]> git.ipfire.org Git - people/arne_f/kernel.git/commit
usb: gadget: f_midi: Fix memleak in f_midi_alloc
authorZhang Qilong <zhangqilong3@huawei.com>
Tue, 17 Nov 2020 02:16:28 +0000 (10:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Dec 2020 07:52:01 +0000 (08:52 +0100)
commitbb92cf0bc99aa1f60a7e4241701f7c396e918fbc
treeabff5cd7abb85b1f998d58878cafca191ac7b330
parentb09dd77c6f15413d976616d1197f0a6f231127e8
usb: gadget: f_midi: Fix memleak in f_midi_alloc

commit e7694cb6998379341fd9bf3bd62b48c4e6a79385 upstream.

In the error path, if midi is not null, we should
free the midi->id if necessary to prevent memleak.

Fixes: b85e9de9e818d ("usb: gadget: f_midi: convert to new function interface with backward compatibility")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201117021629.1470544-2-zhangqilong3@huawei.com
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_midi.c