All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Cc: Mahesh Bandewar <maheshb@google.com>,
	Jiri Benc <jbenc@redhat.com>,
	Hannes Frederic Sowa <hannes@stressinduktion.org>
Subject: [PATCH 2/3] ipvlan: grab rcu_read_lock on xmit path
Date: Thu, 14 May 2015 16:56:19 +0300	[thread overview]
Message-ID: <20150514135619.14062.97774.stgit@buzz> (raw)
In-Reply-To: <20150514134657.14062.87579.stgit@buzz>

ipvlan_start_xmit() is called with rcu_read_lock_bh() while its internal
structures requre normal rcu_read_lock().

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>

---

[  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: [<ffffffff81880f72>] rawv6_sendmsg+0x512/0xbb0
[  802.945197]  #1:  (rcu_read_lock_bh){......}, at: [<ffffffff8185e577>] ip6_finish_output2+0x57/0x790
[  802.945205]  #2:  (rcu_read_lock_bh){......}, at: [<ffffffff8177a68b>] __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]  [<ffffffff819de6f8>] dump_stack+0x4c/0x65
[  802.945253]  [<ffffffff810a7f92>] lockdep_rcu_suspicious+0xe2/0x130
[  802.945265]  [<ffffffff815e24ac>] ipvlan_queue_xmit+0x17c/0x5a0
[  802.945268]  [<ffffffff810aa5a4>] ? __lock_is_held+0x54/0x70
[  802.945271]  [<ffffffff815e300c>] ipvlan_start_xmit+0x1c/0x50
[  802.945272]  [<ffffffff8177a117>] dev_hard_start_xmit+0x2f7/0x820
[  802.945274]  [<ffffffff817797b6>] ? netif_skb_features+0xf6/0x1d0
[  802.945276]  [<ffffffff81779b84>] ? validate_xmit_skb.isra.99.part.100+0x24/0x2c0
[  802.945278]  [<ffffffff8177ad04>] __dev_queue_xmit+0x6c4/0x930
[  802.945280]  [<ffffffff8177a68b>] ? __dev_queue_xmit+0x4b/0x930
[  802.945281]  [<ffffffff810a963a>] ? mark_held_locks+0x6a/0x90
[  802.945283]  [<ffffffff8177af8e>] dev_queue_xmit_sk+0xe/0x10
[  802.945285]  [<ffffffff8185e824>] ip6_finish_output2+0x304/0x790
[  802.945287]  [<ffffffff81860dde>] ? ip6_finish_output+0x9e/0x1e0
[  802.945288]  [<ffffffff81860dde>] ip6_finish_output+0x9e/0x1e0
[  802.945290]  [<ffffffff81860fdb>] ip6_output+0xbb/0x180
[  802.945302]  [<ffffffff818a7d0a>] ? ip6_find_1stfragopt+0x9a/0xa0
[  802.945304]  [<ffffffff81860d40>] ? ip6_fragment+0xe80/0xe80
[  802.945306]  [<ffffffff818a805c>] ip6_local_out_sk+0x2c/0x70
[  802.945308]  [<ffffffff818a80b0>] ip6_local_out+0x10/0x20
[  802.945309]  [<ffffffff81861571>] ip6_send_skb+0x31/0xd0
[  802.945311]  [<ffffffff81861644>] ip6_push_pending_frames+0x34/0x40
[  802.945313]  [<ffffffff81881368>] rawv6_sendmsg+0x908/0xbb0
[  802.945328]  [<ffffffff810aa5a4>] ? __lock_is_held+0x54/0x70
[  802.945340]  [<ffffffff81817e9e>] inet_sendmsg+0x10e/0x1f0
[  802.945343]  [<ffffffff81817d90>] ? inet_recvmsg+0x200/0x200
[  802.945351]  [<ffffffff81758275>] sock_sendmsg+0x45/0x50
[  802.945354]  [<ffffffff8175a719>] SYSC_sendto+0xd9/0x110
[  802.945357]  [<ffffffff8175ac99>] SyS_sendto+0x9/0x10
[  802.945362]  [<ffffffff819ebfae>] system_call_fastpath+0x12/0x76
---
 drivers/net/ipvlan/ipvlan_main.c |    4 ++++
 1 file changed, 4 insertions(+)

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;
 }
 

  parent reply	other threads:[~2015-05-14 13:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 13:56 [PATCH 0/3] ipvlan: fix ipv6 autoconfiguration via RA Konstantin Khlebnikov
2015-05-14 13:56 ` [PATCH 1/3] ipv6: make inet6addr_chain blocking and always call with rtnl locked Konstantin Khlebnikov
2015-05-16 21:22   ` David Miller
2015-05-18 10:13     ` Konstantin Khlebnikov
2015-05-14 13:56 ` Konstantin Khlebnikov [this message]
2015-05-19 23:33   ` [PATCH 2/3] ipvlan: grab rcu_read_lock on xmit path Mahesh Bandewar
2015-05-21  9:51     ` Konstantin Khlebnikov
2015-05-21 11:47       ` Hannes Frederic Sowa
2015-05-14 13:56 ` [PATCH 3/3] ipvlan: set dev_id for l2 ports to generate unique IPv6 addresses Konstantin Khlebnikov
2015-05-19 23:59   ` Mahesh Bandewar
2015-05-21 11:38     ` Konstantin Khlebnikov
2015-05-21 12:09       ` Hannes Frederic Sowa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150514135619.14062.97774.stgit@buzz \
    --to=khlebnikov@yandex-team.ru \
    --cc=davem@davemloft.net \
    --cc=hannes@stressinduktion.org \
    --cc=jbenc@redhat.com \
    --cc=maheshb@google.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.