mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 06:02:05 +00:00
usb: gadget: Potential NULL dereference on allocation error
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>
This commit is contained in:
parent
88b1bb1f3b
commit
df28169e15
@ -838,7 +838,7 @@ static struct usb_function *source_sink_alloc_func(
|
||||
|
||||
ss = kzalloc(sizeof(*ss), GFP_KERNEL);
|
||||
if (!ss)
|
||||
return NULL;
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
ss_opts = container_of(fi, struct f_ss_opts, func_inst);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user