Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2402101imu; Thu, 24 Jan 2019 12:08:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN7z0RB6pV3YAMvNtEJZvrNL76QxnTyhm3Q7Ijqc63WQl3VBBnPqI0Cqp+l8B9/cDHjwgUl2 X-Received: by 2002:a63:a452:: with SMTP id c18mr7293574pgp.204.1548360513887; Thu, 24 Jan 2019 12:08:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548360513; cv=none; d=google.com; s=arc-20160816; b=D9iE0RD0V4FQARpeLUCNzn3L4acxMd8H/zyTD3Ij3yum70R+Gm3YFj+JqdNo8hmKmu NdlSDxUb7L2AwymfjtaCAFq8Te0fLr6XiJ5y2BedGhQTE+LsWRSaPFPY9D4KqN2fFKuz 2yUoZ2NaVM9UNXdzO5c7WuIM6k/hKDyIsh+FrPu7iWKJZwRjM5+DtNb0t8W79ohz1lAW MBOKytqvPWDl+dwmSUArTDbBbLsvFTxIpsUf8SERVImhhjkRE5z188ofrDSKjaRgc/A6 +ersW6dXoL9L77+i1IRKnxnCKQ/fQvHNfmXgmN9CI7zaNYsfbtPm0qfupsvs/uHDF3NK j/WA== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TSxoSsJz/c+nWm0DjeAuTOtADzk+iXDQER9TeB3j97c=; b=EyiOXpDNOjsHAGx5QInwZGVd7YFuzkogkNHL779K68fNpOCtpQjZXZ6gFeZ0k8jVEd h7e/Lve+IH/ds0k6Jpf92WYzGDu12sERhOudmRbjbMKpns/BMYjxag/kSbB4/PH+FaCr j07GVL9ZmByAY9Sq3Aag35iLKYt+YXS9q/lqH5TDzLMS00VAcHcNtKd7ATdPYtDycm1a PatAjEmxj00C047ato7TNFIT+eKMAz/kZn2f3tcsbWA1PSWxvG2HrdkIJWVpfw7ue4eK 2oNDJHm+Fm5NrtvBtHIMfWHX2o50OtNZMXNPlkaJPC/ObXliQHzfwZobg52QmDz+530Z p0Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bWwCfmMm; 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 d4si22986133pla.58.2019.01.24.12.08.18; Thu, 24 Jan 2019 12:08:33 -0800 (PST) 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=@kernel.org header.s=default header.b=bWwCfmMm; 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 S1731146AbfAXT3V (ORCPT + 99 others); Thu, 24 Jan 2019 14:29:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:56340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731121AbfAXT3Q (ORCPT ); Thu, 24 Jan 2019 14:29:16 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4E02F218F0; Thu, 24 Jan 2019 19:29:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548358154; bh=K6tWsAJo28J3/ctHQZ236k4tScu3KiRH7aXd6OK9J0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bWwCfmMmOpegu0eyh3IhSAmux/nNwsmzjVQaczXAMeL6r5+QopWDDtL0e3Q5bzbld 0QnJYkqJ/JsJZyiP16vGMdVx3fzwyELyBNa3aQuH5vquuneP78BVHWA7N6vBD8+QXR weM8A6xPIPmU/WrDLXvLKgEnBVboPD2Jg+9X4EYo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Santos , Hou Tao , Boris Brezillon , Sasha Levin Subject: [PATCH 4.9 13/39] jffs2: Fix use of uninitialized delayed_work, lockdep breakage Date: Thu, 24 Jan 2019 20:20:16 +0100 Message-Id: <20190124190448.704190038@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190124190448.232316246@linuxfoundation.org> References: <20190124190448.232316246@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit a788c5272769ddbcdbab297cf386413eeac04463 ] 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 Reviewed-by: Hou Tao Signed-off-by: Boris Brezillon Signed-off-by: Sasha Levin --- 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 79b0de846f21..226640563df3 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); -- 2.19.1