Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754316AbcCBDK0 (ORCPT ); Tue, 1 Mar 2016 22:10:26 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:37741 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752576AbcCBDKZ (ORCPT ); Tue, 1 Mar 2016 22:10:25 -0500 Date: Wed, 2 Mar 2016 03:09:41 +0000 From: Al Viro To: MaJun 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 Message-ID: <20160302030941.GH17997@ZenIV.linux.org.uk> References: <1456886879-28128-1-git-send-email-majun258@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1456886879-28128-1-git-send-email-majun258@huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 807 Lines: 26 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() > | > 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.