From 29d67f8aa4aed5d207ceff52ad9c5c675a438425 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Thu, 13 Nov 2025 08:03:55 +0100 Subject: [PATCH] hid: hid-playstation: fix memleak in probe Free the buffer if we bail out in the error case of dualshock4_get_calibration_data() Signed-off-by: Oliver Neukum --- drivers/hid/hid-playstation.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c index 63f6eb9030d1..128aa6abd10b 100644 --- a/drivers/hid/hid-playstation.c +++ b/drivers/hid/hid-playstation.c @@ -1942,6 +1942,7 @@ static int dualshock4_get_calibration_data(struct dualshock4 *ds4) "Failed to retrieve DualShock4 calibration info: %d\n", ret); ret = -EILSEQ; + kfree(buf); goto transfer_failed; } else { break; @@ -1959,6 +1960,7 @@ static int dualshock4_get_calibration_data(struct dualshock4 *ds4) if (ret) { hid_warn(hdev, "Failed to retrieve DualShock4 calibration info: %d\n", ret); + kfree(buf); goto transfer_failed; } } -- 2.51.1