Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1347808
| From | "majun (F)" <majun258@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function |
| Date | 2016-03-02 07:40 +0100 |
| Message-ID | <r88BY-3Mu-7@gated-at.bofh.it> (permalink) |
| References | <r85b3-1lk-1@gated-at.bofh.it> <r85uq-1OC-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
在 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 > . >
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function MaJun <majun258@huawei.com> - 2016-03-02 04:00 +0100
Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function Al Viro <viro@ZenIV.linux.org.uk> - 2016-03-02 04:20 +0100
Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function "majun (F)" <majun258@huawei.com> - 2016-03-02 07:40 +0100
Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function Al Viro <viro@ZenIV.linux.org.uk> - 2016-03-02 18:40 +0100
Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function Al Viro <viro@ZenIV.linux.org.uk> - 2016-03-02 19:00 +0100
csiph-web