summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorQasim Ijaz <qasdev00@gmail.com>2025-06-06 19:49:58 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-07-06 11:01:44 +0200
commit2746d020667ef384765004c74c9f22a589a1682e (patch)
treeef55a286e5c109ce1aa52b60cbda249a090cbca5 /drivers/hid
parenta85999b9876543aa9b7a204ee2a660e1d1806262 (diff)
downloadlinux-2746d020667ef384765004c74c9f22a589a1682e.tar.gz
linux-2746d020667ef384765004c74c9f22a589a1682e.tar.bz2
linux-2746d020667ef384765004c74c9f22a589a1682e.zip
HID: wacom: fix memory leak on sysfs attribute creation failure
commit 1a19ae437ca5d5c7d9ec2678946fb339b1c706bf upstream. When sysfs_create_files() fails during wacom_initialize_remotes() the fifo buffer is not freed leading to a memory leak. Fix this by calling kfifo_free() before returning. Fixes: 83e6b40e2de6 ("HID: wacom: EKR: have the wacom resources dynamically allocated") Reviewed-by: Ping Cheng <ping.cheng@wacom.com> Cc: stable@vger.kernel.org Signed-off-by: Qasim Ijaz <qasdev00@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/wacom_sys.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 53517bcb6a35..55bd8829d27e 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -2031,6 +2031,7 @@ static int wacom_initialize_remotes(struct wacom *wacom)
if (error) {
hid_err(wacom->hdev,
"cannot create sysfs group err: %d\n", error);
+ kfifo_free(&remote->remote_fifo);
return error;
}