summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
authorSrinivasarao P <spathi@codeaurora.org>2018-09-12 10:48:45 +0530
committerSrinivasarao P <spathi@codeaurora.org>2018-09-12 10:49:31 +0530
commit727a8ba0671d43567924016e77a8c5330ecab9a3 (patch)
treecbe574b85278c5fb5e699368b0e60bca9c7b4f6d /drivers/scsi/scsi_sysfs.c
parent77fa429e17cc8c2d10c95d5d5ec10d5073be6c35 (diff)
parentd762e28031e9b01584231acc3ef1c12822ca3fb6 (diff)
Merge android-4.4.154 (d762e28) into msm-4.4
* refs/heads/tmp-d762e28 Linux 4.4.154 cdrom: Fix info leak/OOB read in cdrom_ioctl_drive_status iscsi target: fix session creation failure handling scsi: core: Avoid that SCSI device removal through sysfs triggers a deadlock scsi: sysfs: Introduce sysfs_{un,}break_active_protection() MIPS: lib: Provide MIPS64r6 __multi3() for GCC < 7 MIPS: Correct the 64-bit DSP accumulator register size kprobes: Make list and blacklist root user read only s390/pci: fix out of bounds access during irq setup s390/qdio: reset old sbal_state flags s390: fix br_r1_trampoline for machines without exrl x86/spectre: Add missing family 6 check to microcode check x86/irqflags: Mark native_restore_fl extern inline pinctrl: freescale: off by one in imx1_pinconf_group_dbg_show() ASoC: sirf: Fix potential NULL pointer dereference ASoC: dpcm: don't merge format from invalid codec dai udl-kms: fix crash due to uninitialized memory udl-kms: handle allocation failure udl-kms: change down_interruptible to down fuse: Add missed unlock_page() to fuse_readpages_fill() fuse: Fix oops at process_init_reply() fuse: umount should wait for all requests fuse: fix unlocked access to processing queue fuse: fix double request_end() fuse: Don't access pipe->buffers without pipe_lock() x86/process: Re-export start_thread() x86/speculation/l1tf: Suggest what to do on systems with too much RAM x86/speculation/l1tf: Fix off-by-one error when warning that system has too much RAM x86/speculation/l1tf: Fix overflow in l1tf_pfn_limit() on 32bit KVM: arm/arm64: Skip updating PMD entry if no change KVM: arm/arm64: Skip updating PTE entry if no change arm64: mm: check for upper PAGE_SHIFT bits in pfn_valid() ext4: reset error code in ext4_find_entry in fallback ext4: sysfs: print ext4_super_block fields as little-endian ext4: check for NUL characters in extended attribute's name s390/kvm: fix deadlock when killed by oom btrfs: don't leak ret from do_chunk_alloc smb3: don't request leases in symlink creation and query smb3: Do not send SMB3 SET_INFO if nothing changed cifs: check kmalloc before use cifs: add missing debug entries for kconfig options mm/memory.c: check return value of ioremap_prot scsi: vmw_pvscsi: Return DID_RESET for status SAM_STAT_COMMAND_TERMINATED scsi: fcoe: drop frames in ELS LOGO error path drivers: net: lmc: fix case value for target abort error arc: fix type warnings in arc/mm/cache.c arc: fix build errors in arc/include/asm/delay.h enic: handle mtu change for vf properly Revert "MIPS: BCM47XX: Enable 74K Core ExternalSync for PCIe erratum" tools/power turbostat: Read extended processor family from CPUID zswap: re-check zswap_is_full() after do zswap_shrink() selftests/ftrace: Add snapshot and tracing_on test case cachefiles: Wait rather than BUG'ing on "Unexpected object collision" cachefiles: Fix refcounting bug in backing-file read monitoring fscache: Allow cancelled operations to be enqueued net: axienet: Fix double deregister of mdio bnx2x: Fix invalid memory access in rss hash config path. media: staging: omap4iss: Include asm/cacheflush.h after generic includes i2c: davinci: Avoid zero value of CLKH can: mpc5xxx_can: check of_iomap return before use net: prevent ISA drivers from building on PPC32 atl1c: reserve min skb headroom qed: Fix possible race for the link state value. net: caif: Add a missing rcu_read_unlock() in caif_flow_cb tools/power turbostat: fix -S on UP systems usb: gadget: f_uac2: fix endianness of 'struct cntrl_*_lay3' tools: usb: ffs-test: Fix build on big endian systems usb/phy: fix PPC64 build errors in phy-fsl-usb.c usb: gadget: r8a66597: Fix a possible sleep-in-atomic-context bugs in r8a66597_queue() usb: gadget: r8a66597: Fix two possible sleep-in-atomic-context bugs in init_controller() drm/imx: imx-ldb: check if channel is enabled before printing warning drm/imx: imx-ldb: disable LDB on driver bind scsi: libiscsi: fix possible NULL pointer dereference in case of TMF drm/bridge: adv7511: Reset registers on hotplug nl80211: Add a missing break in parse_station_flags mac80211: add stations tied to AP_VLANs during hw reconfig xfrm: free skb if nlsk pointer is NULL xfrm: fix missing dst_release() after policy blocking lbcast and multicast vti6: fix PMTU caching and reporting on xmit Cipso: cipso_v4_optptr enter infinite loop sched/sysctl: Check user input value of sysctl_sched_time_avg BACKPORT: zram: drop max_zpage_size and use zs_huge_class_size() BACKPORT: zsmalloc: introduce zs_huge_class_size() ANDROID: tracing: fix race condition reading saved tgids Conflicts: mm/zsmalloc.c Change-Id: I1add2f0311c887c135ddc6160963702beeb7bb88 Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r--drivers/scsi/scsi_sysfs.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 9f2c9a2fdd74..55fb1088d0b8 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -678,8 +678,24 @@ static ssize_t
sdev_store_delete(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
- if (device_remove_file_self(dev, attr))
- scsi_remove_device(to_scsi_device(dev));
+ struct kernfs_node *kn;
+
+ kn = sysfs_break_active_protection(&dev->kobj, &attr->attr);
+ WARN_ON_ONCE(!kn);
+ /*
+ * Concurrent writes into the "delete" sysfs attribute may trigger
+ * concurrent calls to device_remove_file() and scsi_remove_device().
+ * device_remove_file() handles concurrent removal calls by
+ * serializing these and by ignoring the second and later removal
+ * attempts. Concurrent calls of scsi_remove_device() are
+ * serialized. The second and later calls of scsi_remove_device() are
+ * ignored because the first call of that function changes the device
+ * state into SDEV_DEL.
+ */
+ device_remove_file(dev, attr);
+ scsi_remove_device(to_scsi_device(dev));
+ if (kn)
+ sysfs_unbreak_active_protection(kn);
return count;
};
static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);