commit 021fae688d1e6d826e6e755ac10ae0e4126834c9 Author: Tal Zussman Date: Mon Nov 16 16:06:54 2026 -0500 scsi: scsi_debug: Reset protection information on zone reset zbc_rwp_zone() zeroes the data of a zone that is reset, but leaves the protection information of its previous contents in place. Reads of a zoned device are not limited to the blocks below the write pointer, so with DIX enabled reading those blocks back fails the guard check. Write to a zone, reset it and read it back: # modprobe scsi_debug zbc=managed sector_size=4096 dev_size_mb=64 \ zone_size_mb=4 dif=1 dix=1 # dd if=/dev/urandom of=/dev/sda bs=1M count=1 seek=8 oflag=direct # blkzone reset -o 16384 -c 1 /dev/sda # dd if=/dev/sda of=/dev/null bs=1M count=1 skip=8 iflag=direct dd: error reading '/dev/sda': Invalid or incomplete multibyte or wide character The read fails with EILSEQ, and the guard tag that the device reports is still that of the data that was written, while the block now holds zeroes: scsi_debug:dif_verify: GUARD check failed on sector 2048 rcvd 0x288f, data 0x0000 protection error, dev sda, sector 16384 op 0x0:(READ) flags 0x10800 phys_seg 256 prio class 2 Reset the protection information of the zeroed blocks to 0xff, as unmap_region() does, so that they are not checked until they are written again. Fixes: 2d62253eb1b6 ("scsi: scsi_debug: Zero clear zones at reset write pointer") Signed-off-by: Tal Zussman Reviewed-by: Damien Le Moal Link: https://patch.msgid.link/20261116-scsi-debug-zone-reset-v2-2-83c8a9841f4c@columbia.edu Signed-off-by: Martin K. Petersen (Oracle) commit 78f28a31d7d688054c95b5299845db8fb6e1308c Author: Tal Zussman Date: Mon Nov 16 16:06:53 2026 -0500 scsi: scsi_debug: Wrap around the store when zeroing a reset zone zbc_rwp_zone() zeroes the blocks of a zone that is reset, using the start of the zone as an offset into the store. With virtual_gb set, the device and its zones can extend past the end of the store, which is only dev_size_mb in size. Writes wrap around in do_device_access(), but the memset() doesn't, so resetting a zone that has been written to can write past the end of the store. On a device whose fifth zone starts exactly at the end of the store, write to that zone and reset it: # modprobe scsi_debug zbc=managed sector_size=4096 dev_size_mb=16 \ virtual_gb=1 zone_size_mb=4 # dd if=/dev/urandom of=/dev/sda bs=1M count=1 seek=16 oflag=direct # blkzone reset -o 32768 -c 1 /dev/sda The memset() starts at the first byte past the store, in the guard page after the vmalloc'ed area, for the 1 MiB that was written: BUG: unable to handle page fault for address: ffffc90002c00000 Oops: Oops: 0002 [#1] SMP KASAN NOPTI RIP: 0010:memset_orig+0x33/0xb0 RDX: 0000000000100000 RSI: 0000000000000000 RDI: ffffc90002c00000 Call Trace: zbc_rwp_zone+0x1a7/0x2a0 [scsi_debug] resp_rwp_zone+0x19c/0x450 [scsi_debug] schedule_resp+0x2dd/0xbc0 [scsi_debug] scsi_debug_queuecommand+0x1286/0x2950 [scsi_debug] scsi_queue_rq+0x1d74/0x3200 blk_mq_dispatch_rq_list+0x3ad/0x23c0 The command never completes, so the reset returns EIO to userspace and the device is unusable afterwards. Zero the blocks in a helper that wraps around at the end of the store, and that stops after one pass over it for a zone that is larger than the store. Fixes: 2d62253eb1b6 ("scsi: scsi_debug: Zero clear zones at reset write pointer") Signed-off-by: Tal Zussman Reviewed-by: Damien Le Moal Link: https://patch.msgid.link/20261116-scsi-debug-zone-reset-v2-1-83c8a9841f4c@columbia.edu Signed-off-by: Martin K. Petersen (Oracle) commit f505b951db60ddbcd291a8b3f338b97b9b338228 Author: Shao Mingyin Date: Tue Nov 10 23:11:26 2026 +0800 scsi: core: proc: Use snprintf() for the host number scsi_proc_host_add() and scsi_proc_host_rm() format shost->host_no into a 10-byte buffer with sprintf(). host_no is an unsigned int and can reach ten digits. The %d output plus the terminator then overflows the buffer, and a bounded format would truncate a ten-digit number to nine digits, colliding with an existing procfs entry. Widen the buffer to 11 bytes, use snprintf(), and print with %u to match the type. Ten-digit host numbers are written in full, the overflow is gone, and W=1 no longer reports -Wformat-truncation. Reported-by: Sashiko Link: https://lore.kernel.org/all/sashiko-outbox-204381@kernel.org/ Signed-off-by: Shao Mingyin Link: https://patch.msgid.link/20261110231126279OKrUUjTUMgoJ1kpbNZrCV@zte.com.cn Signed-off-by: Martin K. Petersen (Oracle) commit 4028e065184be8642325ddb6ea59b60dbe59a6ae Author: Ranjan Kumar Date: Thu Nov 19 12:41:32 2026 +0530 scsi: mpi3mr: Use the correct conversion for the diag buffer post request The diag buffer post request is filled in with le64_to_cpu and le32_to_cpu where cpu_to_le64 and cpu_to_le32 are meant. Both swap bytes the same way, so the result does not change, but sparse reports the wrong direction. Use the helpers that match the direction. Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-21-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit 3ffd4ddbc0110441f6c525207e13bba4337033ef Author: Ranjan Kumar Date: Thu Nov 19 12:41:31 2026 +0530 scsi: mpi3mr: Fix byte order of the BSG status reply The status reply returned for a BSG MPT command stores the IOC status and log info in little endian fields without converting them from CPU byte order, so a big endian host returns swapped values to the application. Convert both values to little endian. Fixes: 506bc1a0d6ba ("scsi: mpi3mr: Add support for MPT commands") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=2 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-20-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit b02157ba7c1f9658ad10af48519dd8bdd71e90a3 Author: Ranjan Kumar Date: Thu Nov 19 12:41:30 2026 +0530 scsi: mpi3mr: Fix byte order handling in the NVMe passthrough commands The NVMe passthrough code reads the command dword that selects PRP or SGL and applies the SGE modifier to the addresses without converting between CPU and little endian byte order. On a big endian host the wrong data format is chosen and the modifier bits end up in the wrong place of the address. Convert the command dword when reading it, and keep the modifier mask and value in little endian form like the address fields they are applied to. Fixes: 7dbd0dd8cde3 ("scsi: mpi3mr: Add support for NVMe passthrough") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=2 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-19-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit 93b373f0d4e0eb9ae88e5c45e222675b6ecc9494 Author: Ranjan Kumar Date: Thu Nov 19 12:41:29 2026 +0530 scsi: mpi3mr: Fix partly written and lost entries in the log data buffer Log data events are saved from the event handlers while the get and enable ioctls read and publish the same buffer, index and entry size, all without a lock. A read can return an entry that is only partly written, and two events handled at the same time can take the same index so one is lost. Add a lock for the log data buffer and take it in the writer and in both ioctls. Fixes: f5e6d5a34376 ("scsi: mpi3mr: Add support for driver commands") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=5 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-18-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit dcc72f9dbaaacb11068d87f10b235f72ed8eddb7 Author: Ranjan Kumar Date: Thu Nov 19 12:41:28 2026 +0530 scsi: mpi3mr: Fix sense buffer use after free on BSG command completion The interrupt handler writes the reply and sense data of a BSG command into the command tracker while the ioctl can time out, clear the sense buffer pointer and free the buffer at the same time. Add a lock to the command tracker and take it in the handler, the reset flush and the ioctl. The callbacks run under it and never sleep. Also initialize the two PEL trackers, which never had their lock set up. Fixes: f762326b2baa ("scsi: mpi3mr: Propagate sense data for admin queue SCSI I/O") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=1 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=1 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=4 Closes: https://sashiko.dev/#/patchset/20261104120103.503871-1-ranjan.kumar@broadcom.com?part=16 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-17-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit 572eaf1f4249740888017f2de95ded895d2c5569 Author: Ranjan Kumar Date: Thu Nov 19 12:41:27 2026 +0530 scsi: mpi3mr: Fix block_io accounting when a target is re-created during BSG A BSG task management request raises block_io on the SCSI target private data when it starts and lowers it when it completes. If the target is removed and created again while the command waits, the new private data can be allocated at the address of the old one. The address check then passes and the command lowers block_io of the new target, which may be held by another path. Give each private data a sequence number and lower block_io only when the number is the same as when the command started. Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20261104120103.503871-1-ranjan.kumar@broadcom.com?part=15 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-16-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit 85abd02a51c7d1bb69d80ea7e437e7239f8b7b9a Author: Ranjan Kumar Date: Thu Nov 19 12:41:26 2026 +0530 scsi: mpi3mr: Fix target private data use after free in BSG passthrough A BSG task management request raises block_io on the SCSI target private data and lowers it after the command completes. The pointer is read without a lock and the target device reference is dropped before the wait. If the device is removed meanwhile, the private data is freed and block_io is decremented in freed memory. Update the count under the target device lock and keep the target device reference until the count is released. Lower the count only if the target still has the private data it was raised on. Fixes: 506bc1a0d6ba ("scsi: mpi3mr: Add support for MPT commands") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=3 Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=4 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=1 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=3 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=4 Closes: https://sashiko.dev/#/patchset/20261104120103.503871-1-ranjan.kumar@broadcom.com?part=14 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-15-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit 83d010edd8df39978256d24f3d6f31d15c926f81 Author: Ranjan Kumar Date: Thu Nov 19 12:41:25 2026 +0530 scsi: mpi3mr: Fix the lowest phy number for phys 32 and above The phy mask is 64 bits wide but the lowest phy of a port is found with a call that takes a 32-bit value, so only the low 32 bits of the mask are looked at. For a port with only phys 32 and above the lowest phy comes out as -1. Find the lowest phy in the whole mask. Fixes: cb5b60894602 ("scsi: mpi3mr: Increase maximum number of PHYs to 64 from 32") Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-14-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit 2d6e97aabc30d8027d959da38b6c7ce205fb3aee Author: Ranjan Kumar Date: Thu Nov 19 12:41:24 2026 +0530 scsi: mpi3mr: Fix empty device list race in the all targets query The number of target devices is counted under the target lock but the list is tested for emptiness later without it. If the devices go away in between, the user is given a count with no device list. Decide from the count that was taken under the lock. Fixes: f5e6d5a34376 ("scsi: mpi3mr: Add support for driver commands") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=13 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-13-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit 7a94105f9408b570ebb0748ad2bfe399cd3cb255 Author: Ranjan Kumar Date: Thu Nov 19 12:41:23 2026 +0530 scsi: mpi3mr: Fix the 32 bit shift when building the phy mask The phy mask is 64 bits wide but the bit for a phy is built with a 32 bit shift. For phy numbers 31 and above the result is wrong or undefined, so the mask gets the wrong bits for those phys. Build the bit with a 64 bit shift. Fixes: cb5b60894602 ("scsi: mpi3mr: Increase maximum number of PHYs to 64 from 32") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=12 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=12 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-12-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit 0f94a44009c05e48ab3d65d38cb4e734b7de6eea Author: Ranjan Kumar Date: Thu Nov 19 12:41:22 2026 +0530 scsi: mpi3mr: Fix target device reference leaks Looking up a target device takes a reference. When a target allocation is refused, or when a device has no HBA port, the reference is not released, so the device is never freed and its count grows with every rescan. Release the reference on these paths. Fixes: 13ef29ea4aa0 ("scsi: mpi3mr: Add support for device add/remove event handling") Fixes: 626665e9c38d ("scsi: mpi3mr: Get target object based on rphy") Fixes: 8e45183978d6 ("scsi: mpi3mr: Bad drive in topology results kernel crash") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=9 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=9 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-11-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit e9642e4dc551dfc1401adc5bc21ff254c42c02cf Author: Ranjan Kumar Date: Thu Nov 19 12:41:21 2026 +0530 scsi: mpi3mr: Queue DEVICE_INFO_CHANGED events to the bottom half again The DEVICE_INFO_CHANGED event shares its case with the LOG_DATA event. When the log data handling was added to that case, DEVICE_INFO_CHANGED stopped being queued to the bottom half, so device information changes are no longer applied and the event is saved as log data instead. Give DEVICE_INFO_CHANGED its own case that queues the bottom half. Fixes: d0d19250ed81 ("scsi: mpi3mr: Rename log data save helper to reflect threaded/BH context") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=5 Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=11 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=11 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-10-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit ac7df6cdd9983db0acebc850ed3ea86c82246013 Author: Ranjan Kumar Date: Thu Nov 19 12:41:20 2026 +0530 scsi: mpi3mr: Fix integer overflow in the log data size calculation The number of log entries and their total size are held in 16 bits. With a large entry size the product wraps around, so the driver copies only part of the log data and still reports success. Use 32 bit variables for both values. Fixes: f5e6d5a34376 ("scsi: mpi3mr: Add support for driver commands") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=5 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=13 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-9-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit 2057dfcc96c087035458af956dbd54f2f1d1bcbe Author: Ranjan Kumar Date: Thu Nov 19 12:41:19 2026 +0530 scsi: mpi3mr: Fix integer overflow in the HDB upload bounds check The start offset and the length of an HDB upload request are added in 32 bits and compared with the buffer size. A large offset makes the sum wrap around and pass the check, so the copy reads far outside the buffer. Reject the request if the sum overflows. Fixes: 78b506984ebe ("scsi: mpi3mr: Add ioctl support for HDB") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=15 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-8-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit aa1db329a26a462c8d90b1b3328ba13fe25eba60 Author: Ranjan Kumar Date: Thu Nov 19 12:41:18 2026 +0530 scsi: mpi3mr: Fix endianness of device handles in BSG requests The device handle of a task management request, an NVMe encapsulated request and the target reset sent after a timeout is read from a little endian field and used as a CPU order value. On a big endian system this gives the wrong device handle. Convert the handle to CPU byte order before it is used. Fixes: 506bc1a0d6ba ("scsi: mpi3mr: Add support for MPT commands") Fixes: 7dbd0dd8cde3 ("scsi: mpi3mr: Add support for NVMe passthrough") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=4 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=4 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-7-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit 39bed42d2f0a6f6bd0f084c32a0de922443c6a73 Author: Ranjan Kumar Date: Thu Nov 19 12:41:17 2026 +0530 scsi: mpi3mr: Fix reposting of invalid reply address on the admin queue An admin reply whose reply frame address is not one of the driver's reply buffers is still reposted to the hardware reply free queue. Clear the address when the lookup fails so it is not reposted, as the operational reply queues already do. Fixes: 824a156633df ("scsi: mpi3mr: Base driver code") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=7 Closes: https://sashiko.dev/#/patchset/20260805110634.346670-1-ranjan.kumar@broadcom.com?part=5 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-6-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit 213282fa70bd7e3e87cc4304afb1acd3cc7deb03 Author: Ranjan Kumar Date: Thu Nov 19 12:41:16 2026 +0530 scsi: mpi3mr: Fix PRP list leak in BSG passthrough The PRP list built for an NVMe passthrough request is freed only after the command completes. If posting the request fails or the command times out, the list is never freed. The next request then overwrites the pointer and the old buffer is lost. Free the PRP list on every exit from the request handler. If a timed out command is still pending after recovery, the controller may still use its list. Accept a small leak in that case instead of freeing memory the controller may still read. Fixes: 7dbd0dd8cde3 ("scsi: mpi3mr: Add support for NVMe passthrough") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=1 Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=2 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=1 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-5-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit e25ad58db1e3b5de1c8ed93af318f2d3095f5f88 Author: Ranjan Kumar Date: Thu Nov 19 12:41:15 2026 +0530 scsi: mpi3mr: Remove redundant BSG buffer length checks Buffer entry lengths are now checked before the pointer moves, which makes the later pointer comparisons dead code. Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-4-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit 3f00e31b1e94228dd453d4ef9faa64a6041d179b Author: Ranjan Kumar Date: Thu Nov 19 12:41:14 2026 +0530 scsi: mpi3mr: Fix integer wrap in BSG buffer entry lengths The length of each BSG buffer entry is added to a pointer and the result is compared with the end of the payload. On a 32 bit system a large length makes the sum wrap around and pass the check, so the driver goes on to use a buffer much larger than the payload. Compare each entry length with the number of bytes left in the payload before the pointer is moved. Fixes: 506bc1a0d6ba ("scsi: mpi3mr: Add support for MPT commands") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=1 Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=2 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=1 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-3-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit fb7673d1037d656535610e7c4307a75b52c4a44d Author: Ranjan Kumar Date: Thu Nov 19 12:41:13 2026 +0530 scsi: mpi3mr: Fix out-of-bounds read of the BSG request The driver reads fields from a BSG request without checking its length. A short request, or one that declares more buffer entries than it contains, makes the driver read past the end of the buffer. Return -EINVAL when the request is too short for the command or for the number of buffer entries it declares. Fixes: 4268fa751365 ("scsi: mpi3mr: Add bsg device support") Fixes: f5e6d5a34376 ("scsi: mpi3mr: Add support for driver commands") Fixes: 506bc1a0d6ba ("scsi: mpi3mr: Add support for MPT commands") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=1 Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=2 Closes: https://sashiko.dev/#/patchset/20260818231426.58105-1-chandrakanth.patil@broadcom.com?part=4 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=1 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=2 Closes: https://sashiko.dev/#/patchset/20260825210411.301535-1-chandrakanth.patil@broadcom.com?part=3 Signed-off-by: Ranjan Kumar Link: https://patch.msgid.link/20261119071133.127282-2-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit fac36816b05791dde86ff2338ce3ad1404c31ffe Author: Ian Rogers Date: Thu Nov 19 09:09:05 2026 -0800 scsi: pm8001: Fix abort completion status in pm8001_mpi_task_abort_resp() In pm8001_mpi_task_abort_resp(), the IO_NOT_VALID branch assigns TMF_RESP_FUNC_FAILED (enum tmf_resp, 5) to ts->resp (enum service_response) instead of ts->stat, leaving ts->stat at 0. In addition, switch (status) has no default case, so any other non-zero firmware abort failure status leaves both ts->resp and ts->stat at their zero-initialized values (SAS_TASK_COMPLETE and SAS_SAM_STAT_GOOD), causing sas_execute_internal_abort() to falsely treat a failed abort as TMF_RESP_FUNC_COMPLETE. Set ts->resp = SAS_TASK_COMPLETE and ts->stat = TMF_RESP_FUNC_FAILED for both IO_NOT_VALID and default failure statuses, matching libsas and hisi_sas expectations. Found via Clang -Wassign-enum on an x86_64 allyesconfig build. Verified by building drivers/scsi/pm8001/pm8001_hwi.o with LLVM=1 W=1 (-Werror) and -Wassign-enum, and with a standalone C reproducer under ASan/UBSan; not runtime-tested on physical PM8001/PM80xx hardware. Fixes: dbf9bfe61571 ("[SCSI] pm8001: add SAS/SATA HBA driver") Signed-off-by: Ian Rogers Link: https://patch.msgid.link/20261119170905.1530613-1-irogers@google.com Signed-off-by: Martin K. Petersen (Oracle) commit 1f4c50b5d04bc42550008f27831ef910cd41f93e Author: Ian Rogers Date: Thu Nov 19 09:05:00 2026 -0800 scsi: lpfc: Fix format string and OOB copy in lpfc_read_object() In lpfc_read_object(), rd_object_name is a 26-element u32 array (104 bytes, LPFC_OBJ_NAME_SZ) populated from rdobject via scnprintf() without a "%s" format string, and then copied to the SLI-4 mailbox request with: for (j = 0; j < strlen(rdobject); j++) read_object->u.request.rd_object_name[j] = cpu_to_le32(rd_object_name[j]); Because the loop bound uses strlen(rdobject) (byte count, unbounded) to index 32-bit dword arrays of length 26, any object path of 27 bytes or longer reads past the end of rd_object_name on the stack and overwrites rd_object_cnt, rd_object_hbuf[], and adjacent mailbox memory. Passing rdobject directly as the format string also evaluates any '%' characters as printf specifiers. Format rdobject with "%s", capture the bounded byte length returned by scnprintf(), and iterate over DIV_ROUND_UP(len, sizeof(u32)) dwords. Found via an x86_64 LLVM=1 (Clang 21.1.8) allyesconfig audit with -Wformat-security enabled; fix and changelog drafted with an AI coding assistant. Verified with an ASan/UBSan C reproducer for short, '%'-bearing, and >104-byte object names, and build-tested with LLVM=1 W=1 and -Wformat-security; not tested on Emulex Fibre Channel hardware. Fixes: 72df8a452883 ("scsi: lpfc: Add support for cm enablement buffer") Fixes: 59936430e6a6 ("scsi: lpfc: Fix CPU to/from endian warnings introduced by ELS processing") Signed-off-by: Ian Rogers Reviewed-by: Paul Ely Link: https://patch.msgid.link/20261119170500.1514537-1-irogers@google.com Signed-off-by: Martin K. Petersen (Oracle) commit 002ab4954ef6b9776ea16c35ad517c13959dd3f6 Author: Uwe Kleine-König (The Capable Hub) Date: Wed Nov 11 19:38:43 2026 +0100 scsi: Consistently define pci_device_ids using named initializers ... and PCI device helpers. The various struct pci_device_id arrays were initialized mostly by one of the PCI_DEVICE macros and then list expressions. The latter isn't easily readable if you're not into PCI. Using named initializers is more explicit and thus easier to parse. Also use PCI_DEVICE* helper macros to assign .vendor, .device, .subvendor and .subdevice where appropriate and skip explicit assignments of 0 (which the compiler takes care of). The secret plan is to make struct pci_device_id::driver_data an anonymous union (similar to https://lore.kernel.org/all/cover.1776579304.git.u.kleine-koenig@baylibre.com/) and that requires named initializers. But it's also a nice cleanup on its own. This change doesn't introduce changes to the compiled pci_device_id arrays. Tested on x86 and arm64. [mkp: Fix stex comments reported by Sashiko] Signed-off-by: Uwe Kleine-König (The Capable Hub) Link: https://patch.msgid.link/20261111183844.1906794-2-u.kleine-koenig@baylibre.com Signed-off-by: Martin K. Petersen (Oracle) commit ebdcb02c8a2d61c0aef95a3d451c2464818cf2da Author: Bart Van Assche Date: Thu Nov 19 16:50:57 2026 -0800 scsi: ufs: core: Remove the DMA addresses from struct ufshcd_lrb The offsets stored in struct utp_transfer_req_desc are in double words on hosts without UFSHCD_QUIRK_PRDT_BYTE_GRAN. Using these offsets as byte offsets to compute ucd_rsp_dma_addr and ucd_prdt_dma_addr results in incorrect DMA addresses. These addresses are only used by ufshcd_print_tr() for error logging. Instead of fixing how these addresses are computed, remove the utrd_dma_addr, ucd_req_dma_addr, ucd_rsp_dma_addr and ucd_prdt_dma_addr members from struct ufshcd_lrb and do not report DMA addresses anymore in ufshcd_print_tr(). The contents of the transfer request descriptor, the request UPIU, the response UPIU and the PRDT are still dumped by that function. Remove the local variable cmd_desc_element_addr from ufshcd_init_lrb() since it is no longer used. This patch changes the output of ufshcd_print_tr() as follows: the "Transfer Request Descriptor phys@", "Request UPIU phys@" and "Response UPIU phys@" lines are no longer logged and the "PRDT" line no longer includes a physical address. Signed-off-by: Bart Van Assche Link: https://patch.msgid.link/cc98d54dcd4a98fead25db50c5c6aec2dd65d595.1795135853.git.bvanassche@acm.org Signed-off-by: Martin K. Petersen (Oracle) commit 0943d0da936608c31efbec86c9fde28df02ff982 Author: Bart Van Assche Date: Thu Nov 19 16:49:11 2026 -0800 scsi: ufs: mediatek: Use ARRAY_SIZE() instead of open-coding it The kernel test robot reported the following Coccinelle warning: drivers/ufs/host/ufs-mediatek.c:1351:32-33: WARNING: Use ARRAY_SIZE Derive array bounds from the arrays themselves such that these bounds remain correct if array elements are added or removed. In ufs_mtk_adjust_sync_length(), replace the open-coded sizeof(pa_min_sync_length) / sizeof(struct attr_min) computation with ARRAY_SIZE(pa_min_sync_length) and remove the local variable 'cnt' since it is no longer needed. This fixes the reported warning. Additionally, in ufs_mtk_setup_clk_gating(), replace the hard-coded upper bound in the range check on the scale_us[] index by ARRAY_SIZE(scale_us). This has not been reported by the kernel test robot. Since scale_us[] has six elements, 'ah_scale <= 5' is equivalent to 'ah_scale < ARRAY_SIZE(scale_us)'. No functionality has been changed. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202611170300.dsQhfOB9-lkp@intel.com/ Signed-off-by: Bart Van Assche Link: https://patch.msgid.link/547675c30e66d7664c0adec81f025986ab6ddfce.1795135740.git.bvanassche@acm.org Signed-off-by: Martin K. Petersen (Oracle) commit 235a1223173532f24c00efa350310c436a18be58 Author: Tim Douglas Date: Tue Nov 17 19:37:46 2026 -0500 scsi: esp_scsi: Report the residual byte count The ESP core tracks the number of bytes left to transfer in tot_residue but does not report that count to the SCSI midlayer. As a result, SG_IO returns a residual of zero even when a target transfers fewer bytes than requested, as can happen with INQUIRY and MODE SENSE. Report tot_residue with scsi_set_resid() when a command with a data buffer completes with DID_OK. Initialize the scatterlist DMA length on the identity-mapped PIO/pseudo-DMA path so the residual starts from the buffer length on architectures with a separate DMA length. On a Performa 6200CD with an out-of-tree ESP front end, an SG_IO INQUIRY with an allocation length of 255 returns 36 bytes from the internal CD-ROM drive. The residual is 219 with the fix and 0 before it. AI assistance was used to investigate ESP transfer accounting and draft the fix. Signed-off-by: Tim Douglas Tested-by: Finn Thain Link: https://patch.msgid.link/20261118003746.61659-1-me@timdoug.com Signed-off-by: Martin K. Petersen (Oracle) commit 2205b1afc6d09b60477dce6e1053c05556a54b3f Author: Guangshuo Li Date: Mon Nov 16 22:28:30 2026 +0800 scsi: wd719x: Fix potential firmware buffer leak on probe failure A failed chip initialization leaves the coherent firmware buffer behind while probe releases the host. Disable the RISC and bus mastering before unwinding the failed initialization, then free the firmware buffer along with the other internal DMA buffers. This issue was found by our static analysis tool under development. Fixes: 48a310300663 ("wd719x: Introduce Western Digital WD7193/7197/7296 PCI SCSI card driver") Signed-off-by: Guangshuo Li Link: https://patch.msgid.link/20261116-c29ba55625-scsi-wd719x@mail.sdu.edu.cn Signed-off-by: Martin K. Petersen (Oracle) commit 715aa02a2de96435dbcffc5481c5bc191c547539 Author: Minda Chen Date: Thu Nov 12 15:56:16 2026 +0800 scsi: ufs: starfive: Add UFS support for StarFive JHB100 SoC Add support for the UFS host controller on JHB100 SoC, built on the Synopsys DWC UFS controller and using UFSHCD platform driver. This controller requires specific configurations like M-PHY/RMMI/UniPro. Signed-off-by: Minda Chen Link: https://patch.msgid.link/20261112075616.118436-5-minda.chen@starfivetech.com Signed-off-by: Martin K. Petersen (Oracle) commit b65d9e54e5bbb10484d5d5cb0ff65e2823f1350f Author: Minda Chen Date: Thu Nov 12 15:56:15 2026 +0800 scsi: ufs: dwc: Rename amd-versal2 read/write PHY API and move to dwc common file The PHY register read/write helpers in the AMD Versal2 driver are generic to the Synopsys DesignWare UFS M-PHY. Move them to ufshcd-dwc.c and rename them so that other DWC based glue drivers can reuse them. Add kernel-doc for the exported helpers. No functional change. Signed-off-by: Minda Chen Link: https://patch.msgid.link/20261112075616.118436-4-minda.chen@starfivetech.com Signed-off-by: Martin K. Petersen (Oracle) commit 454284cf3f3901cce50e069be613210d4fc04342 Author: Minda Chen Date: Thu Nov 12 15:56:14 2026 +0800 scsi: ufs: amd-versal2: Make PHY register DME attribute tables per-call ufs_versal2_phy_reg_write() and ufs_versal2_phy_reg_read() keep their DME attribute tables in static, writable arrays and patch the address and value into them on every call. This is not safe once more than one host instance uses the helpers concurrently. Build the tables on the stack and make them const, in preparation for moving the helpers to the common DWC code. Signed-off-by: Minda Chen Link: https://patch.msgid.link/20261112075616.118436-3-minda.chen@starfivetech.com Signed-off-by: Martin K. Petersen (Oracle) commit 11a7560968137b980ae71b3b268ae5dd6e295a9e Author: Minda Chen Date: Thu Nov 12 15:56:13 2026 +0800 scsi: ufs: dt-bindings: starfive: Add UFS Host Controller for JHB100 SoC Add devicetree document for UFS Host Controller StarFive JHB100 SoC. The UFS controller is based on the Synopsys DesignWare UFS controller. Signed-off-by: Minda Chen Reviewed-by: Conor Dooley Link: https://patch.msgid.link/20261112075616.118436-2-minda.chen@starfivetech.com Signed-off-by: Martin K. Petersen (Oracle) commit 08fec21faae44fe002467976befd68e6e62969b5 Author: Andrew Gigena Date: Wed Nov 11 17:53:22 2026 +0000 scsi: ufs: qcom: dt-bindings: Classify sm8150-ufshc as standalone ICE SM8150 UFS uses a standalone ICE node, so its compatible belongs to the standalone-ICE binding rather than the embedded-ICE one. This tightens the schema for qcom,sm8150-ufshc: the standalone-ICE binding allows one reg entry and eight clocks, while existing DTs still use the embedded-ICE layout. This causes a transient, validation-only dtbs_check warning until those DTs are converted (sm8150.dtsi follows in the next patch); existing DTBs still boot. Signed-off-by: Andrew Gigena Reviewed-by: Krzysztof Kozlowski Link: https://patch.msgid.link/20261111-sm8150-ice-rfc-v4-2-0311eac35609@andrewgigena.dev Signed-off-by: Martin K. Petersen (Oracle) commit bd91f6b3b684740174e300fa337713e97792a3f2 Author: Izaac Chong Date: Sat Nov 14 08:33:43 2026 +0800 scsi: fnic: Fix typo in kmem_cache creation error message The error printed when the fdls_frame_recv kmem_cache cannot be created says "cach" instead of "cache". Fix the spelling so the message matches the other cache creation errors in fnic_init_module(). Signed-off-by: Izaac Chong Reviewed-by: Karan Tilak Kumar Link: https://patch.msgid.link/20261114-fnic-typo-v1-1-a9f70c9c4a6b@gmail.com Signed-off-by: Martin K. Petersen (Oracle) commit 7693e76c9f8b7e1dc3a6ac544be97ee6b33e3050 Author: HOYOUNG SEO Date: Wed Nov 11 17:18:34 2026 +0900 scsi: ufs: core: Limit early link recovery in the error handler to runtime PM ufshcd_err_handler() recovers the link without taking hba->host_sem whenever hba->pm_op_in_progress is set. That early path was added by commit f966e02ae521 ("scsi: ufs: core: Fix runtime suspend error deadlock") because the regular error handling would wait for a runtime PM operation that cannot complete while the error handler is waiting. pm_op_in_progress is also set during system suspend, system resume, shutdown and poweroff, where the early path is not needed and runs concurrently with the PM path itself. For example, if a LINERESET is reported and the hibern8 exit fails in __ufshcd_wl_resume() during system resume, both ufshcd_err_handler() and __ufshcd_wl_resume() call ufshcd_link_recovery(), and the host and the device may be reset at the same time. Only take the early path while pm_op_in_progress is set and a runtime suspend or resume of the WLUN is in progress. The runtime PM core sets the runtime status of the WLUN to RPM_SUSPENDING or RPM_RESUMING while ufshcd_wl_runtime_suspend() or ufshcd_wl_runtime_resume() runs, and it is RPM_ACTIVE or RPM_SUSPENDED during system PM. The runtime status alone is not enough: it also covers the block layer steps before and after the driver callbacks, where the early link recovery must not run. pm_op_in_progress is only set while __ufshcd_wl_suspend() or __ufshcd_wl_resume() run, which is inside that window. Both checks are done in the new function ufshcd_in_wl_rpm_callback(). The runtime status is only available with CONFIG_PM, so the function returns false without it. Both values are read without locking, so use READ_ONCE() for them and WRITE_ONCE() when pm_op_in_progress is updated. As the window of pm_op_in_progress is contained in the runtime PM window, a stale value of either one can only make the error handler take the regular path, like an error handler that starts just before or after the PM operation. For the other PM operations the regular error handling is safe: - the system PM callbacks hold host_sem from ufshcd_wl_suspend() until ufshcd_wl_resume() returns, and ufshcd_wl_poweroff() holds it as well, so the error handler waits for them; - during shutdown, hba->shutting_down makes the error handler stop. This changes the behavior during shutdown: errors that occur while the final START STOP UNIT command is being processed are no longer handled by the error handler. Recovery then only happens through ufshcd_eh_timed_out(). Fixes: e23ef4f22db3 ("scsi: ufs: core: Fix error handler host_sem issue") Signed-off-by: HOYOUNG SEO Reviewed-by: Peter Wang Reviewed-by: Bart Van Assche Link: https://patch.msgid.link/282821294.121794387787588.JavaMail.epsvc@epcpadp2new Signed-off-by: Martin K. Petersen (Oracle) commit 7be49f26454e686d0b8cfd277066cefddb8e7464 Author: HOYOUNG SEO Date: Wed Nov 11 17:18:33 2026 +0900 scsi: ufs: core: Make ufshcd_wl_poweroff() behave like ufshcd_wl_suspend() ufshcd_wl_poweroff(), the hibernation poweroff callback, calls __ufshcd_wl_suspend(hba, UFS_SHUTDOWN_PM) directly and ignores the result. Unlike ufshcd_wl_suspend() it: - does not take hba->host_sem. An error handler that runs in the meantime can reset the link concurrently with __ufshcd_wl_suspend(). It also leaves host_sem unbalanced: if hibernation is aborted after ufshcd_wl_poweroff() has been called, ufshcd_wl_resume() is called as the .restore callback and releases host_sem, which was not acquired; - does not check pm_runtime_suspended(dev). __ufshcd_suspend_prepare() leaves the WLUN runtime suspended if ufshcd_rpm_ok_for_spm() is true, which is the case if rpm_lvl and spm_lvl are equal. Then __ufshcd_wl_suspend() triggers error recovery and returns -EBUSY; - does not set hba->is_sys_suspended, so ufshcd_err_handling_prepare() does not restore the clocks and regulators if the .restore callback fails; - ignores errors. Call ufshcd_wl_system_suspend() with UFS_SHUTDOWN_PM from ufshcd_wl_poweroff() to fix all of these, as suggested by Bart Van Assche. host_sem is held until ufshcd_wl_resume() releases it if hibernation is aborted, and released if the suspend fails. For UFS_SHUTDOWN_PM, __ufshcd_wl_suspend() does not convert failures into -EBUSY, so a positive SCSI or UIC status can be returned. A dev_pm_ops callback has to return a negative error code, so convert it. This changes the behavior of ufshcd_wl_poweroff(): an error is now returned from the .poweroff callback, which aborts hibernation, instead of being ignored, and a runtime suspended WLUN is left as it is like in ufshcd_wl_suspend(). Do not use hba->shutting_down to stop the error handler: it makes ufs_mtk_system_suspend(), which is also the .poweroff callback of the MediaTek host controller, fail with -EBUSY, and nothing clears it when hibernation is aborted. Fixes: b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun") Suggested-by: Bart Van Assche Signed-off-by: HOYOUNG SEO Reviewed-by: Peter Wang Reviewed-by: Bart Van Assche Link: https://patch.msgid.link/603443293.161794387787869.JavaMail.epsvc@epcpadp2new Signed-off-by: Martin K. Petersen (Oracle) commit 280c35ec009907b3fc7ce0c9df046025fb4fa585 Author: HOYOUNG SEO Date: Wed Nov 11 17:18:32 2026 +0900 scsi: ufs: core: Add a helper for the system suspend callbacks Move the body of ufshcd_wl_suspend() into ufshcd_wl_system_suspend(), which takes the PM operation as a parameter, so that it can be shared with ufshcd_wl_poweroff() in the next patch. ufshcd_wl_suspend() calls it with UFS_SYSTEM_PM. No functional change, except that the error message printed when the suspend fails now contains the name of the new function. Suggested-by: Bart Van Assche Signed-off-by: HOYOUNG SEO Reviewed-by: Peter Wang Reviewed-by: Bart Van Assche Link: https://patch.msgid.link/331418503.141794387787744.JavaMail.epsvc@epcpadp2new Signed-off-by: Martin K. Petersen (Oracle) commit e043bf8fa65e5de1c62996a5a2fd018721dd7fd1 Author: HOYOUNG SEO Date: Wed Nov 11 17:18:31 2026 +0900 scsi: ufs: core: Clear saved errors in ufshcd_link_recovery() ufshcd_link_recovery() resets both the device and the host and then re-establishes the link. Unlike ufshcd_reset_and_restore(), however, it does not clear hba->saved_err, hba->saved_uic_err and hba->force_reset, so the errors latched before the recovery remain pending after the link has already been recovered. When ufshcd_err_handler() runs afterwards, ufshcd_err_handling_should_stop() sees these stale errors. The error handler then quiesces all queues and, depending on the latched errors (e.g. a fatal error or UFSHCD_UIC_DL_PA_INIT_ERROR), performs another full ufshcd_reset_and_restore() on a link that is already operational. Cache and clear the saved errors before the reset, as ufshcd_reset_and_restore() does, so that only errors raised during or after the recovery are left to the error handler. Put them back if the recovery fails. Fixes: 35dabf4503b9 ("scsi: ufs: core: Use link recovery when h8 exit fails during runtime resume") Signed-off-by: HOYOUNG SEO Reviewed-by: Bart Van Assche Reviewed-by: Peter Wang Reviewed-by: Bean Huo Link: https://patch.msgid.link/1384010761.101794387787447.JavaMail.epsvc@epcpadp2new Signed-off-by: Martin K. Petersen (Oracle) commit 0fc91e802801819a0c51d30b6eecac63ab4f85d2 Author: Shao Mingyin Date: Thu Nov 5 19:33:53 2026 +0800 scsi: target: core: Drop the dead kmap_local_page() NULL check kmap_local_page() never returns NULL; drop the wrapper and always zero the segment. No functional change. Signed-off-by: Shao Mingyin Link: https://patch.msgid.link/20261105193353023NXQ1VSNCIijJ53XmDJc1y@zte.com.cn Signed-off-by: Martin K. Petersen (Oracle) commit 63d67440dc9f103aad38b14f409d6d6e54396746 Author: Shao Mingyin Date: Thu Nov 5 19:33:51 2026 +0800 scsi: target: iblock: Drop the dead kmap() NULL check kmap() never returns NULL, so the check after it is dead code. No functional change. Signed-off-by: Shao Mingyin Reviewed-by: Laurence Oberman Link: https://patch.msgid.link/20261105193351820CRZfBnzFE8zZm2DrNx0T_@zte.com.cn Signed-off-by: Martin K. Petersen (Oracle) commit db1fe578b7eabc7f218b84fc18a626d07f377a69 Author: Shao Mingyin Date: Sat Oct 31 22:22:43 2026 +0800 scsi: scsi_transport_fc: Reject truncated FPIN payloads fc_host_fpin_rcv() computes the length of the TLV area as: bytes_remain = fpin_len - offsetof(struct fc_els_fpin, fpin_desc); without checking that the payload is at least as large as the fixed FC-ELS header. For fpin_len smaller than the header size the subtraction underflows to a huge u32, and the min_t() on the next line also reads fpin->desc_len at offset 4, which is outside the payload when fpin_len is 4 or less. The TLV walker then parses memory that is not part of the FPIN. Reject payloads that cannot hold the header: there is no descriptor list to parse and no statistics to update. This is not only defensive: qla2xxx forwards the firmware-provided frame size minus the 24-byte PURX ELS header, so a frame of exactly that size reaches this helper with a zero length. fpin_len is supplied by the LLDD and the helper is exported, so it should not assume a minimum. Fixes: 3dcfe0de5a97 ("scsi: fc: Parse FPIN packets and update statistics") Signed-off-by: Shao Mingyin Link: https://patch.msgid.link/20261031222243820vSs-SXTIpNSHpWeC2dJ38@zte.com.cn Signed-off-by: Martin K. Petersen (Oracle) commit 787fd1429b3603fdc69ebba864165478c4e73544 Author: Shao Mingyin Date: Sat Oct 31 22:21:33 2026 +0800 scsi: scsi_devinfo: Return an error when the proc write fails proc_scsi_devinfo_write() calls scsi_dev_info_list_add_str() but ignores its return value, so a write to /proc/scsi/device_info always reports success, even when the string is malformed and no entry was added. Users and scripts then believe that the quirk is in effect. scsi_init_devinfo() already checks the return value of the same function and fails the initialization. Return the parser error, but keep returning the number of bytes written on success: a proc write handler that returns zero for a non-empty write would look like a short write to the caller. Signed-off-by: Shao Mingyin Reviewed-by: Laurence Oberman Link: https://patch.msgid.link/20261031222133489hI-BEIDpFMxrtlntnLiFb@zte.com.cn Signed-off-by: Martin K. Petersen (Oracle) commit dd86dc1d86c892c75592d45e000499dfb20d2c62 Author: Jesse Taube Date: Thu Oct 29 12:04:43 2026 -0400 scsi: qedf: Remove unesseary function call The result of `skb_transport_header()` was unused. Calling this function warned when `skb_transport_header_was_set()` returned false causing a panic on debug kernels. Signed-off-by: Jesse Taube Reviewed-by: Laurence Oberman Reviewed-by: John Meneghini Reviewed-by: Nilesh Javali Link: https://patch.msgid.link/20261029160443.904468-1-jtaubepe@redhat.com Signed-off-by: Martin K. Petersen (Oracle) commit dc7ba60d45b105b91d4e2e9567b355fb4a043def Author: Brian Bunker Date: Fri Oct 30 10:57:20 2026 -0700 scsi: core: Restart the queue when unblocking a device set running A device that its transport blocks has its queue stopped. If the SCSI error handler then gives up on the device, it moves it from SDEV_BLOCK to SDEV_OFFLINE and leaves the queue stopped. When userspace later writes "running" to the device's state attribute, store_state_field() moves it to SDEV_RUNNING, still with the queue stopped, and rescans it. The rescan takes the device lock and waits for I/O that can never be dispatched. When the transport then unblocks the device, scsi_internal_device_unblock_nowait() rejects a device in SDEV_RUNNING with -EINVAL before it reaches scsi_start_queue(), so nothing ever restarts the queue. The task that wrote "running" hangs forever holding the device lock, and anything else that takes it hangs behind it. The -EINVAL also makes scsi_host_unblock() stop at this device and leave the rest of the host blocked, and keeps the device in SDEV_RUNNING when the transport asked for SDEV_TRANSPORT_OFFLINE. This shows up with iSCSI when a session drops again just after recovering. iscsid onlines the session's devices after a relogin by writing "running" to every device it finds offline: 1. The session is blocked, which blocks the device and stops its queue. 2. The error handler cannot recover the device and moves it from SDEV_BLOCK to SDEV_OFFLINE. The queue stays stopped. 3. iscsid writes "running": SDEV_OFFLINE -> SDEV_RUNNING with the queue still stopped, then the rescan sends an INQUIRY that sits unsent while holding the device lock. 4. The session recovery timeout calls scsi_target_unblock(). The other devices go from SDEV_BLOCK to SDEV_TRANSPORT_OFFLINE and get their queues restarted, but this one is skipped because it is already running. A vmcore from such a hang shows the device in SDEV_RUNNING with queue_stopped set and the queue's quiesce_depth at 1, the rescan's INQUIRY never started (MQ_RQ_IDLE, no start time or deadline), and iscsid owning the device lock while other tasks wait for it. Handle this in scsi_internal_device_unblock_nowait(), which already restarts the queue of an SDEV_OFFLINE device: accept an SDEV_RUNNING device whose queue is still stopped, move it to the requested state and restart the queue. A running device whose queue is not stopped was never blocked and is still rejected. Do not restart the queue from store_state_field() instead. The device is still blocked by its transport at that point, and some transports and drivers rely on the stopped queue to keep commands away while they reconnect or reset the adapter. Fixes: f0f82e2476f6 ("scsi: core: Fix capacity set to zero after offlinining device") Signed-off-by: Brian Bunker Link: https://patch.msgid.link/20261030175721.24379-2-brian@purestorage.com Signed-off-by: Martin K. Petersen (Oracle) commit 6054ce4233dbc692f50da5517ad459fae1b14ac6 Author: Brian Bunker Date: Wed Oct 28 17:25:31 2026 -0700 scsi: core: Match ULDs to logical units in the ALUA unavailable state scsi_bus_match() only matches devices with peripheral qualifier 000b, so a LU that is in the ALUA unavailable state on a target port when the host scans it never gets an upper-level driver on that path. When the target port becomes available again, nothing binds sd and the path stays unusable until the device is deleted and rescanned. A host that was already running when the path became unavailable keeps sd bound, so the result depends on when the host scanned. Peripheral qualifier 001b cannot be matched on its own: an unmapped LUN reports it as well, and some targets report every possible LUN in REPORT LUNS. Binding sd to all of those would create disks with no backing LU. The SCSI core now reads the access state of a device that supports target port groups with REPORT TARGET PORT GROUPS before the device is registered, and an unmapped LUN fails that command. SPC-4 requires a LU in the unavailable state to report PQ 001b, and the command shows that the LU is mapped, so record in the device whether it reported PQ 001b and its access state could be read, and match such a device. sd then binds to the unavailable path like it does to a standby path, the path stays in the multipath map as a failed path, and the existing UNIT ATTENTION handling brings it back when the target port becomes available. The decision is made once, at scan time, and not from access_state when the match is made. access_state follows the ALUA state, but the peripheral qualifier it relates to does not change after the scan. If the match depended on access_state, a device scanned in the unavailable state would stop matching as soon as its path became available, e.g. when the upper-level driver module is loaded later, or the driver is rebound, or the ALUA device handler updates access_state before the driver is probed. It also does not depend on the state that the command returns, which can already be available if the path recovered between the INQUIRY and the command. This is the same situation as a path in the standby state, to which sd already binds: SPC-4 requires READ CAPACITY in neither state. The unavailable state does not require MODE SENSE either, which the standby state does. The cached INQUIRY data in sysfs keeps the peripheral qualifier reported at scan time, like the rest of the INQUIRY data; access_state shows the current ALUA state. Co-developed-by: Krishna Kant Signed-off-by: Krishna Kant Signed-off-by: Brian Bunker Reviewed-by: Hannes Reinecke Link: https://patch.msgid.link/20261029002531.82824-4-brian@purestorage.com Signed-off-by: Martin K. Petersen (Oracle) commit e085b1d6b6aabd6a7dcd9f02135f9376ff39e95a Author: Brian Bunker Date: Wed Oct 28 17:25:30 2026 -0700 scsi: core: Read the ALUA access state when a device is scanned sdev->access_state is only set by a device handler, and the ALUA device handler reads the state with an RTPG that runs after the device has been registered and matched to a driver. The SCSI core therefore has no ALUA state for a device while it decides whether to bind an upper-level driver to it. For a device that reports TPGS support, send REPORT TARGET PORT GROUPS from scsi_add_lun(), after the VPD pages have been read, and set sdev->access_state from the descriptor of the target port group of this path. UNIT ATTENTIONs, which a target typically reports first after a login or an ALUA state change, are retried, and the command is resent without the extended header if the target rejects it. If the command fails, e.g. with LOGICAL UNIT NOT SUPPORTED because no LU is mapped at the LUN, sdev->access_state is left as it is. The command uses the same timeout as the INQUIRY of the scan. The ALUA device handler keeps updating sdev->access_state afterwards as before. Suggested-by: Hannes Reinecke Co-developed-by: Krishna Kant Signed-off-by: Krishna Kant Signed-off-by: Brian Bunker Reviewed-by: Hannes Reinecke Link: https://patch.msgid.link/20261029002531.82824-3-brian@purestorage.com Signed-off-by: Martin K. Petersen (Oracle) commit 746aa1d936b17679361e8d787c6480ccb7c21240 Author: Brian Bunker Date: Wed Oct 28 17:25:29 2026 -0700 scsi: core: Move REPORT TARGET PORT GROUPS into the SCSI core ALUA is a standard SCSI feature, independent of multipathing, but only the ALUA device handler can currently send REPORT TARGET PORT GROUPS. Move submit_rtpg() into the SCSI core as scsi_report_tpgs(), together with the resubmission with a larger buffer that alua_rtpg() did when the parameter data did not fit, so that the core can read the ALUA state of a device itself. The parameter data format definitions move to scsi_proto.h with it. scsi_dh_alua calls scsi_report_tpgs() with the same timeout, retries and parameter data format as before. No functional change. Suggested-by: Hannes Reinecke Co-developed-by: Krishna Kant Signed-off-by: Krishna Kant Signed-off-by: Brian Bunker Reviewed-by: Hannes Reinecke Link: https://patch.msgid.link/20261029002531.82824-2-brian@purestorage.com Signed-off-by: Martin K. Petersen (Oracle) commit e1a17bf98f513a77e5e6903315c49f56ee009886 Author: Denis Ahrens Date: Mon Oct 26 10:51:54 2026 +0100 scsi: mvme16x: Enable 53c710 burst-8 hardware transfer mode The shared 53c700.c backend runs the 53c710 with burst mode disabled when hostdata->burst_length is left unset: NCR_700_chip_setup() falls through to BURST_DISABLE in CTEST7 and a 1-byte burst length in DMODE_710_REG, so the chip delivers one byte per transfer period. The other 53c710 hosts in-tree already use it: sim710 and lasi700 pick burst 8, sni_53c710 burst 4. A/B verified on an MVME177 (53c710 rev 2, ZuluSCSI drives): raw reads 16 MiB @64k 4.7/4.8/5.1 -> 5.8/6.1/6.7 MB/s (+23..26%) 4 MiB @16k 3.4 -> 4.4 MB/s 4 MiB @4k 3.2 -> 3.9 MB/s 4 MiB @512B 2.1 -> 2.2 MB/s (small-buffer case is SCSI command-count bound; burst only raises bytes per command, not commands) writes unchanged (filesystem-bound, not ASIC-bound) Integrity: a 16 MiB /dev/urandom payload round-trips bit-exact on a cold read (sync + drop_caches, md5 verified write vs read); dmesg clean with no timeouts, sense errors, retries or resets. Signed-off-by: Denis Ahrens Link: https://patch.msgid.link/733CA975-51A9-4687-BBD5-1FB4171FA3FE@h3q.com Signed-off-by: Martin K. Petersen (Oracle) commit ae8ecbc1e28633bdb23cfb61d8048c4e8f52052d Author: Torra Sowmya Date: Sun Nov 8 12:16:26 2026 +0530 scsi: sd: Remove unused zone append tracepoints Commit 1846f308d66f ("scsi: sd: Use the block layer zone append emulation") removed the calls to scsi_prepare_zone_append and scsi_zone_wp_update, but left their definitions in sd_trace.h. Consequently, sd_zbc.c still generates code and data for events that have no remaining callers. Remove sd_trace.h, which contains only these two events, and remove its include and CREATE_TRACE_POINTS definition from sd_zbc.c. Fixes: 1846f308d66f ("scsi: sd: Use the block layer zone append emulation") Signed-off-by: Torra Sowmya Link: https://patch.msgid.link/20261108064626.5539-1-sowmyatorra@gmail.com Signed-off-by: Martin K. Petersen (Oracle) commit c14818f4d2b46a67fa0d2fd8fd5ef3532245f07a Author: Bart Van Assche Date: Fri Oct 30 15:42:39 2026 -0700 scsi: core: Limit retries of commands that receive UNIT ATTENTION Fail non-removable commands in scsi_io_completion_action() on UNIT ATTENTION if retries exceed max(cmd->allowed, 3). This bounds the number of retries of commands for which scsi_decide_disposition() exhausted the retries or that have been finished by the error handler, e.g. because a target keeps reporting UNIT ATTENTION after recovery. Since scmd->retries is not incremented for failfast commands on this code path, failfast commands are retried until the command runtime limit is exceeded, as before. Signed-off-by: Bart Van Assche Tested-by: Alexey Charkov Link: https://patch.msgid.link/959f1c7628af83cd184ac51f35e38d654b261069.1793400000.git.bvanassche@acm.org Signed-off-by: Martin K. Petersen (Oracle) commit 49da33f609929db6f6c3b8567d0e0cca6f9ae182 Author: Bart Van Assche Date: Fri Oct 30 15:42:38 2026 -0700 scsi: core: Escalate persistent UNIT ATTENTION conditions Recover from persistent UNIT ATTENTION conditions in the SCSI midlayer instead of maintaining a per-device quirk list for targets such as BIWIN BWU2A05* UFS devices that fail to clear power-on or reset UNIT ATTENTION on WRITE commands while clearing it on commands such as TEST UNIT READY, READ, and SYNCHRONIZE CACHE. If a non-removable block request that is not failfast receives the same UNIT ATTENTION repeatedly, retry it twice and invoke the error handler thereafter, instead of letting scsi_io_completion_action() retry uncounted until the command runtime limit is exceeded. The error handler clears the UNIT ATTENTION by sending TEST UNIT READY. Track this with a dedicated per-command counter and the additional sense code of the most recent UNIT ATTENTION instead of scmd->retries. scmd->retries is also incremented for other retry reasons and by the error handler, and a target may report multiple queued UNIT ATTENTION conditions with different additional sense codes. On most architectures the new fields occupy an existing hole in struct scsi_cmnd. Limit the number of error handler invocations for commands with unlimited retries since scsi_eh_flush_done_q() does not limit these. Only apply this escalation when the sense data is evaluated by scsi_decide_disposition() and leave the behavior of the exported scsi_check_sense() function unchanged. libata calls scsi_check_sense() from its own error handler, which translates FAILED into an ATA port reset and never sends TEST UNIT READY. Reported-by: Alexey Charkov Closes: https://lore.kernel.org/linux-scsi/20261028-biwin-tua-quirk-v1-1-767a12c9b9cc@flipper.net/ Signed-off-by: Bart Van Assche Tested-by: Alexey Charkov Link: https://patch.msgid.link/5c34851674a67879e175251b9bfe6ccf091e390a.1793400000.git.bvanassche@acm.org Signed-off-by: Martin K. Petersen (Oracle) commit d54e68b5c31cbfb108c1f22ec21bdf43c5133e0e Author: Bart Van Assche Date: Fri Oct 30 15:42:37 2026 -0700 scsi: core: Clear UNIT ATTENTION conditions with TEST UNIT READY Some targets, e.g. BIWIN BWU2A05* UFS devices, fail to clear power-on or reset UNIT ATTENTION conditions on WRITE commands while clearing these on commands like TEST UNIT READY, READ, and SYNCHRONIZE CACHE. Add scsi_eh_clear_ua() to scsi_eh_ready_devs() ahead of device reset so that the error handler sends TEST UNIT READY to consume a stuck UNIT ATTENTION and verifies with a follow-up TEST UNIT READY that the condition cleared before requeueing affected commands. Allow a few additional TEST UNIT READY attempts for queued UNIT ATTENTION conditions and busy devices, delay retries, and honor the error handler deadline. Save and restore scmd->sense_buffer across scsi_send_eh_cmnd() so that the original sense data remains intact while filtering work_q and if retries are later exhausted. Log a rate-limited message when a persistent UNIT ATTENTION is cleared to make it possible to identify misbehaving devices. Signed-off-by: Bart Van Assche Link: https://patch.msgid.link/444e78b0fa892e8854bee89f341824d67000d968.1793400000.git.bvanassche@acm.org Signed-off-by: Martin K. Petersen (Oracle) commit 099fb3376bb73c29457782d917a3b68d846a9e87 Author: Bart Van Assche Date: Fri Oct 30 15:42:36 2026 -0700 scsi: core: Simplify scsi_eh_ready_devs() Replace the nested if-statements in scsi_eh_ready_devs() with a single if-statement that combines the conditions with the && operator. This reduces the indentation level and makes it easier to insert additional recovery steps. No functionality has been changed. Signed-off-by: Bart Van Assche Link: https://patch.msgid.link/de1a210fb52adaefd818ed68eb5e7678a004762e.1793400000.git.bvanassche@acm.org Signed-off-by: Martin K. Petersen (Oracle) commit b7545895b1c97b8fd0201ee6eac9cbeb57f1e3c5 Author: Bart Van Assche Date: Fri Oct 30 15:42:35 2026 -0700 scsi: core: Introduce scsi_cmd_needs_stu() Introduce scsi_cmd_needs_stu() and use it in scsi_eh_stu() instead of testing scsi_check_sense(scmd) == FAILED. This makes it explicit that START UNIT is only sent for LU_NOT_READY_INITIALIZING_COMMAND_REQUIRED and prevents that the error handler reports sense data a second time. This patch prepares for making scsi_decide_disposition() escalate persistent UNIT ATTENTION conditions to the error handler. Signed-off-by: Bart Van Assche Link: https://patch.msgid.link/c35a3b27958cb93c26c1ccecccd572c54da448e4.1793400000.git.bvanassche@acm.org Signed-off-by: Martin K. Petersen (Oracle) commit c78b78166c55ebd6ae0b378499abd519aee7a966 Author: Matt Wang Date: Mon Oct 19 14:29:58 2026 +0800 scsi: vmw_pvscsi: Add support for ARM64 architecture This change adds PVSCSI support for the ARM64 architecture, restricted to little endian and 4K memory page size. Barrier usage is updated from compiler barriers, which were sufficient on x86, to the appropriate DMA barriers. Signed-off-by: Matt Wang Reviewed-by: Vishal Bhakta Link: https://patch.msgid.link/20261019062959.426900-1-matt.wang@broadcom.com Signed-off-by: Martin K. Petersen (Oracle) commit a3d959d2778f22b44c2df52cb70e78811c0e739e Author: Matt Wang Date: Wed Sep 30 07:15:39 2026 +0800 scsi: vmw_pvscsi: Clamp on e->dataLen in pvscsi_complete_request() When calculating the residual bytes, clamp dataLen to the buffer length before the subtraction. This prevents an overflow if the device sends a larger value than expected. Signed-off-by: Matt Wang Link: https://patch.msgid.link/20260929231539.630963-1-matt.wang@broadcom.com Fixes: 851b164231d1 ("[SCSI] vmw_pvscsi: SCSI driver for VMware's virtual HBA.") Signed-off-by: Martin K. Petersen (Oracle) commit 6e862335a8d3a3c8bfc8488dc1c6fa81b83a83ee Author: Matt Wang Date: Wed Sep 30 07:14:59 2026 +0800 scsi: vmw_pvscsi: Add boundary check for cmd_map access The context value provided by the device in a completion is used to index into cmd_map to find the command that was completed. To prevent out of bounds access or completion of an inactive context, check that the context value is in-bounds and that it maps to an active context. Signed-off-by: Matt Wang Link: https://patch.msgid.link/20260929231459.630938-1-matt.wang@broadcom.com Fixes: 851b164231d1 ("[SCSI] vmw_pvscsi: SCSI driver for VMware's virtual HBA.") Signed-off-by: Martin K. Petersen (Oracle)