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: <5719F047.80102@marvell.com>
Date:	Fri, 22 Apr 2016 11:35:03 +0200
From:	Lino Sanfilippo <lsanfil@...vell.com>
To:	Sabrina Dubroca <sd@...asysnail.net>, <netdev@...r.kernel.org>
CC:	Lance Richardson <lrichard@...hat.com>,
	Hannes Frederic Sowa <hannes@...essinduktion.org>,
	Johannes Berg <johannes@...solutions.net>,
	Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH net v2 1/9] macsec: add missing NULL check after kmalloc



On 22.04.2016 11:28, Sabrina Dubroca wrote:
> Fixes: c09440f7dcb3 ("macsec: introduce IEEE 802.1AE driver")
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Sabrina Dubroca <sd@...asysnail.net>
> Acked-by: Hannes Frederic Sowa <hannes@...essinduktion.org>
> ---
>   drivers/net/macsec.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
> index 84d3e5ca8817..f691030ee3df 100644
> --- a/drivers/net/macsec.c
> +++ b/drivers/net/macsec.c
> @@ -1622,8 +1622,8 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)
>   	}
>
>   	rx_sa = kmalloc(sizeof(*rx_sa), GFP_KERNEL);
> -	if (init_rx_sa(rx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]), secy->key_len,
> -		       secy->icv_len)) {
> +	if (!rx_sa || init_rx_sa(rx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]),
> +				 secy->key_len, secy->icv_len)) {
>   		rtnl_unlock();
>   		return -ENOMEM;
>   	}


In case that kmalloc was successful and init_rx_sa failed, the allocated memory should be freed, shouldnt it?.

Regards,
Lino

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ