]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
HID: wacom: fix memory leak on sysfs attribute creation failure
authorQasim Ijaz <qasdev00@gmail.com>
Fri, 6 Jun 2025 18:49:58 +0000 (19:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 13:57:40 +0000 (15:57 +0200)
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>
drivers/hid/wacom_sys.c

index 42f95b00d3ba9c2fbfbe84c33adaad8509f1a287..88e59f28af9059da4b23bc8e0f91a3c8a60cb165 100644 (file)
@@ -2030,6 +2030,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;
        }