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] [day] [month] [year] [list]
Message-ID: <20180614135845.xzej3zrnhc2bf726@mwanda>
Date:   Thu, 14 Jun 2018 16:58:45 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Zhouyang Jia <jiazhouyang09@...il.com>
Cc:     devel@...verdev.osuosl.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] staging: gdm724x: add error handling for nlmsg_put

On Thu, Jun 14, 2018 at 07:31:51PM +0800, Zhouyang Jia wrote:
> When nlmsg_put fails, the lack of error-handling code may
> cause unexpected results.
> 
> This patch adds error-handling code after calling nlmsg_put.
> 
> Signed-off-by: Zhouyang Jia <jiazhouyang09@...il.com>
> ---
> v1->v2:
> - Add some cleanup
> ---
>  drivers/staging/gdm724x/netlink_k.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/staging/gdm724x/netlink_k.c b/drivers/staging/gdm724x/netlink_k.c
> index abe2425..16da03b 100644
> --- a/drivers/staging/gdm724x/netlink_k.c
> +++ b/drivers/staging/gdm724x/netlink_k.c
> @@ -119,6 +119,11 @@ int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len)
>  	seq++;
>  
>  	nlh = nlmsg_put(skb, 0, seq, type, len, 0);
> +	if (!nlh) {
> +		kfree_skb(skb);
> +		return -EMSGSIZE;
> +	}

As I mentioned earlier, this patch is not required because the we just
allocated the skb and we know that it is large enough.

regards,
dan carpenter


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ