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: <20250216095915.GT17863@unreal>
Date: Sun, 16 Feb 2025 11:59:15 +0200
From: Leon Romanovsky <leon@...nel.org>
To: tianx <tianx@...silicon.com>
Cc: netdev@...r.kernel.org, andrew+netdev@...n.ch, kuba@...nel.org,
	pabeni@...hat.com, edumazet@...gle.com, davem@...emloft.net,
	jeff.johnson@....qualcomm.com, przemyslaw.kitszel@...el.com,
	weihg@...silicon.com, wanry@...silicon.com, horms@...nel.org,
	parthiban.veerasooran@...rochip.com, masahiroy@...nel.org
Subject: Re: [PATCH v4 07/14] net-next/yunsilicon: Init auxiliary device

On Fri, Feb 14, 2025 at 11:14:45AM +0800, tianx wrote:
> On 2025/2/13 22:37, Leon Romanovsky wrote:
> > On Thu, Feb 13, 2025 at 05:14:19PM +0800, Xin Tian wrote:
> >> Initialize eth auxiliary device when pci probing
> >>
> >> Co-developed-by: Honggang Wei <weihg@...silicon.com>
> >> Signed-off-by: Honggang Wei <weihg@...silicon.com>
> >> Co-developed-by: Lei Yan <jacky@...silicon.com>
> >> Signed-off-by: Lei Yan <jacky@...silicon.com>
> >> Signed-off-by: Xin Tian <tianx@...silicon.com>
> >> ---
> >>   .../ethernet/yunsilicon/xsc/common/xsc_core.h |  12 ++
> >>   .../net/ethernet/yunsilicon/xsc/pci/Makefile  |   3 +-
> >>   .../net/ethernet/yunsilicon/xsc/pci/adev.c    | 110 ++++++++++++++++++
> >>   .../net/ethernet/yunsilicon/xsc/pci/adev.h    |  14 +++
> >>   .../net/ethernet/yunsilicon/xsc/pci/main.c    |  10 ++
> >>   5 files changed, 148 insertions(+), 1 deletion(-)
> >>   create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/adev.c
> >>   create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/adev.h
> > <...>

<...>

> >> +	[XSC_ADEV_IDX_ETH] = XSC_ETH_ADEV_NAME,
> >> +};
> >> +
> >> +static void xsc_release_adev(struct device *dev)
> >> +{
> >> +	/* Doing nothing, but auxiliary bus requires a release function */
> >> +}
> > It is unlikely to be true in driver lifetime model. At least you should
> > free xsc_adev here.
> >
> > Thanks
> 
> Hi Leon, xsc_adev has already been freed after calling 
> auxiliary_device_uninit. If I free it again in the release callback, it 
> will cause a double free.

You should follow standard driver lifetime model. Your
auxiliary_device_uninit() is wrong and shouldn't exist from the
beginning.

Thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ