Skip to contentSkip to conversation

s390/dasd: fix locking error

PATCH Applied Stefan Haberland 2 participants 3 messages Jun 9, 2023

Subsystems (3)
lore
Share & tools
lore

Stefan Haberland

author maintainer
#0 lore raw

cover s390/dasd: fix locking error

Hi Jens,

please apply the following patch that fixes a locking error in the DASD driver. Thanks.

Jan Höppner (1):
s390/dasd: Use correct lock while counting channel queue length

 drivers/s390/block/dasd_ioctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.39.2
author maintainer
#1 lore raw

PATCH 1/1 s390/dasd: Use correct lock while counting channel queue length

From: Jan Höppner <[email protected]>

The lock around counting the channel queue length in the BIODASDINFO ioctl was incorrectly changed to the dasd_block->queue_lock with commit 583d6535cb9d ("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 583d6535cb9d ("dasd: remove dead code")
---
 drivers/s390/block/dasd_ioctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/block/dasd_ioctl.c +2 -2
index 9327dcdd6e5e..8fca725b3dae 100644
@@ -552,10 +552,10 @@ static int __dasd_ioctl_information(struct dasd_block *block,
 
 	memcpy(dasd_info->type, base->discipline->name, 4);
 
-	spin_lock_irqsave(&block->queue_lock, flags);
+	spin_lock_irqsave(get_ccwdev_lock(base->cdev), flags);
 	list_for_each(l, &base->ccw_queue)
 		dasd_info->chanq_len++;
-	spin_unlock_irqrestore(&block->queue_lock, flags);
+	spin_unlock_irqrestore(get_ccwdev_lock(base->cdev), flags);
 	return 0;
 }
 
Signature · 1 line
2.39.2
maintainer Applied
#2 lore raw
In reply to Stefan Haberland
Quoted 10 lines · Stefan Haberland

please apply the following patch that fixes a locking error in the DASD driver. Thanks.

Jan Höppner (1):
s390/dasd: Use correct lock while counting channel queue length

drivers/s390/block/dasd_ioctl.c | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)

[...]

Applied, thanks!

[1/1] s390/dasd: Use correct lock while counting channel queue length

      commit: ccc45cb4e7271c74dbb27776ae8f73d84557f5c6

Best regards,

Signature · 1 line
Jens Axboe