提交 2bd15f1f 编写于 作者: J Jesper Juhl 提交者: Greg Kroah-Hartman

USB SL811HS HCD: Fix memory leak in sl811h_urb_enqueue()

In drivers/usb/host/sl811-hcd.c::sl811h_urb_enqueue(), memory is allocated
with kzalloc() and assigned to 'ep'. If we leave via the 'fail' label due
to 'if (ep->maxpacket > H_MAXPACKET)', then 'ep' will go out of scope
without having been assigned to anything, so we'll leak the memory we
allocated.
This patch fixes the leak by simply calling kfree(ep); before jumping to
the 'fail' label.
Signed-off-by: NJesper Juhl <jj@chaosbits.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 b14de385
......@@ -861,6 +861,7 @@ static int sl811h_urb_enqueue(
DBG("dev %d ep%d maxpacket %d\n",
udev->devnum, epnum, ep->maxpacket);
retval = -EINVAL;
kfree(ep);
goto fail;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册