Skip to contentSkip to conversation

Revert "s390/cio: Fix device lifecycle handling in css_alloc_subchannel()"

PATCH In review Ben Hutchings 3 participants 4 messages May 26 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "s390/cio: Fix device lifecycle handling in css_alloc_subchannel()"

This reverts commit 2b2ad7ad4a28ffdb9f94e6d979b88a5b12b71681, which was commit f65c75b0b9b5a390bc3beadcde0a6fbc3ad118f7 upstream. The order of initialisation and error paths in this function are substantially different in 5.10 and this backport did not take that into account.

---
 drivers/s390/cio/css.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/cio/css.c +1 -1
index e5e20ea850aa..cf2c3c4c590f 100644
@@ -241,7 +241,7 @@ struct subchannel *css_alloc_subchannel(struct subchannel_id schid,
 	return sch;
 
 err:
-	put_device(&sch->dev);
+	kfree(sch);
 	return ERR_PTR(ret);
 }
 
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Ben Hutchings

This reverts commit 2b2ad7ad4a28ffdb9f94e6d979b88a5b12b71681, which was commit f65c75b0b9b5a390bc3beadcde0a6fbc3ad118f7 upstream. The order of initialisation and error paths in this function are substantially different in 5.10 and this backport did not take that into account.

Hi Ben,

Thank you for pointing it out.
I overlooked that part. The goto err was all before device_initialize().

Quoted 18 lines
---
  drivers/s390/cio/css.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/cio/css.c +1 -1
index e5e20ea850aa..cf2c3c4c590f 100644
@@ -241,7 +241,7 @@ struct subchannel *css_alloc_subchannel(struct subchannel_id schid,
  	return sch;
 
  err:
-	put_device(&sch->dev);
+	kfree(sch);
  	return ERR_PTR(ret);
  }
 
maintainer
#2 lore raw
In reply to Ben Hutchings
Quoted 4 lines · Ben Hutchings

The backported commit calls put_device() on the embedded struct device, which is now reached if css_sch_create_locks() fails, before it was initialised. This effectively reverts upstream commit f65c75b0b9b5 for 5.10.

Queued for 5.10, thanks. I also queued matching reverts on 5.15 (of b1d4e6fb24167) and 6.1 (of fd295a75d828c), since the same goto-err path lands at the err: label before device_initialize() on those branches too.

Signature · 2 lines
Thanks,
Sasha
#3 lore raw
Quoted 10 lines · Sasha Levin
Quoted 4 lines · Ben Hutchings

The backported commit calls put_device() on the embedded struct device, which is now reached if css_sch_create_locks() fails, before it was initialised. This effectively reverts upstream commit f65c75b0b9b5 for 5.10.

Queued for 5.10, thanks. I also queued matching reverts on 5.15 (of b1d4e6fb24167) and 6.1 (of fd295a75d828c), since the same goto-err path lands at the err: label before device_initialize() on those branches too.

Thanks. I am still working my way through various fixes needed for different stable branches. I agree with reverting for exactly those branches too.

Ben.

Signature · 2 lines
Ben Hutchings - Debian developer, member of kernel, installer and LTS
teams