]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
s390/ism: add release function for struct device
authorJulian Ruess <julianr@linux.ibm.com>
Fri, 14 Feb 2025 12:01:37 +0000 (13:01 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 18 Feb 2025 00:40:07 +0000 (16:40 -0800)
commit915e34d5ad35a6a9e56113f852ade4a730fb88f0
tree6a0e4d9144e8b1900370eb2cf645122c136f91a9
parent07b598c0e6f06a0f254c88dafb4ad50f8a8c6eea
s390/ism: add release function for struct device

According to device_release() in /drivers/base/core.c,
a device without a release function is a broken device
and must be fixed.

The current code directly frees the device after calling device_add()
without waiting for other kernel parts to release their references.
Thus, a reference could still be held to a struct device,
e.g., by sysfs, leading to potential use-after-free
issues if a proper release function is not set.

Fixes: 8c81ba20349d ("net/smc: De-tangle ism and smc device initialization")
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
Signed-off-by: Julian Ruess <julianr@linux.ibm.com>
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250214120137.563409-1-wintera@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/s390/net/ism_drv.c