usb: gadget: Potential NULL dereference on allocation error
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 21 Dec 2018 20:42:52 +0000 (23:42 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Mar 2019 16:57:04 +0000 (17:57 +0100)
commitd3b0e3061767d57d8cb2d9034d515e201e78f50a
tree85eed55e24b14ca0c95be4f563ede1ab78ce89b9
parent38152b626bcbaafd5bbd4b63ca4e4e6662613175
usb: gadget: Potential NULL dereference on allocation error

[ Upstream commit df28169e1538e4a8bcd8b779b043e5aa6524545c ]

The source_sink_alloc_func() function is supposed to return error
pointers on error.  The function is called from usb_get_function() which
doesn't check for NULL returns so it would result in an Oops.

Of course, in the current kernel, small allocations always succeed so
this doesn't affect runtime.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/gadget/function/f_sourcesink.c