Skip to contentSkip to conversation

ipv4: potential underflow in compat_ip_setsockopt()

PATCH Applied Dan Carpenter 2 participants 2 messages May 23, 2020 – May 26, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv4: potential underflow in compat_ip_setsockopt()

The value of "n" is capped at 0x1ffffff but it checked for negative values. I don't think this causes a problem but I'm not certain and it's harmless to prevent it.

Fixes 2e04172875c9 ("ipv4: do compat setsockopt for MCAST_MSFILTER directly")

---

 net/ipv4/ip_sockglue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/ip_sockglue.c +1 -1
index a2469bc57cfe..f43d5f12aa86 100644
@@ -1347,8 +1347,8 @@ int compat_ip_setsockopt(struct sock *sk, int level, int optname,
 	{
 		const int size0 = offsetof(struct compat_group_filter, gf_slist);
 		struct compat_group_filter *gf32;
+		unsigned int n;
 		void *p;
-		int n;
 
 		if (optlen < size0)
 			return -EINVAL;
Signature · 1 line
2.26.2
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Sat, 23 May 2020 20:46:48 +0300

Quoted 6 lines

The value of "n" is capped at 0x1ffffff but it checked for negative values. I don't think this causes a problem but I'm not certain and it's harmless to prevent it.

Fixes 2e04172875c9 ("ipv4: do compat setsockopt for MCAST_MSFILTER directly")

Applied.