mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tj@kernel.org" <tj@kernel.org>
To: "Liu, Chuansheng" <chuansheng.liu@intel.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	"dmitry.torokhov@gmail.com" <dmitry.torokhov@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] devres: Freeing the drs after all release() are called
Date: Thu, 7 Nov 2013 09:29:59 +0900	[thread overview]
Message-ID: <20131107002959.GA32200@mtj.dyndns.org> (raw)
In-Reply-To: <27240C0AC20F114CBF8149A2696CBE4A01B86696@SHSMSX101.ccr.corp.intel.com>

Hello, Liu.

On Thu, Nov 07, 2013 at 12:27:56AM +0000, Liu, Chuansheng wrote:
> The driver code is as below:
> _INIT() {
> 
> A = devm_kzalloc();
> B= devm_request_threaded_irq(isr_handler);
> C = devm_kzalloc();
> }
> 
> When driver _EXIT, the devres_release_all () will be called.
> The C will be kfreed before B, but when freeing irq B, the pending isr_handler() possibly
> will access the memory B which has been freed.
> Then the memory corruption occurred.
> 
> This patch can solve this scenario.

Isn't the bug there IRQ being requested before all its resources are
allocated?  The proposed change just masks the underlying issue or
incorrectly ordered operations.

Thanks.

-- 
tejun

  reply	other threads:[~2013-11-07  0:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06  6:40 Chuansheng Liu
2013-11-06  8:58 ` Greg KH
2013-11-07  0:27   ` Liu, Chuansheng
2013-11-07  0:29     ` tj [this message]
2013-11-07  0:36       ` Liu, Chuansheng
2013-11-07  0:46         ` Dmitry Torokhov
2013-11-07  0:53           ` Liu, Chuansheng
2013-11-07  0:51         ` tj
2013-11-07  1:18           ` Liu, Chuansheng
2013-11-07  1:56             ` 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=20131107002959.GA32200@mtj.dyndns.org \
    --to=tj@kernel.org \
    --cc=chuansheng.liu@intel.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®