netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] libertas_tf: Avoid a null pointer dereference in if_usb_disconnect()
@ 2020-05-01 18:15 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2020-05-01 18:15 UTC (permalink / raw)
  To: Colin Ian King, linux-wireless, netdev
  Cc: kernel-janitors, linux-kernel, David S. Miller, Kalle Valo,
	Lubomir Rintel, Steve deRosier

> Currently there is a check if priv is null when calling lbtf_remove_card
> but not in a previous call to if_usb_reset_dev that can also dereference
> priv.  Fix this by also only calling lbtf_remove_card if priv is null.

I suggest to recheck this description (and the corresponding patch subject).


…
> +++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
> @@ -247,10 +247,10 @@ static void if_usb_disconnect(struct usb_interface *intf)
>
>  	lbtf_deb_enter(LBTF_DEB_MAIN);
>
> -	if_usb_reset_device(priv);
> -
> -	if (priv)
> +	if (priv) {
> +		if_usb_reset_device(priv);
>  		lbtf_remove_card(priv);
> +	}
>
>  	/* Unlink and free urb */
>  	if_usb_free(cardp);

The patch code proposes to move a specific function call into an if branch
according to a null pointer check.

Regards,
Markus

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-01 18:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-01 18:15 [PATCH] libertas_tf: Avoid a null pointer dereference in if_usb_disconnect() Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).