linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: [PATCH] jffs2: reduce stack usage in jffs2_build_xattr_subsystem()
  2023-05-06  4:56 34% [PATCH] jffs2: reduce stack usage in jffs2_build_xattr_subsystem() Christian Marangi
  2023-05-06 13:11  5% ` Zhihao Cheng
@ 2023-05-15 10:46 10% ` Christian Brauner
  1 sibling, 0 replies; 28+ results
From: Christian Brauner @ 2023-05-15 10:46 UTC (permalink / raw)
  To: David Woodhouse, Richard Weinberger, Fabian Frederick,
	Nick Desaulniers, KaiGai Kohei, linux-mtd, linux-kernel,
	Christian Marangi
  Cc: Christian Brauner, Tim Gardner, kernel test robot, Ron Economos,
	Nathan Chancellor, stable

On Sat, 06 May 2023 06:56:12 +0200, Christian Marangi wrote:
> Use kcalloc() for allocation/flush of 128 pointers table to
> reduce stack usage.
> 
> Function now returns -ENOMEM or 0 on success.
> 
> stackusage
> Before:
> ./fs/jffs2/xattr.c:775  jffs2_build_xattr_subsystem     1208
> dynamic,bounded
> 
> [...]

I assume I was Cced to pick this up. I'm happy to do that. If this is
rather supposed to go through the jffs2 tree then please tell me so we
can drop it.

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/1] jffs2: reduce stack usage in jffs2_build_xattr_subsystem()
      https://git.kernel.org/vfs/vfs/c/493e7cebb906

^ permalink raw reply	[relevance 10%]

* Re: [PATCH] jffs2: reduce stack usage in jffs2_build_xattr_subsystem()
  2023-05-06  4:56 34% [PATCH] jffs2: reduce stack usage in jffs2_build_xattr_subsystem() Christian Marangi
@ 2023-05-06 13:11  5% ` Zhihao Cheng
  2023-05-15 10:46 10% ` Christian Brauner
  1 sibling, 0 replies; 28+ results
From: Zhihao Cheng @ 2023-05-06 13:11 UTC (permalink / raw)
  To: Christian Marangi, David Woodhouse, Richard Weinberger,
	Fabian Frederick, Nick Desaulniers, Christian Brauner,
	KaiGai Kohei, linux-mtd, linux-kernel
  Cc: Tim Gardner, kernel test robot, Ron Economos, Nathan Chancellor, stable

在 2023/5/6 12:56, Christian Marangi 写道:
> From: Fabian Frederick <fabf@skynet.be>
> 
> Use kcalloc() for allocation/flush of 128 pointers table to
> reduce stack usage.
> 
> Function now returns -ENOMEM or 0 on success.
> 
> stackusage
> Before:
> ./fs/jffs2/xattr.c:775  jffs2_build_xattr_subsystem     1208
> dynamic,bounded
> 
> After:
> ./fs/jffs2/xattr.c:775  jffs2_build_xattr_subsystem     192
> dynamic,bounded
> 
> Also update definition when CONFIG_JFFS2_FS_XATTR is not enabled
> 
> Tested with an MTD mount point and some user set/getfattr.
> 
> Many current target on OpenWRT also suffer from a compilation warning
> (that become an error with CONFIG_WERROR) with the following output:
> 
> fs/jffs2/xattr.c: In function 'jffs2_build_xattr_subsystem':
> fs/jffs2/xattr.c:887:1: error: the frame size of 1088 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
>    887 | }
>        | ^
> 
> Using dynamic allocation fix this compilation warning.
> 
> Fixes: c9f700f840bd ("[JFFS2][XATTR] using 'delete marker' for xdatum/xref deletion")
> Reported-by: Tim Gardner <tim.gardner@canonical.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Ron Economos <re@w6rz.net>
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> Cc: stable@vger.kernel.org
> ---
>   fs/jffs2/build.c |  5 ++++-
>   fs/jffs2/xattr.c | 13 +++++++++----
>   fs/jffs2/xattr.h |  4 ++--
>   3 files changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c
> index 837cd55fd4c5..6ae9d6fefb86 100644
> --- a/fs/jffs2/build.c
> +++ b/fs/jffs2/build.c
> @@ -211,7 +211,10 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c)
>   		ic->scan_dents = NULL;
>   		cond_resched();
>   	}
> -	jffs2_build_xattr_subsystem(c);
> +	ret = jffs2_build_xattr_subsystem(c);
> +	if (ret)
> +		goto exit;
> +
>   	c->flags &= ~JFFS2_SB_FLAG_BUILDING;
>   
>   	dbg_fsbuild("FS build complete\n");
> diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
> index aa4048a27f31..3b6bdc9a49e1 100644
> --- a/fs/jffs2/xattr.c
> +++ b/fs/jffs2/xattr.c
> @@ -772,10 +772,10 @@ void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c)
>   }
>   
>   #define XREF_TMPHASH_SIZE	(128)
> -void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
> +int jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
>   {
>   	struct jffs2_xattr_ref *ref, *_ref;
> -	struct jffs2_xattr_ref *xref_tmphash[XREF_TMPHASH_SIZE];
> +	struct jffs2_xattr_ref **xref_tmphash;
>   	struct jffs2_xattr_datum *xd, *_xd;
>   	struct jffs2_inode_cache *ic;
>   	struct jffs2_raw_node_ref *raw;
> @@ -784,9 +784,12 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
>   
>   	BUG_ON(!(c->flags & JFFS2_SB_FLAG_BUILDING));
>   
> +	xref_tmphash = kcalloc(XREF_TMPHASH_SIZE,
> +			       sizeof(struct jffs2_xattr_ref *), GFP_KERNEL);
> +	if (!xref_tmphash)
> +		return -ENOMEM;
> +

I have made some fault injection tests, jffs2 works fine, this patch 
imports no memleak problems. It seems okay.

>   	/* Phase.1 : Merge same xref */
> -	for (i=0; i < XREF_TMPHASH_SIZE; i++)
> -		xref_tmphash[i] = NULL;
>   	for (ref=c->xref_temp; ref; ref=_ref) {
>   		struct jffs2_xattr_ref *tmp;
>   
> @@ -884,6 +887,8 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
>   		     "%u of xref (%u dead, %u orphan) found.\n",
>   		     xdatum_count, xdatum_unchecked_count, xdatum_orphan_count,
>   		     xref_count, xref_dead_count, xref_orphan_count);
> +	kfree(xref_tmphash);
> +	return 0;
>   }
>   
>   struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
> diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
> index 720007b2fd65..1b5030a3349d 100644
> --- a/fs/jffs2/xattr.h
> +++ b/fs/jffs2/xattr.h
> @@ -71,7 +71,7 @@ static inline int is_xattr_ref_dead(struct jffs2_xattr_ref *ref)
>   #ifdef CONFIG_JFFS2_FS_XATTR
>   
>   extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c);
> -extern void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c);
> +extern int jffs2_build_xattr_subsystem(struct jffs2_sb_info *c);
>   extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c);
>   
>   extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
> @@ -103,7 +103,7 @@ extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t);
>   #else
>   
>   #define jffs2_init_xattr_subsystem(c)
> -#define jffs2_build_xattr_subsystem(c)
> +#define jffs2_build_xattr_subsystem(c)		(0)
>   #define jffs2_clear_xattr_subsystem(c)
>   
>   #define jffs2_xattr_do_crccheck_inode(c, ic)
> 


^ permalink raw reply	[relevance 5%]

* [PATCH] jffs2: reduce stack usage in jffs2_build_xattr_subsystem()
@ 2023-05-06  4:56 34% Christian Marangi
  2023-05-06 13:11  5% ` Zhihao Cheng
  2023-05-15 10:46 10% ` Christian Brauner
  0 siblings, 2 replies; 28+ results
From: Christian Marangi @ 2023-05-06  4:56 UTC (permalink / raw)
  To: David Woodhouse, Richard Weinberger, Fabian Frederick,
	Nick Desaulniers, Christian Marangi, Christian Brauner,
	KaiGai Kohei, linux-mtd, linux-kernel
  Cc: Tim Gardner, kernel test robot, Ron Economos, Nathan Chancellor, stable

From: Fabian Frederick <fabf@skynet.be>

Use kcalloc() for allocation/flush of 128 pointers table to
reduce stack usage.

Function now returns -ENOMEM or 0 on success.

stackusage
Before:
./fs/jffs2/xattr.c:775  jffs2_build_xattr_subsystem     1208
dynamic,bounded

After:
./fs/jffs2/xattr.c:775  jffs2_build_xattr_subsystem     192
dynamic,bounded

Also update definition when CONFIG_JFFS2_FS_XATTR is not enabled

Tested with an MTD mount point and some user set/getfattr.

Many current target on OpenWRT also suffer from a compilation warning
(that become an error with CONFIG_WERROR) with the following output:

fs/jffs2/xattr.c: In function 'jffs2_build_xattr_subsystem':
fs/jffs2/xattr.c:887:1: error: the frame size of 1088 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
  887 | }
      | ^

Using dynamic allocation fix this compilation warning.

Fixes: c9f700f840bd ("[JFFS2][XATTR] using 'delete marker' for xdatum/xref deletion")
Reported-by: Tim Gardner <tim.gardner@canonical.com>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Ron Economos <re@w6rz.net>
Reported-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Cc: stable@vger.kernel.org
---
 fs/jffs2/build.c |  5 ++++-
 fs/jffs2/xattr.c | 13 +++++++++----
 fs/jffs2/xattr.h |  4 ++--
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c
index 837cd55fd4c5..6ae9d6fefb86 100644
--- a/fs/jffs2/build.c
+++ b/fs/jffs2/build.c
@@ -211,7 +211,10 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c)
 		ic->scan_dents = NULL;
 		cond_resched();
 	}
-	jffs2_build_xattr_subsystem(c);
+	ret = jffs2_build_xattr_subsystem(c);
+	if (ret)
+		goto exit;
+
 	c->flags &= ~JFFS2_SB_FLAG_BUILDING;
 
 	dbg_fsbuild("FS build complete\n");
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index aa4048a27f31..3b6bdc9a49e1 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -772,10 +772,10 @@ void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c)
 }
 
 #define XREF_TMPHASH_SIZE	(128)
-void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
+int jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 {
 	struct jffs2_xattr_ref *ref, *_ref;
-	struct jffs2_xattr_ref *xref_tmphash[XREF_TMPHASH_SIZE];
+	struct jffs2_xattr_ref **xref_tmphash;
 	struct jffs2_xattr_datum *xd, *_xd;
 	struct jffs2_inode_cache *ic;
 	struct jffs2_raw_node_ref *raw;
@@ -784,9 +784,12 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 
 	BUG_ON(!(c->flags & JFFS2_SB_FLAG_BUILDING));
 
+	xref_tmphash = kcalloc(XREF_TMPHASH_SIZE,
+			       sizeof(struct jffs2_xattr_ref *), GFP_KERNEL);
+	if (!xref_tmphash)
+		return -ENOMEM;
+
 	/* Phase.1 : Merge same xref */
-	for (i=0; i < XREF_TMPHASH_SIZE; i++)
-		xref_tmphash[i] = NULL;
 	for (ref=c->xref_temp; ref; ref=_ref) {
 		struct jffs2_xattr_ref *tmp;
 
@@ -884,6 +887,8 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 		     "%u of xref (%u dead, %u orphan) found.\n",
 		     xdatum_count, xdatum_unchecked_count, xdatum_orphan_count,
 		     xref_count, xref_dead_count, xref_orphan_count);
+	kfree(xref_tmphash);
+	return 0;
 }
 
 struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
index 720007b2fd65..1b5030a3349d 100644
--- a/fs/jffs2/xattr.h
+++ b/fs/jffs2/xattr.h
@@ -71,7 +71,7 @@ static inline int is_xattr_ref_dead(struct jffs2_xattr_ref *ref)
 #ifdef CONFIG_JFFS2_FS_XATTR
 
 extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c);
-extern void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c);
+extern int jffs2_build_xattr_subsystem(struct jffs2_sb_info *c);
 extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c);
 
 extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
@@ -103,7 +103,7 @@ extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t);
 #else
 
 #define jffs2_init_xattr_subsystem(c)
-#define jffs2_build_xattr_subsystem(c)
+#define jffs2_build_xattr_subsystem(c)		(0)
 #define jffs2_clear_xattr_subsystem(c)
 
 #define jffs2_xattr_do_crccheck_inode(c, ic)
-- 
2.39.2


^ permalink raw reply related	[relevance 34%]

* Re: [PATCH linux-next] jffs2: reduce stack usage in jffs2_build_xattr_subsystem()
  2017-05-09 20:30 35% [PATCH linux-next] jffs2: reduce stack usage in jffs2_build_xattr_subsystem() Fabian Frederick
@ 2023-01-20 21:56 10% ` Nick Desaulniers
  0 siblings, 0 replies; 28+ results
From: Nick Desaulniers @ 2023-01-20 21:56 UTC (permalink / raw)
  To: David Woodhouse
  Cc: David Woodhouse, linux-mtd, linux-kernel, tim.gardner, lkp, re, nathan

On Tue, May 09, 2017 at 10:30:03PM +0200, Fabian Frederick wrote:
> Use kcalloc() for allocation/flush of 128 pointers table to
> reduce stack usage.
> 
> Function now returns -ENOMEM or 0 on success.
> 
> stackusage
> Before:
> ./fs/jffs2/xattr.c:775  jffs2_build_xattr_subsystem     1208
> dynamic,bounded
> 
> After:
> ./fs/jffs2/xattr.c:775  jffs2_build_xattr_subsystem     192
> dynamic,bounded
> 
> Also update definition when CONFIG_JFFS2_FS_XATTR is not enabled
> 
> Tested with an MTD mount point and some user set/getfattr.
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Hi David,
Any chance this patch can get picked up? It LGTM, and I see multiple
reports of this issue on lore:
https://lore.kernel.org/lkml/?q=jffs2_build_xattr_subsystem

Reported-by: Tim Gardner <tim.gardner@canonical.com>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Ron Economos <re@w6rz.net>
Reported-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  fs/jffs2/build.c |  5 ++++-
>  fs/jffs2/xattr.c | 14 ++++++++++----
>  fs/jffs2/xattr.h |  4 ++--
>  3 files changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c
> index b288c8a..f88e0bf 100644
> --- a/fs/jffs2/build.c
> +++ b/fs/jffs2/build.c
> @@ -211,7 +211,10 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c)
>  		ic->scan_dents = NULL;
>  		cond_resched();
>  	}
> -	jffs2_build_xattr_subsystem(c);
> +	ret = jffs2_build_xattr_subsystem(c);
> +	if (ret)
> +		goto exit;
> +
>  	c->flags &= ~JFFS2_SB_FLAG_BUILDING;
>  
>  	dbg_fsbuild("FS build complete\n");
> diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
> index da3e185..95c0496 100644
> --- a/fs/jffs2/xattr.c
> +++ b/fs/jffs2/xattr.c
> @@ -772,10 +772,10 @@ void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c)
>  }
>  
>  #define XREF_TMPHASH_SIZE	(128)
> -void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
> +int jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
>  {
>  	struct jffs2_xattr_ref *ref, *_ref;
> -	struct jffs2_xattr_ref *xref_tmphash[XREF_TMPHASH_SIZE];
> +	struct jffs2_xattr_ref **xref_tmphash;
>  	struct jffs2_xattr_datum *xd, *_xd;
>  	struct jffs2_inode_cache *ic;
>  	struct jffs2_raw_node_ref *raw;
> @@ -784,9 +784,13 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
>  
>  	BUG_ON(!(c->flags & JFFS2_SB_FLAG_BUILDING));
>  
> +
> +	xref_tmphash = kcalloc(XREF_TMPHASH_SIZE,
> +			       sizeof(struct jffs2_xattr_ref *), GFP_KERNEL);
> +	if (!xref_tmphash)
> +		return -ENOMEM;
> +
>  	/* Phase.1 : Merge same xref */
> -	for (i=0; i < XREF_TMPHASH_SIZE; i++)
> -		xref_tmphash[i] = NULL;
>  	for (ref=c->xref_temp; ref; ref=_ref) {
>  		struct jffs2_xattr_ref *tmp;
>  
> @@ -884,6 +888,8 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
>  		     "%u of xref (%u dead, %u orphan) found.\n",
>  		     xdatum_count, xdatum_unchecked_count, xdatum_orphan_count,
>  		     xref_count, xref_dead_count, xref_orphan_count);
> +	kfree(xref_tmphash);
> +	return 0;
>  }
>  
>  struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
> diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
> index 720007b..1b5030a 100644
> --- a/fs/jffs2/xattr.h
> +++ b/fs/jffs2/xattr.h
> @@ -71,7 +71,7 @@ static inline int is_xattr_ref_dead(struct jffs2_xattr_ref *ref)
>  #ifdef CONFIG_JFFS2_FS_XATTR
>  
>  extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c);
> -extern void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c);
> +extern int jffs2_build_xattr_subsystem(struct jffs2_sb_info *c);
>  extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c);
>  
>  extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
> @@ -103,7 +103,7 @@ extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t);
>  #else
>  
>  #define jffs2_init_xattr_subsystem(c)
> -#define jffs2_build_xattr_subsystem(c)
> +#define jffs2_build_xattr_subsystem(c)		(0)
>  #define jffs2_clear_xattr_subsystem(c)
>  
>  #define jffs2_xattr_do_crccheck_inode(c, ic)
> -- 
> 2.9.3
> 

^ permalink raw reply	[relevance 10%]

* Re: [PATCH 5.15 00/41] 5.15.15-rc1 review
  2022-01-15 12:15  0%       ` Greg Kroah-Hartman
@ 2022-01-15 12:31  0%         ` Ron Economos
  0 siblings, 0 replies; 28+ results
From: Ron Economos @ 2022-01-15 12:31 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, linux, shuah, patches, lkft-triage,
	pavel, jonathanh, f.fainelli, stable

On 1/15/22 4:15 AM, Greg Kroah-Hartman wrote:
> On Sat, Jan 15, 2022 at 03:52:34AM -0800, Ron Economos wrote:
>> On 1/15/22 12:14 AM, Greg Kroah-Hartman wrote:
>>> On Fri, Jan 14, 2022 at 11:59:57AM -0800, Ron Economos wrote:
>>>> On 1/14/22 12:16 AM, Greg Kroah-Hartman wrote:
>>>>> This is the start of the stable review cycle for the 5.15.15 release.
>>>>> There are 41 patches in this series, all will be posted as a response
>>>>> to this one.  If anyone has any issues with these being applied, please
>>>>> let me know.
>>>>>
>>>>> Responses should be made by Sun, 16 Jan 2022 08:15:33 +0000.
>>>>> Anything received after that time might be too late.
>>>>>
>>>>> The whole patch series can be found in one patch at:
>>>>> 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.15-rc1.gz
>>>>> or in the git tree and branch at:
>>>>> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.15.y
>>>>> and the diffstat can be found below.
>>>>>
>>>>> thanks,
>>>>>
>>>>> greg k-h
>>>> Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
>>>>
>>>> Warnings:
>>>>
>>>> fs/jffs2/xattr.c: In function 'jffs2_build_xattr_subsystem':
>>>> fs/jffs2/xattr.c:887:1: warning: the frame size of 1104 bytes is larger than
>>>> 1024 bytes [-Wframe-larger-than=]
>>>>     887 | }
>>>>         | ^
>>>> lib/crypto/curve25519-hacl64.c: In function 'ladder_cmult.constprop':
>>>> lib/crypto/curve25519-hacl64.c:601:1: warning: the frame size of 1040 bytes
>>>> is larger than 1024 bytes [-Wframe-larger-than=]
>>>>     601 | }
>>>>         | ^
>>>> drivers/net/wireguard/allowedips.c: In function 'root_remove_peer_lists':
>>>> drivers/net/wireguard/allowedips.c:77:1: warning: the frame size of 1040
>>>> bytes is larger than 1024 bytes [-Wframe-larger-than=]
>>>>      77 | }
>>>>         | ^
>>>> drivers/net/wireguard/allowedips.c: In function 'root_free_rcu':
>>>> drivers/net/wireguard/allowedips.c:64:1: warning: the frame size of 1040
>>>> bytes is larger than 1024 bytes [-Wframe-larger-than=]
>>>>      64 | }
>>>>         | ^
>>>> drivers/vhost/scsi.c: In function 'vhost_scsi_flush':
>>>> drivers/vhost/scsi.c:1444:1: warning: the frame size of 1040 bytes is larger
>>>> than 1024 bytes [-Wframe-larger-than=]
>>>>    1444 | }
>>>>         | ^
>>> Are these new warnings with this release, or old ones?
>>>
>>> thanks,
>>>
>>> greg k-h
>> They are old ones.
> Ok, that's good.  Are they fixed in 5.16?  Anyone planning on fixing
> them given that -Werror is now allowed to be set?
>
> thanks,
>
> greg k-h

They are also in 5.16. I'm using the Ubuntu 21.10 config (which includes 
the kitchen sink), so they're probably not showing up for others.

Ron


^ permalink raw reply	[relevance 0%]

* Re: [PATCH 5.15 00/41] 5.15.15-rc1 review
  2022-01-15  8:14  0%   ` Greg Kroah-Hartman
@ 2022-01-15 11:52  0%     ` Ron Economos
  2022-01-15 12:15  0%       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 28+ results
From: Ron Economos @ 2022-01-15 11:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, linux, shuah, patches, lkft-triage,
	pavel, jonathanh, f.fainelli, stable

On 1/15/22 12:14 AM, Greg Kroah-Hartman wrote:
> On Fri, Jan 14, 2022 at 11:59:57AM -0800, Ron Economos wrote:
>> On 1/14/22 12:16 AM, Greg Kroah-Hartman wrote:
>>> This is the start of the stable review cycle for the 5.15.15 release.
>>> There are 41 patches in this series, all will be posted as a response
>>> to this one.  If anyone has any issues with these being applied, please
>>> let me know.
>>>
>>> Responses should be made by Sun, 16 Jan 2022 08:15:33 +0000.
>>> Anything received after that time might be too late.
>>>
>>> The whole patch series can be found in one patch at:
>>> 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.15-rc1.gz
>>> or in the git tree and branch at:
>>> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.15.y
>>> and the diffstat can be found below.
>>>
>>> thanks,
>>>
>>> greg k-h
>> Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
>>
>> Warnings:
>>
>> fs/jffs2/xattr.c: In function 'jffs2_build_xattr_subsystem':
>> fs/jffs2/xattr.c:887:1: warning: the frame size of 1104 bytes is larger than
>> 1024 bytes [-Wframe-larger-than=]
>>    887 | }
>>        | ^
>> lib/crypto/curve25519-hacl64.c: In function 'ladder_cmult.constprop':
>> lib/crypto/curve25519-hacl64.c:601:1: warning: the frame size of 1040 bytes
>> is larger than 1024 bytes [-Wframe-larger-than=]
>>    601 | }
>>        | ^
>> drivers/net/wireguard/allowedips.c: In function 'root_remove_peer_lists':
>> drivers/net/wireguard/allowedips.c:77:1: warning: the frame size of 1040
>> bytes is larger than 1024 bytes [-Wframe-larger-than=]
>>     77 | }
>>        | ^
>> drivers/net/wireguard/allowedips.c: In function 'root_free_rcu':
>> drivers/net/wireguard/allowedips.c:64:1: warning: the frame size of 1040
>> bytes is larger than 1024 bytes [-Wframe-larger-than=]
>>     64 | }
>>        | ^
>> drivers/vhost/scsi.c: In function 'vhost_scsi_flush':
>> drivers/vhost/scsi.c:1444:1: warning: the frame size of 1040 bytes is larger
>> than 1024 bytes [-Wframe-larger-than=]
>>   1444 | }
>>        | ^
> Are these new warnings with this release, or old ones?
>
> thanks,
>
> greg k-h

They are old ones.

Ron


^ permalink raw reply	[relevance 0%]

* Re: [PATCH 5.15 00/41] 5.15.15-rc1 review
  2022-01-15 11:52  0%     ` Ron Economos
@ 2022-01-15 12:15  0%       ` Greg Kroah-Hartman
  2022-01-15 12:31  0%         ` Ron Economos
  0 siblings, 1 reply; 28+ results
From: Greg Kroah-Hartman @ 2022-01-15 12:15 UTC (permalink / raw)
  To: Ron Economos
  Cc: linux-kernel, torvalds, akpm, linux, shuah, patches, lkft-triage,
	pavel, jonathanh, f.fainelli, stable

On Sat, Jan 15, 2022 at 03:52:34AM -0800, Ron Economos wrote:
> On 1/15/22 12:14 AM, Greg Kroah-Hartman wrote:
> > On Fri, Jan 14, 2022 at 11:59:57AM -0800, Ron Economos wrote:
> > > On 1/14/22 12:16 AM, Greg Kroah-Hartman wrote:
> > > > This is the start of the stable review cycle for the 5.15.15 release.
> > > > There are 41 patches in this series, all will be posted as a response
> > > > to this one.  If anyone has any issues with these being applied, please
> > > > let me know.
> > > > 
> > > > Responses should be made by Sun, 16 Jan 2022 08:15:33 +0000.
> > > > Anything received after that time might be too late.
> > > > 
> > > > The whole patch series can be found in one patch at:
> > > > 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.15-rc1.gz
> > > > or in the git tree and branch at:
> > > > 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.15.y
> > > > and the diffstat can be found below.
> > > > 
> > > > thanks,
> > > > 
> > > > greg k-h
> > > Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
> > > 
> > > Warnings:
> > > 
> > > fs/jffs2/xattr.c: In function 'jffs2_build_xattr_subsystem':
> > > fs/jffs2/xattr.c:887:1: warning: the frame size of 1104 bytes is larger than
> > > 1024 bytes [-Wframe-larger-than=]
> > >    887 | }
> > >        | ^
> > > lib/crypto/curve25519-hacl64.c: In function 'ladder_cmult.constprop':
> > > lib/crypto/curve25519-hacl64.c:601:1: warning: the frame size of 1040 bytes
> > > is larger than 1024 bytes [-Wframe-larger-than=]
> > >    601 | }
> > >        | ^
> > > drivers/net/wireguard/allowedips.c: In function 'root_remove_peer_lists':
> > > drivers/net/wireguard/allowedips.c:77:1: warning: the frame size of 1040
> > > bytes is larger than 1024 bytes [-Wframe-larger-than=]
> > >     77 | }
> > >        | ^
> > > drivers/net/wireguard/allowedips.c: In function 'root_free_rcu':
> > > drivers/net/wireguard/allowedips.c:64:1: warning: the frame size of 1040
> > > bytes is larger than 1024 bytes [-Wframe-larger-than=]
> > >     64 | }
> > >        | ^
> > > drivers/vhost/scsi.c: In function 'vhost_scsi_flush':
> > > drivers/vhost/scsi.c:1444:1: warning: the frame size of 1040 bytes is larger
> > > than 1024 bytes [-Wframe-larger-than=]
> > >   1444 | }
> > >        | ^
> > Are these new warnings with this release, or old ones?
> > 
> > thanks,
> > 
> > greg k-h
> 
> They are old ones.

Ok, that's good.  Are they fixed in 5.16?  Anyone planning on fixing
them given that -Werror is now allowed to be set?

thanks,

greg k-h

^ permalink raw reply	[relevance 0%]

* Re: [PATCH 5.15 00/41] 5.15.15-rc1 review
  2022-01-14 19:59  4% ` Ron Economos
@ 2022-01-15  8:14  0%   ` Greg Kroah-Hartman
  2022-01-15 11:52  0%     ` Ron Economos
  0 siblings, 1 reply; 28+ results
From: Greg Kroah-Hartman @ 2022-01-15  8:14 UTC (permalink / raw)
  To: Ron Economos
  Cc: linux-kernel, torvalds, akpm, linux, shuah, patches, lkft-triage,
	pavel, jonathanh, f.fainelli, stable

On Fri, Jan 14, 2022 at 11:59:57AM -0800, Ron Economos wrote:
> On 1/14/22 12:16 AM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 5.15.15 release.
> > There are 41 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Sun, 16 Jan 2022 08:15:33 +0000.
> > Anything received after that time might be too late.
> > 
> > The whole patch series can be found in one patch at:
> > 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.15-rc1.gz
> > or in the git tree and branch at:
> > 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.15.y
> > and the diffstat can be found below.
> > 
> > thanks,
> > 
> > greg k-h
> 
> Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
> 
> Warnings:
> 
> fs/jffs2/xattr.c: In function 'jffs2_build_xattr_subsystem':
> fs/jffs2/xattr.c:887:1: warning: the frame size of 1104 bytes is larger than
> 1024 bytes [-Wframe-larger-than=]
>   887 | }
>       | ^
> lib/crypto/curve25519-hacl64.c: In function 'ladder_cmult.constprop':
> lib/crypto/curve25519-hacl64.c:601:1: warning: the frame size of 1040 bytes
> is larger than 1024 bytes [-Wframe-larger-than=]
>   601 | }
>       | ^
> drivers/net/wireguard/allowedips.c: In function 'root_remove_peer_lists':
> drivers/net/wireguard/allowedips.c:77:1: warning: the frame size of 1040
> bytes is larger than 1024 bytes [-Wframe-larger-than=]
>    77 | }
>       | ^
> drivers/net/wireguard/allowedips.c: In function 'root_free_rcu':
> drivers/net/wireguard/allowedips.c:64:1: warning: the frame size of 1040
> bytes is larger than 1024 bytes [-Wframe-larger-than=]
>    64 | }
>       | ^
> drivers/vhost/scsi.c: In function 'vhost_scsi_flush':
> drivers/vhost/scsi.c:1444:1: warning: the frame size of 1040 bytes is larger
> than 1024 bytes [-Wframe-larger-than=]
>  1444 | }
>       | ^

Are these new warnings with this release, or old ones?

thanks,

greg k-h

^ permalink raw reply	[relevance 0%]

* Re: [PATCH 5.16 00/37] 5.16.1-rc1 review
  @ 2022-01-15  4:25  4% ` Ron Economos
  0 siblings, 0 replies; 28+ results
From: Ron Economos @ 2022-01-15  4:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, shuah, patches, lkft-triage, pavel,
	jonathanh, f.fainelli, stable

On 1/14/22 12:16 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 5.16.1 release.
> There are 37 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Sun, 16 Jan 2022 08:15:33 +0000.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.16.1-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.16.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h

Built and booted successfully on RISC-V RV64 (HiFive Unmatched).

Warnings:

fs/jffs2/xattr.c: In function ‘jffs2_build_xattr_subsystem’:
fs/jffs2/xattr.c:887:1: warning: the frame size of 1104 bytes is larger 
than 1024 bytes [-Wframe-larger-than=]
   887 | }
       | ^
lib/crypto/curve25519-hacl64.c: In function ‘ladder_cmult.constprop’:
lib/crypto/curve25519-hacl64.c:601:1: warning: the frame size of 1040 
bytes is larger than 1024 bytes [-Wframe-larger-than=]
   601 | }
       | ^
drivers/net/wireguard/allowedips.c: In function ‘root_remove_peer_lists’:
drivers/net/wireguard/allowedips.c:77:1: warning: the frame size of 1040 
bytes is larger than 1024 bytes [-Wframe-larger-than=]
    77 | }
       | ^
drivers/net/wireguard/allowedips.c: In function ‘root_free_rcu’:
drivers/net/wireguard/allowedips.c:64:1: warning: the frame size of 1040 
bytes is larger than 1024 bytes [-Wframe-larger-than=]
    64 | }
       | ^
drivers/vhost/scsi.c: In function ‘vhost_scsi_flush’:
drivers/vhost/scsi.c:1444:1: warning: the frame size of 1040 bytes is 
larger than 1024 bytes [-Wframe-larger-than=]
  1444 | }
       | ^

Tested-by: Ron Economos <re@w6rz.net>


^ permalink raw reply	[relevance 4%]

* Re: [PATCH 5.15 00/41] 5.15.15-rc1 review
  @ 2022-01-14 19:59  4% ` Ron Economos
  2022-01-15  8:14  0%   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 28+ results
From: Ron Economos @ 2022-01-14 19:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, shuah, patches, lkft-triage, pavel,
	jonathanh, f.fainelli, stable

On 1/14/22 12:16 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 5.15.15 release.
> There are 41 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Sun, 16 Jan 2022 08:15:33 +0000.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.15-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.15.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h

Built and booted successfully on RISC-V RV64 (HiFive Unmatched).

Warnings:

fs/jffs2/xattr.c: In function 'jffs2_build_xattr_subsystem':
fs/jffs2/xattr.c:887:1: warning: the frame size of 1104 bytes is larger 
than 1024 bytes [-Wframe-larger-than=]
   887 | }
       | ^
lib/crypto/curve25519-hacl64.c: In function 'ladder_cmult.constprop':
lib/crypto/curve25519-hacl64.c:601:1: warning: the frame size of 1040 
bytes is larger than 1024 bytes [-Wframe-larger-than=]
   601 | }
       | ^
drivers/net/wireguard/allowedips.c: In function 'root_remove_peer_lists':
drivers/net/wireguard/allowedips.c:77:1: warning: the frame size of 1040 
bytes is larger than 1024 bytes [-Wframe-larger-than=]
    77 | }
       | ^
drivers/net/wireguard/allowedips.c: In function 'root_free_rcu':
drivers/net/wireguard/allowedips.c:64:1: warning: the frame size of 1040 
bytes is larger than 1024 bytes [-Wframe-larger-than=]
    64 | }
       | ^
drivers/vhost/scsi.c: In function 'vhost_scsi_flush':
drivers/vhost/scsi.c:1444:1: warning: the frame size of 1040 bytes is 
larger than 1024 bytes [-Wframe-larger-than=]
  1444 | }
       | ^

Tested-by: Ron Economos <re@w6rz.net>


^ permalink raw reply	[relevance 4%]

* fs/jffs2/xattr.c:887:1: warning: the frame size of 1040 bytes is larger than 1024 bytes
@ 2021-10-24 17:38  4% kernel test robot
  0 siblings, 0 replies; 28+ results
From: kernel test robot @ 2021-10-24 17:38 UTC (permalink / raw)
  To: Kees Cook
  Cc: kbuild-all, linux-kernel, Andrew Morton, Linux Memory Management List

[-- Attachment #1: Type: text/plain, Size: 11885 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   9c0c4d24ac000e52d55348961d3a3ba42065e0cf
commit: d0a3ac549f389c1511a4df0d7638536305205d20 ubsan: enable for all*config builds
date:   10 months ago
config: powerpc64-randconfig-r013-20211019 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d0a3ac549f389c1511a4df0d7638536305205d20
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout d0a3ac549f389c1511a4df0d7638536305205d20
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   fs/jffs2/xattr.c: In function 'jffs2_garbage_collect_xattr_datum':
   fs/jffs2/xattr.c:1247:79: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
    1247 |                           xd->xid, xd->version, old_ofs, ref_offset(xd->node));
         |                                                                               ^
   fs/jffs2/xattr.c:1222:34: warning: variable 'old_ofs' set but not used [-Wunused-but-set-variable]
    1222 |         uint32_t totlen, length, old_ofs;
         |                                  ^~~~~~~
   fs/jffs2/xattr.c: In function 'jffs2_garbage_collect_xattr_ref':
   fs/jffs2/xattr.c:1281:86: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
    1281 |                           ref->ic->ino, ref->xd->xid, old_ofs, ref_offset(ref->node));
         |                                                                                      ^
   fs/jffs2/xattr.c:1258:34: warning: variable 'old_ofs' set but not used [-Wunused-but-set-variable]
    1258 |         uint32_t totlen, length, old_ofs;
         |                                  ^~~~~~~
   fs/jffs2/xattr.c: In function 'jffs2_build_xattr_subsystem':
>> fs/jffs2/xattr.c:887:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
     887 | }
         | ^


vim +887 fs/jffs2/xattr.c

aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  773  
c9f700f840bd48 KaiGai Kohei    2006-06-11  774  #define XREF_TMPHASH_SIZE	(128)
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  775  void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  776  {
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  777  	struct jffs2_xattr_ref *ref, *_ref;
c9f700f840bd48 KaiGai Kohei    2006-06-11  778  	struct jffs2_xattr_ref *xref_tmphash[XREF_TMPHASH_SIZE];
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  779  	struct jffs2_xattr_datum *xd, *_xd;
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  780  	struct jffs2_inode_cache *ic;
c9f700f840bd48 KaiGai Kohei    2006-06-11  781  	struct jffs2_raw_node_ref *raw;
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  782  	int i, xdatum_count = 0, xdatum_unchecked_count = 0, xref_count = 0;
8a13695cbe4e83 KaiGai Kohei    2006-06-24  783  	int xdatum_orphan_count = 0, xref_orphan_count = 0, xref_dead_count = 0;
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  784  
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  785  	BUG_ON(!(c->flags & JFFS2_SB_FLAG_BUILDING));
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  786  
8a13695cbe4e83 KaiGai Kohei    2006-06-24  787  	/* Phase.1 : Merge same xref */
c9f700f840bd48 KaiGai Kohei    2006-06-11  788  	for (i=0; i < XREF_TMPHASH_SIZE; i++)
c9f700f840bd48 KaiGai Kohei    2006-06-11  789  		xref_tmphash[i] = NULL;
8f2b6f49c656dd KaiGai Kohei    2006-05-13  790  	for (ref=c->xref_temp; ref; ref=_ref) {
c9f700f840bd48 KaiGai Kohei    2006-06-11  791  		struct jffs2_xattr_ref *tmp;
c9f700f840bd48 KaiGai Kohei    2006-06-11  792  
8f2b6f49c656dd KaiGai Kohei    2006-05-13  793  		_ref = ref->next;
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  794  		if (ref_flags(ref->node) != REF_PRISTINE) {
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  795  			if (verify_xattr_ref(c, ref)) {
c9f700f840bd48 KaiGai Kohei    2006-06-11  796  				BUG_ON(ref->node->next_in_ino != (void *)ref);
c9f700f840bd48 KaiGai Kohei    2006-06-11  797  				ref->node->next_in_ino = NULL;
c9f700f840bd48 KaiGai Kohei    2006-06-11  798  				jffs2_mark_node_obsolete(c, ref->node);
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  799  				jffs2_free_xattr_ref(ref);
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  800  				continue;
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  801  			}
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  802  		}
c9f700f840bd48 KaiGai Kohei    2006-06-11  803  
c9f700f840bd48 KaiGai Kohei    2006-06-11  804  		i = (ref->ino ^ ref->xid) % XREF_TMPHASH_SIZE;
c9f700f840bd48 KaiGai Kohei    2006-06-11  805  		for (tmp=xref_tmphash[i]; tmp; tmp=tmp->next) {
c9f700f840bd48 KaiGai Kohei    2006-06-11  806  			if (tmp->ino == ref->ino && tmp->xid == ref->xid)
c9f700f840bd48 KaiGai Kohei    2006-06-11  807  				break;
c9f700f840bd48 KaiGai Kohei    2006-06-11  808  		}
c9f700f840bd48 KaiGai Kohei    2006-06-11  809  		if (tmp) {
c9f700f840bd48 KaiGai Kohei    2006-06-11  810  			raw = ref->node;
c9f700f840bd48 KaiGai Kohei    2006-06-11  811  			if (ref->xseqno > tmp->xseqno) {
c9f700f840bd48 KaiGai Kohei    2006-06-11  812  				tmp->xseqno = ref->xseqno;
c9f700f840bd48 KaiGai Kohei    2006-06-11  813  				raw->next_in_ino = tmp->node;
c9f700f840bd48 KaiGai Kohei    2006-06-11  814  				tmp->node = raw;
c9f700f840bd48 KaiGai Kohei    2006-06-11  815  			} else {
c9f700f840bd48 KaiGai Kohei    2006-06-11  816  				raw->next_in_ino = tmp->node->next_in_ino;
c9f700f840bd48 KaiGai Kohei    2006-06-11  817  				tmp->node->next_in_ino = raw;
c9f700f840bd48 KaiGai Kohei    2006-06-11  818  			}
c9f700f840bd48 KaiGai Kohei    2006-06-11  819  			jffs2_free_xattr_ref(ref);
c9f700f840bd48 KaiGai Kohei    2006-06-11  820  			continue;
c9f700f840bd48 KaiGai Kohei    2006-06-11  821  		} else {
c9f700f840bd48 KaiGai Kohei    2006-06-11  822  			ref->next = xref_tmphash[i];
c9f700f840bd48 KaiGai Kohei    2006-06-11  823  			xref_tmphash[i] = ref;
c9f700f840bd48 KaiGai Kohei    2006-06-11  824  		}
c9f700f840bd48 KaiGai Kohei    2006-06-11  825  	}
c9f700f840bd48 KaiGai Kohei    2006-06-11  826  	c->xref_temp = NULL;
c9f700f840bd48 KaiGai Kohei    2006-06-11  827  
8a13695cbe4e83 KaiGai Kohei    2006-06-24  828  	/* Phase.2 : Bind xref with inode_cache and xattr_datum */
c9f700f840bd48 KaiGai Kohei    2006-06-11  829  	for (i=0; i < XREF_TMPHASH_SIZE; i++) {
c9f700f840bd48 KaiGai Kohei    2006-06-11  830  		for (ref=xref_tmphash[i]; ref; ref=_ref) {
8a13695cbe4e83 KaiGai Kohei    2006-06-24  831  			xref_count++;
c9f700f840bd48 KaiGai Kohei    2006-06-11  832  			_ref = ref->next;
c9f700f840bd48 KaiGai Kohei    2006-06-11  833  			if (is_xattr_ref_dead(ref)) {
c9f700f840bd48 KaiGai Kohei    2006-06-11  834  				ref->next = c->xref_dead_list;
c9f700f840bd48 KaiGai Kohei    2006-06-11  835  				c->xref_dead_list = ref;
8a13695cbe4e83 KaiGai Kohei    2006-06-24  836  				xref_dead_count++;
c9f700f840bd48 KaiGai Kohei    2006-06-11  837  				continue;
c9f700f840bd48 KaiGai Kohei    2006-06-11  838  			}
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  839  			/* At this point, ref->xid and ref->ino contain XID and inode number.
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  840  			   ref->xd and ref->ic are not valid yet. */
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  841  			xd = jffs2_find_xattr_datum(c, ref->xid);
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  842  			ic = jffs2_get_ino_cache(c, ref->ino);
27c72b040c0be8 David Woodhouse 2008-05-01  843  			if (!xd || !ic || !ic->pino_nlink) {
8a13695cbe4e83 KaiGai Kohei    2006-06-24  844  				dbg_xattr("xref(ino=%u, xid=%u, xseqno=%u) is orphan.\n",
c9f700f840bd48 KaiGai Kohei    2006-06-11  845  					  ref->ino, ref->xid, ref->xseqno);
8a13695cbe4e83 KaiGai Kohei    2006-06-24  846  				ref->xseqno |= XREF_DELETE_MARKER;
c9f700f840bd48 KaiGai Kohei    2006-06-11  847  				ref->next = c->xref_dead_list;
c9f700f840bd48 KaiGai Kohei    2006-06-11  848  				c->xref_dead_list = ref;
8a13695cbe4e83 KaiGai Kohei    2006-06-24  849  				xref_orphan_count++;
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  850  				continue;
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  851  			}
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  852  			ref->xd = xd;
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  853  			ref->ic = ic;
2c887e2359f6e7 KaiGai Kohei    2006-06-24  854  			atomic_inc(&xd->refcnt);
8f2b6f49c656dd KaiGai Kohei    2006-05-13  855  			ref->next = ic->xref;
8f2b6f49c656dd KaiGai Kohei    2006-05-13  856  			ic->xref = ref;
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  857  		}
c9f700f840bd48 KaiGai Kohei    2006-06-11  858  	}
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  859  
8a13695cbe4e83 KaiGai Kohei    2006-06-24  860  	/* Phase.3 : Link unchecked xdatum to xattr_unchecked list */
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  861  	for (i=0; i < XATTRINDEX_HASHSIZE; i++) {
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  862  		list_for_each_entry_safe(xd, _xd, &c->xattrindex[i], xindex) {
8a13695cbe4e83 KaiGai Kohei    2006-06-24  863  			xdatum_count++;
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  864  			list_del_init(&xd->xindex);
2c887e2359f6e7 KaiGai Kohei    2006-06-24  865  			if (!atomic_read(&xd->refcnt)) {
8a13695cbe4e83 KaiGai Kohei    2006-06-24  866  				dbg_xattr("xdatum(xid=%u, version=%u) is orphan.\n",
c9f700f840bd48 KaiGai Kohei    2006-06-11  867  					  xd->xid, xd->version);
8a13695cbe4e83 KaiGai Kohei    2006-06-24  868  				xd->flags |= JFFS2_XFLAGS_DEAD;
c9f700f840bd48 KaiGai Kohei    2006-06-11  869  				list_add(&xd->xindex, &c->xattr_unchecked);
8a13695cbe4e83 KaiGai Kohei    2006-06-24  870  				xdatum_orphan_count++;
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  871  				continue;
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  872  			}
c9f700f840bd48 KaiGai Kohei    2006-06-11  873  			if (is_xattr_datum_unchecked(c, xd)) {
c9f700f840bd48 KaiGai Kohei    2006-06-11  874  				dbg_xattr("unchecked xdatum(xid=%u, version=%u)\n",
c9f700f840bd48 KaiGai Kohei    2006-06-11  875  					  xd->xid, xd->version);
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  876  				list_add(&xd->xindex, &c->xattr_unchecked);
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  877  				xdatum_unchecked_count++;
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  878  			}
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  879  		}
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  880  	}
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  881  	/* build complete */
8a13695cbe4e83 KaiGai Kohei    2006-06-24  882  	JFFS2_NOTICE("complete building xattr subsystem, %u of xdatum"
8a13695cbe4e83 KaiGai Kohei    2006-06-24  883  		     " (%u unchecked, %u orphan) and "
8a13695cbe4e83 KaiGai Kohei    2006-06-24  884  		     "%u of xref (%u dead, %u orphan) found.\n",
8a13695cbe4e83 KaiGai Kohei    2006-06-24  885  		     xdatum_count, xdatum_unchecked_count, xdatum_orphan_count,
8a13695cbe4e83 KaiGai Kohei    2006-06-24  886  		     xref_count, xref_dead_count, xref_orphan_count);
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13 @887  }
aa98d7cf59b5b0 KaiGai Kohei    2006-05-13  888  

:::::: The code at line 887 was first introduced by commit
:::::: aa98d7cf59b5b0764d3502662053489585faf2fe [JFFS2][XATTR] XATTR support on JFFS2 (version. 5)

:::::: TO: KaiGai Kohei <kaigai@ak.jp.nec.com>
:::::: CC: KaiGai Kohei <kaigai@ak.jp.nec.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36678 bytes --]

^ permalink raw reply	[relevance 4%]

* Re: [PATCH] Enable '-Werror' by default for all kernel builds
  @ 2021-09-07  2:30  1%   ` Nathan Chancellor
  0 siblings, 0 replies; 28+ results
From: Nathan Chancellor @ 2021-09-07  2:30 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Guenter Roeck, linux-kernel, llvm, Nick Desaulniers

On Mon, Sep 06, 2021 at 09:12:12AM -0700, Linus Torvalds wrote:
> On Mon, Sep 6, 2021 at 7:26 AM Guenter Roeck <linux@roeck-us.net> wrote:
> >
> > Build results:
> >         total: 153 pass: 89 fail: 64
> 
> Well, that sadly proves the point of that patch. x86-64 may be clean,
> because I have required it manually. Others not necessarily so much..
> 
> I've got at least one sparc64 fix in my inbox. It _might_ fix some
> other cases too (syscall checking), but I suspect it's one of those
> "death by a thousand cuts" situations, not just one or two issues that
> show up.
> 
> Do you end up exposing the errors anywhere where I can take a look?
> 
> If some of them are just because of bad tooling on certain
> architectures (ie fundamentally "this is unfixable, because we use
> gcc-XYZ that just always causes warnings") then those we could/should
> just disable -Werror for those and forget about them.
> 
> But hopefully most cases are just "people haven't cared enough" and
> easily fixed.

Our clang builds got bit pretty hard by this. From my local builds
(clang-14), the following ones failed (file name describes the config)
along with the errors plus some triage. -Wframe-larger-than= appears to
be the most common warning. I apologize if this email is too long or
convoluted, I can try to break it down better in the future.



arm32-allmodconfig.log: arch/arm/lib/xor-neon.c:30:2: error: This code requires at least version 4.6 of GCC [-Werror,-W#warnings]
arm32-alpine.log: arch/arm/lib/xor-neon.c:30:2: error: This code requires at least version 4.6 of GCC [-Werror,-W#warnings]
arm32-debian.log: arch/arm/lib/xor-neon.c:30:2: error: This code requires at least version 4.6 of GCC [-Werror,-W#warnings
arm32-fedora.log: arch/arm/lib/xor-neon.c:30:2: error: This code requires at least version 4.6 of GCC [-Werror,-W#warnings]
arm32-opensuse.log: arch/arm/lib/xor-neon.c:30:2: error: This code requires at least version 4.6 of GCC [-Werror,-W#warnings]
arm32-v7-archlinux.log:arch/arm/lib/xor-neon.c:30:2: error: This code requires at least version 4.6 of GCC [-Werror,-W#warnings]

This has been tracked for a while with no real resolution:

https://github.com/ClangBuiltLinux/linux/issues/496
https://github.com/ClangBuiltLinux/linux/issues/503
https://lore.kernel.org/r/20190528235742.105510-1-natechancellor@gmail.com/
https://lore.kernel.org/r/20201106051436.2384842-1-adrian.ratiu@collabora.com/
https://lore.kernel.org/r/20201112212457.2042105-1-adrian.ratiu@collabora.com/



arm32-allmodconfig.log: drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:157:11: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
arm32-allmodconfig.log: drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:257:7: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
arm32-allmodconfig.log: drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:262:7: error: variable 'err' is used uninitialized whenever switch case is taken [-Werror,-Wsometimes-uninitialized]

This affected a great number of configs. It is known and is being fixed:

https://lore.kernel.org/r/CA+G9fYsV7sTfaefGj3bpkvVdRQUeiWCVRiu6ovjtM=qri-HJ8g@mail.gmail.com/
https://lore.kernel.org/r/20210902190554.211497-4-saeed@kernel.org/

Unfortunately, these uninitialized warnings will constantly plague us
because GCC does not warn due to -Wmaybe-uninitialized being disabled
because it is not as reliable as the clang warning.



arm32-allmodconfig.log: crypto/wp512.c:782:13: error: stack frame size (1176) exceeds limit (1024) in function 'wp512_process_buffer' [-Werror,-Wframe-larger-than]
arm32-allmodconfig.log: drivers/firmware/tegra/bpmp-debugfs.c:294:12: error: stack frame size (1256) exceeds limit (1024) in function 'bpmp_debug_show' [-Werror,-Wframe-larger-than]
arm32-allmodconfig.log: drivers/firmware/tegra/bpmp-debugfs.c:357:16: error: stack frame size (1264) exceeds limit (1024) in function 'bpmp_debug_store' [-Werror,-Wframe-larger-than]
arm32-allmodconfig.log: drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:3043:6: error: stack frame size (1384) exceeds limit (1024) in function 'bw_calcs' [-Werror,-Wframe-larger-than]
arm32-allmodconfig.log: drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:77:13: error: stack frame size (5560) exceeds limit (1024) in function 'calculate_bandwidth' [-Werror,-Wframe-larger-than]
arm32-allmodconfig.log: drivers/mtd/chips/cfi_cmdset_0001.c:1872:12: error: stack frame size (1064) exceeds limit (1024) in function 'cfi_intelext_writev' [-Werror,-Wframe-larger-than]
arm32-allmodconfig.log: drivers/ntb/hw/idt/ntb_hw_idt.c:1041:27: error: stack frame size (1032) exceeds limit (1024) in function 'idt_scan_mws' [-Werror,-Wframe-larger-than]
arm32-allmodconfig.log: drivers/staging/fbtft/fbtft-core.c:902:12: error: stack frame size (1072) exceeds limit (1024) in function 'fbtft_init_display_from_property' [-Werror,-Wframe-larger-than]
arm32-allmodconfig.log: drivers/staging/fbtft/fbtft-core.c:992:5: error: stack frame size (1064) exceeds limit (1024) in function 'fbtft_init_display' [-Werror,-Wframe-larger-than]
arm32-allmodconfig.log: drivers/staging/rtl8723bs/core/rtw_security.c:1288:5: error: stack frame size (1040) exceeds limit (1024) in function 'rtw_aes_decrypt' [-Werror,-Wframe-larger-than]
arm32-fedora.log: drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:3043:6: error: stack frame size (1376) exceeds limit (1024) in function 'bw_calcs' [-Werror,-Wframe-larger-than]
arm32-fedora.log: drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:77:13: error: stack frame size (5384) exceeds limit (1024) in function 'calculate_bandwidth' [-Werror,-Wframe-larger-than]

Aside from the dce_calcs.c warnings, these do not seem too bad. I
believe allmodconfig turns on UBSAN but it could also be aggressive
inlining by clang. I intend to look at all -Wframe-large-than warnings
closely later.



arm64-alpine.log:drivers/scsi/lpfc/lpfc_init.c:11608:48: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
arm64-alpine.log:drivers/scsi/lpfc/lpfc_init.c:8280:29: error: no member named 'c_stat' in 'struct lpfc_sli4_hba'
arm64-alpine.log:drivers/scsi/lpfc/lpfc_init.c:9092:48: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
arm64-alpine.log:drivers/scsi/lpfc/lpfc_nvme.c:1592:3: error: use of undeclared identifier 'start'
arm64-alpine.log:drivers/scsi/lpfc/lpfc_nvme.c:1639:28: error: use of undeclared identifier 'start'; did you mean 'cstat'?
arm64-alpine.log:drivers/scsi/lpfc/lpfc_scsi.c:5587:2: error: use of undeclared identifier 'start'
arm64-alpine.log:drivers/scsi/lpfc/lpfc_scsi.c:5670:27: error: use of undeclared identifier 'start'
x86_64-alpine.log:drivers/scsi/lpfc/lpfc_init.c:11608:48: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
x86_64-alpine.log:drivers/scsi/lpfc/lpfc_init.c:8280:29: error: no member named 'c_stat' in 'struct lpfc_sli4_hba'
x86_64-alpine.log:drivers/scsi/lpfc/lpfc_init.c:9092:48: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
x86_64-alpine.log:drivers/scsi/lpfc/lpfc_nvme.c:1592:3: error: use of undeclared identifier 'start'
x86_64-alpine.log:drivers/scsi/lpfc/lpfc_nvme.c:1639:28: error: use of undeclared identifier 'start'
x86_64-alpine.log:drivers/scsi/lpfc/lpfc_scsi.c:5587:2: error: use of undeclared identifier 'start'
x86_64-alpine.log:drivers/scsi/lpfc/lpfc_scsi.c:5670:27: error: use of undeclared identifier 'start'; did you mean 'stac'?

The -Wshift-count-overflow warnings only show because there are other
errors in this file. This appears to be because some variables or
members of a structure are defined when the lpfc debug config is
disabled. I'll send patches for these later.



arm64-archlinux.log: arch/arm64/crypto/aes-neonbs-glue.c:270:12: error: stack frame size (1056) exceeds limit (1024) in function 'aesbs_xts_setkey' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/char/ipmi/ipmi_msghandler.c:4850:13: error: stack frame size (1072) exceeds limit (1024) in function 'ipmi_panic_request_and_wait' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/crypto/ccp/ccp-ops.c:629:1: error: stack frame size (1072) exceeds limit (1024) in function 'ccp_run_aes_gcm_cmd' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/firmware/tegra/bpmp-debugfs.c:294:12: error: stack frame size (1296) exceeds limit (1024) in function 'bpmp_debug_show' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/firmware/tegra/bpmp-debugfs.c:357:16: error: stack frame size (1328) exceeds limit (1024) in function 'bpmp_debug_store' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/gpu/drm/radeon/radeon_cs.c:661:5: error: stack frame size (1184) exceeds limit (1024) in function 'radeon_cs_ioctl' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1779:5: error: stack frame size (1152) exceeds limit (1024) in function 'arm_smmu_atc_inv_domain' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1851:13: error: stack frame size (1136) exceeds limit (1024) in function '__arm_smmu_tlb_inv_range' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:2295:13: error: stack frame size (1136) exceeds limit (1024) in function 'arm_smmu_disable_ats' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:952:13: error: stack frame size (1152) exceeds limit (1024) in function 'arm_smmu_sync_cd' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/net/wireguard/allowedips.c:255:6: error: stack frame size (1120) exceeds limit (1024) in function 'wg_allowedips_free' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/net/wireguard/allowedips.c:53:13: error: stack frame size (1088) exceeds limit (1024) in function 'root_free_rcu' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/staging/fbtft/fb_hx8353d.c:20:12: error: stack frame size (1040) exceeds limit (1024) in function 'init_display' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/staging/fbtft/fb_ssd1331.c:131:12: error: stack frame size (1360) exceeds limit (1024) in function 'set_gamma' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/staging/fbtft/fb_ssd1351.c:120:12: error: stack frame size (1360) exceeds limit (1024) in function 'set_gamma' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/staging/fbtft/fbtft-core.c:902:12: error: stack frame size (1040) exceeds limit (1024) in function 'fbtft_init_display_from_property' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/vhost/scsi.c:1543:1: error: stack frame size (1152) exceeds limit (1024) in function 'vhost_scsi_set_endpoint' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/vhost/scsi.c:1670:1: error: stack frame size (1136) exceeds limit (1024) in function 'vhost_scsi_clear_endpoint' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: drivers/vhost/scsi.c:1831:12: error: stack frame size (1376) exceeds limit (1024) in function 'vhost_scsi_release' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: fs/binfmt_elf.c:766:12: error: stack frame size (1072) exceeds limit (1024) in function 'parse_elf_properties' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: fs/binfmt_elf.c:766:12: error: stack frame size (1088) exceeds limit (1024) in function 'parse_elf_properties' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: fs/select.c:970:12: error: stack frame size (1040) exceeds limit (1024) in function 'do_sys_poll' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: net/core/rtnetlink.c:3251:12: error: stack frame size (1088) exceeds limit (1024) in function '__rtnl_newlink' [-Werror,-Wframe-larger-than]
arm64-archlinux.log: net/sunrpc/auth_gss/gss_krb5_crypto.c:599:1: error: stack frame size (1152) exceeds limit (1024) in function 'gss_krb5_aes_encrypt' [-Werror,-Wframe-larger-than]
arm64-fedora.log: arch/arm64/crypto/aes-neonbs-glue.c:270:12: error: stack frame size (1040) exceeds limit (1024) in function 'aesbs_xts_setkey' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/block/drbd/drbd_main.c:2507:5: error: stack frame size (1088) exceeds limit (1024) in function 'set_resource_options' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/char/ipmi/ipmi_msghandler.c:4850:13: error: stack frame size (1072) exceeds limit (1024) in function 'ipmi_panic_request_and_wait' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/clk/zynqmp/clkc.c:768:12: error: stack frame size (1040) exceeds limit (1024) in function 'zynqmp_clock_probe' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/crypto/ccp/ccp-ops.c:629:1: error: stack frame size (1056) exceeds limit (1024) in function 'ccp_run_aes_gcm_cmd' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/firmware/tegra/bpmp-debugfs.c:294:12: error: stack frame size (1296) exceeds limit (1024) in function 'bpmp_debug_show' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/firmware/tegra/bpmp-debugfs.c:357:16: error: stack frame size (1328) exceeds limit (1024) in function 'bpmp_debug_store' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1779:5: error: stack frame size (1152) exceeds limit (1024) in function 'arm_smmu_atc_inv_domain' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1851:13: error: stack frame size (1136) exceeds limit (1024) in function '__arm_smmu_tlb_inv_range' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:2295:13: error: stack frame size (1136) exceeds limit (1024) in function 'arm_smmu_disable_ats' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:952:13: error: stack frame size (1152) exceeds limit (1024) in function 'arm_smmu_sync_cd' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:3308:12: error: stack frame size (8400) exceeds limit (1024) in function 'dpaa_eth_probe' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c:534:12: error: stack frame size (4208) exceeds limit (1024) in function 'dpaa_set_coalesce' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/net/wireguard/allowedips.c:255:6: error: stack frame size (1120) exceeds limit (1024) in function 'wg_allowedips_free' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/net/wireguard/allowedips.c:53:13: error: stack frame size (1088) exceeds limit (1024) in function 'root_free_rcu' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/net/wireless/ath/ath11k/mac.c:2539:12: error: stack frame size (1040) exceeds limit (1024) in function 'ath11k_mac_op_hw_scan' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/vhost/scsi.c:1543:1: error: stack frame size (1152) exceeds limit (1024) in function 'vhost_scsi_set_endpoint' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/vhost/scsi.c:1670:1: error: stack frame size (1136) exceeds limit (1024) in function 'vhost_scsi_clear_endpoint' [-Werror,-Wframe-larger-than]
arm64-fedora.log: drivers/vhost/scsi.c:1831:12: error: stack frame size (1360) exceeds limit (1024) in function 'vhost_scsi_release' [-Werror,-Wframe-larger-than]
arm64-fedora.log: fs/binfmt_elf.c:766:12: error: stack frame size (1072) exceeds limit (1024) in function 'parse_elf_properties' [-Werror,-Wframe-larger-than]
arm64-fedora.log: fs/jffs2/xattr.c:775:6: error: stack frame size (1168) exceeds limit (1024) in function 'jffs2_build_xattr_subsystem' [-Werror,-Wframe-larger-than]
arm64-fedora.log: fs/select.c:970:12: error: stack frame size (1040) exceeds limit (1024) in function 'do_sys_poll' [-Werror,-Wframe-larger-than]
arm64-fedora.log: include/linux/module.h:76:12: error: stack frame size (1120) exceeds limit (1024) in function 'init_module' [-Werror,-Wframe-larger-than]
arm64-fedora.log: kernel/cgroup/cpuset.c:1536:12: error: stack frame size (1600) exceeds limit (1024) in function 'update_cpumask' [-Werror,-Wframe-larger-than]
arm64-fedora.log: kernel/cgroup/cpuset.c:1985:12: error: stack frame size (1712) exceeds limit (1024) in function 'update_prstate' [-Werror,-Wframe-larger-than]
arm64-fedora.log: kernel/cgroup/cpuset.c:3200:13: error: stack frame size (1632) exceeds limit (1024) in function 'cpuset_hotplug_workfn' [-Werror,-Wframe-larger-than]
arm64-fedora.log: kernel/irq/affinity.c:338:12: error: stack frame size (1136) exceeds limit (1024) in function 'irq_build_affinity_masks' [-Werror,-Wframe-larger-than]
arm64-fedora.log: kernel/sched/core.c:7934:1: error: stack frame size (1088) exceeds limit (1024) in function '__sched_setaffinity' [-Werror,-Wframe-larger-than]
arm64-fedora.log: kernel/sched/isolation.c:80:19: error: stack frame size (1088) exceeds limit (1024) in function 'housekeeping_setup' [-Werror,-Wframe-larger-than]
arm64-fedora.log: net/core/rtnetlink.c:3251:12: error: stack frame size (1088) exceeds limit (1024) in function '__rtnl_newlink' [-Werror,-Wframe-larger-than]
arm64-fedora.log: net/sunrpc/auth_gss/gss_krb5_crypto.c:599:1: error: stack frame size (1152) exceeds limit (1024) in function 'gss_krb5_aes_encrypt' [-Werror,-Wframe-larger-than]

It appears that both Arch Linux and Fedora define CONFIG_FRAME_WARN
as 1024, below its default of 2048. I am not sure these look particurly
scary (although there are some that are rather large that need to be
looked at).



i386-debian.log: drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:452:13: error: stack frame size (1628) exceeds limit (1024) in function 'dcn_bw_calc_rq_dlg_ttu' [-Werror,-Wframe-larger-than]
i386-debian.log: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn20/display_mode_vba_20.c:1085:13: error: stack frame size (1356) exceeds limit (1024) in function 'dml20_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' [-Werror,-Wframe-larger-than]
i386-debian.log: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn20/display_mode_vba_20.c:3286:6: error: stack frame size (1484) exceeds limit (1024) in function 'dml20_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
i386-debian.log: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn20/display_mode_vba_20v2.c:1145:13: error: stack frame size (1228) exceeds limit (1024) in function 'dml20v2_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' [-Werror,-Wframe-larger-than]
i386-debian.log: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn20/display_mode_vba_20v2.c:3393:6: error: stack frame size (1372) exceeds limit (1024) in function 'dml20v2_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
i386-debian.log: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn21/display_mode_vba_21.c:1466:13: error: stack frame size (1308) exceeds limit (1024) in function 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' [-Werror,-Wframe-larger-than]
i386-debian.log: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn21/display_mode_vba_21.c:3397:6: error: stack frame size (1564) exceeds limit (1024) in function 'dml21_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
i386-debian.log: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn21/display_rq_dlg_calc_21.c:1657:6: error: stack frame size (1100) exceeds limit (1024) in function 'dml21_rq_dlg_get_dlg_reg' [-Werror,-Wframe-larger-than]
i386-debian.log: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn21/display_rq_dlg_calc_21.c:829:13: error: stack frame size (1084) exceeds limit (1024) in function 'dml_rq_dlg_get_dlg_params' [-Werror,-Wframe-larger-than]
i386-debian.log: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_rq_dlg_calc_30.c:1831:6: error: stack frame size (1108) exceeds limit (1024) in function 'dml30_rq_dlg_get_dlg_reg' [-Werror,-Wframe-larger-than]
i386-debian.log: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_rq_dlg_calc_30.c:981:13: error: stack frame size (1148) exceeds limit (1024) in function 'dml_rq_dlg_get_dlg_params' [-Werror,-Wframe-larger-than]
i386-debian.log: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_rq_dlg_calc_31.c:939:13: error: stack frame size (1372) exceeds limit (1024) in function 'dml_rq_dlg_get_dlg_params' [-Werror,-Wframe-larger-than]
i386-debian.log: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dml1_display_rq_dlg_calc.c:997:6: error: stack frame size (1212) exceeds limit (1024) in function 'dml1_rq_dlg_get_dlg_params' [-Werror,-Wframe-larger-than]

I am guessing these are all excessive due to the floating point logic
and more inlining. I have investigated some of these previously due to
prior reports:

https://github.com/ClangBuiltLinux/linux/issues/693
https://github.com/ClangBuiltLinux/linux/issues/694
https://github.com/ClangBuiltLinux/linux/issues/695



powerpc64le-debian.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:1918:13: error: stack frame size (2208) exceeds limit (2048) in function 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' [-Werror,-Wframe-larger-than]
powerpc64le-debian.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3644:6: error: stack frame size (2496) exceeds limit (2048) in function 'dml30_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
powerpc64le-debian.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_mode_vba_31.c:3956:6: error: stack frame size (2720) exceeds limit (2048) in function 'dml31_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
powerpc64le-fedora.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:1918:13: error: stack frame size (2208) exceeds limit (2048) in function 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' [-Werror,-Wframe-larger-than]
powerpc64le-fedora.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3644:6: error: stack frame size (2496) exceeds limit (2048) in function 'dml30_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
powerpc64le-fedora.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_mode_vba_31.c:3956:6: error: stack frame size (2720) exceeds limit (2048) in function 'dml31_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
powerpc64le-opensuse.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:1918:13: error: stack frame size (2208) exceeds limit (2048) in function 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' [-Werror,-Wframe-larger-than]
powerpc64le-opensuse.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3644:6: error: stack frame size (2496) exceeds limit (2048) in function 'dml30_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
powerpc64le-opensuse.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_mode_vba_31.c:3956:6: error: stack frame size (2720) exceeds limit (2048) in function 'dml31_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]


I suspect this is a backend problem because these do not really appear
in any other configurations (maybe with Altivec?)



powerpc64le-debian.log:drivers/net/ethernet/sfc/falcon/farch.c:994:10: error: shift count is negative [-Werror,-Wshift-count-negative]
powerpc64le-debian.log:drivers/net/ethernet/sfc/farch.c:985:10: error: shift count is negative [-Werror,-Wshift-count-negative]
powerpc64le-opensuse.log:drivers/net/ethernet/sfc/falcon/farch.c:994:10: error: shift count is negative [-Werror,-Wshift-count-negative]
powerpc64le-opensuse.log:drivers/net/ethernet/sfc/farch.c:985:10: error: shift count is negative [-Werror,-Wshift-count-negative]

I believe this is a false positive due to a bug with how clang models
asm goto in the control flow graph: https://bugs.llvm.org/show_bug.cgi?id=51682



riscv-allmodconfig.log:crypto/ecc.c:1276:13: error: stack frame size (3392) exceeds limit (2048) in function 'ecc_point_mult' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:crypto/ecc.c:1358:6: error: stack frame size (3168) exceeds limit (2048) in function 'ecc_point_mult_shamir' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/block/drbd/drbd_receiver.c:924:12: error: stack frame size (2080) exceeds limit (2048) in function 'conn_connect' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/block/loop.c:1818:12: error: stack frame size (2592) exceeds limit (2048) in function 'lo_ioctl' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/crypto/ccree/cc_hash.c:1882:5: error: stack frame size (2528) exceeds limit (2048) in function 'cc_init_hash_sram' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c:567:1: error: stack frame size (3520) exceeds limit (2048) in function 'gf100_ram_new_' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c:1521:1: error: stack frame size (5856) exceeds limit (2048) in function 'gk104_ram_new_' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c:940:1: error: stack frame size (2624) exceeds limit (2048) in function 'gt215_ram_new' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/gpu/drm/rockchip/cdn-dp-core.c:1126:12: error: unused function 'cdn_dp_resume' [-Werror,-Wunused-function]
riscv-allmodconfig.log:drivers/hwmon/occ/common.c:1150:5: error: stack frame size (3008) exceeds limit (2048) in function 'occ_setup' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/infiniband/hw/ocrdma/ocrdma_stats.c:686:16: error: stack frame size (20736) exceeds limit (2048) in function 'ocrdma_dbgfs_ops_read' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/media/common/cx2341x.c:1574:5: error: stack frame size (2944) exceeds limit (2048) in function 'cx2341x_handler_init' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/media/i2c/cx25840/cx25840-core.c:2294:12: error: stack frame size (2976) exceeds limit (2048) in function 'cx25840_reset' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/media/i2c/cx25840/cx25840-core.c:5651:13: error: stack frame size (2400) exceeds limit (2048) in function 'cx23888_std_setup' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/media/pci/cx23885/cx23885-dvb.c:1187:12: error: stack frame size (2688) exceeds limit (2048) in function 'dvb_register' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/media/pci/ddbridge/ddbridge-core.c:2365:6: error: stack frame size (2336) exceeds limit (2048) in function 'ddb_ports_init' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.c:799:5: error: stack frame size (2208) exceeds limit (2048) in function 'mxl111sf_i2c_xfer' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/media/usb/gspca/sn9c2028.c:802:12: error: stack frame size (3168) exceeds limit (2048) in function 'sd_start' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/mtd/chips/cfi_cmdset_0001.c:1872:12: error: stack frame size (2432) exceeds limit (2048) in function 'cfi_intelext_writev' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/net/ethernet/intel/i40e/i40e_ddp.c:264:5: error: stack frame size (2368) exceeds limit (2048) in function 'i40e_ddp_load' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/net/wan/slic_ds26522.c:203:12: error: stack frame size (15328) exceeds limit (2048) in function 'slic_ds26522_probe' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/net/wireless/ath/ath11k/qmi.c:2695:13: error: stack frame size (4384) exceeds limit (2048) in function 'ath11k_qmi_driver_event_work' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/net/wireless/atmel/atmel.c:1050:13: error: stack frame size (2656) exceeds limit (2048) in function 'rx_done_irq' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/net/wireless/atmel/atmel.c:1305:5: error: stack frame size (5152) exceeds limit (2048) in function 'atmel_open' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c:15430:13: error: stack frame size (2400) exceeds limit (2048) in function 'wlc_phy_workarounds_nphy_gainctrl' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c:17019:13: error: stack frame size (6272) exceeds limit (2048) in function 'wlc_phy_workarounds_nphy' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c:25631:1: error: stack frame size (3136) exceeds limit (2048) in function 'wlc_phy_cal_txiqlo_nphy' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c:28303:1: error: stack frame size (2464) exceeds limit (2048) in function 'wlc_phy_txpwr_index_nphy' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/net/wireless/intel/ipw2x00/ipw2100.c:5471:12: error: stack frame size (2880) exceeds limit (2048) in function 'ipw2100_configure_security' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:855:5: error: stack frame size (4672) exceeds limit (2048) in function 'iwl_mvm_ftm_start' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/phy/ti/phy-j721e-wiz.c:1133:12: error: stack frame size (2336) exceeds limit (2048) in function 'wiz_probe' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/rtc/rtc-r9701.c:89:12: error: stack frame size (2400) exceeds limit (2048) in function 'r9701_set_datetime' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/scsi/pm8001/pm80xx_hwi.c:3537:12: error: stack frame size (2368) exceeds limit (2048) in function 'mpi_hw_event' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/scsi/qla2xxx/qla_bsg.c:2787:1: error: stack frame size (3296) exceeds limit (2048) in function 'qla2x00_process_vendor_specific' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/staging/media/hantro/hantro_g2_hevc_dec.c:536:5: error: stack frame size (3616) exceeds limit (2048) in function 'hantro_g2_hevc_dec_run' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/staging/rtl8723bs/core/rtw_security.c:1288:5: error: stack frame size (6976) exceeds limit (2048) in function 'rtw_aes_decrypt' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/staging/rtl8723bs/core/rtw_security.c:865:19: error: stack frame size (5536) exceeds limit (2048) in function 'aes_cipher' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/staging/wlan-ng/cfg80211.c:436:12: error: stack frame size (3904) exceeds limit (2048) in function 'prism2_connect' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/usb/misc/sisusbvga/sisusb.c:1878:12: error: stack frame size (3680) exceeds limit (2048) in function 'sisusb_init_gfxcore' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c:117:12: error: stack frame size (14400) exceeds limit (2048) in function 'lb035q02_connect' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:fs/io_uring.c:6578:12: error: stack frame size (2112) exceeds limit (2048) in function 'io_issue_sqe' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:fs/ocfs2/dlm/dlmdomain.c:1852:12: error: stack frame size (2272) exceeds limit (2048) in function 'dlm_join_domain' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:fs/ocfs2/dlm/dlmmaster.c:701:28: error: stack frame size (2208) exceeds limit (2048) in function 'dlm_get_lock_resource' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:fs/ocfs2/dlm/dlmrecovery.c:427:12: error: stack frame size (2976) exceeds limit (2048) in function 'dlm_do_recovery' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:include/linux/module.h:76:12: error: stack frame size (2848) exceeds limit (2048) in function 'init_module' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:lib/bitfield_kunit.c:60:20: error: stack frame size (11328) exceeds limit (10240) in function 'test_bitfields_constants' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:lib/test_kasan.c:946:13: error: stack frame size (3104) exceeds limit (2048) in function 'kasan_bitops_generic' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:lib/test_scanf.c:217:20: error: stack frame size (4640) exceeds limit (2048) in function 'numbers_simple' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:net/mac80211/mesh.c:1516:6: error: stack frame size (2272) exceeds limit (2048) in function 'ieee80211_mesh_rx_queued_mgmt' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:net/qrtr/ns.c:661:13: error: stack frame size (2144) exceeds limit (2048) in function 'qrtr_ns_worker' [-Werror,-Wframe-larger-than]
riscv-allmodconfig.log:sound/usb/mixer_s1810c.c:543:5: error: stack frame size (2208) exceeds limit (2048) in function 'snd_sc1810_init_mixer' [-Werror,-Wframe-larger-than]

I suspect this is a backend problem because these do not really appear
in any other configurations (might also be something with a sanitizer?)



s390x-defconfig.log: include/asm-generic/io.h:464:31: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
s390x-defconfig.log: include/asm-generic/io.h:477:61: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
s390x-defconfig.log: include/asm-generic/io.h:490:61: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
s390x-defconfig.log: include/asm-generic/io.h:501:33: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
s390x-defconfig.log: include/asm-generic/io.h:511:59: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
s390x-defconfig.log: include/asm-generic/io.h:521:59: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
s390x-defconfig.log: include/asm-generic/io.h:609:20: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
s390x-defconfig.log: include/asm-generic/io.h:617:20: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
s390x-defconfig.log: include/asm-generic/io.h:625:20: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
s390x-defconfig.log: include/asm-generic/io.h:634:21: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
s390x-defconfig.log: include/asm-generic/io.h:643:21: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
s390x-defconfig.log: include/asm-generic/io.h:652:21: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]

This affected all s390x configs I test. fs/btrfs force enables W=1 so we
get these. This is known and had a solution rejected at pull time:

https://github.com/ClangBuiltLinux/linux/issues/1285
https://lore.kernel.org/r/20210510145234.594814-1-schnelle@linux.ibm.com/
https://lore.kernel.org/r/CAK8P3a2oZ-+qd3Nhpy9VVXCJB3DU5N-y-ta2JpP0t6NHh=GVXw@mail.gmail.com/


s390x-allmodconfig.log:drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:77:13: error: stack frame size (5184) exceeds limit (2048) in function 'calculate_bandwidth' [-Werror,-Wframe-larger-than]

Same deal as the other dc_calcs.c warnings.



x86_64-allmodconfig-O3.log:drivers/net/ethernet/microchip/sparx5/sparx5_calendar.c:566:5: error: stack frame size (2504) exceeds limit (2048) in function 'sparx5_config_dsm_calendar' [-Werror,-Wframe-larger-than]

Probably aggressive inlining due to testing -O3.

x86_64-alpine.log:drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:452:13: error: stack frame size (1800) exceeds limit (1280) in function 'dcn_bw_calc_rq_dlg_ttu' [-Werror,-Wframe-larger-than]
x86_64-alpine.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn21/display_rq_dlg_calc_21.c:1657:6: error: stack frame size (1336) exceeds limit (1280) in function 'dml21_rq_dlg_get_dlg_reg' [-Werror,-Wframe-larger-than]
x86_64-alpine.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_rq_dlg_calc_30.c:1831:6: error: stack frame size (1352) exceeds limit (1280) in function 'dml30_rq_dlg_get_dlg_reg' [-Werror,-Wframe-larger-than]
x86_64-alpine.log:drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_rq_dlg_calc_31.c:1676:6: error: stack frame size (1336) exceeds limit (1280) in function 'dml31_rq_dlg_get_dlg_reg' [-Werror,-Wframe-larger-than]
x86_64-alpine.log:drivers/vhost/scsi.c:1831:12: error: stack frame size (1320) exceeds limit (1280) in function 'vhost_scsi_release' [-Werror,-Wframe-larger-than]

Another instance where distros lower CONFIG_FRAME_WARN below the 2048
default. Again, none look particularly scary but should still probably
be dealt with.

Cheers,
Nathan

^ permalink raw reply	[relevance 1%]

* [PATCH] jffs2: Convert from atomic_t to refcount_t on jffs2_xattr_datum->refcnt
@ 2021-07-16 10:08  6% Xiyu Yang
  0 siblings, 0 replies; 28+ results
From: Xiyu Yang @ 2021-07-16 10:08 UTC (permalink / raw)
  To: David Woodhouse, Richard Weinberger, Xin Tan, Xiyu Yang,
	linux-mtd, linux-kernel
  Cc: yuanxzhang

refcount_t type and corresponding API can protect refcounters from
accidental underflow and overflow and further use-after-free situations

Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
---
 fs/jffs2/xattr.c | 14 +++++++-------
 fs/jffs2/xattr.h |  3 ++-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index da3e18503c65..f7e959817ff1 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -352,7 +352,7 @@ static struct jffs2_xattr_datum *create_xattr_datum(struct jffs2_sb_info *c,
 		    && xd->value_len==xsize
 		    && !strcmp(xd->xname, xname)
 		    && !memcmp(xd->xvalue, xvalue, xsize)) {
-			atomic_inc(&xd->refcnt);
+			refcount_inc(&xd->refcnt);
 			return xd;
 		}
 	}
@@ -372,7 +372,7 @@ static struct jffs2_xattr_datum *create_xattr_datum(struct jffs2_sb_info *c,
 	strcpy(data, xname);
 	memcpy(data + name_len + 1, xvalue, xsize);
 
-	atomic_set(&xd->refcnt, 1);
+	refcount_set(&xd->refcnt, 1);
 	xd->xid = ++c->highest_xid;
 	xd->flags |= JFFS2_XFLAGS_HOT;
 	xd->xprefix = xprefix;
@@ -404,7 +404,7 @@ static struct jffs2_xattr_datum *create_xattr_datum(struct jffs2_sb_info *c,
 static void unrefer_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd)
 {
 	/* must be called under down_write(xattr_sem) */
-	if (atomic_dec_and_lock(&xd->refcnt, &c->erase_completion_lock)) {
+	if (refcount_dec_and_lock(&xd->refcnt, &c->erase_completion_lock)) {
 		unload_xattr_datum(c, xd);
 		xd->flags |= JFFS2_XFLAGS_DEAD;
 		if (xd->node == (void *)xd) {
@@ -621,7 +621,7 @@ void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *i
 	for (ref = ic->xref; ref; ref = _ref) {
 		_ref = ref->next;
 		xd = ref->xd;
-		if (atomic_dec_and_test(&xd->refcnt)) {
+		if (refcount_dec_and_test(&xd->refcnt)) {
 			unload_xattr_datum(c, xd);
 			jffs2_free_xattr_datum(xd);
 		}
@@ -851,7 +851,7 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 			}
 			ref->xd = xd;
 			ref->ic = ic;
-			atomic_inc(&xd->refcnt);
+			refcount_inc(&xd->refcnt);
 			ref->next = ic->xref;
 			ic->xref = ref;
 		}
@@ -862,7 +862,7 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 		list_for_each_entry_safe(xd, _xd, &c->xattrindex[i], xindex) {
 			xdatum_count++;
 			list_del_init(&xd->xindex);
-			if (!atomic_read(&xd->refcnt)) {
+			if (!refcount_read(&xd->refcnt)) {
 				dbg_xattr("xdatum(xid=%u, version=%u) is orphan.\n",
 					  xd->xid, xd->version);
 				xd->flags |= JFFS2_XFLAGS_DEAD;
@@ -1322,7 +1322,7 @@ int jffs2_verify_xattr(struct jffs2_sb_info *c)
 void jffs2_release_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd)
 {
 	/* must be called under spin_lock(&c->erase_completion_lock) */
-	if (atomic_read(&xd->refcnt) || xd->node != (void *)xd)
+	if (refcount_read(&xd->refcnt) || xd->node != (void *)xd)
 		return;
 
 	list_del(&xd->xindex);
diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
index 720007b2fd65..75742f948d20 100644
--- a/fs/jffs2/xattr.h
+++ b/fs/jffs2/xattr.h
@@ -14,6 +14,7 @@
 
 #include <linux/xattr.h>
 #include <linux/list.h>
+#include <linux/refcount.h>
 
 #define JFFS2_XFLAGS_HOT	(0x01)	/* This datum is HOT */
 #define JFFS2_XFLAGS_BIND	(0x02)	/* This datum is not reclaimed */
@@ -29,7 +30,7 @@ struct jffs2_xattr_datum
 	uint16_t xprefix;		/* see JFFS2_XATTR_PREFIX_* */
 
 	struct list_head xindex;	/* chained from c->xattrindex[n] */
-	atomic_t refcnt;		/* # of xattr_ref refers this */
+	refcount_t refcnt;		/* # of xattr_ref refers this */
 	uint32_t xid;
 	uint32_t version;
 
-- 
2.7.4


^ permalink raw reply related	[relevance 6%]

* [PATCH] jffs2: implement mount option to configure endianness
@ 2018-11-06 21:49  1% Nikunj Kela
  0 siblings, 0 replies; 28+ results
From: Nikunj Kela @ 2018-11-06 21:49 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Nikunj Kela, xe-linux-external, linux-mtd, linux-kernel

This patch allows the endianness of the JFSS2 filesystem to be
specified by mount option 'force_endian=big|little|native'. If
endianness is not specified, it defaults to 'native' endianness
thus retaining the existing behavior.

Some architectures benefit from having a single known endianness
of JFFS2 filesystem (for data, not executables) independent of the
endianness of the processor (ARM processors can be switched to either
endianness at run-time).

We have boards that are shipped with BE jffs2 and BE kernel. We are
now migrating to LE kernel. This mount option helps us in mounting
BE jffs2 on LE kernel.

Cc: xe-linux-external@cisco.com
Signed-off-by: Nikunj Kela <nkela@cisco.com>
---
 fs/jffs2/acl.c         |  30 ++++---
 fs/jffs2/debug.c       |  62 ++++++-------
 fs/jffs2/dir.c         |  94 ++++++++++----------
 fs/jffs2/erase.c       |   8 +-
 fs/jffs2/file.c        |  48 +++++------
 fs/jffs2/fs.c          |  90 +++++++++----------
 fs/jffs2/gc.c          | 192 ++++++++++++++++++++---------------------
 fs/jffs2/jffs2_fs_sb.h |   1 +
 fs/jffs2/nodelist.h    | 115 +++++++++++++++---------
 fs/jffs2/nodemgmt.c    |  10 +--
 fs/jffs2/read.c        |  48 +++++------
 fs/jffs2/readinode.c   | 118 ++++++++++++-------------
 fs/jffs2/scan.c        | 190 ++++++++++++++++++++--------------------
 fs/jffs2/summary.c     | 183 ++++++++++++++++++++-------------------
 fs/jffs2/summary.h     |  20 +++--
 fs/jffs2/super.c       |  30 +++++++
 fs/jffs2/wbuf.c        |  36 ++++----
 fs/jffs2/write.c       | 164 +++++++++++++++++------------------
 fs/jffs2/xattr.c       |  90 +++++++++----------
 19 files changed, 804 insertions(+), 725 deletions(-)

diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 093ffbd82395..e27a5b029215 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -52,7 +52,8 @@ static int jffs2_acl_count(size_t size)
 	}
 }
 
-static struct posix_acl *jffs2_acl_from_medium(void *value, size_t size)
+static struct posix_acl *jffs2_acl_from_medium(struct jffs2_sb_info *c,
+						void *value, size_t size)
 {
 	void *end = value + size;
 	struct jffs2_acl_header *header = value;
@@ -65,7 +66,7 @@ static struct posix_acl *jffs2_acl_from_medium(void *value, size_t size)
 		return NULL;
 	if (size < sizeof(struct jffs2_acl_header))
 		return ERR_PTR(-EINVAL);
-	ver = je32_to_cpu(header->a_version);
+	ver = je32_to_cpu(c, header->a_version);
 	if (ver != JFFS2_ACL_VERSION) {
 		JFFS2_WARNING("Invalid ACL version. (=%u)\n", ver);
 		return ERR_PTR(-EINVAL);
@@ -86,8 +87,8 @@ static struct posix_acl *jffs2_acl_from_medium(void *value, size_t size)
 		entry = value;
 		if (value + sizeof(struct jffs2_acl_entry_short) > end)
 			goto fail;
-		acl->a_entries[i].e_tag = je16_to_cpu(entry->e_tag);
-		acl->a_entries[i].e_perm = je16_to_cpu(entry->e_perm);
+		acl->a_entries[i].e_tag = je16_to_cpu(c, entry->e_tag);
+		acl->a_entries[i].e_perm = je16_to_cpu(c, entry->e_perm);
 		switch (acl->a_entries[i].e_tag) {
 			case ACL_USER_OBJ:
 			case ACL_GROUP_OBJ:
@@ -102,7 +103,7 @@ static struct posix_acl *jffs2_acl_from_medium(void *value, size_t size)
 					goto fail;
 				acl->a_entries[i].e_uid =
 					make_kuid(&init_user_ns,
-						  je32_to_cpu(entry->e_id));
+						  je32_to_cpu(c, entry->e_id));
 				break;
 			case ACL_GROUP:
 				value += sizeof(struct jffs2_acl_entry);
@@ -110,7 +111,7 @@ static struct posix_acl *jffs2_acl_from_medium(void *value, size_t size)
 					goto fail;
 				acl->a_entries[i].e_gid =
 					make_kgid(&init_user_ns,
-						  je32_to_cpu(entry->e_id));
+						  je32_to_cpu(c, entry->e_id));
 				break;
 
 			default:
@@ -125,7 +126,8 @@ static struct posix_acl *jffs2_acl_from_medium(void *value, size_t size)
 	return ERR_PTR(-EINVAL);
 }
 
-static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size)
+static void *jffs2_acl_to_medium(struct jffs2_sb_info *c,
+				const struct posix_acl *acl, size_t *size)
 {
 	struct jffs2_acl_header *header;
 	struct jffs2_acl_entry *entry;
@@ -137,21 +139,21 @@ static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size)
 			GFP_KERNEL);
 	if (!header)
 		return ERR_PTR(-ENOMEM);
-	header->a_version = cpu_to_je32(JFFS2_ACL_VERSION);
+	header->a_version = cpu_to_je32(c, JFFS2_ACL_VERSION);
 	e = header + 1;
 	for (i=0; i < acl->a_count; i++) {
 		const struct posix_acl_entry *acl_e = &acl->a_entries[i];
 		entry = e;
-		entry->e_tag = cpu_to_je16(acl_e->e_tag);
-		entry->e_perm = cpu_to_je16(acl_e->e_perm);
+		entry->e_tag = cpu_to_je16(c, acl_e->e_tag);
+		entry->e_perm = cpu_to_je16(c, acl_e->e_perm);
 		switch(acl_e->e_tag) {
 			case ACL_USER:
-				entry->e_id = cpu_to_je32(
+				entry->e_id = cpu_to_je32(c,
 					from_kuid(&init_user_ns, acl_e->e_uid));
 				e += sizeof(struct jffs2_acl_entry);
 				break;
 			case ACL_GROUP:
-				entry->e_id = cpu_to_je32(
+				entry->e_id = cpu_to_je32(c,
 					from_kgid(&init_user_ns, acl_e->e_gid));
 				e += sizeof(struct jffs2_acl_entry);
 				break;
@@ -197,7 +199,7 @@ struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
 		rc = do_jffs2_getxattr(inode, xprefix, "", value, rc);
 	}
 	if (rc > 0) {
-		acl = jffs2_acl_from_medium(value, rc);
+		acl = jffs2_acl_from_medium(JFFS2_SB_INFO(inode->i_sb), value, rc);
 	} else if (rc == -ENODATA || rc == -ENOSYS) {
 		acl = NULL;
 	} else {
@@ -214,7 +216,7 @@ static int __jffs2_set_acl(struct inode *inode, int xprefix, struct posix_acl *a
 	int rc;
 
 	if (acl) {
-		value = jffs2_acl_to_medium(acl, &size);
+		value = jffs2_acl_to_medium(JFFS2_SB_INFO(inode->i_sb), acl, &size);
 		if (IS_ERR(value))
 			return PTR_ERR(value);
 	}
diff --git a/fs/jffs2/debug.c b/fs/jffs2/debug.c
index 9d26b1b9fc01..22a115518354 100644
--- a/fs/jffs2/debug.c
+++ b/fs/jffs2/debug.c
@@ -787,50 +787,50 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
 		return;
 	}
 
-	printk(JFFS2_DBG "magic:\t%#04x\n", je16_to_cpu(node.u.magic));
-	printk(JFFS2_DBG "nodetype:\t%#04x\n", je16_to_cpu(node.u.nodetype));
-	printk(JFFS2_DBG "totlen:\t%#08x\n", je32_to_cpu(node.u.totlen));
-	printk(JFFS2_DBG "hdr_crc:\t%#08x\n", je32_to_cpu(node.u.hdr_crc));
+	printk(JFFS2_DBG "magic:\t%#04x\n", je16_to_cpu(c, node.u.magic));
+	printk(JFFS2_DBG "nodetype:\t%#04x\n", je16_to_cpu(c, node.u.nodetype));
+	printk(JFFS2_DBG "totlen:\t%#08x\n", je32_to_cpu(c, node.u.totlen));
+	printk(JFFS2_DBG "hdr_crc:\t%#08x\n", je32_to_cpu(c, node.u.hdr_crc));
 
 	crc = crc32(0, &node.u, sizeof(node.u) - 4);
-	if (crc != je32_to_cpu(node.u.hdr_crc)) {
+	if (crc != je32_to_cpu(c, node.u.hdr_crc)) {
 		JFFS2_ERROR("wrong common header CRC.\n");
 		return;
 	}
 
-	if (je16_to_cpu(node.u.magic) != JFFS2_MAGIC_BITMASK &&
-		je16_to_cpu(node.u.magic) != JFFS2_OLD_MAGIC_BITMASK)
+	if (je16_to_cpu(c, node.u.magic) != JFFS2_MAGIC_BITMASK &&
+		je16_to_cpu(c, node.u.magic) != JFFS2_OLD_MAGIC_BITMASK)
 	{
 		JFFS2_ERROR("wrong node magic: %#04x instead of %#04x.\n",
-			je16_to_cpu(node.u.magic), JFFS2_MAGIC_BITMASK);
+			je16_to_cpu(c, node.u.magic), JFFS2_MAGIC_BITMASK);
 		return;
 	}
 
-	switch(je16_to_cpu(node.u.nodetype)) {
+	switch(je16_to_cpu(c, node.u.nodetype)) {
 
 	case JFFS2_NODETYPE_INODE:
 
 		printk(JFFS2_DBG "the node is inode node\n");
-		printk(JFFS2_DBG "ino:\t%#08x\n", je32_to_cpu(node.i.ino));
-		printk(JFFS2_DBG "version:\t%#08x\n", je32_to_cpu(node.i.version));
+		printk(JFFS2_DBG "ino:\t%#08x\n", je32_to_cpu(c, node.i.ino));
+		printk(JFFS2_DBG "version:\t%#08x\n", je32_to_cpu(c, node.i.version));
 		printk(JFFS2_DBG "mode:\t%#08x\n", node.i.mode.m);
-		printk(JFFS2_DBG "uid:\t%#04x\n", je16_to_cpu(node.i.uid));
-		printk(JFFS2_DBG "gid:\t%#04x\n", je16_to_cpu(node.i.gid));
-		printk(JFFS2_DBG "isize:\t%#08x\n", je32_to_cpu(node.i.isize));
-		printk(JFFS2_DBG "atime:\t%#08x\n", je32_to_cpu(node.i.atime));
-		printk(JFFS2_DBG "mtime:\t%#08x\n", je32_to_cpu(node.i.mtime));
-		printk(JFFS2_DBG "ctime:\t%#08x\n", je32_to_cpu(node.i.ctime));
-		printk(JFFS2_DBG "offset:\t%#08x\n", je32_to_cpu(node.i.offset));
-		printk(JFFS2_DBG "csize:\t%#08x\n", je32_to_cpu(node.i.csize));
-		printk(JFFS2_DBG "dsize:\t%#08x\n", je32_to_cpu(node.i.dsize));
+		printk(JFFS2_DBG "uid:\t%#04x\n", je16_to_cpu(c, node.i.uid));
+		printk(JFFS2_DBG "gid:\t%#04x\n", je16_to_cpu(c, node.i.gid));
+		printk(JFFS2_DBG "isize:\t%#08x\n", je32_to_cpu(c, node.i.isize));
+		printk(JFFS2_DBG "atime:\t%#08x\n", je32_to_cpu(c, node.i.atime));
+		printk(JFFS2_DBG "mtime:\t%#08x\n", je32_to_cpu(c, node.i.mtime));
+		printk(JFFS2_DBG "ctime:\t%#08x\n", je32_to_cpu(c, node.i.ctime));
+		printk(JFFS2_DBG "offset:\t%#08x\n", je32_to_cpu(c, node.i.offset));
+		printk(JFFS2_DBG "csize:\t%#08x\n", je32_to_cpu(c, node.i.csize));
+		printk(JFFS2_DBG "dsize:\t%#08x\n", je32_to_cpu(c, node.i.dsize));
 		printk(JFFS2_DBG "compr:\t%#02x\n", node.i.compr);
 		printk(JFFS2_DBG "usercompr:\t%#02x\n", node.i.usercompr);
-		printk(JFFS2_DBG "flags:\t%#04x\n", je16_to_cpu(node.i.flags));
-		printk(JFFS2_DBG "data_crc:\t%#08x\n", je32_to_cpu(node.i.data_crc));
-		printk(JFFS2_DBG "node_crc:\t%#08x\n", je32_to_cpu(node.i.node_crc));
+		printk(JFFS2_DBG "flags:\t%#04x\n", je16_to_cpu(c, node.i.flags));
+		printk(JFFS2_DBG "data_crc:\t%#08x\n", je32_to_cpu(c, node.i.data_crc));
+		printk(JFFS2_DBG "node_crc:\t%#08x\n", je32_to_cpu(c, node.i.node_crc));
 
 		crc = crc32(0, &node.i, sizeof(node.i) - 8);
-		if (crc != je32_to_cpu(node.i.node_crc)) {
+		if (crc != je32_to_cpu(c, node.i.node_crc)) {
 			JFFS2_ERROR("wrong node header CRC.\n");
 			return;
 		}
@@ -839,20 +839,20 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
 	case JFFS2_NODETYPE_DIRENT:
 
 		printk(JFFS2_DBG "the node is dirent node\n");
-		printk(JFFS2_DBG "pino:\t%#08x\n", je32_to_cpu(node.d.pino));
-		printk(JFFS2_DBG "version:\t%#08x\n", je32_to_cpu(node.d.version));
-		printk(JFFS2_DBG "ino:\t%#08x\n", je32_to_cpu(node.d.ino));
-		printk(JFFS2_DBG "mctime:\t%#08x\n", je32_to_cpu(node.d.mctime));
+		printk(JFFS2_DBG "pino:\t%#08x\n", je32_to_cpu(c, node.d.pino));
+		printk(JFFS2_DBG "version:\t%#08x\n", je32_to_cpu(c, node.d.version));
+		printk(JFFS2_DBG "ino:\t%#08x\n", je32_to_cpu(c, node.d.ino));
+		printk(JFFS2_DBG "mctime:\t%#08x\n", je32_to_cpu(c, node.d.mctime));
 		printk(JFFS2_DBG "nsize:\t%#02x\n", node.d.nsize);
 		printk(JFFS2_DBG "type:\t%#02x\n", node.d.type);
-		printk(JFFS2_DBG "node_crc:\t%#08x\n", je32_to_cpu(node.d.node_crc));
-		printk(JFFS2_DBG "name_crc:\t%#08x\n", je32_to_cpu(node.d.name_crc));
+		printk(JFFS2_DBG "node_crc:\t%#08x\n", je32_to_cpu(c, node.d.node_crc));
+		printk(JFFS2_DBG "name_crc:\t%#08x\n", je32_to_cpu(c, node.d.name_crc));
 
 		node.d.name[node.d.nsize] = '\0';
 		printk(JFFS2_DBG "name:\t\"%s\"\n", node.d.name);
 
 		crc = crc32(0, &node.d, sizeof(node.d) - 8);
-		if (crc != je32_to_cpu(node.d.node_crc)) {
+		if (crc != je32_to_cpu(c, node.d.node_crc)) {
 			JFFS2_ERROR("wrong node header CRC.\n");
 			return;
 		}
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index f20cff1194bb..3ae79533606c 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -201,7 +201,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry,
 	if (ret)
 		goto fail;
 
-	dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(ri->ctime));
+	dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(c, ri->ctime));
 
 	jffs2_free_raw_inode(ri);
 
@@ -326,13 +326,13 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
 	f = JFFS2_INODE_INFO(inode);
 
 	inode->i_size = targetlen;
-	ri->isize = ri->dsize = ri->csize = cpu_to_je32(inode->i_size);
-	ri->totlen = cpu_to_je32(sizeof(*ri) + inode->i_size);
-	ri->hdr_crc = cpu_to_je32(crc32(0, ri, sizeof(struct jffs2_unknown_node)-4));
+	ri->isize = ri->dsize = ri->csize = cpu_to_je32(c, inode->i_size);
+	ri->totlen = cpu_to_je32(c, sizeof(*ri) + inode->i_size);
+	ri->hdr_crc = cpu_to_je32(c, crc32(0, ri, sizeof(struct jffs2_unknown_node)-4));
 
 	ri->compr = JFFS2_COMPR_NONE;
-	ri->data_crc = cpu_to_je32(crc32(0, target, targetlen));
-	ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
+	ri->data_crc = cpu_to_je32(c, crc32(0, target, targetlen));
+	ri->node_crc = cpu_to_je32(c, crc32(0, ri, sizeof(*ri)-8));
 
 	fn = jffs2_write_dnode(c, f, ri, target, targetlen, ALLOC_NORMAL);
 
@@ -392,19 +392,19 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
 	dir_f = JFFS2_INODE_INFO(dir_i);
 	mutex_lock(&dir_f->sem);
 
-	rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-	rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT);
-	rd->totlen = cpu_to_je32(sizeof(*rd) + namelen);
-	rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4));
+	rd->magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+	rd->nodetype = cpu_to_je16(c, JFFS2_NODETYPE_DIRENT);
+	rd->totlen = cpu_to_je32(c, sizeof(*rd) + namelen);
+	rd->hdr_crc = cpu_to_je32(c, crc32(0, rd, sizeof(struct jffs2_unknown_node)-4));
 
-	rd->pino = cpu_to_je32(dir_i->i_ino);
-	rd->version = cpu_to_je32(++dir_f->highest_version);
-	rd->ino = cpu_to_je32(inode->i_ino);
-	rd->mctime = cpu_to_je32(JFFS2_NOW());
+	rd->pino = cpu_to_je32(c, dir_i->i_ino);
+	rd->version = cpu_to_je32(c, ++dir_f->highest_version);
+	rd->ino = cpu_to_je32(c, inode->i_ino);
+	rd->mctime = cpu_to_je32(c, JFFS2_NOW());
 	rd->nsize = namelen;
 	rd->type = DT_LNK;
-	rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
-	rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen));
+	rd->node_crc = cpu_to_je32(c, crc32(0, rd, sizeof(*rd)-8));
+	rd->name_crc = cpu_to_je32(c, crc32(0, dentry->d_name.name, namelen));
 
 	fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, ALLOC_NORMAL);
 
@@ -418,7 +418,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
 		goto fail;
 	}
 
-	dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime));
+	dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(c, rd->mctime));
 
 	jffs2_free_raw_dirent(rd);
 
@@ -489,8 +489,8 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode
 	/* but ic->pino_nlink is the parent ino# */
 	f->inocache->pino_nlink = dir_i->i_ino;
 
-	ri->data_crc = cpu_to_je32(0);
-	ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
+	ri->data_crc = cpu_to_je32(c, 0);
+	ri->node_crc = cpu_to_je32(c, crc32(0, ri, sizeof(*ri)-8));
 
 	fn = jffs2_write_dnode(c, f, ri, NULL, 0, ALLOC_NORMAL);
 
@@ -535,19 +535,19 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode
 	dir_f = JFFS2_INODE_INFO(dir_i);
 	mutex_lock(&dir_f->sem);
 
-	rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-	rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT);
-	rd->totlen = cpu_to_je32(sizeof(*rd) + namelen);
-	rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4));
+	rd->magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+	rd->nodetype = cpu_to_je16(c, JFFS2_NODETYPE_DIRENT);
+	rd->totlen = cpu_to_je32(c, sizeof(*rd) + namelen);
+	rd->hdr_crc = cpu_to_je32(c, crc32(0, rd, sizeof(struct jffs2_unknown_node)-4));
 
-	rd->pino = cpu_to_je32(dir_i->i_ino);
-	rd->version = cpu_to_je32(++dir_f->highest_version);
-	rd->ino = cpu_to_je32(inode->i_ino);
-	rd->mctime = cpu_to_je32(JFFS2_NOW());
+	rd->pino = cpu_to_je32(c, dir_i->i_ino);
+	rd->version = cpu_to_je32(c, ++dir_f->highest_version);
+	rd->ino = cpu_to_je32(c, inode->i_ino);
+	rd->mctime = cpu_to_je32(c, JFFS2_NOW());
 	rd->nsize = namelen;
 	rd->type = DT_DIR;
-	rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
-	rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen));
+	rd->node_crc = cpu_to_je32(c, crc32(0, rd, sizeof(*rd)-8));
+	rd->name_crc = cpu_to_je32(c, crc32(0, dentry->d_name.name, namelen));
 
 	fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, ALLOC_NORMAL);
 
@@ -561,7 +561,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode
 		goto fail;
 	}
 
-	dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime));
+	dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(c, rd->mctime));
 	inc_nlink(dir_i);
 
 	jffs2_free_raw_dirent(rd);
@@ -627,7 +627,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode
 	c = JFFS2_SB_INFO(dir_i->i_sb);
 
 	if (S_ISBLK(mode) || S_ISCHR(mode))
-		devlen = jffs2_encode_dev(&dev, rdev);
+		devlen = jffs2_encode_dev(c, &dev, rdev);
 
 	/* Try to reserve enough space for both node and dirent.
 	 * Just the node will do for now, though
@@ -653,13 +653,13 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode
 
 	f = JFFS2_INODE_INFO(inode);
 
-	ri->dsize = ri->csize = cpu_to_je32(devlen);
-	ri->totlen = cpu_to_je32(sizeof(*ri) + devlen);
-	ri->hdr_crc = cpu_to_je32(crc32(0, ri, sizeof(struct jffs2_unknown_node)-4));
+	ri->dsize = ri->csize = cpu_to_je32(c, devlen);
+	ri->totlen = cpu_to_je32(c, sizeof(*ri) + devlen);
+	ri->hdr_crc = cpu_to_je32(c, crc32(0, ri, sizeof(struct jffs2_unknown_node)-4));
 
 	ri->compr = JFFS2_COMPR_NONE;
-	ri->data_crc = cpu_to_je32(crc32(0, &dev, devlen));
-	ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
+	ri->data_crc = cpu_to_je32(c, crc32(0, &dev, devlen));
+	ri->node_crc = cpu_to_je32(c, crc32(0, ri, sizeof(*ri)-8));
 
 	fn = jffs2_write_dnode(c, f, ri, (char *)&dev, devlen, ALLOC_NORMAL);
 
@@ -704,22 +704,22 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode
 	dir_f = JFFS2_INODE_INFO(dir_i);
 	mutex_lock(&dir_f->sem);
 
-	rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-	rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT);
-	rd->totlen = cpu_to_je32(sizeof(*rd) + namelen);
-	rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4));
+	rd->magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+	rd->nodetype = cpu_to_je16(c, JFFS2_NODETYPE_DIRENT);
+	rd->totlen = cpu_to_je32(c, sizeof(*rd) + namelen);
+	rd->hdr_crc = cpu_to_je32(c, crc32(0, rd, sizeof(struct jffs2_unknown_node)-4));
 
-	rd->pino = cpu_to_je32(dir_i->i_ino);
-	rd->version = cpu_to_je32(++dir_f->highest_version);
-	rd->ino = cpu_to_je32(inode->i_ino);
-	rd->mctime = cpu_to_je32(JFFS2_NOW());
+	rd->pino = cpu_to_je32(c, dir_i->i_ino);
+	rd->version = cpu_to_je32(c, ++dir_f->highest_version);
+	rd->ino = cpu_to_je32(c, inode->i_ino);
+	rd->mctime = cpu_to_je32(c, JFFS2_NOW());
 	rd->nsize = namelen;
 
 	/* XXX: This is ugly. */
 	rd->type = (mode & S_IFMT) >> 12;
 
-	rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
-	rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen));
+	rd->node_crc = cpu_to_je32(c, crc32(0, rd, sizeof(*rd)-8));
+	rd->name_crc = cpu_to_je32(c, crc32(0, dentry->d_name.name, namelen));
 
 	fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, ALLOC_NORMAL);
 
@@ -733,7 +733,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode
 		goto fail;
 	}
 
-	dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime));
+	dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(c, rd->mctime));
 
 	jffs2_free_raw_dirent(rd);
 
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index 83b8f06b4a64..3b993221ab4f 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -423,14 +423,14 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
 
 		struct kvec vecs[1];
 		struct jffs2_unknown_node marker = {
-			.magic =	cpu_to_je16(JFFS2_MAGIC_BITMASK),
-			.nodetype =	cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER),
-			.totlen =	cpu_to_je32(c->cleanmarker_size)
+			.magic =	cpu_to_je16(c, JFFS2_MAGIC_BITMASK),
+			.nodetype =	cpu_to_je16(c, JFFS2_NODETYPE_CLEANMARKER),
+			.totlen =	cpu_to_je32(c, c->cleanmarker_size)
 		};
 
 		jffs2_prealloc_raw_node_refs(c, jeb, 1);
 
-		marker.hdr_crc = cpu_to_je32(crc32(0, &marker, sizeof(struct jffs2_unknown_node)-4));
+		marker.hdr_crc = cpu_to_je32(c, crc32(0, &marker, sizeof(struct jffs2_unknown_node)-4));
 
 		vecs[0].iov_base = (unsigned char *) &marker;
 		vecs[0].iov_len = sizeof(marker);
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index 7d8654a1472e..1258f92f3b38 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -164,24 +164,24 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
 		mutex_lock(&f->sem);
 		memset(&ri, 0, sizeof(ri));
 
-		ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-		ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
-		ri.totlen = cpu_to_je32(sizeof(ri));
-		ri.hdr_crc = cpu_to_je32(crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4));
-
-		ri.ino = cpu_to_je32(f->inocache->ino);
-		ri.version = cpu_to_je32(++f->highest_version);
-		ri.mode = cpu_to_jemode(inode->i_mode);
-		ri.uid = cpu_to_je16(i_uid_read(inode));
-		ri.gid = cpu_to_je16(i_gid_read(inode));
-		ri.isize = cpu_to_je32(max((uint32_t)inode->i_size, pageofs));
-		ri.atime = ri.ctime = ri.mtime = cpu_to_je32(JFFS2_NOW());
-		ri.offset = cpu_to_je32(inode->i_size);
-		ri.dsize = cpu_to_je32(pageofs - inode->i_size);
-		ri.csize = cpu_to_je32(0);
+		ri.magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+		ri.nodetype = cpu_to_je16(c, JFFS2_NODETYPE_INODE);
+		ri.totlen = cpu_to_je32(c, sizeof(ri));
+		ri.hdr_crc = cpu_to_je32(c, crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4));
+
+		ri.ino = cpu_to_je32(c, f->inocache->ino);
+		ri.version = cpu_to_je32(c, ++f->highest_version);
+		ri.mode = cpu_to_jemode(c, inode->i_mode);
+		ri.uid = cpu_to_je16(c, i_uid_read(inode));
+		ri.gid = cpu_to_je16(c, i_gid_read(inode));
+		ri.isize = cpu_to_je32(c, max((uint32_t)inode->i_size, pageofs));
+		ri.atime = ri.ctime = ri.mtime = cpu_to_je32(c, JFFS2_NOW());
+		ri.offset = cpu_to_je32(c, inode->i_size);
+		ri.dsize = cpu_to_je32(c, pageofs - inode->i_size);
+		ri.csize = cpu_to_je32(c, 0);
 		ri.compr = JFFS2_COMPR_ZERO;
-		ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
-		ri.data_crc = cpu_to_je32(0);
+		ri.node_crc = cpu_to_je32(c, crc32(0, &ri, sizeof(ri)-8));
+		ri.data_crc = cpu_to_je32(c, 0);
 
 		fn = jffs2_write_dnode(c, f, &ri, NULL, 0, ALLOC_NORMAL);
 
@@ -278,12 +278,12 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping,
 	}
 
 	/* Set the fields that the generic jffs2_write_inode_range() code can't find */
-	ri->ino = cpu_to_je32(inode->i_ino);
-	ri->mode = cpu_to_jemode(inode->i_mode);
-	ri->uid = cpu_to_je16(i_uid_read(inode));
-	ri->gid = cpu_to_je16(i_gid_read(inode));
-	ri->isize = cpu_to_je32((uint32_t)inode->i_size);
-	ri->atime = ri->ctime = ri->mtime = cpu_to_je32(JFFS2_NOW());
+	ri->ino = cpu_to_je32(c, inode->i_ino);
+	ri->mode = cpu_to_jemode(c, inode->i_mode);
+	ri->uid = cpu_to_je16(c, i_uid_read(inode));
+	ri->gid = cpu_to_je16(c, i_gid_read(inode));
+	ri->isize = cpu_to_je32(c, (uint32_t)inode->i_size);
+	ri->atime = ri->ctime = ri->mtime = cpu_to_je32(c, JFFS2_NOW());
 
 	/* In 2.4, it was already kmapped by generic_file_write(). Doesn't
 	   hurt to do it again. The alternative is ifdefs, which are ugly. */
@@ -308,7 +308,7 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping,
 			inode->i_size = pos + writtenlen;
 			inode->i_blocks = (inode->i_size + 511) >> 9;
 
-			inode->i_ctime = inode->i_mtime = ITIME(je32_to_cpu(ri->ctime));
+			inode->i_ctime = inode->i_mtime = ITIME(je32_to_cpu(c, ri->ctime));
 		}
 	}
 
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index eab04eca95a3..f24a01b0e70d 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -51,7 +51,7 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
 	   it out again with the appropriate data attached */
 	if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) {
 		/* For these, we don't actually need to read the old node */
-		mdatalen = jffs2_encode_dev(&dev, inode->i_rdev);
+		mdatalen = jffs2_encode_dev(c, &dev, inode->i_rdev);
 		mdata = (char *)&dev;
 		jffs2_dbg(1, "%s(): Writing %d bytes of kdev_t\n",
 			  __func__, mdatalen);
@@ -92,48 +92,48 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
 	mutex_lock(&f->sem);
 	ivalid = iattr->ia_valid;
 
-	ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-	ri->nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
-	ri->totlen = cpu_to_je32(sizeof(*ri) + mdatalen);
-	ri->hdr_crc = cpu_to_je32(crc32(0, ri, sizeof(struct jffs2_unknown_node)-4));
+	ri->magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+	ri->nodetype = cpu_to_je16(c, JFFS2_NODETYPE_INODE);
+	ri->totlen = cpu_to_je32(c, sizeof(*ri) + mdatalen);
+	ri->hdr_crc = cpu_to_je32(c, crc32(0, ri, sizeof(struct jffs2_unknown_node)-4));
 
-	ri->ino = cpu_to_je32(inode->i_ino);
-	ri->version = cpu_to_je32(++f->highest_version);
+	ri->ino = cpu_to_je32(c, inode->i_ino);
+	ri->version = cpu_to_je32(c, ++f->highest_version);
 
-	ri->uid = cpu_to_je16((ivalid & ATTR_UID)?
+	ri->uid = cpu_to_je16(c, (ivalid & ATTR_UID)?
 		from_kuid(&init_user_ns, iattr->ia_uid):i_uid_read(inode));
-	ri->gid = cpu_to_je16((ivalid & ATTR_GID)?
+	ri->gid = cpu_to_je16(c, (ivalid & ATTR_GID)?
 		from_kgid(&init_user_ns, iattr->ia_gid):i_gid_read(inode));
 
 	if (ivalid & ATTR_MODE)
-		ri->mode = cpu_to_jemode(iattr->ia_mode);
+		ri->mode = cpu_to_jemode(c, iattr->ia_mode);
 	else
-		ri->mode = cpu_to_jemode(inode->i_mode);
+		ri->mode = cpu_to_jemode(c, inode->i_mode);
 
 
-	ri->isize = cpu_to_je32((ivalid & ATTR_SIZE)?iattr->ia_size:inode->i_size);
-	ri->atime = cpu_to_je32(I_SEC((ivalid & ATTR_ATIME)?iattr->ia_atime:inode->i_atime));
-	ri->mtime = cpu_to_je32(I_SEC((ivalid & ATTR_MTIME)?iattr->ia_mtime:inode->i_mtime));
-	ri->ctime = cpu_to_je32(I_SEC((ivalid & ATTR_CTIME)?iattr->ia_ctime:inode->i_ctime));
+	ri->isize = cpu_to_je32(c, (ivalid & ATTR_SIZE)?iattr->ia_size:inode->i_size);
+	ri->atime = cpu_to_je32(c, I_SEC((ivalid & ATTR_ATIME)?iattr->ia_atime:inode->i_atime));
+	ri->mtime = cpu_to_je32(c, I_SEC((ivalid & ATTR_MTIME)?iattr->ia_mtime:inode->i_mtime));
+	ri->ctime = cpu_to_je32(c, I_SEC((ivalid & ATTR_CTIME)?iattr->ia_ctime:inode->i_ctime));
 
-	ri->offset = cpu_to_je32(0);
-	ri->csize = ri->dsize = cpu_to_je32(mdatalen);
+	ri->offset = cpu_to_je32(c, 0);
+	ri->csize = ri->dsize = cpu_to_je32(c, mdatalen);
 	ri->compr = JFFS2_COMPR_NONE;
 	if (ivalid & ATTR_SIZE && inode->i_size < iattr->ia_size) {
 		/* It's an extension. Make it a hole node */
 		ri->compr = JFFS2_COMPR_ZERO;
-		ri->dsize = cpu_to_je32(iattr->ia_size - inode->i_size);
-		ri->offset = cpu_to_je32(inode->i_size);
+		ri->dsize = cpu_to_je32(c, iattr->ia_size - inode->i_size);
+		ri->offset = cpu_to_je32(c, inode->i_size);
 	} else if (ivalid & ATTR_SIZE && !iattr->ia_size) {
 		/* For truncate-to-zero, treat it as deletion because
 		   it'll always be obsoleting all previous nodes */
 		alloc_type = ALLOC_DELETION;
 	}
-	ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
+	ri->node_crc = cpu_to_je32(c, crc32(0, ri, sizeof(*ri)-8));
 	if (mdatalen)
-		ri->data_crc = cpu_to_je32(crc32(0, mdata, mdatalen));
+		ri->data_crc = cpu_to_je32(c, crc32(0, mdata, mdatalen));
 	else
-		ri->data_crc = cpu_to_je32(0);
+		ri->data_crc = cpu_to_je32(c, 0);
 
 	new_metadata = jffs2_write_dnode(c, f, ri, mdata, mdatalen, alloc_type);
 	if (S_ISLNK(inode->i_mode))
@@ -146,12 +146,12 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
 		return PTR_ERR(new_metadata);
 	}
 	/* It worked. Update the inode */
-	inode->i_atime = ITIME(je32_to_cpu(ri->atime));
-	inode->i_ctime = ITIME(je32_to_cpu(ri->ctime));
-	inode->i_mtime = ITIME(je32_to_cpu(ri->mtime));
-	inode->i_mode = jemode_to_cpu(ri->mode);
-	i_uid_write(inode, je16_to_cpu(ri->uid));
-	i_gid_write(inode, je16_to_cpu(ri->gid));
+	inode->i_atime = ITIME(je32_to_cpu(c, ri->atime));
+	inode->i_ctime = ITIME(je32_to_cpu(c, ri->ctime));
+	inode->i_mtime = ITIME(je32_to_cpu(c, ri->mtime));
+	inode->i_mode = jemode_to_cpu(c, ri->mode);
+	i_uid_write(inode, je16_to_cpu(c, ri->uid));
+	i_gid_write(inode, je16_to_cpu(c, ri->gid));
 
 
 	old_metadata = f->metadata;
@@ -276,13 +276,13 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
 	if (ret)
 		goto error;
 
-	inode->i_mode = jemode_to_cpu(latest_node.mode);
-	i_uid_write(inode, je16_to_cpu(latest_node.uid));
-	i_gid_write(inode, je16_to_cpu(latest_node.gid));
-	inode->i_size = je32_to_cpu(latest_node.isize);
-	inode->i_atime = ITIME(je32_to_cpu(latest_node.atime));
-	inode->i_mtime = ITIME(je32_to_cpu(latest_node.mtime));
-	inode->i_ctime = ITIME(je32_to_cpu(latest_node.ctime));
+	inode->i_mode = jemode_to_cpu(c, latest_node.mode);
+	i_uid_write(inode, je16_to_cpu(c, latest_node.uid));
+	i_gid_write(inode, je16_to_cpu(c, latest_node.gid));
+	inode->i_size = je32_to_cpu(c, latest_node.isize);
+	inode->i_atime = ITIME(je32_to_cpu(c, latest_node.atime));
+	inode->i_mtime = ITIME(je32_to_cpu(c, latest_node.mtime));
+	inode->i_ctime = ITIME(je32_to_cpu(c, latest_node.ctime));
 
 	set_nlink(inode, f->inocache->pino_nlink);
 
@@ -337,9 +337,9 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
 			goto error;
 		}
 		if (f->metadata->size == sizeof(jdev.old_id))
-			rdev = old_decode_dev(je16_to_cpu(jdev.old_id));
+			rdev = old_decode_dev(je16_to_cpu(c, jdev.old_id));
 		else
-			rdev = new_decode_dev(je32_to_cpu(jdev.new_id));
+			rdev = new_decode_dev(je32_to_cpu(c, jdev.new_id));
 
 	case S_IFSOCK:
 	case S_IFIFO:
@@ -441,14 +441,14 @@ struct inode *jffs2_new_inode (struct inode *dir_i, umode_t mode, struct jffs2_r
 
 	memset(ri, 0, sizeof(*ri));
 	/* Set OS-specific defaults for new inodes */
-	ri->uid = cpu_to_je16(from_kuid(&init_user_ns, current_fsuid()));
+	ri->uid = cpu_to_je16(c, from_kuid(&init_user_ns, current_fsuid()));
 
 	if (dir_i->i_mode & S_ISGID) {
-		ri->gid = cpu_to_je16(i_gid_read(dir_i));
+		ri->gid = cpu_to_je16(c, i_gid_read(dir_i));
 		if (S_ISDIR(mode))
 			mode |= S_ISGID;
 	} else {
-		ri->gid = cpu_to_je16(from_kgid(&init_user_ns, current_fsgid()));
+		ri->gid = cpu_to_je16(c, from_kgid(&init_user_ns, current_fsgid()));
 	}
 
 	/* POSIX ACLs have to be processed now, at least partly.
@@ -468,12 +468,12 @@ struct inode *jffs2_new_inode (struct inode *dir_i, umode_t mode, struct jffs2_r
 		return ERR_PTR(ret);
 	}
 	set_nlink(inode, 1);
-	inode->i_ino = je32_to_cpu(ri->ino);
-	inode->i_mode = jemode_to_cpu(ri->mode);
-	i_gid_write(inode, je16_to_cpu(ri->gid));
-	i_uid_write(inode, je16_to_cpu(ri->uid));
+	inode->i_ino = je32_to_cpu(c, ri->ino);
+	inode->i_mode = jemode_to_cpu(c, ri->mode);
+	i_gid_write(inode, je16_to_cpu(c, ri->gid));
+	i_uid_write(inode, je16_to_cpu(c, ri->uid));
 	inode->i_atime = inode->i_ctime = inode->i_mtime = current_time(inode);
-	ri->atime = ri->mtime = ri->ctime = cpu_to_je32(I_SEC(inode->i_mtime));
+	ri->atime = ri->mtime = ri->ctime = cpu_to_je32(c, I_SEC(inode->i_mtime));
 
 	inode->i_blocks = 0;
 	inode->i_size = 0;
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c
index 9ed0f26cf023..6183458d6bd9 100644
--- a/fs/jffs2/gc.c
+++ b/fs/jffs2/gc.c
@@ -632,28 +632,28 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
 		goto out_node;
 
 	crc = crc32(0, node, sizeof(struct jffs2_unknown_node)-4);
-	if (je32_to_cpu(node->u.hdr_crc) != crc) {
+	if (je32_to_cpu(c, node->u.hdr_crc) != crc) {
 		pr_warn("Header CRC failed on REF_PRISTINE node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
-			ref_offset(raw), je32_to_cpu(node->u.hdr_crc), crc);
+			ref_offset(raw), je32_to_cpu(c, node->u.hdr_crc), crc);
 		goto bail;
 	}
 
-	switch(je16_to_cpu(node->u.nodetype)) {
+	switch(je16_to_cpu(c, node->u.nodetype)) {
 	case JFFS2_NODETYPE_INODE:
 		crc = crc32(0, node, sizeof(node->i)-8);
-		if (je32_to_cpu(node->i.node_crc) != crc) {
+		if (je32_to_cpu(c, node->i.node_crc) != crc) {
 			pr_warn("Node CRC failed on REF_PRISTINE data node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
-				ref_offset(raw), je32_to_cpu(node->i.node_crc),
+				ref_offset(raw), je32_to_cpu(c, node->i.node_crc),
 				crc);
 			goto bail;
 		}
 
-		if (je32_to_cpu(node->i.dsize)) {
-			crc = crc32(0, node->i.data, je32_to_cpu(node->i.csize));
-			if (je32_to_cpu(node->i.data_crc) != crc) {
+		if (je32_to_cpu(c, node->i.dsize)) {
+			crc = crc32(0, node->i.data, je32_to_cpu(c, node->i.csize));
+			if (je32_to_cpu(c, node->i.data_crc) != crc) {
 				pr_warn("Data CRC failed on REF_PRISTINE data node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
 					ref_offset(raw),
-					je32_to_cpu(node->i.data_crc), crc);
+					je32_to_cpu(c, node->i.data_crc), crc);
 				goto bail;
 			}
 		}
@@ -661,10 +661,10 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
 
 	case JFFS2_NODETYPE_DIRENT:
 		crc = crc32(0, node, sizeof(node->d)-8);
-		if (je32_to_cpu(node->d.node_crc) != crc) {
+		if (je32_to_cpu(c, node->d.node_crc) != crc) {
 			pr_warn("Node CRC failed on REF_PRISTINE dirent node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
 				ref_offset(raw),
-				je32_to_cpu(node->d.node_crc), crc);
+				je32_to_cpu(c, node->d.node_crc), crc);
 			goto bail;
 		}
 
@@ -676,10 +676,10 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
 
 		if (node->d.nsize) {
 			crc = crc32(0, node->d.name, node->d.nsize);
-			if (je32_to_cpu(node->d.name_crc) != crc) {
+			if (je32_to_cpu(c, node->d.name_crc) != crc) {
 				pr_warn("Name CRC failed on REF_PRISTINE dirent node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
 					ref_offset(raw),
-					je32_to_cpu(node->d.name_crc), crc);
+					je32_to_cpu(c, node->d.name_crc), crc);
 				goto bail;
 			}
 		}
@@ -688,7 +688,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
 		/* If it's inode-less, we don't _know_ what it is. Just copy it intact */
 		if (ic) {
 			pr_warn("Unknown node type for REF_PRISTINE node at 0x%08x: 0x%04x\n",
-				ref_offset(raw), je16_to_cpu(node->u.nodetype));
+				ref_offset(raw), je16_to_cpu(c, node->u.nodetype));
 			goto bail;
 		}
 	}
@@ -770,7 +770,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
 	if (S_ISBLK(JFFS2_F_I_MODE(f)) ||
 	    S_ISCHR(JFFS2_F_I_MODE(f)) ) {
 		/* For these, we don't actually need to read the old node */
-		mdatalen = jffs2_encode_dev(&dev, JFFS2_F_I_RDEV(f));
+		mdatalen = jffs2_encode_dev(c, &dev, JFFS2_F_I_RDEV(f));
 		mdata = (char *)&dev;
 		jffs2_dbg(1, "%s(): Writing %d bytes of kdev_t\n",
 			  __func__, mdatalen);
@@ -810,26 +810,26 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
 		ilen = JFFS2_F_I_SIZE(f);
 
 	memset(&ri, 0, sizeof(ri));
-	ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-	ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
-	ri.totlen = cpu_to_je32(sizeof(ri) + mdatalen);
-	ri.hdr_crc = cpu_to_je32(crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4));
-
-	ri.ino = cpu_to_je32(f->inocache->ino);
-	ri.version = cpu_to_je32(++f->highest_version);
-	ri.mode = cpu_to_jemode(JFFS2_F_I_MODE(f));
-	ri.uid = cpu_to_je16(JFFS2_F_I_UID(f));
-	ri.gid = cpu_to_je16(JFFS2_F_I_GID(f));
-	ri.isize = cpu_to_je32(ilen);
-	ri.atime = cpu_to_je32(JFFS2_F_I_ATIME(f));
-	ri.ctime = cpu_to_je32(JFFS2_F_I_CTIME(f));
-	ri.mtime = cpu_to_je32(JFFS2_F_I_MTIME(f));
-	ri.offset = cpu_to_je32(0);
-	ri.csize = cpu_to_je32(mdatalen);
-	ri.dsize = cpu_to_je32(mdatalen);
+	ri.magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+	ri.nodetype = cpu_to_je16(c, JFFS2_NODETYPE_INODE);
+	ri.totlen = cpu_to_je32(c, sizeof(ri) + mdatalen);
+	ri.hdr_crc = cpu_to_je32(c, crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4));
+
+	ri.ino = cpu_to_je32(c, f->inocache->ino);
+	ri.version = cpu_to_je32(c, ++f->highest_version);
+	ri.mode = cpu_to_jemode(c, JFFS2_F_I_MODE(f));
+	ri.uid = cpu_to_je16(c, JFFS2_F_I_UID(f));
+	ri.gid = cpu_to_je16(c, JFFS2_F_I_GID(f));
+	ri.isize = cpu_to_je32(c, ilen);
+	ri.atime = cpu_to_je32(c, JFFS2_F_I_ATIME(f));
+	ri.ctime = cpu_to_je32(c, JFFS2_F_I_CTIME(f));
+	ri.mtime = cpu_to_je32(c, JFFS2_F_I_MTIME(f));
+	ri.offset = cpu_to_je32(c, 0);
+	ri.csize = cpu_to_je32(c, mdatalen);
+	ri.dsize = cpu_to_je32(c, mdatalen);
 	ri.compr = JFFS2_COMPR_NONE;
-	ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
-	ri.data_crc = cpu_to_je32(crc32(0, mdata, mdatalen));
+	ri.node_crc = cpu_to_je32(c, crc32(0, &ri, sizeof(ri)-8));
+	ri.data_crc = cpu_to_je32(c, crc32(0, mdata, mdatalen));
 
 	new_fn = jffs2_write_dnode(c, f, &ri, mdata, mdatalen, ALLOC_GC);
 
@@ -855,24 +855,24 @@ static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_er
 	uint32_t alloclen;
 	int ret;
 
-	rd.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-	rd.nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT);
+	rd.magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+	rd.nodetype = cpu_to_je16(c, JFFS2_NODETYPE_DIRENT);
 	rd.nsize = strlen(fd->name);
-	rd.totlen = cpu_to_je32(sizeof(rd) + rd.nsize);
-	rd.hdr_crc = cpu_to_je32(crc32(0, &rd, sizeof(struct jffs2_unknown_node)-4));
+	rd.totlen = cpu_to_je32(c, sizeof(rd) + rd.nsize);
+	rd.hdr_crc = cpu_to_je32(c, crc32(0, &rd, sizeof(struct jffs2_unknown_node)-4));
 
-	rd.pino = cpu_to_je32(f->inocache->ino);
-	rd.version = cpu_to_je32(++f->highest_version);
-	rd.ino = cpu_to_je32(fd->ino);
+	rd.pino = cpu_to_je32(c, f->inocache->ino);
+	rd.version = cpu_to_je32(c, ++f->highest_version);
+	rd.ino = cpu_to_je32(c, fd->ino);
 	/* If the times on this inode were set by explicit utime() they can be different,
 	   so refrain from splatting them. */
 	if (JFFS2_F_I_MTIME(f) == JFFS2_F_I_CTIME(f))
-		rd.mctime = cpu_to_je32(JFFS2_F_I_MTIME(f));
+		rd.mctime = cpu_to_je32(c, JFFS2_F_I_MTIME(f));
 	else
-		rd.mctime = cpu_to_je32(0);
+		rd.mctime = cpu_to_je32(c, 0);
 	rd.type = fd->type;
-	rd.node_crc = cpu_to_je32(crc32(0, &rd, sizeof(rd)-8));
-	rd.name_crc = cpu_to_je32(crc32(0, fd->name, rd.nsize));
+	rd.node_crc = cpu_to_je32(c, crc32(0, &rd, sizeof(rd)-8));
+	rd.name_crc = cpu_to_je32(c, crc32(0, fd->name, rd.nsize));
 
 	ret = jffs2_reserve_space_gc(c, sizeof(rd)+rd.nsize, &alloclen,
 				JFFS2_SUMMARY_DIRENT_SIZE(rd.nsize));
@@ -957,15 +957,15 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct
 				continue;
 			}
 
-			if (je16_to_cpu(rd->nodetype) != JFFS2_NODETYPE_DIRENT)
+			if (je16_to_cpu(c, rd->nodetype) != JFFS2_NODETYPE_DIRENT)
 				continue;
 
 			/* If the name CRC doesn't match, skip */
-			if (je32_to_cpu(rd->name_crc) != name_crc)
+			if (je32_to_cpu(c, rd->name_crc) != name_crc)
 				continue;
 
 			/* If the name length doesn't match, or it's another deletion dirent, skip */
-			if (rd->nsize != name_len || !je32_to_cpu(rd->ino))
+			if (rd->nsize != name_len || !je32_to_cpu(c, rd->ino))
 				continue;
 
 			/* OK, check the actual name now */
@@ -979,7 +979,7 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct
 
 			jffs2_dbg(1, "Deletion dirent at %08x still obsoletes real dirent \"%s\" at %08x for ino #%u\n",
 				  ref_offset(fd->raw), fd->name,
-				  ref_offset(raw), je32_to_cpu(rd->ino));
+				  ref_offset(raw), je32_to_cpu(c, rd->ino));
 			kfree(rd);
 
 			return jffs2_garbage_collect_dirent(c, jeb, f, fd);
@@ -1036,23 +1036,23 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
 				ret, readlen);
 			goto fill;
 		}
-		if (je16_to_cpu(ri.nodetype) != JFFS2_NODETYPE_INODE) {
+		if (je16_to_cpu(c, ri.nodetype) != JFFS2_NODETYPE_INODE) {
 			pr_warn("%s(): Node at 0x%08x had node type 0x%04x instead of JFFS2_NODETYPE_INODE(0x%04x)\n",
 				__func__, ref_offset(fn->raw),
-				je16_to_cpu(ri.nodetype), JFFS2_NODETYPE_INODE);
+				je16_to_cpu(c, ri.nodetype), JFFS2_NODETYPE_INODE);
 			return -EIO;
 		}
-		if (je32_to_cpu(ri.totlen) != sizeof(ri)) {
+		if (je32_to_cpu(c, ri.totlen) != sizeof(ri)) {
 			pr_warn("%s(): Node at 0x%08x had totlen 0x%x instead of expected 0x%zx\n",
 				__func__, ref_offset(fn->raw),
-				je32_to_cpu(ri.totlen), sizeof(ri));
+				je32_to_cpu(c, ri.totlen), sizeof(ri));
 			return -EIO;
 		}
 		crc = crc32(0, &ri, sizeof(ri)-8);
-		if (crc != je32_to_cpu(ri.node_crc)) {
+		if (crc != je32_to_cpu(c, ri.node_crc)) {
 			pr_warn("%s: Node at 0x%08x had CRC 0x%08x which doesn't match calculated CRC 0x%08x\n",
 				__func__, ref_offset(fn->raw),
-				je32_to_cpu(ri.node_crc), crc);
+				je32_to_cpu(c, ri.node_crc), crc);
 			/* FIXME: We could possibly deal with this by writing new holes for each frag */
 			pr_warn("Data in the range 0x%08x to 0x%08x of inode #%u will be lost\n",
 				start, end, f->inocache->ino);
@@ -1067,16 +1067,16 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
 		}
 	} else {
 	fill:
-		ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-		ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
-		ri.totlen = cpu_to_je32(sizeof(ri));
-		ri.hdr_crc = cpu_to_je32(crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4));
-
-		ri.ino = cpu_to_je32(f->inocache->ino);
-		ri.version = cpu_to_je32(++f->highest_version);
-		ri.offset = cpu_to_je32(start);
-		ri.dsize = cpu_to_je32(end - start);
-		ri.csize = cpu_to_je32(0);
+		ri.magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+		ri.nodetype = cpu_to_je16(c, JFFS2_NODETYPE_INODE);
+		ri.totlen = cpu_to_je32(c, sizeof(ri));
+		ri.hdr_crc = cpu_to_je32(c, crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4));
+
+		ri.ino = cpu_to_je32(c, f->inocache->ino);
+		ri.version = cpu_to_je32(c, ++f->highest_version);
+		ri.offset = cpu_to_je32(c, start);
+		ri.dsize = cpu_to_je32(c, end - start);
+		ri.csize = cpu_to_je32(c, 0);
 		ri.compr = JFFS2_COMPR_ZERO;
 	}
 
@@ -1088,15 +1088,15 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
 	else
 		ilen = JFFS2_F_I_SIZE(f);
 
-	ri.mode = cpu_to_jemode(JFFS2_F_I_MODE(f));
-	ri.uid = cpu_to_je16(JFFS2_F_I_UID(f));
-	ri.gid = cpu_to_je16(JFFS2_F_I_GID(f));
-	ri.isize = cpu_to_je32(ilen);
-	ri.atime = cpu_to_je32(JFFS2_F_I_ATIME(f));
-	ri.ctime = cpu_to_je32(JFFS2_F_I_CTIME(f));
-	ri.mtime = cpu_to_je32(JFFS2_F_I_MTIME(f));
-	ri.data_crc = cpu_to_je32(0);
-	ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
+	ri.mode = cpu_to_jemode(c, JFFS2_F_I_MODE(f));
+	ri.uid = cpu_to_je16(c, JFFS2_F_I_UID(f));
+	ri.gid = cpu_to_je16(c, JFFS2_F_I_GID(f));
+	ri.isize = cpu_to_je32(c, ilen);
+	ri.atime = cpu_to_je32(c, JFFS2_F_I_ATIME(f));
+	ri.ctime = cpu_to_je32(c, JFFS2_F_I_CTIME(f));
+	ri.mtime = cpu_to_je32(c, JFFS2_F_I_MTIME(f));
+	ri.data_crc = cpu_to_je32(c, 0);
+	ri.node_crc = cpu_to_je32(c, crc32(0, &ri, sizeof(ri)-8));
 
 	ret = jffs2_reserve_space_gc(c, sizeof(ri), &alloclen,
 				     JFFS2_SUMMARY_INODE_SIZE);
@@ -1111,7 +1111,7 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
 		pr_warn("Error writing new hole node: %ld\n", PTR_ERR(new_fn));
 		return PTR_ERR(new_fn);
 	}
-	if (je32_to_cpu(ri.version) == f->highest_version) {
+	if (je32_to_cpu(c, ri.version) == f->highest_version) {
 		jffs2_add_full_dnode_to_inode(c, f, new_fn);
 		if (f->metadata) {
 			jffs2_mark_node_obsolete(c, f->metadata->raw);
@@ -1129,8 +1129,8 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
 	 */
 	D1(if(unlikely(fn->frags <= 1)) {
 			pr_warn("%s(): Replacing fn with %d frag(s) but new ver %d != highest_version %d of ino #%d\n",
-				__func__, fn->frags, je32_to_cpu(ri.version),
-				f->highest_version, je32_to_cpu(ri.ino));
+				__func__, fn->frags, je32_to_cpu(c, ri.version),
+				f->highest_version, je32_to_cpu(c, ri.ino));
 	});
 
 	/* This is a partially-overlapped hole node. Mark it REF_NORMAL not REF_PRISTINE */
@@ -1355,27 +1355,27 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era
 
 		comprtype = jffs2_compress(c, f, writebuf, &comprbuf, &datalen, &cdatalen);
 
-		ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-		ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
-		ri.totlen = cpu_to_je32(sizeof(ri) + cdatalen);
-		ri.hdr_crc = cpu_to_je32(crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4));
-
-		ri.ino = cpu_to_je32(f->inocache->ino);
-		ri.version = cpu_to_je32(++f->highest_version);
-		ri.mode = cpu_to_jemode(JFFS2_F_I_MODE(f));
-		ri.uid = cpu_to_je16(JFFS2_F_I_UID(f));
-		ri.gid = cpu_to_je16(JFFS2_F_I_GID(f));
-		ri.isize = cpu_to_je32(JFFS2_F_I_SIZE(f));
-		ri.atime = cpu_to_je32(JFFS2_F_I_ATIME(f));
-		ri.ctime = cpu_to_je32(JFFS2_F_I_CTIME(f));
-		ri.mtime = cpu_to_je32(JFFS2_F_I_MTIME(f));
-		ri.offset = cpu_to_je32(offset);
-		ri.csize = cpu_to_je32(cdatalen);
-		ri.dsize = cpu_to_je32(datalen);
+		ri.magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+		ri.nodetype = cpu_to_je16(c, JFFS2_NODETYPE_INODE);
+		ri.totlen = cpu_to_je32(c, sizeof(ri) + cdatalen);
+		ri.hdr_crc = cpu_to_je32(c, crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4));
+
+		ri.ino = cpu_to_je32(c, f->inocache->ino);
+		ri.version = cpu_to_je32(c, ++f->highest_version);
+		ri.mode = cpu_to_jemode(c, JFFS2_F_I_MODE(f));
+		ri.uid = cpu_to_je16(c, JFFS2_F_I_UID(f));
+		ri.gid = cpu_to_je16(c, JFFS2_F_I_GID(f));
+		ri.isize = cpu_to_je32(c, JFFS2_F_I_SIZE(f));
+		ri.atime = cpu_to_je32(c, JFFS2_F_I_ATIME(f));
+		ri.ctime = cpu_to_je32(c, JFFS2_F_I_CTIME(f));
+		ri.mtime = cpu_to_je32(c, JFFS2_F_I_MTIME(f));
+		ri.offset = cpu_to_je32(c, offset);
+		ri.csize = cpu_to_je32(c, cdatalen);
+		ri.dsize = cpu_to_je32(c, datalen);
 		ri.compr = comprtype & 0xff;
 		ri.usercompr = (comprtype >> 8) & 0xff;
-		ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
-		ri.data_crc = cpu_to_je32(crc32(0, comprbuf, cdatalen));
+		ri.node_crc = cpu_to_je32(c, crc32(0, &ri, sizeof(ri)-8));
+		ri.data_crc = cpu_to_je32(c, crc32(0, comprbuf, cdatalen));
 
 		new_fn = jffs2_write_dnode(c, f, &ri, comprbuf, cdatalen, ALLOC_GC);
 
diff --git a/fs/jffs2/jffs2_fs_sb.h b/fs/jffs2/jffs2_fs_sb.h
index 778275f48a87..ef28e28cb6d4 100644
--- a/fs/jffs2/jffs2_fs_sb.h
+++ b/fs/jffs2/jffs2_fs_sb.h
@@ -39,6 +39,7 @@ struct jffs2_mount_opts {
 	 * latter users to write to the file system if the amount if the
 	 * available space is less then 'rp_size'. */
 	unsigned int rp_size;
+	unsigned int endian;
 };
 
 /* A struct for the overall file system control.  Pointers to
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
index 0637271f3770..a51d2481bfee 100644
--- a/fs/jffs2/nodelist.h
+++ b/fs/jffs2/nodelist.h
@@ -27,47 +27,79 @@
 #include "os-linux.h"
 #endif
 
-#define JFFS2_NATIVE_ENDIAN
+#define JFFS2_ENDIAN_NATIVE 0
+#define JFFS2_ENDIAN_LITTLE 1
+#define JFFS2_ENDIAN_BIG 2
 
 /* Note we handle mode bits conversion from JFFS2 (i.e. Linux) to/from
    whatever OS we're actually running on here too. */
 
-#if defined(JFFS2_NATIVE_ENDIAN)
-#define cpu_to_je16(x) ((jint16_t){x})
-#define cpu_to_je32(x) ((jint32_t){x})
-#define cpu_to_jemode(x) ((jmode_t){os_to_jffs2_mode(x)})
-
-#define constant_cpu_to_je16(x) ((jint16_t){x})
-#define constant_cpu_to_je32(x) ((jint32_t){x})
-
-#define je16_to_cpu(x) ((x).v16)
-#define je32_to_cpu(x) ((x).v32)
-#define jemode_to_cpu(x) (jffs2_to_os_mode((x).m))
-#elif defined(JFFS2_BIG_ENDIAN)
-#define cpu_to_je16(x) ((jint16_t){cpu_to_be16(x)})
-#define cpu_to_je32(x) ((jint32_t){cpu_to_be32(x)})
-#define cpu_to_jemode(x) ((jmode_t){cpu_to_be32(os_to_jffs2_mode(x))})
-
-#define constant_cpu_to_je16(x) ((jint16_t){__constant_cpu_to_be16(x)})
-#define constant_cpu_to_je32(x) ((jint32_t){__constant_cpu_to_be32(x)})
-
-#define je16_to_cpu(x) (be16_to_cpu(x.v16))
-#define je32_to_cpu(x) (be32_to_cpu(x.v32))
-#define jemode_to_cpu(x) (be32_to_cpu(jffs2_to_os_mode((x).m)))
-#elif defined(JFFS2_LITTLE_ENDIAN)
-#define cpu_to_je16(x) ((jint16_t){cpu_to_le16(x)})
-#define cpu_to_je32(x) ((jint32_t){cpu_to_le32(x)})
-#define cpu_to_jemode(x) ((jmode_t){cpu_to_le32(os_to_jffs2_mode(x))})
-
-#define constant_cpu_to_je16(x) ((jint16_t){__constant_cpu_to_le16(x)})
-#define constant_cpu_to_je32(x) ((jint32_t){__constant_cpu_to_le32(x)})
-
-#define je16_to_cpu(x) (le16_to_cpu(x.v16))
-#define je32_to_cpu(x) (le32_to_cpu(x.v32))
-#define jemode_to_cpu(x) (le32_to_cpu(jffs2_to_os_mode((x).m)))
-#else
-#error wibble
-#endif
+static inline jint16_t
+cpu_to_je16(struct jffs2_sb_info *c, u16 x)
+{
+	if (c->mount_opts.endian  == JFFS2_ENDIAN_LITTLE)
+		return ((jint16_t){cpu_to_le16(x)});
+	else if (c->mount_opts.endian  == JFFS2_ENDIAN_BIG)
+		return ((jint16_t){cpu_to_be16(x)});
+	else
+		return ((jint16_t){x});
+}
+
+static inline jint32_t
+cpu_to_je32(struct jffs2_sb_info *c, u32 x)
+{
+	if (c->mount_opts.endian  == JFFS2_ENDIAN_LITTLE)
+		return ((jint32_t){cpu_to_le32(x)});
+	else if (c->mount_opts.endian  == JFFS2_ENDIAN_BIG)
+		return ((jint32_t){cpu_to_be32(x)});
+	else
+		return ((jint32_t){x});
+}
+
+static inline jmode_t
+cpu_to_jemode(struct jffs2_sb_info *c, u32 x)
+{
+	if (c->mount_opts.endian  == JFFS2_ENDIAN_LITTLE)
+		return ((jmode_t){cpu_to_le32(os_to_jffs2_mode(x))});
+	else if (c->mount_opts.endian  == JFFS2_ENDIAN_BIG)
+		return ((jmode_t){cpu_to_be32(os_to_jffs2_mode(x))});
+	else
+		return ((jmode_t){os_to_jffs2_mode(x)});
+}
+
+
+static inline u16
+je16_to_cpu(struct jffs2_sb_info *c, jint16_t x)
+{
+	if (c->mount_opts.endian  == JFFS2_ENDIAN_LITTLE)
+		return le16_to_cpu(x.v16);
+	else if (c->mount_opts.endian  == JFFS2_ENDIAN_BIG)
+		return be16_to_cpu(x.v16);
+	else
+		return ((x).v16);
+}
+
+static inline u32
+je32_to_cpu(struct jffs2_sb_info *c, jint32_t x)
+{
+	if (c->mount_opts.endian  == JFFS2_ENDIAN_LITTLE)
+		return le32_to_cpu(x.v32);
+	else if (c->mount_opts.endian  == JFFS2_ENDIAN_BIG)
+		return be32_to_cpu(x.v32);
+	else
+		return ((x).v32);
+}
+
+static inline u32
+jemode_to_cpu(struct jffs2_sb_info *c, jmode_t x)
+{
+	if (c->mount_opts.endian  == JFFS2_ENDIAN_LITTLE)
+		return le32_to_cpu(jffs2_to_os_mode((x).m));
+	else if (c->mount_opts.endian  == JFFS2_ENDIAN_BIG)
+		return be32_to_cpu(jffs2_to_os_mode((x).m));
+	else
+		return jffs2_to_os_mode((x).m);
+}
 
 /* The minimal node header size */
 #define JFFS2_MIN_NODE_HEADER sizeof(struct jffs2_raw_dirent)
@@ -141,7 +173,7 @@ static inline struct jffs2_inode_cache *jffs2_raw_ref_to_ic(struct jffs2_raw_nod
 /* Dirent nodes should be REF_PRISTINE only if they are not a deletion
    dirent. Deletion dirents should be REF_NORMAL so that GC gets to
    throw them away when appropriate */
-#define dirent_node_state(rd)	( (je32_to_cpu((rd)->ino)?REF_PRISTINE:REF_NORMAL) )
+#define dirent_node_state(c, rd)	( (je32_to_cpu((c), (rd)->ino)?REF_PRISTINE:REF_NORMAL) )
 
 /* NB: REF_PRISTINE for an inode-less node (ref->next_in_ino == NULL) indicates
    it is an unknown node of type JFFS2_NODETYPE_RWCOMPAT_COPY, so it'll get
@@ -313,13 +345,14 @@ static inline int jffs2_blocks_use_vmalloc(struct jffs2_sb_info *c)
 
 #define PAD(x) (((x)+3)&~3)
 
-static inline int jffs2_encode_dev(union jffs2_device_node *jdev, dev_t rdev)
+static inline int jffs2_encode_dev(struct jffs2_sb_info *c,
+				union jffs2_device_node *jdev, dev_t rdev)
 {
 	if (old_valid_dev(rdev)) {
-		jdev->old_id = cpu_to_je16(old_encode_dev(rdev));
+		jdev->old_id = cpu_to_je16(c, old_encode_dev(rdev));
 		return sizeof(jdev->old_id);
 	} else {
-		jdev->new_id = cpu_to_je32(new_encode_dev(rdev));
+		jdev->new_id = cpu_to_je32(c, new_encode_dev(rdev));
 		return sizeof(jdev->new_id);
 	}
 }
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
index a7bbe879cfc3..32c362464ba6 100644
--- a/fs/jffs2/nodemgmt.c
+++ b/fs/jffs2/nodemgmt.c
@@ -766,18 +766,18 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
 			ref_offset(ref), retlen);
 		goto out_erase_sem;
 	}
-	if (PAD(je32_to_cpu(n.totlen)) != PAD(freed_len)) {
+	if (PAD(je32_to_cpu(c, n.totlen)) != PAD(freed_len)) {
 		pr_warn("Node totlen on flash (0x%08x) != totlen from node ref (0x%08x)\n",
-			je32_to_cpu(n.totlen), freed_len);
+			je32_to_cpu(c, n.totlen), freed_len);
 		goto out_erase_sem;
 	}
-	if (!(je16_to_cpu(n.nodetype) & JFFS2_NODE_ACCURATE)) {
+	if (!(je16_to_cpu(c, n.nodetype) & JFFS2_NODE_ACCURATE)) {
 		jffs2_dbg(1, "Node at 0x%08x was already marked obsolete (nodetype 0x%04x)\n",
-			  ref_offset(ref), je16_to_cpu(n.nodetype));
+			  ref_offset(ref), je16_to_cpu(c, n.nodetype));
 		goto out_erase_sem;
 	}
 	/* XXX FIXME: This is ugly now */
-	n.nodetype = cpu_to_je16(je16_to_cpu(n.nodetype) & ~JFFS2_NODE_ACCURATE);
+	n.nodetype = cpu_to_je16(c, je16_to_cpu(c, n.nodetype) & ~JFFS2_NODE_ACCURATE);
 	ret = jffs2_flash_write(c, ref_offset(ref), sizeof(n), &retlen, (char *)&n);
 	if (ret) {
 		pr_warn("Write error in obliterating obsoleted node at 0x%08x: %d\n",
diff --git a/fs/jffs2/read.c b/fs/jffs2/read.c
index 0b042b1fc82f..95f66eb2b184 100644
--- a/fs/jffs2/read.c
+++ b/fs/jffs2/read.c
@@ -51,26 +51,26 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
 	crc = crc32(0, ri, sizeof(*ri)-8);
 
 	jffs2_dbg(1, "Node read from %08x: node_crc %08x, calculated CRC %08x. dsize %x, csize %x, offset %x, buf %p\n",
-		  ref_offset(fd->raw), je32_to_cpu(ri->node_crc),
-		  crc, je32_to_cpu(ri->dsize), je32_to_cpu(ri->csize),
-		  je32_to_cpu(ri->offset), buf);
-	if (crc != je32_to_cpu(ri->node_crc)) {
+		  ref_offset(fd->raw), je32_to_cpu(c, ri->node_crc),
+		  crc, je32_to_cpu(c, ri->dsize), je32_to_cpu(c, ri->csize),
+		  je32_to_cpu(c, ri->offset), buf);
+	if (crc != je32_to_cpu(c, ri->node_crc)) {
 		pr_warn("Node CRC %08x != calculated CRC %08x for node at %08x\n",
-			je32_to_cpu(ri->node_crc), crc, ref_offset(fd->raw));
+			je32_to_cpu(c, ri->node_crc), crc, ref_offset(fd->raw));
 		ret = -EIO;
 		goto out_ri;
 	}
 	/* There was a bug where we wrote hole nodes out with csize/dsize
 	   swapped. Deal with it */
-	if (ri->compr == JFFS2_COMPR_ZERO && !je32_to_cpu(ri->dsize) &&
-	    je32_to_cpu(ri->csize)) {
+	if (ri->compr == JFFS2_COMPR_ZERO && !je32_to_cpu(c, ri->dsize) &&
+	    je32_to_cpu(c, ri->csize)) {
 		ri->dsize = ri->csize;
-		ri->csize = cpu_to_je32(0);
+		ri->csize = cpu_to_je32(c, 0);
 	}
 
-	D1(if(ofs + len > je32_to_cpu(ri->dsize)) {
+	D1(if(ofs + len > je32_to_cpu(c, ri->dsize)) {
 			pr_warn("jffs2_read_dnode() asked for %d bytes at %d from %d-byte node\n",
-				len, ofs, je32_to_cpu(ri->dsize));
+				len, ofs, je32_to_cpu(c, ri->dsize));
 		ret = -EINVAL;
 		goto out_ri;
 	});
@@ -87,18 +87,18 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
 	   Reading partial node and it's uncompressed - read into readbuf, check CRC, and copy
 	   Reading partial node and it's compressed - read into readbuf, check checksum, decompress to decomprbuf and copy
 	*/
-	if (ri->compr == JFFS2_COMPR_NONE && len == je32_to_cpu(ri->dsize)) {
+	if (ri->compr == JFFS2_COMPR_NONE && len == je32_to_cpu(c, ri->dsize)) {
 		readbuf = buf;
 	} else {
-		readbuf = kmalloc(je32_to_cpu(ri->csize), GFP_KERNEL);
+		readbuf = kmalloc(je32_to_cpu(c, ri->csize), GFP_KERNEL);
 		if (!readbuf) {
 			ret = -ENOMEM;
 			goto out_ri;
 		}
 	}
 	if (ri->compr != JFFS2_COMPR_NONE) {
-		if (len < je32_to_cpu(ri->dsize)) {
-			decomprbuf = kmalloc(je32_to_cpu(ri->dsize), GFP_KERNEL);
+		if (len < je32_to_cpu(c, ri->dsize)) {
+			decomprbuf = kmalloc(je32_to_cpu(c, ri->dsize), GFP_KERNEL);
 			if (!decomprbuf) {
 				ret = -ENOMEM;
 				goto out_readbuf;
@@ -110,36 +110,36 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
 		decomprbuf = readbuf;
 	}
 
-	jffs2_dbg(2, "Read %d bytes to %p\n", je32_to_cpu(ri->csize),
+	jffs2_dbg(2, "Read %d bytes to %p\n", je32_to_cpu(c, ri->csize),
 		  readbuf);
 	ret = jffs2_flash_read(c, (ref_offset(fd->raw)) + sizeof(*ri),
-			       je32_to_cpu(ri->csize), &readlen, readbuf);
+			       je32_to_cpu(c, ri->csize), &readlen, readbuf);
 
-	if (!ret && readlen != je32_to_cpu(ri->csize))
+	if (!ret && readlen != je32_to_cpu(c, ri->csize))
 		ret = -EIO;
 	if (ret)
 		goto out_decomprbuf;
 
-	crc = crc32(0, readbuf, je32_to_cpu(ri->csize));
-	if (crc != je32_to_cpu(ri->data_crc)) {
+	crc = crc32(0, readbuf, je32_to_cpu(c, ri->csize));
+	if (crc != je32_to_cpu(c, ri->data_crc)) {
 		pr_warn("Data CRC %08x != calculated CRC %08x for node at %08x\n",
-			je32_to_cpu(ri->data_crc), crc, ref_offset(fd->raw));
+			je32_to_cpu(c, ri->data_crc), crc, ref_offset(fd->raw));
 		ret = -EIO;
 		goto out_decomprbuf;
 	}
 	jffs2_dbg(2, "Data CRC matches calculated CRC %08x\n", crc);
 	if (ri->compr != JFFS2_COMPR_NONE) {
 		jffs2_dbg(2, "Decompress %d bytes from %p to %d bytes at %p\n",
-			  je32_to_cpu(ri->csize), readbuf,
-			  je32_to_cpu(ri->dsize), decomprbuf);
-		ret = jffs2_decompress(c, f, ri->compr | (ri->usercompr << 8), readbuf, decomprbuf, je32_to_cpu(ri->csize), je32_to_cpu(ri->dsize));
+			  je32_to_cpu(c, ri->csize), readbuf,
+			  je32_to_cpu(c, ri->dsize), decomprbuf);
+		ret = jffs2_decompress(c, f, ri->compr | (ri->usercompr << 8), readbuf, decomprbuf, je32_to_cpu(c, ri->csize), je32_to_cpu(c, ri->dsize));
 		if (ret) {
 			pr_warn("Error: jffs2_decompress returned %d\n", ret);
 			goto out_decomprbuf;
 		}
 	}
 
-	if (len < je32_to_cpu(ri->dsize)) {
+	if (len < je32_to_cpu(c, ri->dsize)) {
 		memcpy(buf, decomprbuf+ofs, len);
 	}
  out_decomprbuf:
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 389ea53ea487..fdca03c9c803 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -594,9 +594,9 @@ static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r
 	BUG_ON(ref_obsolete(ref));
 
 	crc = crc32(0, rd, sizeof(*rd) - 8);
-	if (unlikely(crc != je32_to_cpu(rd->node_crc))) {
+	if (unlikely(crc != je32_to_cpu(c, rd->node_crc))) {
 		JFFS2_NOTICE("header CRC failed on dirent node at %#08x: read %#08x, calculated %#08x\n",
-			     ref_offset(ref), je32_to_cpu(rd->node_crc), crc);
+			     ref_offset(ref), je32_to_cpu(c, rd->node_crc), crc);
 		jffs2_mark_node_obsolete(c, ref);
 		return 0;
 	}
@@ -607,9 +607,9 @@ static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r
 		int len;
 
 		/* Sanity check */
-		if (unlikely(PAD((rd->nsize + sizeof(*rd))) != PAD(je32_to_cpu(rd->totlen)))) {
+		if (unlikely(PAD((rd->nsize + sizeof(*rd))) != PAD(je32_to_cpu(c, rd->totlen)))) {
 			JFFS2_ERROR("illegal nsize in node at %#08x: nsize %#02x, totlen %#04x\n",
-				    ref_offset(ref), rd->nsize, je32_to_cpu(rd->totlen));
+				    ref_offset(ref), rd->nsize, je32_to_cpu(c, rd->totlen));
 			jffs2_mark_node_obsolete(c, ref);
 			return 0;
 		}
@@ -622,7 +622,7 @@ static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r
 		jeb->unchecked_size -= len;
 		c->used_size += len;
 		c->unchecked_size -= len;
-		ref->flash_offset = ref_offset(ref) | dirent_node_state(rd);
+		ref->flash_offset = ref_offset(ref) | dirent_node_state(c, rd);
 		spin_unlock(&c->erase_completion_lock);
 	}
 
@@ -631,17 +631,17 @@ static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r
 		return -ENOMEM;
 
 	fd->raw = ref;
-	fd->version = je32_to_cpu(rd->version);
-	fd->ino = je32_to_cpu(rd->ino);
+	fd->version = je32_to_cpu(c, rd->version);
+	fd->ino = je32_to_cpu(c, rd->ino);
 	fd->type = rd->type;
 
 	if (fd->version > rii->highest_version)
 		rii->highest_version = fd->version;
 
 	/* Pick out the mctime of the latest dirent */
-	if(fd->version > rii->mctime_ver && je32_to_cpu(rd->mctime)) {
+	if(fd->version > rii->mctime_ver && je32_to_cpu(c, rd->mctime)) {
 		rii->mctime_ver = fd->version;
-		rii->latest_mctime = je32_to_cpu(rd->mctime);
+		rii->latest_mctime = je32_to_cpu(c, rd->mctime);
 	}
 
 	/*
@@ -707,9 +707,9 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
 	BUG_ON(ref_obsolete(ref));
 
 	crc = crc32(0, rd, sizeof(*rd) - 8);
-	if (unlikely(crc != je32_to_cpu(rd->node_crc))) {
+	if (unlikely(crc != je32_to_cpu(c, rd->node_crc))) {
 		JFFS2_NOTICE("node CRC failed on dnode at %#08x: read %#08x, calculated %#08x\n",
-			     ref_offset(ref), je32_to_cpu(rd->node_crc), crc);
+			     ref_offset(ref), je32_to_cpu(c, rd->node_crc), crc);
 		jffs2_mark_node_obsolete(c, ref);
 		return 0;
 	}
@@ -721,14 +721,14 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
 	}
 
 	tn->partial_crc = 0;
-	csize = je32_to_cpu(rd->csize);
+	csize = je32_to_cpu(c, rd->csize);
 
 	/* If we've never checked the CRCs on this node, check them now */
 	if (ref_flags(ref) == REF_UNCHECKED) {
 
 		/* Sanity checks */
-		if (unlikely(je32_to_cpu(rd->offset) > je32_to_cpu(rd->isize)) ||
-		    unlikely(PAD(je32_to_cpu(rd->csize) + sizeof(*rd)) != PAD(je32_to_cpu(rd->totlen)))) {
+		if (unlikely(je32_to_cpu(c, rd->offset) > je32_to_cpu(c, rd->isize)) ||
+		    unlikely(PAD(je32_to_cpu(c, rd->csize) + sizeof(*rd)) != PAD(je32_to_cpu(c, rd->totlen)))) {
 			JFFS2_WARNING("inode node header CRC is corrupted at %#08x\n", ref_offset(ref));
 			jffs2_dbg_dump_node(c, ref_offset(ref));
 			jffs2_mark_node_obsolete(c, ref);
@@ -783,9 +783,9 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
 
 			/* If we actually calculated the whole data CRC
 			 * and it is wrong, drop the node. */
-			if (len >= csize && unlikely(tn->partial_crc != je32_to_cpu(rd->data_crc))) {
+			if (len >= csize && unlikely(tn->partial_crc != je32_to_cpu(c, rd->data_crc))) {
 				JFFS2_NOTICE("wrong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n",
-					ref_offset(ref), tn->partial_crc, je32_to_cpu(rd->data_crc));
+					ref_offset(ref), tn->partial_crc, je32_to_cpu(c, rd->data_crc));
 				jffs2_mark_node_obsolete(c, ref);
 				goto free_out;
 			}
@@ -820,9 +820,9 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
 		goto free_out;
 	}
 
-	tn->version = je32_to_cpu(rd->version);
-	tn->fn->ofs = je32_to_cpu(rd->offset);
-	tn->data_crc = je32_to_cpu(rd->data_crc);
+	tn->version = je32_to_cpu(c, rd->version);
+	tn->fn->ofs = je32_to_cpu(c, rd->offset);
+	tn->data_crc = je32_to_cpu(c, rd->data_crc);
 	tn->csize = csize;
 	tn->fn->raw = ref;
 	tn->overlapped = 0;
@@ -832,14 +832,14 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
 
 	/* There was a bug where we wrote hole nodes out with
 	   csize/dsize swapped. Deal with it */
-	if (rd->compr == JFFS2_COMPR_ZERO && !je32_to_cpu(rd->dsize) && csize)
+	if (rd->compr == JFFS2_COMPR_ZERO && !je32_to_cpu(c, rd->dsize) && csize)
 		tn->fn->size = csize;
 	else // normal case...
-		tn->fn->size = je32_to_cpu(rd->dsize);
+		tn->fn->size = je32_to_cpu(c, rd->dsize);
 
 	dbg_readinode2("dnode @%08x: ver %u, offset %#04x, dsize %#04x, csize %#04x\n",
-		       ref_offset(ref), je32_to_cpu(rd->version),
-		       je32_to_cpu(rd->offset), je32_to_cpu(rd->dsize), csize);
+		       ref_offset(ref), je32_to_cpu(c, rd->version),
+		       je32_to_cpu(c, rd->offset), je32_to_cpu(c, rd->dsize), csize);
 
 	ret = jffs2_add_tn_to_tree(c, rii, tn);
 
@@ -850,7 +850,7 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
 		return ret;
 	}
 #ifdef JFFS2_DBG_READINODE2_MESSAGES
-	dbg_readinode2("After adding ver %d:\n", je32_to_cpu(rd->version));
+	dbg_readinode2("After adding ver %d:\n", je32_to_cpu(c, rd->version));
 	tn = tn_first(&rii->tn_root);
 	while (tn) {
 		dbg_readinode2("%p: v %d r 0x%x-0x%x ov %d\n",
@@ -876,37 +876,37 @@ static inline int read_unknown(struct jffs2_sb_info *c, struct jffs2_raw_node_re
 		JFFS2_ERROR("REF_UNCHECKED but unknown node at %#08x\n",
 			    ref_offset(ref));
 		JFFS2_ERROR("Node is {%04x,%04x,%08x,%08x}. Please report this error.\n",
-			    je16_to_cpu(un->magic), je16_to_cpu(un->nodetype),
-			    je32_to_cpu(un->totlen), je32_to_cpu(un->hdr_crc));
+			    je16_to_cpu(c, un->magic), je16_to_cpu(c, un->nodetype),
+			    je32_to_cpu(c, un->totlen), je32_to_cpu(c, un->hdr_crc));
 		jffs2_mark_node_obsolete(c, ref);
 		return 0;
 	}
 
-	un->nodetype = cpu_to_je16(JFFS2_NODE_ACCURATE | je16_to_cpu(un->nodetype));
+	un->nodetype = cpu_to_je16(c, JFFS2_NODE_ACCURATE | je16_to_cpu(c, un->nodetype));
 
-	switch(je16_to_cpu(un->nodetype) & JFFS2_COMPAT_MASK) {
+	switch(je16_to_cpu(c, un->nodetype) & JFFS2_COMPAT_MASK) {
 
 	case JFFS2_FEATURE_INCOMPAT:
 		JFFS2_ERROR("unknown INCOMPAT nodetype %#04X at %#08x\n",
-			    je16_to_cpu(un->nodetype), ref_offset(ref));
+			    je16_to_cpu(c, un->nodetype), ref_offset(ref));
 		/* EEP */
 		BUG();
 		break;
 
 	case JFFS2_FEATURE_ROCOMPAT:
 		JFFS2_ERROR("unknown ROCOMPAT nodetype %#04X at %#08x\n",
-			    je16_to_cpu(un->nodetype), ref_offset(ref));
+			    je16_to_cpu(c, un->nodetype), ref_offset(ref));
 		BUG_ON(!(c->flags & JFFS2_SB_FLAG_RO));
 		break;
 
 	case JFFS2_FEATURE_RWCOMPAT_COPY:
 		JFFS2_NOTICE("unknown RWCOMPAT_COPY nodetype %#04X at %#08x\n",
-			     je16_to_cpu(un->nodetype), ref_offset(ref));
+			     je16_to_cpu(c, un->nodetype), ref_offset(ref));
 		break;
 
 	case JFFS2_FEATURE_RWCOMPAT_DELETE:
 		JFFS2_NOTICE("unknown RWCOMPAT_DELETE nodetype %#04X at %#08x\n",
-			     je16_to_cpu(un->nodetype), ref_offset(ref));
+			     je16_to_cpu(c, un->nodetype), ref_offset(ref));
 		jffs2_mark_node_obsolete(c, ref);
 		return 0;
 	}
@@ -1041,25 +1041,25 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
 		node = (union jffs2_node_union *)buf;
 
 		/* No need to mask in the valid bit; it shouldn't be invalid */
-		if (je32_to_cpu(node->u.hdr_crc) != crc32(0, node, sizeof(node->u)-4)) {
+		if (je32_to_cpu(c, node->u.hdr_crc) != crc32(0, node, sizeof(node->u)-4)) {
 			JFFS2_NOTICE("Node header CRC failed at %#08x. {%04x,%04x,%08x,%08x}\n",
-				     ref_offset(ref), je16_to_cpu(node->u.magic),
-				     je16_to_cpu(node->u.nodetype),
-				     je32_to_cpu(node->u.totlen),
-				     je32_to_cpu(node->u.hdr_crc));
+				     ref_offset(ref), je16_to_cpu(c, node->u.magic),
+				     je16_to_cpu(c, node->u.nodetype),
+				     je32_to_cpu(c, node->u.totlen),
+				     je32_to_cpu(c, node->u.hdr_crc));
 			jffs2_dbg_dump_node(c, ref_offset(ref));
 			jffs2_mark_node_obsolete(c, ref);
 			goto cont;
 		}
-		if (je16_to_cpu(node->u.magic) != JFFS2_MAGIC_BITMASK) {
+		if (je16_to_cpu(c, node->u.magic) != JFFS2_MAGIC_BITMASK) {
 			/* Not a JFFS2 node, whinge and move on */
 			JFFS2_NOTICE("Wrong magic bitmask 0x%04x in node header at %#08x.\n",
-				     je16_to_cpu(node->u.magic), ref_offset(ref));
+				     je16_to_cpu(c, node->u.magic), ref_offset(ref));
 			jffs2_mark_node_obsolete(c, ref);
 			goto cont;
 		}
 
-		switch (je16_to_cpu(node->u.nodetype)) {
+		switch (je16_to_cpu(c, node->u.nodetype)) {
 
 		case JFFS2_NODETYPE_DIRENT:
 
@@ -1191,12 +1191,12 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
 			}
 			JFFS2_NOTICE("but it has children so we fake some modes for it\n");
 		}
-		latest_node->mode = cpu_to_jemode(S_IFDIR|S_IRUGO|S_IWUSR|S_IXUGO);
-		latest_node->version = cpu_to_je32(0);
-		latest_node->atime = latest_node->ctime = latest_node->mtime = cpu_to_je32(0);
-		latest_node->isize = cpu_to_je32(0);
-		latest_node->gid = cpu_to_je16(0);
-		latest_node->uid = cpu_to_je16(0);
+		latest_node->mode = cpu_to_jemode(c, S_IFDIR|S_IRUGO|S_IWUSR|S_IXUGO);
+		latest_node->version = cpu_to_je32(c, 0);
+		latest_node->atime = latest_node->ctime = latest_node->mtime = cpu_to_je32(c, 0);
+		latest_node->isize = cpu_to_je32(c, 0);
+		latest_node->gid = cpu_to_je16(c, 0);
+		latest_node->uid = cpu_to_je16(c, 0);
 		if (f->inocache->state == INO_STATE_READING)
 			jffs2_set_inocache_state(c, f->inocache, INO_STATE_PRESENT);
 		return 0;
@@ -1211,29 +1211,29 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
 	}
 
 	crc = crc32(0, latest_node, sizeof(*latest_node)-8);
-	if (crc != je32_to_cpu(latest_node->node_crc)) {
+	if (crc != je32_to_cpu(c, latest_node->node_crc)) {
 		JFFS2_ERROR("CRC failed for read_inode of inode %u at physical location 0x%x\n",
 			f->inocache->ino, ref_offset(rii.latest_ref));
 		return -EIO;
 	}
 
-	switch(jemode_to_cpu(latest_node->mode) & S_IFMT) {
+	switch(jemode_to_cpu(c, latest_node->mode) & S_IFMT) {
 	case S_IFDIR:
-		if (rii.mctime_ver > je32_to_cpu(latest_node->version)) {
+		if (rii.mctime_ver > je32_to_cpu(c, latest_node->version)) {
 			/* The times in the latest_node are actually older than
 			   mctime in the latest dirent. Cheat. */
-			latest_node->ctime = latest_node->mtime = cpu_to_je32(rii.latest_mctime);
+			latest_node->ctime = latest_node->mtime = cpu_to_je32(c, rii.latest_mctime);
 		}
 		break;
 
 
 	case S_IFREG:
 		/* If it was a regular file, truncate it to the latest node's isize */
-		new_size = jffs2_truncate_fragtree(c, &f->fragtree, je32_to_cpu(latest_node->isize));
-		if (new_size != je32_to_cpu(latest_node->isize)) {
+		new_size = jffs2_truncate_fragtree(c, &f->fragtree, je32_to_cpu(c, latest_node->isize));
+		if (new_size != je32_to_cpu(c, latest_node->isize)) {
 			JFFS2_WARNING("Truncating ino #%u to %d bytes failed because it only had %d bytes to start with!\n",
-				      f->inocache->ino, je32_to_cpu(latest_node->isize), new_size);
-			latest_node->isize = cpu_to_je32(new_size);
+				      f->inocache->ino, je32_to_cpu(c, latest_node->isize), new_size);
+			latest_node->isize = cpu_to_je32(c, new_size);
 		}
 		break;
 
@@ -1242,14 +1242,14 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
 		   Remove this when dwmw2 comes to his senses and stops
 		   symlinks from being an entirely gratuitous special
 		   case. */
-		if (!je32_to_cpu(latest_node->isize))
+		if (!je32_to_cpu(c, latest_node->isize))
 			latest_node->isize = latest_node->dsize;
 
 		if (f->inocache->state != INO_STATE_CHECKING) {
 			/* Symlink's inode data is the target path. Read it and
 			 * keep in RAM to facilitate quick follow symlink
 			 * operation. */
-			uint32_t csize = je32_to_cpu(latest_node->csize);
+			uint32_t csize = je32_to_cpu(c, latest_node->csize);
 			if (csize > JFFS2_MAX_NAME_LEN)
 				return -ENAMETOOLONG;
 			f->target = kmalloc(csize + 1, GFP_KERNEL);
@@ -1281,18 +1281,18 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
 		   kept as the metadata node */
 		if (f->metadata) {
 			JFFS2_ERROR("Argh. Special inode #%u with mode 0%o had metadata node\n",
-			       f->inocache->ino, jemode_to_cpu(latest_node->mode));
+			       f->inocache->ino, jemode_to_cpu(c, latest_node->mode));
 			return -EIO;
 		}
 		if (!frag_first(&f->fragtree)) {
 			JFFS2_ERROR("Argh. Special inode #%u with mode 0%o has no fragments\n",
-			       f->inocache->ino, jemode_to_cpu(latest_node->mode));
+			       f->inocache->ino, jemode_to_cpu(c, latest_node->mode));
 			return -EIO;
 		}
 		/* ASSERT: f->fraglist != NULL */
 		if (frag_next(frag_first(&f->fragtree))) {
 			JFFS2_ERROR("Argh. Special inode #%u with mode 0x%x had more than one node\n",
-			       f->inocache->ino, jemode_to_cpu(latest_node->mode));
+			       f->inocache->ino, jemode_to_cpu(c, latest_node->mode));
 			/* FIXME: Deal with it - check crc32, check for duplicate node, check times and discard the older one */
 			return -EIO;
 		}
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 90431dd613b8..07c74dafb44e 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -333,23 +333,23 @@ static int jffs2_scan_xattr_node(struct jffs2_sb_info *c, struct jffs2_erasebloc
 	int err;
 
 	crc = crc32(0, rx, sizeof(struct jffs2_raw_xattr) - 4);
-	if (crc != je32_to_cpu(rx->node_crc)) {
+	if (crc != je32_to_cpu(c, rx->node_crc)) {
 		JFFS2_WARNING("node CRC failed at %#08x, read=%#08x, calc=%#08x\n",
-			      ofs, je32_to_cpu(rx->node_crc), crc);
-		if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(rx->totlen))))
+			      ofs, je32_to_cpu(c, rx->node_crc), crc);
+		if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(c, rx->totlen))))
 			return err;
 		return 0;
 	}
 
-	xid = je32_to_cpu(rx->xid);
-	version = je32_to_cpu(rx->version);
+	xid = je32_to_cpu(c, rx->xid);
+	version = je32_to_cpu(c, rx->version);
 
 	totlen = PAD(sizeof(struct jffs2_raw_xattr)
-			+ rx->name_len + 1 + je16_to_cpu(rx->value_len));
-	if (totlen != je32_to_cpu(rx->totlen)) {
+			+ rx->name_len + 1 + je16_to_cpu(c, rx->value_len));
+	if (totlen != je32_to_cpu(c, rx->totlen)) {
 		JFFS2_WARNING("node length mismatch at %#08x, read=%u, calc=%u\n",
-			      ofs, je32_to_cpu(rx->totlen), totlen);
-		if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(rx->totlen))))
+			      ofs, je32_to_cpu(c, rx->totlen), totlen);
+		if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(c, rx->totlen))))
 			return err;
 		return 0;
 	}
@@ -367,14 +367,14 @@ static int jffs2_scan_xattr_node(struct jffs2_sb_info *c, struct jffs2_erasebloc
 		xd->version = version;
 		xd->xprefix = rx->xprefix;
 		xd->name_len = rx->name_len;
-		xd->value_len = je16_to_cpu(rx->value_len);
-		xd->data_crc = je32_to_cpu(rx->data_crc);
+		xd->value_len = je16_to_cpu(c, rx->value_len);
+		xd->data_crc = je32_to_cpu(c, rx->data_crc);
 
 		jffs2_link_node_ref(c, jeb, ofs | REF_PRISTINE, totlen, (void *)xd);
 	}
 
 	if (jffs2_sum_active())
-		jffs2_sum_add_xattr_mem(s, rx, ofs - jeb->offset);
+		jffs2_sum_add_xattr_mem(c, s, rx, ofs - jeb->offset);
 	dbg_xattr("scanning xdatum at %#08x (xid=%u, version=%u)\n",
 		  ofs, xd->xid, xd->version);
 	return 0;
@@ -389,19 +389,19 @@ static int jffs2_scan_xref_node(struct jffs2_sb_info *c, struct jffs2_eraseblock
 	int err;
 
 	crc = crc32(0, rr, sizeof(*rr) - 4);
-	if (crc != je32_to_cpu(rr->node_crc)) {
+	if (crc != je32_to_cpu(c, rr->node_crc)) {
 		JFFS2_WARNING("node CRC failed at %#08x, read=%#08x, calc=%#08x\n",
-			      ofs, je32_to_cpu(rr->node_crc), crc);
-		if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(rr->totlen)))))
+			      ofs, je32_to_cpu(c, rr->node_crc), crc);
+		if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(c, rr->totlen)))))
 			return err;
 		return 0;
 	}
 
-	if (PAD(sizeof(struct jffs2_raw_xref)) != je32_to_cpu(rr->totlen)) {
+	if (PAD(sizeof(struct jffs2_raw_xref)) != je32_to_cpu(c, rr->totlen)) {
 		JFFS2_WARNING("node length mismatch at %#08x, read=%u, calc=%zd\n",
-			      ofs, je32_to_cpu(rr->totlen),
+			      ofs, je32_to_cpu(c, rr->totlen),
 			      PAD(sizeof(struct jffs2_raw_xref)));
-		if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(rr->totlen))))
+		if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(c, rr->totlen))))
 			return err;
 		return 0;
 	}
@@ -419,18 +419,18 @@ static int jffs2_scan_xref_node(struct jffs2_sb_info *c, struct jffs2_eraseblock
 	 * used to chain all xattr_ref object. It's re-chained to
 	 * jffs2_inode_cache in jffs2_build_xattr_subsystem() correctly.
 	 */
-	ref->ino = je32_to_cpu(rr->ino);
-	ref->xid = je32_to_cpu(rr->xid);
-	ref->xseqno = je32_to_cpu(rr->xseqno);
+	ref->ino = je32_to_cpu(c, rr->ino);
+	ref->xid = je32_to_cpu(c, rr->xid);
+	ref->xseqno = je32_to_cpu(c, rr->xseqno);
 	if (ref->xseqno > c->highest_xseqno)
 		c->highest_xseqno = (ref->xseqno & ~XREF_DELETE_MARKER);
 	ref->next = c->xref_temp;
 	c->xref_temp = ref;
 
-	jffs2_link_node_ref(c, jeb, ofs | REF_PRISTINE, PAD(je32_to_cpu(rr->totlen)), (void *)ref);
+	jffs2_link_node_ref(c, jeb, ofs | REF_PRISTINE, PAD(je32_to_cpu(c, rr->totlen)), (void *)ref);
 
 	if (jffs2_sum_active())
-		jffs2_sum_add_xref_mem(s, rr, ofs - jeb->offset);
+		jffs2_sum_add_xref_mem(c, s, rr, ofs - jeb->offset);
 	dbg_xattr("scan xref at %#08x (xid=%u, ino=%u)\n",
 		  ofs, ref->xid, ref->ino);
 	return 0;
@@ -487,9 +487,9 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 		if (!buf_size) {
 			/* XIP case. Just look, point at the summary if it's there */
 			sm = (void *)buf + c->sector_size - sizeof(*sm);
-			if (je32_to_cpu(sm->magic) == JFFS2_SUM_MAGIC) {
-				sumptr = buf + je32_to_cpu(sm->offset);
-				sumlen = c->sector_size - je32_to_cpu(sm->offset);
+			if (je32_to_cpu(c, sm->magic) == JFFS2_SUM_MAGIC) {
+				sumptr = buf + je32_to_cpu(c, sm->offset);
+				sumlen = c->sector_size - je32_to_cpu(c, sm->offset);
 			}
 		} else {
 			/* If NAND flash, read a whole page of it. Else just the end */
@@ -506,8 +506,8 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 				return err;
 
 			sm = (void *)buf + buf_size - sizeof(*sm);
-			if (je32_to_cpu(sm->magic) == JFFS2_SUM_MAGIC) {
-				sumlen = c->sector_size - je32_to_cpu(sm->offset);
+			if (je32_to_cpu(c, sm->magic) == JFFS2_SUM_MAGIC) {
+				sumlen = c->sector_size - je32_to_cpu(c, sm->offset);
 				sumptr = buf + buf_size - sumlen;
 
 				/* sm->offset maybe wrong but MAGIC maybe right */
@@ -715,7 +715,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 			goto more_empty;
 		}
 
-		if (ofs == jeb->offset && je16_to_cpu(node->magic) == KSAMTIB_CIGAM_2SFFJ) {
+		if (ofs == jeb->offset && je16_to_cpu(c, node->magic) == KSAMTIB_CIGAM_2SFFJ) {
 			pr_warn("Magic bitmask is backwards at offset 0x%08x. Wrong endian filesystem?\n",
 				ofs);
 			if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
@@ -723,14 +723,14 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 			ofs += 4;
 			continue;
 		}
-		if (je16_to_cpu(node->magic) == JFFS2_DIRTY_BITMASK) {
+		if (je16_to_cpu(c, node->magic) == JFFS2_DIRTY_BITMASK) {
 			jffs2_dbg(1, "Dirty bitmask at 0x%08x\n", ofs);
 			if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
 				return err;
 			ofs += 4;
 			continue;
 		}
-		if (je16_to_cpu(node->magic) == JFFS2_OLD_MAGIC_BITMASK) {
+		if (je16_to_cpu(c, node->magic) == JFFS2_OLD_MAGIC_BITMASK) {
 			pr_warn("Old JFFS2 bitmask found at 0x%08x\n", ofs);
 			pr_warn("You cannot use older JFFS2 filesystems with newer kernels\n");
 			if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
@@ -738,12 +738,12 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 			ofs += 4;
 			continue;
 		}
-		if (je16_to_cpu(node->magic) != JFFS2_MAGIC_BITMASK) {
+		if (je16_to_cpu(c, node->magic) != JFFS2_MAGIC_BITMASK) {
 			/* OK. We're out of possibilities. Whinge and move on */
 			noisy_printk(&noise, "%s(): Magic bitmask 0x%04x not found at 0x%08x: 0x%04x instead\n",
 				     __func__,
 				     JFFS2_MAGIC_BITMASK, ofs,
-				     je16_to_cpu(node->magic));
+				     je16_to_cpu(c, node->magic));
 			if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
 				return err;
 			ofs += 4;
@@ -751,17 +751,17 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 		}
 		/* We seem to have a node of sorts. Check the CRC */
 		crcnode.magic = node->magic;
-		crcnode.nodetype = cpu_to_je16( je16_to_cpu(node->nodetype) | JFFS2_NODE_ACCURATE);
+		crcnode.nodetype = cpu_to_je16(c, je16_to_cpu(c, node->nodetype) | JFFS2_NODE_ACCURATE);
 		crcnode.totlen = node->totlen;
 		hdr_crc = crc32(0, &crcnode, sizeof(crcnode)-4);
 
-		if (hdr_crc != je32_to_cpu(node->hdr_crc)) {
+		if (hdr_crc != je32_to_cpu(c, node->hdr_crc)) {
 			noisy_printk(&noise, "%s(): Node at 0x%08x {0x%04x, 0x%04x, 0x%08x) has invalid CRC 0x%08x (calculated 0x%08x)\n",
 				     __func__,
-				     ofs, je16_to_cpu(node->magic),
-				     je16_to_cpu(node->nodetype),
-				     je32_to_cpu(node->totlen),
-				     je32_to_cpu(node->hdr_crc),
+				     ofs, je16_to_cpu(c, node->magic),
+				     je16_to_cpu(c, node->nodetype),
+				     je32_to_cpu(c, node->totlen),
+				     je32_to_cpu(c, node->hdr_crc),
 				     hdr_crc);
 			if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
 				return err;
@@ -769,10 +769,10 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 			continue;
 		}
 
-		if (ofs + je32_to_cpu(node->totlen) > jeb->offset + c->sector_size) {
+		if (ofs + je32_to_cpu(c, node->totlen) > jeb->offset + c->sector_size) {
 			/* Eep. Node goes over the end of the erase block. */
 			pr_warn("Node at 0x%08x with length 0x%08x would run over the end of the erase block\n",
-				ofs, je32_to_cpu(node->totlen));
+				ofs, je32_to_cpu(c, node->totlen));
 			pr_warn("Perhaps the file system was created with the wrong erase size?\n");
 			if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
 				return err;
@@ -780,17 +780,17 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 			continue;
 		}
 
-		if (!(je16_to_cpu(node->nodetype) & JFFS2_NODE_ACCURATE)) {
+		if (!(je16_to_cpu(c, node->nodetype) & JFFS2_NODE_ACCURATE)) {
 			/* Wheee. This is an obsoleted node */
 			jffs2_dbg(2, "Node at 0x%08x is obsolete. Skipping\n",
 				  ofs);
-			if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(node->totlen)))))
+			if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(c, node->totlen)))))
 				return err;
-			ofs += PAD(je32_to_cpu(node->totlen));
+			ofs += PAD(je32_to_cpu(c, node->totlen));
 			continue;
 		}
 
-		switch(je16_to_cpu(node->nodetype)) {
+		switch(je16_to_cpu(c, node->nodetype)) {
 		case JFFS2_NODETYPE_INODE:
 			if (buf_ofs + buf_len < ofs + sizeof(struct jffs2_raw_inode)) {
 				buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs);
@@ -805,14 +805,14 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 			}
 			err = jffs2_scan_inode_node(c, jeb, (void *)node, ofs, s);
 			if (err) return err;
-			ofs += PAD(je32_to_cpu(node->totlen));
+			ofs += PAD(je32_to_cpu(c, node->totlen));
 			break;
 
 		case JFFS2_NODETYPE_DIRENT:
-			if (buf_ofs + buf_len < ofs + je32_to_cpu(node->totlen)) {
+			if (buf_ofs + buf_len < ofs + je32_to_cpu(c, node->totlen)) {
 				buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs);
 				jffs2_dbg(1, "Fewer than %d bytes (dirent node) left to end of buf. Reading 0x%x at 0x%08x\n",
-					  je32_to_cpu(node->totlen), buf_len,
+					  je32_to_cpu(c, node->totlen), buf_len,
 					  ofs);
 				err = jffs2_fill_scan_buf(c, buf, ofs, buf_len);
 				if (err)
@@ -822,15 +822,15 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 			}
 			err = jffs2_scan_dirent_node(c, jeb, (void *)node, ofs, s);
 			if (err) return err;
-			ofs += PAD(je32_to_cpu(node->totlen));
+			ofs += PAD(je32_to_cpu(c, node->totlen));
 			break;
 
 #ifdef CONFIG_JFFS2_FS_XATTR
 		case JFFS2_NODETYPE_XATTR:
-			if (buf_ofs + buf_len < ofs + je32_to_cpu(node->totlen)) {
+			if (buf_ofs + buf_len < ofs + je32_to_cpu(c, node->totlen)) {
 				buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs);
 				jffs2_dbg(1, "Fewer than %d bytes (xattr node) left to end of buf. Reading 0x%x at 0x%08x\n",
-					  je32_to_cpu(node->totlen), buf_len,
+					  je32_to_cpu(c, node->totlen), buf_len,
 					  ofs);
 				err = jffs2_fill_scan_buf(c, buf, ofs, buf_len);
 				if (err)
@@ -841,13 +841,13 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 			err = jffs2_scan_xattr_node(c, jeb, (void *)node, ofs, s);
 			if (err)
 				return err;
-			ofs += PAD(je32_to_cpu(node->totlen));
+			ofs += PAD(je32_to_cpu(c, node->totlen));
 			break;
 		case JFFS2_NODETYPE_XREF:
-			if (buf_ofs + buf_len < ofs + je32_to_cpu(node->totlen)) {
+			if (buf_ofs + buf_len < ofs + je32_to_cpu(c, node->totlen)) {
 				buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs);
 				jffs2_dbg(1, "Fewer than %d bytes (xref node) left to end of buf. Reading 0x%x at 0x%08x\n",
-					  je32_to_cpu(node->totlen), buf_len,
+					  je32_to_cpu(c, node->totlen), buf_len,
 					  ofs);
 				err = jffs2_fill_scan_buf(c, buf, ofs, buf_len);
 				if (err)
@@ -858,15 +858,15 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 			err = jffs2_scan_xref_node(c, jeb, (void *)node, ofs, s);
 			if (err)
 				return err;
-			ofs += PAD(je32_to_cpu(node->totlen));
+			ofs += PAD(je32_to_cpu(c, node->totlen));
 			break;
 #endif	/* CONFIG_JFFS2_FS_XATTR */
 
 		case JFFS2_NODETYPE_CLEANMARKER:
 			jffs2_dbg(1, "CLEANMARKER node found at 0x%08x\n", ofs);
-			if (je32_to_cpu(node->totlen) != c->cleanmarker_size) {
+			if (je32_to_cpu(c, node->totlen) != c->cleanmarker_size) {
 				pr_notice("CLEANMARKER node found at 0x%08x has totlen 0x%x != normal 0x%x\n",
-					  ofs, je32_to_cpu(node->totlen),
+					  ofs, je32_to_cpu(c, node->totlen),
 					  c->cleanmarker_size);
 				if ((err = jffs2_scan_dirty_space(c, jeb, PAD(sizeof(struct jffs2_unknown_node)))))
 					return err;
@@ -886,47 +886,47 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 
 		case JFFS2_NODETYPE_PADDING:
 			if (jffs2_sum_active())
-				jffs2_sum_add_padding_mem(s, je32_to_cpu(node->totlen));
-			if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(node->totlen)))))
+				jffs2_sum_add_padding_mem(s, je32_to_cpu(c, node->totlen));
+			if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(c, node->totlen)))))
 				return err;
-			ofs += PAD(je32_to_cpu(node->totlen));
+			ofs += PAD(je32_to_cpu(c, node->totlen));
 			break;
 
 		default:
-			switch (je16_to_cpu(node->nodetype) & JFFS2_COMPAT_MASK) {
+			switch (je16_to_cpu(c, node->nodetype) & JFFS2_COMPAT_MASK) {
 			case JFFS2_FEATURE_ROCOMPAT:
 				pr_notice("Read-only compatible feature node (0x%04x) found at offset 0x%08x\n",
-					  je16_to_cpu(node->nodetype), ofs);
+					  je16_to_cpu(c, node->nodetype), ofs);
 				c->flags |= JFFS2_SB_FLAG_RO;
 				if (!(jffs2_is_readonly(c)))
 					return -EROFS;
-				if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(node->totlen)))))
+				if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(c, node->totlen)))))
 					return err;
-				ofs += PAD(je32_to_cpu(node->totlen));
+				ofs += PAD(je32_to_cpu(c, node->totlen));
 				break;
 
 			case JFFS2_FEATURE_INCOMPAT:
 				pr_notice("Incompatible feature node (0x%04x) found at offset 0x%08x\n",
-					  je16_to_cpu(node->nodetype), ofs);
+					  je16_to_cpu(c, node->nodetype), ofs);
 				return -EINVAL;
 
 			case JFFS2_FEATURE_RWCOMPAT_DELETE:
 				jffs2_dbg(1, "Unknown but compatible feature node (0x%04x) found at offset 0x%08x\n",
-					  je16_to_cpu(node->nodetype), ofs);
-				if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(node->totlen)))))
+					  je16_to_cpu(c, node->nodetype), ofs);
+				if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(c, node->totlen)))))
 					return err;
-				ofs += PAD(je32_to_cpu(node->totlen));
+				ofs += PAD(je32_to_cpu(c, node->totlen));
 				break;
 
 			case JFFS2_FEATURE_RWCOMPAT_COPY: {
 				jffs2_dbg(1, "Unknown but compatible feature node (0x%04x) found at offset 0x%08x\n",
-					  je16_to_cpu(node->nodetype), ofs);
+					  je16_to_cpu(c, node->nodetype), ofs);
 
-				jffs2_link_node_ref(c, jeb, ofs | REF_PRISTINE, PAD(je32_to_cpu(node->totlen)), NULL);
+				jffs2_link_node_ref(c, jeb, ofs | REF_PRISTINE, PAD(je32_to_cpu(c, node->totlen)), NULL);
 
 				/* We can't summarise nodes we don't grok */
 				jffs2_sum_disable_collecting(s);
-				ofs += PAD(je32_to_cpu(node->totlen));
+				ofs += PAD(je32_to_cpu(c, node->totlen));
 				break;
 				}
 			}
@@ -986,7 +986,7 @@ static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_erasebloc
 				 struct jffs2_raw_inode *ri, uint32_t ofs, struct jffs2_summary *s)
 {
 	struct jffs2_inode_cache *ic;
-	uint32_t crc, ino = je32_to_cpu(ri->ino);
+	uint32_t crc, ino = je32_to_cpu(c, ri->ino);
 
 	jffs2_dbg(1, "%s(): Node at 0x%08x\n", __func__, ofs);
 
@@ -1001,15 +1001,15 @@ static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_erasebloc
 
 	/* Check the node CRC in any case. */
 	crc = crc32(0, ri, sizeof(*ri)-8);
-	if (crc != je32_to_cpu(ri->node_crc)) {
+	if (crc != je32_to_cpu(c, ri->node_crc)) {
 		pr_notice("%s(): CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
-			  __func__, ofs, je32_to_cpu(ri->node_crc), crc);
+			  __func__, ofs, je32_to_cpu(c, ri->node_crc), crc);
 		/*
 		 * We believe totlen because the CRC on the node
 		 * _header_ was OK, just the node itself failed.
 		 */
 		return jffs2_scan_dirty_space(c, jeb,
-					      PAD(je32_to_cpu(ri->totlen)));
+					      PAD(je32_to_cpu(c, ri->totlen)));
 	}
 
 	ic = jffs2_get_ino_cache(c, ino);
@@ -1020,17 +1020,17 @@ static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_erasebloc
 	}
 
 	/* Wheee. It worked */
-	jffs2_link_node_ref(c, jeb, ofs | REF_UNCHECKED, PAD(je32_to_cpu(ri->totlen)), ic);
+	jffs2_link_node_ref(c, jeb, ofs | REF_UNCHECKED, PAD(je32_to_cpu(c, ri->totlen)), ic);
 
 	jffs2_dbg(1, "Node is ino #%u, version %d. Range 0x%x-0x%x\n",
-		  je32_to_cpu(ri->ino), je32_to_cpu(ri->version),
-		  je32_to_cpu(ri->offset),
-		  je32_to_cpu(ri->offset)+je32_to_cpu(ri->dsize));
+		  je32_to_cpu(c, ri->ino), je32_to_cpu(c, ri->version),
+		  je32_to_cpu(c, ri->offset),
+		  je32_to_cpu(c, ri->offset)+je32_to_cpu(c, ri->dsize));
 
-	pseudo_random += je32_to_cpu(ri->version);
+	pseudo_random += je32_to_cpu(c, ri->version);
 
 	if (jffs2_sum_active()) {
-		jffs2_sum_add_inode_mem(s, ri, ofs - jeb->offset);
+		jffs2_sum_add_inode_mem(c, s, ri, ofs - jeb->offset);
 	}
 
 	return 0;
@@ -1051,16 +1051,16 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
 	   mask in the ACCURATE bit any more. */
 	crc = crc32(0, rd, sizeof(*rd)-8);
 
-	if (crc != je32_to_cpu(rd->node_crc)) {
+	if (crc != je32_to_cpu(c, rd->node_crc)) {
 		pr_notice("%s(): Node CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
-			  __func__, ofs, je32_to_cpu(rd->node_crc), crc);
+			  __func__, ofs, je32_to_cpu(c, rd->node_crc), crc);
 		/* We believe totlen because the CRC on the node _header_ was OK, just the node itself failed. */
-		if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(rd->totlen)))))
+		if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(c, rd->totlen)))))
 			return err;
 		return 0;
 	}
 
-	pseudo_random += je32_to_cpu(rd->version);
+	pseudo_random += je32_to_cpu(c, rd->version);
 
 	/* Should never happen. Did. (OLPC trac #4184)*/
 	checkedlen = strnlen(rd->name, rd->nsize);
@@ -1076,36 +1076,36 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
 	fd->name[checkedlen] = 0;
 
 	crc = crc32(0, fd->name, rd->nsize);
-	if (crc != je32_to_cpu(rd->name_crc)) {
+	if (crc != je32_to_cpu(c, rd->name_crc)) {
 		pr_notice("%s(): Name CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
-			  __func__, ofs, je32_to_cpu(rd->name_crc), crc);
+			  __func__, ofs, je32_to_cpu(c, rd->name_crc), crc);
 		jffs2_dbg(1, "Name for which CRC failed is (now) '%s', ino #%d\n",
-			  fd->name, je32_to_cpu(rd->ino));
+			  fd->name, je32_to_cpu(c, rd->ino));
 		jffs2_free_full_dirent(fd);
 		/* FIXME: Why do we believe totlen? */
 		/* We believe totlen because the CRC on the node _header_ was OK, just the name failed. */
-		if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(rd->totlen)))))
+		if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(c, rd->totlen)))))
 			return err;
 		return 0;
 	}
-	ic = jffs2_scan_make_ino_cache(c, je32_to_cpu(rd->pino));
+	ic = jffs2_scan_make_ino_cache(c, je32_to_cpu(c, rd->pino));
 	if (!ic) {
 		jffs2_free_full_dirent(fd);
 		return -ENOMEM;
 	}
 
-	fd->raw = jffs2_link_node_ref(c, jeb, ofs | dirent_node_state(rd),
-				      PAD(je32_to_cpu(rd->totlen)), ic);
+	fd->raw = jffs2_link_node_ref(c, jeb, ofs | dirent_node_state(c, rd),
+				      PAD(je32_to_cpu(c, rd->totlen)), ic);
 
 	fd->next = NULL;
-	fd->version = je32_to_cpu(rd->version);
-	fd->ino = je32_to_cpu(rd->ino);
+	fd->version = je32_to_cpu(c, rd->version);
+	fd->ino = je32_to_cpu(c, rd->ino);
 	fd->nhash = full_name_hash(NULL, fd->name, checkedlen);
 	fd->type = rd->type;
 	jffs2_add_fd_to_list(c, fd, &ic->scan_dents);
 
 	if (jffs2_sum_active()) {
-		jffs2_sum_add_dirent_mem(s, rd, ofs - jeb->offset);
+		jffs2_sum_add_dirent_mem(c, s, rd, ofs - jeb->offset);
 	}
 
 	return 0;
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c
index be7c8a6a5748..11998d98861b 100644
--- a/fs/jffs2/summary.c
+++ b/fs/jffs2/summary.c
@@ -60,7 +60,8 @@ void jffs2_sum_exit(struct jffs2_sb_info *c)
 	c->summary = NULL;
 }
 
-static int jffs2_sum_add_mem(struct jffs2_summary *s, union jffs2_sum_mem *item)
+static int jffs2_sum_add_mem(struct jffs2_sb_info *c, struct jffs2_summary *s,
+						union jffs2_sum_mem *item)
 {
 	if (!s->sum_list_head)
 		s->sum_list_head = (union jffs2_sum_mem *) item;
@@ -68,25 +69,25 @@ static int jffs2_sum_add_mem(struct jffs2_summary *s, union jffs2_sum_mem *item)
 		s->sum_list_tail->u.next = (union jffs2_sum_mem *) item;
 	s->sum_list_tail = (union jffs2_sum_mem *) item;
 
-	switch (je16_to_cpu(item->u.nodetype)) {
+	switch (je16_to_cpu(c, item->u.nodetype)) {
 		case JFFS2_NODETYPE_INODE:
 			s->sum_size += JFFS2_SUMMARY_INODE_SIZE;
 			s->sum_num++;
 			dbg_summary("inode (%u) added to summary\n",
-						je32_to_cpu(item->i.inode));
+						je32_to_cpu(c, item->i.inode));
 			break;
 		case JFFS2_NODETYPE_DIRENT:
 			s->sum_size += JFFS2_SUMMARY_DIRENT_SIZE(item->d.nsize);
 			s->sum_num++;
 			dbg_summary("dirent (%u) added to summary\n",
-						je32_to_cpu(item->d.ino));
+						je32_to_cpu(c, item->d.ino));
 			break;
 #ifdef CONFIG_JFFS2_FS_XATTR
 		case JFFS2_NODETYPE_XATTR:
 			s->sum_size += JFFS2_SUMMARY_XATTR_SIZE;
 			s->sum_num++;
 			dbg_summary("xattr (xid=%u, version=%u) added to summary\n",
-				    je32_to_cpu(item->x.xid), je32_to_cpu(item->x.version));
+				    je32_to_cpu(c, item->x.xid), je32_to_cpu(c, item->x.version));
 			break;
 		case JFFS2_NODETYPE_XREF:
 			s->sum_size += JFFS2_SUMMARY_XREF_SIZE;
@@ -96,7 +97,7 @@ static int jffs2_sum_add_mem(struct jffs2_summary *s, union jffs2_sum_mem *item)
 #endif
 		default:
 			JFFS2_WARNING("UNKNOWN node type %u\n",
-					    je16_to_cpu(item->u.nodetype));
+					    je16_to_cpu(c, item->u.nodetype));
 			return 1;
 	}
 	return 0;
@@ -112,8 +113,8 @@ int jffs2_sum_add_padding_mem(struct jffs2_summary *s, uint32_t size)
 	return 0;
 }
 
-int jffs2_sum_add_inode_mem(struct jffs2_summary *s, struct jffs2_raw_inode *ri,
-				uint32_t ofs)
+int jffs2_sum_add_inode_mem(struct jffs2_sb_info *c, struct jffs2_summary *s,
+				struct jffs2_raw_inode *ri, uint32_t ofs)
 {
 	struct jffs2_sum_inode_mem *temp = kmalloc(sizeof(struct jffs2_sum_inode_mem), GFP_KERNEL);
 
@@ -123,15 +124,15 @@ int jffs2_sum_add_inode_mem(struct jffs2_summary *s, struct jffs2_raw_inode *ri,
 	temp->nodetype = ri->nodetype;
 	temp->inode = ri->ino;
 	temp->version = ri->version;
-	temp->offset = cpu_to_je32(ofs); /* relative offset from the beginning of the jeb */
+	temp->offset = cpu_to_je32(c, ofs); /* relative offset from the beginning of the jeb */
 	temp->totlen = ri->totlen;
 	temp->next = NULL;
 
-	return jffs2_sum_add_mem(s, (union jffs2_sum_mem *)temp);
+	return jffs2_sum_add_mem(c, s, (union jffs2_sum_mem *)temp);
 }
 
-int jffs2_sum_add_dirent_mem(struct jffs2_summary *s, struct jffs2_raw_dirent *rd,
-				uint32_t ofs)
+int jffs2_sum_add_dirent_mem(struct jffs2_sb_info *c, struct jffs2_summary *s,
+				struct jffs2_raw_dirent *rd, uint32_t ofs)
 {
 	struct jffs2_sum_dirent_mem *temp =
 		kmalloc(sizeof(struct jffs2_sum_dirent_mem) + rd->nsize, GFP_KERNEL);
@@ -141,7 +142,7 @@ int jffs2_sum_add_dirent_mem(struct jffs2_summary *s, struct jffs2_raw_dirent *r
 
 	temp->nodetype = rd->nodetype;
 	temp->totlen = rd->totlen;
-	temp->offset = cpu_to_je32(ofs);	/* relative from the beginning of the jeb */
+	temp->offset = cpu_to_je32(c, ofs);	/* relative from the beginning of the jeb */
 	temp->pino = rd->pino;
 	temp->version = rd->version;
 	temp->ino = rd->ino;
@@ -151,11 +152,12 @@ int jffs2_sum_add_dirent_mem(struct jffs2_summary *s, struct jffs2_raw_dirent *r
 
 	memcpy(temp->name, rd->name, rd->nsize);
 
-	return jffs2_sum_add_mem(s, (union jffs2_sum_mem *)temp);
+	return jffs2_sum_add_mem(c, s, (union jffs2_sum_mem *)temp);
 }
 
 #ifdef CONFIG_JFFS2_FS_XATTR
-int jffs2_sum_add_xattr_mem(struct jffs2_summary *s, struct jffs2_raw_xattr *rx, uint32_t ofs)
+int jffs2_sum_add_xattr_mem(struct jffs2_sb_info *c, struct jffs2_summary *s,
+				struct jffs2_raw_xattr *rx, uint32_t ofs)
 {
 	struct jffs2_sum_xattr_mem *temp;
 
@@ -166,14 +168,15 @@ int jffs2_sum_add_xattr_mem(struct jffs2_summary *s, struct jffs2_raw_xattr *rx,
 	temp->nodetype = rx->nodetype;
 	temp->xid = rx->xid;
 	temp->version = rx->version;
-	temp->offset = cpu_to_je32(ofs);
+	temp->offset = cpu_to_je32(c, ofs);
 	temp->totlen = rx->totlen;
 	temp->next = NULL;
 
-	return jffs2_sum_add_mem(s, (union jffs2_sum_mem *)temp);
+	return jffs2_sum_add_mem(c, s, (union jffs2_sum_mem *)temp);
 }
 
-int jffs2_sum_add_xref_mem(struct jffs2_summary *s, struct jffs2_raw_xref *rr, uint32_t ofs)
+int jffs2_sum_add_xref_mem(struct jffs2_sb_info *c, struct jffs2_summary *s,
+				struct jffs2_raw_xref *rr, uint32_t ofs)
 {
 	struct jffs2_sum_xref_mem *temp;
 
@@ -182,10 +185,10 @@ int jffs2_sum_add_xref_mem(struct jffs2_summary *s, struct jffs2_raw_xref *rr, u
 		return -ENOMEM;
 
 	temp->nodetype = rr->nodetype;
-	temp->offset = cpu_to_je32(ofs);
+	temp->offset = cpu_to_je32(c, ofs);
 	temp->next = NULL;
 
-	return jffs2_sum_add_mem(s, (union jffs2_sum_mem *)temp);
+	return jffs2_sum_add_mem(c, s, (union jffs2_sum_mem *)temp);
 }
 #endif
 /* Cleanup every collected summary information */
@@ -260,7 +263,7 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs,
 	jeb = &c->blocks[ofs / c->sector_size];
 	ofs -= jeb->offset;
 
-	switch (je16_to_cpu(node->u.nodetype)) {
+	switch (je16_to_cpu(c, node->u.nodetype)) {
 		case JFFS2_NODETYPE_INODE: {
 			struct jffs2_sum_inode_mem *temp =
 				kmalloc(sizeof(struct jffs2_sum_inode_mem), GFP_KERNEL);
@@ -271,11 +274,11 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs,
 			temp->nodetype = node->i.nodetype;
 			temp->inode = node->i.ino;
 			temp->version = node->i.version;
-			temp->offset = cpu_to_je32(ofs);
+			temp->offset = cpu_to_je32(c, ofs);
 			temp->totlen = node->i.totlen;
 			temp->next = NULL;
 
-			return jffs2_sum_add_mem(c->summary, (union jffs2_sum_mem *)temp);
+			return jffs2_sum_add_mem(c, c->summary, (union jffs2_sum_mem *)temp);
 		}
 
 		case JFFS2_NODETYPE_DIRENT: {
@@ -287,7 +290,7 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs,
 
 			temp->nodetype = node->d.nodetype;
 			temp->totlen = node->d.totlen;
-			temp->offset = cpu_to_je32(ofs);
+			temp->offset = cpu_to_je32(c, ofs);
 			temp->pino = node->d.pino;
 			temp->version = node->d.version;
 			temp->ino = node->d.ino;
@@ -309,7 +312,7 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs,
 					break;
 			}
 
-			return jffs2_sum_add_mem(c->summary, (union jffs2_sum_mem *)temp);
+			return jffs2_sum_add_mem(c, c->summary, (union jffs2_sum_mem *)temp);
 		}
 #ifdef CONFIG_JFFS2_FS_XATTR
 		case JFFS2_NODETYPE_XATTR: {
@@ -322,10 +325,10 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs,
 			temp->xid = node->x.xid;
 			temp->version = node->x.version;
 			temp->totlen = node->x.totlen;
-			temp->offset = cpu_to_je32(ofs);
+			temp->offset = cpu_to_je32(c, ofs);
 			temp->next = NULL;
 
-			return jffs2_sum_add_mem(c->summary, (union jffs2_sum_mem *)temp);
+			return jffs2_sum_add_mem(c, c->summary, (union jffs2_sum_mem *)temp);
 		}
 		case JFFS2_NODETYPE_XREF: {
 			struct jffs2_sum_xref_mem *temp;
@@ -333,15 +336,15 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs,
 			if (!temp)
 				goto no_mem;
 			temp->nodetype = node->r.nodetype;
-			temp->offset = cpu_to_je32(ofs);
+			temp->offset = cpu_to_je32(c, ofs);
 			temp->next = NULL;
 
-			return jffs2_sum_add_mem(c->summary, (union jffs2_sum_mem *)temp);
+			return jffs2_sum_add_mem(c, c->summary, (union jffs2_sum_mem *)temp);
 		}
 #endif
 		case JFFS2_NODETYPE_PADDING:
 			dbg_summary("node PADDING\n");
-			c->summary->sum_padded += je32_to_cpu(node->u.totlen);
+			c->summary->sum_padded += je32_to_cpu(c, node->u.totlen);
 			break;
 
 		case JFFS2_NODETYPE_CLEANMARKER:
@@ -394,7 +397,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
 
 	sp = summary->sum;
 
-	for (i=0; i<je32_to_cpu(summary->sum_num); i++) {
+	for (i=0; i<je32_to_cpu(c, summary->sum_num); i++) {
 		dbg_summary("processing summary index %d\n", i);
 
 		cond_resched();
@@ -404,16 +407,16 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
 		if (err)
 			return err;
 
-		switch (je16_to_cpu(((struct jffs2_sum_unknown_flash *)sp)->nodetype)) {
+		switch (je16_to_cpu(c, ((struct jffs2_sum_unknown_flash *)sp)->nodetype)) {
 			case JFFS2_NODETYPE_INODE: {
 				struct jffs2_sum_inode_flash *spi;
 				spi = sp;
 
-				ino = je32_to_cpu(spi->inode);
+				ino = je32_to_cpu(c, spi->inode);
 
 				dbg_summary("Inode at 0x%08x-0x%08x\n",
-					    jeb->offset + je32_to_cpu(spi->offset),
-					    jeb->offset + je32_to_cpu(spi->offset) + je32_to_cpu(spi->totlen));
+					    jeb->offset + je32_to_cpu(c, spi->offset),
+					    jeb->offset + je32_to_cpu(c, spi->offset) + je32_to_cpu(c, spi->totlen));
 
 				ic = jffs2_scan_make_ino_cache(c, ino);
 				if (!ic) {
@@ -421,10 +424,10 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
 					return -ENOMEM;
 				}
 
-				sum_link_node_ref(c, jeb, je32_to_cpu(spi->offset) | REF_UNCHECKED,
-						  PAD(je32_to_cpu(spi->totlen)), ic);
+				sum_link_node_ref(c, jeb, je32_to_cpu(c, spi->offset) | REF_UNCHECKED,
+						  PAD(je32_to_cpu(c, spi->totlen)), ic);
 
-				*pseudo_random += je32_to_cpu(spi->version);
+				*pseudo_random += je32_to_cpu(c, spi->version);
 
 				sp += JFFS2_SUMMARY_INODE_SIZE;
 
@@ -437,8 +440,8 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
 				spd = sp;
 
 				dbg_summary("Dirent at 0x%08x-0x%08x\n",
-					    jeb->offset + je32_to_cpu(spd->offset),
-					    jeb->offset + je32_to_cpu(spd->offset) + je32_to_cpu(spd->totlen));
+					    jeb->offset + je32_to_cpu(c, spd->offset),
+					    jeb->offset + je32_to_cpu(c, spd->offset) + je32_to_cpu(c, spd->totlen));
 
 
 				/* This should never happen, but https://dev.laptop.org/ticket/4184 */
@@ -446,13 +449,13 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
 				if (!checkedlen) {
 					pr_err("Dirent at %08x has zero at start of name. Aborting mount.\n",
 					       jeb->offset +
-					       je32_to_cpu(spd->offset));
+					       je32_to_cpu(c, spd->offset));
 					return -EIO;
 				}
 				if (checkedlen < spd->nsize) {
 					pr_err("Dirent at %08x has zeroes in name. Truncating to %d chars\n",
 					       jeb->offset +
-					       je32_to_cpu(spd->offset),
+					       je32_to_cpu(c, spd->offset),
 					       checkedlen);
 				}
 
@@ -464,24 +467,24 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
 				memcpy(&fd->name, spd->name, checkedlen);
 				fd->name[checkedlen] = 0;
 
-				ic = jffs2_scan_make_ino_cache(c, je32_to_cpu(spd->pino));
+				ic = jffs2_scan_make_ino_cache(c, je32_to_cpu(c, spd->pino));
 				if (!ic) {
 					jffs2_free_full_dirent(fd);
 					return -ENOMEM;
 				}
 
-				fd->raw = sum_link_node_ref(c, jeb,  je32_to_cpu(spd->offset) | REF_UNCHECKED,
-							    PAD(je32_to_cpu(spd->totlen)), ic);
+				fd->raw = sum_link_node_ref(c, jeb,  je32_to_cpu(c, spd->offset) | REF_UNCHECKED,
+							    PAD(je32_to_cpu(c, spd->totlen)), ic);
 
 				fd->next = NULL;
-				fd->version = je32_to_cpu(spd->version);
-				fd->ino = je32_to_cpu(spd->ino);
+				fd->version = je32_to_cpu(c, spd->version);
+				fd->ino = je32_to_cpu(c, spd->ino);
 				fd->nhash = full_name_hash(NULL, fd->name, checkedlen);
 				fd->type = spd->type;
 
 				jffs2_add_fd_to_list(c, fd, &ic->scan_dents);
 
-				*pseudo_random += je32_to_cpu(spd->version);
+				*pseudo_random += je32_to_cpu(c, spd->version);
 
 				sp += JFFS2_SUMMARY_DIRENT_SIZE(spd->nsize);
 
@@ -494,27 +497,27 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
 
 				spx = (struct jffs2_sum_xattr_flash *)sp;
 				dbg_summary("xattr at %#08x-%#08x (xid=%u, version=%u)\n", 
-					    jeb->offset + je32_to_cpu(spx->offset),
-					    jeb->offset + je32_to_cpu(spx->offset) + je32_to_cpu(spx->totlen),
-					    je32_to_cpu(spx->xid), je32_to_cpu(spx->version));
+					    jeb->offset + je32_to_cpu(c, spx->offset),
+					    jeb->offset + je32_to_cpu(c, spx->offset) + je32_to_cpu(c, spx->totlen),
+					    je32_to_cpu(c, spx->xid), je32_to_cpu(c, spx->version));
 
-				xd = jffs2_setup_xattr_datum(c, je32_to_cpu(spx->xid),
-								je32_to_cpu(spx->version));
+				xd = jffs2_setup_xattr_datum(c, je32_to_cpu(c, spx->xid),
+								je32_to_cpu(c, spx->version));
 				if (IS_ERR(xd))
 					return PTR_ERR(xd);
-				if (xd->version > je32_to_cpu(spx->version)) {
+				if (xd->version > je32_to_cpu(c, spx->version)) {
 					/* node is not the newest one */
 					struct jffs2_raw_node_ref *raw
-						= sum_link_node_ref(c, jeb, je32_to_cpu(spx->offset) | REF_UNCHECKED,
-								    PAD(je32_to_cpu(spx->totlen)), NULL);
+						= sum_link_node_ref(c, jeb, je32_to_cpu(c, spx->offset) | REF_UNCHECKED,
+								    PAD(je32_to_cpu(c, spx->totlen)), NULL);
 					raw->next_in_ino = xd->node->next_in_ino;
 					xd->node->next_in_ino = raw;
 				} else {
-					xd->version = je32_to_cpu(spx->version);
-					sum_link_node_ref(c, jeb, je32_to_cpu(spx->offset) | REF_UNCHECKED,
-							  PAD(je32_to_cpu(spx->totlen)), (void *)xd);
+					xd->version = je32_to_cpu(c, spx->version);
+					sum_link_node_ref(c, jeb, je32_to_cpu(c, spx->offset) | REF_UNCHECKED,
+							  PAD(je32_to_cpu(c, spx->totlen)), (void *)xd);
 				}
-				*pseudo_random += je32_to_cpu(spx->xid);
+				*pseudo_random += je32_to_cpu(c, spx->xid);
 				sp += JFFS2_SUMMARY_XATTR_SIZE;
 
 				break;
@@ -525,8 +528,8 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
 
 				spr = (struct jffs2_sum_xref_flash *)sp;
 				dbg_summary("xref at %#08x-%#08x\n",
-					    jeb->offset + je32_to_cpu(spr->offset),
-					    jeb->offset + je32_to_cpu(spr->offset) + 
+					    jeb->offset + je32_to_cpu(c, spr->offset),
+					    jeb->offset + je32_to_cpu(c, spr->offset) + 
 					    (uint32_t)PAD(sizeof(struct jffs2_raw_xref)));
 
 				ref = jffs2_alloc_xattr_ref();
@@ -537,7 +540,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
 				ref->next = c->xref_temp;
 				c->xref_temp = ref;
 
-				sum_link_node_ref(c, jeb, je32_to_cpu(spr->offset) | REF_UNCHECKED,
+				sum_link_node_ref(c, jeb, je32_to_cpu(c, spr->offset) | REF_UNCHECKED,
 						  PAD(sizeof(struct jffs2_raw_xref)), (void *)ref);
 
 				*pseudo_random += ref->node->flash_offset;
@@ -547,7 +550,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
 			}
 #endif
 			default : {
-				uint16_t nodetype = je16_to_cpu(((struct jffs2_sum_unknown_flash *)sp)->nodetype);
+				uint16_t nodetype = je16_to_cpu(c, ((struct jffs2_sum_unknown_flash *)sp)->nodetype);
 				JFFS2_WARNING("Unsupported node type %x found in summary! Exiting...\n", nodetype);
 				if ((nodetype & JFFS2_COMPAT_MASK) == JFFS2_FEATURE_INCOMPAT)
 					return -EIO;
@@ -583,37 +586,37 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb
 		    jeb->offset, jeb->offset + ofs, sumsize);
 
 	/* OK, now check for node validity and CRC */
-	crcnode.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-	crcnode.nodetype = cpu_to_je16(JFFS2_NODETYPE_SUMMARY);
+	crcnode.magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+	crcnode.nodetype = cpu_to_je16(c, JFFS2_NODETYPE_SUMMARY);
 	crcnode.totlen = summary->totlen;
 	crc = crc32(0, &crcnode, sizeof(crcnode)-4);
 
-	if (je32_to_cpu(summary->hdr_crc) != crc) {
+	if (je32_to_cpu(c, summary->hdr_crc) != crc) {
 		dbg_summary("Summary node header is corrupt (bad CRC or "
 				"no summary at all)\n");
 		goto crc_err;
 	}
 
-	if (je32_to_cpu(summary->totlen) != sumsize) {
+	if (je32_to_cpu(c, summary->totlen) != sumsize) {
 		dbg_summary("Summary node is corrupt (wrong erasesize?)\n");
 		goto crc_err;
 	}
 
 	crc = crc32(0, summary, sizeof(struct jffs2_raw_summary)-8);
 
-	if (je32_to_cpu(summary->node_crc) != crc) {
+	if (je32_to_cpu(c, summary->node_crc) != crc) {
 		dbg_summary("Summary node is corrupt (bad CRC)\n");
 		goto crc_err;
 	}
 
 	crc = crc32(0, summary->sum, sumsize - sizeof(struct jffs2_raw_summary));
 
-	if (je32_to_cpu(summary->sum_crc) != crc) {
+	if (je32_to_cpu(c, summary->sum_crc) != crc) {
 		dbg_summary("Summary node data is corrupt (bad CRC)\n");
 		goto crc_err;
 	}
 
-	if ( je32_to_cpu(summary->cln_mkr) ) {
+	if ( je32_to_cpu(c, summary->cln_mkr) ) {
 
 		dbg_summary("Summary : CLEANMARKER node \n");
 
@@ -621,19 +624,19 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb
 		if (ret)
 			return ret;
 
-		if (je32_to_cpu(summary->cln_mkr) != c->cleanmarker_size) {
+		if (je32_to_cpu(c, summary->cln_mkr) != c->cleanmarker_size) {
 			dbg_summary("CLEANMARKER node has totlen 0x%x != normal 0x%x\n",
-				je32_to_cpu(summary->cln_mkr), c->cleanmarker_size);
-			if ((ret = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(summary->cln_mkr)))))
+				je32_to_cpu(c, summary->cln_mkr), c->cleanmarker_size);
+			if ((ret = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(c, summary->cln_mkr)))))
 				return ret;
 		} else if (jeb->first_node) {
 			dbg_summary("CLEANMARKER node not first node in block "
 					"(0x%08x)\n", jeb->offset);
-			if ((ret = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(summary->cln_mkr)))))
+			if ((ret = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(c, summary->cln_mkr)))))
 				return ret;
 		} else {
 			jffs2_link_node_ref(c, jeb, jeb->offset | REF_NORMAL,
-					    je32_to_cpu(summary->cln_mkr), NULL);
+					    je32_to_cpu(c, summary->cln_mkr), NULL);
 		}
 	}
 
@@ -706,19 +709,19 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock
 	memset(c->summary->sum_buf, 0xff, datasize);
 	memset(&isum, 0, sizeof(isum));
 
-	isum.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-	isum.nodetype = cpu_to_je16(JFFS2_NODETYPE_SUMMARY);
-	isum.totlen = cpu_to_je32(infosize);
-	isum.hdr_crc = cpu_to_je32(crc32(0, &isum, sizeof(struct jffs2_unknown_node) - 4));
-	isum.padded = cpu_to_je32(c->summary->sum_padded);
-	isum.cln_mkr = cpu_to_je32(c->cleanmarker_size);
-	isum.sum_num = cpu_to_je32(c->summary->sum_num);
+	isum.magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+	isum.nodetype = cpu_to_je16(c, JFFS2_NODETYPE_SUMMARY);
+	isum.totlen = cpu_to_je32(c, infosize);
+	isum.hdr_crc = cpu_to_je32(c, crc32(0, &isum, sizeof(struct jffs2_unknown_node) - 4));
+	isum.padded = cpu_to_je32(c, c->summary->sum_padded);
+	isum.cln_mkr = cpu_to_je32(c, c->cleanmarker_size);
+	isum.sum_num = cpu_to_je32(c, c->summary->sum_num);
 	wpage = c->summary->sum_buf;
 
 	while (c->summary->sum_num) {
 		temp = c->summary->sum_list_head;
 
-		switch (je16_to_cpu(temp->u.nodetype)) {
+		switch (je16_to_cpu(c, temp->u.nodetype)) {
 			case JFFS2_NODETYPE_INODE: {
 				struct jffs2_sum_inode_flash *sino_ptr = wpage;
 
@@ -778,10 +781,10 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock
 			}
 #endif
 			default : {
-				if ((je16_to_cpu(temp->u.nodetype) & JFFS2_COMPAT_MASK)
+				if ((je16_to_cpu(c, temp->u.nodetype) & JFFS2_COMPAT_MASK)
 				    == JFFS2_FEATURE_RWCOMPAT_COPY) {
 					dbg_summary("Writing unknown RWCOMPAT_COPY node type %x\n",
-						    je16_to_cpu(temp->u.nodetype));
+						    je16_to_cpu(c, temp->u.nodetype));
 					jffs2_sum_disable_collecting(c->summary);
 				} else {
 					BUG();	/* unknown node in summary information */
@@ -800,11 +803,11 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock
 	wpage += padsize;
 
 	sm = wpage;
-	sm->offset = cpu_to_je32(c->sector_size - jeb->free_size);
-	sm->magic = cpu_to_je32(JFFS2_SUM_MAGIC);
+	sm->offset = cpu_to_je32(c, c->sector_size - jeb->free_size);
+	sm->magic = cpu_to_je32(c, JFFS2_SUM_MAGIC);
 
-	isum.sum_crc = cpu_to_je32(crc32(0, c->summary->sum_buf, datasize));
-	isum.node_crc = cpu_to_je32(crc32(0, &isum, sizeof(isum) - 8));
+	isum.sum_crc = cpu_to_je32(c, crc32(0, c->summary->sum_buf, datasize));
+	isum.node_crc = cpu_to_je32(c, crc32(0, &isum, sizeof(isum) - 8));
 
 	vecs[0].iov_base = &isum;
 	vecs[0].iov_len = sizeof(isum);
diff --git a/fs/jffs2/summary.h b/fs/jffs2/summary.h
index 60207a2ae952..b8558d753f01 100644
--- a/fs/jffs2/summary.h
+++ b/fs/jffs2/summary.h
@@ -182,10 +182,14 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs,
 			unsigned long count,  uint32_t to);
 int jffs2_sum_write_sumnode(struct jffs2_sb_info *c);
 int jffs2_sum_add_padding_mem(struct jffs2_summary *s, uint32_t size);
-int jffs2_sum_add_inode_mem(struct jffs2_summary *s, struct jffs2_raw_inode *ri, uint32_t ofs);
-int jffs2_sum_add_dirent_mem(struct jffs2_summary *s, struct jffs2_raw_dirent *rd, uint32_t ofs);
-int jffs2_sum_add_xattr_mem(struct jffs2_summary *s, struct jffs2_raw_xattr *rx, uint32_t ofs);
-int jffs2_sum_add_xref_mem(struct jffs2_summary *s, struct jffs2_raw_xref *rr, uint32_t ofs);
+int jffs2_sum_add_inode_mem(struct jffs2_sb_info *c, struct jffs2_summary *s,
+				struct jffs2_raw_inode *ri, uint32_t ofs);
+int jffs2_sum_add_dirent_mem(struct jffs2_sb_info *c, struct jffs2_summary *s,
+				struct jffs2_raw_dirent *rd, uint32_t ofs);
+int jffs2_sum_add_xattr_mem(struct jffs2_sb_info *c, struct jffs2_summary *s,
+				struct jffs2_raw_xattr *rx, uint32_t ofs);
+int jffs2_sum_add_xref_mem(struct jffs2_sb_info *c, struct jffs2_summary *s,
+				struct jffs2_raw_xref *rr, uint32_t ofs);
 int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
 			   struct jffs2_raw_summary *summary, uint32_t sumlen,
 			   uint32_t *pseudo_random);
@@ -202,10 +206,10 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb
 #define jffs2_sum_move_collected(a,b)
 #define jffs2_sum_write_sumnode(a) (0)
 #define jffs2_sum_add_padding_mem(a,b)
-#define jffs2_sum_add_inode_mem(a,b,c)
-#define jffs2_sum_add_dirent_mem(a,b,c)
-#define jffs2_sum_add_xattr_mem(a,b,c)
-#define jffs2_sum_add_xref_mem(a,b,c)
+#define jffs2_sum_add_inode_mem(a,b,c,d)
+#define jffs2_sum_add_dirent_mem(a,b,c,d)
+#define jffs2_sum_add_xattr_mem(a,b,c,d)
+#define jffs2_sum_add_xref_mem(a,b,c,d)
 #define jffs2_sum_scan_sumnode(a,b,c,d,e) (0)
 
 #endif /* CONFIG_JFFS2_SUMMARY */
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 902a7dd10e5c..73ecc723f7d1 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -63,6 +63,18 @@ static void jffs2_i_init_once(void *foo)
 	inode_init_once(&f->vfs_inode);
 }
 
+static const char *jffs2_endianness(unsigned int endian)
+{
+	switch (endian) {
+	case JFFS2_ENDIAN_LITTLE:
+		return "little";
+	case JFFS2_ENDIAN_BIG:
+		return "big";
+	default:
+		return "native";
+	}
+}
+
 static const char *jffs2_compr_name(unsigned int compr)
 {
 	switch (compr) {
@@ -92,6 +104,8 @@ static int jffs2_show_options(struct seq_file *s, struct dentry *root)
 		seq_printf(s, ",compr=%s", jffs2_compr_name(opts->compr));
 	if (opts->rp_size)
 		seq_printf(s, ",rp_size=%u", opts->rp_size / 1024);
+	if (opts->endian)
+		seq_printf(s, ",force_endian=%s", jffs2_endianness(opts->endian));
 
 	return 0;
 }
@@ -161,17 +175,20 @@ static const struct export_operations jffs2_export_ops = {
  *
  * Opt_override_compr: override default compressor
  * Opt_rp_size: size of reserved pool in KiB
+ * Opt_force_endian: override endianness
  * Opt_err: just end of array marker
  */
 enum {
 	Opt_override_compr,
 	Opt_rp_size,
+	Opt_force_endian,
 	Opt_err,
 };
 
 static const match_table_t tokens = {
 	{Opt_override_compr, "compr=%s"},
 	{Opt_rp_size, "rp_size=%u"},
+	{Opt_force_endian, "force_endian=%s"},
 	{Opt_err, NULL},
 };
 
@@ -228,6 +245,19 @@ static int jffs2_parse_options(struct jffs2_sb_info *c, char *data)
 			}
 			c->mount_opts.rp_size = opt;
 			break;
+		case Opt_force_endian:
+			name = match_strdup(&args[0]);
+
+			if (!name)
+				return -ENOMEM;
+			if (!strcmp(name, "little"))
+				c->mount_opts.endian = JFFS2_ENDIAN_LITTLE;
+			else if (!strcmp(name, "big"))
+				c->mount_opts.endian = JFFS2_ENDIAN_BIG;
+			else
+				c->mount_opts.endian = JFFS2_ENDIAN_NATIVE;
+			kfree(name);
+			break;
 		default:
 			pr_err("Error: unrecognized mount option '%s' or missing value\n",
 			       p);
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index c6821a509481..a2d6503d2a05 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -188,18 +188,18 @@ static struct jffs2_raw_node_ref **jffs2_incore_replace_raw(struct jffs2_sb_info
 	struct jffs2_full_dirent *fd;
 
 	dbg_noderef("incore_replace_raw: node at %p is {%04x,%04x}\n",
-		    node, je16_to_cpu(node->u.magic), je16_to_cpu(node->u.nodetype));
+		    node, je16_to_cpu(c, node->u.magic), je16_to_cpu(c, node->u.nodetype));
 
-	BUG_ON(je16_to_cpu(node->u.magic) != 0x1985 &&
-	       je16_to_cpu(node->u.magic) != 0);
+	BUG_ON(je16_to_cpu(c, node->u.magic) != 0x1985 &&
+	       je16_to_cpu(c, node->u.magic) != 0);
 
-	switch (je16_to_cpu(node->u.nodetype)) {
+	switch (je16_to_cpu(c, node->u.nodetype)) {
 	case JFFS2_NODETYPE_INODE:
 		if (f->metadata && f->metadata->raw == raw) {
 			dbg_noderef("Will replace ->raw in f->metadata at %p\n", f->metadata);
 			return &f->metadata->raw;
 		}
-		frag = jffs2_lookup_node_frag(&f->fragtree, je32_to_cpu(node->i.offset));
+		frag = jffs2_lookup_node_frag(&f->fragtree, je32_to_cpu(c, node->i.offset));
 		BUG_ON(!frag);
 		/* Find a frag which refers to the full_dnode we want to modify */
 		while (!frag->node || frag->node->raw != raw) {
@@ -220,7 +220,7 @@ static struct jffs2_raw_node_ref **jffs2_incore_replace_raw(struct jffs2_sb_info
 
 	default:
 		dbg_noderef("Don't care about replacing raw for nodetype %x\n",
-			    je16_to_cpu(node->u.nodetype));
+			    je16_to_cpu(c, node->u.nodetype));
 		break;
 	}
 	return NULL;
@@ -615,10 +615,10 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
 
 		if ( c->wbuf_len + sizeof(struct jffs2_unknown_node) < c->wbuf_pagesize) {
 			struct jffs2_unknown_node *padnode = (void *)(c->wbuf + c->wbuf_len);
-			padnode->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-			padnode->nodetype = cpu_to_je16(JFFS2_NODETYPE_PADDING);
-			padnode->totlen = cpu_to_je32(c->wbuf_pagesize - c->wbuf_len);
-			padnode->hdr_crc = cpu_to_je32(crc32(0, padnode, sizeof(*padnode)-4));
+			padnode->magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+			padnode->nodetype = cpu_to_je16(c, JFFS2_NODETYPE_PADDING);
+			padnode->totlen = cpu_to_je32(c, c->wbuf_pagesize - c->wbuf_len);
+			padnode->hdr_crc = cpu_to_je32(c, crc32(0, padnode, sizeof(*padnode)-4));
 		}
 	}
 	/* else jffs2_flash_writev has actually filled in the rest of the
@@ -1019,12 +1019,16 @@ int jffs2_flash_read(struct jffs2_sb_info *c, loff_t ofs, size_t len, size_t *re
 /* For historical reasons we use only 8 bytes for OOB clean marker */
 #define OOB_CM_SIZE 8
 
-static const struct jffs2_unknown_node oob_cleanmarker =
+static struct jffs2_unknown_node oob_cleanmarker;
+
+static void jffs2_init_oob_cleanmarker(struct jffs2_sb_info *c)
 {
-	.magic = constant_cpu_to_je16(JFFS2_MAGIC_BITMASK),
-	.nodetype = constant_cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER),
-	.totlen = constant_cpu_to_je32(8)
-};
+	if (!je16_to_cpu(c, oob_cleanmarker.magic)) {
+		oob_cleanmarker.magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+		oob_cleanmarker.nodetype = cpu_to_je16(c, JFFS2_NODETYPE_CLEANMARKER);
+		oob_cleanmarker.totlen = cpu_to_je32(c, 8);
+	}
+}
 
 /*
  * Check, if the out of band area is empty. This function knows about the clean
@@ -1079,6 +1083,7 @@ int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c,
 	struct mtd_oob_ops ops;
 	int ret, cmlen = min_t(int, c->oobavail, OOB_CM_SIZE);
 
+	jffs2_init_oob_cleanmarker(c);
 	ops.mode = MTD_OPS_AUTO_OOB;
 	ops.ooblen = cmlen;
 	ops.oobbuf = c->oobbuf;
@@ -1104,6 +1109,7 @@ int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c,
 	struct mtd_oob_ops ops;
 	int cmlen = min_t(int, c->oobavail, OOB_CM_SIZE);
 
+	jffs2_init_oob_cleanmarker(c);
 	ops.mode = MTD_OPS_AUTO_OOB;
 	ops.ooblen = cmlen;
 	ops.oobbuf = (uint8_t *)&oob_cleanmarker;
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c
index cda9a361368e..5706508803fc 100644
--- a/fs/jffs2/write.c
+++ b/fs/jffs2/write.c
@@ -39,16 +39,16 @@ int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
 
 	jffs2_add_ino_cache(c, f->inocache);
 	jffs2_dbg(1, "%s(): Assigned ino# %d\n", __func__, f->inocache->ino);
-	ri->ino = cpu_to_je32(f->inocache->ino);
+	ri->ino = cpu_to_je32(c, f->inocache->ino);
 
-	ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-	ri->nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
-	ri->totlen = cpu_to_je32(PAD(sizeof(*ri)));
-	ri->hdr_crc = cpu_to_je32(crc32(0, ri, sizeof(struct jffs2_unknown_node)-4));
-	ri->mode = cpu_to_jemode(mode);
+	ri->magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+	ri->nodetype = cpu_to_je16(c, JFFS2_NODETYPE_INODE);
+	ri->totlen = cpu_to_je32(c, PAD(sizeof(*ri)));
+	ri->hdr_crc = cpu_to_je32(c, crc32(0, ri, sizeof(struct jffs2_unknown_node)-4));
+	ri->mode = cpu_to_jemode(c, mode);
 
 	f->highest_version = 1;
-	ri->version = cpu_to_je32(f->highest_version);
+	ri->version = cpu_to_je32(c, f->highest_version);
 
 	return 0;
 }
@@ -69,7 +69,7 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
 	int retried = 0;
 	unsigned long cnt = 2;
 
-	D1(if(je32_to_cpu(ri->hdr_crc) != crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)) {
+	D1(if(je32_to_cpu(c, ri->hdr_crc) != crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)) {
 		pr_crit("Eep. CRC not correct in jffs2_write_dnode()\n");
 		BUG();
 	}
@@ -79,9 +79,9 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
 	vecs[1].iov_base = (unsigned char *)data;
 	vecs[1].iov_len = datalen;
 
-	if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) {
+	if (je32_to_cpu(c, ri->totlen) != sizeof(*ri) + datalen) {
 		pr_warn("%s(): ri->totlen (0x%08x) != sizeof(*ri) (0x%08zx) + datalen (0x%08x)\n",
-			__func__, je32_to_cpu(ri->totlen),
+			__func__, je32_to_cpu(c, ri->totlen),
 			sizeof(*ri), datalen);
 	}
 
@@ -97,13 +97,13 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
 
 	jffs2_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len);
 
-	if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(ri->version) < f->highest_version)) {
+	if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(c, ri->version) < f->highest_version)) {
 		BUG_ON(!retried);
 		jffs2_dbg(1, "%s(): dnode_version %d, highest version %d -> updating dnode\n",
 			  __func__,
-			  je32_to_cpu(ri->version), f->highest_version);
-		ri->version = cpu_to_je32(++f->highest_version);
-		ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
+			  je32_to_cpu(c, ri->version), f->highest_version);
+		ri->version = cpu_to_je32(c, ++f->highest_version);
+		ri->node_crc = cpu_to_je32(c, crc32(0, ri, sizeof(*ri)-8));
 	}
 
 	ret = jffs2_flash_writev(c, vecs, cnt, flash_ofs, &retlen,
@@ -172,9 +172,9 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
 	   beginning of a page and runs to the end of the file, or if
 	   it's a hole node, mark it REF_PRISTINE, else REF_NORMAL.
 	*/
-	if ((je32_to_cpu(ri->dsize) >= PAGE_SIZE) ||
-	    ( ((je32_to_cpu(ri->offset)&(PAGE_SIZE-1))==0) &&
-	      (je32_to_cpu(ri->dsize)+je32_to_cpu(ri->offset) ==  je32_to_cpu(ri->isize)))) {
+	if ((je32_to_cpu(c, ri->dsize) >= PAGE_SIZE) ||
+	    ( ((je32_to_cpu(c, ri->offset)&(PAGE_SIZE-1))==0) &&
+	      (je32_to_cpu(c, ri->dsize)+je32_to_cpu(c, ri->offset) ==  je32_to_cpu(c, ri->isize)))) {
 		flash_ofs |= REF_PRISTINE;
 	} else {
 		flash_ofs |= REF_NORMAL;
@@ -186,14 +186,14 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
 		jffs2_free_full_dnode(fn);
 		return ERR_CAST(hold_err);
 	}
-	fn->ofs = je32_to_cpu(ri->offset);
-	fn->size = je32_to_cpu(ri->dsize);
+	fn->ofs = je32_to_cpu(c, ri->offset);
+	fn->size = je32_to_cpu(c, ri->dsize);
 	fn->frags = 0;
 
 	jffs2_dbg(1, "jffs2_write_dnode wrote node at 0x%08x(%d) with dsize 0x%x, csize 0x%x, node_crc 0x%08x, data_crc 0x%08x, totlen 0x%08x\n",
-		  flash_ofs & ~3, flash_ofs & 3, je32_to_cpu(ri->dsize),
-		  je32_to_cpu(ri->csize), je32_to_cpu(ri->node_crc),
-		  je32_to_cpu(ri->data_crc), je32_to_cpu(ri->totlen));
+		  flash_ofs & ~3, flash_ofs & 3, je32_to_cpu(c, ri->dsize),
+		  je32_to_cpu(c, ri->csize), je32_to_cpu(c, ri->node_crc),
+		  je32_to_cpu(c, ri->data_crc), je32_to_cpu(c, ri->totlen));
 
 	if (retried) {
 		jffs2_dbg_acct_sanity_check(c,NULL);
@@ -215,10 +215,10 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
 
 	jffs2_dbg(1, "%s(ino #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x)\n",
 		  __func__,
-		  je32_to_cpu(rd->pino), name, name, je32_to_cpu(rd->ino),
-		  je32_to_cpu(rd->name_crc));
+		  je32_to_cpu(c, rd->pino), name, name, je32_to_cpu(c, rd->ino),
+		  je32_to_cpu(c, rd->name_crc));
 
-	D1(if(je32_to_cpu(rd->hdr_crc) != crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)) {
+	D1(if(je32_to_cpu(c, rd->hdr_crc) != crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)) {
 		pr_crit("Eep. CRC not correct in jffs2_write_dirent()\n");
 		BUG();
 	   });
@@ -228,8 +228,8 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
 		   occasion: https://dev.laptop.org/ticket/4184 */
 		pr_crit("Error in jffs2_write_dirent() -- name contains zero bytes!\n");
 		pr_crit("Directory inode #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x\n",
-			je32_to_cpu(rd->pino), name, name, je32_to_cpu(rd->ino),
-			je32_to_cpu(rd->name_crc));
+			je32_to_cpu(c, rd->pino), name, name, je32_to_cpu(c, rd->ino),
+			je32_to_cpu(c, rd->name_crc));
 		WARN_ON(1);
 		return ERR_PTR(-EIO);
 	}
@@ -243,8 +243,8 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
 	if (!fd)
 		return ERR_PTR(-ENOMEM);
 
-	fd->version = je32_to_cpu(rd->version);
-	fd->ino = je32_to_cpu(rd->ino);
+	fd->version = je32_to_cpu(c, rd->version);
+	fd->ino = je32_to_cpu(c, rd->ino);
 	fd->nhash = full_name_hash(NULL, name, namelen);
 	fd->type = rd->type;
 	memcpy(fd->name, name, namelen);
@@ -255,18 +255,18 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
 
 	jffs2_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len);
 
-	if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(rd->version) < f->highest_version)) {
+	if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(c, rd->version) < f->highest_version)) {
 		BUG_ON(!retried);
 		jffs2_dbg(1, "%s(): dirent_version %d, highest version %d -> updating dirent\n",
 			  __func__,
-			  je32_to_cpu(rd->version), f->highest_version);
-		rd->version = cpu_to_je32(++f->highest_version);
-		fd->version = je32_to_cpu(rd->version);
-		rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
+			  je32_to_cpu(c, rd->version), f->highest_version);
+		rd->version = cpu_to_je32(c, ++f->highest_version);
+		fd->version = je32_to_cpu(c, rd->version);
+		rd->node_crc = cpu_to_je32(c, crc32(0, rd, sizeof(*rd)-8));
 	}
 
 	ret = jffs2_flash_writev(c, vecs, 2, flash_ofs, &retlen,
-				 (alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino));
+				 (alloc_mode==ALLOC_GC)?0:je32_to_cpu(c, rd->pino));
 	if (ret || (retlen != sizeof(*rd) + namelen)) {
 		pr_notice("Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n",
 			  sizeof(*rd) + namelen, flash_ofs, ret, retlen);
@@ -318,7 +318,7 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
 		return ERR_PTR(ret?ret:-EIO);
 	}
 	/* Mark the space used */
-	fd->raw = jffs2_add_physical_node_ref(c, flash_ofs | dirent_node_state(rd),
+	fd->raw = jffs2_add_physical_node_ref(c, flash_ofs | dirent_node_state(c, rd),
 					      PAD(sizeof(*rd)+namelen), f->inocache);
 	if (IS_ERR(fd->raw)) {
 		void *hold_err = fd->raw;
@@ -372,21 +372,21 @@ int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
 
 		comprtype = jffs2_compress(c, f, buf, &comprbuf, &datalen, &cdatalen);
 
-		ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-		ri->nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
-		ri->totlen = cpu_to_je32(sizeof(*ri) + cdatalen);
-		ri->hdr_crc = cpu_to_je32(crc32(0, ri, sizeof(struct jffs2_unknown_node)-4));
-
-		ri->ino = cpu_to_je32(f->inocache->ino);
-		ri->version = cpu_to_je32(++f->highest_version);
-		ri->isize = cpu_to_je32(max(je32_to_cpu(ri->isize), offset + datalen));
-		ri->offset = cpu_to_je32(offset);
-		ri->csize = cpu_to_je32(cdatalen);
-		ri->dsize = cpu_to_je32(datalen);
+		ri->magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+		ri->nodetype = cpu_to_je16(c, JFFS2_NODETYPE_INODE);
+		ri->totlen = cpu_to_je32(c, sizeof(*ri) + cdatalen);
+		ri->hdr_crc = cpu_to_je32(c, crc32(0, ri, sizeof(struct jffs2_unknown_node)-4));
+
+		ri->ino = cpu_to_je32(c, f->inocache->ino);
+		ri->version = cpu_to_je32(c, ++f->highest_version);
+		ri->isize = cpu_to_je32(c, max(je32_to_cpu(c, ri->isize), offset + datalen));
+		ri->offset = cpu_to_je32(c, offset);
+		ri->csize = cpu_to_je32(c, cdatalen);
+		ri->dsize = cpu_to_je32(c, datalen);
 		ri->compr = comprtype & 0xff;
 		ri->usercompr = (comprtype >> 8 ) & 0xff;
-		ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
-		ri->data_crc = cpu_to_je32(crc32(0, comprbuf, cdatalen));
+		ri->node_crc = cpu_to_je32(c, crc32(0, ri, sizeof(*ri)-8));
+		ri->data_crc = cpu_to_je32(c, crc32(0, comprbuf, cdatalen));
 
 		fn = jffs2_write_dnode(c, f, ri, comprbuf, cdatalen, ALLOC_NORETRY);
 
@@ -459,13 +459,13 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f,
 
 	mutex_lock(&f->sem);
 
-	ri->data_crc = cpu_to_je32(0);
-	ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
+	ri->data_crc = cpu_to_je32(c, 0);
+	ri->node_crc = cpu_to_je32(c, crc32(0, ri, sizeof(*ri)-8));
 
 	fn = jffs2_write_dnode(c, f, ri, NULL, 0, ALLOC_NORMAL);
 
 	jffs2_dbg(1, "jffs2_do_create created file with mode 0x%x\n",
-		  jemode_to_cpu(ri->mode));
+		  jemode_to_cpu(c, ri->mode));
 
 	if (IS_ERR(fn)) {
 		jffs2_dbg(1, "jffs2_write_dnode() failed\n");
@@ -507,19 +507,19 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f,
 
 	mutex_lock(&dir_f->sem);
 
-	rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-	rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT);
-	rd->totlen = cpu_to_je32(sizeof(*rd) + qstr->len);
-	rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4));
+	rd->magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+	rd->nodetype = cpu_to_je16(c, JFFS2_NODETYPE_DIRENT);
+	rd->totlen = cpu_to_je32(c, sizeof(*rd) + qstr->len);
+	rd->hdr_crc = cpu_to_je32(c, crc32(0, rd, sizeof(struct jffs2_unknown_node)-4));
 
-	rd->pino = cpu_to_je32(dir_f->inocache->ino);
-	rd->version = cpu_to_je32(++dir_f->highest_version);
+	rd->pino = cpu_to_je32(c, dir_f->inocache->ino);
+	rd->version = cpu_to_je32(c, ++dir_f->highest_version);
 	rd->ino = ri->ino;
 	rd->mctime = ri->ctime;
 	rd->nsize = qstr->len;
 	rd->type = DT_REG;
-	rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
-	rd->name_crc = cpu_to_je32(crc32(0, qstr->name, qstr->len));
+	rd->node_crc = cpu_to_je32(c, crc32(0, rd, sizeof(*rd)-8));
+	rd->name_crc = cpu_to_je32(c, crc32(0, qstr->name, qstr->len));
 
 	fd = jffs2_write_dirent(c, dir_f, rd, qstr->name, qstr->len, ALLOC_NORMAL);
 
@@ -570,19 +570,19 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f,
 		mutex_lock(&dir_f->sem);
 
 		/* Build a deletion node */
-		rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-		rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT);
-		rd->totlen = cpu_to_je32(sizeof(*rd) + namelen);
-		rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4));
-
-		rd->pino = cpu_to_je32(dir_f->inocache->ino);
-		rd->version = cpu_to_je32(++dir_f->highest_version);
-		rd->ino = cpu_to_je32(0);
-		rd->mctime = cpu_to_je32(time);
+		rd->magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+		rd->nodetype = cpu_to_je16(c, JFFS2_NODETYPE_DIRENT);
+		rd->totlen = cpu_to_je32(c, sizeof(*rd) + namelen);
+		rd->hdr_crc = cpu_to_je32(c, crc32(0, rd, sizeof(struct jffs2_unknown_node)-4));
+
+		rd->pino = cpu_to_je32(c, dir_f->inocache->ino);
+		rd->version = cpu_to_je32(c, ++dir_f->highest_version);
+		rd->ino = cpu_to_je32(c, 0);
+		rd->mctime = cpu_to_je32(c, time);
 		rd->nsize = namelen;
 		rd->type = DT_UNKNOWN;
-		rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
-		rd->name_crc = cpu_to_je32(crc32(0, name, namelen));
+		rd->node_crc = cpu_to_je32(c, crc32(0, rd, sizeof(*rd)-8));
+		rd->name_crc = cpu_to_je32(c, crc32(0, name, namelen));
 
 		fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, ALLOC_DELETION);
 
@@ -687,21 +687,21 @@ int jffs2_do_link (struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint
 	mutex_lock(&dir_f->sem);
 
 	/* Build a deletion node */
-	rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-	rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT);
-	rd->totlen = cpu_to_je32(sizeof(*rd) + namelen);
-	rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4));
-
-	rd->pino = cpu_to_je32(dir_f->inocache->ino);
-	rd->version = cpu_to_je32(++dir_f->highest_version);
-	rd->ino = cpu_to_je32(ino);
-	rd->mctime = cpu_to_je32(time);
+	rd->magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+	rd->nodetype = cpu_to_je16(c, JFFS2_NODETYPE_DIRENT);
+	rd->totlen = cpu_to_je32(c, sizeof(*rd) + namelen);
+	rd->hdr_crc = cpu_to_je32(c, crc32(0, rd, sizeof(struct jffs2_unknown_node)-4));
+
+	rd->pino = cpu_to_je32(c, dir_f->inocache->ino);
+	rd->version = cpu_to_je32(c, ++dir_f->highest_version);
+	rd->ino = cpu_to_je32(c, ino);
+	rd->mctime = cpu_to_je32(c, time);
 	rd->nsize = namelen;
 
 	rd->type = type;
 
-	rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
-	rd->name_crc = cpu_to_je32(crc32(0, name, namelen));
+	rd->node_crc = cpu_to_je32(c, crc32(0, rd, sizeof(*rd)-8));
+	rd->name_crc = cpu_to_je32(c, crc32(0, name, namelen));
 
 	fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, ALLOC_NORMAL);
 
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index da3e18503c65..98ea8f87df9d 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -152,32 +152,32 @@ static int do_verify_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_dat
 		return rc ? rc : -EIO;
 	}
 	crc = crc32(0, &rx, sizeof(rx) - 4);
-	if (crc != je32_to_cpu(rx.node_crc)) {
+	if (crc != je32_to_cpu(c, rx.node_crc)) {
 		JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n",
-			    offset, je32_to_cpu(rx.hdr_crc), crc);
+			    offset, je32_to_cpu(c, rx.hdr_crc), crc);
 		xd->flags |= JFFS2_XFLAGS_INVALID;
 		return JFFS2_XATTR_IS_CORRUPTED;
 	}
-	totlen = PAD(sizeof(rx) + rx.name_len + 1 + je16_to_cpu(rx.value_len));
-	if (je16_to_cpu(rx.magic) != JFFS2_MAGIC_BITMASK
-	    || je16_to_cpu(rx.nodetype) != JFFS2_NODETYPE_XATTR
-	    || je32_to_cpu(rx.totlen) != totlen
-	    || je32_to_cpu(rx.xid) != xd->xid
-	    || je32_to_cpu(rx.version) != xd->version) {
+	totlen = PAD(sizeof(rx) + rx.name_len + 1 + je16_to_cpu(c, rx.value_len));
+	if (je16_to_cpu(c, rx.magic) != JFFS2_MAGIC_BITMASK
+	    || je16_to_cpu(c, rx.nodetype) != JFFS2_NODETYPE_XATTR
+	    || je32_to_cpu(c, rx.totlen) != totlen
+	    || je32_to_cpu(c, rx.xid) != xd->xid
+	    || je32_to_cpu(c, rx.version) != xd->version) {
 		JFFS2_ERROR("inconsistent xdatum at %#08x, magic=%#04x/%#04x, "
 			    "nodetype=%#04x/%#04x, totlen=%u/%u, xid=%u/%u, version=%u/%u\n",
-			    offset, je16_to_cpu(rx.magic), JFFS2_MAGIC_BITMASK,
-			    je16_to_cpu(rx.nodetype), JFFS2_NODETYPE_XATTR,
-			    je32_to_cpu(rx.totlen), totlen,
-			    je32_to_cpu(rx.xid), xd->xid,
-			    je32_to_cpu(rx.version), xd->version);
+			    offset, je16_to_cpu(c, rx.magic), JFFS2_MAGIC_BITMASK,
+			    je16_to_cpu(c, rx.nodetype), JFFS2_NODETYPE_XATTR,
+			    je32_to_cpu(c, rx.totlen), totlen,
+			    je32_to_cpu(c, rx.xid), xd->xid,
+			    je32_to_cpu(c, rx.version), xd->version);
 		xd->flags |= JFFS2_XFLAGS_INVALID;
 		return JFFS2_XATTR_IS_CORRUPTED;
 	}
 	xd->xprefix = rx.xprefix;
 	xd->name_len = rx.name_len;
-	xd->value_len = je16_to_cpu(rx.value_len);
-	xd->data_crc = je32_to_cpu(rx.data_crc);
+	xd->value_len = je16_to_cpu(c, rx.value_len);
+	xd->data_crc = je32_to_cpu(c, rx.data_crc);
 
 	spin_lock(&c->erase_completion_lock);
  complete:
@@ -301,18 +301,18 @@ static int save_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x
 
 	/* Setup raw-xattr */
 	memset(&rx, 0, sizeof(rx));
-	rx.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-	rx.nodetype = cpu_to_je16(JFFS2_NODETYPE_XATTR);
-	rx.totlen = cpu_to_je32(PAD(totlen));
-	rx.hdr_crc = cpu_to_je32(crc32(0, &rx, sizeof(struct jffs2_unknown_node) - 4));
+	rx.magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+	rx.nodetype = cpu_to_je16(c, JFFS2_NODETYPE_XATTR);
+	rx.totlen = cpu_to_je32(c, PAD(totlen));
+	rx.hdr_crc = cpu_to_je32(c, crc32(0, &rx, sizeof(struct jffs2_unknown_node) - 4));
 
-	rx.xid = cpu_to_je32(xd->xid);
-	rx.version = cpu_to_je32(++xd->version);
+	rx.xid = cpu_to_je32(c, xd->xid);
+	rx.version = cpu_to_je32(c, ++xd->version);
 	rx.xprefix = xd->xprefix;
 	rx.name_len = xd->name_len;
-	rx.value_len = cpu_to_je16(xd->value_len);
-	rx.data_crc = cpu_to_je32(crc32(0, vecs[1].iov_base, vecs[1].iov_len));
-	rx.node_crc = cpu_to_je32(crc32(0, &rx, sizeof(struct jffs2_raw_xattr) - 4));
+	rx.value_len = cpu_to_je16(c, xd->value_len);
+	rx.data_crc = cpu_to_je32(c, crc32(0, vecs[1].iov_base, vecs[1].iov_len));
+	rx.node_crc = cpu_to_je32(c, crc32(0, &rx, sizeof(struct jffs2_raw_xattr) - 4));
 
 	rc = jffs2_flash_writev(c, vecs, 2, phys_ofs, &length, 0);
 	if (rc || totlen != length) {
@@ -464,24 +464,24 @@ static int verify_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref
 	}
 	/* obsolete node */
 	crc = crc32(0, &rr, sizeof(rr) - 4);
-	if (crc != je32_to_cpu(rr.node_crc)) {
+	if (crc != je32_to_cpu(c, rr.node_crc)) {
 		JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n",
-			    offset, je32_to_cpu(rr.node_crc), crc);
+			    offset, je32_to_cpu(c, rr.node_crc), crc);
 		return JFFS2_XATTR_IS_CORRUPTED;
 	}
-	if (je16_to_cpu(rr.magic) != JFFS2_MAGIC_BITMASK
-	    || je16_to_cpu(rr.nodetype) != JFFS2_NODETYPE_XREF
-	    || je32_to_cpu(rr.totlen) != PAD(sizeof(rr))) {
+	if (je16_to_cpu(c, rr.magic) != JFFS2_MAGIC_BITMASK
+	    || je16_to_cpu(c, rr.nodetype) != JFFS2_NODETYPE_XREF
+	    || je32_to_cpu(c, rr.totlen) != PAD(sizeof(rr))) {
 		JFFS2_ERROR("inconsistent xref at %#08x, magic=%#04x/%#04x, "
 			    "nodetype=%#04x/%#04x, totlen=%u/%zu\n",
-			    offset, je16_to_cpu(rr.magic), JFFS2_MAGIC_BITMASK,
-			    je16_to_cpu(rr.nodetype), JFFS2_NODETYPE_XREF,
-			    je32_to_cpu(rr.totlen), PAD(sizeof(rr)));
+			    offset, je16_to_cpu(c, rr.magic), JFFS2_MAGIC_BITMASK,
+			    je16_to_cpu(c, rr.nodetype), JFFS2_NODETYPE_XREF,
+			    je32_to_cpu(c, rr.totlen), PAD(sizeof(rr)));
 		return JFFS2_XATTR_IS_CORRUPTED;
 	}
-	ref->ino = je32_to_cpu(rr.ino);
-	ref->xid = je32_to_cpu(rr.xid);
-	ref->xseqno = je32_to_cpu(rr.xseqno);
+	ref->ino = je32_to_cpu(c, rr.ino);
+	ref->xid = je32_to_cpu(c, rr.xid);
+	ref->xseqno = je32_to_cpu(c, rr.xseqno);
 	if (ref->xseqno > c->highest_xseqno)
 		c->highest_xseqno = (ref->xseqno & ~XREF_DELETE_MARKER);
 
@@ -511,22 +511,22 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref)
 	uint32_t xseqno, phys_ofs = write_ofs(c);
 	int ret;
 
-	rr.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
-	rr.nodetype = cpu_to_je16(JFFS2_NODETYPE_XREF);
-	rr.totlen = cpu_to_je32(PAD(sizeof(rr)));
-	rr.hdr_crc = cpu_to_je32(crc32(0, &rr, sizeof(struct jffs2_unknown_node) - 4));
+	rr.magic = cpu_to_je16(c, JFFS2_MAGIC_BITMASK);
+	rr.nodetype = cpu_to_je16(c, JFFS2_NODETYPE_XREF);
+	rr.totlen = cpu_to_je32(c, PAD(sizeof(rr)));
+	rr.hdr_crc = cpu_to_je32(c, crc32(0, &rr, sizeof(struct jffs2_unknown_node) - 4));
 
 	xseqno = (c->highest_xseqno += 2);
 	if (is_xattr_ref_dead(ref)) {
 		xseqno |= XREF_DELETE_MARKER;
-		rr.ino = cpu_to_je32(ref->ino);
-		rr.xid = cpu_to_je32(ref->xid);
+		rr.ino = cpu_to_je32(c, ref->ino);
+		rr.xid = cpu_to_je32(c, ref->xid);
 	} else {
-		rr.ino = cpu_to_je32(ref->ic->ino);
-		rr.xid = cpu_to_je32(ref->xd->xid);
+		rr.ino = cpu_to_je32(c, ref->ic->ino);
+		rr.xid = cpu_to_je32(c, ref->xd->xid);
 	}
-	rr.xseqno = cpu_to_je32(xseqno);
-	rr.node_crc = cpu_to_je32(crc32(0, &rr, sizeof(rr) - 4));
+	rr.xseqno = cpu_to_je32(c, xseqno);
+	rr.node_crc = cpu_to_je32(c, crc32(0, &rr, sizeof(rr) - 4));
 
 	ret = jffs2_flash_write(c, phys_ofs, sizeof(rr), &length, (char *)&rr);
 	if (ret || sizeof(rr) != length) {
-- 
2.19.1


^ permalink raw reply related	[relevance 1%]

* [RFC PATCH] jffs2: make the overwritten xattr invisible after remount
@ 2018-10-20 11:07 16% Hou Tao
  0 siblings, 0 replies; 28+ results
From: Hou Tao @ 2018-10-20 11:07 UTC (permalink / raw)
  To: linux-mtd, dwmw2; +Cc: linux-kernel, richard.weinberger, boris.brezillon

For xattr modification, we do not write a new jffs2_raw_xref with
delete marker into flash, so if a xattr is modified then removed,
and the old xref & xdatum are not erased by GC, after reboot or
remount, the new xattr xref will be dead but the old xattr xref
will be alive, and we will get the overwritten xattr instead of
non-existent error when reading the removed xattr.

Fix it by keeping dead xrefs and linking them to the corresponding
xdatum & inode in jffs2_build_xattr_subsystem(), and using them to
check and remove the xrefs with a lower xseqno in check_xattr_ref_inode(),
and removing these dead xrefs once the check is done.

The fix will cause performance degradation in check_xattr_ref_inode(),
when xattrs are updated through deletion & addition, because there will
be many dead xrefs in the inode xref list. Luckily SELinux and ACL always
update xattr through overwrite, so the degradation may be acceptable.

The problem can also be fixed by writing the delete marker for xattr
ovewrite, but that will incur an extra flash write for each update
which is more expensive than just checking the lower xseqno once.

Fixes: 8a13695cbe4e ("[JFFS2][XATTR] rid unnecessary writing of delete marker.")
Signed-off-by: Hou Tao <houtao1@huawei.com>
---
 fs/jffs2/xattr.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
 fs/jffs2/xattr.h |  8 +++++++-
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index da3e18503c65..3d40fe02b003 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -522,6 +522,12 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref)
 		rr.ino = cpu_to_je32(ref->ino);
 		rr.xid = cpu_to_je32(ref->xid);
 	} else {
+		/*
+		 * For dead xref which has not been moved to xref_dead_list yet
+		 * (refer to jffs2_build_xattr_subsystem())
+		 */
+		if (ref->flags & JFFS2_XREF_FLAGS_DEAD)
+			xseqno |= XREF_DELETE_MARKER;
 		rr.ino = cpu_to_je32(ref->ic->ino);
 		rr.xid = cpu_to_je32(ref->xd->xid);
 	}
@@ -539,6 +545,8 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref)
 		return ret;
 	}
 	/* success */
+	if (ref->flags & JFFS2_XREF_FLAGS_DEAD)
+		xseqno &= ~XREF_DELETE_MARKER;
 	ref->xseqno = xseqno;
 	jffs2_add_physical_node_ref(c, phys_ofs | REF_PRISTINE, PAD(sizeof(rr)), (void *)ref);
 
@@ -680,6 +688,22 @@ static int check_xattr_ref_inode(struct jffs2_sb_info *c, struct jffs2_inode_cac
 			}
 		}
 	}
+
+	/* Remove dead xrefs moved in by jffs2_build_xattr_subsystem() */
+	for (ref=ic->xref, pref=&ic->xref; ref; ref=*pref) {
+		if (ref->flags & JFFS2_XREF_FLAGS_DEAD) {
+			ref->flags &= ~JFFS2_XREF_FLAGS_DEAD;
+
+			*pref = ref->next;
+			dbg_xattr("remove dead xref (ino=%u, xid=%u)\n",
+					ref->ic->ino, ref->xd->xid);
+			delete_xattr_ref(c, ref);
+			continue;
+		}
+
+		pref = &ref->next;
+	}
+
 	ic->flags |= INO_FLAGS_XATTR_CHECKED;
  out:
 	up_write(&c->xattr_sem);
@@ -830,12 +854,27 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 		for (ref=xref_tmphash[i]; ref; ref=_ref) {
 			xref_count++;
 			_ref = ref->next;
-			if (is_xattr_ref_dead(ref)) {
-				ref->next = c->xref_dead_list;
-				c->xref_dead_list = ref;
+			/*
+			 * Now the dead xref can not been moved into
+			 * xref_dead_list, it will be used in
+			 * check_xattr_ref_inode() to check whether or not
+			 * a xref with a lower xseqno (without delete marker)
+			 * also needs to be marked as dead. After that, the
+			 * dead xref will be moved into xref_dead_list.
+			 *
+			 * The reason for a xref with lower xseqno may be dead
+			 * is that for xattr modification we do not write a new
+			 * jffs2_raw_xref with delete mark into flash as we do
+			 * for xattr removal. So if a xattr is modified then
+			 * removed and the old xref & xdatum are not GC-ed,
+			 * after reboot or remount, the new xattr xref will be
+			 * dead but the old xattr xref will be alive, and we
+			 * will get a older xattr value instead of non-existent
+			 * error when reading the removed xattr.
+			 */
+			if (is_xattr_ref_dead(ref))
 				xref_dead_count++;
-				continue;
-			}
+
 			/* At this point, ref->xid and ref->ino contain XID and inode number.
 			   ref->xd and ref->ic are not valid yet. */
 			xd = jffs2_find_xattr_datum(c, ref->xid);
@@ -849,6 +888,18 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 				xref_orphan_count++;
 				continue;
 			}
+
+			/*
+			 * Use JFFS2_XREF_FLAGS_DEAD instead of
+			 * XREF_DELETE_MARKER to prevent xref from being
+			 * skipped by jffs2_garbage_collect_xattr_ref()
+			 * during GC.
+			 */
+			if (is_xattr_ref_dead(ref)) {
+				ref->xseqno &= ~XREF_DELETE_MARKER;
+				ref->flags |= JFFS2_XREF_FLAGS_DEAD;
+			}
+
 			ref->xd = xd;
 			ref->ic = ic;
 			atomic_inc(&xd->refcnt);
diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
index 720007b2fd65..f18f968bd901 100644
--- a/fs/jffs2/xattr.h
+++ b/fs/jffs2/xattr.h
@@ -41,13 +41,19 @@ struct jffs2_xattr_datum
 	uint32_t value_len;	/* length of xvalue */
 };
 
+/*
+ * xref is dead, but has not been moved to xref_dead_list yet
+ * and needs save during GC.
+ */
+#define JFFS2_XREF_FLAGS_DEAD (0x01)
+
 struct jffs2_inode_cache;
 struct jffs2_xattr_ref
 {
 	void *always_null;
 	struct jffs2_raw_node_ref *node;
 	uint8_t class;
-	uint8_t flags;		/* Currently unused */
+	uint8_t flags;
 	u16 unused;
 
 	uint32_t xseqno;
-- 
2.16.2.dirty


^ permalink raw reply related	[relevance 16%]

* [PATCH linux-next] jffs2: reduce stack usage in jffs2_build_xattr_subsystem()
@ 2017-05-09 20:30 35% Fabian Frederick
  2023-01-20 21:56 10% ` Nick Desaulniers
  0 siblings, 1 reply; 28+ results
From: Fabian Frederick @ 2017-05-09 20:30 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd, linux-kernel, fabf

Use kcalloc() for allocation/flush of 128 pointers table to
reduce stack usage.

Function now returns -ENOMEM or 0 on success.

stackusage
Before:
./fs/jffs2/xattr.c:775  jffs2_build_xattr_subsystem     1208
dynamic,bounded

After:
./fs/jffs2/xattr.c:775  jffs2_build_xattr_subsystem     192
dynamic,bounded

Also update definition when CONFIG_JFFS2_FS_XATTR is not enabled

Tested with an MTD mount point and some user set/getfattr.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/jffs2/build.c |  5 ++++-
 fs/jffs2/xattr.c | 14 ++++++++++----
 fs/jffs2/xattr.h |  4 ++--
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c
index b288c8a..f88e0bf 100644
--- a/fs/jffs2/build.c
+++ b/fs/jffs2/build.c
@@ -211,7 +211,10 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c)
 		ic->scan_dents = NULL;
 		cond_resched();
 	}
-	jffs2_build_xattr_subsystem(c);
+	ret = jffs2_build_xattr_subsystem(c);
+	if (ret)
+		goto exit;
+
 	c->flags &= ~JFFS2_SB_FLAG_BUILDING;
 
 	dbg_fsbuild("FS build complete\n");
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index da3e185..95c0496 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -772,10 +772,10 @@ void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c)
 }
 
 #define XREF_TMPHASH_SIZE	(128)
-void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
+int jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 {
 	struct jffs2_xattr_ref *ref, *_ref;
-	struct jffs2_xattr_ref *xref_tmphash[XREF_TMPHASH_SIZE];
+	struct jffs2_xattr_ref **xref_tmphash;
 	struct jffs2_xattr_datum *xd, *_xd;
 	struct jffs2_inode_cache *ic;
 	struct jffs2_raw_node_ref *raw;
@@ -784,9 +784,13 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 
 	BUG_ON(!(c->flags & JFFS2_SB_FLAG_BUILDING));
 
+
+	xref_tmphash = kcalloc(XREF_TMPHASH_SIZE,
+			       sizeof(struct jffs2_xattr_ref *), GFP_KERNEL);
+	if (!xref_tmphash)
+		return -ENOMEM;
+
 	/* Phase.1 : Merge same xref */
-	for (i=0; i < XREF_TMPHASH_SIZE; i++)
-		xref_tmphash[i] = NULL;
 	for (ref=c->xref_temp; ref; ref=_ref) {
 		struct jffs2_xattr_ref *tmp;
 
@@ -884,6 +888,8 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 		     "%u of xref (%u dead, %u orphan) found.\n",
 		     xdatum_count, xdatum_unchecked_count, xdatum_orphan_count,
 		     xref_count, xref_dead_count, xref_orphan_count);
+	kfree(xref_tmphash);
+	return 0;
 }
 
 struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
index 720007b..1b5030a 100644
--- a/fs/jffs2/xattr.h
+++ b/fs/jffs2/xattr.h
@@ -71,7 +71,7 @@ static inline int is_xattr_ref_dead(struct jffs2_xattr_ref *ref)
 #ifdef CONFIG_JFFS2_FS_XATTR
 
 extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c);
-extern void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c);
+extern int jffs2_build_xattr_subsystem(struct jffs2_sb_info *c);
 extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c);
 
 extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
@@ -103,7 +103,7 @@ extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t);
 #else
 
 #define jffs2_init_xattr_subsystem(c)
-#define jffs2_build_xattr_subsystem(c)
+#define jffs2_build_xattr_subsystem(c)		(0)
 #define jffs2_clear_xattr_subsystem(c)
 
 #define jffs2_xattr_do_crccheck_inode(c, ic)
-- 
2.9.3

^ permalink raw reply related	[relevance 35%]

* Re: [PATCH v4.4-rc8] jffs2: xattr: Silence frame size warning
  2016-01-07 19:11 18% [PATCH v4.4-rc8] jffs2: xattr: Silence frame size warning tim.gardner
@ 2016-02-01 14:48  0% ` David Woodhouse
  0 siblings, 0 replies; 28+ results
From: David Woodhouse @ 2016-02-01 14:48 UTC (permalink / raw)
  To: tim.gardner, linux-mtd, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 986 bytes --]

On Thu, 2016-01-07 at 12:11 -0700, tim.gardner@canonical.com wrote:
> From: Tim Gardner <tim.gardner@canonical.com>
> 
> fs/jffs2/xattr.c: In function 'jffs2_build_xattr_subsystem':
> fs/jffs2/xattr.c:887:1: warning: the frame size of 1128 bytes is
> larger than 1024 bytes [-Wframe-larger-than=]
>  }

At first glance, that looks like it's just bypassing the entire
contents of that function if the allocation fails, leaving the various
data structures in an inconsistent state and raw node refs unchecked,
which will lead to lots of issues later once the mount has completed
and GC can never get unstuck.

So at the very least, your commit message is lacking the explanation of
what the implications are, and *why* you have satisfied yourself that
it's actually OK.

At worst, the patch is entirely broken.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5691 bytes --]

^ permalink raw reply	[relevance 0%]

* [PATCH v4.4-rc8] jffs2: xattr: Silence frame size warning
@ 2016-01-07 19:11 18% tim.gardner
  2016-02-01 14:48  0% ` David Woodhouse
  0 siblings, 1 reply; 28+ results
From: tim.gardner @ 2016-01-07 19:11 UTC (permalink / raw)
  To: linux-mtd, linux-kernel; +Cc: Tim Gardner, David Woodhouse

From: Tim Gardner <tim.gardner@canonical.com>

fs/jffs2/xattr.c: In function 'jffs2_build_xattr_subsystem':
fs/jffs2/xattr.c:887:1: warning: the frame size of 1128 bytes is larger than 1024 bytes [-Wframe-larger-than=]
 }

gcc version 5.3.1 20151219 (Ubuntu 5.3.1-4ubuntu1)

Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 fs/jffs2/xattr.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index 4c2c036..160ddcd 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -775,7 +775,7 @@ void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c)
 void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 {
 	struct jffs2_xattr_ref *ref, *_ref;
-	struct jffs2_xattr_ref *xref_tmphash[XREF_TMPHASH_SIZE];
+	struct jffs2_xattr_ref **xref_tmphash;
 	struct jffs2_xattr_datum *xd, *_xd;
 	struct jffs2_inode_cache *ic;
 	struct jffs2_raw_node_ref *raw;
@@ -784,9 +784,14 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 
 	BUG_ON(!(c->flags & JFFS2_SB_FLAG_BUILDING));
 
+	xref_tmphash = kcalloc(XREF_TMPHASH_SIZE, sizeof(*xref_tmphash),
+		GFP_KERNEL);
+	if (!xref_tmphash) {
+		JFFS2_WARNING("kcalloc failure\n");
+		return;
+	}
+
 	/* Phase.1 : Merge same xref */
-	for (i=0; i < XREF_TMPHASH_SIZE; i++)
-		xref_tmphash[i] = NULL;
 	for (ref=c->xref_temp; ref; ref=_ref) {
 		struct jffs2_xattr_ref *tmp;
 
@@ -884,6 +889,7 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 		     "%u of xref (%u dead, %u orphan) found.\n",
 		     xdatum_count, xdatum_unchecked_count, xdatum_orphan_count,
 		     xref_count, xref_dead_count, xref_orphan_count);
+	kfree(xref_tmphash);
 }
 
 struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
-- 
1.9.1

^ permalink raw reply related	[relevance 18%]

* RE: Linux version 3.18.10 Bluez ver 5.28 security level crashing system
  2015-04-07 17:21  0% ` Peter Hurley
@ 2015-04-08 16:20  2%   ` Will Tucker
  0 siblings, 0 replies; 28+ results
From: Will Tucker @ 2015-04-08 16:20 UTC (permalink / raw)
  To: 'Peter Hurley', 'linux-bluetooth'; +Cc: linux-kernel

More information:

OpenWrt Migrated to new Kernel and new blueZ.
   Image Name:   MIPS OpenWrt Linux-3.18.11
   hcitool - HCI Tool ver 5.30

Got a little further and a possible workaround for the gatttool "sec-level medium' issue as shown in Example 1 and 2.
Example 3 with pairing concerns me the most since it gives an Oops[#1];. 

Thanks! 

reboot
root@OpenWrt:/# [   61.170000] br-lan: port 1(eth1) entered disabled state
[   61.170000] device eth1 left promiscuous mode
[   61.180000] br-lan: port 1(eth1) entered disabled state
[   61.190000] eth1: link down
[   61.190000] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[   65.380000] Removing MTD device #8 (rootfs_data) with use count 1
[   65.410000] reboot: Reÿÿ

U-Boot 1.1.4 (Feb  9 2012 - 20:12:45)

AP121 (ar9331) U-boot

DRAM:  64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 161k for U-Boot at: 83fd4000
Reserving 192k for malloc() at: 83fa4000
Reserving 44 Bytes for Board Info at: 83fa3fd4
Reserving 36 Bytes for Global Data at: 83fa3fb0
Reserving 128k for boot params() at: 83f83fb0
Stack Pointer at: 83f83f98
Now running in RAM - U-Boot at: 83fd4000
============================================
Date:Feb  9 2012  Time:20:12:45
Cameo Version: v1.00 Build:03
Module Name: D-Link DIR-505A1
============================================
id read 0x100000ff
flash size 8388608, sector count = 128
Flash:  8 MB
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   ag7240_enet_initialize...
: cfg1 0x5 cfg2 0x7114
eth0: 00:03:7f:ff:ff:ff
eth0 up
: cfg1 0xf cfg2 0x7214
eth1: 00:03:7f:ff:ff:fe
athrs26_reg_init_lan
ATHRS26: resetting s26
ATHRS26: s26 reset done
eth1 up
eth0, eth1
Hit any key to stop autoboot:  0
## Booting image at 9f080000 ...
   Image Name:   MIPS OpenWrt Linux-3.18.11
   Created:      2015-04-08  13:38:53 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1151178 Bytes =  1.1 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum at 0x9f080040 ...OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 67108864

Starting kernel ...

[    0.000000] Linux version 3.18.11 (guest@WILLS-LINUX-BOX) (gcc version 4.8.3
(OpenWrt/Linaro GCC 4.8-2014.04 r44873) ) #1 Wed Apr 8 07:38:24 MDT 2015
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Atheros AR9330 rev 1
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x03ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x03ffffff]
[    0.000000] Initmem setup node 0 [mem 0x00000000-0x03ffffff]
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32
bytes
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pag
es: 16256
[    0.000000] Kernel command line:  board=DIR-505-A1 console=ttyATH0,115200 mtd
parts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,256k(language)ro,7
680k@0x80000(firmware) rootfstype=squashfs,jffs2 noinitrd
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 60944K/65536K available (2484K kernel code, 125K rwdata,
528K rodata, 244K init, 188K bss, 4592K reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.00
0MHz
[    0.000000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
[    0.080000] pid_max: default: 32768 minimum: 301
[    0.080000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.090000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.100000] NET: Registered protocol family 16
[    0.100000] MIPS: machine is D-Link DIR-505 rev. A1
[    0.610000] Switched to clocksource MIPS
[    0.610000] NET: Registered protocol family 2
[    0.620000] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.620000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.620000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.630000] TCP: reno registered
[    0.630000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.640000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.650000] NET: Registered protocol family 1
[    0.650000] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.670000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.670000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORIT
Y) (c) 2001-2006 Red Hat, Inc.
[    0.680000] msgmni has been set to 119
[    0.680000] io scheduler noop registered
[    0.690000] io scheduler deadline registered (default)
[    0.690000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.700000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11, base_baud = 15
62500) is a AR933X UART
[    0.710000] console [ttyATH0] enabled
[    0.710000] console [ttyATH0] enabled
[    0.710000] bootconsole [early0] disabled
[    0.710000] bootconsole [early0] disabled
[    0.720000] m25p80 spi0.0: found mx25l6405d, expected m25p80
[    0.730000] m25p80 spi0.0: mx25l6405d (8192 Kbytes)
[    0.730000] 6 cmdlinepart partitions found on MTD device spi0.0
[    0.740000] Creating 6 MTD partitions on "spi0.0":
[    0.740000] 0x000000000000-0x000000010000 : "u-boot"
[    0.750000] 0x000000010000-0x000000020000 : "art"
[    0.760000] 0x000000020000-0x000000030000 : "mac"
[    0.760000] 0x000000030000-0x000000040000 : "nvram"
[    0.760000] 0x000000040000-0x000000080000 : "language"
[    0.770000] 0x000000080000-0x000000800000 : "firmware"
[    0.790000] 2 uimage-fw partitions found on MTD device firmware
[    0.800000] 0x000000080000-0x00000019910a : "kernel"
[    0.800000] mtd: partition "kernel" must either start or end on erase block b
oundary or be smaller than an erase block -- forcing read-only
[    0.810000] 0x00000019910a-0x000000800000 : "rootfs"
[    0.820000] mtd: partition "rootfs" must either start or end on erase block b
oundary or be smaller than an erase block -- forcing read-only
[    0.830000] mtd: device 7 (rootfs) set to be root filesystem
[    0.860000] 1 squashfs-split partitions found on MTD device rootfs
[    0.860000] 0x000000660000-0x000000800000 : "rootfs_data"
[    0.880000] libphy: ag71xx_mdio: probed
[    1.470000] ag71xx-mdio.1: Found an AR7240/AR9330 built-in switch
[    1.500000] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    2.090000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd0
41, driver=Generic PHY]
[    2.100000] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    2.100000] TCP: cubic registered
[    2.100000] NET: Registered protocol family 17
[    2.110000] bridge: automatic filtering via arp/ip/ip6tables has been depreca
ted. Update your scripts to load br_netfilter if you need this.
[    2.120000] 8021q: 802.1Q VLAN Support v1.8
[    2.140000] VFS: Mounted root (squashfs filesystem) readonly on device 31:7.
[    2.140000] Freeing unused kernel memory: 244K (80373000 - 803b0000)
[    3.550000] init: failed to symlink /tmp -> /var
[    3.550000] init: Console is alive
[    3.560000] init: - watchdog -
[    5.980000] usbcore: registered new interface driver usbfs
[    5.990000] usbcore: registered new interface driver hub
[    5.990000] usbcore: registered new device driver usb
[    6.050000] SCSI subsystem initialized
[    6.060000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    6.060000] ehci-platform: EHCI generic platform driver
[    6.070000] ehci-platform ehci-platform: EHCI Host Controller
[    6.070000] ehci-platform ehci-platform: new USB bus registered, assigned bus
 number 1
[    6.080000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[    6.110000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[    6.110000] hub 1-0:1.0: USB hub found
[    6.110000] hub 1-0:1.0: 1 port detected
[    6.120000] usbcore: registered new interface driver usb-storage
[    6.440000] usb 1-1: new full-speed USB device number 2 using ehci-platform
[    6.610000] init: - preinit -
[    7.310000] random: procd urandom read with 12 bits of entropy available
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    9.680000] mount_root: loading kmods from internal overlay
[   10.070000] jffs2: notice: (353) jffs2_build_xattr_subsystem: complete buildi
ng xattr subsystem, 1 of xdatum (1 unchecked, 0 orphan) and 1 of xref (0 dead, 0
 orphan) found.
[   10.090000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   10.100000] block: extroot: not configured
[   10.140000] jffs2: notice: (350) jffs2_build_xattr_subsystem: complete buildi
ng xattr subsystem, 1 of xdatum (1 unchecked, 0 orphan) and 1 of xref (0 dead, 0
 orphan) found.
[   10.250000] eth1: link up (100Mbps/Full duplex)
[   10.380000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   10.390000] block: extroot: not configured
[   10.400000] mount_root: switching to jffs2 overlay
[   10.450000] eth1: link down
[   10.460000] procd: - early -
[   10.460000] procd: - watchdog -
[   11.370000] procd: - ubus -
[   12.380000] procd: - init -
Please press Enter to activate this console.
[   13.890000] NET: Registered protocol family 10
[   13.920000] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   13.990000] hidraw: raw HID events driver (C) Jiri Kosina
[   14.040000] u32 classifier
[   14.040000]     input device check on
[   14.040000]     Actions configured
[   14.050000] Mirror/redirect action on
[   14.060000] nf_conntrack version 0.5.0 (956 buckets, 3824 max)
[   14.150000] Bluetooth: Core ver 2.19
[   14.160000] NET: Registered protocol family 31
[   14.160000] Bluetooth: HCI device and connection manager initialized
[   14.170000] Bluetooth: HCI socket layer initialized
[   14.170000] Bluetooth: L2CAP socket layer initialized
[   14.180000] Bluetooth: SCO socket layer initialized
[   14.190000] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   14.190000] Bluetooth: BNEP filters: protocol multicast
[   14.200000] Bluetooth: BNEP socket layer initialized
[   14.210000] usbcore: registered new interface driver btusb
[   14.210000] Loading modules backported from Linux version master-2015-03-09-0
-g141f155
[   14.220000] Backport generated by backports.git backports-20150129-0-gdd4a670

[   14.230000] bluetooth hci0: Direct firmware load for brcm/BCM20702A0-0a5c-21e
8.hcd failed with error -2
[   14.230000] bluetooth hci0: Falling back to user helper
[   14.260000] Bluetooth: HCI UART driver ver 2.2
[   14.260000] Bluetooth: HCI H4 protocol initialized
[   14.270000] Bluetooth: HCI BCSP protocol initialized
[   14.270000] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[   14.280000] Bluetooth: HIDP socket layer initialized
[   14.290000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   14.400000] Bluetooth: RFCOMM TTY layer initialized
[   14.400000] Bluetooth: RFCOMM socket layer initialized
[   14.400000] Bluetooth: RFCOMM ver 1.11
[   14.500000] xt_time: kernel timezone is -0000
[   14.570000] cfg80211: Calling CRDA to update world regulatory domain
[   14.640000] cfg80211: World regulatory domain updated:
[   14.650000] cfg80211:  DFS Master region: unset
[   14.650000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gai
n, max_eirp), (dfs_cac_time)
[   14.660000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 m
Bm), (N/A)
[   14.670000] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 m
Bm), (N/A)
[   14.680000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 m
Bm), (N/A)
[   14.690000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 m
Bm), (N/A)
[   14.690000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AU
TO), (N/A, 2000 mBm), (0 s)
[   14.700000] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000
mBm), (0 s)
[   14.710000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 m
Bm), (N/A)
[   14.720000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0
mBm), (N/A)
[   14.760000] firmware brcm!BCM20702A0-0a5c-21e8.hcd: firmware_loading_store: m
ap pages failed
[   14.770000] Bluetooth: hci0: BCM: patch brcm/BCM20702A0-0a5c-21e8.hcd not fou
nd
[   14.790000] PPP generic driver version 2.4.2
[   14.810000] NET: Registered protocol family 24
[   14.910000] Bluetooth: Unable to create crypto context
[   14.940000] ieee80211 phy0: Atheros AR9330 Rev:1 mem=0xb8100000, irq=2
[   14.960000] cfg80211: Calling CRDA for country: US
[   14.960000] cfg80211: Regulatory domain changed to country: US
[   14.970000] cfg80211:  DFS Master region: FCC
[   14.970000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gai
n, max_eirp), (dfs_cac_time)
[   14.980000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 m
Bm), (N/A)
[   14.990000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AU
TO), (N/A, 1700 mBm), (N/A)
[   15.000000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AU
TO), (N/A, 2300 mBm), (0 s)
[   15.010000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 m
Bm), (N/A)
[   15.010000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 40
00 mBm), (N/A)
[   25.940000] device eth1 entered promiscuous mode
[   25.970000] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   28.690000] eth1: link up (100Mbps/Full duplex)
[   28.690000] br-lan: port 1(eth1) entered forwarding state
[   28.700000] br-lan: port 1(eth1) entered forwarding state
[   28.710000] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   30.700000] br-lan: port 1(eth1) entered forwarding state

BusyBox v1.23.2 (2015-04-06 07:12:41 MDT) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 CHAOS CALMER (Bleeding Edge, r45313)
 -----------------------------------------------------
  * 1 1/2 oz Gin            Shake with a glassful
  * 1/4 oz Triple Sec       of broken ice and pour
  * 3/4 oz Lime Juice       unstrained into a goblet.
  * 1 1/2 oz Orange Juice
  * 1 tsp. Grenadine Syrup
 -----------------------------------------------------
root@OpenWrt:/#


EXAMPLE 1:
root@OpenWrt:/# hciconfig hci0 up
root@OpenWrt:/# gatttool --adapter=hci0 --sec-level=medium -I
[                 ][LE]> connect EC:FE:7E:10:95:1F
Attempting to connect to EC:FE:7E:10:95:1F
Connection successful
[EC:FE:7E:10:95:1F][LE]>
[EC:FE:7E:10:95:1F][LE]> disconnect
(gatttool:2082): GLib-WARNING **: Invalid file descriptor.
[EC:FE:7E:10:95:1F][LE]>

EXAMPLE 2:
root@OpenWrt:/# hciconfig hci0 up
root@OpenWrt:/# gatttool --adapter=hci0 --sec-level=medium -I
[                 ][LE]> connect EC:FE:7E:10:95:1F
Attempting to connect to EC:FE:7E:10:95:1F
Connection successful
[EC:FE:7E:10:95:1F][LE]>
[EC:FE:7E:10:95:1F][LE]> sec-level medium
[  583.700000] CPU 0 Unable to handle kernel paging request at virtual address 0
0000200, epc == 80067e20, ra == 831f1668
[  583.700000] Oops[#1]:
[  583.700000] CPU: 0 PID: 2457 Comm: gatttool Not tainted 3.18.11 #1
[  583.700000] task: 82b40000 ti: 8383c000 task.ti: 8383c000
[  583.700000] $ 0   : 00000000 7fb6dac6 00000000 00000000
[  583.700000] $ 4   : 00000200 8292a40c 00000000 00000000
[  583.700000] $ 8   : 00000000 00000000 00000001 00000057
[  583.700000] $12   : 7fb6da90 00000002 00000000 00000000
[  583.700000] $16   : 8292a400 82ae9400 00000000 00000002
[  583.700000] $20   : 00000200 006f5ba0 7709d118 00000000
[  583.700000] $24   : 00000000 76f30a40
[  583.700000] $28   : 8383c000 8383de88 00000000 831f1668
[  583.700000] Hi    : 00000020
[  583.700000] Lo    : 00000033
[  583.700000] epc   : 80067e20 mutex_lock+0x0/0x30
[  583.700000]     Not tainted
[  583.700000] ra    : 831f1668 smp_conn_security+0x88/0x200 [bluetooth]
[  583.700000] Status: 1000fc03 KERNEL EXL IE
[  583.700000] Cause : 00800008
[  583.700000] BadVA : 00000200
[  583.700000] PrId  : 00019374 (MIPS 24Kc)
[  583.700000] Modules linked in: ath9k ath9k_common pppoe ppp_async iptable_nat
 ath9k_hw ath pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4
mac80211 ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_tcpmss xt_strin
g xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt
_length xt_id xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlim
it xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CT xt_C
LASSIFY ts_kmp ts_fsm ts_bm slhc rfcomm nf_reject_ipv4 nf_nat_masquerade_ipv4 nf
_nat_irc nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrac
k_rtcache nf_conntrack_irc nf_conntrack_ftp iptable_raw iptable_mangle iptable_f
ilter ipt_ECN ip_tables hidp hci_uart crc_ccitt compat btusb bnep bluetooth act_
connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow
 cls_route cls_fw sch_hfsc sch_ingress hid evdev input_core ledtrig_usbdev ip6t_
REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle ip6
table_filter ip6_tables x_tables ifb ipv6 arc4 crypto_blkcipher usb_storage ehci
_platform ehci_hcd sd_mod scsi_mod gpio_button_hotplug ext4 jbd2 mbcache usbcore
 nls_base usb_common crc16 crypto_hash
[  583.700000] Process gatttool (pid: 2457, threadinfo=8383c000, task=82b40000,
tls=77158750)
[  583.700000] Stack : 8383df00 80134510 0000540f 00000000 7fb6db78 801382a0 829
2a800 7fb6dac4
          82a46e00 ffffffea 831f7b50 831ee274 7709d118 7fb6dbe0 8383dee8 006f58a
8
          02000000 802693f8 00000004 800796d4 83587580 00000002 7fb6dac4 0000000
4
          00000112 8007c714 00000000 00000000 00000000 00000000 00000002 0000000
0
          00000000 00000000 00000005 00000002 006f58a8 77128b70 00000000 80062b5
c
          ...
[  583.700000] Call Trace:
[  583.700000] [<80067e20>] mutex_lock+0x0/0x30
[  583.700000] [<831f1668>] smp_conn_security+0x88/0x200 [bluetooth]
[  583.700000] [<831ee274>] l2cap_is_socket+0x1514/0x242c [bluetooth]
[  583.700000]
[  583.700000]
Code: 8fb00024  03e00008  27bd0040 <c0820000> 2443ffff  e0830000  1060fffc  0000
0000  2442ffff
[  583.980000] ---[ end trace 8f75012237ecc092 ]---


EXAMPLE 3:
[bluetooth]#
root@OpenWrt:/# bluetoothctl
[bluetooth]#
[NEW] Controller 00:19:0E:12:46:8A BlueZ 5.30 [default]
[bluetooth]#
[bluetooth]# power on
[bluetooth]#
Changing power on succeeded
[bluetooth]#
[CHG] Controller 00:19:0E:12:46:8A Powered: yes
[bluetooth]#
[bluetooth]# [   67.640000] random: nonblocking pool is initialized
[bluetooth]#
scan on
[bluetooth]#
Discovery started
[bluetooth]#
[CHG] Controller 00:19:0E:12:46:8A Discovering: yes
[bluetooth]#
[NEW] Device EC:FE:7E:00:00:22 BlueRadios000022
[bluetooth]# scan o
[NEW] Device 6A:F4:BB:1F:8C:14 6A-F4-BB-1F-8C-14
[NEW] Device 67:89:36:EB:AF:2C 67-89-36-EB-AF-2C
[bluetooth]#
[NEW] Device 41:AF:82:1F:33:EC 41-AF-82-1F-33-EC
[bluetooth]#
[NEW] Device EC:FE:7E:11:6C:41 BLEbeacon116C41
[bluetooth]#
[NEW] Device EC:FE:7E:10:68:23 EC-FE-7E-10-68-23
[bluetooth]#
[NEW] Device 5C:31:3E:55:26:9D MagAlert55269D
[bluetooth]#
[NEW] Device 6D:1B:7B:30:05:0D 6D-1B-7B-30-05-0D
[bluetooth]#
[NEW] Device EC:FE:7E:10:AD:99 SensorBug10AD99
[bluetooth]#
[NEW] Device EC:FE:7E:0F:13:FE EC-FE-7E-0F-13-FE
[bluetooth]#
[NEW] Device FD:0C:87:41:62:10 FD-0C-87-41-62-10
[bluetooth]#
[NEW] Device D8:6B:89:E7:B8:88 estimote
[bluetooth]#
[NEW] Device EC:FE:7E:10:95:1F SensorBug10951F
[bluetooth]#
[NEW] Device F7:8D:75:19:38:CA F7-8D-75-19-38-CA
[bluetooth]#
[NEW] Device EC:FE:7E:12:4B:9D EC-FE-7E-12-4B-9D
[bluetooth]#
[NEW] Device EC:FE:7E:10:E5:51 EC-FE-7E-10-E5-51
[bluetooth]#
[NEW] Device EC:FE:7E:10:86:62 BlueRadios108662
[bluetooth]#
[CHG] Device EC:FE:7E:10:E5:51 Name: BlueRadios10E551
[bluetooth]#
[CHG] Device EC:FE:7E:10:E5:51 Alias: BlueRadios10E551
[bluetooth]#
[NEW] Device EC:FE:7E:10:AD:3E EC-FE-7E-10-AD-3E
[bluetooth]#
[CHG] Device EC:FE:7E:0F:13:FE Name: Mongoose0F13FE
[bluetooth]#
[CHG] Device EC:FE:7E:0F:13:FE Alias: Mongoose0F13FE
[bluetooth]#
[CHG] Device FD:0C:87:41:62:10 Name: estimote
[bluetooth]#
[CHG] Device FD:0C:87:41:62:10 Alias: estimote
[NEW] Device 00:19:0E:12:46:49 00-19-0E-12-46-49
[bluetooth]# scan off
[CHG] Device 00:19:0E:12:46:49 RSSI is nil
[CHG] Device EC:FE:7E:10:AD:3E RSSI is nil
[CHG] Device EC:FE:7E:10:86:62 RSSI is nil
[CHG] Device EC:FE:7E:10:E5:51 RSSI is nil
[CHG] Device EC:FE:7E:12:4B:9D RSSI is nil
[CHG] Device F7:8D:75:19:38:CA RSSI is nil
[CHG] Device EC:FE:7E:10:95:1F RSSI is nil
[CHG] Device D8:6B:89:E7:B8:88 RSSI is nil
[CHG] Device FD:0C:87:41:62:10 RSSI is nil
[CHG] Device EC:FE:7E:0F:13:FE RSSI is nil
[CHG] Device EC:FE:7E:10:AD:99 RSSI is nil
[CHG] Device 6D:1B:7B:30:05:0D RSSI is nil
[CHG] Device 5C:31:3E:55:26:9D RSSI is nil
[CHG] Device EC:FE:7E:10:68:23 RSSI is nil
[CHG] Device EC:FE:7E:11:6C:41 RSSI is nil
[CHG] Device 41:AF:82:1F:33:EC RSSI is nil
[CHG] Device 67:89:36:EB:AF:2C RSSI is nil
[CHG] Device 6A:F4:BB:1F:8C:14 RSSI is nil
[CHG] Device EC:FE:7E:00:00:22 RSSI is nil
Discovery stopped
[CHG] Controller 00:19:0E:12:46:8A Discovering: no
[bluetooth]#
 [bluetooth]# pair EC:FE:7E:10:95:1F
Attempting to pair with EC:FE:7E:10:95:1F
[  219.850000] CPU 0 Unable to handle kernel paging request at virtual address 0
0000200, epc == 80067e20, ra == 83231668
[  219.860000] Oops[#1]:
[  219.860000] CPU: 0 PID: 685 Comm: kworker/u3:0 Not tainted 3.18.11 #1
[  219.860000] Workqueue: hci0 hci_alloc_dev [bluetooth]
[  219.860000] task: 8305dd10 ti: 8316c000 task.ti: 8316c000
[  219.860000] $ 0   : 00000000 00000000 00000000 00000000
[  219.860000] $ 4   : 00000200 82a2400c 00000000 00000000
[  219.860000] $ 8   : ffffffec 00000001 00000003 1f95107e
[  219.860000] $12   : 00000000 00000000 00000000 00000000
[  219.860000] $16   : 82a24000 8297bb00 00000000 00000002
[  219.860000] $20   : 00000200 00000003 8297bb94 00000080
[  219.860000] $24   : 00000003 8322cf20
[  219.860000] $28   : 8316c000 8316dc90 00000005 83231668
[  219.860000] Hi    : 00000009
[  219.860000] Lo    : 00000fa0
[  219.860000] epc   : 80067e20 mutex_lock+0x0/0x30
[  219.860000]     Not tainted
[  219.860000] ra    : 83231668 smp_conn_security+0x88/0x200 [bluetooth]
[  219.860000] Status: 1000fc03 KERNEL EXL IE
[  219.860000] Cause : 00800008
[  219.860000] BadVA : 00000200
[  219.860000] PrId  : 00019374 (MIPS 24Kc)
[  219.860000] Modules linked in: ath9k ath9k_common pppoe ppp_async iptable_nat
 ath9k_hw ath pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4
mac80211 ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_tcpmss xt_strin
g xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt
_length xt_id xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlim
it xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CT xt_C
LASSIFY ts_kmp ts_fsm ts_bm slhc rfcomm nf_reject_ipv4 nf_nat_masquerade_ipv4 nf
_nat_irc nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrac
k_rtcache nf_conntrack_irc nf_conntrack_ftp iptable_raw iptable_mangle iptable_f
ilter ipt_ECN ip_tables hidp hci_uart crc_ccitt compat btusb bnep bluetooth act_
connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow
 cls_route cls_fw sch_hfsc sch_ingress hid evdev input_core ledtrig_usbdev ip6t_
REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle ip6
table_filter ip6_tables x_tables ifb ipv6 arc4 crypto_blkcipher usb_storage ehci
_platform ehci_hcd sd_mod scsi_mod gpio_button_hotplug ext4 jbd2 mbcache usbcore
 nls_base usb_common crc16 crypto_hash
[  219.860000] Process kworker/u3:0 (pid: 685, threadinfo=8316c000, task=8305dd1
0, tls=00000000)
[  219.860000] Stack : 82949c00 832283f0 82a42600 8297bb00 82a24000 82949c00 829
7bb00 82a24000
          82a24000 8297bbac 8297bb9c 8322c69c 83bf7000 82a24170 82a4280b 8011d22
8
          83bf7000 82a24170 82a4280b 82a2400c 82a24013 00000000 83bf7000 82a2400
0
          00000000 82a2400c 83bf7008 00000000 832381e8 832381b8 00000088 83211f5
8
          fffffff5 800f9b18 83bf7000 83bf76bc 00000000 00000000 00000000 0000000
0
          ...
[  219.860000] Call Trace:
[  219.860000] [<80067e20>] mutex_lock+0x0/0x30
[  219.860000] [<83231668>] smp_conn_security+0x88/0x200 [bluetooth]
[  219.860000] [<8322c69c>] l2cap_connect_cfm+0x290/0x354 [bluetooth]
[  219.860000] [<83211f58>] hci_chan_lookup_handle+0x4fec/0x5968 [bluetooth]
[  219.860000]
[  219.860000]
Code: 8fb00024  03e00008  27bd0040 <c0820000> 2443ffff  e0830000  1060fffc  0000
0000  2442ffff
[  220.150000] ---[ end trace 8f75012237ecc092 ]---
[bluetooth]# [  220.160000] CPU 0 Unable to handle kernel paging request at virt
ual address fffffff0, epc == 801b57ac, ra == 802c91b8
[  220.160000] Oops[#2]:
[  220.160000] CPU: 0 PID: 685 Comm: kworker/u3:0 Tainted: G      D        3.18.
11 #1
[  220.160000] task: 8305dd10 ti: 8316c000 task.ti: 8316c000
[  220.160000] $ 0   : 00000000 803d0000 00000000 0f003f70
[  220.160000] $ 4   : 8305dd10 00000000 80359590 0f003f70
[  220.160000] $ 8   : 00000008 00000000 00000000 00090014
[  220.160000] $12   : 0000000e 00000007 00000001 80337ed4
[  220.160000] $16   : 00000000 00000001 80359590 83828000
[  220.160000] $20   : 8305df0c 80360000 80359590 00000000
[  220.160000] $24   : 0000000e 801176a0
[  220.160000] $28   : 8316c000 8316da48 00000010 802c91b8
[  220.160000] Hi    : 00000033
[  220.160000] Lo    : 428f0000
[  220.160000] epc   : 801b57ac kthread_data+0x4/0xc
[  220.160000]     Tainted: G      D
[  220.160000] ra    : 802c91b8 wq_worker_sleeping+0x14/0xc0
[  220.160000] Status: 1000fc02 KERNEL EXL
[  220.160000] Cause : 80800008
[  220.160000] BadVA : fffffff0
[  220.160000] PrId  : 00019374 (MIPS 24Kc)
[  220.160000] Modules linked in: ath9k ath9k_common pppoe ppp_async iptable_nat
 ath9k_hw ath pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4
mac80211 ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_tcpmss xt_strin
g xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt
_length xt_id xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlim
it xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CT xt_C
LASSIFY ts_kmp ts_fsm ts_bm slhc rfcomm nf_reject_ipv4 nf_nat_masquerade_ipv4 nf
_nat_irc nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrac
k_rtcache nf_conntrack_irc nf_conntrack_ftp iptable_raw iptable_mangle iptable_f
ilter ipt_ECN ip_tables hidp hci_uart crc_ccitt compat btusb bnep bluetooth act_
connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow
 cls_route cls_fw sch_hfsc sch_ingress hid evdev input_core ledtrig_usbdev ip6t_
REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle ip6
table_filter ip6_tables x_tables ifb ipv6 arc4 crypto_blkcipher usb_storage ehci
_platform ehci_hcd sd_mod scsi_mod gpio_button_hotplug ext4 jbd2 mbcache usbcore
 nls_base usb_common crc16 crypto_hash
[  220.160000] Process kworker/u3:0 (pid: 685, threadinfo=8316c000, task=8305dd1
0, tls=00000000)
[  220.160000] Stack : 00000001 80359590 83828000 8305df0c 8305dd10 80066278 803
d0000 00000000
          8316da68 8316da68 8305dd10 00000001 8305dd08 83828000 8305de88 0000000
1
          8305dd08 00000000 00000010 80129764 803d48c0 00000002 80362a9c 803d000
0
          8316daa8 8316daa8 8305ded0 08000000 8316daa8 8316dad4 8316dbd8 8031896
4
          0000000b 00000028 00000200 00000003 00000000 00000000 00030000 80122df
c
          ...
[  220.160000] Call Trace:
[  220.160000] [<801b57ac>] kthread_data+0x4/0xc
[  220.160000] [<802c91b8>] wq_worker_sleeping+0x14/0xc0
[  220.160000] [<80066278>] __schedule+0x108/0x5b4
[  220.160000] [<80129764>] do_exit+0x74c/0x764
[  220.160000] [<80122dfc>] direct_finish_page+0x0/0x20
[  220.160000]
[  220.160000]
Code: 03e00008  27bd0040  8c8201d0 <03e00008> 8c42fff0  08041103  24840010  1080
0002  00000000
[  220.450000] ---[ end trace 8f75012237ecc093 ]---
[  220.460000] Fixing recursive fault but reboot is needed!
[  220.460000] CPU 0 Unable to handle kernel paging request at virtual address f
ffffff0, epc == 801b57ac, ra == 802c91b8
[  220.460000] Oops[#3]:
[  220.460000] CPU: 0 PID: 685 Comm: kworker/u3:0 Tainted: G      D        3.18.
11 #1
[  220.460000] task: 8305dd10 ti: 8316c000 task.ti: 8316c000
[  220.460000] $ 0   : 00000000 00000001 00000000 0f003f70
[  220.460000] $ 4   : 8305dd10 00000000 80359590 0f003f70
[  220.460000] $ 8   : 00000008 00000000 00000000 626f6f74
[  220.460000] $12   : 00000000 03bf0000 00000000 61756c74
[  220.460000] $16   : 00000000 0000000b 80359590 00000028
[  220.460000] $20   : 8305df0c 80360000 80359590 00000000
[  220.460000] $24   : 00000003 801176a0
[  220.460000] $28   : 8316c000 8316d800 00030000 802c91b8
[  220.460000] Hi    : 00000033
[  220.460000] Lo    : 5470a300
[  220.460000] epc   : 801b57ac kthread_data+0x4/0xc
[  220.460000]     Tainted: G      D
[  220.460000] ra    : 802c91b8 wq_worker_sleeping+0x14/0xc0
[  220.460000] Status: 1000fc02 KERNEL EXL
[  220.460000] Cause : 80800008
[  220.460000] BadVA : fffffff0
[  220.460000] PrId  : 00019374 (MIPS 24Kc)
[  220.460000] Modules linked in: ath9k ath9k_common pppoe ppp_async iptable_nat
 ath9k_hw ath pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4
mac80211 ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_tcpmss xt_strin
g xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt
_length xt_id xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlim
it xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CT xt_C
LASSIFY ts_kmp ts_fsm ts_bm slhc rfcomm nf_reject_ipv4 nf_nat_masquerade_ipv4 nf
_nat_irc nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrac
k_rtcache nf_conntrack_irc nf_conntrack_ftp iptable_raw iptable_mangle iptable_f
ilter ipt_ECN ip_tables hidp hci_uart crc_ccitt compat btusb bnep bluetooth act_
connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow
 cls_route cls_fw sch_hfsc sch_ingress hid evdev input_core ledtrig_usbdev ip6t_
REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle ip6
table_filter ip6_tables x_tables ifb ipv6 arc4 crypto_blkcipher usb_storage ehci
_platform ehci_hcd sd_mod scsi_mod gpio_button_hotplug ext4 jbd2 mbcache usbcore
 nls_base usb_common crc16 crypto_hash
[  220.460000] Process kworker/u3:0 (pid: 685, threadinfo=8316c000, task=8305dd1
0, tls=00000000)
[  220.460000] Stack : 0000000b 80359590 00000028 8305df0c 8305dd10 80066278 000
00000 00000000
          00030000 802b64b4 8305dd10 0000000b 0000000b 00000028 8305df0c 8036000
0
          00000000 00000000 00030000 80129114 803d48c0 00000038 00000014 0000003
2
          803d0000 801b1cb8 00000000 00000050 80319e80 8316d88c 8316d990 8031896
4
          0000000b 00000028 8305df0c 80360000 00000000 00000000 00030000 80122df
c
          ...
[  220.460000] Call Trace:
[  220.460000] [<801b57ac>] kthread_data+0x4/0xc
[  220.460000] [<802c91b8>] wq_worker_sleeping+0x14/0xc0
[  220.460000] [<80066278>] __schedule+0x108/0x5b4
[  220.460000] [<80129114>] do_exit+0xfc/0x764
[  220.460000] [<80122dfc>] direct_finish_page+0x0/0x20
[  220.460000]
[  220.460000]
Code: 03e00008  27bd0040  8c8201d0 <03e00008> 8c42fff0  08041103  24840010  1080
0002  00000000
[  220.750000] ---[ end trace 8f75012237ecc094 ]---
[  220.760000] Fixing recursive fault but reboot is needed!
[  220.760000] CPU 0 Unable to handle kernel paging request at virtual address f
ffffff0, epc == 801b57ac, ra == 802c91b8
[  220.760000] Oops[#4]:
[  220.760000] CPU: 0 PID: 685 Comm: kworker/u3:0 Tainted: G      D        3.18.
11 #1
[  220.760000] task: 8305dd10 ti: 8316c000 task.ti: 8316c000
[  220.760000] $ 0   : 00000000 00000001 00000000 0f003f70
[  220.760000] $ 4   : 8305dd10 00000000 80359590 0f003f70
[  220.760000] $ 8   : 00000008 00000000 00000000 626f6f74
[  220.760000] $12   : 00000000 03bf0000 00000000 61756c74
[  220.760000] $16   : 00000000 0000000b 80359590 00000028
[  220.760000] $20   : 8305df0c 80360000 80359590 00000000
[  220.760000] $24   : 00000003 801176a0
[  220.760000] $28   : 8316c000 8316d5b8 00030000 802c91b8
[  220.760000] Hi    : 00000033
[  220.760000] Lo    : 66524600
[  220.760000] epc   : 801b57ac kthread_data+0x4/0xc
[  220.760000]     Tainted: G      D
[  220.760000] ra    : 802c91b8 wq_worker_sleeping+0x14/0xc0
[  220.760000] Status: 1000fc02 KERNEL EXL
[  220.760000] Cause : 80800008
[  220.760000] BadVA : fffffff0
[  220.760000] PrId  : 00019374 (MIPS 24Kc)
[  220.760000] Modules linked in: ath9k ath9k_common pppoe ppp_async iptable_nat
 ath9k_hw ath pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4
mac80211 ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_tcpmss xt_strin
g xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt
_length xt_id xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlim
it xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CT xt_C
LASSIFY ts_kmp ts_fsm ts_bm slhc rfcomm nf_reject_ipv4 nf_nat_masquerade_ipv4 nf
_nat_irc nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrac
k_rtcache nf_conntrack_irc nf_conntrack_ftp iptable_raw iptable_mangle iptable_f
ilter ipt_ECN ip_tables hidp hci_uart crc_ccitt compat btusb bnep bluetooth act_
connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow
 cls_route cls_fw sch_hfsc sch_ingress hid evdev input_core ledtrig_usbdev ip6t_
REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle ip6
table_filter ip6_tables x_tables ifb ipv6 arc4 crypto_blkcipher usb_storage ehci
_platform ehci_hcd sd_mod scsi_mod gpio_button_hotplug ext4 jbd2 mbcache usbcore
 nls_base usb_common crc16 crypto_hash
[  220.760000] Process kworker/u3:0 (pid: 685, threadinfo=8316c000, task=8305dd1
0, tls=00000000)
[  220.760000] Stack : 0000000b 80359590 00000028 8305df0c 8305dd10 80066278 000
00000 00000000
          00030000 802b64b4 8305dd10 0000000b 0000000b 00000028 8305df0c 8036000
0
          00000000 00000000 00030000 80129114 803d48c0 00000038 00000014 0000003
2
          803d0000 801b1cb8 00000000 00000050 80319e80 8316d644 8316d748 8031896
4
          0000000b 00000028 8305df0c 80360000 00000000 00000000 00030000 80122df
c
          ...
[  220.760000] Call Trace:
[  220.760000] [<801b57ac>] kthread_data+0x4/0xc
[  220.760000] [<802c91b8>] wq_worker_sleeping+0x14/0xc0
[  220.760000] [<80066278>] __schedule+0x108/0x5b4
[  220.760000] [<80129114>] do_exit+0xfc/0x764
[  220.760000] [<80122dfc>] direct_finish_page+0x0/0x20
[  220.760000]
[  220.760000]
Code: 03e00008  27bd0040  8c8201d0 <03e00008> 8c42fff0  08041103  24840010  1080
0002  00000000
[  221.050000] ---[ end trace 8f75012237ecc095 ]---
[  221.060000] Fixing recursive fault but reboot is needed!
[  221.060000] CPU 0 Unable to handle kernel paging request at virtual address f
ffffff0, epc == 801b57ac, ra == 802c91b8
[  221.060000] Oops[#5]:
[  221.060000] CPU: 0 PID: 685 Comm: kworker/u3:0 Tainted: G      D        3.18.
11 #1
[  221.060000] task: 8305dd10 ti: 8316c000 task.ti: 8316c000
[  221.060000] $ 0   : 00000000 00000001 00000000 0f003f70
[  221.060000] $ 4   : 8305dd10 00000000 80359590 0f003f70
[  221.060000] $ 8   : 00000008 00000000 00000000 626f6f74
[  221.060000] $12   : 00000000 03bf0000 00000000 61756c74
[  221.060000] $16   : 00000000 0000000b 80359590 00000028
[  221.060000] $20   : 8305df0c 80360000 80359590 00000000
[  221.060000] $24   : 00000003 801176a0
[  221.060000] $28   : 8316c000 8316d370 00030000 802c91b8
[  221.060000] Hi    : 00000033
[  221.060000] Lo    : 7833e900
[  221.060000] epc   : 801b57ac kthread_data+0x4/0xc
[  221.060000]     Tainted: G      D
[  221.060000] ra    : 802c91b8 wq_worker_sleeping+0x14/0xc0
[  221.060000] Status: 1000fc02 KERNEL EXL
[  221.060000] Cause : 80800008
[  221.060000] BadVA : fffffff0
[  221.060000] PrId  : 00019374 (MIPS 24Kc)
[  221.060000] Modules linked in: ath9k ath9k_common pppoe ppp_async iptable_nat
 ath9k_hw ath pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4
mac80211 ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_tcpmss xt_strin
g xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt
_length xt_id xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlim
it xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CT xt_C
LASSIFY ts_kmp ts_fsm ts_bm slhc rfcomm nf_reject_ipv4 nf_nat_masquerade_ipv4 nf
_nat_irc nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrac
k_rtcache nf_conntrack_irc nf_conntrack_ftp iptable_raw iptable_mangle iptable_f
ilter ipt_ECN ip_tables hidp hci_uart crc_ccitt compat btusb bnep bluetooth act_
connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow
 cls_route cls_fw sch_hfsc sch_ingress hid evdev input_core ledtrig_usbdev ip6t_
REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle ip6
table_filter ip6_tables x_tables ifb ipv6 arc4 crypto_blkcipher usb_storage ehci
_platform ehci_hcd sd_mod scsi_mod gpio_button_hotplug ext4 jbd2 mbcache usbcore
 nls_base usb_common crc16 crypto_hash
[  221.060000] Process kworker/u3:0 (pid: 685, threadinfo=8316c000, task=8305dd1
0, tls=00000000)
[  221.060000] Stack : 0000000b 80359590 00000028 8305df0c 8305dd10 80066278 000
00000 00000000
          00030000 802b64b4 8305dd10 0000000b 0000000b 00000028 8305df0c 8036000
0
          00000000 00000000 00030000 80129114 803d48c0 00000038 00000014 0000003
2
          803d0000 801b1cb8 00000000 00000050 80319e80 8316d3fc 8316d500 8031896
4
          0000000b 00000028 8305df0c 80360000 00000000 00000000 00030000 80122df
c
          ...
[  221.060000] Call Trace:
[  221.060000] [<801b57ac>] kthread_data+0x4/0xc
[  221.060000] [<802c91b8>] wq_worker_sleeping+0x14/0xc0
[  221.060000] [<80066278>] __schedule+0x108/0x5b4
[  221.060000] [<80129114>] do_exit+0xfc/0x764
[  221.060000] [<80122dfc>] direct_finish_page+0x0/0x20
[  221.060000]
[  221.060000]
Code: 03e00008  27bd0040  8c8201d0 <03e00008> 8c42fff0  08041103  24840010  1080
0002  00000000
[  221.350000] ---[ end trace 8f75012237ecc096 ]---
[  221.360000] Fixing recursive fault but reboot is needed!
[  221.360000] CPU 0 Unable to handle kernel paging request at virtual address f
ffffff0, epc == 801b57ac, ra == 802c91b8
[  221.360000] Oops[#6]:
[  221.360000] CPU: 0 PID: 685 Comm: kworker/u3:0 Tainted: G      D        3.18.
11 #1
[  221.360000] task: 8305dd10 ti: 8316c000 task.ti: 8316c000
[  221.360000] $ 0   : 00000000 00000001 00000000 0f003f70
[  221.360000] $ 4   : 8305dd10 00000000 80359590 0f003f70
[  221.360000] $ 8   : 00000008 00000000 00000000 626f6f74
[  221.360000] $12   : 00000000 03bf0000 00000000 61756c74
[  221.360000] $16   : 00000000 0000000b 80359590 00000028
[  221.360000] $20   : 8305df0c 80360000 80359590 00000000
[  221.360000] $24   : 00000003 801176a0
[  221.360000] $28   : 8316c000 8316d128 00030000 802c91b8
[  221.360000] Hi    : 00000033
[  221.360000] Lo    : 8a158c00
[  221.360000] epc   : 801b57ac kthread_data+0x4/0xc
[  221.360000]     Tainted: G      D
[  221.360000] ra    : 802c91b8 wq_worker_sleeping+0x14/0xc0
[  221.360000] Status: 1000fc02 KERNEL EXL
[  221.360000] Cause : 80800008
[  221.360000] BadVA : fffffff0
[  221.360000] PrId  : 00019374 (MIPS 24Kc)
[  221.360000] Modules linked in: ath9k ath9k_common pppoe ppp_async iptable_nat
 ath9k_hw ath pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4
mac80211 ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_tcpmss xt_strin
g xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt
_length xt_id xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlim
it xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CT xt_C
LASSIFY ts_kmp ts_fsm ts_bm slhc rfcomm nf_reject_ipv4 nf_nat_masquerade_ipv4 nf
_nat_irc nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrac
k_rtcache nf_conntrack_irc nf_conntrack_ftp iptable_raw iptable_mangle iptable_f
ilter ipt_ECN ip_tables hidp hci_uart crc_ccitt compat btusb bnep bluetooth act_
connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow
 cls_route cls_fw sch_hfsc sch_ingress hid evdev input_core ledtrig_usbdev ip6t_
REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle ip6
table_filter ip6_tables x_tables ifb ipv6 arc4 crypto_blkcipher usb_storage ehci
_platform ehci_hcd sd_mod scsi_mod gpio_button_hotplug ext4 jbd2 mbcache usbcore
 nls_base usb_common crc16 crypto_hash
[  221.360000] Process kworker/u3:0 (pid: 685, threadinfo=8316c000, task=8305dd1
0, tls=00000000)
[  221.360000] Stack : 0000000b 80359590 00000028 8305df0c 8305dd10 80066278 000
00000 00000000
          00030000 802b64b4 8305dd10 0000000b 0000000b 00000028 8305df0c 8036000
0
          00000000 00000000 00030000 80129114 803d48c0 00000038 00000014 0000003
2
          803d0000 801b1cb8 00000000 00000050 80319e80 8316d1b4 8316d2b8 8031896
4
          0000000b 00000028 8305df0c 80360000 00000000 00000000 00030000 80122df
c
          ...
[  221.360000] Call Trace:
[  221.360000] [<801b57ac>] kthread_data+0x4/0xc
[  221.360000] [<802c91b8>] wq_worker_sleeping+0x14/0xc0
[  221.360000] [<80066278>] __schedule+0x108/0x5b4
[  221.360000] [<80129114>] do_exit+0xfc/0x764
[  221.360000] [<80122dfc>] direct_finish_page+0x0/0x20
[  221.360000]
[  221.360000]
Code: 03e00008  27bd0040  8c8201d0 <03e00008> 8c42fff0  08041103  24840010  1080
0002  00000000
[  221.650000] ---[ end trace 8f75012237ecc097 ]---
[  221.660000] Fixing recursive fault but reboot is needed!
[  221.660000] CPU 0 Unable to handle kernel paging request at virtual address f
ffffff0, epc == 801b57ac, ra == 802c91b8
[  221.660000] Oops[#7]:
[  221.660000] CPU: 0 PID: 685 Comm: kworker/u3:0 Tainted: G      D        3.18.
11 #1
[  221.660000] task: 8305dd10 ti: 8316c000 task.ti: 8316c000
[  221.660000] $ 0   : 00000000 00000001 00000000 0f003f70
[  221.660000] $ 4   : 8305dd10 00000000 80359590 0f003f70
[  221.660000] $ 8   : 00000008 00000000 00000000 626f6f74
[  221.660000] $12   : 00000000 03bf0000 00000000 61756c74
[  221.660000] $16   : 00000000 0000000b 80359590 00000028
[  221.660000] $20   : 8305df0c 80360000 80359590 00000000
[  221.660000] $24   : 00000003 801176a0
[  221.660000] $28   : 8316c000 8316cee0 00030000 802c91b8
[  221.660000] Hi    : 00000033
[  221.660000] Lo    : 9bf72f00
[  221.660000] epc   : 801b57ac kthread_data+0x4/0xc
[  221.660000]     Tainted: G      D
[  221.660000] ra    : 802c91b8 wq_worker_sleeping+0x14/0xc0
[  221.660000] Status: 1000fc02 KERNEL EXL
[  221.660000] Cause : 80800008
[  221.660000] BadVA : fffffff0
[  221.660000] PrId  : 00019374 (MIPS 24Kc)
[  221.660000] Modules linked in: ath9k ath9k_common pppoe ppp_async iptable_nat
 ath9k_hw ath pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4
mac80211 ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_tcpmss xt_strin
g xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt
_length xt_id xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlim
it xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CT xt_C
LASSIFY ts_kmp ts_fsm ts_bm slhc rfcomm nf_reject_ipv4 nf_nat_masquerade_ipv4 nf
_nat_irc nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrac
k_rtcache nf_conntrack_irc nf_conntrack_ftp iptable_raw iptable_mangle iptable_f
ilter ipt_ECN ip_tables hidp hci_uart crc_ccitt compat btusb bnep bluetooth act_
connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow
 cls_route cls_fw sch_hfsc sch_ingress hid evdev input_core ledtrig_usbdev ip6t_
REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle ip6
table_filter ip6_tables x_tables ifb ipv6 arc4 crypto_blkcipher usb_storage ehci
_platform ehci_hcd sd_mod scsi_mod gpio_button_hotplug ext4 jbd2 mbcache usbcore
 nls_base usb_common crc16 crypto_hash
[  221.660000] Process kworker/u3:0 (pid: 685, threadinfo=8316c000, task=8305dd1
0, tls=00000000)
[  221.660000] Stack : 0000000b 80359590 00000028 8305df0c 8305dd10 80066278 000
00000 00000000
          00030000 802b64b4 8305dd10 0000000b 0000000b 00000028 8305df0c 8036000
0
          00000000 00000000 00030000 80129114 803d48c0 00000038 00000014 0000003
2
          803d0000 801b1cb8 00000000 00000050 80319e80 8316cf6c 8316d070 8031896
4
          0000000b 00000028 8305df0c 80360000 00000000 00000000 00030000 80122df
c
          ...
[  221.660000] Call Trace:
[  221.660000] [<801b57ac>] kthread_data+0x4/0xc
[  221.660000] [<802c91b8>] wq_worker_sleeping+0x14/0xc0
[  221.660000] [<80066278>] __schedule+0x108/0x5b4
[  221.660000] [<80129114>] do_exit+0xfc/0x764
[  221.660000] [<80122dfc>] direct_finish_page+0x0/0x20
[  221.660000]
[  221.660000]
Code: 03e00008  27bd0040  8c8201d0 <03e00008> 8c42fff0  08041103  24840010  1080
0002  00000000
[  221.950000] ---[ end trace 8f75012237ecc098 ]---
[  221.960000] Fixing recursive fault but reboot is needed!
[  221.970000] CPU 0 Unable to handle kernel paging request at virtual address f
ffffff0, epc == 801b57ac, ra == 802c91b8
[  221.970000] Oops[#8]:
[  221.970000] CPU: 0 PID: 685 Comm: kworker/u3:0 Tainted: G      D        3.18.
11 #1
[  221.970000] task: 8305dd10 ti: 8316c000 task.ti: 8316c000
[  221.970000] $ 0   : 00000000 00000001 00000000 0f003f70
[  221.970000] $ 4   : 8305dd10 00000000 80359590 0f003f70
[  221.970000] $ 8   : 00000008 00000000 00000000 626f6f74
[  221.970000] $12   : 00000000 03bf0000 00000000 61756c74
[  221.970000] $16   : 00000000 0000000b 80359590 00000028
[  221.970000] $20   : 8305df0c 80360000 80359590 00000000
[  221.970000] $24   : 00000003 801176a0
[  221.970000] $28   : 8316c000 8316cc98 00030000 802c91b8
[  221.970000] Hi    : 00000033
[  221.970000] Lo    : ae716880
[  221.970000] epc   : 801b57ac kthread_data+0x4/0xc
[  221.970000]     Tainted: G      D
[  221.970000] ra    : 802c91b8 wq_worker_sleeping+0x14/0xc0
[  221.970000] Status: 1000fc02 KERNEL EXL
[  221.970000] Cause : 80800008
[  221.970000] BadVA : fffffff0
[  221.970000] PrId  : 00019374 (MIPS 24Kc)
[  221.970000] Modules linked in: ath9k ath9k_common pppoe ppp_async iptable_nat
 ath9k_hw ath pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4
mac80211 ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_tcpmss xt_strin
g xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt
_length xt_id xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlim
it xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CT xt_C
LASSIFY ts_kmp ts_fsm ts_bm slhc rfcomm nf_reject_ipv4 nf_nat_masquerade_ipv4 nf
_nat_irc nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrac
k_rtcache nf_conntrack_irc nf_conntrack_ftp iptable_raw iptable_mangle iptable_f
ilter ipt_ECN ip_tables hidp hci_uart crc_ccitt compat btusb bnep bluetooth act_
connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow
 cls_route cls_fw sch_hfsc sch_ingress hid evdev input_core ledtrig_usbdev ip6t_
REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle ip6
table_filter ip6_tables x_tables ifb ipv6 arc4 crypto_blkcipher usb_storage ehci
_platform ehci_hcd sd_mod scsi_mod gpio_button_hotplug ext4 jbd2 mbcache usbcore
 nls_base usb_common crc16 crypto_hash
[  221.970000] Process kworker/u3:0 (pid: 685, threadinfo=8316c000, task=8305dd1
0, tls=00000000)
[  221.970000] Stack : 0000000b 80359590 00000028 8305df0c 8305dd10 80066278 000
00000 00000000
          00030000 802b64b4 8305dd10 0000000b 0000000b 00000028 8305df0c 8036000
0
          00000000 00000000 00030000 80129114 803d48c0 00000038 00000014 0000003
2
          803d0000 801b1cb8 00000000 00000050 80319e80 8316cd24 8316ce28 8031896
4
          0000000b 00000028 8305df0c 80360000 00000000 00000000 00030000 80122df
c
          ...
[  221.970000] Call Trace:
[  221.970000] [<801b57ac>] kthread_data+0x4/0xc
[  221.970000] [<802c91b8>] wq_worker_sleeping+0x14/0xc0
[  221.970000] [<80066278>] __schedule+0x108/0x5b4
[  221.970000] [<80129114>] do_exit+0xfc/0x764
[  221.970000] [<80122dfc>] direct_finish_page+0x0/0x20
[  221.970000]
[  221.970000]
Code: 03e00008  27bd0040  8c8201d0 <03e00008> 8c42fff0  08041103  24840010  1080
0002  00000000
[  222.260000] ---[ end trace 8f75012237ecc099 ]---
[  222.270000] Fixing recursive fault but reboot is needed!
[  222.270000] CPU 0 Unable to handle kernel paging request at virtual address f
ffffff0, epc == 801b57ac, ra == 802c91b8
[  222.270000] Oops[#9]:
[  222.270000] CPU: 0 PID: 685 Comm: kworker/u3:0 Tainted: G      D        3.18.
11 #1
...



-----Original Message-----
From: Peter Hurley [mailto:peter@hurleysoftware.com] 
Sent: Tuesday, April 07, 2015 11:22 AM
To: Will Tucker; linux-bluetooth
Cc: linux-kernel@vger.kernel.org
Subject: Re: Linux version 3.18.10 Bluez ver 5.28 security level crashing system

[ +linux-bluetooth]

On 04/07/2015 12:27 PM, Will Tucker wrote:
> Hi
> Trying to get Bluez 5.28  pairing to work on openwrt. Using Linux 
> version 3.18.10.
> 
> I would use Bluez 5.30 but I read a post that stated it needed Linux 
> 3.19 and that may be long tedious job to update openwrt. Below is the 
> sequence and result of trying to set the security level using 
> bluetoothctl interactively.
> 
> eth0: 00:03:7f:ff:ff:ff
> eth0 up
> : cfg1 0xf cfg2 0x7214
> eth1: 00:03:7f:ff:ff:fe
> athrs26_reg_init_lan
> ATHRS26: resetting s26
> ATHRS26: s26 reset done
> eth1 up
> eth0, eth1
> Hit any key to stop autoboot:  0
> ## Booting image at 9f080000 ...
>    Image Name:   MIPS OpenWrt Linux-3.18.10
>    Created:      2015-04-07  13:03:05 UTC
>    Image Type:   MIPS Linux Kernel Image (lzma compressed)
>    Data Size:    1151316 Bytes =  1.1 MB
>    Load Address: 80060000
>    Entry Point:  80060000
>    Verifying Checksum at 0x9f080040 ...OK
>    Uncompressing Kernel Image ... OK
> No initrd
> ## Transferring control to Linux (at address 80060000) ...
> ## Giving linux memsize in bytes, 67108864
> 
> Starting kernel ...
> 
> [    0.000000] Linux version 3.18.10 (guest@WILLS-LINUX-BOX) (gcc version
> 4.8.3
> (OpenWrt/Linaro GCC 4.8-2014.04 r44873) ) #7 Tue Apr 7 07:02:38 MDT 2015
> [    0.000000] bootconsole [early0] enabled
> [    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
> [    0.000000] SoC: Atheros AR9330 rev 1
> [    0.000000] Determined physical RAM map:
> [    0.000000]  memory: 04000000 @ 00000000 (usable)
> [    0.000000] Initrd not found or empty - disabling initrd
> [    0.000000] Zone ranges:
> [    0.000000]   Normal   [mem 0x00000000-0x03ffffff]
> [    0.000000] Movable zone start for each node
> [    0.000000] Early memory node ranges
> [    0.000000]   node   0: [mem 0x00000000-0x03ffffff]
> [    0.000000] Initmem setup node 0 [mem 0x00000000-0x03ffffff]
> [    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32
> bytes.
> [    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize
> 32
> bytes
> [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total
> pag
> es: 16256
> [    0.000000] Kernel command line:  board=DIR-505-A1 console=ttyATH0,115200
> mtd
> parts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,256k(lan
> guage)
> ro,7
> 680k@0x80000(firmware) rootfstype=squashfs,jffs2 noinitrd
> [    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
> [    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
> [    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
> [    0.000000] Writing ErrCtl register=00000000
> [    0.000000] Readback ErrCtl register=00000000
> [    0.000000] Memory: 60944K/65536K available (2485K kernel code, 125K
> rwdata,
> 528K rodata, 244K init, 188K bss, 4592K reserved)
> [    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
> [    0.000000] NR_IRQS:51
> [    0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz,
> Ref:25.00
> 0MHz
> [    0.000000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
> [    0.080000] pid_max: default: 32768 minimum: 301
> [    0.080000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
> [    0.090000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096
> bytes)
> [    0.100000] NET: Registered protocol family 16
> [    0.100000] MIPS: machine is D-Link DIR-505 rev. A1
> [    0.610000] Switched to clocksource MIPS
> [    0.610000] NET: Registered protocol family 2
> [    0.620000] TCP established hash table entries: 1024 (order: 0, 4096
> bytes)
> [    0.620000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
> [    0.620000] TCP: Hash tables configured (established 1024 bind 1024)
> [    0.630000] TCP: reno registered
> [    0.630000] UDP hash table entries: 256 (order: 0, 4096 bytes)
> [    0.640000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
> [    0.650000] NET: Registered protocol family 1
> [    0.650000] futex hash table entries: 256 (order: -1, 3072 bytes)
> [    0.670000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
> [    0.670000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME)
> (CMODE_PRIORIT
> Y) (c) 2001-2006 Red Hat, Inc.
> [    0.680000] msgmni has been set to 119
> [    0.680000] io scheduler noop registered
> [    0.690000] io scheduler deadline registered (default)
> [    0.690000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
> [    0.700000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11, base_baud
> = 15
> 62500) is a AR933X UART
> [    0.710000] console [ttyATH0] enabled
> [    0.710000] console [ttyATH0] enabled
> [    0.710000] bootconsole [early0] disabled
> [    0.710000] bootconsole [early0] disabled
> [    0.720000] m25p80 spi0.0: found mx25l6405d, expected m25p80
> [    0.730000] m25p80 spi0.0: mx25l6405d (8192 Kbytes)
> [    0.730000] 6 cmdlinepart partitions found on MTD device spi0.0
> [    0.740000] Creating 6 MTD partitions on "spi0.0":
> [    0.740000] 0x000000000000-0x000000010000 : "u-boot"
> [    0.750000] 0x000000010000-0x000000020000 : "art"
> [    0.760000] 0x000000020000-0x000000030000 : "mac"
> [    0.760000] 0x000000030000-0x000000040000 : "nvram"
> [    0.760000] 0x000000040000-0x000000080000 : "language"
> [    0.770000] 0x000000080000-0x000000800000 : "firmware"
> [    0.810000] 2 uimage-fw partitions found on MTD device firmware
> [    0.810000] 0x000000080000-0x000000199194 : "kernel"
> [    0.820000] mtd: partition "kernel" must either start or end on erase
> block b
> oundary or be smaller than an erase block -- forcing read-only
> [    0.830000] 0x000000199194-0x000000800000 : "rootfs"
> [    0.840000] mtd: partition "rootfs" must either start or end on erase
> block b
> oundary or be smaller than an erase block -- forcing read-only
> [    0.850000] mtd: device 7 (rootfs) set to be root filesystem
> [    0.860000] 1 squashfs-split partitions found on MTD device rootfs
> [    0.860000] 0x000000610000-0x000000800000 : "rootfs_data"
> [    0.880000] libphy: ag71xx_mdio: probed
> [    1.480000] ag71xx-mdio.1: Found an AR7240/AR9330 built-in switch
> [    1.510000] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
> [    2.100000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04
> [uid=004dd0
> 41, driver=Generic PHY]
> [    2.110000] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
> [    2.110000] TCP: cubic registered
> [    2.110000] NET: Registered protocol family 17
> [    2.120000] bridge: automatic filtering via arp/ip/ip6tables has been
> depreca
> ted. Update your scripts to load br_netfilter if you need this.
> [    2.130000] 8021q: 802.1Q VLAN Support v1.8
> [    2.150000] VFS: Mounted root (squashfs filesystem) readonly on device
> 31:7.
> [    2.150000] Freeing unused kernel memory: 244K (80373000 - 803b0000)
> [    3.540000] init: failed to symlink /tmp -> /var
> [    3.550000] init: Console is alive
> [    3.550000] init: - watchdog -
> [    5.960000] usbcore: registered new interface driver usbfs
> [    5.960000] usbcore: registered new interface driver hub
> [    5.970000] usbcore: registered new device driver usb
> [    6.020000] SCSI subsystem initialized
> [    6.030000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
> [    6.040000] ehci-platform: EHCI generic platform driver
> [    6.040000] ehci-platform ehci-platform: EHCI Host Controller
> [    6.050000] ehci-platform ehci-platform: new USB bus registered, assigned
> bus
> number 1
> [    6.060000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
> [    6.080000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
> [    6.080000] hub 1-0:1.0: USB hub found
> [    6.080000] hub 1-0:1.0: 1 port detected
> [    6.090000] usbcore: registered new interface driver usb-storage
> [    6.410000] usb 1-1: new full-speed USB device number 2 using
> ehci-platform
> [    6.600000] init: - preinit -
> [    7.290000] random: procd urandom read with 12 bits of entropy available
> Press the [f] key and hit [enter] to enter failsafe mode Press the 
> [1], [2], [3] or [4] key and hit [enter] to select the debug level
> [   10.660000] mount_root: loading kmods from internal overlay
> [   11.060000] jffs2: notice: (353) jffs2_build_xattr_subsystem: complete
> buildi
> ng xattr subsystem, 1 of xdatum (1 unchecked, 0 orphan) and 1 of xref 
> (0 dead, 0
> orphan) found.
> [   11.070000] block: attempting to load
> /tmp/jffs_cfg/upper/etc/config/fstab
> [   11.080000] block: extroot: not configured
> [   11.120000] jffs2: notice: (350) jffs2_build_xattr_subsystem: complete
> buildi
> ng xattr subsystem, 1 of xdatum (1 unchecked, 0 orphan) and 1 of xref 
> (0 dead, 0
> orphan) found.
> [   11.270000] eth1: link up (100Mbps/Full duplex)
> [   11.370000] block: attempting to load
> /tmp/jffs_cfg/upper/etc/config/fstab
> [   11.380000] block: extroot: not configured
> [   11.380000] mount_root: switching to jffs2 overlay
> [   11.430000] eth1: link down
> [   11.450000] procd: - early -
> [   11.450000] procd: - watchdog -
> [   12.360000] procd: - ubus -
> [   13.370000] procd: - init -
> Please press Enter to activate this console.
> [   14.980000] NET: Registered protocol family 10
> [   15.000000] ip6_tables: (C) 2000-2006 Netfilter Core Team
> [   15.050000] hidraw: raw HID events driver (C) Jiri Kosina
> [   15.070000] u32 classifier
> [   15.070000]     input device check on
> [   15.070000]     Actions configured
> [   15.080000] Mirror/redirect action on
> [   15.090000] nf_conntrack version 0.5.0 (956 buckets, 3824 max)
> [   15.200000] Bluetooth: Core ver 2.19
> [   15.210000] NET: Registered protocol family 31
> [   15.210000] Bluetooth: HCI device and connection manager initialized
> [   15.220000] Bluetooth: HCI socket layer initialized
> [   15.220000] Bluetooth: L2CAP socket layer initialized
> [   15.230000] Bluetooth: SCO socket layer initialized
> [   15.240000] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
> [   15.240000] Bluetooth: BNEP filters: protocol multicast
> [   15.250000] Bluetooth: BNEP socket layer initialized
> [   15.260000] usbcore: registered new interface driver btusb
> [   15.260000] Loading modules backported from Linux version
> master-2015-03-09-0
> -g141f155
> [   15.270000] Backport generated by backports.git
> backports-20150129-0-gdd4a670
> 
> [   15.280000] bluetooth hci0: Direct firmware load for
> brcm/BCM20702A0-0a5c-21e
> 8.hcd failed with error -2
> [   15.280000] bluetooth hci0: Falling back to user helper
> [   15.300000] Bluetooth: HCI UART driver ver 2.2
> [   15.300000] Bluetooth: HCI H4 protocol initialized
> [   15.310000] Bluetooth: HCI BCSP protocol initialized
> [   15.330000] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
> [   15.330000] Bluetooth: HIDP socket layer initialized
> [   15.340000] ip_tables: (C) 2000-2006 Netfilter Core Team
> [   15.430000] Bluetooth: RFCOMM TTY layer initialized
> [   15.440000] Bluetooth: RFCOMM socket layer initialized
> [   15.440000] Bluetooth: RFCOMM ver 1.11
> [   15.540000] xt_time: kernel timezone is -0000
> [   15.600000] cfg80211: Calling CRDA to update world regulatory domain
> [   15.620000] cfg80211: World regulatory domain updated:
> [   15.620000] cfg80211:  DFS Master region: unset
> [   15.620000] cfg80211:   (start_freq - end_freq @ bandwidth),
> (max_antenna_gai
> n, max_eirp), (dfs_cac_time)
> [   15.630000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A,
> 2000 m
> Bm), (N/A)
> [   15.640000] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A,
> 2000 m
> Bm), (N/A)
> [   15.650000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A,
> 2000 m
> Bm), (N/A)
> [   15.660000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A,
> 2000 m
> Bm), (N/A)
> [   15.670000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000
> KHz AU
> TO), (N/A, 2000 mBm), (0 s)
> [   15.680000] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A,
> 2000
> mBm), (0 s)
> [   15.680000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A,
> 2000 m
> Bm), (N/A)
> [   15.690000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz),
> (N/A, 0
> mBm), (N/A)
> [   15.800000] PPP generic driver version 2.4.2
> [   15.810000] NET: Registered protocol family 24
> [   15.870000] firmware brcm!BCM20702A0-0a5c-21e8.hcd:
> firmware_loading_store: m
> ap pages failed
> [   15.880000] Bluetooth: hci0: BCM: patch brcm/BCM20702A0-0a5c-21e8.hcd not
> fou
> nd
> [   15.940000] ieee80211 phy0: Atheros AR9330 Rev:1 mem=0xb8100000, irq=2
> [   15.950000] cfg80211: Calling CRDA for country: US
> [   15.950000] cfg80211: Regulatory domain changed to country: US
> [   15.960000] cfg80211:  DFS Master region: FCC
> [   15.960000] cfg80211:   (start_freq - end_freq @ bandwidth),
> (max_antenna_gai
> n, max_eirp), (dfs_cac_time)
> [   15.970000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A,
> 3000 m
> Bm), (N/A)
> [   15.980000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000
> KHz AU
> TO), (N/A, 1700 mBm), (N/A)
> [   15.990000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000
> KHz AU
> TO), (N/A, 2300 mBm), (0 s)
> [   16.000000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A,
> 3000 m
> Bm), (N/A)
> [   16.010000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz),
> (N/A, 40
> 00 mBm), (N/A)
> [   16.060000] Bluetooth: Unable to create crypto context
> 
> 
> 
> BusyBox v1.23.2 (2015-04-06 07:12:41 MDT) built-in shell (ash)
> 
>   _______                     ________        __
> |       |.-----.-----.-----.|  |  |  |.----.|  |_
> |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
> |_______||   __|_____|__|__||________||__|  |____|
>           |__| W I R E L E S S   F R E E D O M
> -----------------------------------------------------
> CHAOS CALMER (Bleeding Edge, r45288)
> -----------------------------------------------------
>   * 1 1/2 oz Gin            Shake with a glassful
>   * 1/4 oz Triple Sec       of broken ice and pour
>   * 3/4 oz Lime Juice       unstrained into a goblet.
>   * 1 1/2 oz Orange Juice
>   * 1 tsp. Grenadine Syrup
> -----------------------------------------------------
> root@OpenWrt:/#
> root@OpenWrt:/#
> root@OpenWrt:/#
> root@OpenWrt:/# [   27.080000] device eth1 entered promiscuous mode
> [   27.080000] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
> 
> root@OpenWrt:/# [   29.870000] eth1: link up (100Mbps/Full duplex)
> [   29.870000] br-lan: port 1(eth1) entered forwarding state
> [   29.880000] br-lan: port 1(eth1) entered forwarding state
> [   29.880000] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
> [   31.880000] br-lan: port 1(eth1) entered forwarding state
> 
> 
> root@OpenWrt:/# hciconfig hci0 up
> root@OpenWrt:/# hciconfig
> hci0:   Type: BR/EDR  Bus: USB
>         BD Address: 00:19:0E:12:46:8A  ACL MTU: 1021:8  SCO MTU: 64:1
>         UP RUNNING
>         RX bytes:1158 acl:0 sco:0 events:63 errors:0
>         TX bytes:1046 acl:0 sco:0 commands:63 errors:0
> 
> 
> root@OpenWrt:/# gatttool --adapter=hci0 -I
> [                 ][LE]> connect EC:FE:7E:10:95:1F
> Attempting to connect to EC:FE:7E:10:95:1F Connection successful 
> [EC:FE:7E:10:95:1F][LE]> sec-level medium [  334.770000] CPU 0 Unable 
> to handle kernel paging request at virtual address 0 0000200, epc == 
> 80067e20, ra == 83231668 [  334.770000] Oops[#1]:
> [  334.770000] CPU: 0 PID: 1553 Comm: gatttool Not tainted 3.18.10 #7 
> [  334.770000] task: 82a43548 ti: 829a8000 task.ti: 829a8000
> [  334.770000] $ 0   : 00000000 7ffaed06 00000000 00000000
> [  334.770000] $ 4   : 00000200 830bcc0c 00000000 00000000
> [  334.770000] $ 8   : 00000000 00000000 00000001 00000057
> [  334.770000] $12   : 7ffaecd0 00000002 00000000 00000000
> [  334.770000] $16   : 830bcc00 829d1700 00000000 00000002
> [  334.770000] $20   : 00000200 006afb50 77209118 00000000
> [  334.770000] $24   : 00000000 7709ca40
> [  334.770000] $28   : 829a8000 829a9e88 00000000 83231668
> [  334.770000] Hi    : 00000020
> [  334.770000] Lo    : 00000033
> [  334.770000] epc   : 80067e20 mutex_lock+0x0/0x30
> [  334.770000]     Not tainted
> [  334.770000] ra    : 83231668 smp_conn_security+0x88/0x200 [bluetooth]
> [  334.770000] Status: 1000fc03 KERNEL EXL IE [  334.770000] Cause : 
> 00800008 [  334.770000] BadVA : 00000200 [  334.770000] PrId  : 
> 00019374 (MIPS 24Kc) [  334.770000] Modules linked in: ath9k 
> ath9k_common pppoe ppp_async iptable_nat ath9k_hw ath pppox 
> ppp_generic nf_nat_ipv4 nf_conntrack_ipv6
> nf_conntrack_ipv4
> mac80211 ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp 
> xt_tcpmss xt_strin g xt_statistic xt_state xt_recent xt_nat 
> xt_multiport xt_mark xt_mac xt_limit xt _length xt_id xt_hl xt_helper 
> xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlim it xt_connbytes 
> xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CT xt_C 
> LASSIFY ts_kmp ts_fsm ts_bm slhc rfcomm nf_reject_ipv4
> nf_nat_masquerade_ipv4 nf
> _nat_irc nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 
> nf_conntrac k_rtcache nf_conntrack_irc nf_conntrack_ftp iptable_raw 
> iptable_mangle iptable_f ilter ipt_ECN ip_tables hidp hci_uart 
> crc_ccitt compat btusb bnep bluetooth act_ connmark nf_conntrack 
> act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow cls_route 
> cls_fw sch_hfsc sch_ingress hid evdev input_core ledtrig_usbdev ip6t_ 
> REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw 
> ip6table_mangle
> ip6
> table_filter ip6_tables x_tables ifb ipv6 arc4 crypto_blkcipher 
> usb_storage ehci _platform ehci_hcd sd_mod scsi_mod 
> gpio_button_hotplug ext4 jbd2 mbcache usbcore nls_base usb_common 
> crc16 crypto_hash [  334.770000] Process gatttool (pid: 1553, 
> threadinfo=829a8000, task=82a43548,
> tls=772c4750)
> [  334.770000] Stack : 829a9f00 80134464 0000540f 00000000 7ffaedb8 
> 801381f4
> 829
> 9d400 7ffaed04
>           82ade200 ffffffea 83237b50 8322e274 77209118 7ffaee20 
> 829a9ee8 006af8a
> 8
>           02000000 80269348 00000004 800796d4 83550b00 00000002 
> 7ffaed04
> 0000000
> 4
>           00000112 8007c714 00000000 00000000 00000000 00000000 
> 00000002
> 0000000
> 0
>           00000000 00000000 00000005 00000002 006af8a8 77294b70 
> 00000000
> 80062b5
> c
>           ...
> [  334.770000] Call Trace:
> [  334.770000] [<80067e20>] mutex_lock+0x0/0x30 [  334.770000] 
> [<83231668>] smp_conn_security+0x88/0x200 [bluetooth] [  334.770000] 
> [<8322e274>] l2cap_is_socket+0x1514/0x242c [bluetooth] [  334.770000] 
> [  334.770000]
> Code: 8fb00024  03e00008  27bd0040 <c0820000> 2443ffff  e0830000  
> 1060fffc
> 0000
> 0000  2442ffff
> [  335.050000] ---[ end trace fe8f2f0ed758dfcc ]---
> 
> Will Tucker
> BlueRadios, Inc.
> 8310 South Valley Highway, Suite 275
> Englewood, Colorado 80112
> USA
> wtucker@BlueRadios.com
> www.BlueRadios.com



^ permalink raw reply	[relevance 2%]

* Re: Linux version 3.18.10 Bluez ver 5.28 security level crashing system
  2015-04-07 16:27  3% Linux version 3.18.10 Bluez ver 5.28 security level crashing system Will Tucker
@ 2015-04-07 17:21  0% ` Peter Hurley
  2015-04-08 16:20  2%   ` Will Tucker
  0 siblings, 1 reply; 28+ results
From: Peter Hurley @ 2015-04-07 17:21 UTC (permalink / raw)
  To: Will Tucker, linux-bluetooth; +Cc: linux-kernel

[ +linux-bluetooth]

On 04/07/2015 12:27 PM, Will Tucker wrote:
> Hi 
> Trying to get Bluez 5.28  pairing to work on openwrt. Using Linux version
> 3.18.10.
> 
> I would use Bluez 5.30 but I read a post that stated it needed Linux 3.19
> and that may be long tedious job to update openwrt. Below is the sequence
> and result of trying to set the security level using bluetoothctl
> interactively.
> 
> eth0: 00:03:7f:ff:ff:ff
> eth0 up
> : cfg1 0xf cfg2 0x7214
> eth1: 00:03:7f:ff:ff:fe
> athrs26_reg_init_lan
> ATHRS26: resetting s26
> ATHRS26: s26 reset done
> eth1 up
> eth0, eth1
> Hit any key to stop autoboot:  0
> ## Booting image at 9f080000 ...
>    Image Name:   MIPS OpenWrt Linux-3.18.10
>    Created:      2015-04-07  13:03:05 UTC
>    Image Type:   MIPS Linux Kernel Image (lzma compressed)
>    Data Size:    1151316 Bytes =  1.1 MB
>    Load Address: 80060000
>    Entry Point:  80060000
>    Verifying Checksum at 0x9f080040 ...OK
>    Uncompressing Kernel Image ... OK
> No initrd
> ## Transferring control to Linux (at address 80060000) ...
> ## Giving linux memsize in bytes, 67108864
> 
> Starting kernel ...
> 
> [    0.000000] Linux version 3.18.10 (guest@WILLS-LINUX-BOX) (gcc version
> 4.8.3
> (OpenWrt/Linaro GCC 4.8-2014.04 r44873) ) #7 Tue Apr 7 07:02:38 MDT 2015
> [    0.000000] bootconsole [early0] enabled
> [    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
> [    0.000000] SoC: Atheros AR9330 rev 1
> [    0.000000] Determined physical RAM map:
> [    0.000000]  memory: 04000000 @ 00000000 (usable)
> [    0.000000] Initrd not found or empty - disabling initrd
> [    0.000000] Zone ranges:
> [    0.000000]   Normal   [mem 0x00000000-0x03ffffff]
> [    0.000000] Movable zone start for each node
> [    0.000000] Early memory node ranges
> [    0.000000]   node   0: [mem 0x00000000-0x03ffffff]
> [    0.000000] Initmem setup node 0 [mem 0x00000000-0x03ffffff]
> [    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32
> bytes.
> [    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize
> 32
> bytes
> [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total
> pag
> es: 16256
> [    0.000000] Kernel command line:  board=DIR-505-A1 console=ttyATH0,115200
> mtd
> parts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,256k(language)
> ro,7
> 680k@0x80000(firmware) rootfstype=squashfs,jffs2 noinitrd
> [    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
> [    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
> [    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
> [    0.000000] Writing ErrCtl register=00000000
> [    0.000000] Readback ErrCtl register=00000000
> [    0.000000] Memory: 60944K/65536K available (2485K kernel code, 125K
> rwdata,
> 528K rodata, 244K init, 188K bss, 4592K reserved)
> [    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
> [    0.000000] NR_IRQS:51
> [    0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz,
> Ref:25.00
> 0MHz
> [    0.000000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
> [    0.080000] pid_max: default: 32768 minimum: 301
> [    0.080000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
> [    0.090000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096
> bytes)
> [    0.100000] NET: Registered protocol family 16
> [    0.100000] MIPS: machine is D-Link DIR-505 rev. A1
> [    0.610000] Switched to clocksource MIPS
> [    0.610000] NET: Registered protocol family 2
> [    0.620000] TCP established hash table entries: 1024 (order: 0, 4096
> bytes)
> [    0.620000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
> [    0.620000] TCP: Hash tables configured (established 1024 bind 1024)
> [    0.630000] TCP: reno registered
> [    0.630000] UDP hash table entries: 256 (order: 0, 4096 bytes)
> [    0.640000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
> [    0.650000] NET: Registered protocol family 1
> [    0.650000] futex hash table entries: 256 (order: -1, 3072 bytes)
> [    0.670000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
> [    0.670000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME)
> (CMODE_PRIORIT
> Y) (c) 2001-2006 Red Hat, Inc.
> [    0.680000] msgmni has been set to 119
> [    0.680000] io scheduler noop registered
> [    0.690000] io scheduler deadline registered (default)
> [    0.690000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
> [    0.700000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11, base_baud
> = 15
> 62500) is a AR933X UART
> [    0.710000] console [ttyATH0] enabled
> [    0.710000] console [ttyATH0] enabled
> [    0.710000] bootconsole [early0] disabled
> [    0.710000] bootconsole [early0] disabled
> [    0.720000] m25p80 spi0.0: found mx25l6405d, expected m25p80
> [    0.730000] m25p80 spi0.0: mx25l6405d (8192 Kbytes)
> [    0.730000] 6 cmdlinepart partitions found on MTD device spi0.0
> [    0.740000] Creating 6 MTD partitions on "spi0.0":
> [    0.740000] 0x000000000000-0x000000010000 : "u-boot"
> [    0.750000] 0x000000010000-0x000000020000 : "art"
> [    0.760000] 0x000000020000-0x000000030000 : "mac"
> [    0.760000] 0x000000030000-0x000000040000 : "nvram"
> [    0.760000] 0x000000040000-0x000000080000 : "language"
> [    0.770000] 0x000000080000-0x000000800000 : "firmware"
> [    0.810000] 2 uimage-fw partitions found on MTD device firmware
> [    0.810000] 0x000000080000-0x000000199194 : "kernel"
> [    0.820000] mtd: partition "kernel" must either start or end on erase
> block b
> oundary or be smaller than an erase block -- forcing read-only
> [    0.830000] 0x000000199194-0x000000800000 : "rootfs"
> [    0.840000] mtd: partition "rootfs" must either start or end on erase
> block b
> oundary or be smaller than an erase block -- forcing read-only
> [    0.850000] mtd: device 7 (rootfs) set to be root filesystem
> [    0.860000] 1 squashfs-split partitions found on MTD device rootfs
> [    0.860000] 0x000000610000-0x000000800000 : "rootfs_data"
> [    0.880000] libphy: ag71xx_mdio: probed
> [    1.480000] ag71xx-mdio.1: Found an AR7240/AR9330 built-in switch
> [    1.510000] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
> [    2.100000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04
> [uid=004dd0
> 41, driver=Generic PHY]
> [    2.110000] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
> [    2.110000] TCP: cubic registered
> [    2.110000] NET: Registered protocol family 17
> [    2.120000] bridge: automatic filtering via arp/ip/ip6tables has been
> depreca
> ted. Update your scripts to load br_netfilter if you need this.
> [    2.130000] 8021q: 802.1Q VLAN Support v1.8
> [    2.150000] VFS: Mounted root (squashfs filesystem) readonly on device
> 31:7.
> [    2.150000] Freeing unused kernel memory: 244K (80373000 - 803b0000)
> [    3.540000] init: failed to symlink /tmp -> /var
> [    3.550000] init: Console is alive
> [    3.550000] init: - watchdog -
> [    5.960000] usbcore: registered new interface driver usbfs
> [    5.960000] usbcore: registered new interface driver hub
> [    5.970000] usbcore: registered new device driver usb
> [    6.020000] SCSI subsystem initialized
> [    6.030000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
> [    6.040000] ehci-platform: EHCI generic platform driver
> [    6.040000] ehci-platform ehci-platform: EHCI Host Controller
> [    6.050000] ehci-platform ehci-platform: new USB bus registered, assigned
> bus
> number 1
> [    6.060000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
> [    6.080000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
> [    6.080000] hub 1-0:1.0: USB hub found
> [    6.080000] hub 1-0:1.0: 1 port detected
> [    6.090000] usbcore: registered new interface driver usb-storage
> [    6.410000] usb 1-1: new full-speed USB device number 2 using
> ehci-platform
> [    6.600000] init: - preinit -
> [    7.290000] random: procd urandom read with 12 bits of entropy available
> Press the [f] key and hit [enter] to enter failsafe mode
> Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
> [   10.660000] mount_root: loading kmods from internal overlay
> [   11.060000] jffs2: notice: (353) jffs2_build_xattr_subsystem: complete
> buildi
> ng xattr subsystem, 1 of xdatum (1 unchecked, 0 orphan) and 1 of xref (0
> dead, 0
> orphan) found.
> [   11.070000] block: attempting to load
> /tmp/jffs_cfg/upper/etc/config/fstab
> [   11.080000] block: extroot: not configured
> [   11.120000] jffs2: notice: (350) jffs2_build_xattr_subsystem: complete
> buildi
> ng xattr subsystem, 1 of xdatum (1 unchecked, 0 orphan) and 1 of xref (0
> dead, 0
> orphan) found.
> [   11.270000] eth1: link up (100Mbps/Full duplex)
> [   11.370000] block: attempting to load
> /tmp/jffs_cfg/upper/etc/config/fstab
> [   11.380000] block: extroot: not configured
> [   11.380000] mount_root: switching to jffs2 overlay
> [   11.430000] eth1: link down
> [   11.450000] procd: - early -
> [   11.450000] procd: - watchdog -
> [   12.360000] procd: - ubus -
> [   13.370000] procd: - init -
> Please press Enter to activate this console.
> [   14.980000] NET: Registered protocol family 10
> [   15.000000] ip6_tables: (C) 2000-2006 Netfilter Core Team
> [   15.050000] hidraw: raw HID events driver (C) Jiri Kosina
> [   15.070000] u32 classifier
> [   15.070000]     input device check on
> [   15.070000]     Actions configured
> [   15.080000] Mirror/redirect action on
> [   15.090000] nf_conntrack version 0.5.0 (956 buckets, 3824 max)
> [   15.200000] Bluetooth: Core ver 2.19
> [   15.210000] NET: Registered protocol family 31
> [   15.210000] Bluetooth: HCI device and connection manager initialized
> [   15.220000] Bluetooth: HCI socket layer initialized
> [   15.220000] Bluetooth: L2CAP socket layer initialized
> [   15.230000] Bluetooth: SCO socket layer initialized
> [   15.240000] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
> [   15.240000] Bluetooth: BNEP filters: protocol multicast
> [   15.250000] Bluetooth: BNEP socket layer initialized
> [   15.260000] usbcore: registered new interface driver btusb
> [   15.260000] Loading modules backported from Linux version
> master-2015-03-09-0
> -g141f155
> [   15.270000] Backport generated by backports.git
> backports-20150129-0-gdd4a670
> 
> [   15.280000] bluetooth hci0: Direct firmware load for
> brcm/BCM20702A0-0a5c-21e
> 8.hcd failed with error -2
> [   15.280000] bluetooth hci0: Falling back to user helper
> [   15.300000] Bluetooth: HCI UART driver ver 2.2
> [   15.300000] Bluetooth: HCI H4 protocol initialized
> [   15.310000] Bluetooth: HCI BCSP protocol initialized
> [   15.330000] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
> [   15.330000] Bluetooth: HIDP socket layer initialized
> [   15.340000] ip_tables: (C) 2000-2006 Netfilter Core Team
> [   15.430000] Bluetooth: RFCOMM TTY layer initialized
> [   15.440000] Bluetooth: RFCOMM socket layer initialized
> [   15.440000] Bluetooth: RFCOMM ver 1.11
> [   15.540000] xt_time: kernel timezone is -0000
> [   15.600000] cfg80211: Calling CRDA to update world regulatory domain
> [   15.620000] cfg80211: World regulatory domain updated:
> [   15.620000] cfg80211:  DFS Master region: unset
> [   15.620000] cfg80211:   (start_freq - end_freq @ bandwidth),
> (max_antenna_gai
> n, max_eirp), (dfs_cac_time)
> [   15.630000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A,
> 2000 m
> Bm), (N/A)
> [   15.640000] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A,
> 2000 m
> Bm), (N/A)
> [   15.650000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A,
> 2000 m
> Bm), (N/A)
> [   15.660000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A,
> 2000 m
> Bm), (N/A)
> [   15.670000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000
> KHz AU
> TO), (N/A, 2000 mBm), (0 s)
> [   15.680000] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A,
> 2000
> mBm), (0 s)
> [   15.680000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A,
> 2000 m
> Bm), (N/A)
> [   15.690000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz),
> (N/A, 0
> mBm), (N/A)
> [   15.800000] PPP generic driver version 2.4.2
> [   15.810000] NET: Registered protocol family 24
> [   15.870000] firmware brcm!BCM20702A0-0a5c-21e8.hcd:
> firmware_loading_store: m
> ap pages failed
> [   15.880000] Bluetooth: hci0: BCM: patch brcm/BCM20702A0-0a5c-21e8.hcd not
> fou
> nd
> [   15.940000] ieee80211 phy0: Atheros AR9330 Rev:1 mem=0xb8100000, irq=2
> [   15.950000] cfg80211: Calling CRDA for country: US
> [   15.950000] cfg80211: Regulatory domain changed to country: US
> [   15.960000] cfg80211:  DFS Master region: FCC
> [   15.960000] cfg80211:   (start_freq - end_freq @ bandwidth),
> (max_antenna_gai
> n, max_eirp), (dfs_cac_time)
> [   15.970000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A,
> 3000 m
> Bm), (N/A)
> [   15.980000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000
> KHz AU
> TO), (N/A, 1700 mBm), (N/A)
> [   15.990000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000
> KHz AU
> TO), (N/A, 2300 mBm), (0 s)
> [   16.000000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A,
> 3000 m
> Bm), (N/A)
> [   16.010000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz),
> (N/A, 40
> 00 mBm), (N/A)
> [   16.060000] Bluetooth: Unable to create crypto context
> 
> 
> 
> BusyBox v1.23.2 (2015-04-06 07:12:41 MDT) built-in shell (ash)
> 
>   _______                     ________        __
> |       |.-----.-----.-----.|  |  |  |.----.|  |_
> |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
> |_______||   __|_____|__|__||________||__|  |____|
>           |__| W I R E L E S S   F R E E D O M
> -----------------------------------------------------
> CHAOS CALMER (Bleeding Edge, r45288)
> -----------------------------------------------------
>   * 1 1/2 oz Gin            Shake with a glassful
>   * 1/4 oz Triple Sec       of broken ice and pour
>   * 3/4 oz Lime Juice       unstrained into a goblet.
>   * 1 1/2 oz Orange Juice
>   * 1 tsp. Grenadine Syrup
> -----------------------------------------------------
> root@OpenWrt:/#
> root@OpenWrt:/#
> root@OpenWrt:/#
> root@OpenWrt:/# [   27.080000] device eth1 entered promiscuous mode
> [   27.080000] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
> 
> root@OpenWrt:/# [   29.870000] eth1: link up (100Mbps/Full duplex)
> [   29.870000] br-lan: port 1(eth1) entered forwarding state
> [   29.880000] br-lan: port 1(eth1) entered forwarding state
> [   29.880000] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
> [   31.880000] br-lan: port 1(eth1) entered forwarding state
> 
> 
> root@OpenWrt:/# hciconfig hci0 up
> root@OpenWrt:/# hciconfig
> hci0:   Type: BR/EDR  Bus: USB
>         BD Address: 00:19:0E:12:46:8A  ACL MTU: 1021:8  SCO MTU: 64:1
>         UP RUNNING
>         RX bytes:1158 acl:0 sco:0 events:63 errors:0
>         TX bytes:1046 acl:0 sco:0 commands:63 errors:0
> 
> 
> root@OpenWrt:/# gatttool --adapter=hci0 -I
> [                 ][LE]> connect EC:FE:7E:10:95:1F
> Attempting to connect to EC:FE:7E:10:95:1F
> Connection successful
> [EC:FE:7E:10:95:1F][LE]> sec-level medium
> [  334.770000] CPU 0 Unable to handle kernel paging request at virtual
> address 0
> 0000200, epc == 80067e20, ra == 83231668
> [  334.770000] Oops[#1]:
> [  334.770000] CPU: 0 PID: 1553 Comm: gatttool Not tainted 3.18.10 #7
> [  334.770000] task: 82a43548 ti: 829a8000 task.ti: 829a8000
> [  334.770000] $ 0   : 00000000 7ffaed06 00000000 00000000
> [  334.770000] $ 4   : 00000200 830bcc0c 00000000 00000000
> [  334.770000] $ 8   : 00000000 00000000 00000001 00000057
> [  334.770000] $12   : 7ffaecd0 00000002 00000000 00000000
> [  334.770000] $16   : 830bcc00 829d1700 00000000 00000002
> [  334.770000] $20   : 00000200 006afb50 77209118 00000000
> [  334.770000] $24   : 00000000 7709ca40
> [  334.770000] $28   : 829a8000 829a9e88 00000000 83231668
> [  334.770000] Hi    : 00000020
> [  334.770000] Lo    : 00000033
> [  334.770000] epc   : 80067e20 mutex_lock+0x0/0x30
> [  334.770000]     Not tainted
> [  334.770000] ra    : 83231668 smp_conn_security+0x88/0x200 [bluetooth]
> [  334.770000] Status: 1000fc03 KERNEL EXL IE
> [  334.770000] Cause : 00800008
> [  334.770000] BadVA : 00000200
> [  334.770000] PrId  : 00019374 (MIPS 24Kc)
> [  334.770000] Modules linked in: ath9k ath9k_common pppoe ppp_async
> iptable_nat
> ath9k_hw ath pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6
> nf_conntrack_ipv4
> mac80211 ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_tcpmss
> xt_strin
> g xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac
> xt_limit xt
> _length xt_id xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark
> xt_connlim
> it xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CT
> xt_C
> LASSIFY ts_kmp ts_fsm ts_bm slhc rfcomm nf_reject_ipv4
> nf_nat_masquerade_ipv4 nf
> _nat_irc nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4
> nf_conntrac
> k_rtcache nf_conntrack_irc nf_conntrack_ftp iptable_raw iptable_mangle
> iptable_f
> ilter ipt_ECN ip_tables hidp hci_uart crc_ccitt compat btusb bnep bluetooth
> act_
> connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex
> cls_flow
> cls_route cls_fw sch_hfsc sch_ingress hid evdev input_core ledtrig_usbdev
> ip6t_
> REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle
> ip6
> table_filter ip6_tables x_tables ifb ipv6 arc4 crypto_blkcipher usb_storage
> ehci
> _platform ehci_hcd sd_mod scsi_mod gpio_button_hotplug ext4 jbd2 mbcache
> usbcore
> nls_base usb_common crc16 crypto_hash
> [  334.770000] Process gatttool (pid: 1553, threadinfo=829a8000,
> task=82a43548,
> tls=772c4750)
> [  334.770000] Stack : 829a9f00 80134464 0000540f 00000000 7ffaedb8 801381f4
> 829
> 9d400 7ffaed04
>           82ade200 ffffffea 83237b50 8322e274 77209118 7ffaee20 829a9ee8
> 006af8a
> 8
>           02000000 80269348 00000004 800796d4 83550b00 00000002 7ffaed04
> 0000000
> 4
>           00000112 8007c714 00000000 00000000 00000000 00000000 00000002
> 0000000
> 0
>           00000000 00000000 00000005 00000002 006af8a8 77294b70 00000000
> 80062b5
> c
>           ...
> [  334.770000] Call Trace:
> [  334.770000] [<80067e20>] mutex_lock+0x0/0x30
> [  334.770000] [<83231668>] smp_conn_security+0x88/0x200 [bluetooth]
> [  334.770000] [<8322e274>] l2cap_is_socket+0x1514/0x242c [bluetooth]
> [  334.770000]
> [  334.770000]
> Code: 8fb00024  03e00008  27bd0040 <c0820000> 2443ffff  e0830000  1060fffc
> 0000
> 0000  2442ffff
> [  335.050000] ---[ end trace fe8f2f0ed758dfcc ]---
> 
> Will Tucker
> BlueRadios, Inc.
> 8310 South Valley Highway, Suite 275
> Englewood, Colorado 80112
> USA
> wtucker@BlueRadios.com 
> www.BlueRadios.com 


^ permalink raw reply	[relevance 0%]

* Linux version 3.18.10 Bluez ver 5.28 security level crashing system
@ 2015-04-07 16:27  3% Will Tucker
  2015-04-07 17:21  0% ` Peter Hurley
  0 siblings, 1 reply; 28+ results
From: Will Tucker @ 2015-04-07 16:27 UTC (permalink / raw)
  To: linux-kernel

Hi 
Trying to get Bluez 5.28  pairing to work on openwrt. Using Linux version
3.18.10.

I would use Bluez 5.30 but I read a post that stated it needed Linux 3.19
and that may be long tedious job to update openwrt. Below is the sequence
and result of trying to set the security level using bluetoothctl
interactively.

eth0: 00:03:7f:ff:ff:ff
eth0 up
: cfg1 0xf cfg2 0x7214
eth1: 00:03:7f:ff:ff:fe
athrs26_reg_init_lan
ATHRS26: resetting s26
ATHRS26: s26 reset done
eth1 up
eth0, eth1
Hit any key to stop autoboot:  0
## Booting image at 9f080000 ...
   Image Name:   MIPS OpenWrt Linux-3.18.10
   Created:      2015-04-07  13:03:05 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1151316 Bytes =  1.1 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum at 0x9f080040 ...OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 67108864

Starting kernel ...

[    0.000000] Linux version 3.18.10 (guest@WILLS-LINUX-BOX) (gcc version
4.8.3
(OpenWrt/Linaro GCC 4.8-2014.04 r44873) ) #7 Tue Apr 7 07:02:38 MDT 2015
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Atheros AR9330 rev 1
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x03ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x03ffffff]
[    0.000000] Initmem setup node 0 [mem 0x00000000-0x03ffffff]
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32
bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize
32
bytes
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total
pag
es: 16256
[    0.000000] Kernel command line:  board=DIR-505-A1 console=ttyATH0,115200
mtd
parts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,256k(language)
ro,7
680k@0x80000(firmware) rootfstype=squashfs,jffs2 noinitrd
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 60944K/65536K available (2485K kernel code, 125K
rwdata,
528K rodata, 244K init, 188K bss, 4592K reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz,
Ref:25.00
0MHz
[    0.000000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
[    0.080000] pid_max: default: 32768 minimum: 301
[    0.080000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.090000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096
bytes)
[    0.100000] NET: Registered protocol family 16
[    0.100000] MIPS: machine is D-Link DIR-505 rev. A1
[    0.610000] Switched to clocksource MIPS
[    0.610000] NET: Registered protocol family 2
[    0.620000] TCP established hash table entries: 1024 (order: 0, 4096
bytes)
[    0.620000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.620000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.630000] TCP: reno registered
[    0.630000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.640000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.650000] NET: Registered protocol family 1
[    0.650000] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.670000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.670000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME)
(CMODE_PRIORIT
Y) (c) 2001-2006 Red Hat, Inc.
[    0.680000] msgmni has been set to 119
[    0.680000] io scheduler noop registered
[    0.690000] io scheduler deadline registered (default)
[    0.690000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.700000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11, base_baud
= 15
62500) is a AR933X UART
[    0.710000] console [ttyATH0] enabled
[    0.710000] console [ttyATH0] enabled
[    0.710000] bootconsole [early0] disabled
[    0.710000] bootconsole [early0] disabled
[    0.720000] m25p80 spi0.0: found mx25l6405d, expected m25p80
[    0.730000] m25p80 spi0.0: mx25l6405d (8192 Kbytes)
[    0.730000] 6 cmdlinepart partitions found on MTD device spi0.0
[    0.740000] Creating 6 MTD partitions on "spi0.0":
[    0.740000] 0x000000000000-0x000000010000 : "u-boot"
[    0.750000] 0x000000010000-0x000000020000 : "art"
[    0.760000] 0x000000020000-0x000000030000 : "mac"
[    0.760000] 0x000000030000-0x000000040000 : "nvram"
[    0.760000] 0x000000040000-0x000000080000 : "language"
[    0.770000] 0x000000080000-0x000000800000 : "firmware"
[    0.810000] 2 uimage-fw partitions found on MTD device firmware
[    0.810000] 0x000000080000-0x000000199194 : "kernel"
[    0.820000] mtd: partition "kernel" must either start or end on erase
block b
oundary or be smaller than an erase block -- forcing read-only
[    0.830000] 0x000000199194-0x000000800000 : "rootfs"
[    0.840000] mtd: partition "rootfs" must either start or end on erase
block b
oundary or be smaller than an erase block -- forcing read-only
[    0.850000] mtd: device 7 (rootfs) set to be root filesystem
[    0.860000] 1 squashfs-split partitions found on MTD device rootfs
[    0.860000] 0x000000610000-0x000000800000 : "rootfs_data"
[    0.880000] libphy: ag71xx_mdio: probed
[    1.480000] ag71xx-mdio.1: Found an AR7240/AR9330 built-in switch
[    1.510000] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    2.100000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04
[uid=004dd0
41, driver=Generic PHY]
[    2.110000] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    2.110000] TCP: cubic registered
[    2.110000] NET: Registered protocol family 17
[    2.120000] bridge: automatic filtering via arp/ip/ip6tables has been
depreca
ted. Update your scripts to load br_netfilter if you need this.
[    2.130000] 8021q: 802.1Q VLAN Support v1.8
[    2.150000] VFS: Mounted root (squashfs filesystem) readonly on device
31:7.
[    2.150000] Freeing unused kernel memory: 244K (80373000 - 803b0000)
[    3.540000] init: failed to symlink /tmp -> /var
[    3.550000] init: Console is alive
[    3.550000] init: - watchdog -
[    5.960000] usbcore: registered new interface driver usbfs
[    5.960000] usbcore: registered new interface driver hub
[    5.970000] usbcore: registered new device driver usb
[    6.020000] SCSI subsystem initialized
[    6.030000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    6.040000] ehci-platform: EHCI generic platform driver
[    6.040000] ehci-platform ehci-platform: EHCI Host Controller
[    6.050000] ehci-platform ehci-platform: new USB bus registered, assigned
bus
number 1
[    6.060000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[    6.080000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[    6.080000] hub 1-0:1.0: USB hub found
[    6.080000] hub 1-0:1.0: 1 port detected
[    6.090000] usbcore: registered new interface driver usb-storage
[    6.410000] usb 1-1: new full-speed USB device number 2 using
ehci-platform
[    6.600000] init: - preinit -
[    7.290000] random: procd urandom read with 12 bits of entropy available
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[   10.660000] mount_root: loading kmods from internal overlay
[   11.060000] jffs2: notice: (353) jffs2_build_xattr_subsystem: complete
buildi
ng xattr subsystem, 1 of xdatum (1 unchecked, 0 orphan) and 1 of xref (0
dead, 0
orphan) found.
[   11.070000] block: attempting to load
/tmp/jffs_cfg/upper/etc/config/fstab
[   11.080000] block: extroot: not configured
[   11.120000] jffs2: notice: (350) jffs2_build_xattr_subsystem: complete
buildi
ng xattr subsystem, 1 of xdatum (1 unchecked, 0 orphan) and 1 of xref (0
dead, 0
orphan) found.
[   11.270000] eth1: link up (100Mbps/Full duplex)
[   11.370000] block: attempting to load
/tmp/jffs_cfg/upper/etc/config/fstab
[   11.380000] block: extroot: not configured
[   11.380000] mount_root: switching to jffs2 overlay
[   11.430000] eth1: link down
[   11.450000] procd: - early -
[   11.450000] procd: - watchdog -
[   12.360000] procd: - ubus -
[   13.370000] procd: - init -
Please press Enter to activate this console.
[   14.980000] NET: Registered protocol family 10
[   15.000000] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   15.050000] hidraw: raw HID events driver (C) Jiri Kosina
[   15.070000] u32 classifier
[   15.070000]     input device check on
[   15.070000]     Actions configured
[   15.080000] Mirror/redirect action on
[   15.090000] nf_conntrack version 0.5.0 (956 buckets, 3824 max)
[   15.200000] Bluetooth: Core ver 2.19
[   15.210000] NET: Registered protocol family 31
[   15.210000] Bluetooth: HCI device and connection manager initialized
[   15.220000] Bluetooth: HCI socket layer initialized
[   15.220000] Bluetooth: L2CAP socket layer initialized
[   15.230000] Bluetooth: SCO socket layer initialized
[   15.240000] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   15.240000] Bluetooth: BNEP filters: protocol multicast
[   15.250000] Bluetooth: BNEP socket layer initialized
[   15.260000] usbcore: registered new interface driver btusb
[   15.260000] Loading modules backported from Linux version
master-2015-03-09-0
-g141f155
[   15.270000] Backport generated by backports.git
backports-20150129-0-gdd4a670

[   15.280000] bluetooth hci0: Direct firmware load for
brcm/BCM20702A0-0a5c-21e
8.hcd failed with error -2
[   15.280000] bluetooth hci0: Falling back to user helper
[   15.300000] Bluetooth: HCI UART driver ver 2.2
[   15.300000] Bluetooth: HCI H4 protocol initialized
[   15.310000] Bluetooth: HCI BCSP protocol initialized
[   15.330000] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[   15.330000] Bluetooth: HIDP socket layer initialized
[   15.340000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   15.430000] Bluetooth: RFCOMM TTY layer initialized
[   15.440000] Bluetooth: RFCOMM socket layer initialized
[   15.440000] Bluetooth: RFCOMM ver 1.11
[   15.540000] xt_time: kernel timezone is -0000
[   15.600000] cfg80211: Calling CRDA to update world regulatory domain
[   15.620000] cfg80211: World regulatory domain updated:
[   15.620000] cfg80211:  DFS Master region: unset
[   15.620000] cfg80211:   (start_freq - end_freq @ bandwidth),
(max_antenna_gai
n, max_eirp), (dfs_cac_time)
[   15.630000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A,
2000 m
Bm), (N/A)
[   15.640000] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A,
2000 m
Bm), (N/A)
[   15.650000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A,
2000 m
Bm), (N/A)
[   15.660000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A,
2000 m
Bm), (N/A)
[   15.670000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000
KHz AU
TO), (N/A, 2000 mBm), (0 s)
[   15.680000] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A,
2000
mBm), (0 s)
[   15.680000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A,
2000 m
Bm), (N/A)
[   15.690000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz),
(N/A, 0
mBm), (N/A)
[   15.800000] PPP generic driver version 2.4.2
[   15.810000] NET: Registered protocol family 24
[   15.870000] firmware brcm!BCM20702A0-0a5c-21e8.hcd:
firmware_loading_store: m
ap pages failed
[   15.880000] Bluetooth: hci0: BCM: patch brcm/BCM20702A0-0a5c-21e8.hcd not
fou
nd
[   15.940000] ieee80211 phy0: Atheros AR9330 Rev:1 mem=0xb8100000, irq=2
[   15.950000] cfg80211: Calling CRDA for country: US
[   15.950000] cfg80211: Regulatory domain changed to country: US
[   15.960000] cfg80211:  DFS Master region: FCC
[   15.960000] cfg80211:   (start_freq - end_freq @ bandwidth),
(max_antenna_gai
n, max_eirp), (dfs_cac_time)
[   15.970000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A,
3000 m
Bm), (N/A)
[   15.980000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000
KHz AU
TO), (N/A, 1700 mBm), (N/A)
[   15.990000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000
KHz AU
TO), (N/A, 2300 mBm), (0 s)
[   16.000000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A,
3000 m
Bm), (N/A)
[   16.010000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz),
(N/A, 40
00 mBm), (N/A)
[   16.060000] Bluetooth: Unable to create crypto context



BusyBox v1.23.2 (2015-04-06 07:12:41 MDT) built-in shell (ash)

  _______                     ________        __
|       |.-----.-----.-----.|  |  |  |.----.|  |_
|   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
|_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
-----------------------------------------------------
CHAOS CALMER (Bleeding Edge, r45288)
-----------------------------------------------------
  * 1 1/2 oz Gin            Shake with a glassful
  * 1/4 oz Triple Sec       of broken ice and pour
  * 3/4 oz Lime Juice       unstrained into a goblet.
  * 1 1/2 oz Orange Juice
  * 1 tsp. Grenadine Syrup
-----------------------------------------------------
root@OpenWrt:/#
root@OpenWrt:/#
root@OpenWrt:/#
root@OpenWrt:/# [   27.080000] device eth1 entered promiscuous mode
[   27.080000] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready

root@OpenWrt:/# [   29.870000] eth1: link up (100Mbps/Full duplex)
[   29.870000] br-lan: port 1(eth1) entered forwarding state
[   29.880000] br-lan: port 1(eth1) entered forwarding state
[   29.880000] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   31.880000] br-lan: port 1(eth1) entered forwarding state


root@OpenWrt:/# hciconfig hci0 up
root@OpenWrt:/# hciconfig
hci0:   Type: BR/EDR  Bus: USB
        BD Address: 00:19:0E:12:46:8A  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING
        RX bytes:1158 acl:0 sco:0 events:63 errors:0
        TX bytes:1046 acl:0 sco:0 commands:63 errors:0


root@OpenWrt:/# gatttool --adapter=hci0 -I
[                 ][LE]> connect EC:FE:7E:10:95:1F
Attempting to connect to EC:FE:7E:10:95:1F
Connection successful
[EC:FE:7E:10:95:1F][LE]> sec-level medium
[  334.770000] CPU 0 Unable to handle kernel paging request at virtual
address 0
0000200, epc == 80067e20, ra == 83231668
[  334.770000] Oops[#1]:
[  334.770000] CPU: 0 PID: 1553 Comm: gatttool Not tainted 3.18.10 #7
[  334.770000] task: 82a43548 ti: 829a8000 task.ti: 829a8000
[  334.770000] $ 0   : 00000000 7ffaed06 00000000 00000000
[  334.770000] $ 4   : 00000200 830bcc0c 00000000 00000000
[  334.770000] $ 8   : 00000000 00000000 00000001 00000057
[  334.770000] $12   : 7ffaecd0 00000002 00000000 00000000
[  334.770000] $16   : 830bcc00 829d1700 00000000 00000002
[  334.770000] $20   : 00000200 006afb50 77209118 00000000
[  334.770000] $24   : 00000000 7709ca40
[  334.770000] $28   : 829a8000 829a9e88 00000000 83231668
[  334.770000] Hi    : 00000020
[  334.770000] Lo    : 00000033
[  334.770000] epc   : 80067e20 mutex_lock+0x0/0x30
[  334.770000]     Not tainted
[  334.770000] ra    : 83231668 smp_conn_security+0x88/0x200 [bluetooth]
[  334.770000] Status: 1000fc03 KERNEL EXL IE
[  334.770000] Cause : 00800008
[  334.770000] BadVA : 00000200
[  334.770000] PrId  : 00019374 (MIPS 24Kc)
[  334.770000] Modules linked in: ath9k ath9k_common pppoe ppp_async
iptable_nat
ath9k_hw ath pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6
nf_conntrack_ipv4
mac80211 ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_tcpmss
xt_strin
g xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac
xt_limit xt
_length xt_id xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark
xt_connlim
it xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CT
xt_C
LASSIFY ts_kmp ts_fsm ts_bm slhc rfcomm nf_reject_ipv4
nf_nat_masquerade_ipv4 nf
_nat_irc nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4
nf_conntrac
k_rtcache nf_conntrack_irc nf_conntrack_ftp iptable_raw iptable_mangle
iptable_f
ilter ipt_ECN ip_tables hidp hci_uart crc_ccitt compat btusb bnep bluetooth
act_
connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex
cls_flow
cls_route cls_fw sch_hfsc sch_ingress hid evdev input_core ledtrig_usbdev
ip6t_
REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle
ip6
table_filter ip6_tables x_tables ifb ipv6 arc4 crypto_blkcipher usb_storage
ehci
_platform ehci_hcd sd_mod scsi_mod gpio_button_hotplug ext4 jbd2 mbcache
usbcore
nls_base usb_common crc16 crypto_hash
[  334.770000] Process gatttool (pid: 1553, threadinfo=829a8000,
task=82a43548,
tls=772c4750)
[  334.770000] Stack : 829a9f00 80134464 0000540f 00000000 7ffaedb8 801381f4
829
9d400 7ffaed04
          82ade200 ffffffea 83237b50 8322e274 77209118 7ffaee20 829a9ee8
006af8a
8
          02000000 80269348 00000004 800796d4 83550b00 00000002 7ffaed04
0000000
4
          00000112 8007c714 00000000 00000000 00000000 00000000 00000002
0000000
0
          00000000 00000000 00000005 00000002 006af8a8 77294b70 00000000
80062b5
c
          ...
[  334.770000] Call Trace:
[  334.770000] [<80067e20>] mutex_lock+0x0/0x30
[  334.770000] [<83231668>] smp_conn_security+0x88/0x200 [bluetooth]
[  334.770000] [<8322e274>] l2cap_is_socket+0x1514/0x242c [bluetooth]
[  334.770000]
[  334.770000]
Code: 8fb00024  03e00008  27bd0040 <c0820000> 2443ffff  e0830000  1060fffc
0000
0000  2442ffff
[  335.050000] ---[ end trace fe8f2f0ed758dfcc ]---

Will Tucker
BlueRadios, Inc.
8310 South Valley Highway, Suite 275
Englewood, Colorado 80112
USA
wtucker@BlueRadios.com 
www.BlueRadios.com 





^ permalink raw reply	[relevance 3%]

* RE: using DMA-API on ARM
  @ 2014-12-08 13:47  1%           ` Hante Meuleman
  0 siblings, 0 replies; 28+ results
From: Hante Meuleman @ 2014-12-08 13:47 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Will Deacon, Arend Van Spriel, Marek Szyprowski,
	linux-arm-kernel, David Miller, linux-kernel, brcm80211-dev-list,
	linux-wireless

[-- Attachment #1: Type: text/plain, Size: 4257 bytes --]

Still using outlook, but will limit the line length, I hope that works for the
moment. Attached is a log with the requested information, it is a little
bit non-standard though. The dump code from the mm was copied in
the driver and called from there, mapping the prints back to our local
printf, but it should produce the same. I did this because I didn't realize
the table is static.

Some background on the test setup: I'm using a Broadcom reference 
design AP platform with an BRCM 4708 host SOC. For the AP router 
platform the opensource packet OpenWRT was used. Some small
modifications were made to get it to work on our HW. Only one core
is enabled for the moment (no time to figure out how to enable the
other one). Openwrt was configured to use kernel 3.18-rc2 and 
the brcmfmac of the compat-wireless code was updated with our 
latest code (minor patches, which have been submitted already). 
The device used is 43602 pcie device. Some modifications to the build
system were made to enable PCIE. The test is to connect with a 
client to the AP and run iperf (TCP). The test can run for many hours
without a problem, but sometimes fails very quickly.

The log: first the ring allocation info is printed. Starting at
16.124847, ring 2, 3 and 4 are rings used for device to host. In this
log the failure is on a read of ring 3. Ring 3 is 1024 entries of each
16 bytes. The next thing printed is the kernel page tables. Then some 
OpenWRT info and the logging of part of the connection setup. Then at 
1780.130752 the logging of the failure starts. The sequence number is 
modulo 253 with ring size of 1024 matches an "old" entry (read 40, 
expected 52). Then the different pointers are printed followed by 
the kernel page table. The code does then a cache invalidate on the 
dma_handle and the next read the sequence number is correct.

Regards,
Hante



Please wrap your message - replying to a message which looks like this in
my editor is far from easy, and gives me much more work to /manually/
reformat it before I can reply to it:

On Fri, Dec 05, 2014 at 12:56:45PM +0000, Hante Meuleman wrote:
> The problem is with data coming from device, so DMA from device to host. The $
>
> However: this indicates that dma_alloc_coherent on an ARM target may result i$
>
> Regards,
> Hante

Thanks.

On Fri, Dec 05, 2014 at 12:56:45PM +0000, Hante Meuleman wrote:
> However: this indicates that dma_alloc_coherent on an ARM target may
> result in a memory buffer which can be cached which conflicts with
> the API of this function.

If the memory has an alias which is cacheable, it is possible for cache
lines to get allocated via that alias, even if the alias has no explicit
accesses to it.

This is something which I've been going on for quite literally /years/ -
mismatched cache attributes can cause unpredictable behaviour.  I've had
a lot of push back from people who are of the opinion that "if it works
for me, then there isn't a problem" and I eventually gave up fighting
the battle, especially as the ARM architecture people weakened my
reasoning behind it by publishing a relaxation of the "no differing
attributes" issue.  This was particularly true of those who wanted to
use ioremap() on system memory - and cases such as
dma_init_coherent_memory().

So, I never fixed this problem in the original DMA allocator code; I
basically gave up with it.  It's a latent bug which did need to be fixed,
and is still present today in the non-CMA case.

The symptoms which you are reporting sound very much like this kind of
problem - the virtual address for the memory returned by
dma_alloc_coherent() will not be cacheable memory - it will have been
remapped using map_vm_area().  However, there could very well be a fully
cacheable lowmem mapping of that memory, which if a read (speculative or
otherwise) will bring a cache line in, and because the caches are VIPT
or PIPT, that cache line can be hit via the non-cacheable mapping too.

What I /really/ need is more evidence of this to tell those disbelievers
where to stick their flawed arguments. :)

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.

[-- Attachment #2: cache_fail_dmesg.txt --]
[-- Type: text/plain, Size: 35592 bytes --]

root@OpenWrt:/# dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 3.18.0-rc2 (developer@meuleman-test) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r43121) ) #66 SMP Mon Dec 8 12:38:39 CET 2014
[    0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7),c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Buffalo WZR-1750DHP (BCM4708)
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] On node 0 totalpages: 32768
[    0.000000] free_area_init_node: node 0, pgdat c038ee00, node_mem_map c7efb000
[    0.000000]   Normal zone: 256 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 32768 pages, LIFO batch:7
[    0.000000] PERCPU: Embedded 9 pages/cpu @c7ee3000 s6528 r8192 d22144 u36864
[    0.000000] pcpu-alloc: s6528 r8192 d22144 u36864 alloc=9*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Memory: 125936K/131072K available (2682K kernel code, 103K rwdata, 744K rodata, 164K init, 188K bss, 5136K reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
[    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0360dc4   (3428 kB)
[    0.000000]       .init : 0xc0361000 - 0xc038a000   ( 164 kB)
[    0.000000]       .data : 0xc038a000 - 0xc03a3eb8   ( 104 kB)
[    0.000000]        .bss : 0xc03a3eb8 - 0xc03d2ebc   ( 189 kB)
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] PL310 OF: cache setting yield illegal associativity
[    0.000000] PL310 OF: -1069781724 calculated, only 8 and 16 legal
[    0.000000] L2C-310 enabling early BRESP for Cortex-A9
[    0.000000] L2C-310 full line of zeros enabled for Cortex-A9
[    0.000000] L2C-310 dynamic clock gating enabled, standby mode enabled
[    0.000000] L2C-310 cache controller enabled, 16 ways, 256 kB
[    0.000000] L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x4e130001
[    0.000017] sched_clock: 64 bits at 400MHz, resolution 2ns, wraps every 2748779069440ns
[    0.000315] Calibrating delay loop... 1594.16 BogoMIPS (lpj=7970816)
[    0.090133] pid_max: default: 32768 minimum: 301
[    0.090299] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.090312] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.090822] CPU: Testing write buffer coherency: ok
[    0.091084] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.091152] Setting up static identity map for 0x11728 - 0x1175c
[    0.092455] Brought up 1 CPUs
[    0.092471] SMP: Total of 1 processors activated.
[    0.092481] CPU: All CPU(s) started in SVC mode.
[    0.099682] NET: Registered protocol family 16
[    0.100425] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.106341] usbcore: registered new interface driver usbfs
[    0.106422] usbcore: registered new interface driver hub
[    0.106500] usbcore: registered new device driver usb
[    0.107259] Switched to clocksource arm_global_timer
[    0.108567] NET: Registered protocol family 2
[    0.109224] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.109251] TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
[    0.109278] TCP: Hash tables configured (established 1024 bind 1024)
[    0.109350] TCP: reno registered
[    0.109368] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.109404] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.109669] NET: Registered protocol family 1
[    0.109737] PCI: CLS 0 bytes, default 64
[    0.110768] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.111905] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.111932] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.112155] msgmni has been set to 245
[    0.113050] io scheduler noop registered
[    0.113073] io scheduler deadline registered (default)
[    0.113329] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.113952] console [ttyS0] disabled
[    0.114026] of_serial 18000300.serial: ttyS0 at MMIO 0x18000300 (irq = 117, base_baud = 6250000) is a 16550
[    0.514919] console [ttyS0] enabled
[    0.518713] of_serial 18000400.serial: ttyS1 at MMIO 0x18000400 (irq = 117, base_baud = 6250000) is a 16550
[    0.603994] no nvram found
[    0.606975] Unsupported SPROM revision 0 detected. Will extract v1
[    0.613693] bcmnand: Broadcom NAND Controller driver loaded
[    0.620439] bgmac: Broadcom 47xx GBit MAC driver loaded
[    0.625723] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.632256] ehci-pci: EHCI PCI platform driver
[    0.636742] ehci-platform: EHCI generic platform driver
[    0.642218] bcma: bus0: Found chip with id 53010, rev 0x00 and package 0x02
[    0.649209] bcma: bus0: Core 0 found: ChipCommon (manuf 0x4BF, id 0x800, rev 0x2A, class 0x0)
[    0.657791] bcma: bus0: Core 1 found: Chipcommon B (manuf 0x4BF, id 0x50B, rev 0x01, class 0x0)
[    0.666522] bcma: bus0: Core 2 found: DMA (manuf 0x4BF, id 0x502, rev 0x01, class 0x0)
[    0.674477] bcma: bus0: Core 3 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x05, class 0x0)
[    0.682858] bcma: bus0: Core 4 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x05, class 0x0)
[    0.691249] bcma: bus0: Core 5 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x05, class 0x0)
[    0.699635] bcma: bus0: Core 6 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x05, class 0x0)
[    0.707993] bcma: bus0: Core 7 found: PCIe Gen 2 (manuf 0x4BF, id 0x501, rev 0x01, class 0x0)
[    0.716528] bcma: bus0: Core 8 found: PCIe Gen 2 (manuf 0x4BF, id 0x501, rev 0x01, class 0x0)
[    0.725074] bcma: bus0: Core 9 found: PCIe Gen 2 (manuf 0x4BF, id 0x501, rev 0x01, class 0x0)
[    0.733641] bcma: bus0: Core 10 found: ARM Cortex A9 core (ihost) (manuf 0x4BF, id 0x510, rev 0x01, class 0x0)
[    0.743658] bcma: bus0: Core 11 found: USB 2.0 (manuf 0x4BF, id 0x504, rev 0x01, class 0x0)
[    0.752036] bcma: bus0: Core 12 found: USB 3.0 (manuf 0x4BF, id 0x505, rev 0x01, class 0x0)
[    0.760426] bcma: bus0: Core 13 found: SDIO3 (manuf 0x4BF, id 0x503, rev 0x01, class 0x0)
[    0.768626] bcma: bus0: Core 14 found: ARM Cortex A9 JTAG (manuf 0x4BF, id 0x506, rev 0x01, class 0x0)
[    0.777962] bcma: bus0: Core 15 found: Denali DDR2/DDR3 memory controller (manuf 0x4BF, id 0x507, rev 0x01, class 0x0)
[    0.788681] bcma: bus0: Core 16 found: ROM (manuf 0x4BF, id 0x508, rev 0x01, class 0x0)
[    0.796726] bcma: bus0: Core 17 found: NAND flash controller (manuf 0x4BF, id 0x509, rev 0x01, class 0x0)
[    0.806325] bcma: bus0: Core 18 found: SPI flash controller (manuf 0x4BF, id 0x50A, rev 0x01, class 0x0)
[    0.820252] bcmnand: NAND Controller rev 6.1
[    0.840228] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xdc
[    0.846565] nand: Micron NAND 512MiB 3,3V 8-bit
[    0.851094] nand: 512MiB, SLC, page size: 2048, OOB size: 64
[    1.220976] bcm53xxspiflash spi32766.0: mx25l25635e (32768 Kbytes)
[    2.585498] next_part_offset limited to 1000000
[    2.590014] 5 bcm47xxpart partitions found on MTD device spi32766.0
[    2.596260] Creating 5 MTD partitions on "spi32766.0":
[    2.601389] 0x000000000000-0x000000040000 : "boot"
[    2.606848] 0x000000040000-0x000000ff0000 : "firmware"
[    2.612569] 0x00000004001c-0x000000184c00 : "linux"
[    2.617429] mtd: partition "linux" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[    2.630415] 0x000000184c00-0x000000ff0000 : "rootfs"
[    2.635364] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[    2.648435] mtd: device 4 (rootfs) set to be root filesystem
[    2.654360] 1 squashfs-split partitions found on MTD device rootfs
[    2.660542] 0x000000450000-0x000000ff0000 : "rootfs_data"
[    2.666561] 0x000000ff0000-0x000001000000 : "nvram"
[    2.672108] bcma: bus0: Found sprom from device tree provider
[    2.678032] bgmac bcma0:3: Invalid MAC addr: 00:00:00:00:00:00
[    2.683900] bgmac bcma0:3: Using random MAC: a2:68:1a:ca:99:26
[    2.689770] bgmac bcma0:3: Found PHY addr: 0
[    2.698590] libphy: bgmac mii bus: probed
[    2.781466] b53_common: found switch: BCM53011, rev 3
[    2.787094] netif_napi_add() called with weight 128 on device eth0
[    2.793422] bgmac bcma0:4: Invalid MAC addr: 00:00:00:00:00:00
[    2.799255] bgmac bcma0:4: Using random MAC: 6a:b7:e9:ad:58:4c
[    2.805138] bgmac bcma0:4: Found PHY addr: 0
[    2.812607] libphy: bgmac mii bus: probed
[    2.890939] bgmac: Unsupported core_unit 2
[    2.895033] bgmac: probe of bcma0:5 failed with error -524
[    2.900619] bgmac: Unsupported core_unit 3
[    2.904704] bgmac: probe of bcma0:6 failed with error -524
[    2.910271] pcie2_bcma bcma0:7: scanning bus
[    3.164199] pcie2_bcma bcma0:7: switching to GEN2
[    3.418495] pcie2_bcma bcma0:7: PCI host bridge to bus 0000:00
[    3.424332] pci_bus 0000:00: root bus resource [mem 0x08000000-0x0fffffff]
[    3.431189] pci_bus 0000:00: root bus resource [io  0x8000000-0xfffffff]
[    3.437859] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    3.445774] pci 0000:00:00.0: [14e4:8011] type 01 class 0x060400
[    3.445842] pci 0000:00:00.0: PME# supported from D0 D3hot D3cold
[    3.446051] PCI: bus0: Fast back to back transfers disabled
[    3.451757] pci 0000:01:00.0: [14e4:43bc] type 00 class 0x028000
[    3.451792] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00007fff 64bit]
[    3.451815] pci 0000:01:00.0: reg 0x18: [mem 0x00000000-0x003fffff 64bit]
[    3.451908] pci 0000:01:00.0: supports D1 D2
[    3.451920] pci 0000:01:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    3.452102] PCI: bus1: Fast back to back transfers disabled
[    3.457657] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    3.457675] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 01
[    3.457724] pci 0000:00:00.0: BAR 8: assigned [mem 0x08000000-0x085fffff]
[    3.464514] pci 0000:01:00.0: BAR 2: assigned [mem 0x08000000-0x083fffff 64bit]
[    3.471808] pci 0000:01:00.0: BAR 0: assigned [mem 0x08400000-0x08407fff 64bit]
[    3.479098] pci 0000:00:00.0: PCI bridge to [bus 01]
[    3.484050] pci 0000:00:00.0:   bridge window [mem 0x08000000-0x085fffff]
[    3.490879] pci 0000:01:00.0: Max Payload Size 128, but upstream 0000:00:00.0 set to 512; if necessary, use "pci=pcie_bus_safe" and report a bug
[    3.503894] pcie2_bcma bcma0:8: scanning bus
[    3.757879] pcie2_bcma bcma0:9: scanning bus
[    4.012438] bcma: bus0: Bus registered
[    4.016517] TCP: cubic registered
[    4.019832] NET: Registered protocol family 17
[    4.024381] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    4.036954] 8021q: 802.1Q VLAN Support v1.8
[    4.041208] Registering SWP/SWPB emulation handler
[    4.064654] VFS: Mounted root (squashfs filesystem) readonly on device 31:4.
[   926] Freeing unused kernel memory: 164K (c0361000 - c038a000)
[    6.136424] gpio-keys gpio-keys: failed to request irq:-6 for gpio:11
[    6.142919] gpio-keys gpio-keys: failed to request irq:-6 for gpio:12
[    6.149333] gpio-keys gpio-keys: failed to request irq:-6 for gpio:13
[    6.155756] gpio-keys gpio-keys: failed to request irq:-6 for gpio:14
[    6.162180] gpio-keys gpio-keys: failed to request irq:-6 for gpio:15
[    6.234566] random: mktemp urandom read with 41 bits of entropy available
[    9.650068] jffs2: notice: (288) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    9.666442] overlayfs: missing upperdir or lowerdir or workdir
[   14.159733] Loading modules backported from Linux version master-2014-10-08-0-g0275925
[   14.167681] Backport generated by backports.git backports-20140905-1-gde42785
[   14.180633] cfg80211: Calling CRDA to update world regulatory domain
[   14.192280] cfg80211: World regulatory domain updated:
[   14.197413] cfg80211:  DFS Master region: unset
[   14.201802] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   14.211517] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   14.219481] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   14.227454] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[   14.235427] cfg80211:   (5170000 KHz - 5250000 KHz @ 160000 KHz), (N/A, 2000 mBm), (N/A)
[   14.243489] cfg80211:   (5250000 KHz - 5330000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[   14.251551] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[   14.259604] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[   14.267577] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[   14.289862] usbcore: registered new interface driver brcmfmac
[   14.295733] brcmfmac 0000:01:00.0: enabling device (0140 -> 0142)
[   15.325236] brcmfmac 0000:01:00.0: Direct firmware load for brcm/brcmfmac43602-pcie.txt failed with error -2
[   16.124847] brcmfmac: brcmf_pcie_alloc_dma_and_ring: RING 0: virtual address: c8ccf000, physical address:   (null):06c06000
[   16.136056] brcmfmac: brcmf_pcie_alloc_dma_and_ring: RING 1: virtual address: c8cd1000, physical address:   (null):06c12000
[   16.147179] brcmfmac: brcmf_pcie_alloc_dma_and_ring: RING 2: virtual address: c8cd4000, physical address:   (null):06c07000
[   16.158377] brcmfmac: brcmf_pcie_alloc_dma_and_ring: RING 3: virtual address: c8cd6000, physical address:   (null):073bc000
[   16.169526] brcmfmac: brcmf_pcie_alloc_dma_and_ring: RING 4: virtual address: c8cdb000, physical address:   (null):06c14000
[   16.301412] brcmfmac: brcmf_msgbuf_rxbuf_data_post: Failed to reserve space in commonring
[   16.321273] brcmfmac: localseq_vprintf: ---[ Modules ]---
[   16.326768] brcmfmac: localseq_vprintf: 0xbf000000-0xbf002000           8K     RW x  SHD MEM/CACHED/WBWA
[   16.336242] brcmfmac: localseq_vprintf: 0xbf005000-0xbf007000           8K     RW x  SHD MEM/CACHED/WBWA
[   16.345696] brcmfmac: localseq_vprintf: 0xbf00a000-0xbf00b000           4K     RW x  SHD MEM/CACHED/WBWA
[   16.355147] brcmfmac: localseq_vprintf: 0xbf00e000-0xbf03d000         188K     RW x  SHD MEM/CACHED/WBWA
[   16.364599] brcmfmac: localseq_vprintf: 0xbf046000-0xbf06f000         164K     RW x  SHD MEM/CACHED/WBWA
[   16.374064] brcmfmac: localseq_vprintf: ---[ Kernel Mapping ]---
[   16.380045] brcmfmac: localseq_vprintf: 0xc0000000-0xc0400000           4M     RW x  SHD
[   16.388113] brcmfmac: localseq_vprintf: 0xc0400000-0xc8000000         124M     RW NX SHD
[   16.396168] brcmfmac: localseq_vprintf: ---[ vmalloc() Area ]---
[   16.402163] brcmfmac: localseq_vprintf: 0xc8800000-0xc8801000           4K     RW NX SHD DEV/SHARED
[   16.411173] brcmfmac: localseq_vprintf: 0xc8802000-0xc8803000           4K     RW NX SHD DEV/SHARED
[   16.420184] brcmfmac: localseq_vprintf: 0xc8804000-0xc8805000           4K     RW NX SHD DEV/SHARED
[   16.429188] brcmfmac: localseq_vprintf: 0xc8806000-0xc8807000           4K     RW NX SHD DEV/SHARED
[   16.438200] brcmfmac: localseq_vprintf: 0xc8808000-0xc8809000           4K     RW NX SHD DEV/SHARED
[   16.447215] brcmfmac: localseq_vprintf: 0xc880e000-0xc884e000         256K     RW NX SHD MEM/BUFFERABLE/WC
[   16.456840] brcmfmac: localseq_vprintf: 0xc884f000-0xc8895000         280K     RW NX SHD MEM/CACHED/WBWA
[   16.466287] brcmfmac: localseq_vprintf: 0xc8896000-0xc8897000           4K     RW NX SHD DEV/SHARED
[   16.475299] brcmfmac: localseq_vprintf: 0xc8898000-0xc8899000           4K     RW NX SHD DEV/SHARED
[   16.484310] brcmfmac: localseq_vprintf: 0xc889a000-0xc889b000           4K     RW NX SHD DEV/SHARED
[   16.493322] brcmfmac: localseq_vprintf: 0xc889e000-0xc889f000           4K     RW NX SHD DEV/SHARED
[   16.502335] brcmfmac: localseq_vprintf: 0xc88a0000-0xc88a1000           4K     RW NX SHD DEV/SHARED
[   16.511345] brcmfmac: localseq_vprintf: 0xc88a2000-0xc88a3000           4K     RW NX SHD DEV/SHARED
[   16.520357] brcmfmac: localseq_vprintf: 0xc88a4000-0xc88a5000           4K     RW NX SHD DEV/SHARED
[   16.529361] brcmfmac: localseq_vprintf: 0xc88a6000-0xc88a7000           4K     RW NX SHD DEV/SHARED
[   16.538372] brcmfmac: localseq_vprintf: 0xc88a8000-0xc88a9000           4K     RW NX SHD DEV/SHARED
[   16.547382] brcmfmac: localseq_vprintf: 0xc88aa000-0xc88ab000           4K     RW NX SHD DEV/SHARED
[   16.556394] brcmfmac: localseq_vprintf: 0xc88ac000-0xc88ad000           4K     RW NX SHD DEV/SHARED
[   16.565404] brcmfmac: localseq_vprintf: 0xc88ae000-0xc88af000           4K     RW NX SHD DEV/SHARED
[   16.574417] brcmfmac: localseq_vprintf: 0xc88b0000-0xc88b1000           4K     RW NX SHD DEV/SHARED
[   16.583428] brcmfmac: localseq_vprintf: 0xc88b2000-0xc88b3000           4K     RW NX SHD DEV/SHARED
[   16.592441] brcmfmac: localseq_vprintf: 0xc88b4000-0xc88b5000           4K     RW NX SHD DEV/SHARED
[   16.601451] brcmfmac: localseq_vprintf: 0xc88b6000-0xc88b7000           4K     RW NX SHD DEV/SHARED
[   16.610464] brcmfmac: localseq_vprintf: 0xc88b8000-0xc88b9000           4K     RW NX SHD DEV/SHARED
[   16.619467] brcmfmac: localseq_vprintf: 0xc88ba000-0xc88bb000           4K     RW NX SHD DEV/SHARED
[   16.628478] brcmfmac: localseq_vprintf: 0xc88bc000-0xc88bd000           4K     RW NX SHD DEV/SHARED
[   16.637490] brcmfmac: localseq_vprintf: 0xc88be000-0xc88bf000           4K     RW NX SHD DEV/SHARED
[   16.646503] brcmfmac: localseq_vprintf: 0xc88c0000-0xc88c1000           4K     RW NX SHD DEV/SHARED
[   16.655512] brcmfmac: localseq_vprintf: 0xc88c2000-0xc88c3000           4K     RW NX SHD DEV/SHARED
[   16.664524] brcmfmac: localseq_vprintf: 0xc88c4000-0xc88c5000           4K     RW NX SHD DEV/SHARED
[   16.673535] brcmfmac: localseq_vprintf: 0xc88c6000-0xc88c7000           4K     RW NX SHD DEV/SHARED
[   16.682547] brcmfmac: localseq_vprintf: 0xc88c8000-0xc88c9000           4K     RW NX SHD DEV/SHARED
[   16.691558] brcmfmac: localseq_vprintf: 0xc88ca000-0xc88cb000           4K     RW NX SHD DEV/SHARED
[   16.700569] brcmfmac: localseq_vprintf: 0xc88cc000-0xc88cd000           4K     RW NX SHD DEV/SHARED
[   16.709573] brcmfmac: localseq_vprintf: 0xc88ce000-0xc88cf000           4K     RW NX SHD DEV/SHARED
[   16.718585] brcmfmac: localseq_vprintf: 0xc88d0000-0xc88d1000           4K     RW NX SHD DEV/SHARED
[   16.727596] brcmfmac: localseq_vprintf: 0xc88d2000-0xc88d3000           4K     RW NX SHD DEV/SHARED
[   16.736608] brcmfmac: localseq_vprintf: 0xc88d4000-0xc88d5000           4K     RW NX SHD DEV/SHARED
[   16.745618] brcmfmac: localseq_vprintf: 0xc88d6000-0xc88d7000           4K     RW NX SHD DEV/SHARED
[   16.754631] brcmfmac: localseq_vprintf: 0xc88d8000-0xc88d9000           4K     RW NX SHD DEV/SHARED
[   16.763642] brcmfmac: localseq_vprintf: 0xc88da000-0xc88db000           4K     RW NX SHD DEV/SHARED
[   16.772654] brcmfmac: localseq_vprintf: 0xc88dc000-0xc88dd000           4K     RW NX SHD DEV/SHARED
[   16.781665] brcmfmac: localseq_vprintf: 0xc88de000-0xc88df000           4K     RW NX SHD DEV/SHARED
[   16.790677] brcmfmac: localseq_vprintf: 0xc88e0000-0xc88e1000           4K     RW NX SHD DEV/SHARED
[   16.799680] brcmfmac: localseq_vprintf: 0xc88e2000-0xc88e3000           4K     RW NX SHD DEV/SHARED
[   16.808691] brcmfmac: localseq_vprintf: 0xc88e4000-0xc88e5000           4K     RW NX SHD DEV/SHARED
[   16.817703] brcmfmac: localseq_vprintf: 0xc88e6000-0xc88e7000           4K     RW NX SHD DEV/SHARED
[   16.826714] brcmfmac: localseq_vprintf: 0xc88e8000-0xc88e9000           4K     RW NX SHD DEV/SHARED
[   16.835725] brcmfmac: localseq_vprintf: 0xc88ea000-0xc88ec000           8K     RW NX SHD MEM/BUFFERABLE/WC
[   16.845343] brcmfmac: localseq_vprintf: 0xc88ed000-0xc88ef000           8K     RW NX SHD MEM/BUFFERABLE/WC
[   16.854959] brcmfmac: localseq_vprintf: 0xc88f0000-0xc88f2000           8K     RW NX SHD MEM/BUFFERABLE/WC
[   16.864575] brcmfmac: localseq_vprintf: 0xc88f3000-0xc88f5000           8K     RW NX SHD MEM/BUFFERABLE/WC
[   16.874191] brcmfmac: localseq_vprintf: 0xc88f6000-0xc88f8000           8K     RW NX SHD MEM/BUFFERABLE/WC
[   16.883807] brcmfmac: localseq_vprintf: 0xc88fa000-0xc88fb000           4K     RW NX SHD DEV/SHARED
[   16.892819] brcmfmac: localseq_vprintf: 0xc88fc000-0xc88fe000           8K     RW NX SHD MEM/BUFFERABLE/WC
[   16.902435] brcmfmac: localseq_vprintf: 0xc88ff000-0xc8901000           8K     RW NX SHD MEM/BUFFERABLE/WC
[   16.912051] brcmfmac: localseq_vprintf: 0xc8902000-0xc8904000           8K     RW NX SHD MEM/BUFFERABLE/WC
[   16.921667] brcmfmac: localseq_vprintf: 0xc8905000-0xc8907000           8K     RW NX SHD MEM/BUFFERABLE/WC
[   16.931285] brcmfmac: localseq_vprintf: 0xc8908000-0xc890a000           8K     RW NX SHD MEM/BUFFERABLE/WC
[   16.940901] brcmfmac: localseq_vprintf: 0xc890b000-0xc890e000          12K     RW NX SHD MEM/CACHED/WBWA
[   16.950347] brcmfmac: localseq_vprintf: 0xc890f000-0xc894f000         256K     RW NX SHD MEM/CACHED/WBWA
[   16.959792] brcmfmac: localseq_vprintf: 0xc8950000-0xc8990000         256K     RW NX SHD MEM/CACHED/WBWA
[   16.969256] brcmfmac: localseq_vprintf: 0xc8aa0000-0xc8aa8000          32K     RW NX SHD DEV/SHARED
[   16.978298] brcmfmac: localseq_vprintf: 0xc8ccf000-0xc8cd0000           4K     RW NX SHD MEM/BUFFERABLE/WC
[   16.987920] brcmfmac: localseq_vprintf: 0xc8cd1000-0xc8cd3000           8K     RW NX SHD MEM/BUFFERABLE/WC
[   16.997536] brcmfmac: localseq_vprintf: 0xc8cd4000-0xc8cd5000           4K     RW NX SHD MEM/BUFFERABLE/WC
[   17.007152] brcmfmac: localseq_vprintf: 0xc8cd6000-0xc8cda000          16K     RW NX SHD MEM/BUFFERABLE/WC
[   17.016778] brcmfmac: localseq_vprintf: 0xc8cdb000-0xc8cdd000           8K     RW NX SHD MEM/BUFFERABLE/WC
[   17.026394] brcmfmac: localseq_vprintf: 0xc8cde000-0xc8cdf000           4K     RW NX SHD MEM/BUFFERABLE/WC
[   17.036009] brcmfmac: localseq_vprintf: 0xc8ce0000-0xc8ce1000           4K     RW NX SHD MFERABLE/WC
[   17.045626] brcmfmac: localseq_vprintf: 0xc8ce5000-0xc8ce6000           4K     RW NX SHD MEM/BUFFERABLE/WC
[   17.055524] brcmfmac: localseq_vprintf: 0xca800000-0xcac00000           4M     RW NX SHD DEV/SHARED
[   17.064597] brcmfmac: localseq_vprintf: 0xfedee000-0xfedf1000          12K     RW NX SHD MEM/CACHED/WBWA
[   17.074046] brcmfmac: localseq_vprintf: 0xfedf7000-0xfedfa000          12K     RW NX SHD MEM/CACHED/WBWA
[   17.083499] brcmfmac: localseq_vprintf: ---[ vmalloc() End ]---
[   17.089392] brcmfmac: localseq_vprintf: ---[ Fixmap Area ]---
[   17.095145] brcmfmac: localseq_vprintf: ---[ Vectors ]---
[   17.100534] brcmfmac: localseq_vprintf: 0xffff0000-0xffff1000           4K USR ro x  SHD MEM/CACHED/WBWA
[   17.109969] brcmfmac: localseq_vprintf: 0xffff1000-0xffff2000           4K     ro x  SHD MEM/CACHED/WBWA
[   17.119406] brcmfmac: localseq_vprintf: ---[ Vectors End ]---
[   20.683755] device eth0.1 entered promiscuous mode
[   20.688542] device eth0 entered promiscuous mode
[   20.714866] br-lan: port 1(eth0.1) entered forwarding state
[   20.720475] br-lan: port 1(eth0.1) entered forwarding state
[   22.720161] br-lan: port 1(eth0.1) entered forwarding state
[   22.829502] brcmfmac: brcmf_add_if: ERROR: netdev:wlan0 already exists
[   22.836043] brcmfmac: brcmf_add_if: ignore IF event
[   22.851645] device wlan0 entered promiscuous mode
[   22.856391] br-lan: port 2(wlan0) entered forwarding state
[   22.861913] br-lan: port 2(wlan0) entered forwarding state
[   23.060471] brcmfmac: brcmf_add_if: ERROR: netdev:wlan0 already exists
[   23.066977] brcmfmac: brcmf_add_if: ignore IF event
[   24.870181] br-lan: port 2(wlan0) entered forwarding state
[   35.830824] brcmfmac: brcmf_cfg80211_change_station: Change station, MAC 00:90:4c:0c:c1:54
[   35.839157] brcmfmac: brcmf_cfg80211_change_station: Change station, mask 0x001c set 0x0000
[   48.582775] random: nonblocking pool is initialized
[ 1780.130752] brcmfmac: brcmf_sync_seqnum: Sequence number failure (expected 52, read 40)
[ 1780.138733] brcmfmac: brcmf_sync_seqnum: Sequence number pointer c8cd600c, as part of struct at address c8cd6000
[ 1780.148891] brcmfmac: brcmf_sync_seqnum: Struct size 16
[ 1780.154102] brcmfmac: brcmf_sync_seqnum: dma_handle of ring:   (null):073bc000, dma_to_pfn(dma_handle): 0x000073bc
[ 1780.164321] brcmfmac: brcmf_sync_seqnum: PHYS_PFN_OFFSET: 0x00000000
[ 1780.171601] brcmfmac: brcmf_sync_seqnum: ========= walk_pgd(): ==========
[ 1780.178361] brcmfmac: localseq_vprintf: ---[ Modules ]---
[ 1780.183851] brcmfmac: localseq_vprintf: 0xbf000000-0xbf002000           8K     RW x  SHD MEM/CACHED/WBWA
[ 1780.193308] brcmfmac: localseq_vprintf: 0xbf005000-0xbf007000           8K     RW x  SHD MEM/CACHED/WBWA
[ 1780.202756] brcmfmac: localseq_vprintf: 0xbf00a000-0xbf00b000           4K     RW x  SHD MEM/CACHED/WBWA
[ 1780.212210] brcmfmac: localseq_vprintf: 0xbf00e000-0xbf03d000         188K     RW x  SHD MEM/CACHED/WBWA
[ 1780.221663] brcmfmac: localseq_vprintf: 0xbf046000-0xbf06f000         164K     RW x  SHD MEM/CACHED/WBWA
[ 1780.231128] brcmfmac: localseq_vprintf: ---[ Kernel Mapping ]---
[ 1780.237109] brcmfmac: localseq_vprintf: 0xc0000000-0xc0400000           4M     RW x  SHD
[ 1780.245176] brcmfmac: localseq_vprintf: 0xc0400000-0xc8000000         124M     RW NX SHD
[ 1780.253234] brcmfmac: localseq_vprintf: ---[ vmalloc() Area ]---
[ 1780.259217] brcmfmac: localseq_vprintf: 0xc8800000-0xc8801000           4K     RW NX SHD DEV/SHARED
[ 1780.268228] brcmfmac: localseq_vprintf: 0xc8802000-0xc8803000           4K     RW NX SHD DEV/SHARED
[ 1780.277240] brcmfmac: localseq_vprintf: 0xc8804000-0xc8805000           4K     RW NX SHD DEV/SHARED
[ 1780.286250] brcmfmac: localseq_vprintf: 0xc8806000-0xc8807000           4K     RW NX SHD DEV/SHARED
[ 1780.295263] brcmfmac: localseq_vprintf: 0xc8808000-0xc8809000           4K     RW NX SHD DEV/SHARED
[ 1780.304278] brcmfmac: localseq_vprintf: 0xc880e000-0xc884e000         256K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.313903] brcmfmac: localseq_vprintf: 0xc884f000-0xc8895000         280K     RW NX SHD MEM/CACHED/WBWA
[ 1780.323351] brcmfmac: localseq_vprintf: 0xc8896000-0xc8897000           4K     RW NX SHD DEV/SHARED
[ 1780.332362] brcmfmac: localseq_vprintf: 0xc8898000-0xc8899000           4K     RW NX SHD DEV/SHARED
[ 1780.341375] brcmfmac: localseq_vprintf: 0xc889a000-0xc889b000           4K     RW NX SHD DEV/SHARED
[ 1780.350378] brcmfmac: localseq_vprintf: 0xc889e000-0xc889f000           4K     RW NX SHD DEV/SHARED
[ 1780.359389] brcmfmac: localseq_vprintf: 0xc88a0000-0xc88a1000           4K     RW NX SHD DEV/SHARED
[ 1780.368400] brcmfmac: localseq_vprintf: 0xc88a2000-0xc88a3000           4K     RW NX SHD DEV/SHARED
[ 1780.377411] brcmfmac: localseq_vprintf: 0xc88a4000-0xc88a5000           4K     RW NX SHD DEV/SHARED
[ 1780.386423] brcmfmac: localseq_vprintf: 0xc88a6000-0xc88a7000           4K     RW NX SHD DEV/SHARED
[ 1780.395434] brcmfmac: localseq_vprintf: 0xc88a8000-0xc88a9000           4K     RW NX SHD DEV/SHARED
[ 1780.404459] brcmfmac: localseq_vprintf: 0xc88aa000-0xc88ab000           4K     RW NX SHD DEV/SHARED
[ 1780.413477] brcmfmac: localseq_vprintf: 0xc88ac000-0xc88ad000           4K     RW NX SHD DEV/SHARED
[ 1780.422495] brcmfmac: localseq_vprintf: 0xc88ae000-0xc88af000           4K     RW NX SHD DEV/SHARED
[ 1780.431507] brcmfmac: localseq_vprintf: 0xc88b0000-0xc88b1000           4K     RW NX SHD DEV/SHARED
[ 1780.440510] brcmfmac: localseq_vprintf: 0xc88b2000-0xc88b3000           4K     RW NX SHD DEV/SHARED
[ 1780.449522] brcmfmac: localseq_vprintf: 0xc88b4000-0xc88b5000           4K     RW NX SHD DEV/SHARED
[ 1780.458533] brcmfmac: localseq_vprintf: 0xc88b6000-0xc88b7000           4K     RW NX SHD DEV/SHARED
[ 1780.467544] brcmfmac: localseq_vprintf: 0xc88b8000-0xc88b9000           4K     RW NX SHD DEV/SHARED
[ 1780.476556] brcmfmac: localseq_vprintf: 0xc88ba000-0xc88bb000           4K     RW NX SHD DEV/SHARED
[ 1780.485566] brcmfmac: localseq_vprintf: 0xc88bc000-0xc88bd000           4K     RW NX SHD DEV/SHARED
[ 1780.494579] brcmfmac: localseq_vprintf: 0xc88be000-0xc88bf000           4K     RW NX SHD DEV/SHARED
[ 1780.503590] brcmfmac: localseq_vprintf: 0xc88c0000-0xc88c1000           4K     RW NX SHD DEV/SHARED
[ 1780.512601] brcmfmac: localseq_vprintf: 0xc88c2000-0xc88c3000           4K     RW NX SHD DEV/SHARED
[ 1780.521613] brcmfmac: localseq_vprintf: 0xc88c4000-0xc88c5000           4K     RW NX SHD DEV/SHARED
[ 1780.530624] brcmfmac: localseq_vprintf: 0xc88c6000-0xc88c7000           4K     RW NX SHD DEV/SHARED
[ 1780.539629] brcmfmac: localseq_vprintf: 0xc88c8000-0xc88c9000           4K     RW NX SHD DEV/SHARED
[ 1780.548639] brcmfmac: localseq_vprintf: 0xc88ca000-0xc88cb000           4K     RW NX SHD DEV/SHARED
[ 1780.557651] brcmfmac: localseq_vprintf: 0xc88cc000-0xc88cd000           4K     RW NX SHD DEV/SHARED
[ 1780.566662] brcmfmac: localseq_vprintf: 0xc88ce000-0xc88cf000           4K     RW NX SHD DEV/SHARED
[ 1780.575673] brcmfmac: localseq_vprintf: 0xc88d0000-0xc88d1000           4K     RW NX SHD DEV/SHARED
[ 1780.584686] brcmfmac: localseq_vprintf: 0xc88d2000-0xc88d3000           4K     RW NX SHD DEV/SHARED
[ 1780.593697] brcmfmac: localseq_vprintf: 0xc88d4000-0xc88d5000           4K     RW NX SHD DEV/SHARED
[ 1780.602708] brcmfmac: localseq_vprintf: 0xc88d6000-0xc88d7000           4K     RW NX SHD DEV/SHARED
[ 1780.611720] brcmfmac: localseq_vprintf: 0xc88d8000-0xc88d9000           4K     RW NX SHD DEV/SHARED
[ 1780.620731] brcmfmac: localseq_vprintf: 0xc88da000-0xc88db000           4K     RW NX SHD DEV/SHARED
[ 1780.629734] brcmfmac: localseq_vprintf: 0xc88dc000-0xc88dd000           4K     RW NX SHD DEV/SHARED
[ 1780.638746] brcmfmac: localseq_vprintf: 0xc88de000-0xc88df000           4K     RW NX SHD DEV/SHARED
[ 1780.647759] brcmfmac: localseq_vprintf: 0xc88e0000-0xc88e1000           4K     RW NX SHD DEV/SHARED
[ 1780.656768] brcmfmac: localseq_vprintf: 0xc88e2000-0xc88e3000           4K     RW NX SHD DEV/SHARED
[ 1780.665779] brcmfmac: localseq_vprintf: 0xc88e4000-0xc88e5000           4K     RW NX SHD DEV/SHARED
[ 1780.674792] brcmfmac: localseq_vprintf: 0xc88e6000-0xc88e7000           4K     RW NX SHD DEV/SHARED
[ 1780.683805] brcmfmac: localseq_vprintf: 0xc88e8000-0xc88e9000           4K     RW NX SHD DEV/SHARED
[ 1780.692815] brcmfmac: localseq_vprintf: 0xc88ea000-0xc88ec000           8K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.702432] brcmfmac: localseq_vprintf: 0xc88ed000-0xc88ef000           8K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.712048] brcmfmac: localseq_vprintf: 0xc88f0000-0xc88f2000           8K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.721664] brcmfmac: localseq_vprintf: 0xc88f3000-0xc88f5000           8K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.731281] brcmfmac: localseq_vprintf: 0xc88f6000-0xc88f8000           8K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.740896] brcmfmac: localseq_vprintf: 0xc88fa000-0xc88fb000           4K     RW NX SHD DEV/SHARED
[ 1780.749901] brcmfmac: localseq_vprintf: 0xc88fc000-0xc88fe000           8K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.759516] brcmfmac: localseq_vprintf: 0xc88ff000-0xc8901000           8K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.769132] brcmfmac: localseq_vprintf: 0xc8902000-0xc8904000           8K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.778748] brcmfmac: localseq_vprintf: 0xc8905000-0xc8907000           8K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.788365] brcmfmac: localseq_vprintf: 0xc8908000-0xc890a000           8K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.797rcmfmac: localseq_vprintf: 0xc890b000-0xc890e000          12K     RW NX SHD MEM/CACHED/WBWA
[ 1780.807428] brcmfmac: localseq_vprintf: 0xc890f000-0xc894f000         256K     RW NX SHD MEM/CACHED/WBWA
[ 1780.816894] brcmfmac: localseq_vprintf: 0xc8950000-0xc8990000         256K     RW NX SHD MEM/CACHED/WBWA
[ 1780.826354] brcmfmac: localseq_vprintf: 0xc8aa0000-0xc8aa8000          32K     RW NX SHD DEV/SHARED
[ 1780.835398] brcmfmac: localseq_vprintf: 0xc8ccf000-0xc8cd0000           4K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.845019] brcmfmac: localseq_vprintf: 0xc8cd1000-0xc8cd3000           8K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.854633] brcmfmac: localseq_vprintf: 0xc8cd4000-0xc8cd5000           4K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.864251] brcmfmac: localseq_vprintf: 0xc8cd6000-0xc8cda000          16K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.873866] brcmfmac: localseq_vprintf: 0xc8cdb000-0xc8cdd000           8K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.883483] brcmfmac: localseq_vprintf: 0xc8cde000-0xc8cdf000           4K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.893098] brcmfmac: localseq_vprintf: 0xc8ce0000-0xc8ce1000           4K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.902715] brcmfmac: localseq_vprintf: 0xc8ce5000-0xc8ce6000           4K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.912334] brcmfmac: localseq_vprintf: 0xc8d05000-0xc8d06000           4K     RW NX SHD MEM/CACHED/WBWA
[ 1780.921785] brcmfmac: localseq_vprintf: 0xc8d09000-0xc8d0f000          24K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.931401] brcmfmac: localseq_vprintf: 0xc8d10000-0xc8d16000          24K     RW NX SHD MEM/BUFFERABLE/WC
[ 1780.941300] brcmfmac: localseq_vprintf: 0xca800000-0xcac00000           4M     RW NX SHD DEV/SHARED
[ 1780.950358] brcmfmac: localseq_vprintf: 0xfedee000-0xfedf1000          12K     RW NX SHD MEM/CACHED/WBWA
[ 1780.959817] brcmfmac: localseq_vprintf: 0xfedf7000-0xfedfa000          12K     RW NX SHD MEM/CACHED/WBWA
[ 1780.969257] brcmfmac: localseq_vprintf: ---[ vmalloc() End ]---
[ 1780.975156] brcmfmac: localseq_vprintf: ---[ Fixmap Area ]---
[ 1780.980909] brcmfmac: localseq_vprintf: ---[ Vectors ]---
[ 1780.986291] brcmfmac: localseq_vprintf: 0xffff0000-0xffff1000           4K USR ro x  SHD MEM/CACHED/WBWA
[ 1780.995737] sched: RT throttling activated
[ 1780.999822] brcmfmac: localseq_vprintf: 0xffff1000-0xffff2000           4K     ro x  SHD MEM/CACHED/WBWA
[ 1781.009262] brcmfmac: localseq_vprintf: ---[ Vectors End ]---
[ 1781.014991] brcmfmac: brcmf_sync_seqnum: Loopcnt 1 (expected 52, read 52)
root@OpenWrt:/#


^ permalink raw reply	[relevance 1%]

* Re: linux-next: JFFS2 corruption
  2013-02-26 15:50  2% linux-next: JFFS2 corruption Mark Jackson
@ 2013-02-26 23:18  0% ` Stephen Rothwell
  0 siblings, 0 replies; 28+ results
From: Stephen Rothwell @ 2013-02-26 23:18 UTC (permalink / raw)
  To: Mark Jackson; +Cc: linux-next, linux-mtd, David Woodhouse, lkml, Al Viro

[-- Attachment #1: Type: text/plain, Size: 16877 bytes --]

Hi Mark,

On Tue, 26 Feb 2013 15:50:18 +0000 Mark Jackson <mpfj-list@mimc.co.uk> wrote:
>
> Just tested the current next-20130226 on a custom AM335X board, and if I mount
> our JFFS2 image as read/write, the next reboot shows the image as being corrupt.
> 
> If I reprogram the jffs2 image into NAND and only mount the volume as read-only,
> no corruption occurs and the system remains intact.
> 
> I have also tested:-
> 
> (a) reprogram ubifs image into nand
> (b) boot the volume as read-only (corrupt -> no)
> (c) remount the volume as read/write
> (d) rebooting the volume as read-only (corrupt -> yes)

Thanks for all the testing.  Sam questions as in my other email.

Al, same for you as well ...

> Below is the log showing (d) ...
> 
> Regards
> Mark J.
> ---
> [    0.000000] Booting Linux on physical CPU 0x0
> [    0.000000] Linux version 3.8.0-next-20130226-dirty (mpfj@mpfj-nanobone) (gcc version 4.5.4 (Buildroot 2012.11) ) #12 SMP Tue Feb 26 14:04:28 GMT 2013
> [    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7d
> [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
> [    0.000000] Machine: Generic AM33XX (Flattened Device Tree), model: TI AM335x BeagleBone
> [    0.000000] Memory policy: ECC disabled, Data cache writeback
> [    0.000000] CPU: All CPU(s) started in SVC mode.
> [    0.000000] AM335X ES1.0 (neon )
> [    0.000000] PERCPU: Embedded 9 pages/cpu @c0e02000 s13696 r8192 d14976 u36864
> [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 64768
> [    0.000000] Kernel command line: console=ttyO0,115200n8 noinitrd ip=off mem=256M rootwait=1 rootfstype=jffs2 root=/dev/mtdblock6 ro
> [    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
> [    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
> [    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
> [    0.000000] __ex_table already sorted, skipping sort
> [    0.000000] Memory: 255MB = 255MB total
> [    0.000000] Memory: 246536k/246536k available, 15608k reserved, 0K highmem
> [    0.000000] Virtual kernel memory layout:
> [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
> [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
> [    0.000000]     vmalloc : 0xd0800000 - 0xff000000   ( 744 MB)
> [    0.000000]     lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
> [    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
> [    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
> [    0.000000]       .text : 0xc0008000 - 0xc05cd3a0   (5909 kB)
> [    0.000000]       .init : 0xc05ce000 - 0xc061e580   ( 322 kB)
> [    0.000000]       .data : 0xc0620000 - 0xc06a6820   ( 539 kB)
> [    0.000000]        .bss : 0xc06a6820 - 0xc0bf4d6c   (5434 kB)
> [    0.000000] Hierarchical RCU implementation.
> [    0.000000]  RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
> [    0.000000] NR_IRQS:16 nr_irqs:16 16
> [    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
> [    0.000000] Total of 128 interrupts on 1 active controller
> [    0.000000] OMAP clockevent source: GPTIMER1 at 26000000 Hz
> [    0.000000] sched_clock: 32 bits at 26MHz, resolution 38ns, wraps every 165191ms
> [    0.000000] OMAP clocksource: GPTIMER2 at 26000000 Hz
> [    0.000000] Console: colour dummy device 80x30
> [    0.000000] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
> [    0.000000] ... MAX_LOCKDEP_SUBCLASSES:  8
> [    0.000000] ... MAX_LOCK_DEPTH:          48
> [    0.000000] ... MAX_LOCKDEP_KEYS:        8191
> [    0.000000] ... CLASSHASH_SIZE:          4096
> [    0.000000] ... MAX_LOCKDEP_ENTRIES:     16384
> [    0.000000] ... MAX_LOCKDEP_CHAINS:      32768
> [    0.000000] ... CHAINHASH_SIZE:          16384
> [    0.000000]  memory used by lock dependency info: 3695 kB
> [    0.000000]  per task-struct memory footprint: 1152 bytes
> [    0.001032] Calibrating delay loop... 476.77 BogoMIPS (lpj=2383872)
> [    0.109736] pid_max: default: 32768 minimum: 301
> [    0.110266] Security Framework initialized
> [    0.110426] Mount-cache hash table entries: 512
> [    0.121717] CPU: Testing write buffer coherency: ok
> [    0.123210] CPU0: thread -1, cpu 0, socket -1, mpidr 0
> [    0.123295] Setting up static identity map for 0xc041e950 - 0xc041e9c0
> [    0.126044] Brought up 1 CPUs
> [    0.126069] SMP: Total of 1 processors activated (476.77 BogoMIPS).
> [    0.126081] CPU: All CPU(s) started in SVC mode.
> [    0.129080] devtmpfs: initialized
> [    0.200411] pinctrl core: initialized pinctrl subsystem
> [    0.206461] regulator-dummy: no parameters
> [    0.209043] NET: Registered protocol family 16
> [    0.209939] DMA: preallocated 256 KiB pool for atomic coherent allocations
> [    0.233770] OMAP GPIO hardware version 0.1
> [    0.263351] omap-gpmc 50000000.gpmc: GPMC revision 6.0
> [    0.265960] No ATAGs?
> [    0.265988] hw-breakpoint: debug architecture 0x4 unsupported.
> [    0.311687] bio: create slab <bio-0> at 0
> [    0.398050] omap-dma-engine omap-dma-engine: OMAP DMA engine driver
> [    0.405918] usbcore: registered new interface driver usbfs
> [    0.406470] usbcore: registered new interface driver hub
> [    0.407327] usbcore: registered new device driver usb
> [    0.409003] omap_i2c 44e0b000.i2c: did not get pins for i2c error: -19
> [    0.411618] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
> [    0.413344] mcp230xx: probe of 0-0020 failed with error -22
> [    0.419117] DCDC1: at 1800 mV
> [    0.422543] vdd_mpu: 925 <--> 1325 mV at 3300 mV
> [    0.424721] vdd_core: 925 <--> 1150 mV at 1100 mV
> [    0.426984] LDO1: at 1800 mV
> [    0.429065] LDO2: at 3300 mV
> [    0.431676] LDO3: at 3300 mV
> [    0.433749] LDO4: at 2800 mV
> [    0.435554] tps65217 0-0024: TPS65217 ID 0x7 version 1.1
> [    0.446197] Switching to clocksource gp_timer
> [    0.560007] NET: Registered protocol family 2
> [    0.562070] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
> [    0.562292] TCP bind hash table entries: 2048 (order: 4, 73728 bytes)
> [    0.563243] TCP: Hash tables configured (established 2048 bind 2048)
> [    0.563476] TCP: reno registered
> [    0.563510] UDP hash table entries: 256 (order: 2, 20480 bytes)
> [    0.563775] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
> [    0.564666] NET: Registered protocol family 1
> [    0.565819] NetWinder Floating Point Emulator V0.97 (double precision)
> [    0.566339] CPU PMU: probing PMU on CPU 0
> [    0.566373] hw perfevents: enabled with ARMv7 Cortex-A8 PMU driver, 5 counters available
> [    0.710679] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
> [    0.711291] msgmni has been set to 481
> [    0.714998] io scheduler noop registered
> [    0.715027] io scheduler deadline registered
> [    0.715110] io scheduler cfq registered (default)
> [    0.716538] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
> [    0.721523] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
> [    0.728884] omap_uart 44e09000.serial: did not get pins for uart0 error: -19
> [    0.729525] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 88) is a OMAP UART0
> [    1.319153] console [ttyO0] enabled
> [    1.325110] omap_uart 48022000.serial: did not get pins for uart1 error: -19
> [    1.333400] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 89) is a OMAP UART1
> [    1.343363] omap_uart 48024000.serial: did not get pins for uart2 error: -19
> [    1.351285] 48024000.serial: ttyO2 at MMIO 0x48024000 (irq = 90) is a OMAP UART2
> [    1.360714] omap_uart 481a6000.serial: did not get pins for uart3 error: -19
> [    1.368752] 481a6000.serial: ttyO3 at MMIO 0x481a6000 (irq = 60) is a OMAP UART3
> [    1.378159] omap_uart 481a8000.serial: did not get pins for uart4 error: -19
> [    1.385862] 481a8000.serial: ttyO4 at MMIO 0x481a8000 (irq = 61) is a OMAP UART4
> [    1.395315] omap_uart 481aa000.serial: did not get pins for uart5 error: -19
> [    1.403172] 481aa000.serial: ttyO5 at MMIO 0x481aa000 (irq = 62) is a OMAP UART5
> [    1.446256] brd: module loaded
> [    1.471131] loop: module loaded
> [    1.478556] mtdoops: mtd device (mtddev=name/number) must be supplied
> [    1.487714] Generic platform RAM MTD, (c) 2004 Simtec Electronics
> [    1.496006] enabling NAND BCH ecc with 8-bit correction
> [    1.502018] ONFI param page 0 valid
> [    1.505695] ONFI flash detected
> [    1.509090] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G08ABAEAWP), 256MiB, page size: 2048, OOB size: 64
> [    1.521348] 8 ofpart partitions found on MTD device omap2-nand.0
> [    1.527717] Creating 8 MTD partitions on "omap2-nand.0":
> [    1.533316] 0x000000000000-0x000000020000 : "spl1"
> [    1.545257] 0x000000020000-0x000000040000 : "spl2"
> [    1.555022] 0x000000040000-0x000000060000 : "spl3"
> [    1.564408] 0x000000060000-0x000000080000 : "spl4"
> [    1.573946] 0x000000080000-0x0000001e0000 : "boot"
> [    1.584828] 0x0000001e0000-0x000000200000 : "env"
> [    1.594707] 0x000000200000-0x000004200000 : "rootfs"
> [    1.659562] 0x000004200000-0x000010000000 : "data"
> [    1.839654] usbcore: registered new interface driver asix
> [    1.845828] usbcore: registered new interface driver cdc_ether
> [    1.852728] usbcore: registered new interface driver smsc95xx
> [    1.859890] usbcore: registered new interface driver net1080
> [    1.866332] usbcore: registered new interface driver cdc_subset
> [    1.873194] usbcore: registered new interface driver zaurus
> [    1.879727] usbcore: registered new interface driver cdc_ncm
> [    1.888250] usbcore: registered new interface driver cdc_wdm
> [    1.894777] usbcore: registered new interface driver usbtest
> [    1.904123] rtc-ds1307 0-0068: rtc core: registered ds1307 as rtc0
> [    1.910851] rtc-ds1307 0-0068: 56 bytes nvram
> [    1.916215] i2c /dev entries driver
> [    1.925777] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
> [    1.934797] omap_cpufreq_init: unable to get MPU regulator
> [    1.944756] usbcore: registered new interface driver usbhid
> [    1.950806] usbhid: USB HID core driver
> [    1.956489] oprofile: using arm/armv7
> [    1.961449] TCP: cubic registered
> [    1.964949] Initializing XFRM netlink socket
> [    1.969694] NET: Registered protocol family 17
> [    1.974613] NET: Registered protocol family 15
> [    1.979855] Key type dns_resolver registered
> [    1.984457] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
> [    1.992657] ThumbEE CPU extension supported.
> [    2.066693] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
> [    2.073130] davinci_mdio 4a101000.mdio: detected phy mask fffffffc
> [    2.084362] libphy: 4a101000.mdio: probed
> [    2.088760] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
> [    2.098421] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver SMSC LAN8710/LAN8720
> [    2.108516] Random MACID = fa:91:6f:36:0e:b0
> [    2.118076] rtc-ds1307 0-0068: setting system clock to 2013-01-21 20:34:58 UTC (1358800498)
> [    2.652964] jffs2: mtd->read(0x1fc54 bytes from 0x3a03ac) returned ECC error
> [    2.676730] jffs2: mtd->read(0x1e260 bytes from 0x3a1da0) returned ECC error
> [    2.684150] jffs2: Empty flash at 0x003a1d9c ends at 0x003a2000
> [    3.161187] jffs2: notice: (1) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
> [    3.179148] VFS: Mounted root (jffs2 filesystem) readonly on device 31:6.
> [    3.188034] devtmpfs: mounted
> [    3.191762] Freeing init memory: 320K
> [    3.606040]
> [    3.607646] ======================================================
> [    3.614138] [ INFO: possible circular locking dependency detected ]
> [    3.620728] 3.8.0-next-20130226-dirty #12 Not tainted
> [    3.626033] -------------------------------------------------------
> [    3.632615] rcS/631 is trying to acquire lock:
> [    3.637283]  (&mm->mmap_sem){++++++}, at: [<c00f0af4>] might_fault+0x3c/0x90
> [    3.644741]
> [    3.644741] but task is already holding lock:
> [    3.650867]  (&f->sem){+.+.+.}, at: [<c01a278c>] jffs2_readdir+0x44/0x1a8
> [    3.658040]
> [    3.658040] which lock already depends on the new lock.
> [    3.658040]
> [    3.666633]
> [    3.666633] the existing dependency chain (in reverse order) is:
> [    3.674496]
> -> #1 (&f->sem){+.+.+.}:
> [    3.678463]        [<c0092df0>] lock_acquire+0x9c/0x104
> [    3.683975]        [<c0416c04>] mutex_lock_nested+0x3c/0x334
> [    3.689941]        [<c01a2fb4>] jffs2_readpage+0x20/0x44
> [    3.695530]        [<c00d9d38>] __do_page_cache_readahead+0x2a0/0x2cc
> [    3.702313]        [<c00da004>] ra_submit+0x28/0x30
> [    3.707446]        [<c00d179c>] filemap_fault+0x304/0x458
> [    3.713138]        [<c00f0c58>] __do_fault+0x6c/0x490
> [    3.718454]        [<c00f3c5c>] handle_pte_fault+0xb0/0x6f0
> [    3.724316]        [<c00f433c>] handle_mm_fault+0xa0/0xd4
> [    3.729994]        [<c041b30c>] do_page_fault+0x2a0/0x3d4
> [    3.735679]        [<c000845c>] do_DataAbort+0x30/0x9c
> [    3.741085]        [<c04197e4>] __dabt_svc+0x44/0x80
> [    3.746309]        [<c0222b98>] __clear_user_std+0x1c/0x64
> [    3.752089]
> -> #0 (&mm->mmap_sem){++++++}:
> [    3.756599]        [<c00927ec>] __lock_acquire+0x1d70/0x1de0
> [    3.762554]        [<c0092df0>] lock_acquire+0x9c/0x104
> [    3.768051]        [<c00f0b18>] might_fault+0x60/0x90
> [    3.773364]        [<c011bc3c>] filldir+0x5c/0x158
> [    3.778416]        [<c01a2824>] jffs2_readdir+0xdc/0x1a8
> [    3.784005]        [<c011becc>] vfs_readdir+0x98/0xb4
> [    3.789319]        [<c011bfcc>] sys_getdents+0x74/0xd0
> [    3.794724]        [<c0013820>] ret_fast_syscall+0x0/0x3c
> [    3.800416]
> [    3.800416] other info that might help us debug this:
> [    3.800416]
> [    3.808824]  Possible unsafe locking scenario:
> [    3.808824]
> [    3.815041]        CPU0                    CPU1
> [    3.819797]        ----                    ----
> [    3.824550]   lock(&f->sem);
> [    3.827587]                                lock(&mm->mmap_sem);
> [    3.833815]                                lock(&f->sem);
> [    3.839496]   lock(&mm->mmap_sem);
> [    3.843079]
> [    3.843079]  *** DEADLOCK ***
> [    3.843079]
> [    3.849302] 2 locks held by rcS/631:
> [    3.853055]  #0:  (&type->i_mutex_dir_key){+.+.+.}, at: [<c011be90>] vfs_readdir+0x5c/0xb4
> [    3.861778]  #1:  (&f->sem){+.+.+.}, at: [<c01a278c>] jffs2_readdir+0x44/0x1a8
> [    3.869404]
> [    3.869404] stack backtrace:
> [    3.874009] [<c001b158>] (unwind_backtrace+0x0/0xf0) from [<c008f29c>] (print_circular_bug+0x1d0/0x2dc)
> [    3.883888] [<c008f29c>] (print_circular_bug+0x1d0/0x2dc) from [<c00927ec>] (__lock_acquire+0x1d70/0x1de0)
> [    3.894040] [<c00927ec>] (__lock_acquire+0x1d70/0x1de0) from [<c0092df0>] (lock_acquire+0x9c/0x104)
> [    3.903553] [<c0092df0>] (lock_acquire+0x9c/0x104) from [<c00f0b18>] (might_fault+0x60/0x90)
> [    3.912427] [<c00f0b18>] (might_fault+0x60/0x90) from [<c011bc3c>] (filldir+0x5c/0x158)
> [    3.920844] [<c011bc3c>] (filldir+0x5c/0x158) from [<c01a2824>] (jffs2_readdir+0xdc/0x1a8)
> [    3.929533] [<c01a2824>] (jffs2_readdir+0xdc/0x1a8) from [<c011becc>] (vfs_readdir+0x98/0xb4)
> [    3.938500] [<c011becc>] (vfs_readdir+0x98/0xb4) from [<c011bfcc>] (sys_getdents+0x74/0xd0)
> [    3.947285] [<c011bfcc>] (sys_getdents+0x74/0xd0) from [<c0013820>] (ret_fast_syscall+0x0/0x3c)
> Starting logging: OK
> Initializing random number generator... [    3.997350] jffs2: mtd->read(0x778 bytes from 0x3a3888) returned ECC error
> [    4.021216] jffs2: mtd->read(0x7bc bytes from 0x3a3844) returned ECC error
> [    4.043965] jffs2: mtd->read(0x800 bytes from 0x3a3800) returned ECC error
> [    4.059373] jffs2: mtd->read(0x44 bytes from 0x3a3888) returned ECC error
> [    4.075443] jffs2: mtd->read(0x44 bytes from 0x3a3888) returned ECC error
> [    4.083554] jffs2: mtd->read(0x200 bytes from 0x3a38cc) returned ECC error
> read-only file system detected...done
> Starting network...
> Starting dropbear sshd: mkdir: can't create directory '/etc/dropbear': Read-only file system
> generating rsa key... generating dsa key... OK
> Starting lighttpd: OK
> 
> Welcome to Buildroot
> beaglebone login:

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[relevance 0%]

* Re: linux-next: JFFS2 deadlock
  2013-02-26 11:54  4% linux-next: JFFS2 deadlock Mark Jackson
@ 2013-02-26 23:17  0% ` Stephen Rothwell
  0 siblings, 0 replies; 28+ results
From: Stephen Rothwell @ 2013-02-26 23:17 UTC (permalink / raw)
  To: Mark Jackson; +Cc: linux-next, linux-mtd, David Woodhouse, lkml, Al Viro

[-- Attachment #1: Type: text/plain, Size: 4747 bytes --]

Hi Mark,

On Tue, 26 Feb 2013 11:54:56 +0000 Mark Jackson <mpfj-list@mimc.co.uk> wrote:
>
> Just tested the current next-20130226 on a custom AM335X board, and I received the JFFS2 deadlock shown below.

Is this new today?  is it reproducible? Does if ail for Linus' tree?

Al, could this be something to do with the new stuff in the vfs tree?

> Regards
> Mark JACKSON
> ---
> [    3.250349] jffs2: notice: (1) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
> [    3.268364] VFS: Mounted root (jffs2 filesystem) readonly on device 31:6.
> [    3.277233] devtmpfs: mounted
> [    3.280982] Freeing init memory: 332K
> [    3.706697]
> [    3.708306] ======================================================
> [    3.714804] [ INFO: possible circular locking dependency detected ]
> [    3.721398] 3.8.0-next-20130226-dirty #10 Not tainted
> [    3.726708] -------------------------------------------------------
> [    3.733297] rcS/686 is trying to acquire lock:
> [    3.737969]  (&mm->mmap_sem){++++++}, at: [<c00f0af4>] might_fault+0x3c/0x90
> [    3.745437]
> [    3.745437] but task is already holding lock:
> [    3.751569]  (&f->sem){+.+.+.}, at: [<c023d128>] jffs2_readdir+0x44/0x1a8
> [    3.758748]
> [    3.758748] which lock already depends on the new lock.
> [    3.758748]
> [    3.767348]
> [    3.767348] the existing dependency chain (in reverse order) is:
> [    3.775215]
> -> #1 (&f->sem){+.+.+.}:
> [    3.779184]        [<c0092df0>] lock_acquire+0x9c/0x104
> [    3.784701]        [<c04b76e4>] mutex_lock_nested+0x3c/0x334
> [    3.790666]        [<c023d950>] jffs2_readpage+0x20/0x44
> [    3.796261]        [<c00d9d38>] __do_page_cache_readahead+0x2a0/0x2cc
> [    3.803050]        [<c00da004>] ra_submit+0x28/0x30
> [    3.808187]        [<c00d179c>] filemap_fault+0x304/0x458
> [    3.813884]        [<c00f0c58>] __do_fault+0x6c/0x490
> [    3.819203]        [<c00f3c5c>] handle_pte_fault+0xb0/0x6f0
> [    3.825071]        [<c00f433c>] handle_mm_fault+0xa0/0xd4
> [    3.830755]        [<c04bbdcc>] do_page_fault+0x2a0/0x3d4
> [    3.836449]        [<c000845c>] do_DataAbort+0x30/0x9c
> [    3.841861]        [<c04ba2a4>] __dabt_svc+0x44/0x80
> [    3.847089]        [<c0289c34>] __clear_user_std+0x1c/0x64
> [    3.852877]
> -> #0 (&mm->mmap_sem){++++++}:
> [    3.857393]        [<c00927ec>] __lock_acquire+0x1d70/0x1de0
> [    3.863353]        [<c0092df0>] lock_acquire+0x9c/0x104
> [    3.868855]        [<c00f0b18>] might_fault+0x60/0x90
> [    3.874174]        [<c011bc3c>] filldir+0x5c/0x158
> [    3.879230]        [<c023d1c0>] jffs2_readdir+0xdc/0x1a8
> [    3.884823]        [<c011becc>] vfs_readdir+0x98/0xb4
> [    3.890144]        [<c011bfcc>] sys_getdents+0x74/0xd0
> [    3.895554]        [<c0013820>] ret_fast_syscall+0x0/0x3c
> [    3.901251]
> [    3.901251] other info that might help us debug this:
> [    3.901251]
> [    3.909668]  Possible unsafe locking scenario:
> [    3.909668]
> [    3.915892]        CPU0                    CPU1
> [    3.920652]        ----                    ----
> [    3.925411]   lock(&f->sem);
> [    3.928451]                                lock(&mm->mmap_sem);
> [    3.934688]                                lock(&f->sem);
> [    3.940376]   lock(&mm->mmap_sem);
> [    3.943965]
> [    3.943965]  *** DEADLOCK ***
> [    3.943965]
> [    3.950196] 2 locks held by rcS/686:
> [    3.953952]  #0:  (&type->i_mutex_dir_key){+.+.+.}, at: [<c011be90>] vfs_readdir+0x5c/0xb4
> [    3.962686]  #1:  (&f->sem){+.+.+.}, at: [<c023d128>] jffs2_readdir+0x44/0x1a8
> [    3.970320]
> [    3.970320] stack backtrace:
> [    3.974930] [<c001b158>] (unwind_backtrace+0x0/0xf0) from [<c008f29c>] (print_circular_bug+0x1d0/0x2dc)
> [    3.984815] [<c008f29c>] (print_circular_bug+0x1d0/0x2dc) from [<c00927ec>] (__lock_acquire+0x1d70/0x1de0)
> [    3.994975] [<c00927ec>] (__lock_acquire+0x1d70/0x1de0) from [<c0092df0>] (lock_acquire+0x9c/0x104)
> [    4.004494] [<c0092df0>] (lock_acquire+0x9c/0x104) from [<c00f0b18>] (might_fault+0x60/0x90)
> [    4.013376] [<c00f0b18>] (might_fault+0x60/0x90) from [<c011bc3c>] (filldir+0x5c/0x158)
> [    4.021802] [<c011bc3c>] (filldir+0x5c/0x158) from [<c023d1c0>] (jffs2_readdir+0xdc/0x1a8)
> [    4.030502] [<c023d1c0>] (jffs2_readdir+0xdc/0x1a8) from [<c011becc>] (vfs_readdir+0x98/0xb4)
> [    4.039477] [<c011becc>] (vfs_readdir+0x98/0xb4) from [<c011bfcc>] (sys_getdents+0x74/0xd0)
> [    4.048270] [<c011bfcc>] (sys_getdents+0x74/0xd0) from [<c0013820>] (ret_fast_syscall+0x0/0x3c)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[relevance 0%]

* linux-next: JFFS2 corruption
@ 2013-02-26 15:50  2% Mark Jackson
  2013-02-26 23:18  0% ` Stephen Rothwell
  0 siblings, 1 reply; 28+ results
From: Mark Jackson @ 2013-02-26 15:50 UTC (permalink / raw)
  To: linux-next; +Cc: linux-mtd, David Woodhouse, lkml

Just tested the current next-20130226 on a custom AM335X board, and if I mount
our JFFS2 image as read/write, the next reboot shows the image as being corrupt.

If I reprogram the jffs2 image into NAND and only mount the volume as read-only,
no corruption occurs and the system remains intact.

I have also tested:-

(a) reprogram ubifs image into nand
(b) boot the volume as read-only (corrupt -> no)
(c) remount the volume as read/write
(d) rebooting the volume as read-only (corrupt -> yes)

Below is the log showing (d) ...

Regards
Mark J.
---
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 3.8.0-next-20130226-dirty (mpfj@mpfj-nanobone) (gcc version 4.5.4 (Buildroot 2012.11) ) #12 SMP Tue Feb 26 14:04:28 GMT 2013
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine: Generic AM33XX (Flattened Device Tree), model: TI AM335x BeagleBone
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] AM335X ES1.0 (neon )
[    0.000000] PERCPU: Embedded 9 pages/cpu @c0e02000 s13696 r8192 d14976 u36864
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 64768
[    0.000000] Kernel command line: console=ttyO0,115200n8 noinitrd ip=off mem=256M rootwait=1 rootfstype=jffs2 root=/dev/mtdblock6 ro
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] __ex_table already sorted, skipping sort
[    0.000000] Memory: 255MB = 255MB total
[    0.000000] Memory: 246536k/246536k available, 15608k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xd0800000 - 0xff000000   ( 744 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc05cd3a0   (5909 kB)
[    0.000000]       .init : 0xc05ce000 - 0xc061e580   ( 322 kB)
[    0.000000]       .data : 0xc0620000 - 0xc06a6820   ( 539 kB)
[    0.000000]        .bss : 0xc06a6820 - 0xc0bf4d6c   (5434 kB)
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
[    0.000000] Total of 128 interrupts on 1 active controller
[    0.000000] OMAP clockevent source: GPTIMER1 at 26000000 Hz
[    0.000000] sched_clock: 32 bits at 26MHz, resolution 38ns, wraps every 165191ms
[    0.000000] OMAP clocksource: GPTIMER2 at 26000000 Hz
[    0.000000] Console: colour dummy device 80x30
[    0.000000] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[    0.000000] ... MAX_LOCKDEP_SUBCLASSES:  8
[    0.000000] ... MAX_LOCK_DEPTH:          48
[    0.000000] ... MAX_LOCKDEP_KEYS:        8191
[    0.000000] ... CLASSHASH_SIZE:          4096
[    0.000000] ... MAX_LOCKDEP_ENTRIES:     16384
[    0.000000] ... MAX_LOCKDEP_CHAINS:      32768
[    0.000000] ... CHAINHASH_SIZE:          16384
[    0.000000]  memory used by lock dependency info: 3695 kB
[    0.000000]  per task-struct memory footprint: 1152 bytes
[    0.001032] Calibrating delay loop... 476.77 BogoMIPS (lpj=2383872)
[    0.109736] pid_max: default: 32768 minimum: 301
[    0.110266] Security Framework initialized
[    0.110426] Mount-cache hash table entries: 512
[    0.121717] CPU: Testing write buffer coherency: ok
[    0.123210] CPU0: thread -1, cpu 0, socket -1, mpidr 0
[    0.123295] Setting up static identity map for 0xc041e950 - 0xc041e9c0
[    0.126044] Brought up 1 CPUs
[    0.126069] SMP: Total of 1 processors activated (476.77 BogoMIPS).
[    0.126081] CPU: All CPU(s) started in SVC mode.
[    0.129080] devtmpfs: initialized
[    0.200411] pinctrl core: initialized pinctrl subsystem
[    0.206461] regulator-dummy: no parameters
[    0.209043] NET: Registered protocol family 16
[    0.209939] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.233770] OMAP GPIO hardware version 0.1
[    0.263351] omap-gpmc 50000000.gpmc: GPMC revision 6.0
[    0.265960] No ATAGs?
[    0.265988] hw-breakpoint: debug architecture 0x4 unsupported.
[    0.311687] bio: create slab <bio-0> at 0
[    0.398050] omap-dma-engine omap-dma-engine: OMAP DMA engine driver
[    0.405918] usbcore: registered new interface driver usbfs
[    0.406470] usbcore: registered new interface driver hub
[    0.407327] usbcore: registered new device driver usb
[    0.409003] omap_i2c 44e0b000.i2c: did not get pins for i2c error: -19
[    0.411618] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[    0.413344] mcp230xx: probe of 0-0020 failed with error -22
[    0.419117] DCDC1: at 1800 mV
[    0.422543] vdd_mpu: 925 <--> 1325 mV at 3300 mV
[    0.424721] vdd_core: 925 <--> 1150 mV at 1100 mV
[    0.426984] LDO1: at 1800 mV
[    0.429065] LDO2: at 3300 mV
[    0.431676] LDO3: at 3300 mV
[    0.433749] LDO4: at 2800 mV
[    0.435554] tps65217 0-0024: TPS65217 ID 0x7 version 1.1
[    0.446197] Switching to clocksource gp_timer
[    0.560007] NET: Registered protocol family 2
[    0.562070] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    0.562292] TCP bind hash table entries: 2048 (order: 4, 73728 bytes)
[    0.563243] TCP: Hash tables configured (established 2048 bind 2048)
[    0.563476] TCP: reno registered
[    0.563510] UDP hash table entries: 256 (order: 2, 20480 bytes)
[    0.563775] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
[    0.564666] NET: Registered protocol family 1
[    0.565819] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.566339] CPU PMU: probing PMU on CPU 0
[    0.566373] hw perfevents: enabled with ARMv7 Cortex-A8 PMU driver, 5 counters available
[    0.710679] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
[    0.711291] msgmni has been set to 481
[    0.714998] io scheduler noop registered
[    0.715027] io scheduler deadline registered
[    0.715110] io scheduler cfq registered (default)
[    0.716538] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
[    0.721523] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.728884] omap_uart 44e09000.serial: did not get pins for uart0 error: -19
[    0.729525] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 88) is a OMAP UART0
[    1.319153] console [ttyO0] enabled
[    1.325110] omap_uart 48022000.serial: did not get pins for uart1 error: -19
[    1.333400] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 89) is a OMAP UART1
[    1.343363] omap_uart 48024000.serial: did not get pins for uart2 error: -19
[    1.351285] 48024000.serial: ttyO2 at MMIO 0x48024000 (irq = 90) is a OMAP UART2
[    1.360714] omap_uart 481a6000.serial: did not get pins for uart3 error: -19
[    1.368752] 481a6000.serial: ttyO3 at MMIO 0x481a6000 (irq = 60) is a OMAP UART3
[    1.378159] omap_uart 481a8000.serial: did not get pins for uart4 error: -19
[    1.385862] 481a8000.serial: ttyO4 at MMIO 0x481a8000 (irq = 61) is a OMAP UART4
[    1.395315] omap_uart 481aa000.serial: did not get pins for uart5 error: -19
[    1.403172] 481aa000.serial: ttyO5 at MMIO 0x481aa000 (irq = 62) is a OMAP UART5
[    1.446256] brd: module loaded
[    1.471131] loop: module loaded
[    1.478556] mtdoops: mtd device (mtddev=name/number) must be supplied
[    1.487714] Generic platform RAM MTD, (c) 2004 Simtec Electronics
[    1.496006] enabling NAND BCH ecc with 8-bit correction
[    1.502018] ONFI param page 0 valid
[    1.505695] ONFI flash detected
[    1.509090] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G08ABAEAWP), 256MiB, page size: 2048, OOB size: 64
[    1.521348] 8 ofpart partitions found on MTD device omap2-nand.0
[    1.527717] Creating 8 MTD partitions on "omap2-nand.0":
[    1.533316] 0x000000000000-0x000000020000 : "spl1"
[    1.545257] 0x000000020000-0x000000040000 : "spl2"
[    1.555022] 0x000000040000-0x000000060000 : "spl3"
[    1.564408] 0x000000060000-0x000000080000 : "spl4"
[    1.573946] 0x000000080000-0x0000001e0000 : "boot"
[    1.584828] 0x0000001e0000-0x000000200000 : "env"
[    1.594707] 0x000000200000-0x000004200000 : "rootfs"
[    1.659562] 0x000004200000-0x000010000000 : "data"
[    1.839654] usbcore: registered new interface driver asix
[    1.845828] usbcore: registered new interface driver cdc_ether
[    1.852728] usbcore: registered new interface driver smsc95xx
[    1.859890] usbcore: registered new interface driver net1080
[    1.866332] usbcore: registered new interface driver cdc_subset
[    1.873194] usbcore: registered new interface driver zaurus
[    1.879727] usbcore: registered new interface driver cdc_ncm
[    1.888250] usbcore: registered new interface driver cdc_wdm
[    1.894777] usbcore: registered new interface driver usbtest
[    1.904123] rtc-ds1307 0-0068: rtc core: registered ds1307 as rtc0
[    1.910851] rtc-ds1307 0-0068: 56 bytes nvram
[    1.916215] i2c /dev entries driver
[    1.925777] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
[    1.934797] omap_cpufreq_init: unable to get MPU regulator
[    1.944756] usbcore: registered new interface driver usbhid
[    1.950806] usbhid: USB HID core driver
[    1.956489] oprofile: using arm/armv7
[    1.961449] TCP: cubic registered
[    1.964949] Initializing XFRM netlink socket
[    1.969694] NET: Registered protocol family 17
[    1.974613] NET: Registered protocol family 15
[    1.979855] Key type dns_resolver registered
[    1.984457] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[    1.992657] ThumbEE CPU extension supported.
[    2.066693] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
[    2.073130] davinci_mdio 4a101000.mdio: detected phy mask fffffffc
[    2.084362] libphy: 4a101000.mdio: probed
[    2.088760] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
[    2.098421] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver SMSC LAN8710/LAN8720
[    2.108516] Random MACID = fa:91:6f:36:0e:b0
[    2.118076] rtc-ds1307 0-0068: setting system clock to 2013-01-21 20:34:58 UTC (1358800498)
[    2.652964] jffs2: mtd->read(0x1fc54 bytes from 0x3a03ac) returned ECC error
[    2.676730] jffs2: mtd->read(0x1e260 bytes from 0x3a1da0) returned ECC error
[    2.684150] jffs2: Empty flash at 0x003a1d9c ends at 0x003a2000
[    3.161187] jffs2: notice: (1) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    3.179148] VFS: Mounted root (jffs2 filesystem) readonly on device 31:6.
[    3.188034] devtmpfs: mounted
[    3.191762] Freeing init memory: 320K
[    3.606040]
[    3.607646] ======================================================
[    3.614138] [ INFO: possible circular locking dependency detected ]
[    3.620728] 3.8.0-next-20130226-dirty #12 Not tainted
[    3.626033] -------------------------------------------------------
[    3.632615] rcS/631 is trying to acquire lock:
[    3.637283]  (&mm->mmap_sem){++++++}, at: [<c00f0af4>] might_fault+0x3c/0x90
[    3.644741]
[    3.644741] but task is already holding lock:
[    3.650867]  (&f->sem){+.+.+.}, at: [<c01a278c>] jffs2_readdir+0x44/0x1a8
[    3.658040]
[    3.658040] which lock already depends on the new lock.
[    3.658040]
[    3.666633]
[    3.666633] the existing dependency chain (in reverse order) is:
[    3.674496]
-> #1 (&f->sem){+.+.+.}:
[    3.678463]        [<c0092df0>] lock_acquire+0x9c/0x104
[    3.683975]        [<c0416c04>] mutex_lock_nested+0x3c/0x334
[    3.689941]        [<c01a2fb4>] jffs2_readpage+0x20/0x44
[    3.695530]        [<c00d9d38>] __do_page_cache_readahead+0x2a0/0x2cc
[    3.702313]        [<c00da004>] ra_submit+0x28/0x30
[    3.707446]        [<c00d179c>] filemap_fault+0x304/0x458
[    3.713138]        [<c00f0c58>] __do_fault+0x6c/0x490
[    3.718454]        [<c00f3c5c>] handle_pte_fault+0xb0/0x6f0
[    3.724316]        [<c00f433c>] handle_mm_fault+0xa0/0xd4
[    3.729994]        [<c041b30c>] do_page_fault+0x2a0/0x3d4
[    3.735679]        [<c000845c>] do_DataAbort+0x30/0x9c
[    3.741085]        [<c04197e4>] __dabt_svc+0x44/0x80
[    3.746309]        [<c0222b98>] __clear_user_std+0x1c/0x64
[    3.752089]
-> #0 (&mm->mmap_sem){++++++}:
[    3.756599]        [<c00927ec>] __lock_acquire+0x1d70/0x1de0
[    3.762554]        [<c0092df0>] lock_acquire+0x9c/0x104
[    3.768051]        [<c00f0b18>] might_fault+0x60/0x90
[    3.773364]        [<c011bc3c>] filldir+0x5c/0x158
[    3.778416]        [<c01a2824>] jffs2_readdir+0xdc/0x1a8
[    3.784005]        [<c011becc>] vfs_readdir+0x98/0xb4
[    3.789319]        [<c011bfcc>] sys_getdents+0x74/0xd0
[    3.794724]        [<c0013820>] ret_fast_syscall+0x0/0x3c
[    3.800416]
[    3.800416] other info that might help us debug this:
[    3.800416]
[    3.808824]  Possible unsafe locking scenario:
[    3.808824]
[    3.815041]        CPU0                    CPU1
[    3.819797]        ----                    ----
[    3.824550]   lock(&f->sem);
[    3.827587]                                lock(&mm->mmap_sem);
[    3.833815]                                lock(&f->sem);
[    3.839496]   lock(&mm->mmap_sem);
[    3.843079]
[    3.843079]  *** DEADLOCK ***
[    3.843079]
[    3.849302] 2 locks held by rcS/631:
[    3.853055]  #0:  (&type->i_mutex_dir_key){+.+.+.}, at: [<c011be90>] vfs_readdir+0x5c/0xb4
[    3.861778]  #1:  (&f->sem){+.+.+.}, at: [<c01a278c>] jffs2_readdir+0x44/0x1a8
[    3.869404]
[    3.869404] stack backtrace:
[    3.874009] [<c001b158>] (unwind_backtrace+0x0/0xf0) from [<c008f29c>] (print_circular_bug+0x1d0/0x2dc)
[    3.883888] [<c008f29c>] (print_circular_bug+0x1d0/0x2dc) from [<c00927ec>] (__lock_acquire+0x1d70/0x1de0)
[    3.894040] [<c00927ec>] (__lock_acquire+0x1d70/0x1de0) from [<c0092df0>] (lock_acquire+0x9c/0x104)
[    3.903553] [<c0092df0>] (lock_acquire+0x9c/0x104) from [<c00f0b18>] (might_fault+0x60/0x90)
[    3.912427] [<c00f0b18>] (might_fault+0x60/0x90) from [<c011bc3c>] (filldir+0x5c/0x158)
[    3.920844] [<c011bc3c>] (filldir+0x5c/0x158) from [<c01a2824>] (jffs2_readdir+0xdc/0x1a8)
[    3.929533] [<c01a2824>] (jffs2_readdir+0xdc/0x1a8) from [<c011becc>] (vfs_readdir+0x98/0xb4)
[    3.938500] [<c011becc>] (vfs_readdir+0x98/0xb4) from [<c011bfcc>] (sys_getdents+0x74/0xd0)
[    3.947285] [<c011bfcc>] (sys_getdents+0x74/0xd0) from [<c0013820>] (ret_fast_syscall+0x0/0x3c)
Starting logging: OK
Initializing random number generator... [    3.997350] jffs2: mtd->read(0x778 bytes from 0x3a3888) returned ECC error
[    4.021216] jffs2: mtd->read(0x7bc bytes from 0x3a3844) returned ECC error
[    4.043965] jffs2: mtd->read(0x800 bytes from 0x3a3800) returned ECC error
[    4.059373] jffs2: mtd->read(0x44 bytes from 0x3a3888) returned ECC error
[    4.075443] jffs2: mtd->read(0x44 bytes from 0x3a3888) returned ECC error
[    4.083554] jffs2: mtd->read(0x200 bytes from 0x3a38cc) returned ECC error
read-only file system detected...done
Starting network...
Starting dropbear sshd: mkdir: can't create directory '/etc/dropbear': Read-only file system
generating rsa key... generating dsa key... OK
Starting lighttpd: OK

Welcome to Buildroot
beaglebone login:

^ permalink raw reply	[relevance 2%]

* linux-next: JFFS2 deadlock
@ 2013-02-26 11:54  4% Mark Jackson
  2013-02-26 23:17  0% ` Stephen Rothwell
  0 siblings, 1 reply; 28+ results
From: Mark Jackson @ 2013-02-26 11:54 UTC (permalink / raw)
  To: linux-next; +Cc: linux-mtd, David Woodhouse, lkml

Just tested the current next-20130226 on a custom AM335X board, and I received the JFFS2 deadlock shown below.

Regards
Mark JACKSON
---
[    3.250349] jffs2: notice: (1) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    3.268364] VFS: Mounted root (jffs2 filesystem) readonly on device 31:6.
[    3.277233] devtmpfs: mounted
[    3.280982] Freeing init memory: 332K
[    3.706697]
[    3.708306] ======================================================
[    3.714804] [ INFO: possible circular locking dependency detected ]
[    3.721398] 3.8.0-next-20130226-dirty #10 Not tainted
[    3.726708] -------------------------------------------------------
[    3.733297] rcS/686 is trying to acquire lock:
[    3.737969]  (&mm->mmap_sem){++++++}, at: [<c00f0af4>] might_fault+0x3c/0x90
[    3.745437]
[    3.745437] but task is already holding lock:
[    3.751569]  (&f->sem){+.+.+.}, at: [<c023d128>] jffs2_readdir+0x44/0x1a8
[    3.758748]
[    3.758748] which lock already depends on the new lock.
[    3.758748]
[    3.767348]
[    3.767348] the existing dependency chain (in reverse order) is:
[    3.775215]
-> #1 (&f->sem){+.+.+.}:
[    3.779184]        [<c0092df0>] lock_acquire+0x9c/0x104
[    3.784701]        [<c04b76e4>] mutex_lock_nested+0x3c/0x334
[    3.790666]        [<c023d950>] jffs2_readpage+0x20/0x44
[    3.796261]        [<c00d9d38>] __do_page_cache_readahead+0x2a0/0x2cc
[    3.803050]        [<c00da004>] ra_submit+0x28/0x30
[    3.808187]        [<c00d179c>] filemap_fault+0x304/0x458
[    3.813884]        [<c00f0c58>] __do_fault+0x6c/0x490
[    3.819203]        [<c00f3c5c>] handle_pte_fault+0xb0/0x6f0
[    3.825071]        [<c00f433c>] handle_mm_fault+0xa0/0xd4
[    3.830755]        [<c04bbdcc>] do_page_fault+0x2a0/0x3d4
[    3.836449]        [<c000845c>] do_DataAbort+0x30/0x9c
[    3.841861]        [<c04ba2a4>] __dabt_svc+0x44/0x80
[    3.847089]        [<c0289c34>] __clear_user_std+0x1c/0x64
[    3.852877]
-> #0 (&mm->mmap_sem){++++++}:
[    3.857393]        [<c00927ec>] __lock_acquire+0x1d70/0x1de0
[    3.863353]        [<c0092df0>] lock_acquire+0x9c/0x104
[    3.868855]        [<c00f0b18>] might_fault+0x60/0x90
[    3.874174]        [<c011bc3c>] filldir+0x5c/0x158
[    3.879230]        [<c023d1c0>] jffs2_readdir+0xdc/0x1a8
[    3.884823]        [<c011becc>] vfs_readdir+0x98/0xb4
[    3.890144]        [<c011bfcc>] sys_getdents+0x74/0xd0
[    3.895554]        [<c0013820>] ret_fast_syscall+0x0/0x3c
[    3.901251]
[    3.901251] other info that might help us debug this:
[    3.901251]
[    3.909668]  Possible unsafe locking scenario:
[    3.909668]
[    3.915892]        CPU0                    CPU1
[    3.920652]        ----                    ----
[    3.925411]   lock(&f->sem);
[    3.928451]                                lock(&mm->mmap_sem);
[    3.934688]                                lock(&f->sem);
[    3.940376]   lock(&mm->mmap_sem);
[    3.943965]
[    3.943965]  *** DEADLOCK ***
[    3.943965]
[    3.950196] 2 locks held by rcS/686:
[    3.953952]  #0:  (&type->i_mutex_dir_key){+.+.+.}, at: [<c011be90>] vfs_readdir+0x5c/0xb4
[    3.962686]  #1:  (&f->sem){+.+.+.}, at: [<c023d128>] jffs2_readdir+0x44/0x1a8
[    3.970320]
[    3.970320] stack backtrace:
[    3.974930] [<c001b158>] (unwind_backtrace+0x0/0xf0) from [<c008f29c>] (print_circular_bug+0x1d0/0x2dc)
[    3.984815] [<c008f29c>] (print_circular_bug+0x1d0/0x2dc) from [<c00927ec>] (__lock_acquire+0x1d70/0x1de0)
[    3.994975] [<c00927ec>] (__lock_acquire+0x1d70/0x1de0) from [<c0092df0>] (lock_acquire+0x9c/0x104)
[    4.004494] [<c0092df0>] (lock_acquire+0x9c/0x104) from [<c00f0b18>] (might_fault+0x60/0x90)
[    4.013376] [<c00f0b18>] (might_fault+0x60/0x90) from [<c011bc3c>] (filldir+0x5c/0x158)
[    4.021802] [<c011bc3c>] (filldir+0x5c/0x158) from [<c023d1c0>] (jffs2_readdir+0xdc/0x1a8)
[    4.030502] [<c023d1c0>] (jffs2_readdir+0xdc/0x1a8) from [<c011becc>] (vfs_readdir+0x98/0xb4)
[    4.039477] [<c011becc>] (vfs_readdir+0x98/0xb4) from [<c011bfcc>] (sys_getdents+0x74/0xd0)
[    4.048270] [<c011bfcc>] (sys_getdents+0x74/0xd0) from [<c0013820>] (ret_fast_syscall+0x0/0x3c)

^ permalink raw reply	[relevance 4%]

* fsl elbc driver causes corruption with bus monitor timeouts while simultaneously access on Nor / Nand mtd partitions
@ 2011-04-14  7:06  4% emre kara
  0 siblings, 0 replies; 28+ results
From: emre kara @ 2011-04-14  7:06 UTC (permalink / raw)
  To: Scott Wood, Roy Zang
  Cc: linuxppc-dev, linux-kernel, David Woodhouse, Lan Chunhe-B25806,
	Wood Scott-B07421, Anton Vorontsov, felix, bayraktarz

Hi Scott, Roy.
Scott's "mtd: eLBC NAND: increase bus timeout to maximum" patch is excluded from kernel with Roy's "P4080/eLBC: Make Freescale elbc interrupt common to elbc devices" patch. I don't know the reason for it but this causes bus monitor timeouts and corrupts nand flash while using mainline kernel. As I know there is an errata related to this topic, I think "increasing bus timeout to maximum" is a must.
You can easly generate this situation with below commands:

Note: mtd4 is a Nor and mtd9 is a Nand partition.
[root@P2020RDB root]# mount /dev/mtdblock9 /mnt/src/
mount: you must specify the filesystem type
[root@P2020RDB root]# mount /dev/mtdblock9 /mnt/src/ -t jffs2
��JFFS2 notice: (1950) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[root@P2020RDB root]# dd if=/dev/mtd4 of=/mnt/src/uboot bs=1
fsl-lbc ffe05000.localbus: Local bus monitor time-out: LTESR 0x80000000
fsl-lbc ffe05000.localbus: command failed: fir 412e0000 fcr 0 status 80000000 mdr c0
Read of newly-erased block at 0x00430000 failed: -74. Putting on bad_list
fsl-lbc ffe05000.localbus: Local bus monitor time-out: LTESR 0x80000000
fsl-lbc ffe05000.localbus: command failed: fir 426db000 fcr 6070d000 status 80000000 mdr ff
Erase at 0x0042c000 failed immediately: errno -5
fsl-lbc ffe05000.localbus: Local bus monitor time-out: LTESR 0x80000000
Cfsl-lbc ffe05000.localbus: command failed: fir 412e0000 fcr 0 status 80000000 mdr c0
Read of newly-erased block at 0x00433000 failed: -74. Putting on bad_list
JFFS2: marking eraseblock at 00433000

Regards.

Emre


^ permalink raw reply	[relevance 4%]

* bug list: putting too much data on the stack
@ 2010-02-11  8:51  1% Dan Carpenter
  0 siblings, 0 replies; 28+ results
From: Dan Carpenter @ 2010-02-11  8:51 UTC (permalink / raw)
  To: kernel-janitors; +Cc: linux-kernel

This is a list of functions that put a lot of data (500 bytes) on the stack.  
I don't know if 500 is reasonable, but I've seen people complaining about 
smaller amounts.

The list was generated by: 
  make C=1 CHECK="/path/to/smatch -p=kernel" modules bzImage | tee warns.txt
  grep "bytes on stack" warns.txt

regards,
dan carpenter

Previous bug lists:
* Assigning negative values to unsigned variables
  http://lkml.indiana.edu/hypermail/linux/kernel/1001.3/01222.html

* Doing dma on the stack
  http://lkml.indiana.edu/hypermail/linux/kernel/1001.3/01231.html

* Dereferencing variables before verifying they are not null
  http://lkml.indiana.edu/hypermail/linux/kernel/1001.3/01980.html

arch/x86/kernel/early_printk.c +169 early_printk(2) warn: 'buf' puts 512 bytes on stack
fs/select.c +399 do_select(3) warn: 'table' puts 604 bytes on stack
fs/select.c +814 do_sys_poll(3) warn: 'table' puts 604 bytes on stack
fs/fuse/dev.c +888 fuse_notify_inval_entry(5) warn: 'buf' puts 1025 bytes on stack
fs/hfsplus/super.c +308 hfsplus_fill_super(4) warn: 'entry' puts 520 bytes on stack
fs/hfsplus/inode.c +398 hfsplus_cat_read_inode(2) warn: 'entry' puts 520 bytes on stack
fs/hfsplus/inode.c +462 hfsplus_cat_write_inode(4) warn: 'entry' puts 520 bytes on stack
fs/hfsplus/ioctl.c +100 hfsplus_setxattr(5) warn: 'entry' puts 520 bytes on stack
fs/hfsplus/ioctl.c +142 hfsplus_getxattr(5) warn: 'entry' puts 520 bytes on stack
fs/hfsplus/catalog.c +156 hfsplus_find_cat(3) warn: 'tmp' puts 520 bytes on stack
fs/hfsplus/catalog.c +185 hfsplus_create_cat(4) warn: 'entry' puts 520 bytes on stack
fs/hfsplus/catalog.c +317 hfsplus_rename_cat(6) warn: 'entry' puts 520 bytes on stack
fs/hfsplus/dir.c +33 hfsplus_lookup(6) warn: 'entry' puts 520 bytes on stack
fs/hfsplus/dir.c +119 hfsplus_readdir(6) warn: 'entry' puts 520 bytes on stack
fs/jffs2/xattr.c +767 jffs2_build_xattr_subsystem(3) warn: 'xref_tmphash' puts 512 bytes on stack
(null) +36 jffs2_rtime_compress(5) warn: 'positions' puts 512 bytes on stack
fs/jffs2/compr_rtime.c +78 jffs2_rtime_decompress(5) warn: 'positions' puts 512 bytes on stack
fs/lockd/clntproc.c +621 nlmclnt_reclaim(2) warn: 'reqst' puts 764 bytes on stack
fs/ncpfs/dir.c +276 __ncp_lookup_validate(7) warn: function puts 656 bytes on stack
fs/ncpfs/dir.c +800 ncp_lookup(6) warn: function puts 652 bytes on stack
fs/ncpfs/dir.c +885 ncp_create_new(7) warn: function puts 652 bytes on stack
fs/ncpfs/dir.c +953 ncp_mkdir(5) warn: function puts 644 bytes on stack
fs/ncpfs/dir.c +1115 ncp_rename(6) warn: function puts 528 bytes on stack
fs/nfsd/nfs4xdr.c +1814 nfsd4_encode_fattr(88) warn: function puts 500 bytes on stack
fs/reiserfs/namei.c +1309 reiserfs_rename(99) warn: function puts 562 bytes on stack
fs/reiserfs/stree.c +1334 reiserfs_delete_solid_item(9) warn: function puts 540 bytes on stack
ipc/sem.c +715 semctl_main(6) warn: 'fast_sem_io' puts 512 bytes on stack
security/selinux/ss/services.c +1736 security_load_policy(9) warn: function puts 598 bytes on stack
crypto/testmgr.c +398 test_aead(81) warn: function puts 660 bytes on stack
crypto/testmgr.c +948 test_comp(5) warn: 'result' puts 512 bytes on stack
crypto/testmgr.c +1030 test_pcomp(7) warn: 'result' puts 512 bytes on stack
drivers/atm/solos-pci.c +915 print_buffer(3) warn: 'msg' puts 500 bytes on stack
drivers/block/xd.c +785 xd_wd_init_drive(19) warn: 'buf' puts 512 bytes on stack
drivers/block/xd.c +868 xd_seagate_init_drive(2) warn: 'buf' puts 512 bytes on stack
drivers/block/cpqarray.c +896 do_ida_request(5) warn: 'tmp_sg' puts 896 bytes on stack
drivers/char/ipmi/ipmi_msghandler.c +4160 send_panic_events(7) warn: 'smi_msg' puts 572 bytes on stack
drivers/char/rocket.c +1266 get_ports(2) warn: 'tmp' puts 776 bytes on stack
drivers/char/stallion.c +2400 stl_getportstruct(2) warn: 'stl_dummyport' puts 596 bytes on stack
drivers/char/istallion.c +4210 stli_getportstruct(2) warn: 'stli_dummyport' puts 508 bytes on stack
drivers/crypto/padlock-aes.c +155 aes_set_key(53) warn: function puts 504 bytes on stack
drivers/crypto/hifn_795x.c +1656 hifn_test(11) warn: function puts 576 bytes on stack
drivers/gpu/drm/nouveau/nv40_graph.c +256 nv40_graph_init(20) warn: 'cp' puts 1024 bytes on stack
drivers/gpu/drm/radeon/radeon_atombios.c +645 radeon_get_atom_connector_info_from_supported_devices_table(14) warn: 'bios_connectors' puts 1600 bytes on stack
drivers/gpu/drm/radeon/atom.c +1191 atom_parse(6) warn: 'name' puts 512 bytes on stack
drivers/input/joystick/sidewinder.c +428 sw_read(2) warn: 'buf' puts 512 bytes on stack
drivers/isdn/act2000/act2000_isa.c +360 act2000_isa_getid(3) warn: 'fid' puts 510 bytes on stack
drivers/isdn/hardware/eicon/idifunc.c +189 connect_didd(5) warn: 'DIDD_Table' puts 512 bytes on stack
drivers/isdn/hardware/eicon/mntfunc.c +80 connect_didd(5) warn: 'DIDD_Table' puts 512 bytes on stack
drivers/isdn/hardware/eicon/capifunc.c +1056 divacapi_connect_didd(5) warn: 'DIDD_Table' puts 512 bytes on stack
drivers/isdn/hardware/eicon/message.c +4890 sig_ind(62) warn: function puts 671 bytes on stack
drivers/isdn/hardware/eicon/message.c +14762 group_optimization(6) warn: function puts 534 bytes on stack
drivers/isdn/hardware/eicon/diddfunc.c +55 connect_didd(5) warn: 'DIDD_Table' puts 512 bytes on stack
drivers/isdn/hardware/eicon/divasfunc.c +162 connect_didd(5) warn: 'DIDD_Table' puts 512 bytes on stack
drivers/isdn/i4l/isdn_common.c +1313 isdn_ioctl(39) warn: function puts 548 bytes on stack
drivers/media/common/saa7146_hlp.c +392 calculate_clipping_registers_rect(55) warn: function puts 832 bytes on stack
drivers/media/dvb/dvb-core/dvb_ca_en50221.c +590 dvb_ca_en50221_read_data(4) warn: 'buf' puts 512 bytes on stack
drivers/media/dvb/dvb-core/dvb_ca_en50221.c +1282 dvb_ca_en50221_io_write(7) warn: 'fragbuf' puts 512 bytes on stack
drivers/media/dvb/dvb-usb/dib0700_core.c +368 dib0700_download_firmware(7) warn: function puts 568 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +553 avc_tuner_dsd(3) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +586 avc_tuner_set_pids(2) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +629 avc_tuner_get_ts(2) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +664 avc_identify_subunit(2) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +700 avc_tuner_status(2) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +777 avc_lnb_control(4) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +823 avc_register_remote_control(2) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +909 avc_ca_app_info(2) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +948 avc_ca_info(2) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +985 avc_ca_reset(2) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +1015 avc_ca_pmt(2) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +1143 avc_ca_get_time_date(2) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +1176 avc_ca_enter_menu(2) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/firewire/firedtv-avc.c +1205 avc_ca_get_mmi(2) warn: 'buffer' puts 516 bytes on stack
drivers/media/dvb/frontends/dib3000mc.c +816 dib3000mc_i2c_enumeration(2) warn: 'st' puts 1416 bytes on stack
drivers/media/dvb/frontends/dib7000p.c +1326 dib7000p_i2c_enumeration(2) warn: 'st' puts 1468 bytes on stack
drivers/media/dvb/frontends/or51211.c +113 or51211_load_firmware(4) warn: 'tudata' puts 585 bytes on stack
drivers/media/video/cx18/cx18-driver.c +288 cx18_read_eeprom(2) warn: 'c' puts 504 bytes on stack
drivers/media/video/pvrusb2/pvrusb2-eeprom.c +128 pvr2_eeprom_analyze(11) warn: 'fake_client' puts 504 bytes on stack
drivers/media/video/saa7134/saa6752hs.c +684 saa6752hs_init(8) warn: function puts 541 bytes on stack
drivers/media/video/saa7164/saa7164-cmd.c +126 saa7164_cmd_dequeue(6) warn: 'tmp' puts 512 bytes on stack
drivers/message/i2o/i2o_config.c +907 i2o_cfg_passthru(138) warn: 'rmsg' puts 512 bytes on stack
drivers/mfd/wm8350-i2c.c +43 wm8350_i2c_write_device(4) warn: 'msg' puts 511 bytes on stack
drivers/misc/lkdtm.c +228 recursive_loop(2) warn: 'buf' puts 1024 bytes on stack
drivers/mtd/inftlcore.c +331 INFTL_foldchain(79) warn: 'movebuf' puts 512 bytes on stack
(null) +51 find_boot_record(5) warn: 'buf' puts 512 bytes on stack
drivers/mtd/nftlcore.c +405 NFTL_foldchain(162) warn: 'movebuf' puts 512 bytes on stack
drivers/mtd/nftlmount.c +42 find_boot_record(5) warn: 'buf' puts 512 bytes on stack
drivers/mtd/ftl.c +467 copy_erase_unit(3) warn: 'buf' puts 512 bytes on stack
drivers/net/hamradio/6pack.c +462 sixpack_receive_buf(4) warn: 'buf' puts 512 bytes on stack
drivers/net/ixgb/ixgb_main.c +1084 ixgb_set_multi(29) warn: 'mta' puts 768 bytes on stack
drivers/net/mlx4/main.c +731 mlx4_init_hca(9) warn: function puts 527 bytes on stack
drivers/net/sfc/ethtool.c +527 efx_ethtool_self_test(4) warn: 'efx_tests' puts 912 bytes on stack
drivers/net/tulip/de2104x.c +1783 de21041_get_srom_info(3) warn: 'ee_data' puts 518 bytes on stack
drivers/net/vxge/vxge-main.c +1807 vxge_rth_configure(33) warn: function puts 781 bytes on stack
drivers/net/vxge/vxge-main.c +4019 vxge_probe(8) warn: 'll_config' puts 668 bytes on stack
drivers/net/wan/cycx_x25.c +1017 hex_dump(2) warn: 'hex' puts 1024 bytes on stack
drivers/net/wireless/airo.c +3001 airo_process_scan_results(2) warn: 'bss' puts 714 bytes on stack
drivers/net/wireless/airo.c +3823 setup_card(47) warn: 'rssi_rid' puts 514 bytes on stack
drivers/net/wireless/airo.c +5489 proc_BSSList_open(6) warn: 'BSSList_rid' puts 714 bytes on stack
drivers/net/wireless/airo.c +7191 airo_get_aplist(8) warn: 'BSSList' puts 714 bytes on stack
drivers/net/wireless/airo.c +7753 airo_read_wireless_stats(5) warn: function puts 676 bytes on stack
drivers/net/wireless/ath/ath5k/debug.c +203 read_file_beacon(5) warn: 'buf' puts 500 bytes on stack
drivers/net/wireless/ath/ath5k/debug.c +317 read_file_debug(4) warn: 'buf' puts 700 bytes on stack
drivers/net/wireless/ath/ath9k/debug.c +83 read_file_dma(5) warn: 'buf' puts 1024 bytes on stack
drivers/net/wireless/ath/ath9k/debug.c +213 read_file_interrupt(4) warn: 'buf' puts 512 bytes on stack
drivers/net/wireless/ath/ath9k/debug.c +344 read_file_wiphy(4) warn: 'buf' puts 512 bytes on stack
drivers/net/wireless/ipw2x00/ipw2100.c +2114 ipw2100_set_essid(27) warn: function puts 561 bytes on stack
drivers/net/wireless/ipw2x00/ipw2200.c +3181 ipw_load_firmware(9) warn: 'phys' puts 512 bytes on stack
drivers/net/wireless/ipw2x00/libipw_rx.c +1617 libipw_process_probe_response(66) warn: function puts 509 bytes on stack
drivers/net/wireless/iwlwifi/iwl-debugfs.c +523 iwl_dbgfs_status_read(5) warn: 'buf' puts 512 bytes on stack
drivers/net/wireless/iwmc3200wifi/debugfs.c +321 iwm_debugfs_fw_err_read(6) warn: 'buf' puts 512 bytes on stack
drivers/net/wireless/libertas/assoc.c +667 lbs_associate(4) warn: 'cmd' puts 534 bytes on stack
drivers/net/bnx2.c +5841 bnx2_test_nvram(2) warn: 'buf' puts 512 bytes on stack
drivers/net/bnx2x_main.c +10377 bnx2x_test_nvram(16) warn: 'buf' puts 848 bytes on stack
drivers/net/niu.c +9129 niu_try_msix(2) warn: 'msi_vec' puts 512 bytes on stack
drivers/net/virtio_net.c +277 try_fill_recv_maxbufs(3) warn: 'sg' puts 560 bytes on stack
drivers/net/virtio_net.c +459 xmit_skb(2) warn: 'sg' puts 560 bytes on stack
drivers/scsi/bfa/bfad.c +647 bfad_fcs_port_cfg(4) warn: function puts 648 bytes on stack
drivers/scsi/bfa/bfad_im.c +170 bfad_im_info(6) warn: 'ioc_attr' puts 1340 bytes on stack
drivers/scsi/bfa/bfad_im.c +934 bfad_os_fc_host_init(5) warn: 'attr' puts 1340 bytes on stack
drivers/scsi/bfa/bfad_attr.c +424 bfad_im_serial_num_show(7) warn: 'ioc_attr' puts 1340 bytes on stack
drivers/scsi/bfa/bfad_attr.c +440 bfad_im_model_show(7) warn: 'ioc_attr' puts 1340 bytes on stack
drivers/scsi/bfa/bfad_attr.c +455 bfad_im_model_desc_show(7) warn: 'ioc_attr' puts 1340 bytes on stack
drivers/scsi/bfa/bfad_attr.c +485 bfad_im_symbolic_name_show(7) warn: 'ioc_attr' puts 1340 bytes on stack
drivers/scsi/bfa/bfad_attr.c +503 bfad_im_hw_version_show(7) warn: 'ioc_attr' puts 1340 bytes on stack
drivers/scsi/bfa/bfad_attr.c +525 bfad_im_optionrom_version_show(7) warn: 'ioc_attr' puts 1340 bytes on stack
drivers/scsi/bfa/bfad_attr.c +541 bfad_im_fw_version_show(7) warn: 'ioc_attr' puts 1340 bytes on stack
drivers/scsi/bfa/bfad_attr.c +556 bfad_im_num_of_ports_show(7) warn: 'ioc_attr' puts 1340 bytes on stack
drivers/scsi/bfa/bfa_ioc.c +2229 bfa_ioc_aen_post(5) warn: 'ioc_attr' puts 1340 bytes on stack
drivers/scsi/bfa/bfa_fcport.c +125 bfa_pport_aen_post(6) warn: 'ioc_attr' puts 1340 bytes on stack
drivers/scsi/bfa/fabric.c +566 bfa_fcs_fabric_psymb_init(3) warn: 'adapter_attr' puts 968 bytes on stack
drivers/scsi/bfa/fdmi.c +528 bfa_fcs_port_fdmi_build_rhba_pyld(4) warn: 'hba_attr' puts 756 bytes on stack
drivers/scsi/bfa/fdmi.c +821 bfa_fcs_port_fdmi_build_portattr_block(3) warn: 'fcs_port_attr' puts 556 bytes on stack
drivers/scsi/bfa/fdmi.c +1100 bfa_fcs_fdmi_get_hbaattr(5) warn: 'adapter_attr' puts 968 bytes on stack
drivers/scsi/bfa/vport.c +639 bfa_fcs_vport_get_max(2) warn: 'ioc_attr' puts 1340 bytes on stack
drivers/scsi/lpfc/lpfc_debugfs.c +398 lpfc_debugfs_dumpHBASlim_data(5) warn: 'buffer' puts 1024 bytes on stack
drivers/scsi/dpt_i2o.c +1791 adpt_i2o_passthru(2) warn: 'msg' puts 512 bytes on stack
drivers/scsi/dpt_i2o.c +2288 adpt_scsi_to_i2o(3) warn: 'msg' puts 512 bytes on stack
drivers/scsi/eata.c +1081 port_detect(5) warn: 'info' puts 532 bytes on stack
drivers/scsi/gdth_proc.c +48 gdth_set_asc_info(9) warn: function puts 524 bytes on stack
drivers/scsi/gdth.c +4100 ioc_lockdrv(2) warn: 'ldrv' puts 514 bytes on stack
drivers/scsi/gdth.c +4221 ioc_general(57) warn: function puts 532 bytes on stack
drivers/scsi/vmw_pvscsi.c +445 pvscsi_setup_all_rings(2) warn: 'cmd' puts 528 bytes on stack
drivers/scsi/scsi_debug.c +1440 resp_mode_select(5) warn: 'arr' puts 512 bytes on stack
drivers/scsi/scsi_debug.c +1537 resp_log_sense(4) warn: 'arr' puts 512 bytes on stack
drivers/staging/comedi/drivers/serial2002.c +176 tty_read(11) warn: 'table' puts 604 bytes on stack
drivers/staging/comedi/drivers/serial2002.c +488 serial_2002_open(93) warn: function puts 1600 bytes on stack
drivers/staging/hv/NetVsc.c +1296 NetVscOnChannelCallback(8) warn: 'packet' puts 2048 bytes on stack
drivers/staging/otus/ioctl.c +2697 usbdrv_ioctl(319) warn: function puts 636 bytes on stack
drivers/staging/otus/80211core/cmmsta.c +2971 zfIbssConnectNetwork(3) warn: 'tmpBssInfo' puts 912 bytes on stack
drivers/staging/otus/80211core/cmmsta.c +3815 zfInfraConnectNetwork(4) warn: 'candidateBss' puts 912 bytes on stack
drivers/staging/otus/80211core/cwep.c +130 zfWEPEncrypt(46) warn: function puts 563 bytes on stack
drivers/staging/otus/80211core/cwep.c +254 zfWEPDecrypt(49) warn: function puts 567 bytes on stack
drivers/staging/rt2860/common/mlme.c +4186 BssTableSortByRssi(3) warn: 'TmpBss' puts 1556 bytes on stack
drivers/staging/rt2860/common/cmm_aes.c +1210 AES_GTK_KEY_WRAP(5) warn: 'R' puts 512 bytes on stack
drivers/staging/rt2860/common/cmm_aes.c +1213 AES_GTK_KEY_WRAP(8) warn: 'aesctx' puts 516 bytes on stack
drivers/staging/rt2860/common/cmm_aes.c +1274 AES_GTK_KEY_UNWRAP(7) warn: 'aesctx' puts 516 bytes on stack
drivers/staging/rt2860/sta/sync.c +446 MlmeStartReqAction(6) warn: 'VarIE' puts 1024 bytes on stack
drivers/staging/rt2860/sta/sync.c +573 PeerBeaconAtScanAction(20) warn: 'VarIE' puts 1024 bytes on stack
drivers/staging/rt2860/sta/sync.c +691 PeerBeaconAtJoinAction(20) warn: 'VarIE' puts 1024 bytes on stack
drivers/staging/rt2860/sta/sync.c +1066 PeerBeacon(22) warn: 'VarIE' puts 1024 bytes on stack
drivers/staging/rt2860/sta/connect.c +288 CntlOidScanProc(4) warn: 'CurrBss' puts 1556 bytes on stack
drivers/staging/rt2860/rt_linux.c +726 send_monitor_packets(8) warn: 'ralinkrate' puts 1024 bytes on stack
drivers/staging/rt2860/sta_ioctl.c +694 rt_ioctl_iwaplist(6) warn: 'addr' puts 1024 bytes on stack
drivers/staging/rt2860/sta_ioctl.c +1571 rt_ioctl_siwmlme(6) warn: 'MsgElem' puts 1564 bytes on stack
drivers/staging/rt2870/common/../../rt2860/common/mlme.c +4186 BssTableSortByRssi(3) warn: 'TmpBss' puts 1556 bytes on stack
drivers/staging/rt2870/common/../../rt2860/common/cmm_aes.c +1210 AES_GTK_KEY_WRAP(5) warn: 'R' puts 512 bytes on stack
drivers/staging/rt2870/common/../../rt2860/common/cmm_aes.c +1213 AES_GTK_KEY_WRAP(8) warn: 'aesctx' puts 516 bytes on stack
drivers/staging/rt2870/common/../../rt2860/common/cmm_aes.c +1274 AES_GTK_KEY_UNWRAP(7) warn: 'aesctx' puts 516 bytes on stack
drivers/staging/rt2870/sta/../../rt2860/sta/sync.c +446 MlmeStartReqAction(6) warn: 'VarIE' puts 1024 bytes on stack
drivers/staging/rt2870/sta/../../rt2860/sta/sync.c +573 PeerBeaconAtScanAction(20) warn: 'VarIE' puts 1024 bytes on stack
drivers/staging/rt2870/sta/../../rt2860/sta/sync.c +691 PeerBeaconAtJoinAction(20) warn: 'VarIE' puts 1024 bytes on stack
drivers/staging/rt2870/sta/../../rt2860/sta/sync.c +1066 PeerBeacon(22) warn: 'VarIE' puts 1024 bytes on stack
drivers/staging/rt2870/sta/../../rt2860/sta/connect.c +288 CntlOidScanProc(4) warn: 'CurrBss' puts 1556 bytes on stack
drivers/staging/rt2870/../rt2860/rt_linux.c +726 send_monitor_packets(8) warn: 'ralinkrate' puts 1024 bytes on stack
drivers/staging/rt2870/../rt2860/sta_ioctl.c +694 rt_ioctl_iwaplist(6) warn: 'addr' puts 1024 bytes on stack
drivers/staging/rt2870/../rt2860/sta_ioctl.c +1571 rt_ioctl_siwmlme(6) warn: 'MsgElem' puts 1564 bytes on stack
drivers/staging/rtl8192e/r819xE_phy.c +2726 rtl8192_phy_SwChnlStepByStep(12) warn: function puts 789 bytes on stack
drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c +623 RxReorderIndicatePacket(7) warn: 'prxbIndicateArray' puts 512 bytes on stack
drivers/staging/rtl8192e/ieee80211/rtl819x_TSProc.c +41 RxPktPendingTimeout(9) warn: 'stats_IndicateArray' puts 512 bytes on stack
drivers/staging/rtl8192su/r8192S_phy.c +2810 phy_SwChnlStepByStep(17) warn: function puts 789 bytes on stack
drivers/staging/rtl8192su/r8192S_Efuse.c +2075 efuse_read_data(3) warn: 'efusedata' puts 512 bytes on stack
drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c +571 RxReorderIndicatePacket(7) warn: 'prxbIndicateArray' puts 512 bytes on stack
drivers/staging/rtl8192su/ieee80211/rtl819x_TSProc.c +34 RxPktPendingTimeout(9) warn: 'stats_IndicateArray' puts 512 bytes on stack
drivers/staging/rtl8192u/r819xU_phy.c +1254 rtl8192_phy_SwChnlStepByStep(12) warn: function puts 789 bytes on stack
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +615 RxReorderIndicatePacket(7) warn: 'prxbIndicateArray' puts 512 bytes on stack
drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +33 RxPktPendingTimeout(9) warn: 'stats_IndicateArray' puts 512 bytes on stack
drivers/staging/vt6655/device_main.c +3353 device_ioctl(215) warn: 'range' puts 568 bytes on stack
drivers/staging/vt6655/device_main.c +3386 device_ioctl(248) warn: 'buffer' puts 1280 bytes on stack
drivers/staging/vt6655/wmgr.c +1078 s_vMgrRxAssocResponse(84) warn: 'buf' puts 512 bytes on stack
drivers/staging/vt6655/iwctl.c +779 iwctl_giwaplist(6) warn: 'sock' puts 1024 bytes on stack
drivers/staging/vt6656/main_usb.c +1884 device_ioctl(218) warn: 'range' puts 568 bytes on stack
drivers/staging/vt6656/main_usb.c +1917 device_ioctl(251) warn: 'buffer' puts 1280 bytes on stack
drivers/staging/vt6656/wmgr.c +1023 s_vMgrRxAssocResponse(83) warn: 'buf' puts 512 bytes on stack
drivers/staging/vt6656/iwctl.c +836 iwctl_giwaplist(6) warn: 'sock' puts 1024 bytes on stack
drivers/staging/wavelan/wavelan.c +3281 wv_82586_start(8) warn: 'zeroes' puts 512 bytes on stack
drivers/staging/wlan-ng/prism2fw.c +763 read_cardpda(3) warn: 'msg' puts 1068 bytes on stack
drivers/staging/wlan-ng/prism2fw.c +979 writeimage(5) warn: 'rwritemsg' puts 4164 bytes on stack
drivers/staging/wlan-ng/p80211wext.c +1401 p80211wext_giwscan(5) warn: 'msg' puts 544 bytes on stack
drivers/telephony/ixj.c +4975 ixj_daa_cid_read(4) warn: 'CID' puts 512 bytes on stack
drivers/usb/storage/isd200.c +493 isd200_action(4) warn: 'srb_dev' puts 1200 bytes on stack
net/ipv4/tcp.c +2108 do_tcp_setsockopt(28) warn: 'ctd' puts 544 bytes on stack
net/ipv4/tcp.c +2520 do_tcp_getsockopt(81) warn: 'ctd' puts 544 bytes on stack
net/key/af_key.c +2492 pfkey_migrate(11) warn: function puts 585 bytes on stack
net/mac80211/debugfs_sta.c +123 sta_agg_status_read(3) warn: 'buf' puts 1150 bytes on stack
net/rds/iw_rdma.c +180 rds_iw_update_cm_id(4) warn: 'rs' puts 916 bytes on stack
net/xfrm/xfrm_user.c +1897 xfrm_do_migrate(8) warn: function puts 513 bytes on stack
lib/decompress_bunzip2.c +160 get_next_block(5) warn: 'byteCount' puts 1024 bytes on stack
arch/x86/boot/printf.c +298 printf(2) warn: 'printf_buf' puts 1024 bytes on stack


^ permalink raw reply	[relevance 1%]

Results 1-28 of 28 | reverse | sort options + mbox downloads above
-- links below jump to the message on this page --
2010-02-11  8:51  1% bug list: putting too much data on the stack Dan Carpenter
2011-04-14  7:06  4% fsl elbc driver causes corruption with bus monitor timeouts while simultaneously access on Nor / Nand mtd partitions emre kara
2013-02-26 11:54  4% linux-next: JFFS2 deadlock Mark Jackson
2013-02-26 23:17  0% ` Stephen Rothwell
2013-02-26 15:50  2% linux-next: JFFS2 corruption Mark Jackson
2013-02-26 23:18  0% ` Stephen Rothwell
2014-12-05  9:22     using DMA-API on ARM Arend van Spriel
2014-12-05  9:45     ` Russell King - ARM Linux
2014-12-05 12:24       ` Will Deacon
2014-12-05 12:56         ` Hante Meuleman
2014-12-05 13:23           ` Russell King - ARM Linux
2014-12-05 14:20             ` Hante Meuleman
2014-12-08 13:47  1%           ` Hante Meuleman
2015-04-07 16:27  3% Linux version 3.18.10 Bluez ver 5.28 security level crashing system Will Tucker
2015-04-07 17:21  0% ` Peter Hurley
2015-04-08 16:20  2%   ` Will Tucker
2016-01-07 19:11 18% [PATCH v4.4-rc8] jffs2: xattr: Silence frame size warning tim.gardner
2016-02-01 14:48  0% ` David Woodhouse
2017-05-09 20:30 35% [PATCH linux-next] jffs2: reduce stack usage in jffs2_build_xattr_subsystem() Fabian Frederick
2023-01-20 21:56 10% ` Nick Desaulniers
2018-10-20 11:07 16% [RFC PATCH] jffs2: make the overwritten xattr invisible after remount Hou Tao
2018-11-06 21:49  1% [PATCH] jffs2: implement mount option to configure endianness Nikunj Kela
2021-07-16 10:08  6% [PATCH] jffs2: Convert from atomic_t to refcount_t on jffs2_xattr_datum->refcnt Xiyu Yang
2021-09-06 14:26     [PATCH] Enable '-Werror' by default for all kernel builds Guenter Roeck
2021-09-06 16:12     ` Linus Torvalds
2021-09-07  2:30  1%   ` Nathan Chancellor
2021-10-24 17:38  4% fs/jffs2/xattr.c:887:1: warning: the frame size of 1040 bytes is larger than 1024 bytes kernel test robot
2022-01-14  8:16     [PATCH 5.15 00/41] 5.15.15-rc1 review Greg Kroah-Hartman
2022-01-14 19:59  4% ` Ron Economos
2022-01-15  8:14  0%   ` Greg Kroah-Hartman
2022-01-15 11:52  0%     ` Ron Economos
2022-01-15 12:15  0%       ` Greg Kroah-Hartman
2022-01-15 12:31  0%         ` Ron Economos
2022-01-14  8:16     [PATCH 5.16 00/37] 5.16.1-rc1 review Greg Kroah-Hartman
2022-01-15  4:25  4% ` Ron Economos
2023-05-06  4:56 34% [PATCH] jffs2: reduce stack usage in jffs2_build_xattr_subsystem() Christian Marangi
2023-05-06 13:11  5% ` Zhihao Cheng
2023-05-15 10:46 10% ` Christian Brauner

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).