diff options
author | Dima Chumak <dchumak@nvidia.com> | 2021-04-26 15:16:26 +0300 |
---|---|---|
committer | Saeed Mahameed <saeedm@nvidia.com> | 2021-05-18 23:01:31 -0700 |
commit | fe7738eb3ca3631a75844e790f6cb576c0fe7b00 (patch) | |
tree | 6691b2141258b2b3d054baa5b37f5609e6b661da /drivers/mfd/ab8500-debugfs.c | |
parent | 82041634d96e87b41c600a673f10150d9f21f742 (diff) |
net/mlx5e: Fix nullptr in mlx5e_tc_add_fdb_flow()
The result of __dev_get_by_index() is not checked for NULL, which then
passed to mlx5e_attach_encap() and gets dereferenced.
Also, in case of a successful lookup, the net_device reference count is
not incremented, which may result in net_device pointer becoming invalid
at any time during mlx5e_attach_encap() execution.
Fix by using dev_get_by_index(), which does proper reference counting on
the net_device pointer. Also, handle nullptr return value when mirred
device is not found.
It's safe to call dev_put() on the mirred net_device pointer, right
after mlx5e_attach_encap() call, because it's not being saved/copied
down the call chain.
Fixes: 3c37745ec614 ("net/mlx5e: Properly deal with encap flows add/del under neigh update")
Addresses-Coverity: ("Dereference null return value")
Signed-off-by: Dima Chumak <dchumak@nvidia.com>
Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Diffstat (limited to 'drivers/mfd/ab8500-debugfs.c')
0 files changed, 0 insertions, 0 deletions