From patchwork Fri Dec 19 07:04:31 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarek Poplawski X-Patchwork-Id: 14809 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 C8CE3DDEFC for ; Fri, 19 Dec 2008 18:04:43 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752678AbYLSHEj (ORCPT ); Fri, 19 Dec 2008 02:04:39 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752639AbYLSHEj (ORCPT ); Fri, 19 Dec 2008 02:04:39 -0500 Received: from ik-out-1112.google.com ([66.249.90.177]:55720 "EHLO ik-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752615AbYLSHEi (ORCPT ); Fri, 19 Dec 2008 02:04:38 -0500 Received: by ik-out-1112.google.com with SMTP id c29so180483ika.5 for ; Thu, 18 Dec 2008 23:04:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=EB4ziKjMT56L9M5FzyqMbKn/qVPFuVSTK2/s7170L6M=; b=tFo+r6XwS650DVrXHpdRvjW49JteP3Q8iKig9d4WzxR/YLJbskTPGNRPBRGpvBCF3g wSCiJO9Wb8oWAm7uD1o3r7ol8lgbBvcgpKVUC+Ta6+F/1MshKOg6ngpuJtIyPIoZJMjU zW7VteHrQePH/yk0YNdWZF4Ks8UhoXhRvO/hA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=sFnz2FjPc5IddDSsuXKLprA8/Hr1vRV0GjII93dVUQLLbYD9RkTtvCWqD6keXBjE33 KKlOa+MWL2HJ7AT1qQafg6axTEkqrJpifBDhFghqyC8z5fk3IxguQQYmeUmawnulO/Ap BJuljZiqSMJ+82tg1yxX2ztahIMF7Eur64Hng= Received: by 10.210.127.10 with SMTP id z10mr3371385ebc.72.1229670275859; Thu, 18 Dec 2008 23:04:35 -0800 (PST) Received: from ff.dom.local (bv170.internetdsl.tpnet.pl [80.53.205.170]) by mx.google.com with ESMTPS id 7sm434851eyg.32.2008.12.18.23.04.34 (version=SSLv3 cipher=RC4-MD5); Thu, 18 Dec 2008 23:04:35 -0800 (PST) Date: Fri, 19 Dec 2008 07:04:31 +0000 From: Jarek Poplawski To: David Miller Cc: netdev@vger.kernel.org Subject: [PATCH] net: Fix oops in dev_ifsioc() Message-ID: <20081219070431.GA7189@ff.dom.local> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org A command like this: "brctl addif br1 eth1" issued as a user gave me an oops when bridge module wasn't loaded. It's caused by using a dev pointer before checking for NULL. Signed-off-by: Jarek Poplawski --- net/core/dev.c | 4 +++- 1 files changed, 3 insertions(+), 1 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/core/dev.c b/net/core/dev.c index 048cf11..daca72e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3745,11 +3745,13 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd) { int err; struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name); - const struct net_device_ops *ops = dev->netdev_ops; + const struct net_device_ops *ops; if (!dev) return -ENODEV; + ops = dev->netdev_ops; + switch (cmd) { case SIOCSIFFLAGS: /* Set interface flags */ return dev_change_flags(dev, ifr->ifr_flags);