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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9308e357ecff18971b216c5e037b89b66acf7606.camel@HansenPartnership.com>
Date: Mon, 19 Jan 2026 11:02:55 -0500
From: James Bottomley <James.Bottomley@...senPartnership.com>
To: Tzung-Bi Shih <tzungbi@...nel.org>
Cc: "Martin K. Petersen" <martin.petersen@...cle.com>, Greg KH
	 <gregkh@...uxfoundation.org>, linux-scsi@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scsi: core: Don't free dev_name() manually

On Mon, 2026-01-19 at 22:28 +0800, Tzung-Bi Shih wrote:
> On Sun, Jan 18, 2026 at 09:45:26AM -0500, James Bottomley wrote:
> > On Sun, 2026-01-18 at 03:32 +0800, Tzung-Bi Shih wrote:
[...]
> > > >  
> > > >  static struct class shost_class = {
> > > > @@ -279,11 +278,9 @@ int scsi_add_host_with_dma(struct
> > > > Scsi_Host
> > > > *shost, struct device *dev,
> > > >   goto out_disable_runtime_pm;
> > > >  
> > > >   scsi_host_set_state(shost, SHOST_RUNNING);
> > > > - get_device(shost->shost_gendev.parent);
> > 
> > We need a reference to the parent to prevent surprise removal ...
> > where else is the reference held?
> 
> It looks to me the same question as above.  IIUC, device_add() holds
> a reference count to its parent[3].  Drivers don't need to do it
> explicitly.

That's not good enough for SCSI: we have a rather complicated state
model for hosts.  device_add() doesn't occur until the host moves out
of the SHOST_CREATED state, which can be quite a time after device
_initialize() so something has to pin the resources until then, which
is why these references are taken.   You're certainly free to suggest a
different way of doing this, but you can't just get rid of the existing
mechanism without replacing it with something else.

Regards,

Jaems


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ