Kyle Zeng 0113d9c9d1 ipv4: fix null-deref in ipv4_link_failure
Currently, we assume the skb is associated with a device before calling
__ip_options_compile, which is not always the case if it is re-routed by
ipvs.
When skb->dev is NULL, dev_net(skb->dev) will become null-dereference.
This patch adds a check for the edge case and switch to use the net_device
from the rtable when skb->dev is NULL.

Fixes: ed0de45a1008 ("ipv4: recompile ip options in ipv4_link_failure")
Suggested-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Kyle Zeng <zengyhkyle@gmail.com>
Cc: Stephen Suryaputra <ssuryaextr@gmail.com>
Cc: Vadim Fedorenko <vfedorenko@novek.ru>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-09-17 15:14:58 +01:00
..
2023-05-31 13:06:57 +02:00
2021-05-17 15:29:35 -07:00
2023-03-31 21:37:06 -07:00
2023-04-13 16:43:38 -07:00
2023-01-26 10:52:18 +01:00
2021-05-17 15:29:35 -07:00
2022-09-20 10:21:49 -07:00
2022-12-20 03:13:45 +01:00
2023-09-07 18:33:07 -07:00
2021-05-17 15:29:35 -07:00
2022-11-16 09:43:35 +00:00
2023-08-29 17:39:15 -07:00