From patchwork Fri Sep 18 00:57:29 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirsher, Jeffrey T" X-Patchwork-Id: 33813 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.176.167]) by ozlabs.org (Postfix) with ESMTP id 04621B7B6F for ; Fri, 18 Sep 2009 10:57:57 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754648AbZIRA5r (ORCPT ); Thu, 17 Sep 2009 20:57:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754527AbZIRA5q (ORCPT ); Thu, 17 Sep 2009 20:57:46 -0400 Received: from qmta10.westchester.pa.mail.comcast.net ([76.96.62.17]:37994 "EHLO QMTA10.westchester.pa.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754274AbZIRA5q (ORCPT ); Thu, 17 Sep 2009 20:57:46 -0400 Received: from OMTA17.westchester.pa.mail.comcast.net ([76.96.62.89]) by QMTA10.westchester.pa.mail.comcast.net with comcast id i0bg1c0041vXlb85A0xqow; Fri, 18 Sep 2009 00:57:50 +0000 Received: from localhost.localdomain ([63.64.152.142]) by OMTA17.westchester.pa.mail.comcast.net with comcast id i1331c00534bfcX3d135CC; Fri, 18 Sep 2009 01:03:20 +0000 From: Jeff Kirsher Subject: [net-2.6 PATCH 2/6] net: remove kfree_skb on a NULL pointer in af_netlink.c To: davem@davemloft.net Cc: netdev@vger.kernel.org, gospo@redhat.com, linux-scsi@vger.kernel.org, John Fastabend , Jeff Kirsher Date: Thu, 17 Sep 2009 17:57:29 -0700 Message-ID: <20090918005729.25594.14261.stgit@localhost.localdomain> In-Reply-To: <20090918005708.25594.52575.stgit@localhost.localdomain> References: <20090918005708.25594.52575.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: John Fastabend This removes a kfree_skb that is being called on a NULL pointer when do_one_broadcast() is sucessful. And moves the kfree_skb into do_one_broadcast() for the error case. Signed-off-by: John Fastabend Signed-off-by: Jeff Kirsher --- net/netlink/af_netlink.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) -- 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/netlink/af_netlink.c b/net/netlink/af_netlink.c index 4e673d2..9934847 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -1021,6 +1021,8 @@ static inline int do_one_broadcast(struct sock *sk, netlink_overrun(sk); if (nlk->flags & NETLINK_BROADCAST_SEND_ERROR) p->delivery_failure = 1; + kfree_skb(p->skb2); + p->skb2 = NULL; } else { p->congested |= val; p->delivered = 1; @@ -1065,8 +1067,6 @@ int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid, netlink_unlock_table(); - kfree_skb(info.skb2); - if (info.delivery_failure) return -ENOBUFS;