From: Matthias Kaehlcke Date: Tue, 25 Jul 2017 18:36:25 +0000 (-0700) Subject: netpoll: Fix device name check in netpoll_setup() X-Git-Tag: v4.9.161~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64696ba9577f7742358cd7be42da2a4eb4877244;p=thirdparty%2Fkernel%2Fstable.git netpoll: Fix device name check in netpoll_setup() commit 0c3a8f8b8fabff4f3ad2dd7b95ae0e90cdd1aebb upstream. 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 Signed-off-by: David S. Miller Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 457f882b0f7ba..9b2d61120c0d7 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -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); }