From patchwork Thu Mar 25 19:47:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 48587 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B505FB7CF6 for ; Fri, 26 Mar 2010 06:47:42 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754447Ab0CYTr3 (ORCPT ); Thu, 25 Mar 2010 15:47:29 -0400 Received: from mail-bw0-f209.google.com ([209.85.218.209]:39200 "EHLO mail-bw0-f209.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754356Ab0CYTr2 (ORCPT ); Thu, 25 Mar 2010 15:47:28 -0400 Received: by bwz1 with SMTP id 1so1213070bwz.21 for ; Thu, 25 Mar 2010 12:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=Ujb/I9MNqg3X9qkod15WcTTyVEfBJcQh/a6DDm9NShc=; b=TpXulmm7R8YX1i63lmbpkt3MB1wE13pRd2RV2g1eKFVEYp8g9NAcEYmO0tTiM95RAF QH0trw/DBvVFYPv5vnbyR0kzrgr09bZ+C233a5B4PVGK+SiE7bMA+lmM+bfyf82Reze/ VSvVlRXkPCpwx82pR8VVrXR0gkL5Kcj0sjWcI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=U3R8tBlu1ittqSG/zPuJDX2nCinjg9h0QAwFYZz0YFOIGXXO02glNMrS5dkUQzSS/D me8AfhSfXdUyVfqp31y+MCydSQyM007YJLpjZmAJkvTHBauH8Jcvjk08GFstUnCOmMVa +gguY1X4lP+demWL9b3sxoh1Asp6pfyqNPIgU= Received: by 10.204.138.147 with SMTP id a19mr164569bku.68.1269546446332; Thu, 25 Mar 2010 12:47:26 -0700 (PDT) Received: from [127.0.0.1] (gw1.cosmosbay.com [212.99.114.194]) by mx.google.com with ESMTPS id 14sm94645bwz.2.2010.03.25.12.47.23 (version=SSLv3 cipher=RC4-MD5); Thu, 25 Mar 2010 12:47:24 -0700 (PDT) Subject: [PATCH] netfilter: CLUSTERIP: clusterip_seq_stop() fix From: Eric Dumazet To: Patrick McHardy Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org, David Miller In-Reply-To: <1269539686-3885-3-git-send-email-kaber@trash.net> References: <1269539686-3885-1-git-send-email-kaber@trash.net> <1269539686-3885-2-git-send-email-kaber@trash.net> <1269539686-3885-3-git-send-email-kaber@trash.net> Date: Thu, 25 Mar 2010 20:47:22 +0100 Message-ID: <1269546442.2894.5.camel@edumazet-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If clusterip_seq_start() memory allocation fails, we crash later in clusterip_seq_start(), trying to kfree(ERR_PTR(-ENOMEM)) Signed-off-by: Eric Dumazet --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 0886f96..afa937b 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c @@ -600,7 +600,8 @@ static void *clusterip_seq_next(struct seq_file *s, void *v, loff_t *pos) static void clusterip_seq_stop(struct seq_file *s, void *v) { - kfree(v); + if (!IS_ERR(v)) + kfree(v); } static int clusterip_seq_show(struct seq_file *s, void *v)