Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1525190 > unrolled thread

Re: mwifiex: don't do unbalanced free()'ing in cleanup_if()

Started byKalle Valo <kvalo@codeaurora.org>
First post2016-11-18 12:30 +0100
Last post2016-11-18 12:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: mwifiex: don't do unbalanced free()'ing in cleanup_if() Kalle Valo <kvalo@codeaurora.org> - 2016-11-18 12:30 +0100

#1525190 — Re: mwifiex: don't do unbalanced free()'ing in cleanup_if()

FromKalle Valo <kvalo@codeaurora.org>
Date2016-11-18 12:30 +0100
SubjectRe: mwifiex: don't do unbalanced free()'ing in cleanup_if()
Message-ID<sEPwK-6s7-9@gated-at.bofh.it>
Brian Norris <briannorris@chromium.org> wrote:
> The cleanup_if() callback is the inverse of init_if(). We allocate our
> 'card' interface structure in the probe() function, but we free it in
> cleanup_if(). That gives a few problems:
> (a) we leak this memory if probe() fails before we reach init_if()
> (b) we can't safely utilize 'card' after cleanup_if() -- namely, in
>     remove() or suspend(), both of which might race with the cleanup
>     paths in our asynchronous FW initialization path
> 
> Solution: just use devm_kzalloc(), which will free this structure
> properly when the device is removed -- and drop the set_drvdata(...,
> NULL), since the driver core does this for us. This also removes the
> temptation to use drvdata == NULL as a hack for checking if the device
> has been "cleaned up."
> 
> I *do* leave the set_drvdata(..., NULL) for the hacky SDIO
> mwifiex_recreate_adapter(), since the device core won't be able to clear
> that one for us.
> 
> Signed-off-by: Brian Norris <briannorris@chromium.org>

Patch applied to wireless-drivers-next.git, thanks.

66b9c182538e mwifiex: don't do unbalanced free()'ing in cleanup_if()

-- 
https://patchwork.kernel.org/patch/9398689/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web