umber-kernel/drivers/s390
Salah Triki 6715560527 s390/cio: Fix device lifecycle handling in css_alloc_subchannel()
[ Upstream commit f65c75b0b9b5a390bc3beadcde0a6fbc3ad118f7 ]

`css_alloc_subchannel()` calls `device_initialize()` before setting up
the DMA masks. If `dma_set_coherent_mask()` or `dma_set_mask()` fails,
the error path frees the subchannel structure directly, bypassing
the device model reference counting.

Once `device_initialize()` has been called, the embedded struct device
must be released via `put_device()`, allowing the release callback to
free the container structure.

Fix the error path by dropping the initial device reference with
`put_device()` instead of calling `kfree()` directly.

This ensures correct device lifetime handling and avoids potential
use-after-free or double-free issues.

Fixes: e5dcf0025d ("s390/css: move subchannel lock allocation")
Signed-off-by: Salah Triki <salah.triki@gmail.com>
Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2026-02-26 14:59:01 -08:00
..
block s390/dasd: Fix gendisk parent after copy pair swap 2026-01-02 12:57:08 +01:00
char more s390 updates for 6.18 merge window 2025-10-09 10:51:43 -07:00
cio s390/cio: Fix device lifecycle handling in css_alloc_subchannel() 2026-02-26 14:59:01 -08:00
crypto s390/ap: Fix wrong APQN fill calculation 2026-01-30 10:32:25 +01:00
net s390/ctcm: Fix double-kfree 2025-11-17 16:58:25 -08:00
scsi Merge branch '6.16/scsi-queue' into 6.16/scsi-fixes 2025-06-09 15:34:06 -04:00
virtio s390/virtio_ccw: Don't allocate/assign airqs for non-existing queues 2025-04-09 12:12:41 +02:00
Makefile