[PATCH 4.14 21/63] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2019-01-24 Thread Greg Kroah-Hartman
4.14-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 :   80d8f6a2 0038 805f 80444600 
8fe364f4 805dfbe7
[   90.713349] 80563a30 06e2 8068370c 0001  0001 
8e2fdc48 
[   90.730020]   80d9  0106  
6465746e 312e3420
[   90.746690] 6b636f6c 03bf f800 20676e69  8000 
 8e2c2a90
[   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
08052098 8068
[   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 bc00cc385b77..83340496645b 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





[PATCH 4.4 082/104] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2019-01-24 Thread Greg Kroah-Hartman
4.4-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 :   80d8f6a2 0038 805f 80444600 
8fe364f4 805dfbe7
[   90.713349] 80563a30 06e2 8068370c 0001  0001 
8e2fdc48 
[   90.730020]   80d9  0106  
6465746e 312e3420
[   90.746690] 6b636f6c 03bf f800 20676e69  8000 
 8e2c2a90
[   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
08052098 8068
[   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 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





[PATCH 4.19 039/106] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2019-01-24 Thread Greg Kroah-Hartman
4.19-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 :   80d8f6a2 0038 805f 80444600 
8fe364f4 805dfbe7
[   90.713349] 80563a30 06e2 8068370c 0001  0001 
8e2fdc48 
[   90.730020]   80d9  0106  
6465746e 312e3420
[   90.746690] 6b636f6c 03bf f800 20676e69  8000 
 8e2c2a90
[   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
08052098 8068
[   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 902a7dd10e5c..bb6ae387469f 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





[PATCH 4.20 051/127] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2019-01-24 Thread Greg Kroah-Hartman
4.20-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 :   80d8f6a2 0038 805f 80444600 
8fe364f4 805dfbe7
[   90.713349] 80563a30 06e2 8068370c 0001  0001 
8e2fdc48 
[   90.730020]   80d9  0106  
6465746e 312e3420
[   90.746690] 6b636f6c 03bf f800 20676e69  8000 
 8e2c2a90
[   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
08052098 8068
[   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 902a7dd10e5c..bb6ae387469f 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





[PATCH 4.9 13/39] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2019-01-24 Thread Greg Kroah-Hartman
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 :   80d8f6a2 0038 805f 80444600 
8fe364f4 805dfbe7
[   90.713349] 80563a30 06e2 8068370c 0001  0001 
8e2fdc48 
[   90.730020]   80d9  0106  
6465746e 312e3420
[   90.746690] 6b636f6c 03bf f800 20676e69  8000 
 8e2c2a90
[   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
08052098 8068
[   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





[PATCH 3.18 36/52] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2019-01-24 Thread Greg Kroah-Hartman
3.18-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 :   80d8f6a2 0038 805f 80444600 
8fe364f4 805dfbe7
[   90.713349] 80563a30 06e2 8068370c 0001  0001 
8e2fdc48 
[   90.730020]   80d9  0106  
6465746e 312e3420
[   90.746690] 6b636f6c 03bf f800 20676e69  8000 
 8e2c2a90
[   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
08052098 8068
[   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 f3194e5147fd..0bbc31d10857 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





[PATCH AUTOSEL 4.14 15/53] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2019-01-08 Thread Sasha Levin
From: Daniel Santos 

[ 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 :   80d8f6a2 0038 805f 80444600 
8fe364f4 805dfbe7
[   90.713349] 80563a30 06e2 8068370c 0001  0001 
8e2fdc48 
[   90.730020]   80d9  0106  
6465746e 312e3420
[   90.746690] 6b636f6c 03bf f800 20676e69  8000 
 8e2c2a90
[   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
08052098 8068
[   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 bc00cc385b77..83340496645b 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



[PATCH AUTOSEL 4.9 12/36] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2019-01-08 Thread Sasha Levin
From: Daniel Santos 

[ 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 :   80d8f6a2 0038 805f 80444600 
8fe364f4 805dfbe7
[   90.713349] 80563a30 06e2 8068370c 0001  0001 
8e2fdc48 
[   90.730020]   80d9  0106  
6465746e 312e3420
[   90.746690] 6b636f6c 03bf f800 20676e69  8000 
 8e2c2a90
[   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
08052098 8068
[   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



[PATCH AUTOSEL 4.4 08/28] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2019-01-08 Thread Sasha Levin
From: Daniel Santos 

[ 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 :   80d8f6a2 0038 805f 80444600 
8fe364f4 805dfbe7
[   90.713349] 80563a30 06e2 8068370c 0001  0001 
8e2fdc48 
[   90.730020]   80d9  0106  
6465746e 312e3420
[   90.746690] 6b636f6c 03bf f800 20676e69  8000 
 8e2c2a90
[   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
08052098 8068
[   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 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



[PATCH AUTOSEL 3.18 03/19] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2019-01-08 Thread Sasha Levin
From: Daniel Santos 

[ 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 :   80d8f6a2 0038 805f 80444600 
8fe364f4 805dfbe7
[   90.713349] 80563a30 06e2 8068370c 0001  0001 
8e2fdc48 
[   90.730020]   80d9  0106  
6465746e 312e3420
[   90.746690] 6b636f6c 03bf f800 20676e69  8000 
 8e2c2a90
[   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
08052098 8068
[   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 f3194e5147fd..0bbc31d10857 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



[PATCH AUTOSEL 4.19 33/97] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2019-01-08 Thread Sasha Levin
From: Daniel Santos 

[ 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 :   80d8f6a2 0038 805f 80444600 
8fe364f4 805dfbe7
[   90.713349] 80563a30 06e2 8068370c 0001  0001 
8e2fdc48 
[   90.730020]   80d9  0106  
6465746e 312e3420
[   90.746690] 6b636f6c 03bf f800 20676e69  8000 
 8e2c2a90
[   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
08052098 8068
[   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 902a7dd10e5c..bb6ae387469f 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



[PATCH AUTOSEL 4.20 042/117] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2019-01-08 Thread Sasha Levin
From: Daniel Santos 

[ 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 :   80d8f6a2 0038 805f 80444600 
8fe364f4 805dfbe7
[   90.713349] 80563a30 06e2 8068370c 0001  0001 
8e2fdc48 
[   90.730020]   80d9  0106  
6465746e 312e3420
[   90.746690] 6b636f6c 03bf f800 20676e69  8000 
 8e2c2a90
[   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
08052098 8068
[   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 902a7dd10e5c..bb6ae387469f 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



Re: jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2018-12-02 Thread Boris Brezillon
On Fri, 2018-10-19 at 08:30:20 UTC, 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 :   80d8f6a2 0038 805f 80444600 
> 8fe364f4 805dfbe7
> [   90.713349] 80563a30 06e2 8068370c 0001  0001 
> 8e2fdc48 
> [   90.730020]   80d9  0106  
> 6465746e 312e3420
> [   90.746690] 6b636f6c 03bf f800 20676e69  8000 
>  8e2c2a90
> [   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
> 08052098 8068
> [   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 

Applied to http://git.infradead.org/linux-mtd.git mtd/next, thanks.

Boris


Re: [PING 2] [PATCH] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2018-11-24 Thread Richard Weinberger
On Sat, Nov 24, 2018 at 4:32 PM Daniel Santos  wrote:
>
> Ping 2!
>
> On 11/05/2018 03:38 PM, Daniel Santos wrote:
> > Ping.
> >
> > Daniel
> >
> > On 10/21/2018 07:32 PM, Hou Tao wrote:
> >> 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 :   80d8f6a2 0038 805f 
> >>> 80444600 8fe364f4 805dfbe7
> >>> [   90.713349] 80563a30 06e2 8068370c 0001  
> >>> 0001 8e2fdc48 
> >>> [   90.730020]   80d9  0106 
> >>>  6465746e 312e3420
> >>> [   90.746690] 6b636f6c 03bf f800 20676e69  
> >>> 8000  8e2c2a90
> >>> [   90.763362] 80d9 0001  8e2c2a90 0003 
> >>> 80260dc0 08052098 8068
> >>> [   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 

Boris, can you please queue up this patch?

-- 
Thanks,
//richard


[PING 2] [PATCH] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2018-11-24 Thread Daniel Santos
Ping 2!

On 11/05/2018 03:38 PM, Daniel Santos wrote:
> Ping.
>
> Daniel
>
> On 10/21/2018 07:32 PM, Hou Tao wrote:
>> 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 :   80d8f6a2 0038 805f 
>>> 80444600 8fe364f4 805dfbe7
>>> [   90.713349] 80563a30 06e2 8068370c 0001  
>>> 0001 8e2fdc48 
>>> [   90.730020]   80d9  0106 
>>>  6465746e 312e3420
>>> [   90.746690] 6b636f6c 03bf f800 20676e69  
>>> 8000  8e2c2a90
>>> [   90.763362] 80d9 0001  8e2c2a90 0003 
>>> 80260dc0 08052098 8068
>>> [   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
>>
>>
>>



[PING][PATCH] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2018-11-05 Thread Daniel Santos
Ping.

Daniel

On 10/21/2018 07:32 PM, Hou Tao wrote:
>
> 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 :   80d8f6a2 0038 805f 80444600 
>> 8fe364f4 805dfbe7
>> [   90.713349] 80563a30 06e2 8068370c 0001  0001 
>> 8e2fdc48 
>> [   90.730020]   80d9  0106  
>> 6465746e 312e3420
>> [   90.746690] 6b636f6c 03bf f800 20676e69  8000 
>>  8e2c2a90
>> [   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
>> 08052098 8068
>> [   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
>
>
>



Re: [PATCH] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2018-10-21 Thread Daniel Santos
On 10/21/2018 07:32 PM, Hou Tao wrote:
>
> 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 :   80d8f6a2 0038 805f 80444600 
>> 8fe364f4 805dfbe7
>> [   90.713349] 80563a30 06e2 8068370c 0001  0001 
>> 8e2fdc48 
>> [   90.730020]   80d9  0106  
>> 6465746e 312e3420
>> [   90.746690] 6b636f6c 03bf f800 20676e69  8000 
>>  8e2c2a90
>> [   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
>> 08052098 8068
>> [   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

Thank you.

I'm not intimately familiar with these, but it's an SPI NOR chip and I'm
pretty sure they that they don't have ECC.  Specifically a Winbond
w25q128fv using drivers/mtd/devices/m25p80.c.

Thanks,
Daniel





Re: [PATCH] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2018-10-21 Thread Hou Tao



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 :   80d8f6a2 0038 805f 80444600 
> 8fe364f4 805dfbe7
> [   90.713349] 80563a30 06e2 8068370c 0001  0001 
> 8e2fdc48 
> [   90.730020]   80d9  0106  
> 6465746e 312e3420
> [   90.746690] 6b636f6c 03bf f800 20676e69  8000 
>  8e2c2a90
> [   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
> 08052098 8068
> [   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




[PATCH] jffs2: Fix use of uninitialized delayed_work, lockdep breakage

2018-10-19 Thread Daniel Santos
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 :   80d8f6a2 0038 805f 80444600 
8fe364f4 805dfbe7
[   90.713349] 80563a30 06e2 8068370c 0001  0001 
8e2fdc48 
[   90.730020]   80d9  0106  
6465746e 312e3420
[   90.746690] 6b636f6c 03bf f800 20676e69  8000 
 8e2c2a90
[   90.763362] 80d9 0001  8e2c2a90 0003 80260dc0 
08052098 8068
[   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);
-- 
2.16.4