Skip to content

Commit ccc45cb

Browse files
hoeppnerjaxboe
authored andcommitted
s390/dasd: Use correct lock while counting channel queue length
The lock around counting the channel queue length in the BIODASDINFO ioctl was incorrectly changed to the dasd_block->queue_lock with commit 583d653 ("dasd: remove dead code"). This can lead to endless list iterations and a subsequent crash. The queue_lock is supposed to be used only for queue lists belonging to dasd_block. For dasd_device related queue lists the ccwdev lock must be used. Fix the mentioned issues by correctly using the ccwdev lock instead of the queue lock. Fixes: 583d653 ("dasd: remove dead code") Cc: stable@vger.kernel.org # v5.0+ Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://lore.kernel.org/r/20230609153750.1258763-2-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 8cfb981 commit ccc45cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/s390/block/dasd_ioctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,10 @@ static int __dasd_ioctl_information(struct dasd_block *block,
552552

553553
memcpy(dasd_info->type, base->discipline->name, 4);
554554

555-
spin_lock_irqsave(&block->queue_lock, flags);
555+
spin_lock_irqsave(get_ccwdev_lock(base->cdev), flags);
556556
list_for_each(l, &base->ccw_queue)
557557
dasd_info->chanq_len++;
558-
spin_unlock_irqrestore(&block->queue_lock, flags);
558+
spin_unlock_irqrestore(get_ccwdev_lock(base->cdev), flags);
559559
return 0;
560560
}
561561

0 commit comments

Comments
 (0)