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: <ca1c4de5-537a-4aa9-851d-d37ce800fdac@lunn.ch>
Date: Thu, 23 May 2024 15:01:55 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Xiaolei Wang <xiaolei.wang@...driver.com>
Cc: wei.fang@....com, shenwei.wang@....com, xiaoning.wang@....com,
	davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com, imx@...ts.linux.dev, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [v2 PATCH] net: fec: free fec queue when fec_probe() fails or
 fec_drv_remove()

On Thu, May 23, 2024 at 02:29:20PM +0800, Xiaolei Wang wrote:
> commit 59d0f7465644 ("net: fec: init multi queue date structure")
> allocates multiple queues, which should be cleaned up when fec_probe()
> fails or fec_drv_remove(), otherwise a memory leak will occur.
> 
> unreferenced object 0xffffff8010350000 (size 8192):
>   comm "kworker/u8:3", pid 39, jiffies 4294893562
>   hex dump (first 32 bytes):
>     02 00 00 00 00 00 00 00 00 50 06 8a c0 ff ff ff  .........P......
>     e0 6f 06 8a c0 ff ff ff 00 50 06 8a c0 ff ff ff  .o.......P......
>   backtrace (crc f1b8b79f):
>     [<0000000057d2c6ae>] kmemleak_alloc+0x34/0x40
>     [<000000003c413e60>] kmalloc_trace+0x2f8/0x460
>     [<00000000663f64e6>] fec_probe+0x1364/0x3a04
>     [<0000000024d7e427>] platform_probe+0xc4/0x198
>     [<00000000293aa124>] really_probe+0x17c/0x4f0
>     [<00000000dfd1e0f3>] __driver_probe_device+0x158/0x2c4
> 
> Fixes: 59d0f7465644 ("net: fec: init multi queue date structure")
> Signed-off-by: Xiaolei Wang <xiaolei.wang@...driver.com>

Please read what i suggested. It is good to have code which is
symmetric. probe() and remove() should be opposites of each other.
probe() calls fec_enet_init(). So it would be good to have remove()
call fec_enet_deinit() which does the opposite. We then have symmetry.

Is there anything else in fec_enet_init() which needs undoing? A rule
of thumb: If you find a bug, look around, there might be others
nearby. Maybe leaking the queues is not the only problem?

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ