Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function

2016-03-02 Thread Al Viro
On Wed, Mar 02, 2016 at 05:29:54PM +, Al Viro wrote: > And no, it doesn't save the irq state anywhere - both disable and enable > are unconditional. schedule() always returns with irqs enabled. PS: look at it that way: how would you expect a context switch to behave? Suppose we blocked

Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function

2016-03-02 Thread Al Viro
On Wed, Mar 02, 2016 at 05:29:54PM +, Al Viro wrote: > And no, it doesn't save the irq state anywhere - both disable and enable > are unconditional. schedule() always returns with irqs enabled. PS: look at it that way: how would you expect a context switch to behave? Suppose we blocked

Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function

2016-03-02 Thread Al Viro
On Wed, Mar 02, 2016 at 02:32:28PM +0800, majun (F) wrote: > 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. It can't - either it's called with irqs enabled, in which case it returns the same way, or it's

Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function

2016-03-02 Thread Al Viro
On Wed, Mar 02, 2016 at 02:32:28PM +0800, majun (F) wrote: > 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. It can't - either it's called with irqs enabled, in which case it returns the same way, or it's

Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function

2016-03-01 Thread majun (F)
在 2016/3/2 11:09, Al Viro 写道: > On Wed, Mar 02, 2016 at 10:47:59AM +0800, MaJun wrote: >> From: Ma Jun >> >> 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()

Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function

2016-03-01 Thread majun (F)
在 2016/3/2 11:09, Al Viro 写道: > On Wed, Mar 02, 2016 at 10:47:59AM +0800, MaJun wrote: >> From: Ma Jun >> >> 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() >> | >>

Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function

2016-03-01 Thread Al Viro
On Wed, Mar 02, 2016 at 10:47:59AM +0800, MaJun wrote: > From: Ma Jun > > 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() -->

Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function

2016-03-01 Thread Al Viro
On Wed, Mar 02, 2016 at 10:47:59AM +0800, MaJun wrote: > From: Ma Jun > > 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() >

[PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function

2016-03-01 Thread MaJun
From: Ma Jun 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()

[PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function

2016-03-01 Thread MaJun
From: Ma Jun 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() Reported-by: Fan Jinke