All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Filip Schauer <filip@mg6.at>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers core: Fix oops when driver probe fails
Date: Tue, 27 Jul 2021 14:31:10 +0200	[thread overview]
Message-ID: <YP/8jqfW4+HHUL+X@kroah.com> (raw)
In-Reply-To: <20210727112311.GA7645@DESKTOP-E8BN1B0.localdomain>

On Tue, Jul 27, 2021 at 01:23:11PM +0200, Filip Schauer wrote:
> dma_range_map is freed to early, which might cause an oops when
> a driver probe fails.
>  Call trace:
>   is_free_buddy_page+0xe4/0x1d4
>   __free_pages+0x2c/0x88
>   dma_free_contiguous+0x64/0x80
>   dma_direct_free+0x38/0xb4
>   dma_free_attrs+0x88/0xa0
>   dmam_release+0x28/0x34
>   release_nodes+0x78/0x8c
>   devres_release_all+0xa8/0x110
>   really_probe+0x118/0x2d0
>   __driver_probe_device+0xc8/0xe0
>   driver_probe_device+0x54/0xec
>   __driver_attach+0xe0/0xf0
>   bus_for_each_dev+0x7c/0xc8
>   driver_attach+0x30/0x3c
>   bus_add_driver+0x17c/0x1c4
>   driver_register+0xc0/0xf8
>   __platform_driver_register+0x34/0x40
>   ...
> 
> This issue is introduced by commit d0243bbd5dd3 ("drivers core:
> Free dma_range_map when driver probe failed"). It frees
> dma_range_map before the call to devres_release_all, which is too
> early. The solution is to free dma_range_map only after
> devres_release_all.
> 
> Fixes: d0243bbd5dd3 ("drivers core: Free dma_range_map when driver probe failed")
> Signed-off-by: Filip Schauer <filip@mg6.at>
> ---
>  drivers/base/dd.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Oh, nice catch!  This is a v2, right?  Next time please be explicit :)

thanks,

greg k-h

  reply	other threads:[~2021-07-27 12:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 11:23 [PATCH] drivers core: Fix oops when driver probe fails Filip Schauer
2021-07-27 12:31 ` Greg KH [this message]
2021-07-27 16:01   ` Filip Schauer
  -- strict thread matches above, loose matches on Subject: below --
2021-07-27 10:40 Filip Schauer
2021-07-27 10:57 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YP/8jqfW4+HHUL+X@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=filip@mg6.at \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.