AW: [PATCH] sd: sd_open: prevent device removal during sd_open

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

 



>On Thu, Sep 02, 2021 at 01:57:13PM +0000, Christian L?hle wrote:
>> sd and parent devices must not be removed as sd_open checks for events
>> 
>> sd_need_revalidate and sd_revalidate_disk traverse the device path
>> to check for event changes. If during this, e.g. the scsi host is being
>> removed and its resources freed, this traversal crashes.
>> Locking with scan_mutex for just a scsi disk open may seem blunt, but there
>> does not seem to be a more granular option. Also opening /dev/sdX directly
>> happens rarely enough that this shouldn't cause any issues.
>
> Can you please root cause how the device could not be valid, as that
> should not happen?

The device is being removed physically, the driver e.g. uas calls
scsi_remove_host while user-space opens the /dev/sdX.

>>
>> The issue occurred on an older kernel with the following trace:
>> stack segment: 0000 [#1] PREEMPT SMP PTI
>> CPU: 1 PID: 121457 Comm: python3 Not tainted 4.14.238hyLinux #1
>
> .. preferably with a current mainline kernel as things changed a lot
> in this area.

I will, but might take a while to get a setup to reproduce the issue.
(The setup where this occurred actually powerfails the usb device repreatedly.)=
Hyperstone GmbH | Line-Eid-Strasse 3 | 78467 Konstanz
Managing Directors: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux