Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1657431ima; Sun, 21 Oct 2018 17:35:11 -0700 (PDT) X-Google-Smtp-Source: ACcGV61YaX/fXDQmjFr3S5FjLtk2BLsCMQGT8rmtKCZczD4G4/2pZd6MVkJ66mq5+7FZVZXRcHLv X-Received: by 2002:a17:902:700c:: with SMTP id y12-v6mr11693299plk.185.1540168511065; Sun, 21 Oct 2018 17:35:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540168511; cv=none; d=google.com; s=arc-20160816; b=yC4TAfStsBFfmWBwix62QUH0O4iy9DSKynQWSnemzQe2o0EzQ5i9B3VWFdmIBYle4l o9H0x93/fq7Ies6AvC/8bEE4e7PYErrbwWoqldmwoNzP8tK+QqBoiXOpP1NTiATIxpJd XNSV6SQFtr11VIMhpPiJ2GFxeYqoNrm4s4y8qxYR5hBlwj/2ktnTN7QF6yuk1/nBohsF crz4ILinUIxb+k54G8qQDVUeaHOD9ynSe6vqJYbFjDVisQeVH01Iz8xTzG1TkYtSXXeH +vi+cp8qrIv0S6F/NDYRLxisfx8xREsUeaNha2PMeepZot11Y8MmdMXTO/Lr5Ow0M0ua KTWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=7NpydSJt6yCajS97CmYp0GdcZpFYqvA9vgAZd6JLKnc=; b=HOs+9TAL/cCjdXKien0d3dFvNFNUCdhd0MbxT29kC+1QGe4XI5BP1Dt4PkcP+E3ci7 qgLhbBsCUznTP0hcqrw8scBm5QslL12Znk3mCAm7YgVE9EtJOURhN5Ehpvnm9yA/EOf2 ACUhgJCg3ntPL7n7Uk1SEh8KlZx5Xcj1Py3WYlj277k8EsKrOTcw1Ya846kat51Cl+7L HXh2eygbfSnfBa1ioEcR06i9uxG1j2nu+bsuQPyKP/GAH8S2vDkTKnLedU0pei5zjW+N 9/X1H1LM9rsH7ME4EGku5g6+R6Y06/CdmJL9yNsQ1l/znpoXsqW4tjo0rTA2lSXLZT7J bPiA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1-v6si10512456plb.119.2018.10.21.17.34.53; Sun, 21 Oct 2018 17:35:11 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726797AbeJVItK (ORCPT + 99 others); Mon, 22 Oct 2018 04:49:10 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:14101 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726216AbeJVItK (ORCPT ); Mon, 22 Oct 2018 04:49:10 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 29CEA41EA8202; Mon, 22 Oct 2018 08:32:55 +0800 (CST) Received: from [127.0.0.1] (10.177.31.14) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.408.0; Mon, 22 Oct 2018 08:32:53 +0800 Subject: Re: [PATCH] jffs2: Fix use of uninitialized delayed_work, lockdep breakage To: Daniel Santos , LKML CC: David Woodhouse , References: <20181019083020.14335-1-daniel.santos@pobox.com> From: Hou Tao Message-ID: Date: Mon, 22 Oct 2018 08:32:52 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20181019083020.14335-1-daniel.santos@pobox.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.31.14] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/10/19 16:30, Daniel Santos wrote: > jffs2_sync_fs makes the assumption that if CONFIG_JFFS2_FS_WRITEBUFFER > is defined then a write buffer is available and has been initialized. > However, this does is not the case when the mtd device has no > out-of-band buffer: > > int jffs2_nand_flash_setup(struct jffs2_sb_info *c) > { > if (!c->mtd->oobsize) > return 0; > ... > > The resulting call to cancel_delayed_work_sync passing a uninitialized > (but zeroed) delayed_work struct forces lockdep to become disabled. > > [ 90.050639] overlayfs: upper fs does not support tmpfile. > [ 90.652264] INFO: trying to register non-static key. > [ 90.662171] the code is fine but needs lockdep annotation. > [ 90.673090] turning off the locking correctness validator. > [ 90.684021] CPU: 0 PID: 1762 Comm: mount_root Not tainted 4.14.63 #0 > [ 90.696672] Stack : 00000000 00000000 80d8f6a2 00000038 805f0000 80444600 8fe364f4 805dfbe7 > [ 90.713349] 80563a30 000006e2 8068370c 00000001 00000000 00000001 8e2fdc48 ffffffff > [ 90.730020] 00000000 00000000 80d90000 00000000 00000106 00000000 6465746e 312e3420 > [ 90.746690] 6b636f6c 03bf0000 f8000000 20676e69 00000000 80000000 00000000 8e2c2a90 > [ 90.763362] 80d90000 00000001 00000000 8e2c2a90 00000003 80260dc0 08052098 80680000 > [ 90.780033] ... > [ 90.784902] Call Trace: > [ 90.789793] [<8000f0d8>] show_stack+0xb8/0x148 > [ 90.798659] [<8005a000>] register_lock_class+0x270/0x55c > [ 90.809247] [<8005cb64>] __lock_acquire+0x13c/0xf7c > [ 90.818964] [<8005e314>] lock_acquire+0x194/0x1dc > [ 90.828345] [<8003f27c>] flush_work+0x200/0x24c > [ 90.837374] [<80041dfc>] __cancel_work_timer+0x158/0x210 > [ 90.847958] [<801a8770>] jffs2_sync_fs+0x20/0x54 > [ 90.857173] [<80125cf4>] iterate_supers+0xf4/0x120 > [ 90.866729] [<80158fc4>] sys_sync+0x44/0x9c > [ 90.875067] [<80014424>] syscall_common+0x34/0x58 > > Signed-off-by: Daniel Santos > --- > fs/jffs2/super.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c > index 793ad30970ff..cae4ecda3c50 100644 > --- a/fs/jffs2/super.c > +++ b/fs/jffs2/super.c > @@ -101,7 +101,8 @@ static int jffs2_sync_fs(struct super_block *sb, int wait) > struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); > > #ifdef CONFIG_JFFS2_FS_WRITEBUFFER > - cancel_delayed_work_sync(&c->wbuf_dwork); > + if (jffs2_is_writebuffered(c)) > + cancel_delayed_work_sync(&c->wbuf_dwork); > #endif > > mutex_lock(&c->alloc_sem); > Reviewed-by: Hou Tao And I am curious that why is there NAND Flash without OOB area ? So for them the ECC data must be saved in data area ? Regards, Tao