Commit 0c3a8f8b authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by David S. Miller

netpoll: Fix device name check in netpoll_setup()

Apparently netpoll_setup() assumes that netpoll.dev_name is a pointer
when checking if the device name is set:

if (np->dev_name) {
  ...

However the field is a character array, therefore the condition always
yields true. Check instead whether the first byte of the array has a
non-zero value.
Signed-off-by: default avatarMatthias Kaehlcke <mka@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d94708a5
...@@ -666,7 +666,7 @@ int netpoll_setup(struct netpoll *np) ...@@ -666,7 +666,7 @@ int netpoll_setup(struct netpoll *np)
int err; int err;
rtnl_lock(); rtnl_lock();
if (np->dev_name) { if (np->dev_name[0]) {
struct net *net = current->nsproxy->net_ns; struct net *net = current->nsproxy->net_ns;
ndev = __dev_get_by_name(net, np->dev_name); ndev = __dev_get_by_name(net, np->dev_name);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment