]> git.karo-electronics.de Git - linux-beck.git/commit
net: dsa: Do not destroy invalid network devices
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 8 Feb 2017 07:10:13 +0000 (23:10 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Feb 2017 14:11:43 +0000 (15:11 +0100)
commit12758a282435c0ab4878ef163e82420a8e250b73
tree0cb841e6278714a33dc8a150a0ece389255d0009
parenta700cf26a3be881e32573cb0e6373278fac2348a
net: dsa: Do not destroy invalid network devices

[ Upstream commit 382e1eea2d983cd2343482c6a638f497bb44a636 ]

dsa_slave_create() can fail, and dsa_user_port_unapply() will properly check
for the network device not being NULL before attempting to destroy it. We were
not setting the slave network device as NULL if dsa_slave_create() failed, so
we would later on be calling dsa_slave_destroy() on a now free'd and
unitialized network device, causing crashes in dsa_slave_destroy().

Fixes: 83c0afaec7b7 ("net: dsa: Add new binding implementation")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/dsa/dsa2.c