linux/drivers/cdx
Prasanna Kumar T S M 6f4acc3a3c cdx: Fix double free when sysfs file creation fails
In cdx_create_res_attr(), if sysfs_create_bin_file() fails, the code
frees res_attr but doesn't set cdx_dev->res_attr[num] to NULL. This
leaves a dangling pointer in the array. Then cdx_destroy_res_attr()
frees the already-freed memory. Fix the double free by initializing
cdx_dev->res_attr[num] after sysfs_create_bin_file() completes.

Fixes: aeda33ab81 ("cdx: create sysfs bin files for cdx resources")
Cc: stable@vger.kernel.org
Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
Acked-by: Nikhil Agarwal <Nikhil.agarwal@amd.com>
Acked-by: Nipun Gupta <nipun.gupta@amd.com>
Link: https://patch.msgid.link/20260724092712.2119149-1-ptsm@linux.microsoft.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-07-31 14:21:20 +02:00
..
controller Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
cdx_msi.c of: Factor arguments passed to of_map_id() into a struct 2026-06-12 10:25:39 -05:00
cdx.c cdx: Fix double free when sysfs file creation fails 2026-07-31 14:21:20 +02:00
cdx.h cdx: add MSI support for CDX bus 2024-03-07 21:52:03 +00:00
Kconfig cdx: don't select CONFIG_GENERIC_MSI_IRQ 2025-08-27 12:14:12 -06:00
Makefile module: Convert default symbol namespace to string literal 2024-12-03 08:22:25 -08:00