usb: gadget: u_audio: Clear uac pointer when freed.
[ Upstream commita2cf936ebe
] This prevents use of a stale pointer if functions are called after g_cleanup that shouldn't be. This doesn't fix any races, but converts a possibly silent kernel memory corruption into an obvious NULL pointer dereference report. Fixes:eb9fecb9e6
("usb: gadget: f_uac2: split out audio core") Signed-off-by: Chris Wulff <chris.wulff@biamp.com> Link: https://lore.kernel.org/stable/CO1PR17MB54194226DA08BFC9EBD8C163E1172%40CO1PR17MB5419.namprd17.prod.outlook.com Link: https://lore.kernel.org/r/CO1PR17MB54194226DA08BFC9EBD8C163E1172@CO1PR17MB5419.namprd17.prod.outlook.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d481ddb83d
commit
a646645af0
@ -624,6 +624,8 @@ void g_audio_cleanup(struct g_audio *g_audio)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
uac = g_audio->uac;
|
uac = g_audio->uac;
|
||||||
|
g_audio->uac = NULL;
|
||||||
|
|
||||||
card = uac->card;
|
card = uac->card;
|
||||||
if (card)
|
if (card)
|
||||||
snd_card_free_when_closed(card);
|
snd_card_free_when_closed(card);
|
||||||
|
Reference in New Issue
Block a user