Possible BUG on net/ipv4/ipcomp.c, line 358 (fwd)
Subsystems (4)
Herbert Xu
maintainerQuoted 11 lines · James Morris
---------- Forwarded message ----------
Date: Tue, 06 Nov 2007 14:53:30 +0100
From: Vicenç <[email protected]>
To: [email protected]
Subject: Possible BUG onnet/ipv4/ipcomp.c, line 358Hi James,
I think there is a bug on
net/ipv4/ipcomp.cline 358. The trivial patch that should fix it is:
Thanks for the report! The same bug exists in IPv6 too and this patch should fix both.
[IPSEC]: Fix crypto_alloc_comp error checking
The function crypto_alloc_comp returns an errno instead of NULL to indicate error. So it needs to be tested with IS_ERR.
This is based on a patch by Vicenç Beltran Querol.
Cheers,
Signature · 5 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--net/ipv4/ipcomp.c +2 -1
@@ -16,6 +16,7 @@#include <linux/module.h> #include <asm/semaphore.h> #include <linux/crypto.h> +#include <linux/err.h> #include <linux/pfkeyv2.h> #include <linux/percpu.h> #include <linux/smp.h>
@@ -344,7 +345,7 @@ static struct crypto_comp **ipcomp_alloc_tfms(const char *alg_name)for_each_possible_cpu (cpu) {struct crypto_comp *tfm =crypto_alloc_comp (alg_name,0 ,CRYPTO_ALG_ASYNC ); -if (!tfm) +if (IS_ERR (tfm)) goto error; *per_cpu_ptr (tfms, cpu) = tfm; }
net/ipv6/ipcomp6.c +2 -1
@@ -36,6 +36,7 @@#include <net/ipcomp.h> #include <asm/semaphore.h> #include <linux/crypto.h> +#include <linux/err.h> #include <linux/pfkeyv2.h> #include <linux/random.h> #include <linux/percpu.h>
@@ -358,7 +359,7 @@ static struct crypto_comp **ipcomp6_alloc_tfms(const char *alg_name)for_each_possible_cpu (cpu) {struct crypto_comp *tfm =crypto_alloc_comp (alg_name,0 ,CRYPTO_ALG_ASYNC ); -if (!tfm) +if (IS_ERR (tfm)) goto error; *per_cpu_ptr (tfms, cpu) = tfm; }
From: Herbert Xu <[email protected]>
Date: Wed, 7 Nov 2007 09:11:24 +0800
Quoted 8 lines
[IPSEC]: Fix
crypto_alloc_comperror checkingThe function
crypto_alloc_compreturns an errno instead of NULL to indicate error. So it needs to be tested withIS_ERR.This is based on a patch by Vicenç Beltran Querol.
Signed-off-by Herbert Xu <[email protected]>
Applied, and I'll queue this up for -stable too.
Thanks!