stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Daniel Santos <daniel.santos@pobox.com>,
	Boris Brezillon <boris.brezillon@bootlin.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-mtd@lists.infradead.org
Subject: [PATCH AUTOSEL 4.4 08/28] jffs2: Fix use of uninitialized delayed_work, lockdep breakage
Date: Tue,  8 Jan 2019 14:34:25 -0500	[thread overview]
Message-ID: <20190108193445.124251-8-sashal@kernel.org> (raw)
In-Reply-To: <20190108193445.124251-1-sashal@kernel.org>

From: Daniel Santos <daniel.santos@pobox.com>

[ 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 <daniel.santos@pobox.com>
Reviewed-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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 1544f530ccd0..023e7f32ee1b 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


  parent reply	other threads:[~2019-01-08 19:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-08 19:34 [PATCH AUTOSEL 4.4 01/28] platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 02/28] e1000e: allow non-monotonic SYSTIM readings Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 03/28] writeback: don't decrement wb->refcnt if !wb->bdi Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 04/28] MIPS: SiByte: Enable swiotlb for SWARM, LittleSur and BigSur Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 05/28] arm64: perf: set suppress_bind_attrs flag to true Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 06/28] USB: serial: ftdi_sio: use rounding when calculating baud rate divisors Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 07/28] drm/amdgpu: Correct get_crtc_scanoutpos behavior when vpos >= vtotal Sasha Levin
2019-01-08 19:34 ` Sasha Levin [this message]
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 09/28] pstore/ram: Do not treat empty buffers as valid Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 10/28] powerpc/pseries/cpuidle: Fix preempt warning Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 11/28] media: firewire: Fix app_info parameter type in avc_ca{,_app}_info Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 12/28] net: call sk_dst_reset when set SO_DONTROUTE Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 13/28] scsi: target: use consistent left-aligned ASCII INQUIRY data Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 14/28] clk: imx6q: reset exclusive gates on init Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 15/28] kconfig: fix file name and line number of warn_ignored_character() Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 16/28] kconfig: fix memory leak when EOF is encountered in quotation Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 17/28] mmc: atmel-mci: do not assume idle after atmci_request_end Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 18/28] perf intel-pt: Fix error with config term "pt=0" Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 19/28] perf svghelper: Fix unchecked usage of strncpy() Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 20/28] perf parse-events: " Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 21/28] dm kcopyd: Fix bug causing workqueue stalls Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 22/28] dm snapshot: Fix excessive memory usage and " Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 23/28] ALSA: bebob: fix model-id of unit for Apogee Ensemble Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 24/28] sysfs: Disable lockdep for driver bind/unbind files Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 25/28] scsi: megaraid: fix out-of-bound array accesses Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 26/28] ocfs2: fix panic due to unrecovered local alloc Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 27/28] mm/page-writeback.c: don't break integrity writeback on ->writepage() error Sasha Levin
2019-01-08 19:34 ` [PATCH AUTOSEL 4.4 28/28] mm, proc: be more verbose about unstable VMA flags in /proc/<pid>/smaps Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190108193445.124251-8-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=boris.brezillon@bootlin.com \
    --cc=daniel.santos@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).