No description
Find a file
Tony Battersby f135c65085 scsi: sg: Allow waiting for commands to complete on removed device
commit 3455607fd7 upstream.

When a SCSI device is removed while in active use, currently sg will
immediately return -ENODEV on any attempt to wait for active commands that
were sent before the removal.  This is problematic for commands that use
SG_FLAG_DIRECT_IO since the data buffer may still be in use by the kernel
when userspace frees or reuses it after getting ENODEV, leading to
corrupted userspace memory (in the case of READ-type commands) or corrupted
data being sent to the device (in the case of WRITE-type commands).  This
has been seen in practice when logging out of a iscsi_tcp session, where
the iSCSI driver may still be processing commands after the device has been
marked for removal.

Change the policy to allow userspace to wait for active sg commands even
when the device is being removed.  Return -ENODEV only when there are no
more responses to read.

Link: https://lore.kernel.org/r/5ebea46f-fe83-2d0b-233d-d0dcb362dd0a@cybernetics.com
Cc: <stable@vger.kernel.org>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-25 11:18:17 +02:00
arch KVM: x86: Avoid theoretical NULL pointer dereference in kvm_irq_delivery_to_apic_fast() 2022-08-25 11:18:16 +02:00
block blk-mq: don't create hctx debugfs dir until q->debugfs_dir is created 2022-08-25 11:17:36 +02:00
certs certs/blacklist_hashes.c: fix const confusion in certs blacklist 2022-06-22 14:11:22 +02:00
crypto crypto: drbg - make reseeding from get_random_bytes() synchronous 2022-06-22 14:11:18 +02:00
Documentation x86: Handle idle=nomwait cmdline properly for x86_idle 2022-08-25 11:17:28 +02:00
drivers scsi: sg: Allow waiting for commands to complete on removed device 2022-08-25 11:18:17 +02:00
fs btrfs: reject log replay if there is unsupported RO compat flag 2022-08-25 11:18:16 +02:00
include KVM: Add infrastructure and macro to mark VM as bugged 2022-08-25 11:18:16 +02:00
init random: handle latent entropy and command line from random_init() 2022-06-22 14:11:17 +02:00
ipc ipc/mqueue: use get_tree_nodev() in mqueue_get_tree() 2022-06-14 18:11:41 +02:00
kernel timekeeping: contribute wall clock to rng on time change 2022-08-25 11:18:15 +02:00
lib locking/refcount: Consolidate implementations of refcount_t 2022-07-29 17:14:17 +02:00
LICENSES
mm mm/mmap.c: fix missing call to vm_unacct_memory in mmap_region 2022-08-25 11:17:58 +02:00
net tcp: fix over estimation in sk_forced_mem_schedule() 2022-08-25 11:18:17 +02:00
samples samples/kretprobes: Fix return value if register_kretprobe() failed 2021-11-17 09:48:39 +01:00
scripts scripts/faddr2line: Fix vmlinux detection on arm64 2022-08-25 11:18:08 +02:00
security selinux: Add boundary check in put_entry() 2022-08-25 11:17:32 +02:00
sound ASoC: audio-graph-card: Add of_node_put() in fail path 2022-08-25 11:18:05 +02:00
tools tools/thermal: Fix possible path truncations 2022-08-25 11:18:09 +02:00
usr
virt KVM: Add infrastructure and macro to mark VM as bugged 2022-08-25 11:18:16 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS MAINTAINERS: co-maintain random.c 2022-06-22 14:11:05 +02:00
Makefile Makefile: link with -z noexecstack --no-warn-rwx-segments 2022-08-25 11:17:17 +02:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.