can: dev: can_put_echo_skb(): don't crash kernel if can_priv::echo_skb is accessed...
authorMarc Kleine-Budde <mkl@pengutronix.de>
Fri, 29 Sep 2023 08:23:47 +0000 (10:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:51:53 +0000 (11:51 +0100)
commit0d30931f1fa0fb893fb7d5dc32b6b7edfb775be4
tree17875d42394322c745408351129faceb5054a395
parent76378a8bae090ceca3828f2678e3677ae88aeaac
can: dev: can_put_echo_skb(): don't crash kernel if can_priv::echo_skb is accessed out of bounds

[ Upstream commit 6411959c10fe917288cbb1038886999148560057 ]

If the "struct can_priv::echoo_skb" is accessed out of bounds, this
would cause a kernel crash. Instead, issue a meaningful warning
message and return with an error.

Fixes: a6e4bc530403 ("can: make the number of echo skb's configurable")
Link: https://lore.kernel.org/all/20231005-can-dev-fix-can-restart-v2-5-91b5c1fd922c@pengutronix.de
Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/can/dev/skb.c