]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: gadget: f_hid: fix refcount leak on error path
authorJohn Keeping <john@metanate.com>
Tue, 22 Nov 2022 12:35:22 +0000 (12:35 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:26:27 +0000 (13:26 +0100)
commitba78f7c10606719f702c04a15fb0471507b32d7b
treef0af724da4f977a1ea3bf5384189ad35b61e3577
parent9e4b85d815b14bd4db2deea2a54264a23de8b896
usb: gadget: f_hid: fix refcount leak on error path

[ Upstream commit 70a3288a7586526315105c699b687d78cd32559a ]

When failing to allocate report_desc, opts->refcnt has already been
incremented so it needs to be decremented to avoid leaving the options
structure permanently locked.

Fixes: 21a9476a7ba8 ("usb: gadget: hid: add configfs support")
Tested-by: Lee Jones <lee@kernel.org>
Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Reviewed-by: Lee Jones <lee@kernel.org>
Signed-off-by: John Keeping <john@metanate.com>
Link: https://lore.kernel.org/r/20221122123523.3068034-3-john@metanate.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/gadget/function/f_hid.c