net/mlx5e: Fix macsec possible null dereference when updating MAC security entity...
authorEmeel Hakim <ehakim@nvidia.com>
Sun, 11 Dec 2022 11:22:23 +0000 (13:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:58:30 +0000 (11:58 +0100)
commit514d9c6a39213d8200884e70f60ce7faef1ee597
treee685cf52f19327abb62949b149246cc6de1ba4fb
parent9be4e25bdc1fb6bacde61e3e35e276c821a485a0
net/mlx5e: Fix macsec possible null dereference when updating MAC security entity (SecY)

[ Upstream commit 9828994ac492e8e7de47fe66097b7e665328f348 ]

Upon updating MAC security entity (SecY) in hw offload path, the macsec
security association (SA) initialization routine is called. In case of
extended packet number (epn) is enabled the salt and ssci attributes are
retrieved using the MACsec driver rx_sa context which is unavailable when
updating a SecY property such as encoding-sa hence the null dereference.
Fix by using the provided SA to set those attributes.

Fixes: 4411a6c0abd3 ("net/mlx5e: Support MACsec offload extended packet number (EPN)")
Signed-off-by: Emeel Hakim <ehakim@nvidia.com>
Reviewed-by: Raed Salem <raeds@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c