aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/net
diff options
context:
space:
mode:
authorSchichan Nicolas <nschichan@freebox.fr>2012-12-10 08:49:39 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-12-10 19:16:59 -0500
commit89c2e00978ada02a5b84b361faee954cbc7a0386 (patch)
treea6232be1fa89adcecf99ca91bcbcde4d06744047 /arch/arm/net
parent026b7c6bf0bf044aa03e2affbda73b6c6a302538 (diff)
ARM: 7597/1: net: bpf_jit_32: fix kzalloc gfp/size mismatch.
Official prototype for kzalloc is: void *kzalloc(size_t, gfp_t); The ARM bpf_jit code was having the assumption that it was: void *kzalloc(gfp_t, size); This was resulting the use of some random GFP flags depending on the size requested and some random overflows once the really needed size was more than the value of GFP_KERNEL. This bug was present since the original inclusion of bpf_jit for ARM (ddecdfce: ARM: 7259/3: net: JIT compiler for packet filters). Signed-off-by: Nicolas Schichan <nschichan@freebox.fr> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/net')
-rw-r--r--arch/arm/net/bpf_jit_32.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index c641fb685017..a64d34968305 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -845,7 +845,7 @@ void bpf_jit_compile(struct sk_filter *fp)
845 ctx.skf = fp; 845 ctx.skf = fp;
846 ctx.ret0_fp_idx = -1; 846 ctx.ret0_fp_idx = -1;
847 847
848 ctx.offsets = kzalloc(GFP_KERNEL, 4 * (ctx.skf->len + 1)); 848 ctx.offsets = kzalloc(4 * (ctx.skf->len + 1), GFP_KERNEL);
849 if (ctx.offsets == NULL) 849 if (ctx.offsets == NULL)
850 return; 850 return;
851 851
@@ -864,7 +864,7 @@ void bpf_jit_compile(struct sk_filter *fp)
864 864
865 ctx.idx += ctx.imm_count; 865 ctx.idx += ctx.imm_count;
866 if (ctx.imm_count) { 866 if (ctx.imm_count) {
867 ctx.imms = kzalloc(GFP_KERNEL, 4 * ctx.imm_count); 867 ctx.imms = kzalloc(4 * ctx.imm_count, GFP_KERNEL);
868 if (ctx.imms == NULL) 868 if (ctx.imms == NULL)
869 goto out; 869 goto out;
870 } 870 }