summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2026-11-03xfs: refuse a pNFS LAYOUTCOMMIT of a range without blocksDaejun Park
A client can commit a hole in a LAYOUTCOMMIT, because nfsd does not check the extents against its layouts. xfs_iomap_write_unwritten() then allocates written blocks there. A large hole overruns the block reservation and shuts XFS down. A small one exposes stale data. Refuse such a range with -EIO, using XFS_BMAPI_CONVERT_ONLY. Link: https://lore.kernel.org/r/20261014130834.GB15773@lst.de Fixes: 527851124d10 ("xfs: implement pNFS export operations") Cc: stable@vger.kernel.org Signed-off-by: Daejun Park <daejun7.park@samsung.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Carlos Maiolino <cem@kernel.org>
2026-11-03xfs: add a flag to convert unwritten extents without allocating blocksDaejun Park
xfs_bmapi_write() with XFS_BMAPI_CONVERT also allocates blocks for holes and delalloc extents in the range. Add XFS_BMAPI_CONVERT_ONLY for callers that may only convert already allocated blocks. It stops at a hole or delalloc extent, and returns -ENOSR if it stops before mapping anything. Marked for stable because "xfs: refuse a pNFS LAYOUTCOMMIT of a range without blocks" needs it. Suggested-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20261013120359.GB2944@lst.de Cc: stable@vger.kernel.org Signed-off-by: Daejun Park <daejun7.park@samsung.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Pankaj Raghav <p.raghav@samsung.com> Signed-off-by: Carlos Maiolino <cem@kernel.org>
2026-11-03xfs: mark the inode preallocated for pNFS write layouts past EOFDaejun Park
xfs_fs_map_blocks() marks the inode XFS_DIFLAG_PREALLOC only when it allocates blocks for a write layout. A write layout past EOF can also hand out allocated blocks, such as speculative preallocation. blockgc then frees them under the layout, and another file may get them. Mark the inode whenever a write mapping ends past EOF. Fixes: 527851124d10 ("xfs: implement pNFS export operations") Cc: stable@vger.kernel.org Reported-by: Chuck Lever <cel@kernel.org> Link: https://lore.kernel.org/r/4de5356f-bc4d-4f1a-9c81-fce09b1b46fd@slotpi15m67 Signed-off-by: Daejun Park <daejun7.park@samsung.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Pankaj Raghav <p.raghav@samsung.com> Signed-off-by: Carlos Maiolino <cem@kernel.org>
2026-11-03block: don't use the bvec fast path for dma-buf biosAnuj Gupta
bio_may_need_split() reads bi_io_vec, which for dma-buf bios aliases bi_dmabuf_map, and interprets the map as a bvec. Always run the full split check for dma-buf bios. Fixes: d88e44f43e93 ("block: introduce dma map backed bio type") Signed-off-by: Anuj Gupta <anuj20.g@samsung.com> Reviewed-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://patch.msgid.link/20261029105330.1427462-1-anuj1072538@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03blk-iocost: account flush sequence latency only onceZhe Liu
A flush sequence with a DATA phase can complete its original request twice. Both completions invoke ioc_rqos_done(), causing the request to contribute two latency samples and adding the same queue wait time twice. This gives such requests disproportionate weight compared to ordinary writes, distorting the device-wide latency and queue wait feedback used to adjust iocost's virtual time rate. Skip requests marked RQF_FLUSH_SEQ in ioc_rqos_done(). The flag is set when the request enters the flush machinery and is still set when the data phase completes; blk_flush_restore_request() clears it before the final completion, so accounting happens only once, after the whole sequence finishes. The remaining sample covers the request's lifetime through any postflush, and its queue wait time is accumulated only once. Fixes: 7caa47151ab2e ("blkcg: implement blk-iocost") Cc: stable@vger.kernel.org Signed-off-by: Zhe Liu <liuzhe1@kylinos.cn> Acked-by: Tejun Heo <tj@kernel.org> Link: https://patch.msgid.link/20261102061802.408173-1-liuzhe1@kylinos.cn Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03virtio-blk: clamp max_segments to virtqueue ring sizeSergii Ushakov
In virtblk_add_req(), each request consumes 2 extra descriptors (out_hdr and in_hdr) in addition to the data scatter-gather segments. When a hypervisor (e.g. QNX Hypervisor) advertises VIRTIO_BLK_F_SEG_MAX with seg_max = 1024 alongside a 1024-entry split ring (vring.num = 1024) and VIRTIO_RING_F_INDIRECT_DESC disabled, lim->max_segments is set to 1024. When the block layer submits requests with 1023 or 1024 data segments, total_sg reaches 1025 or 1026. This exceeds vring.num (1024), causing virtqueue_add_split() to return -ENOSPC and permanently wedge the blk-mq queue. Furthermore, the Virtio specification (2.7.5.3.1) requires that a descriptor chain never exceed the Queue Size, and virtqueue_add_split() falls back to direct descriptors if indirect table allocation fails. Fix this by: 1. Rejecting queues with ring_size < 3 at probe, or ring_size < (queue_max_segments + 2) during resume/reset recovery in init_vq(). 2. Unconditionally clamping sg_elems to (ring_size - 2) across all virtqueues in virtblk_read_limits(). Fixes: 0864b79a1533 ("virtio: block: dynamic maximum segments") Signed-off-by: Sergii Ushakov <sergiiushakov@google.com> Link: https://patch.msgid.link/20260918135120.1261150-1-sergiiushakov@google.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03null_blk: clean up setting zones read-only or offlineNiklas Cassel
null_set_zone_cond() takes a zone condition, even though read-only and offline are the only zone conditions that it can set. Because of this, it needs a WARN_ON_ONCE() to reject any other zone condition, and its name suggests a generic helper that can set any zone condition. Rename null_set_zone_cond() to null_set_zone_readonly_or_offline(), and replace its zone condition argument with a bool, set_offline, which selects between the read-only and offline conditions. Also remove the comment above the function, as it only repeats the new function name. zone_cond_store() keeps taking a zone condition, as it, unlike null_set_zone_readonly_or_offline(), contains generic code, and might be extended to support additional zone conditions in the future. No functional change, as zone_cond_store() is only called with the read-only or offline condition. Suggested-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Niklas Cassel <cassel@kernel.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://patch.msgid.link/20261022092158.2248831-8-cassel@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03null_blk: don't finish zones to set them read-only or offlineNiklas Cassel
null_set_zone_cond() calls null_finish_zone() to release the zone resources held by a zone before setting it read-only or offline. For an empty or closed zone, null_finish_zone() first runs the zone resource checks, which can close an unrelated implicitly open zone, or fail. As the error is ignored, a failure for a closed zone leaks nr_zones_closed, permanently lowering the effective active zone limit. Setting a zone read-only or offline requires no zone resources, so release the zone resources held by the zone directly instead, using a new helper, null_release_zone_resources(). Fixes: d3a5738849e0 ("null_blk: support read-only and offline zone conditions") Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Niklas Cassel <cassel@kernel.org> Link: https://patch.msgid.link/20261022092158.2248831-7-cassel@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03null_blk: fix opening closed zones at the active zone limitNiklas Cassel
When the open zone limit is reached, null_check_open() closes an implicitly open zone only if the active zone limit is not reached. Closing an implicitly open zone does not change the number of active zones, so this check is wrong. For an empty zone, the active zone limit was already checked by null_check_zone_resources(). For a closed zone, the check makes writing to, opening or finishing the zone fail with BLK_STS_ZONE_OPEN_RESOURCE at the active zone limit, whereas ZBC-3 (4.5.3.2.7.2) and NVMe ZNS (2.1.1.4.1) require closing an implicitly open zone instead. Remove the check, and update the comment above null_check_zone_resources() accordingly. Fixes: dc4d137ee3b7 ("null_blk: add support for max open/active zone limit for zoned devices") Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Niklas Cassel <cassel@kernel.org> Link: https://patch.msgid.link/20261022092158.2248831-6-cassel@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03blk-mq: fix out-of-bounds read in blk_mq_free_rqsKrystian Kaniewski
A KASAN slab-out-of-bounds read can occur in blk_mq_free_rqs() when there is a mismatch between the number of hardware queues allocated for the IO scheduler (et->nr_hw_queues) and the number of hardware queues in the block tag set (set->nr_hw_queues). This mismatch can happen if blk_mq_update_nr_hw_queues() fails halfway through (e.g., due to memory pressure during blk_mq_prealloc_tag_set_tags()). In this error path, the elevator is restored with a larger number of hardware queues than the block tag set actually has. When the elevator is later freed, blk_mq_free_sched_tags() iterates up to the new et->nr_hw_queues and calls blk_mq_free_rqs(). In blk_mq_free_rqs(), it attempts to access set->tags[hctx_idx] to get the driver tags. Because set->nr_hw_queues was not updated due to the earlier failure, set->tags still has the old (smaller) size, leading to an out-of-bounds read. BUG: KASAN: slab-out-of-bounds in blk_mq_free_rqs+0xde/0x680 Read of size 8 at addr ffff88818d67fc28 by task syz-executor117/5839 Call Trace: blk_mq_free_rqs+0xde/0x680 blk_mq_free_map_and_rqs+0x40/0xf0 blk_mq_free_sched_tags blk_mq_free_sched_res+0xeb/0x280 elevator_change_done+0x1d2/0x5c0 elevator_change+0x34f/0x480 elv_iosched_store+0x504/0x630 queue_attr_store+0x207/0x2b0 To fix this, explicitly check if hctx_idx < set->nr_hw_queues before accessing set->tags[hctx_idx]. If hctx_idx >= set->nr_hw_queues, the hardware queue doesn't exist in the tag set, meaning there are no driver tags to clear mappings from. In this case, safely set drv_tags to NULL. The subsequent call to blk_mq_clear_rq_mapping() already handles a NULL drv_tags pointer and will safely return. Fixes: 04225d13aef1 ("block: fix potential deadlock while running nr_hw_queue update") Assisted-by: Gemini:gemini-3.5-flash Gemini:gemini-3.1-pro-preview syzbot Reported-by: syzbot+e90526cab23b9efcd03c@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=e90526cab23b9efcd03c Link: https://syzkaller.appspot.com/ai_job?id=827b5760-86a0-4f44-9c69-430b572eac12 Reviewed-by: Nilay Shorff <nilay@linux.ibm.com> Cc: stable@vger.kernel.org # 6.17+ Signed-off-by: Krystian Kaniewski <krystianmkaniewski@gmail.com> Tested-by: syzbot@syzkaller.appspotmail.com Link: https://patch.msgid.link/20261014170538.1089448-1-krystianmkaniewski@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03vsock: reject negative tv_usec in SO_VM_SOCKETS_CONNECT_TIMEOUTNguyen Dinh Phi
The timeval validation checks tv_usec < USEC_PER_SEC but not tv_usec >= 0, so a negative tv_usec makes the timeout computation wrap into a bogus value, later tripping "schedule_timeout: wrong timeout value" instead of being rejected. Fixes: d021c344051a ("VSOCK: Introduce VM Sockets") Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20261030064428.73930-1-phind.uet@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-11-03virtio_blk: freeze the virtqueue layout at probe timeYunye Zhao
init_vq() reads the writable num_request_queues and poll_queues module parameters both at probe and when recreating virtqueues after suspend or reset. However, virtio-blk does not update the blk-mq hardware queue count or queue maps on restore. Increasing poll_queues can therefore remove the completion callback from a virtqueue still used for interrupt-driven I/O, leaving requests uncompleted. Reducing the effective request queue count through num_request_queues can instead leave existing hardware contexts indexing beyond the reallocated vblk->vqs array. Determine the virtqueue count and the split between interrupt-driven and polling queues once at probe, and reuse this layout when recreating the virtqueues. Changes to these module parameters then affect only subsequently probed devices. Fixes: 0989c41bed96 ("virtio-blk: add num_request_queues module parameter") Signed-off-by: Yunye Zhao <yunye.zhao@linux.alibaba.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Link: https://patch.msgid.link/20261102133740.88919-1-yunye.zhao@linux.alibaba.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03zloop: fix block size queryChristoph Hellwig
The block size obviously needs to be queried when it is not set, not when it already is set. Reported: Damien Le Moal <dlemoal@kernel.org> Fixes: 5e9929e2f03c ("zloop: share more code for opening a zone backing file") Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://patch.msgid.link/20261102055558.3212814-1-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03zloop: reject mismatched conventional zone files on restoreShao Mingyin
When restoring a zloop device, zloop_init_zone() checks that the size of each conventional zone file matches the configured zone size. The check prints an error and then jumps to out_fput, which releases the zone file and returns the value left in "ret" by the preceding vfs_getattr() call, that is, zero. zloop_ctl_add() therefore treats the zone as initialized and continues with a zone->file pointer that was already released; any I/O to that zone then dereferences it. Return -EINVAL, like the sequential zone path does for the same kind of inconsistency. While at it, print the zone size that is actually compared instead of the zone capacity, which may be smaller and only made the message confusing. Fixes: eb0570c7df23 ("block: new zoned loop block device driver") Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://patch.msgid.link/20261031221610676B5VoVcwMgkoDNVZH2bVDO@zte.com.cn Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03block: only serialize elevator switches of the same queueLaveesh Bansal
Since commit 4ff58d6bc9dd ("block: serialize elevator changes for the same queue using a writer lock"), a write to queue/scheduler fails with -EBUSY whenever something else holds set->update_nr_hwq_lock. That commit takes the lock for write, and it has to be a trylock because of commit ce8ee8583ed8 ("block: use trylock to avoid lockdep circular dependency in sysfs"). The lock covers the whole tag set, so it is easy to hit. A scheduler write fails while another queue of the set is switching, or while a sibling disk of the same SCSI host or NVMe controller is added or removed. This matches the udev failures reported on 7.2. Go back to taking the lock for read. The write lock was there to keep two switches of one queue from overlapping in elevator_change_done(), which touches the elevator sysfs and debugfs entries outside of q->elevator_lock. Use QUEUE_FLAG_NO_ELV_SWITCH for that instead: a write sets it before elevator_change() and clears it afterwards, and a write that finds it set returns -EBUSY. Disk removal already sets the flag under the write lock, so no switch can start once it has run. Writes to the same queue, and writes that race with an nr_hw_queues update, an nr_requests write or disk removal, can still get -EBUSY, as with 4ff58d6bc9dd. A write to a disk that is being removed now gets -EBUSY instead of -ENOENT. Fixes: 4ff58d6bc9dd ("block: serialize elevator changes for the same queue using a writer lock") Cc: stable@vger.kernel.org # v7.2+ Reported-by: Reindl Harald <h.reindl@thelounge.net> Closes: https://lore.kernel.org/r/077dd42e-cbc9-4c23-a5ef-3d20e4fc7757@thelounge.net Suggested-by: Nilay Shroff <nilay@linux.ibm.com> Assisted-by: LLM Signed-off-by: Laveesh Bansal <laveeshb@laveeshbansal.com> Reviewed-by: Nilay Shroff <nilay@linux.ibm.com> Link: https://patch.msgid.link/20261031044141.5569-1-laveeshb@laveeshbansal.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03zloop: fix the error code in the blk_mq_alloc_disk messageShao Mingyin
When blk_mq_alloc_disk() fails, "ret" still holds the zero returned by the preceding blk_mq_alloc_tag_set() call, so the error message always reports "err=0". Save PTR_ERR(zlo->disk) in "ret" before printing it, like the blk_mq_alloc_tag_set() and add_disk() failure paths do. Fixes: eb0570c7df23 ("block: new zoned loop block device driver") Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://patch.msgid.link/20261031221737569WQ3bg8y80Ht7JdTCWwlkL@zte.com.cn Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03block: report the correct discard alignment in sysfsAvi Weiss
disk_discard_alignment_show() reports the physical I/O alignment offset instead of the discard alignment. Devices can specify these offsets independently, so the discard_alignment sysfs attribute can report the wrong value. Use bdev_discard_alignment() for the whole-disk attribute, as is already done for partitions. Fixes: 4e1462ffe899 ("block: remove queue_discard_alignment") Signed-off-by: Avi Weiss <thnkslprpt@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/20261031102023.3644494-2-thnkslprpt@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03block: only fail dma-buf bios that need block layer PIKyle Bader
All dma-buf (P2P) I/O to a device with integrity data is rejected today, at registration and in blk_mq_submit_bio(). Only a bio for which the block layer generates or verifies PI needs that. The block layer then walks the bio_vecs, and a dma-buf bio has none. Reject only those bios, and remove the check at registration. Then a submitter that attaches its own PI, for example with IORING_RW_ATTR_FLAG_PI, can do dma-buf I/O to such a device. Link: https://lore.kernel.org/all/bbb87d6b-b7a3-487a-8be4-27f3f9ce4a1b@samsung.com/ Assisted-by: LLM Reviewed-by: Anuj Gupta <anuj20.g@samsung.com> Signed-off-by: Kyle Bader <kbader@ibm.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://patch.msgid.link/20261029155821.2983229-1-kbader@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03block: partitions: reject GPT entries with starting_lba > ending_lbaZizhi Wo
A GPT entry whose starting_lba is greater than its ending_lba is accepted, and the kernel creates a partition with a bogus size. The bogus sector count defeats the end-of-device check, so I/O through that partition is not confined to it and can access sectors outside the partition on the same disk. is_pte_valid() only rejects an entry when its type is NULL or when starting_lba or ending_lba is greater than lastlba; it never checks that starting_lba <= ending_lba. For a reversed entry both field checks still pass, but efi_partition() computes size = ending_lba - starting_lba + 1 in u64, which underflows to a huge value. That value also wraps in the end-of-device check in blk_add_partition() (from + size) and does not fit the signed i_size, which turns negative. Reject entries with starting_lba > ending_lba in is_pte_valid(), matching the head-level check against last_usable_lba < first_usable_lba. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Zizhi Wo <wozizhi@huawei.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/20261102080442.3775061-1-wozizhi@huaweicloud.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03virtio-blk: Fix zone append sector reporting in batched completionShao Mingyin
For zone append, the block layer copies req->__sector back into the bio in blk_zone_append_update_request_bio(), so the driver must update req->__sector with the sector reported by the device. virtblk_request_done() does that, but the batched completion path used by virtblk_poll() only unmaps and cleans up the requests before calling blk_mq_end_request_batch(). A zone append completed through polling therefore keeps the sector that was assigned at submission time, and the file system or application sees the wrong LBA for the written data. Move the sector update into a helper and call it from both completion paths. Fixes: 95bfec41bd3d ("virtio-blk: add support for zoned block devices") Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/202610261955196384aSLGuy3_0MiTvlYXVdiC@zte.com.cn Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03blk-mq: reset queue state on scheduler teardownJianan Huang
We observed I/O timeouts with requests stalled in per-CPU software queues. The affected queue had no elevator, but QUEUE_FLAG_SQ_SCHED remained set. A failed elevator switch can leave this state when falling back to none without clearing the flag. With empty hctx dispatch lists, a queue-wide restart on CPU4 would skip requests pending in ctx5/ctx7: CPU4: blk_mq_run_hw_queues(q) sq_hctx = hctx4 hctx4: no pending requests -> selected hctx5: 9 reads in ctx5 -> skipped hctx7: 3 writes in ctx7 -> skipped The pending requests may remain undispatched until another event runs their hardware queues. Clear the flag and restore nr_requests and async_depth to the driver queue depth in the common scheduler teardown path, covering both scheduler exit and failed initialization. Fixes: 4d337cebcb1c ("blk-mq: avoid to touch q->elevator without any protection") Assisted-by: LLM Signed-off-by: Jianan Huang <jnhuang95@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/20261023092611.116795-1-jnhuang95@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03xfs: fix wrong compat fields in xfs_ioctl32_bstat_copyin()Reid Downing
bs_blocks and bs_xflags were both read from bstat32->bs_size. Read each one from its own field instead. Fixes: e94fc4a43e5c39 ("[XFS] Add compat handlers for swapext ioctl") Cc: stable@vger.kernel.org # v2.6.29 Signed-off-by: Reid Downing <skibletz@gmail.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Carlos Maiolino <cem@kernel.org>
2026-11-03block: Return the soft block size for compat BLKBSZGETHungyu Lin
BLKBSZGET returns the block device's soft block size, while BLKSSZGET returns its logical sector size. The compat BLKBSZGET_32 handler uses bdev_logical_block_size(), so it returns the wrong value when these sizes differ. For example, on an x86_64 kernel a native query of a RAM or loop device with 512-byte logical sectors returns the initial soft block size of 4096 bytes, but an i386 process gets 512 bytes. This makes 32-bit blockdev --getbsz and the BSZ column of --report disagree with native queries, even without a preceding BLKBSZSET. Use block_size() as the native handler and the pre-regression compat handler do, and correct the case comment to describe the soft size. Fixes: 9b81648cb5e3 ("compat_ioctl: simplify up block/ioctl.c") Cc: stable@vger.kernel.org Signed-off-by: Hungyu Lin <dennylin0707@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/20261023153645.37546-1-dennylin0707@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03virtio_blk: use synchronous quiesce in virtblk_freeze_priv()Cong Zhang
blk_mq_run_work_fn() can call blk_mq_sched_dispatch_requests() through blk_mq_run_dispatch_ops(). The dispatcher checks QUEUE_FLAG_QUIESCED while the flag is clear. It can then be preempted before it gets a request. At that time, it has no queue usage reference, so blk_mq_freeze_queue() does not wait for it. virtblk_freeze_priv() then calls blk_mq_quiesce_queue_nowait() and blk_mq_unfreeze_queue(). A new request can enter the queue. The old dispatcher can run again, use its old flag check, get the new request, and call virtio_queue_rq(). At the same time, virtblk_freeze_priv() can reset the device, delete the virtqueues, and free vblk->vqs. The old dispatcher can then use a deleted virtqueue or a NULL vblk->vqs, and the kernel can crash. Fix this by using blk_mq_quiesce_queue(), which waits for dispatch code that was already running. Keep the existing freeze and unfreeze order. The queue remains quiesced until virtblk_restore_priv() calls blk_mq_unquiesce_queue(). Fixes: 7678abee0867 ("virtio-blk: don't keep queue frozen during system suspend") Cc: stable@vger.kernel.org Acked-by: Jason Wang <jasowangio@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Cong Zhang <cong.zhang@oss.qualcomm.com> Link: https://lore.kernel.org/20260911-virtblk_sync_quiesce-v1-1-a883f8f31258@oss.qualcomm.com Link: https://patch.msgid.link/20261103-virtblk_sync_quiesce-v3-1-f40233f9bdd9@oss.qualcomm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03null_blk: reset cache state before device setupBaek Kyu, Kim
The CACHE flag belongs to nullb_device, which outlives each powered-on nullb instance. Power-off discards the runtime cache but leaves the flag set. If cache_size changes from 1 to 0 before the next power-on, the queue advertises write-through while new page writes still go into the cache tree. A completed write can then disappear at the next power-off. Clear CACHE before creating the new instance. The existing cache_size setup sets it again when the new instance needs a cache. Signed-off-by: Baek Kyu, Kim <pocj8ur4in@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/20261025161133.59344-1-pocj8ur4in@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03blk-mq: end the request if getting a keyslot failsJosef Bacik
When blk_crypto_rq_get_keyslot() fails, blk_mq_submit_bio() ends the bio by hand and frees the request. By then blk_mq_bio_to_request() has done the IO accounting, which blk_mq_free_request() doesn't undo, so the in_flight counter never drops and iostat shows a device that is 100% busy. If the bio went through zone write plugging the zone stays plugged as well, and every later write to it waits forever. Use blk_mq_end_request() like the dispatch path does for a request the driver rejected, after marking it for zone write plugging. Move the call to blk_zone_write_plug_init_request() before blk_crypto_rq_get_keyslot() so that it doesn't need to be duplicated. It doesn't depend on the keyslot. Fixes: 99dc422335d8 ("block: support to account io_ticks precisely") Fixes: dd291d77cc90 ("block: Introduce zone write plugging") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Eric Biggers <ebiggers@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/20261029200110.1328103-1-ebiggers@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03io_uring/sqpoll: don't set IO_SQ_THREAD_SHOULD_STOP on thread exitShuai Liu
io_sq_thread_stop() carries a WARN_ON_ONCE() asserting that IO_SQ_THREAD_SHOULD_STOP isn't set yet, i.e. that stopping the SQPOLL thread is never attempted twice. Since commit 22d9db9fd64a ("io_uring/sqpoll: don't attach to a thread that is canceling"), the SQPOLL thread itself sets that bit on its way out, so that io_sq_offload_create() won't attach a new ring to a thread that is canceling. When the thread exits on a fatal signal, the bit is thus set before the ring teardown gets to io_sq_thread_stop(), which now triggers the warning on every such exit: WARNING: io_uring/sqpoll.c:88 at io_sq_thread_stop Workqueue: iou_exit io_ring_exit_work Call Trace: io_put_sq_data io_sq_thread_finish io_ring_ctx_free io_ring_exit_work Introduce a separate IO_SQ_THREAD_EXITING bit for the thread marking itself as on its way out, and check it in io_sq_offload_create() along with IO_SQ_THREAD_SHOULD_STOP. IO_SQ_THREAD_SHOULD_STOP regains its original meaning, "a stop has been requested", and the WARN_ON_ONCE() holds again. Reproduced with an SQPOLL ring and an immediate fatal signal: the warning fires on v7.3.0+ (22d9db9fd64a present) and is gone with this change. Reported-by: syzbot+675af112519ca34f5502@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=675af112519ca34f5502 Fixes: 22d9db9fd64a ("io_uring/sqpoll: don't attach to a thread that is canceling") Signed-off-by: Shuai Liu <847807867@qq.com> Link: https://patch.msgid.link/tencent_BB08960D79E0261B5C1EB1E589787734E907@qq.com [axboe: trim excessive comment] Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-11-03printk: Avoid multiple unregistration in unregister_console_locked()John Ogness
unregister_console_locked() is called from within hlist_for_each_entry_safe(console_list) loops. This would be safe if unregister_console_locked() only unregistered the specified console. After all, that is what the _safe variant is for. However, unregister_console_locked() calls printk_kthreads_check_locked(), which can unregister _multiple_ consoles if kthreads fail to start. This could lead to hlist_for_each_entry_safe() use-after-free scenarios because not only was the list entry removed, but possibly the following entry as well (the @n temporary storage of the next entry). Move the call to printk_kthreads_check_locked() outside of unregister_console_locked(). Add comments to both functions to clarify if they are safe to be used in hlist_for_each_entry_safe(console_list) loops. Reported-by: Sashiko <sashiko-bot@kernel.org> Closes: https://lore.kernel.org/lkml/87ik31iz4x.fsf@jogness.linutronix.de Fixes: 76f258bf3f2a ("printk: nbcon: Introduce printer kthreads") Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> Tested-by: Derek Barbosa <debarbos@redhat.com> Link: https://patch.msgid.link/20261030135802.663893-1-john.ogness@linutronix.de Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-11-03RDMA/ionic: Use a linear QID space when udma_shift is zeroAbhijit Gangurde
Firmware reports udma_shift as the log2 of the number of queues in a queue group. A value of zero means the queues are not striped across two UDMAs, so the QID space is linear and the device has one UDMA. The interleaved bitid/qid transform treats bit 0 as the UDMA selector when the group shift is zero. QID 1 then becomes bitid 1 << half_qid_shift, and freeing that QID releases the wrong allocator index. Skip the transform and select one UDMA so QP and CQ allocation uses the QID directly. Fixes: e8521822c733 ("RDMA/ionic: Register device ops for control path") Reported-by: Keith Lucas <keith.lucas@oracle.com> Link: https://lore.kernel.org/r/20261021161651.4020222-1-haakon.bugge@oracle.com Cc: stable@vger.kernel.org # 6.18 Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com> Link: https://patch.msgid.link/20261030082402.841751-1-abhijit.gangurde@amd.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2026-11-03RDMA/irdma: Do not change mr->pd in driver during rereg_mrJacob Moroni
Previously, IB_MR_REREG_PD would cause the driver to set iwmr->ibmr.pd to the new PD before reregistering with HW because irdma_hwreg_mr() retrieves the PD from there. ib_uverbs_rereg_mr() only moves the PD usecnt from the old PD to the new one and updates mr->pd itself after the driver's rereg_user_mr() call succeeds. So, if the rereg_user_mr() call fails, the MR is left pointing at a PD that does not account for it while the old PD keeps the reference, which means the old PD can never be deallocated, while the new PD can be deallocated even though the MR still points at it. Fix this by removing the PD update from the driver and just letting the core handle it. This required plumbing the PD as an argument through a few functions. This works because the core passes the PD unconditionally and provides the current PD if IB_MR_REREG_PD is not set. Fixes: 5ac388db27c4 ("RDMA/irdma: Add support to re-register a memory region") Signed-off-by: Jacob Moroni <jmoroni@google.com> Link: https://patch.msgid.link/20261029135306.1372393-1-jmoroni@google.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2026-11-03RDMA/irdma: Do not allow rereg_mr to revive defunct MRsJacob Moroni
An MR can become "defunct" if a previous rereg_mr happened to fail in between deregistering the old MR in HW and reregistering it (e.g., due to ib_umem_get_va() failing in the IB_MR_REREG_TRANS case). In this case, the MR is left in a state where the umem may have already been released. If rereg_mr then runs again, but without IB_MR_REREG_TRANS, it will end up reregistering the MR with stale translation info. Fix this by rejecting any attempt to reregister an MR that has previously failed during rereg_mr after the point where the MR has been deregistered in HW. Fixes: 5ac388db27c4 ("RDMA/irdma: Add support to re-register a memory region") Signed-off-by: Jacob Moroni <jmoroni@google.com> Link: https://patch.msgid.link/20261029133121.1204636-1-jmoroni@google.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2026-11-03RDMA/mlx4: Fix stale umem and MTT state after rereg_mr failuresJacob Moroni
During rereg_mr, the umem is released in various failure cases but mmr->umem was left pointing to a freed umem, so it could end up getting double-freed when the MR is finally deregistered, or cause a UAF in ib_umem_check_rereg() if another rereg_mr attempt is made. Fix this by setting mmr->umem to NULL after ib_umem_release(). Additionally, when mlx4_mr_rereg_mem_write() fails, mtt.order is left set but with an invalid offset, so during dereg, mlx4_mtt_cleanup() ends up freeing an MTT range that was never allocated. Fix this by resetting mtt.order to -1 in that path. Fixes: 9376932d0c26 ("IB/mlx4_ib: Add support for user MR re-registration") Signed-off-by: Jacob Moroni <jmoroni@google.com> Link: https://patch.msgid.link/20261029132740.1169950-1-jmoroni@google.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2026-11-03inotify: do not coalesce rename eventsHungyu Lin
inotify compares the mask, watch descriptor and name when coalescing adjacent unread events, but ignores their rename cookies. Distinct IN_MOVED_FROM events can therefore be coalesced, losing the cookie needed to match a later IN_MOVED_TO event. For example, watch two directories with IN_MOVE. Move an entry from the first directory into an unwatched directory, recreate it under the same name, then move it from the first directory into the second watched directory before reading the events. The second IN_MOVED_FROM is merged with the first, while the IN_MOVED_TO retains the second rename's cookie. Userspace can no longer pair the second rename's events. The original inotify implementation compared cookies before coalescing. The fsnotify conversion lost this comparison. Do not coalesce IN_MOVED_FROM or IN_MOVED_TO events, which carry the identity of their respective renames. Leave coalescing of other event types unchanged. Fixes: 63c882a05416 ("inotify: reimplement inotify using fsnotify") Cc: stable@vger.kernel.org Suggested-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Link: https://patch.msgid.link/20261027192027.8617-1-dennylin0707@gmail.com Signed-off-by: Jan Kara <jack@suse.cz>
2026-11-03ext2: only flush DIRSYNC directories on every changeJosef Bacik
Every change of an ext2 directory is written to disk before the system call returns, whether the directory is DIRSYNC or not: its pages with filemap_write_and_wait() and its inode with sync_inode_metadata(). Writes which reach the device for 2000 files, and 200 directories, in a directory without DIRSYNC, with the flusher turned off: create rename unlink mkdir before 4000 8000 4000 800 after 0 0 0 0 In a directory with chattr +D the numbers are those of "before", before and after. commit bc943f4872a7 ("ext2: Don't flush page immediately for DIRSYNC directories") moved the flush from ext2_commit_chunk() to the new ext2_handle_dirsync(). The IS_DIRSYNC() check which was around it didn't move along. Fix by putting the check into ext2_handle_dirsync(). Fixes: bc943f4872a7 ("ext2: Don't flush page immediately for DIRSYNC directories") Signed-off-by: Josef Bacik <josef@toxicpanda.com> Link: https://patch.msgid.link/20261027-b4-ext2-dirsync-v1-1-3dcd012d518d@toxicpanda.com Signed-off-by: Jan Kara <jack@suse.cz>
2026-11-03virtio_pci: don't take the MSI mutex under cpu_hotplug_lockZenghui Yu (Huawei)
Lockdep reports the following circular locking dependency when a virtio-net device is probed with lockdep enabled on a system whose devices sit behind an IOMMU: ====================================================== WARNING: possible circular locking dependency detected 7.3.0-rc1+ #84 Not tainted ------------------------------------------------------ kworker/u34:0/57 is trying to acquire lock: ffff800104f83ee8 (&md->mutex){+.+.}-{4:4}, at: msi_domain_get_virq+0xf0/0x118 but task is already holding lock: ffffc00081edd930 (cpu_hotplug_lock){++++}-{0:0}, at: cpus_read_lock+0x10/0x1c which lock already depends on the new lock. Chain exists of: &md->mutex --> &group->mutex --> cpu_hotplug_lock The cycle is composed of three dependencies: * cpu_hotplug_lock -> &md->mutex (which triggers the splat). virtio_net's init_vqs() calls cpus_read_lock() around virtnet_set_affinity(), which reaches vp_set_vq_affinity(). That calls pci_irq_vector(), which takes the per-device MSI mutex (&dev->msi.data->mutex) via msi_domain_get_virq(). * &md->mutex -> &domain->mutex -> &group->mutex. MSI-X allocation of any device behind the IOMMU holds the MSI mutex while allocating interrupts through the IRQ domain hierarchy. The MSI parent domain (GICv2m, or ITS likewise) calls iommu_dma_prepare_msi() from its .alloc() to map the MSI doorbell, which takes the IOMMU group mutex. * &group->mutex -> cpu_hotplug_lock. bus_iommu_probe() calls iommu_setup_dma_ops() under the group mutex; initializing the IOVA rcaches registers a cpuhp instance, which takes cpu_hotplug_lock. The cycle only became complete since commit 288683c92b1a ("iommu: Make iommu_dma_prepare_msi() into a generic operation"), where iommu_dma_prepare_msi() switched to use the group mutex. pci_irq_vector() is a pure lookup of a vector that is bound to the queue for the whole lifetime of the queue, so there is no reason to take the MSI mutex for it from cpu hotplug locked contexts. Cache the IRQ number in virtio_pci_vq_info {} at vector binding time and make vp_set_vq_affinity() use the cached value. This also covers the CPU hotplug callbacks (virtnet_cpu_online/virtnet_cpu_dead), which call virtnet_set_affinity() with cpu_hotplug_lock already held. Signed-off-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261029121648.22155-1-zenghui.yu@linux.dev>
2026-11-03virtio_ring: Initialize id field in packed indirect descriptorszhang jiao
The virtqueue_add_indirect_packed() function fills an indirect descriptor table with addr, len, and flags for each entry, but does not initialize the id field of struct vring_packed_desc. The table is allocated via kmalloc() (not kzalloc) and then DMA-mapped with DMA_TO_DEVICE, making the uninitialized 2-byte id field of each descriptor readable by the device. This leaks kernel heap memory to the device for every packed indirect descriptor entry. A malicious or compromised device could extract heap contents by reading the id fields from the DMA-mapped indirect descriptor tables. This affects all virtio devices that use packed virtqueues with indirect descriptors, which is the common configuration for modern virtio devices. Fix this by explicitly initializing desc[i].id to zero in the descriptor filling loop. The id field is unused in indirect descriptor table entries per the virtio specification (only the head descriptor in the main ring uses id for buffer identification), so setting it to zero is semantically correct. This matches the split ring path where all four fields of struct vring_desc (addr, len, flags, next) are explicitly written in virtqueue_add_desc_split(). Signed-off-by: zhang jiao <zhangjiao2@cmss.chinamobile.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261029072511.851-1-zhangjiao2@cmss.chinamobile.com>
2026-11-03vhost-scsi: fix page reference leak in misaligned I/O fallbackJia Jia
iov_iter_get_pages2() returns a byte count that excludes the offset into the first page, but also returns a reference to that page in pages[]. On the misaligned-I/O fallback, vhost_scsi_revert_map_iov_to_sgl() puts pages already added to the SG list. The cleanup loop starts at pages[npages], but accounts for its first page as PAGE_SIZE bytes rather than PAGE_SIZE - offset. If the remaining data starts at a non-zero offset, it can finish one page early and leave a page reference behind. Use PAGE_SIZE - offset for the first remaining page and clear offset for later pages, as in the mapping loop. Without this, each affected request leaks one page reference. Fixes: bca939d5bcd0 ("vhost-scsi: Dynamically allocate scatterlists") Reviewed-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Jia Jia <physicalmtea@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261023104035.6686-1-physicalmtea@gmail.com>
2026-11-03vduse: fix VA/PA confusion in the coherent page fault pathchenglong.ma
vduse_domain_get_coherent_page() assumes that iotlb entries above bounce_size were installed by vduse_domain_alloc_coherent(), so it treats map->addr as a physical address. But vduse registers with use_va = true, and when the device is bound to vhost_vdpa, vhost_vdpa_va_map() stores a userspace virtual address in map->addr, which vduse_domain_set_map() then copies into the same iotlb. A process holding the domain file descriptor across a rebind can therefore fault in an arbitrary physical page with read/write access, ignoring the entry permissions. Additionally, since the domain file mmap lacks VM_IO, the domain file itself can be mapped and passed to vhost_vdpa_va_map(), producing self-referential entries that bypass the coherent path check. To fix, only translate entries whose backing file is the domain file itself in vduse_domain_get_coherent_page(), reject such entries in vduse_domain_set_map() since only external mappings should be imported, and set VM_IO on the domain file mmap so vhost_vdpa_va_map() refuses to map it in the first place. Fixes: 8c773d53fb7b ("vduse: Implement an MMU-based software IOTLB") Cc: Xie Yongji <xieyongji@bytedance.com> Cc: stable@vger.kernel.org Reported-by: chenglong.ma <longpareto@gmail.com> Signed-off-by: chenglong.ma <longpareto@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-03hwrng: virtio - prevent use-after-free after a failed restoreThorsten Blum
remove_common() frees the driver data during freeze, but does not clear vdev->priv, which points to freed memory. If probe_common() then fails during restore, a later remove or freeze can dereference the dangling pointer. Clear vdev->priv on the probe_common() error cleanup path and before freeing the driver data in remove_common(). Also reset the device and return early from remove_common() if vdev->priv is already NULL for a safe teardown after a failed restore. Fixes: 08e53fbdb85c ("virtio-rng: support multiple virtio-rng devices") Cc: stable@vger.kernel.org Signed-off-by: Thorsten Blum <blum@kernel.org> Reviewed-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261016103640.4989-2-blum@kernel.org>
2026-11-03virtio: use consistent virtqueue terminologyWei-Shuo Chen
Use virtqueue consistently in the notify function comments across the MMIO and PCI transports. Assisted-by: LLM Signed-off-by: Wei-Shuo Chen <tavhadia@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261016072318.24015-1-tavhadia@gmail.com>
2026-11-03virtio_balloon: initialize wakeup_lock before virtqueues are set upMingbing Zhai
Since c578123e63da ("virtio_balloon: Treat stats requests as wakeup events") the stats_request() virtqueue callback takes vb->wakeup_lock via start_wakeup_event(). init_vqs() registers that callback and even primes and kicks the stats queue, so the lock is reachable from irq context as soon as init_vqs() returns, long before the driver sets DRIVER_OK: vring_interrupt() dispatches to the callback without any DRIVER_OK check unless CONFIG_VIRTIO_HARDEN_NOTIFICATION is set, and that option depends on BROKEN. syzbot hit it from a threaded irq: INFO: trying to register non-static key in stats_request ... assign_lock_key register_lock_class lock_acquire rt_spin_lock start_wakeup_event drivers/virtio/virtio_balloon.c:150 [inline] stats_request drivers/virtio/virtio_balloon.c:435 The lock is only initialized near the end of virtballoon_probe(), after init_vqs() and several steps that can still fail and unwind through del_vqs(), where a racing interrupt still finds the callback registered. Until then it is whatever kzalloc() left in vb: lockdep complains about the unregistered lock class, and wakeup_signal_mask and processing_wakeup_event get updated from irq context while probe is still running. The rt_spin_lock() in the report is just spin_lock() on PREEMPT_RT; any PROVE_LOCKING build takes the same path. stop_update_lock(), which the same callback also acquires, is already initialized before init_vqs(); do the same for wakeup_lock. Fixes: c578123e63da ("virtio_balloon: Treat stats requests as wakeup events") Reported-by: syzbot+13df72e0dc4be5c62215@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=13df72e0dc4be5c62215 Signed-off-by: Mingbing Zhai <zhaimingbing@cmss.chinamobile.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261016025429.901-1-zhaimingbing@cmss.chinamobile.com>
2026-11-03MAINTAINERS: add missing virtio/vdpa/vduse/vhost headersEugenio Pérez
Several headers related to virtio, vDPA, VDUSE and vhost were not covered by any specific MAINTAINERS entry and fell through to the catch-all THE REST section: - include/linux/device-id/virtio.h: not matched by the existing "include/linux/virtio*.h" glob, which only matches files directly under include/linux/ and does not recurse into subdirectories. - include/uapi/linux/vdpa.h: the in-kernel include/linux/vdpa.h was listed under VIRTIO CORE but its UAPI companion was missing; the "include/uapi/linux/virtio_*.h" pattern does not match it because the filename lacks the "virtio_" prefix. - include/uapi/linux/vduse.h: there is no dedicated VDUSE section in MAINTAINERS; the driver lives under drivers/vdpa/ which is already covered by VIRTIO CORE, so the UAPI header belongs there too. - include/uapi/linux/vhost_types.h: the VIRTIO HOST (VHOST) section explicitly lists include/uapi/linux/vhost.h but omits its companion types header. Assisted-by: claude-sonnet 4.6 Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261015094049.107999-1-eperezma@redhat.com>
2026-11-03vhost-vdpa: initialize state before publishing cdevLinfeng Sun
Initialize the completion and as hash buckets before cdev_device_add() makes the device accessible. Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend") Assisted-by: OpenAI-Codex:GPT-5.6 Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261011-fix-null-pointer-in-vhost_vdpa_release-v2-1-66ba929971ce@gmail.com>
2026-11-03vhost: reject backend enable without a kick fileLinfeng Sun
Enabling a backend without VHOST_SET_VRING_KICK dereferences a NULL vq->kick in vhost_poll_start(). Reject the request with -EINVAL. Fixes: 264ee5aa81ec ("tools/virtio: Add --reset") Assisted-by: OpenAI-Codex:GPT-5.6 Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261011-fix-null-pointer-in-vhost_test_set_backend-v1-1-60b2f12d64c6@gmail.com>
2026-11-03vhost-scsi: reject delayed virtqueue setupLinfeng Sun
vhost_scsi_set_endpoint() allocates command pools only for I/O virtqueues that are already set up, but publishes the backend for every virtqueue. Userspace can complete a skipped queue after attaching the endpoint, then kick it with scsi_tags uninitialized and trigger the alloc_hint warning in sbitmap_get(). Delayed virtqueue setup is not supported. Leave skipped I/O virtqueues inactive and reject changes to the vring size or addresses while an endpoint is attached. Userspace must clear the endpoint before changing the vring configuration. I found this bug myself, though the patch was written with AI assistance. Fixes: 25b98b64e284 ("vhost scsi: alloc cmds per vq instead of session") Assisted-by: OpenAI-Codex:GPT-5.6 Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261010-fix-warning-in-sbitmap_get-v3-1-33de562d1359@gmail.com>
2026-11-03virtio_ring: use shadow flags when detaching split descriptorssungbyeongchan
Split virtqueues save descriptor flags and next indexes in desc_extra before publishing descriptors to the device. The detach path uses the shadow next index, but decides whether to continue by rereading the NEXT flag from the shared descriptor. Use the shadow flags for the continuation decision as well. This keeps all detach metadata in the same driver-owned snapshot and avoids an unnecessary shared-ring read. Fixes: 72b5e8958738 ("virtio-ring: store DMA metadata in desc_extra for split virtqueue") Acked-by: Michael S. Tsirkin <mst@redhat.com> Assisted-by: LLM Signed-off-by: sungbyeongchan <tjdqudcks0424@naver.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261008050423.32221-1-tjdqudcks0424@naver.com>
2026-11-03vhost-scsi: validate event queue descriptor directionLinfeng Sun
vhost_get_vq_desc() returns the number of device readable (output) and device writable (input) iovec segments. A guest can submit an eventq descriptor chain that fills vq->iov with output segments, setting out to ARRAY_SIZE(vq->iov) and in to zero. When the host later queues a vhost-scsi event, vhost_scsi_do_evt_work() uses out as the index of the first input segment. This accesses one element beyond vq->iov and triggers an array-index-out-of-bounds report. With panic_on_warn enabled, the report panics the host. The event queue accepts device writable buffers only. Reject chains that contain output segments or lack an input segment before using out as an index. The input check prevents the out-of-bounds access, while the output check validates the eventq descriptor direction. I found the descriptor direction issue myself, though the patch was written with AI assistance. The out-of-bounds read with an output-only chain was separately reported by Jia Jia. Fixes: a6c9af87363c ("tcm_vhost: Add hotplug/hotunplug support") Reported-by: Jia Jia <physicalmtea@gmail.com> Assisted-by: OpenAI-Codex:GPT-5 Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com> Message-ID: <20261009-fix-arrary-index-out-of-bounds-in-vhost_scsi_complete_events-v2-1-1f7689a54735@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2026-11-03power: sequencing: qcom-wcn: increase WCN7850 power-up delayShuai Zhang
When the WCN7850 is powered up from the Bluetooth side first, i.e. BT_EN is asserted while WLAN_EN is still low, the chip starts from a cold state and is not ready to accept the first HCI command 50 ms after BT_EN goes high. The first command (0xfc00, read QCA version) is lost, hci_qca does not resend it and fails after the 2 s command timeout: Bluetooth: hci0: Reading QCA version information failed (-110) When WLAN is powered first, 50 ms is sufficient, so the failure only shows up in the BT-first ordering. Measured on the affected board by which enable pin rose first: pwup_delay_ms BT-first boots with -110 50 9 9 75 23 0 100 21 0 300 20 0 Raise the power-up delay of WCN7850 to 100 ms. The delay is shared by the Bluetooth and WLAN targets, so WLAN power-up also waits 50 ms longer. Fixes: 2f1630f437df ("power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets") Signed-off-by: Cheng Jiang <cheng.jiang@oss.qualcomm.com> Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://patch.msgid.link/20261102094800.3225454-1-shuai.zhang@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-11-03serial: samsung: put the previous baud clockJosef Bacik
s3c24xx_serial_getclk() returns the best baud clock with the reference which clk_get() has taken. s3c24xx_serial_set_termios() stores it in ourport->baudclk and disables the clock which was there before, but does not put it. clk_get() hands out a new handle on every call, so the new clock never equals the old one, and every call of ->set_termios() leaks a handle: a struct clk and a copy of the connection name. Whoever has the port open can repeat that at will with tcsetattr(). Put the old clock when it is replaced, and the new one in case it is not stored. Fixes: 5f5a7a5578c5 ("serial: samsung: switch to clkdev based clock lookup") Cc: stable <stable@kernel.org> Cc: Krzysztof Kozlowski <krzk@kernel.org> Cc: Peter Griffin <peter.griffin@linaro.org> Cc: Alim Akhtar <alim.akhtar@samsung.com> Cc: Jiri Slaby <jirislaby@kernel.org> Cc: Kukjin Kim <kgene.kim@samsung.com> Cc: Thomas Abraham <thomas.abraham@linaro.org> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://patch.msgid.link/20261027-tty-llm-v1-22-99b0202ae546@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-11-03serial: samsung: don't leak the tty on an RX IRQJosef Bacik
s3c24xx_serial_rx_chars_dma() starts by taking a reference to the tty. If the interrupt is not a receive timeout, it switches the port from PIO back to DMA and leaves through the "finish" label, which does not drop the reference. A port with RX DMA changes to PIO on every receive timeout, that is at the end of every burst of data, and comes back this way when the next burst starts. So each burst takes a reference which is never dropped, and the tty structure is not freed when the port is closed for the last time. Drop the reference on both paths. Fixes: b543c301c2c5 ("serial: samsung: add DMA support for RX") Cc: stable <stable@kernel.org> Cc: Krzysztof Kozlowski <krzk@kernel.org> Cc: Peter Griffin <peter.griffin@linaro.org> Cc: Alim Akhtar <alim.akhtar@samsung.com> Cc: Jiri Slaby <jirislaby@kernel.org> Cc: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://patch.msgid.link/20261027-tty-llm-v1-21-99b0202ae546@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>