From patchwork Mon Jan 24 21:11:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 80248 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 0528EB70E9 for ; Tue, 25 Jan 2011 08:12:17 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752970Ab1AXVLp (ORCPT ); Mon, 24 Jan 2011 16:11:45 -0500 Received: from mail-ey0-f174.google.com ([209.85.215.174]:55586 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751878Ab1AXVLo (ORCPT ); Mon, 24 Jan 2011 16:11:44 -0500 Received: by eye27 with SMTP id 27so2175430eye.19 for ; Mon, 24 Jan 2011 13:11:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:from:to:cc:in-reply-to:references :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=BW75xq23FEJjzxgqCUcFXdcg8A8uYhvdbw//+g6W5QA=; b=rwY2aTvo/7btmDj+SmOY9Aj2JMj/TCvOGTSCzKgBP2velioE8y9XQ3uTCZsdaxg8n6 Wa1qsnwkWHop3rbpx+2Ml3JQIVV1JF/eMV9tFFAvuX/3mZo7LHY4zzT7/alh8h/ICK7M Up9VwS9n8tEh3mykw3rfd6YrI/V7ZZVSUd/fU= 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=L9RMvwAIiIEKG+xLQ+yo5QyuYpxMuctjp8+HgmX1WcMcpKteJnidjcI+hP8ZOpU4FS jL+UthpD6XBkPjP6ksTdWYiqKhuox86lFQywxkwPrgbSGbOgz6q/FRWTV3iWvZ7vrUCV rdRwjWX9xDvXfHc/KtNEw2OUejIirVXAgvcno= Received: by 10.216.186.144 with SMTP id w16mr4269606wem.13.1295903502766; Mon, 24 Jan 2011 13:11:42 -0800 (PST) Received: from [10.150.51.211] (gw0.net.jmsp.net [212.23.165.14]) by mx.google.com with ESMTPS id r6sm6804998weq.44.2011.01.24.13.11.40 (version=SSLv3 cipher=RC4-MD5); Mon, 24 Jan 2011 13:11:41 -0800 (PST) Subject: Re: 2.6.38-rc1: arp triggers RTNL assertion From: Eric Dumazet To: David Miller Cc: jamie@audible.transient.net, linux-kernel@vger.kernel.org, netdev@vger.kernel.org In-Reply-To: <20110121.130657.106806953.davem@davemloft.net> References: <20110121061758.GA2247@fifty-fifty.audible.transient.net> <1295593946.2613.52.camel@edumazet-laptop> <1295635976.2609.23.camel@edumazet-laptop> <20110121.130657.106806953.davem@davemloft.net> Date: Mon, 24 Jan 2011 22:11:38 +0100 Message-ID: <1295903498.2924.17.camel@edumazet-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Le vendredi 21 janvier 2011 à 13:06 -0800, David Miller a écrit : > From: Eric Dumazet > Date: Fri, 21 Jan 2011 19:52:56 +0100 > > > Here is how I fixed this, thanks again Jamie ! > > > > [PATCH] net: neighbour: pneigh_lookup() doesnt need RTNL > > Eric, I don't think we can do this. > > Fundamentally, any time a user operation changes the configuration > of the networking, we must hold the RTNL. > > Eliding the RTNL for lookups is fine, but for things that change > state it is not. > > I therefore think you'll need to rework the arp_ioctl() portions > of the commit that introduced this regression. > Here is a second try of the fix, thanks ! Note : Tested with CONFIG_PROVE_RCU=y [PATCH] net: arp_ioctl() must hold RTNL Commit 941666c2e3e0 "net: RCU conversion of dev_getbyhwaddr() and arp_ioctl()" introduced a regression, reported by Jamie Heilman. "arp -Ds 192.168.2.41 eth0 pub" triggered the ASSERT_RTNL() assert in pneigh_lookup() Removing RTNL requirement from arp_ioctl() was a mistake, just revert that part. Reported-by: Jamie Heilman Signed-off-by: Eric Dumazet --- net/core/dev.c | 3 ++- net/ipv4/arp.c | 11 +++++------ 2 files changed, 7 insertions(+), 7 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 7c6a46f..24ea2d7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -749,7 +749,8 @@ EXPORT_SYMBOL(dev_get_by_index); * @ha: hardware address * * Search for an interface by MAC address. Returns NULL if the device - * is not found or a pointer to the device. The caller must hold RCU + * is not found or a pointer to the device. + * The caller must hold RCU or RTNL. * The returned device has not had its ref count increased * and the caller must therefore be careful about locking * diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 04c8b69..7927589 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -1017,14 +1017,13 @@ static int arp_req_set_proxy(struct net *net, struct net_device *dev, int on) IPV4_DEVCONF_ALL(net, PROXY_ARP) = on; return 0; } - if (__in_dev_get_rcu(dev)) { - IN_DEV_CONF_SET(__in_dev_get_rcu(dev), PROXY_ARP, on); + if (__in_dev_get_rtnl(dev)) { + IN_DEV_CONF_SET(__in_dev_get_rtnl(dev), PROXY_ARP, on); return 0; } return -ENXIO; } -/* must be called with rcu_read_lock() */ static int arp_req_set_public(struct net *net, struct arpreq *r, struct net_device *dev) { @@ -1233,10 +1232,10 @@ int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg) if (!(r.arp_flags & ATF_NETMASK)) ((struct sockaddr_in *)&r.arp_netmask)->sin_addr.s_addr = htonl(0xFFFFFFFFUL); - rcu_read_lock(); + rtnl_lock(); if (r.arp_dev[0]) { err = -ENODEV; - dev = dev_get_by_name_rcu(net, r.arp_dev); + dev = __dev_get_by_name(net, r.arp_dev); if (dev == NULL) goto out; @@ -1263,7 +1262,7 @@ int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg) break; } out: - rcu_read_unlock(); + rtnl_unlock(); if (cmd == SIOCGARP && !err && copy_to_user(arg, &r, sizeof(r))) err = -EFAULT; return err;