[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220422161709.30198-2-jose.exposito89@gmail.com>
Date: Fri, 22 Apr 2022 18:17:08 +0200
From: José Expósito <jose.exposito89@...il.com>
To: hadess@...ess.net
Cc: hdegoede@...hat.com, dmitry.torokhov@...il.com,
rydberg@...math.org, lains@...eup.net, jikos@...nel.org,
benjamin.tissoires@...hat.com, linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org,
José Expósito <jose.exposito89@...il.com>
Subject: [PATCH 2/3] HID: logitech-hidpp: Fix double free on managed resource
As described in the documentation for devm_input_allocate_device():
Managed input devices do not need to be explicitly unregistered or
freed as it will be done automatically when owner device unbinds from
its driver (or binding fails).
However this driver was explicitly freeing the input device, allocated
using devm_input_allocate_device() through hidpp_allocate_input().
Remove the call to input_free_device() to avoid a possible double free
error.
Fixes: c39e3d5fc9dd3 ("HID: logitech-hidpp: late bind the input device on wireless connection")
Signed-off-by: José Expósito <jose.exposito89@...il.com>
---
drivers/hid/hid-logitech-hidpp.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 81de88ab2ecc..9c00a781ab57 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -3957,11 +3957,7 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
}
hidpp_populate_input(hidpp, input);
-
- ret = input_register_device(input);
- if (ret)
- input_free_device(input);
-
+ input_register_device(input);
hidpp->delayed_input = input;
}
--
2.25.1
Powered by blists - more mailing lists