public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "majun (F)" <majun258@huawei.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: <ebiederm@xmission.com>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<akpm@linux-foundation.org>, <dhowells@redhat.com>,
	<Waiman.Long@hp.com>, <dingtianhong@huawei.com>,
	<guohanjun@huawei.com>, <fanjinke1@huawei.com>
Subject: Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function
Date: Wed, 2 Mar 2016 14:32:28 +0800	[thread overview]
Message-ID: <56D688FC.9020202@huawei.com> (raw)
In-Reply-To: <20160302030941.GH17997@ZenIV.linux.org.uk>



在 2016/3/2 11:09, Al Viro 写道:
> On Wed, Mar 02, 2016 at 10:47:59AM +0800, MaJun wrote:
>> From: Ma Jun <majun258@huawei.com>
>>
>> The spin_lock/unlock_irq interface is not safe when this function is called
>> at some case which need irq disabled.
> 
>> For example:
>> 	spin_lock_irqsave()
>> 	|
>> 	request_irq() --> proc_alloc_inum()
>> 	|
>> 	spin_unlock_irqrestore()
> 
> Do you even read your own patch?
> 
>>  	if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL))
> 					 ^^^^^^^^^^
> 					 This.
> 
> It can block.  You *can't* call that under spin_lock_irqsave().  At all.
> You also can't do request_irq() under a spinlock, no matter whether you
> disable irqs or not - it also blocks.  So does proc_mkdir(), for that
> matter, and not only in proc_alloc_inum().
> 
> NAKed.  Don't do it.  request_irq() is not to be called under spinlocks,
> with or without irqs disabled.
> 

Sorry,I made a wrong example for this problem.
I want to say this interface may change the irq status after this function
be called.

Thanks!
MaJun

> .
> 

  reply	other threads:[~2016-03-02  6:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02  2:47 [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function MaJun
2016-03-02  3:09 ` Al Viro
2016-03-02  6:32   ` majun (F) [this message]
2016-03-02 17:29     ` Al Viro
2016-03-02 17:57       ` Al Viro

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=56D688FC.9020202@huawei.com \
    --to=majun258@huawei.com \
    --cc=Waiman.Long@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=dingtianhong@huawei.com \
    --cc=ebiederm@xmission.com \
    --cc=fanjinke1@huawei.com \
    --cc=guohanjun@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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