Re: [PATCH] [RFC] mwifiex: Fix NULL pointer deref

From: Sascha Hauer
Date: Wed Jul 03 2024 - 03:25:00 EST


On Tue, Jul 02, 2024 at 10:36:11PM +0200, Francesco Dolcini wrote:
> On Tue, Jul 02, 2024 at 03:32:16PM +0200, Sascha Hauer wrote:
> > On Mon, Jun 24, 2024 at 06:20:14PM +0200, Francesco Dolcini wrote:
> > > On Fri, Jun 21, 2024 at 11:07:27AM +0200, Sascha Hauer wrote:
>
> ...
>
> > > >
> > > > From 3357963821294ff7de26259a154a1cb5bab760cb Mon Sep 17 00:00:00 2001
> > > > From: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> > > > Date: Tue, 18 Jun 2024 12:20:20 +0200
> > > > Subject: [PATCH] mwifiex: Do not return unused priv in
> > > > mwifiex_get_priv_by_id()
> > > >
> > > > mwifiex_get_priv_by_id() returns the priv pointer corresponding to the
> > > > bss_num and bss_type, but without checking if the priv is actually
> > > > currently in use.
> > > > Unused priv pointers do not have a wiphy attached to them which can lead
> > > > to NULL pointer dereferences further down the callstack.
> > > > Fix this by returning only used priv pointers which have priv->bss_mode
> > > > set to something else than NL80211_IFTYPE_UNSPECIFIED.
> > > >
> > > > Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
>
> Reviewed-by: Francesco Dolcini <francesco.dolcini@xxxxxxxxxxx>
>
> I guess you should send it as a proper patch?

Yes, I just did this.

Sascha

--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |