linux-brain/drivers/net/ethernet/mellanox/mlx5/core
Dima Chumak 408614108a net/mlx5e: Fix nullptr in mlx5e_hairpin_get_mdev()
[ Upstream commit b1c2f6312c5005c928a72e668bf305a589d828d4 ]

The result of __dev_get_by_index() is not checked for NULL and then gets
dereferenced immediately.

Also, __dev_get_by_index() must be called while holding either RTNL lock
or @dev_base_lock, which isn't satisfied by mlx5e_hairpin_get_mdev() or
its callers. This makes the underlying hlist_for_each_entry() loop not
safe, and can have adverse effects in itself.

Fix by using dev_get_by_index() and handling nullptr return value when
ifindex device is not found. Update mlx5e_hairpin_get_mdev() callers to
check for possible PTR_ERR() result.

Fixes: 77ab67b7f0 ("net/mlx5e: Basic setup of hairpin object")
Addresses-Coverity: ("Dereference null return value")
Signed-off-by: Dima Chumak <dchumak@nvidia.com>
Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-08-04 12:27:39 +02:00
..
accel net/mlx5: Deprecate usage of generic TLS HW capability bit 2020-02-11 04:35:51 -08:00
diag net/mlx5: Fix failing fw tracer allocation on s390 2020-05-02 08:48:52 +02:00
en net/mlx5e: Don't match on Geneve options in case option masks are all zero 2021-03-30 14:35:24 +02:00
en_accel net/mlx5e: Remove dependency in IPsec initialization flows 2021-06-23 14:41:24 +02:00
fpga net/mlx5: IPsec, fix memory leak at mlx5_fpga_ipsec_delete_sa_ctx 2020-02-11 04:35:50 -08:00
ipoib net/mlx5e: Fix inner tirs handling 2020-06-03 08:21:03 +02:00
lib net/mlx5: poll cmd EQ in case of command timeout 2020-11-22 10:14:11 +01:00
steering net/mlx5: DR, Proper handling of unsupported Connect-X6DX SW steering 2020-12-08 10:40:27 +01:00
Kconfig
Makefile
alloc.c
cmd.c net/mlx5: Add retry mechanism to the command entry index allocation 2020-11-22 10:14:11 +01:00
cq.c
debugfs.c
dev.c
devlink.c net/mlx5e: Add missing release firmware call 2020-04-21 09:04:49 +02:00
devlink.h
ecpf.c
ecpf.h
en.h net/mlx5e: Add resiliency in Striding RQ mode for packets larger than MTU 2020-10-14 10:33:04 +02:00
en_arfs.c
en_common.c
en_dcbnl.c
en_dim.c
en_ethtool.c net/mlx5e: Fix ethtool indication of connector type 2021-04-14 08:24:15 +02:00
en_fs.c net/mlx5e: Fix two double free cases 2021-01-17 14:05:37 +01:00
en_fs_ethtool.c
en_main.c net/mlx5e: Block offload of outer header csum for UDP tunnels 2021-06-23 14:41:25 +02:00
en_rep.c net/mlx5e: Modify uplink state on interface up/down 2020-08-05 09:59:47 +02:00
en_rep.h
en_rx.c net/mlx5e: IPoIB, Drop multicast packets that this interface sent 2020-06-22 09:31:06 +02:00
en_selftest.c
en_stats.c mlx5: work around high stack usage with gcc 2020-02-24 08:36:44 +01:00
en_stats.h
en_tc.c net/mlx5e: Fix nullptr in mlx5e_hairpin_get_mdev() 2021-08-04 12:27:39 +02:00
en_tc.h
en_tx.c net/mlx5e: Update netdev txq on completions during closure 2020-06-03 08:21:04 +02:00
en_txrx.c net/mlx5e: Don't trigger IRQ multiple times on XSK wakeup to avoid WQ overruns 2020-05-02 08:48:48 +02:00
eq.c net/mlx5: Don't request more than supported EQs 2021-04-14 08:24:15 +02:00
eswitch.c net/mlx5: E-Switch, Fail mlx5_esw_modify_vport_rate if qos disabled 2020-11-24 13:29:07 +01:00
eswitch.h net/mlx5e: Modify uplink state on interface up/down 2020-08-05 09:59:47 +02:00
eswitch_offloads.c net/mlx5e: Enable adding peer miss rules only if merged eswitch is supported 2020-09-26 18:03:14 +02:00
eswitch_offloads_termtbl.c net/mlx5e: Use correct enum to determine uplink port 2019-11-06 14:03:55 -08:00
events.c net/mlx5: Fix memory leak in mlx5_events_init 2020-06-03 08:21:04 +02:00
fs_cmd.c
fs_cmd.h
fs_core.c net/mlx5: Fix flow table chaining 2021-08-04 12:27:39 +02:00
fs_core.h net/mlx5: Fix auto group size calculation 2019-11-20 12:33:06 -08:00
fs_counters.c
fw.c net/mlx5: Deprecate usage of generic TLS HW capability bit 2020-02-11 04:35:51 -08:00
health.c net/mlx5: Fix fatal error handling during device load 2020-06-17 16:40:32 +02:00
lag.c
lag.h
lag_mp.c net/mlx5e: Fix multipath lag activation 2021-06-03 08:59:06 +02:00
lag_mp.h
main.c net/mlx5: Properly convey driver version to firmware 2020-12-30 11:51:18 +01:00
mcg.c
mlx5_core.h
mr.c
pagealloc.c net/mlx5: Fix wrong address reclaim when command interface is down 2020-12-08 10:40:27 +01:00
pci_irq.c net/mlx5: Fix request_irqs error flow 2020-10-14 10:33:04 +02:00
pd.c
port.c net/mlx5: Fix eeprom support for SFP module 2020-07-16 08:16:40 +02:00
qp.c
rdma.c net/mlx5: Consider RoCE cap before init RDMA resources 2021-06-23 14:41:24 +02:00
rdma.h
rl.c
sriov.c
transobj.c net/mlx5e: Fix page reclaim for dead peer hairpin 2021-06-23 14:41:24 +02:00
uar.c
vport.c
wq.c net/mlx5e: Reset RQ doorbell counter before moving RQ state from RST to RDY 2020-02-28 17:22:28 +01:00
wq.h net/mlx5e: Reset RQ doorbell counter before moving RQ state from RST to RDY 2020-02-28 17:22:28 +01:00