From patchwork Sun Oct 9 15:19:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: danborkmann@iogearbox.net X-Patchwork-Id: 118599 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 3CBB3B6F8E for ; Mon, 10 Oct 2011 02:52:46 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751726Ab1JIPwm (ORCPT ); Sun, 9 Oct 2011 11:52:42 -0400 Received: from www62.your-server.de ([213.133.104.62]:36186 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750853Ab1JIPwl (ORCPT ); Sun, 9 Oct 2011 11:52:41 -0400 X-Greylist: delayed 1826 seconds by postgrey-1.27 at vger.kernel.org; Sun, 09 Oct 2011 11:52:41 EDT Received: from [78.46.5.208] (helo=webmail01.your-server.de) by www62.your-server.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1RCvCf-00076U-IO; Sun, 09 Oct 2011 17:22:13 +0200 Received: from pc-10089.ethz.ch (pc-10089.ethz.ch [82.130.102.59]) by webmail.your-server.de (Horde Framework) with HTTP; Sun, 09 Oct 2011 17:19:19 +0200 Message-ID: <20111009171919.10922hrx8qjm2f7b@webmail.your-server.de> Date: Sun, 09 Oct 2011 17:19:19 +0200 From: danborkmann@iogearbox.net To: "David S. Miller" , netdev@vger.kernel.org Subject: [PATCH] af_packet: tpacket_destruct_skb, deref skb after BUG_ON assertion MIME-Version: 1.0 Content-Disposition: inline User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.6) X-Authenticated-Sender: danborkmann@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.97.2/13774/Sun Oct 9 16:23:46 2011) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This tiny patch derefs the skb only after BUG_ON(skb==NULL) was evaluated and not before. Patched against latest Linus tree. Thanks, Daniel Signed-off-by: Daniel Borkmann --- 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/packet/af_packet.c b/net/packet/af_packet.c index fabb4fa..d9d833b 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -1167,11 +1167,12 @@ ring_is_full: static void tpacket_destruct_skb(struct sk_buff *skb) { - struct packet_sock *po = pkt_sk(skb->sk); + struct packet_sock *po; void *ph; BUG_ON(skb == NULL); + po = pkt_sk(skb->sk); if (likely(po->tx_ring.pg_vec)) { ph = skb_shinfo(skb)->destructor_arg; BUG_ON(__packet_get_status(po, ph) != TP_STATUS_SENDING);