Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2669037imm; Sun, 12 Aug 2018 20:51:49 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyEKGoClJWR8yt2fwS+ls2SmepHXT8ddvum0NkifyWFYz4js4fQOlwKe3A7NgDXUgE0WyCf X-Received: by 2002:a63:dd09:: with SMTP id t9-v6mr15463044pgg.370.1534132309372; Sun, 12 Aug 2018 20:51:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534132309; cv=none; d=google.com; s=arc-20160816; b=i48y3C+iC4AQe0OefYUavsEarmUbblI7vIOX3fu0FQHgNZC0ps4kGR0EdsbKLMvvkN Lt96yw7UfZa7Q+9cT+dgxQquf/WFBjCazBKSePgQXLG44qytYjAVvLKxRaTONOWWTQ7j +RlTMj1mWXnZmG2zUYbmjtcWnd4KwO6IVfeEhCe/sqwefhszX/vmcNIAP9EXrWRt9Vk5 dFZ3fEIXNRDVDjZdsNCSH7Fo9acrykOm5cNCwQ3TXUS9A3rhaY+qFB3BV3wrDNkiHtxo pA4yHzpk+u3fui9AD5LSry1ThBPM2NwOrg+uGYeVkDcuE2N3WuGXdnyeU9rADocnf6Yu WlLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:mime-version:user-agent:date:message-id :subject:from:cc:to:dkim-signature:arc-authentication-results; bh=622jTiJu+0MRtm9OtT2f2Hf5UrvCZy9t5E5iQFi9qoc=; b=HPyLg+GS85JTwXUcOyepoXZ90nULbdqF5WI9w52ScpVLehozG49nIxhYKWB71PREOg G4U2a54/jbhLJCfry0Or12FZXUqdFTLAf1YmMOvoppVBH445gVJxQfqQyYenLH5MCAs8 riwUFjwfVE/8SyuyMAMvqlDo+EbWROa0PleIMcSrE6MONRfH2dwWpVq7FuA2vEWoKb5F 5t5rJE4nhyjIY93D2JIdaQupVDIHDf+5GkeUUFVjtiS8o8Kgruk4+hOBdrttBCfya+R2 QSK9YFlVO9DHthRslGEoFNhzQ7eeNFAVR66bhna2bM6/YnbJEz3rPpRQuzQrtbEaH+sU vuvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TeiJvmSO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z62-v6si14194372pgz.640.2018.08.12.20.51.34; Sun, 12 Aug 2018 20:51:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TeiJvmSO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728241AbeHMGNB (ORCPT + 99 others); Mon, 13 Aug 2018 02:13:01 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41857 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725859AbeHMGNB (ORCPT ); Mon, 13 Aug 2018 02:13:01 -0400 Received: by mail-pg1-f196.google.com with SMTP id z8-v6so6897341pgu.8 for ; Sun, 12 Aug 2018 20:32:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=622jTiJu+0MRtm9OtT2f2Hf5UrvCZy9t5E5iQFi9qoc=; b=TeiJvmSOyRe3X8One+Rn2MekY0FJr+q/iqbknoMUISpmRGbi9irhuqmYD1gkxn1o5r zNd3wVXzIjxrzKBkLSEviPGTpPwtgjttHg7RY21jUGVKvMfPe9ZfUfWbn3q8plXuEvX+ 7DqSSoLL+P/CmspC33y5PXQbmy8Ao+3DvodzD1dxcUVj7+4t6rF31CNsJNlbZGyYpt5Z nmoek9yjFEQ8a8Yq073ms++nUOm12l5VA/CEct1uZOOHVI0Mhx8J9sl0X90LJbTjBfbn pz3AzUhp5jVgrIWxDEFXO9EZDKrE11uztecScHN/HIZi+F7EmqzzmLYUt9AyWPWIVfXc UwHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=622jTiJu+0MRtm9OtT2f2Hf5UrvCZy9t5E5iQFi9qoc=; b=Pk7tpQ6gSZiMQdedWvwDwemBEAKg/IMoPwNMfV8KqnVatLE5Ayf/WaoGV8b7xZOq2U ID1/0YbbdVbfWbd0md7U6s1RUbKWADWur20Q6+0n4qsfZe49Bpzmc/lnj2lOBulUwj3F nD7YjjBV2747sm8RQUQHcN4bUd/eVwSic9syFTKUq38S81z2m3pSMJNvcveOPMuy+7aX lRS7FE4NbqVZ/vLYGejMaA2b+s2NqvwcIvLEQxr47v+Fi/HGTw/n9ExGFTwywRa6kZHL +EAM9b2TBWJX1m1C0jTvGGnJKmcTTOoTq/UUMGDmqc2RHMtigadvuCx/CpdrYah5ZLoT Gx7w== X-Gm-Message-State: AOUpUlGaU9HwwmAGkn0UDBOVupCk7AsJW1jVoeQkl++cLwDR0IUUyJYg /b2k9UWD587jrrdDfQnvO9wLRaau X-Received: by 2002:a63:161a:: with SMTP id w26-v6mr15715199pgl.257.1534131163211; Sun, 12 Aug 2018 20:32:43 -0700 (PDT) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.71.57? ([2402:f000:1:1501:200:5efe:a66f:4739]) by smtp.gmail.com with ESMTPSA id l10-v6sm22193020pfj.179.2018.08.12.20.32.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Aug 2018 20:32:42 -0700 (PDT) To: dhowells@redhat.com Cc: linux-afs@lists.infradead.org, Linux Kernel Mailing List From: Jia-Ju Bai Subject: [BUG] fs: jffs2: possible sleep-in-atomic-context bugs in jffs2_iget Message-ID: <48808863-2c1e-34bf-5968-8bb88052b556@gmail.com> Date: Mon, 13 Aug 2018 11:32:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel may sleep with holding a spinlock. The function call paths (from bottom to top) in Linux-4.16 are: [FUNC] schedule fs/inode.c, 1916: schedule in __wait_on_freeing_inode fs/inode.c, 826: __wait_on_freeing_inode in find_inode_fast fs/inode.c, 1107: find_inode_fast in iget_locked fs/jffs2/fs.c, 263: iget_locked in jffs2_iget fs/jffs2/fs.c, 665: jffs2_iget in jffs2_gc_fetch_inode fs/jffs2/wbuf.c, 505: jffs2_gc_fetch_inode in jffs2_wbuf_recover fs/jffs2/wbuf.c, 462: spin_lock in jffs2_wbuf_recover [FUNC] mutex_lock_nested fs/jffs2/fs.c, 273: mutex_lock_nested in jffs2_iget fs/jffs2/fs.c, 665: jffs2_iget in jffs2_gc_fetch_inode fs/jffs2/wbuf.c, 505: jffs2_gc_fetch_inode in jffs2_wbuf_recover fs/jffs2/wbuf.c, 462: spin_lock in jffs2_wbuf_recover I do not find a good way to fix, so I only report. Maybe the spinlock should be released before calling jffs2_iget(), and then be acquired again. This is found by my static analysis tool (DSAC). Thanks, Jia-Ju Bai