diff options
author | Andrew Gabbasov <andrew_gabbasov@mentor.com> | 2017-09-30 18:55:55 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-18 10:20:42 +0300 |
commit | ac94abbb7941933946bbb7ce9aca7365fa7d5e74 (patch) | |
tree | 6e2419823e7754f1694f950e6acc29f941da97ad /fs | |
parent | 16c1ef65f4db6a3621d653378d27f611c9840bee (diff) | |
download | linux-ac94abbb7941933946bbb7ce9aca7365fa7d5e74.tar.xz |
usb: gadget: composite: Fix use-after-free in usb_composite_overwrite_options
commit aec17e1e249567e82b26dafbb86de7d07fde8729 upstream.
KASAN enabled configuration reports an error
BUG: KASAN: use-after-free in usb_composite_overwrite_options+...
[libcomposite] at addr ...
Read of size 1 by task ...
when some driver is un-bound and then bound again.
For example, this happens with FunctionFS driver when "ffs-test"
test application is run several times in a row.
If the driver has empty manufacturer ID string in initial static data,
it is then replaced with generated string. After driver unbinding
the generated string is freed, but the driver data still keep that
pointer. And if the driver is then bound again, that pointer
is re-used for string emptiness check.
The fix is to clean up the driver string data upon its unbinding
to drop the pointer to freed memory.
Fixes: cc2683c318a5 ("usb: gadget: Provide a default implementation of default manufacturer string")
Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
0 files changed, 0 insertions, 0 deletions