[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+ASDXOrr7k73mOizNGxPxXQ=bHEMUbTtCnoEusj2vRAaRPufA@mail.gmail.com>
Date: Mon, 5 Oct 2020 10:58:31 -0700
From: Brian Norris <briannorris@...omium.org>
To: trix@...hat.com
Cc: amit karwar <amitkarwar@...il.com>,
Ganapathi Bhat <ganapathi.bhat@....com>,
Xinming Hu <huxinming820@...il.com>,
Kalle Valo <kvalo@...eaurora.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Nathan Chancellor <natechancellor@...il.com>,
ndesaulniers@...gle.com, linville@...driver.com,
Nishant Sarmukadam <nishants@...vell.com>, rramesh@...vell.com,
bzhao@...vell.com, Frank Huang <frankh@...vell.com>,
linux-wireless <linux-wireless@...r.kernel.org>,
"<netdev@...r.kernel.org>" <netdev@...r.kernel.org>,
Linux Kernel <linux-kernel@...r.kernel.org>,
clang-built-linux@...glegroups.com
Subject: Re: [PATCH] wireless: mwifiex: fix double free
On Sun, Oct 4, 2020 at 6:19 AM <trix@...hat.com> wrote:
>
> From: Tom Rix <trix@...hat.com>
>
> clang static analysis reports this problem:
>
> sdio.c:2403:3: warning: Attempt to free released memory
> kfree(card->mpa_rx.buf);
> ^~~~~~~~~~~~~~~~~~~~~~~
That's some interesting static analysis for a compiler.
> When mwifiex_init_sdio() fails in its first call to
> mwifiex_alloc_sdio_mpa_buffer, it falls back to calling it
> again. If the second alloc of mpa_tx.buf fails, the error
> handler will try to free the old, previously freed mpa_rx.buf.
> Reviewing the code, it looks like a second double free would
> happen with mwifiex_cleanup_sdio().
>
> So set both pointers to NULL when they are freed.
>
> Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver")
> Signed-off-by: Tom Rix <trix@...hat.com>
For whatever it's worth:
Reviewed-by: Brian Norris <briannorris@...omium.org>
Powered by blists - more mailing lists