Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751752AbdFEIjm (ORCPT ); Mon, 5 Jun 2017 04:39:42 -0400 Received: from b.ns.miles-group.at ([95.130.255.144]:44723 "EHLO radon.swed.at" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751716AbdFEIjl (ORCPT ); Mon, 5 Jun 2017 04:39:41 -0400 Subject: Re: [PATCH] ubifs: Fix a sleep-in-atomic bug in ubifs_read_nnode To: Jia-Ju Bai , dedekind1@gmail.com References: <1496633916-32362-1-git-send-email-baijiaju1990@163.com> <0687ba2f-f7d5-4632-eebb-50bbadd8a4b0@nod.at> Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org From: Richard Weinberger Message-ID: Date: Mon, 5 Jun 2017 10:39:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <0687ba2f-f7d5-4632-eebb-50bbadd8a4b0@nod.at> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 669 Lines: 22 Am 05.06.2017 um 10:25 schrieb Richard Weinberger: > Jia-Ju Bai, > > Am 05.06.2017 um 05:38 schrieb Jia-Ju Bai: >> The driver may sleep under a spin lock, and the function call path is: >> ubifs_change_lp (acquire the lock by spin_lock) >> change_category >> ubifs_remove_from_cat >> remove_from_lpt_heap >> dbg_check_heap >> ubifs_lpt_lookup >> ubifs_read_nnode >> kzalloc(GFP_NOFS) --> may sleep >> >> To fix it, "GFP_NOFS" is replaced with "GFP_ATOMIC". > > So, this happens only when dbg_check_heap() is activated, right? Why do we call change_category() anyway with c->space_lock held? Thanks, //richard