sfp: fix sfp-bus oops when removing socket/upstream
authorRussell King <rmk+kernel@armlinux.org.uk>
Tue, 26 Dec 2017 23:15:17 +0000 (23:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Jan 2018 08:45:23 +0000 (09:45 +0100)
commit208c17515130e2d97ab81a52ca0afb1c40722f7b
treec88b20005538c6c5273da39e82102c37f0a110ea
parentce66902de86a310da28f4ea0a5da0c7bd7c6745b
sfp: fix sfp-bus oops when removing socket/upstream

[ Upstream commit 0b2122e4934c7783d336397864e34ee53aad0965 ]

When we remove a socket or upstream, and the other side isn't
registered, we dereference a NULL pointer, causing a kernel oops.
Fix this.

Fixes: ce0aa27ff3f6 ("sfp: add sfp-bus to bridge between network devices and sfp cages")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-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>
drivers/net/phy/sfp-bus.c