]> git.baikalelectronics.ru Git - kernel.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)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 Feb 2017 19:50:51 +0000 (14:50 -0500)
commitb8798e20255b4e5c34b4f16f04702cb7cb2feefc
tree0799402b4792dada8d205c23346dbdeddc571bd5
parente62f4d2840b4cada23c7b3a2d76164b95b4a8395
net: dsa: Do not destroy invalid network devices

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: da65645b5ea7 ("net: dsa: Add new binding implementation")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa2.c