Re: [PATCH 2/4] PCI: kirin: Don't put .remove callback in .exit.text section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 03, 2023 at 12:15:24PM +0200, Uwe Kleine-König wrote:
> Hello,
> 
> [dropped Kishon Vijay Abraham  from the list of recipients, their email
> address doesn't work.]
> 
> On Mon, Oct 02, 2023 at 05:12:18PM -0500, Bjorn Helgaas wrote:
> > On Sun, Oct 01, 2023 at 07:02:52PM +0200, Uwe Kleine-König wrote:
> > > With CONFIG_PCIE_KIRIN=y and kirin_pcie_remove() marked with __exit, the
> > > function is discarded from the driver. In this case a bound device can
> > > still get unbound, e.g via sysfs. Then no cleanup code is run resulting
> > > in resource leaks or worse.
> > 
> > kirin_pcie_driver sets .suppress_bind_attrs = true.
> > 
> > Doesn't that mean that we can't unbind a device via sysfs in this
> > case?
> 
> Oh indeed, that's something I missed.
>  
> > I don't expect modpost to know about .suppress_bind_attrs, so maybe we
> > should remove the __exit annotation even if it would be safe to keep
> > it in this case.  It's a tiny function anyway.
> 
> the right thing to do then is something like:
> https://lore.kernel.org/linux-rtc/20231002080529.2535610-7-u.kleine-koenig@xxxxxxxxxxxxxx
> 
> And then it would be consequent to also switch to
> module_platform_driver_probe and move .probe to __init. Or drop
> .suppress_bind_attrs and keep/put .probe() and .remove() in .text.

The other three patches in this series don't suffer from this oversight
and so are (from my POV) ready to go in.

If you tell me, which option you prefer for the kirin driver, I'll
follow up with a matching patch. (If you don't know, my preference would
be to drop .suppress_bind_attrs and move .probe() and .remove() to
.text.)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux