Re: [PATCH] usb: core: Null deref in kernel with USB webcams.

From: Alan Stern
Date: Thu Nov 12 2020 - 14:25:31 EST


On Thu, Nov 12, 2020 at 06:15:08PM +0000, John Boero wrote:
> Then why does line 278 right below it check for NULL?

Are you asking about line 278 in drivers/usb/core/usb.c? The statement
which says:

if (!config)
return NULL;

This is because it is perfectly valid for config to be NULL at this
point. But it is not valid for dev to be NULL. If dev is NULL then
there is a bug in the caller.

Alan Stern