mlxsw: spectrum_router: Fix NULL pointer deref
authorIdo Schimmel <idosch@mellanox.com>
Mon, 25 Dec 2017 07:57:35 +0000 (08:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Jan 2018 08:45:22 +0000 (09:45 +0100)
commit3ef57b767e1b70ca594d5c6f7de687326cedcc7f
tree5f9c856def727bf5e54344a5e674276f336ad149
parentd7e3ea5326cb668f457624476d6dc924c6585658
mlxsw: spectrum_router: Fix NULL pointer deref

[ Upstream commit 8764a8267b128405cf383157d5e9a4a3735d2409 ]

When we remove the neighbour associated with a nexthop we should always
refuse to write the nexthop to the adjacency table. Regardless if it is
already present in the table or not.

Otherwise, we risk dereferencing the NULL pointer that was set instead
of the neighbour.

Fixes: a7ff87acd995 ("mlxsw: spectrum_router: Implement next-hop routing")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Alexander Petrovskiy <alexpe@mellanox.com>
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/mellanox/mlxsw/spectrum_router.c