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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <99cd0859-4d7a-92a2-03e6-f0ab7daf2bc8@osg.samsung.com>
Date:   Tue, 6 Mar 2018 13:56:48 +0100
From:   Stefan Schmidt <stefan@....samsung.com>
To:     Eric Dumazet <eric.dumazet@...il.com>,
        David Miller <davem@...emloft.net>
Cc:     netdev <netdev@...r.kernel.org>,
        Alexander Aring <alex.aring@...il.com>,
        linux-wpan@...r.kernel.org
Subject: Re: [PATCH net] ieee802154: 6lowpan: fix possible NULL deref in
 lowpan_device_event()

Hello.


On 03/05/2018 05:51 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@...gle.com>
>
> A tun device type can trivially be set to arbitrary value using
> TUNSETLINK ioctl().
>
> Therefore, lowpan_device_event() must really check that ieee802154_ptr
> is not NULL.
>
> Fixes: 2c88b5283f60d ("ieee802154: 6lowpan: remove check on null")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: Alexander Aring <alex.aring@...il.com>
> Cc: Stefan Schmidt <stefan@....samsung.com>
> Reported-by: syzbot <syzkaller@...glegroups.com>
> ---
>  net/ieee802154/6lowpan/core.c |   12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/net/ieee802154/6lowpan/core.c b/net/ieee802154/6lowpan/core.c
> index 974765b7d92a..e9f0489e4229 100644
> --- a/net/ieee802154/6lowpan/core.c
> +++ b/net/ieee802154/6lowpan/core.c
> @@ -206,9 +206,13 @@ static inline void lowpan_netlink_fini(void)
>  static int lowpan_device_event(struct notifier_block *unused,
>  			       unsigned long event, void *ptr)
>  {
> -	struct net_device *wdev = netdev_notifier_info_to_dev(ptr);
> +	struct net_device *ndev = netdev_notifier_info_to_dev(ptr);

Not sure why you think there is a rename from wdev to ndev necessary.
I see this more of a rolled in cosmetic change, but its not a real problem from my side.

> +	struct wpan_dev *wpan_dev;
>  
> -	if (wdev->type != ARPHRD_IEEE802154)
> +	if (ndev->type != ARPHRD_IEEE802154)
> +		return NOTIFY_DONE;
> +	wpan_dev = ndev->ieee802154_ptr;
> +	if (!wpan_dev)
>  		return NOTIFY_DONE;
>  
>  	switch (event) {
> @@ -217,8 +221,8 @@ static int lowpan_device_event(struct notifier_block *unused,
>  		 * also delete possible lowpan interfaces which belongs
>  		 * to the wpan interface.
>  		 */
> -		if (wdev->ieee802154_ptr->lowpan_dev)
> -			lowpan_dellink(wdev->ieee802154_ptr->lowpan_dev, NULL);
> +		if (wpan_dev->lowpan_dev)
> +			lowpan_dellink(wpan_dev->lowpan_dev, NULL);
>  		break;
>  	default:
>  		return NOTIFY_DONE;
>

Thanks a lot for fixing this and syzbot for finding it.


Acked-by: Stefan Schmidt <stefan@....samsung.com>

Dave, could you take this one directly? I have no other patches pending for your net tree (only net-next) and having a pull request for just
this patch does not make much sense.

regards
Stefan Schmidt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ