提交 ff879eb6 编写于 作者: S stephen hemminger 提交者: David S. Miller

CAN: use dev_get_by_index_rcu

Use new function to avoid doing read_lock().
Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NOliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 61fbab77
...@@ -139,13 +139,13 @@ static char *bcm_proc_getifname(char *result, int ifindex) ...@@ -139,13 +139,13 @@ static char *bcm_proc_getifname(char *result, int ifindex)
if (!ifindex) if (!ifindex)
return "any"; return "any";
read_lock(&dev_base_lock); rcu_read_lock();
dev = __dev_get_by_index(&init_net, ifindex); dev = dev_get_by_index_rcu(&init_net, ifindex);
if (dev) if (dev)
strcpy(result, dev->name); strcpy(result, dev->name);
else else
strcpy(result, "???"); strcpy(result, "???");
read_unlock(&dev_base_lock); rcu_read_unlock();
return result; return result;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册