From patchwork Thu May 14 13:56:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 472352 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 A7A6D1400B7 for ; Thu, 14 May 2015 23:56:28 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru header.b=RuBWXP56; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933494AbbENN4Z (ORCPT ); Thu, 14 May 2015 09:56:25 -0400 Received: from forward-corp1g.mail.yandex.net ([95.108.253.251]:44673 "EHLO forward-corp1g.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933247AbbENN4X (ORCPT ); Thu, 14 May 2015 09:56:23 -0400 Received: from smtpcorp1m.mail.yandex.net (smtpcorp1m.mail.yandex.net [77.88.61.150]) by forward-corp1g.mail.yandex.net (Yandex) with ESMTP id D390C3660214; Thu, 14 May 2015 16:56:19 +0300 (MSK) Received: from smtpcorp1m.mail.yandex.net (localhost [127.0.0.1]) by smtpcorp1m.mail.yandex.net (Yandex) with ESMTP id B1FBE2CA04C2; Thu, 14 May 2015 16:56:19 +0300 (MSK) Received: from unknown (unknown [2a02:6b8:0:408:2979:8b83:fd17:6b18]) by smtpcorp1m.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id UXymHAwSma-uJci0XhC; Thu, 14 May 2015 16:56:19 +0300 (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1431611779; bh=QPHFPBLrabEluF1wU1LATVvldmjXJL5z96gISJfguVY=; h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References: User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding; b=RuBWXP56mAx/an0WxjMKQvCMjzzQMEEERftqx4w5tIc7KXgk6bJwjz0mU6F0uisDm 4SD85++OWNz411p8p0s9R45Dy6v7W2HFsmEUGZ1HlgUfa0yfY5dxxx8mwQpQ0AjO++ MeqQicsF2R7aHOuD0QXuVJcJns1tH9MpCCfTGyDk= Authentication-Results: smtpcorp1m.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Subject: [PATCH 2/3] ipvlan: grab rcu_read_lock on xmit path From: Konstantin Khlebnikov To: netdev@vger.kernel.org, "David S. Miller" Cc: Mahesh Bandewar , Jiri Benc , Hannes Frederic Sowa Date: Thu, 14 May 2015 16:56:19 +0300 Message-ID: <20150514135619.14062.97774.stgit@buzz> In-Reply-To: <20150514134657.14062.87579.stgit@buzz> References: <20150514134657.14062.87579.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ipvlan_start_xmit() is called with rcu_read_lock_bh() while its internal structures requre normal rcu_read_lock(). Signed-off-by: Konstantin Khlebnikov --- [ 802.945151] =============================== [ 802.945160] [ INFO: suspicious RCU usage. ] [ 802.945164] 4.1.0-rc3+ #71 Not tainted [ 802.945165] ------------------------------- [ 802.945167] drivers/net/ipvlan/ipvlan.h:103 suspicious rcu_dereference_check() usage! [ 802.945168] [ 802.945168] other info that might help us debug this: [ 802.945168] [ 802.945170] [ 802.945170] rcu_scheduler_active = 1, debug_locks = 1 [ 802.945173] 3 locks held by ping6/3813: [ 802.945174] #0: (sk_lock-AF_INET6){+.+.+.}, at: [] rawv6_sendmsg+0x512/0xbb0 [ 802.945197] #1: (rcu_read_lock_bh){......}, at: [] ip6_finish_output2+0x57/0x790 [ 802.945205] #2: (rcu_read_lock_bh){......}, at: [] __dev_queue_xmit+0x4b/0x930 [ 802.945218] [ 802.945218] stack backtrace: [ 802.945221] CPU: 2 PID: 3813 Comm: ping6 Not tainted 4.1.0-rc3+ #71 [ 802.945222] Hardware name: OpenStack Foundation OpenStack Nova, BIOS Bochs 01/01/2011 [ 802.945224] 0000000000000001 ffff8800db7b7888 ffffffff819de6f8 0000000000000007 [ 802.945226] ffff8800db738000 ffff8800db7b78b8 ffffffff810a7f92 ffff880214fc8c00 [ 802.945229] ffff88021595b000 ffff88021595a000 ffff880214adf800 ffff8800db7b7968 [ 802.945232] Call Trace: [ 802.945248] [] dump_stack+0x4c/0x65 [ 802.945253] [] lockdep_rcu_suspicious+0xe2/0x130 [ 802.945265] [] ipvlan_queue_xmit+0x17c/0x5a0 [ 802.945268] [] ? __lock_is_held+0x54/0x70 [ 802.945271] [] ipvlan_start_xmit+0x1c/0x50 [ 802.945272] [] dev_hard_start_xmit+0x2f7/0x820 [ 802.945274] [] ? netif_skb_features+0xf6/0x1d0 [ 802.945276] [] ? validate_xmit_skb.isra.99.part.100+0x24/0x2c0 [ 802.945278] [] __dev_queue_xmit+0x6c4/0x930 [ 802.945280] [] ? __dev_queue_xmit+0x4b/0x930 [ 802.945281] [] ? mark_held_locks+0x6a/0x90 [ 802.945283] [] dev_queue_xmit_sk+0xe/0x10 [ 802.945285] [] ip6_finish_output2+0x304/0x790 [ 802.945287] [] ? ip6_finish_output+0x9e/0x1e0 [ 802.945288] [] ip6_finish_output+0x9e/0x1e0 [ 802.945290] [] ip6_output+0xbb/0x180 [ 802.945302] [] ? ip6_find_1stfragopt+0x9a/0xa0 [ 802.945304] [] ? ip6_fragment+0xe80/0xe80 [ 802.945306] [] ip6_local_out_sk+0x2c/0x70 [ 802.945308] [] ip6_local_out+0x10/0x20 [ 802.945309] [] ip6_send_skb+0x31/0xd0 [ 802.945311] [] ip6_push_pending_frames+0x34/0x40 [ 802.945313] [] rawv6_sendmsg+0x908/0xbb0 [ 802.945328] [] ? __lock_is_held+0x54/0x70 [ 802.945340] [] inet_sendmsg+0x10e/0x1f0 [ 802.945343] [] ? inet_recvmsg+0x200/0x200 [ 802.945351] [] sock_sendmsg+0x45/0x50 [ 802.945354] [] SYSC_sendto+0xd9/0x110 [ 802.945357] [] SyS_sendto+0x9/0x10 [ 802.945362] [] system_call_fastpath+0x12/0x76 --- drivers/net/ipvlan/ipvlan_main.c | 4 ++++ 1 file changed, 4 insertions(+) -- 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/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 77b92a0fe557..0cafd3e6f02d 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -173,6 +173,7 @@ static int ipvlan_stop(struct net_device *dev) return 0; } +/* called with rcu_read_lock_bh. */ static netdev_tx_t ipvlan_start_xmit(struct sk_buff *skb, struct net_device *dev) { @@ -180,6 +181,7 @@ static netdev_tx_t ipvlan_start_xmit(struct sk_buff *skb, int skblen = skb->len; int ret; + rcu_read_lock(); ret = ipvlan_queue_xmit(skb, dev); if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) { struct ipvl_pcpu_stats *pcptr; @@ -193,6 +195,8 @@ static netdev_tx_t ipvlan_start_xmit(struct sk_buff *skb, } else { this_cpu_inc(ipvlan->pcpu_stats->tx_drps); } + rcu_read_unlock(); + return ret; }