Commit f7b52afe authored by Zhengchuan Liang's avatar Zhengchuan Liang Committed by Jakub Kicinski
Browse files

ipv6: exthdrs: refresh nh after handling HAO option



ip6_parse_tlv() caches skb_network_header(skb) in nh while walking
IPv6 TLVs.

ipv6_dest_hao() may call pskb_expand_head() for a cloned skb, which can
move the skb head and invalidate the cached network header pointer.
Refresh nh after ipv6_dest_hao() returns so any trailing padding or TLVs
are parsed from the current skb head.

This matches the existing pattern used in ip6_parse_tlv() after helpers
that can modify skb header storage.

Fixes: a831f5bb ("[IPV6] MIP6: Add inbound interface of home address option.")
Cc: stable@kernel.org
Reported-by: default avatarYuan Tan <yuantan098@gmail.com>
Reported-by: default avatarXin Liu <bird@lzu.edu.cn>
Co-developed-by: default avatarLuxing Yin <tr0jan@lzu.edu.cn>
Signed-off-by: default avatarLuxing Yin <tr0jan@lzu.edu.cn>
Signed-off-by: default avatarZhengchuan Liang <zcliangcn@gmail.com>
Signed-off-by: default avatarRen Wei <n05ec@lzu.edu.cn>
Reviewed-by: default avatarJustin Iurman <justin.iurman@gmail.com>
Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/7aba1debc2196189172499e5769802b026f8caf8.1779247873.git.zcliangcn@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f6f1bfc1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -201,6 +201,8 @@ static bool ip6_parse_tlv(bool hopbyhop,
				case IPV6_TLV_HAO:
					if (!ipv6_dest_hao(skb, off))
						return false;

					nh = skb_network_header(skb);
					break;
#endif
				default: