]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
netpoll: Fix device name check in netpoll_setup()
authorMatthias Kaehlcke <mka@chromium.org>
Tue, 25 Jul 2017 18:36:25 +0000 (11:36 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Jul 2017 00:01:43 +0000 (17:01 -0700)
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: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/netpoll.c

index 8357f164c66092b9c99996782d29de246c54dbd6..912731bed7b71b9208f3947b49c4b93922f7ab0d 100644 (file)
@@ -666,7 +666,7 @@ int netpoll_setup(struct netpoll *np)
        int err;
 
        rtnl_lock();
-       if (np->dev_name) {
+       if (np->dev_name[0]) {
                struct net *net = current->nsproxy->net_ns;
                ndev = __dev_get_by_name(net, np->dev_name);
        }