]> git.itanic.dy.fi Git - linux-stable/commit
switchdev: pass pointer to fib_info instead of copy
authorJiri Pirko <jiri@mellanox.com>
Tue, 17 May 2016 16:58:08 +0000 (18:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Jun 2016 17:21:59 +0000 (10:21 -0700)
commit2e1d00bfc3718256f9a97057c7b0dd72036e5c34
tree41f9c93b88e48565264abd56a4522b4d49d22cad
parent988ae90abb5cb61c286c6f63a1d3b8a6955e4fd8
switchdev: pass pointer to fib_info instead of copy

[ Upstream commit da4ed55165d41b1073f9a476f1c18493e9bf8c8e ]

The problem is that fib_info->nh is [0] so the struct fib_info
allocation size depends on number of nexthops. If we just copy fib_info,
we do not copy the nexthops info and driver accesses memory which is not
ours.

Given the fact that fib4 does not defer operations and therefore it does
not need copy, just pass the pointer down to drivers as it was done
before.

Fixes: 850d0cbc91 ("switchdev: remove pointers from switchdev objects")
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_ofdpa.c
include/net/switchdev.h
net/switchdev/switchdev.c