From patchwork Thu Jan 10 18:32:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 211110 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 0601D2C00A5 for ; Fri, 11 Jan 2013 05:32:58 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755334Ab3AJScv (ORCPT ); Thu, 10 Jan 2013 13:32:51 -0500 Received: from mail-pa0-f48.google.com ([209.85.220.48]:54127 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755194Ab3AJSct (ORCPT ); Thu, 10 Jan 2013 13:32:49 -0500 Received: by mail-pa0-f48.google.com with SMTP id fa1so512539pad.35 for ; Thu, 10 Jan 2013 10:32:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:subject:from:to:cc:in-reply-to:references:content-type :date:message-id:mime-version:x-mailer:content-transfer-encoding; bh=oFoajBHaJ7CIwIIwSYpTkEjiP3IJyPCYkhsshDypaGs=; b=h+Lk1fic9RmvMxooZYt+9TlHBj+XskYb0grRmO/fSUWK4vq8P4Ve+wXmR92zpEAWLC G7KdhVPV5bgEp7xkiBUxuYNJDy/EwI6ATi9jJqgdTIx11LMQAZ0cxrcQaNOyoTMCoE/M kVc5jqXdf5mlxTLgWqv8dRhkh678ejo5PTPL0/6LCyRd5ZoAGteFE8FYWmlnl0Vs2E+5 iefX8gR/7inIczL/bquWdgmO02Um76o8DMz0kLLvq6wuwN4yHO+Yr7V1MyHEC1qw0Krg WXkatvVtB4FR6aaTr9bocrrmZ21mMox2P31yGhNFbc4ECqxM3gfXIi5NbZH58YCNfXRE BZFA== X-Received: by 10.68.253.1 with SMTP id zw1mr66572512pbc.98.1357842768840; Thu, 10 Jan 2013 10:32:48 -0800 (PST) Received: from ?IPv6:2620:0:1000:3304:224:d7ff:fee3:2a94? ([2620:0:1000:3304:224:d7ff:fee3:2a94]) by mx.google.com with ESMTPS id i5sm1463356pax.13.2013.01.10.10.32.46 (version=SSLv3 cipher=RC4-SHA bits=128/128); Thu, 10 Jan 2013 10:32:47 -0800 (PST) Subject: Re: BUG: NULL pointer dereference in netif_carrier_off From: Eric Dumazet To: Tom Parkin , David Miller Cc: netdev@vger.kernel.org In-Reply-To: <1357840590.27446.2331.camel@edumazet-glaptop> References: <1357840590.27446.2331.camel@edumazet-glaptop> Date: Thu, 10 Jan 2013 10:32:45 -0800 Message-ID: <1357842765.27446.2396.camel@edumazet-glaptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet On Thu, 2013-01-10 at 09:56 -0800, Eric Dumazet wrote: > > Hi Tom, thanks for the report, I'll take a look. Oh well, fix seems straightforward... Thanks ! [PATCH net-next] veth: fix a NULL deref in netif_carrier_off In commit d0e2c55e7c94 (veth: avoid a NULL deref in veth_stats_one) we now clear the peer pointers in veth_dellink() veth_close() must therefore make sure the peer pointer is set. Reported-by: Tom Parkin Signed-off-by: Eric Dumazet --- drivers/net/veth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 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/drivers/net/veth.c b/drivers/net/veth.c index 0f71a4f..e1da42a 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -206,9 +206,11 @@ static int veth_open(struct net_device *dev) static int veth_close(struct net_device *dev) { struct veth_priv *priv = netdev_priv(dev); + struct net_device *peer = rtnl_dereference(priv->peer); netif_carrier_off(dev); - netif_carrier_off(rtnl_dereference(priv->peer)); + if (peer) + netif_carrier_off(peer); return 0; }