netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ipv4:  potential underflow in compat_ip_setsockopt()
@ 2020-05-23 17:46 Dan Carpenter
  2020-05-26  0:53 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-05-23 17:46 UTC (permalink / raw)
  To: Al Viro, David S. Miller
  Cc: Alexey Kuznetsov, Hideaki YOSHIFUJI, Jakub Kicinski, netdev,
	kernel-janitors

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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---

 net/ipv4/ip_sockglue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index a2469bc57cfe..f43d5f12aa86 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -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;
-- 
2.26.2


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

* Re: [PATCH net-next] ipv4: potential underflow in compat_ip_setsockopt()
  2020-05-23 17:46 [PATCH net-next] ipv4: potential underflow in compat_ip_setsockopt() Dan Carpenter
@ 2020-05-26  0:53 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-05-26  0:53 UTC (permalink / raw)
  To: dan.carpenter; +Cc: viro, kuznet, yoshfuji, kuba, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Sat, 23 May 2020 20:46:48 +0300

> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

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

end of thread, other threads:[~2020-05-26  0:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-23 17:46 [PATCH net-next] ipv4: potential underflow in compat_ip_setsockopt() Dan Carpenter
2020-05-26  0:53 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).