Skip to content

Commit a2cf936

Browse files
crwulffgregkh
authored andcommitted
usb: gadget: u_audio: Clear uac pointer when freed.
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: eb9fecb ("usb: gadget: f_uac2: split out audio core") Signed-off-by: Chris Wulff <[email protected]> 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 <[email protected]>
1 parent 1b73938 commit a2cf936

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/usb/gadget/function/u_audio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,8 @@ void g_audio_cleanup(struct g_audio *g_audio)
14201420
return;
14211421

14221422
uac = g_audio->uac;
1423+
g_audio->uac = NULL;
1424+
14231425
card = uac->card;
14241426
if (card)
14251427
snd_card_free_when_closed(card);

0 commit comments

Comments
 (0)