Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754859AbXKSSZ5 (ORCPT ); Mon, 19 Nov 2007 13:25:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751417AbXKSSWF (ORCPT ); Mon, 19 Nov 2007 13:22:05 -0500 Received: from pentafluge.infradead.org ([213.146.154.40]:49202 "EHLO pentafluge.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752074AbXKSSWE (ORCPT ); Mon, 19 Nov 2007 13:22:04 -0500 Date: Mon, 19 Nov 2007 10:19:00 -0800 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , Domenico Andreoli , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, bunk@kernel.org, Herbert Xu , "David S. Miller" Subject: [patch 12/26] Fix crypto_alloc_comp() error checking. Message-ID: <20071119181900.GM15425@kroah.com> References: <20071119181438.617190424@mini.kroah.org> MIME-Version: 1.0 Content-Type: text/plain; charset=unknown-8bit Content-Disposition: inline; filename="fix-crypto_alloc_comp-error-checking.patch" Content-Transfer-Encoding: 8bit In-Reply-To: <20071119181746.GA15425@kroah.com> User-Agent: Mutt/1.5.16 (2007-06-09) X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2012 Lines: 69 2.6.22-stable review patch. If anyone has any objections, please let us know. ------------------ From: Herbert Xu [IPSEC]: Fix crypto_alloc_comp error checking [ Upstream commit: 4999f3621f4da622e77931b3d33ada6c7083c705 ] 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. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/ipcomp.c | 3 ++- net/ipv6/ipcomp6.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -355,7 +356,7 @@ static struct crypto_comp **ipcomp_alloc 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; } --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -366,7 +367,7 @@ static struct crypto_comp **ipcomp6_allo 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; } -- - 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/