lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 16 Aug 2018 21:01:27 +0800
From:   Wang Jian <jianjian.wang1@...il.com>
To:     "David S . Miller" <davem@...emloft.net>,
        Jason <jasowang@...hat.com>, girish.moodalbail@...cle.com,
        mst@...hat.com, Willem de Bruijn <willemb@...gle.com>,
        viro@...iv.linux.org.uk, wexu@...hat.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] tap: comment fix

The tap_queue and the "tap_dev" are loosely coupled, not "macvlan_dev".

And I also change one rcu_read_lock's place, seems can reduce rcu
critical section a little.

Signed-off-by: Wang Jian <jianjian.wang1@...il.com>
---
 drivers/net/tap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index f0f7cd9..e5e5a8e 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -125,7 +125,7 @@ static struct tap_dev *tap_dev_get_rcu(const
struct net_device *dev)

 /*
  * RCU usage:
- * The tap_queue and the macvlan_dev are loosely coupled, the
+ * The tap_queue and the tap_dev are loosely coupled, the
  * pointers from one to the other can only be read while rcu_read_lock
  * or rtnl is held.
  *
@@ -720,8 +720,6 @@ static ssize_t tap_get_user(struct tap_queue *q,
struct msghdr *m,
            __vlan_get_protocol(skb, skb->protocol, &depth) != 0)
                skb_set_network_header(skb, depth);

-       rcu_read_lock();
-       tap = rcu_dereference(q->tap);
        /* copy skb_ubuf_info for callback when skb has no error */
        if (zerocopy) {
                skb_shinfo(skb)->destructor_arg = m->msg_control;
@@ -732,6 +730,8 @@ static ssize_t tap_get_user(struct tap_queue *q,
struct msghdr *m,
                uarg->callback(uarg, false);
        }

+       rcu_read_lock();
+       tap = rcu_dereference(q->tap);
        if (tap) {
                skb->dev = tap->dev;
                dev_queue_xmit(skb);

-- 
Regards,
Wang Jian

Powered by blists - more mailing lists