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:   Sat, 26 Oct 2019 20:08:29 +0200
From:   Markus Elfring <Markus.Elfring@....de>
To:     Navid Emamdoost <navid.emamdoost@...il.com>, linux-wimax@...el.com,
        netdev@...r.kernel.org
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org,
        Navid Emamdoost <emamd001@....edu>, Kangjie Lu <kjlu@....edu>,
        Stephen McCamant <smccaman@....edu>,
        "David S. Miller" <davem@...emloft.net>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Inaky Perez-Gonzalez <inaky.perez-gonzalez@...el.com>
Subject: Re: [PATCH] wimax: i2400: Fix memory leak in
 i2400m_op_rfkill_sw_toggle

> Move kfree(cmd) before return to be reached by all execution paths.

I suggest to reconsider this change suggestion once more.


> Fixes: 2507e6ab7a9a ("wimax: i2400: fix memory leak")

I find it interesting that you would like to fix your commit from 2019-09-10.
https://lore.kernel.org/patchwork/patch/1126399/

Will it be helpful to refer also to the commit 024f7f31ed15c471f80408d8b5045497e27e1135
("i2400m: Generic probe/disconnect, reset and message passing" from 2009-01-07)?


> +++ b/drivers/net/wimax/i2400m/op-rfkill.c
> @@ -127,12 +127,12 @@ int i2400m_op_rfkill_sw_toggle(struct wimax_dev *wimax_dev,
>  			"%d\n", result);
>  	result = 0;
>  error_cmd:
> -	kfree(cmd);
>  	kfree_skb(ack_skb);
>  error_msg_to_dev:
>  error_alloc:
>  	d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n",
>  		wimax_dev, state, result);
> +	kfree(cmd);
>  	return result;
>  }


I would prefer to improve the exception handling like the following.
(Would you like to avoid passing a null pointer at the end?)

-error_cmd:
+free_skb:
-	kfree(cmd);
 	kfree_skb(ack_skb);
-error_msg_to_dev:
+free_cmd:
+	kfree(cmd);
-error_alloc:
+exit:


How do you think about this update variant?

Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ