All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.10 1/7] netlabel: fix shift wrapping bug in netlbl_catmap_setlong()
@ 2023-08-29 13:33 Sasha Levin
  2023-08-29 13:33 ` [PATCH AUTOSEL 5.10 2/7] bnx2x: fix page fault following EEH recovery Sasha Levin
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Sasha Levin @ 2023-08-29 13:33 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dmitry Mastykin, Paul Moore, David S . Miller, Sasha Levin,
	edumazet, kuba, pabeni, netdev, linux-security-module

From: Dmitry Mastykin <dmastykin@astralinux.ru>

[ Upstream commit b403643d154d15176b060b82f7fc605210033edd ]

There is a shift wrapping bug in this code on 32-bit architectures.
NETLBL_CATMAP_MAPTYPE is u64, bitmap is unsigned long.
Every second 32-bit word of catmap becomes corrupted.

Signed-off-by: Dmitry Mastykin <dmastykin@astralinux.ru>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/netlabel/netlabel_kapi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
index 91b35b7c80d82..96059c99b915e 100644
--- a/net/netlabel/netlabel_kapi.c
+++ b/net/netlabel/netlabel_kapi.c
@@ -857,7 +857,8 @@ int netlbl_catmap_setlong(struct netlbl_lsm_catmap **catmap,
 
 	offset -= iter->startbit;
 	idx = offset / NETLBL_CATMAP_MAPSIZE;
-	iter->bitmap[idx] |= bitmap << (offset % NETLBL_CATMAP_MAPSIZE);
+	iter->bitmap[idx] |= (NETLBL_CATMAP_MAPTYPE)bitmap
+			     << (offset % NETLBL_CATMAP_MAPSIZE);
 
 	return 0;
 }
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 5.10 1/7] netlabel: fix shift wrapping bug in netlbl_catmap_setlong()
@ 2023-06-26 21:51 Sasha Levin
  2023-06-26 21:51 ` [PATCH AUTOSEL 5.10 2/7] bnx2x: fix page fault following EEH recovery Sasha Levin
  0 siblings, 1 reply; 10+ messages in thread
From: Sasha Levin @ 2023-06-26 21:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dmitry Mastykin, Paul Moore, David S . Miller, Sasha Levin,
	edumazet, kuba, pabeni, netdev, linux-security-module

From: Dmitry Mastykin <dmastykin@astralinux.ru>

[ Upstream commit b403643d154d15176b060b82f7fc605210033edd ]

There is a shift wrapping bug in this code on 32-bit architectures.
NETLBL_CATMAP_MAPTYPE is u64, bitmap is unsigned long.
Every second 32-bit word of catmap becomes corrupted.

Signed-off-by: Dmitry Mastykin <dmastykin@astralinux.ru>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/netlabel/netlabel_kapi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
index 91b35b7c80d82..96059c99b915e 100644
--- a/net/netlabel/netlabel_kapi.c
+++ b/net/netlabel/netlabel_kapi.c
@@ -857,7 +857,8 @@ int netlbl_catmap_setlong(struct netlbl_lsm_catmap **catmap,
 
 	offset -= iter->startbit;
 	idx = offset / NETLBL_CATMAP_MAPSIZE;
-	iter->bitmap[idx] |= bitmap << (offset % NETLBL_CATMAP_MAPSIZE);
+	iter->bitmap[idx] |= (NETLBL_CATMAP_MAPTYPE)bitmap
+			     << (offset % NETLBL_CATMAP_MAPSIZE);
 
 	return 0;
 }
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-09-04  0:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-29 13:33 [PATCH AUTOSEL 5.10 1/7] netlabel: fix shift wrapping bug in netlbl_catmap_setlong() Sasha Levin
2023-08-29 13:33 ` [PATCH AUTOSEL 5.10 2/7] bnx2x: fix page fault following EEH recovery Sasha Levin
2023-08-29 13:33 ` [PATCH AUTOSEL 5.10 3/7] smb/client: print "Unknown" instead of bogus link speed value Sasha Levin
2023-08-29 13:33 ` [PATCH AUTOSEL 5.10 4/7] sctp: handle invalid error codes without calling BUG() Sasha Levin
2023-08-29 13:33 ` [PATCH AUTOSEL 5.10 5/7] cifs: add a warning when the in-flight count goes negative Sasha Levin
2023-08-29 13:47   ` Greg KH
2023-09-04  0:35     ` Sasha Levin
2023-08-29 13:33 ` [PATCH AUTOSEL 5.10 6/7] scsi: storvsc: Always set no_report_opcodes Sasha Levin
2023-08-29 13:33 ` [PATCH AUTOSEL 5.10 7/7] ALSA: seq: oss: Fix racy open/close of MIDI devices Sasha Levin
  -- strict thread matches above, loose matches on Subject: below --
2023-06-26 21:51 [PATCH AUTOSEL 5.10 1/7] netlabel: fix shift wrapping bug in netlbl_catmap_setlong() Sasha Levin
2023-06-26 21:51 ` [PATCH AUTOSEL 5.10 2/7] bnx2x: fix page fault following EEH recovery Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.