]> git.baikalelectronics.ru Git - kernel.git/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)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 May 2016 17:58:49 +0000 (13:58 -0400)
commit50eb4d4f4c58d8321ce7391ada7040877bda3d00
tree0971053bdbdb27fe6d0f9e801411ae94f0a8974d
parentf8bbb3b85ea857d8b41108c19e9e786068fef1d9
switchdev: pass pointer to fib_info instead of copy

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: 1ef8df8469 ("switchdev: remove pointers from switchdev objects")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/rocker/rocker_ofdpa.c
include/net/switchdev.h
net/switchdev/switchdev.c