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]
Date:	Wed, 08 Sep 2010 07:19:45 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	jovi zhang <bookjovi@...il.com>
Cc:	"David S. Miller" <davem@...emloft.net>,
	Johannes Berg <johannes.berg@...el.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Alexey Dobriyan <adobriyan@...nvz.org>,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] netlink: Fix kfree NULL pointer

Le mercredi 08 septembre 2010 à 13:13 +0800, jovi zhang a écrit :
> It will kfree NULL pointer if listeners is NULL. fix it.
> 
> Signed-off-by: bookjovi@...il.com
> net/netlink/af_netlink.c |    5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
> index 980fe4a..1c7bf48 100644
> --- a/net/netlink/af_netlink.c
> +++ b/net/netlink/af_netlink.c
> @@ -1532,8 +1532,10 @@ netlink_kernel_create(struct net *net, int
> unit, unsigned int groups,
>        if (input)
>                nlk_sk(sk)->netlink_rcv = input;
> 
> -       if (netlink_insert(sk, net, 0))
> +       if (netlink_insert(sk, net, 0)) {
> +               kfree(listeners);
>                goto out_sock_release;
> +       }
> 
>        nlk = nlk_sk(sk);
>        nlk->flags |= NETLINK_KERNEL_SOCKET;
> @@ -1553,7 +1555,6 @@ netlink_kernel_create(struct net *net, int unit,
> unsigned int groups,
>        return sk;
> 
> out_sock_release:
> -       kfree(listeners);
>        netlink_kernel_release(sk);
>        return NULL;


This patch is not needed

kfree(NULL) is legal



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ