lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210118203954.15553706@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Mon, 18 Jan 2021 20:39:54 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     wangyingjie55@....com
Cc:     davem@...emloft.net, kuznet@....inr.ac.ru, yoshfuji@...ux-ipv6.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Nikolay Aleksandrov <nikolay@...dia.com>
Subject: Re: [PATCH v1] ipv4: add iPv4_is_multicast() check in
 ip_mc_leave_group().

On Sun, 17 Jan 2021 05:34:16 -0800 wangyingjie55@....com wrote:
> From: Yingjie Wang <wangyingjie55@....com>
> 
> There is no iPv4_is_multicast() check added to ip_mc_leave_group()
> to check if imr->imr_multiaddr.s_addr is a multicast address.
> If not a multicast address, it may result in an error.

Could you please say more? From looking at the code it seems like
no address should match if group is non-mcast, and -EADDRNOTAVAIL 
will be returned.

Adding Nik to CC.

> In some cases, the callers of ip_mc_leave_group() don't check
> whether it is multicast address or not before calling
> such as do_ip_setsockopt(). So I suggest adding the ipv4_is_multicast()
> check to the ip_mc_leave_group() to prevent this from happening.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Yingjie Wang <wangyingjie55@....com>
> ---
>  net/ipv4/igmp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
> index 7b272bbed2b4..1b6f91271cfd 100644
> --- a/net/ipv4/igmp.c
> +++ b/net/ipv4/igmp.c
> @@ -2248,6 +2248,9 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
>  	u32 ifindex;
>  	int ret = -EADDRNOTAVAIL;
>  
> +	if (!ipv4_is_multicast(group))
> +		return -EINVAL;
> +
>  	ASSERT_RTNL();
>  
>  	in_dev = ip_mc_find_dev(net, imr);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ