]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
HID: wacom: fix kobject reference count leak
authorQasim Ijaz <qasdev00@gmail.com>
Fri, 6 Jun 2025 18:49:59 +0000 (19:49 +0100)
committerJiri Kosina <jkosina@suse.com>
Tue, 10 Jun 2025 19:10:27 +0000 (21:10 +0200)
When sysfs_create_files() fails in wacom_initialize_remotes() the error
is returned and the cleanup action will not have been registered yet.

As a result the kobject???s refcount is never dropped, so the
kobject can never be freed leading to a reference leak.

Fix this by calling kobject_put() before returning.

Fixes: 83e6b40e2de6 ("HID: wacom: EKR: have the wacom resources dynamically allocated")
Acked-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>
drivers/hid/wacom_sys.c

index 58cbd43a37e9f47f38bc38b93d1c507be708d29e..1257131b1e34242efbc0d5a0851505b7b2b7231f 100644 (file)
@@ -2059,6 +2059,7 @@ static int wacom_initialize_remotes(struct wacom *wacom)
                hid_err(wacom->hdev,
                        "cannot create sysfs group err: %d\n", error);
                kfifo_free(&remote->remote_fifo);
+               kobject_put(remote->remote_dir);
                return error;
        }