From: ffainelli@freebox.fr (Florian Fainelli)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] ARM: net: bpf_jit_32: fix kzalloc gfp/size mismatch.
Date: Fri, 07 Dec 2012 17:51:39 +0100 [thread overview]
Message-ID: <2962422.LznIlvkqaJ@flexo> (raw)
In-Reply-To: <1354804718-1662-1-git-send-email-nschichan@freebox.fr>
On Thursday 06 December 2012 15:38:31 Nicolas Schichan wrote:
> 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>
This patch is a stable candidate for kernels 3.4+.
> ---
> arch/arm/net/bpf_jit_32.c | 4 ++--
> 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 c641fb6..a64d349 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)
> ctx.skf = fp;
> ctx.ret0_fp_idx = -1;
>
> - ctx.offsets = kzalloc(GFP_KERNEL, 4 * (ctx.skf->len + 1));
> + ctx.offsets = kzalloc(4 * (ctx.skf->len + 1), GFP_KERNEL);
> if (ctx.offsets == NULL)
> return;
>
> @@ -864,7 +864,7 @@ void bpf_jit_compile(struct sk_filter *fp)
>
> ctx.idx += ctx.imm_count;
> if (ctx.imm_count) {
> - ctx.imms = kzalloc(GFP_KERNEL, 4 * ctx.imm_count);
> + ctx.imms = kzalloc(4 * ctx.imm_count, GFP_KERNEL);
> if (ctx.imms == NULL)
> goto out;
> }
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <ffainelli@freebox.fr>
To: Nicolas Schichan <nschichan@freebox.fr>
Cc: mgherzan@gmail.com, rmk+kernel@arm.linux.org.uk,
Russell King <linux@arm.linux.org.uk>,
Eric Dumazet <eric.dumazet@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] ARM: net: bpf_jit_32: fix kzalloc gfp/size mismatch.
Date: Fri, 07 Dec 2012 17:51:39 +0100 [thread overview]
Message-ID: <2962422.LznIlvkqaJ@flexo> (raw)
In-Reply-To: <1354804718-1662-1-git-send-email-nschichan@freebox.fr>
On Thursday 06 December 2012 15:38:31 Nicolas Schichan wrote:
> 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>
This patch is a stable candidate for kernels 3.4+.
> ---
> arch/arm/net/bpf_jit_32.c | 4 ++--
> 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 c641fb6..a64d349 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)
> ctx.skf = fp;
> ctx.ret0_fp_idx = -1;
>
> - ctx.offsets = kzalloc(GFP_KERNEL, 4 * (ctx.skf->len + 1));
> + ctx.offsets = kzalloc(4 * (ctx.skf->len + 1), GFP_KERNEL);
> if (ctx.offsets == NULL)
> return;
>
> @@ -864,7 +864,7 @@ void bpf_jit_compile(struct sk_filter *fp)
>
> ctx.idx += ctx.imm_count;
> if (ctx.imm_count) {
> - ctx.imms = kzalloc(GFP_KERNEL, 4 * ctx.imm_count);
> + ctx.imms = kzalloc(4 * ctx.imm_count, GFP_KERNEL);
> if (ctx.imms == NULL)
> goto out;
> }
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2012-12-07 16:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-06 14:38 [PATCH 1/2] ARM: net: bpf_jit_32: fix kzalloc gfp/size mismatch Nicolas Schichan
2012-12-06 14:38 ` Nicolas Schichan
2012-12-06 14:38 ` [PATCH 2/2] ARM: net: bpf_jit_32: fix sp-relative load/stores offsets Nicolas Schichan
2012-12-06 14:38 ` Nicolas Schichan
2012-12-07 23:15 ` Mircea Gherzan
2012-12-07 23:15 ` Mircea Gherzan
2012-12-07 16:51 ` Florian Fainelli [this message]
2012-12-07 16:51 ` [PATCH 1/2] ARM: net: bpf_jit_32: fix kzalloc gfp/size mismatch Florian Fainelli
2012-12-07 23:04 ` Mircea Gherzan
2012-12-07 23:04 ` Mircea Gherzan
2012-12-10 13:18 ` Nicolas Schichan
2012-12-10 13:18 ` Nicolas Schichan
2012-12-10 13:20 ` Russell King - ARM Linux
2012-12-10 13:20 ` Russell King - ARM Linux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2962422.LznIlvkqaJ@flexo \
--to=ffainelli@freebox.fr \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.