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] [day] [month] [year] [list]
Message-ID: <20230615050947.GA5053@lst.de>
Date:   Thu, 15 Jun 2023 07:09:47 +0200
From:   Christoph Hellwig <hch@....de>
To:     Damien Le Moal <dlemoal@...nel.org>
Cc:     Christoph Hellwig <hch@....de>,
        Alan Stern <stern@...land.harvard.edu>,
        Hannes Reinecke <hare@...e.de>,
        Joe Breuer <linux-kernel@...reuer.net>,
        Bart Van Assche <bvanassche@....org>,
        Bagas Sanjaya <bagasdotme@...il.com>,
        Pavel Machek <pavel@....cz>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <len.brown@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Kees Cook <keescook@...omium.org>,
        Tony Luck <tony.luck@...el.com>,
        "Guilherme G. Piccoli" <gpiccoli@...lia.com>,
        Thorsten Leemhuis <linux@...mhuis.info>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Phillip Potter <phil@...lpotter.co.uk>,
        Linux Power Management <linux-pm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux Hardening <linux-hardening@...r.kernel.org>,
        Linux Regressions <regressions@...ts.linux.dev>,
        Linux SCSI <linux-scsi@...r.kernel.org>,
        Dan Williams <dan.j.williams@...el.com>,
        Hannes Reinecke <hare@...e.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Martin Kepplinger <martin.kepplinger@...i.sm>,
        Kai-Heng Feng <kai.heng.feng@...onical.com>
Subject: Re: Fwd: Waking up from resume locks up on sr device

On Thu, Jun 15, 2023 at 01:57:37PM +0900, Damien Le Moal wrote:
> > No.  scsi_device_get just increments a reference count, and thus
> > prevents ->release from beeing called.  ->remove is not in any way
> > affected by the refcount.
> 
> What ->remove cb are you talking about ? The gendev one ?

The one for the device locked.

> I am trying to understand why the use of device_lock() helps in any way given
> that this is not used by any other functions in scsi. And given that

The device model locks the device before calling ->remove.

> scsi_rescan_device() should always be called with a ref on the scsi device (and
> so on the gendev as well) held, why would this function be racy with device remove ?

Because ->remove ould otherwise be called at the same time as ->rescan.

> Note that I did find a couple of places where scsi_rescan_device() seems to not
> be called with a reference to the scsi dev held, e.g.  store_rescan_field() and
> store_state_field().

You need both a valid reference and ensure ->remove is not called at the
same time.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ