OSDN Git Service

rocker: fix possible null pointer dereference in rocker_router_fib_event_work
authorJiri Pirko <jiri@mellanox.com>
Thu, 1 Feb 2018 11:21:15 +0000 (12:21 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Feb 2018 09:19:48 +0000 (10:19 +0100)
commit1da27118f419208acd895fc95713dcd9ef25a289
tree4bcb4c1541a8f5319f920410a93ecb75e2cc017b
parent07ca93e3176bfdc5e954b79c0dcee0fb95aef6fb
rocker: fix possible null pointer dereference in rocker_router_fib_event_work

[ Upstream commit a83165f00f16c0e0ef5b7cec3cbd0d4788699265 ]

Currently, rocker user may experience following null pointer
derefence bug:

[    3.062141] BUG: unable to handle kernel NULL pointer dereference at 00000000000000d0
[    3.065163] IP: rocker_router_fib_event_work+0x36/0x110 [rocker]

The problem is uninitialized rocker->wops pointer that is initialized
only with the first initialized port. So move the port initialization
before registering the fib events.

Fixes: 936bd486564a ("rocker: use FIB notifications instead of switchdev calls")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/rocker/rocker_main.c