s390/dasd: fix double module refcount decrement
PATCH 1/1 s390/dasd: fix double module refcount decrement
From: Miroslav Franc <[email protected]>
[ 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.
---
Verified the build test.
--- drivers/s390/block/dasd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/s390/block/dasd.c +1 -4
@@ -3637,12 +3637,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 */
@@ -3650,8 +3649,6 @@ int dasd_generic_set_online(struct ccw_device *cdev,if (rc) {pr_warn ("%s Setting the DASD online with discipline %s failed with rc=%i\n" ,dev_name (&cdev->dev), discipline->name, rc); -module_put (discipline->owner); -module_put (base_discipline->owner);dasd_delete_device (device);return rc; }
Signature · 1 line
2.34.1
Sasha Levin
maintainer[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: c3116e62ddeff79cae342147753ce596f01fcf06
WARNING: Author mismatch between patch and upstream commit:
Backport author: Feng Liu<[email protected]> Commit author: Miroslav Franc<[email protected]>
Status in newer kernel trees:
6.14.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: ec09bcab32fc) 6.1.y | Present (different SHA1: ad999aa18103) 5.15.y | Present (different SHA1: edbdb0d94143)
Note: The patch differs from the upstream commit:
---
1: c3116e62ddeff ! 1: aa5101aca4e99 s390/dasd: fix double module refcount decrement
@@ Metadata
## Commit message ##
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
@@ Commit message
+ [Minor context change fixed]
+ Signed-off-by: Feng Liu <[email protected]>
+ Signed-off-by: He Zhe <[email protected]>
## drivers/s390/block/dasd.c ##
@@ drivers/s390/block/dasd.c: int dasd_generic_set_online(struct ccw_device *cdev,
@@ drivers/s390/block/dasd.c: int dasd_generic_set_online(struct ccw_device *cdev,
/* check_device will allocate block device if necessary */
@@ drivers/s390/block/dasd.c: 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);
+ pr_warn("%s Setting the DASD online with discipline %s failed with rc=%i\n",
+ dev_name(&cdev->dev), discipline->name, rc);
- module_put(discipline->owner);
- module_put(base_discipline->owner);
dasd_delete_device(device);
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-5.10.y | Success | Success |