]> git.itanic.dy.fi Git - linux-stable/commit
octeontx2-af: Add validation before accessing cgx and lmac
authorHariprasad Kelam <hkelam@marvell.com>
Fri, 30 Jun 2023 06:28:44 +0000 (11:58 +0530)
committerDavid S. Miller <davem@davemloft.net>
Sun, 2 Jul 2023 14:47:19 +0000 (15:47 +0100)
commit79ebb53772c95d3a6ae51b3c65f9985fdd430df6
tree602bfd8680402ca8a8cf109e1cf1828362c18ee8
parent2e7bc57b976bb016c6569a54d95c1b8d88f9450a
octeontx2-af: Add validation before accessing cgx and lmac

with the addition of new MAC blocks like CN10K RPM and CN10KB
RPM_USX, LMACs are noncontiguous and CGX blocks are also
noncontiguous. But during RVU driver initialization, the driver
is assuming they are contiguous and trying to access
cgx or lmac with their id which is resulting in kernel panic.

This patch fixes the issue by adding proper checks.

[   23.219150] pc : cgx_lmac_read+0x38/0x70
[   23.219154] lr : rvu_program_channels+0x3f0/0x498
[   23.223852] sp : ffff000100d6fc80
[   23.227158] x29: ffff000100d6fc80 x28: ffff00010009f880 x27:
000000000000005a
[   23.234288] x26: ffff000102586768 x25: 0000000000002500 x24:
fffffffffff0f000

Fixes: 91c6945ea1f9 ("octeontx2-af: cn10k: Add RPM MAC support")
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/af/cgx.c