Patch "s390/dasd: fix double module refcount decrement" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    s390/dasd: fix double module refcount decrement

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     s390-dasd-fix-double-module-refcount-decrement.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 0c773277cf693e3f79456943ac76d72d811bef51
Author: Miroslav Franc <mfranc@xxxxxxx>
Date:   Fri Feb 9 13:45:22 2024 +0100

    s390/dasd: fix double module refcount decrement
    
    [ Upstream commit c3116e62ddeff79cae342147753ce596f01fcf06 ]
    
    Once the discipline is associated with the device, deleting the device
    takes care of decrementing the module's refcount.  Doing it manually on
    this error path causes refcount to artificially decrease on each error
    while it should just stay the same.
    
    Fixes: c020d722b110 ("s390/dasd: fix panic during offline processing")
    Signed-off-by: Miroslav Franc <mfranc@xxxxxxx>
    Signed-off-by: Jan Höppner <hoeppner@xxxxxxxxxxxxx>
    Signed-off-by: Stefan Haberland <sth@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240209124522.3697827-3-sth@xxxxxxxxxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index f13f76fe3f2e2..fc33474271115 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -3573,12 +3573,11 @@ int dasd_generic_set_online(struct ccw_device *cdev,
 		dasd_delete_device(device);
 		return -EINVAL;
 	}
+	device->base_discipline = base_discipline;
 	if (!try_module_get(discipline->owner)) {
-		module_put(base_discipline->owner);
 		dasd_delete_device(device);
 		return -EINVAL;
 	}
-	device->base_discipline = base_discipline;
 	device->discipline = discipline;
 
 	/* check_device will allocate block device if necessary */
@@ -3586,8 +3585,6 @@ int dasd_generic_set_online(struct ccw_device *cdev,
 	if (rc) {
 		dev_warn(dev, "Setting the DASD online with discipline %s failed with rc=%i\n",
 			 discipline->name, rc);
-		module_put(discipline->owner);
-		module_put(base_discipline->owner);
 		dasd_delete_device(device);
 		return rc;
 	}




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux