mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
xfrm: Switch to skb_dstref_steal to clear dst_entry
Going forward skb_dst_set will assert that skb dst_entry is empty during skb_dst_set. skb_dstref_steal is added to reset existing entry without doing refcnt. Switch to skb_dstref_steal in __xfrm_route_forward and add a comment on why it's safe to skip skb_dstref_restore. Signed-off-by: Stanislav Fomichev <sdf@fomichev.me> Link: https://patch.msgid.link/20250818154032.3173645-3-sdf@fomichev.me Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
c3f0c02997
commit
c829aab21e
@@ -3881,12 +3881,18 @@ int __xfrm_route_forward(struct sk_buff *skb, unsigned short family)
|
||||
}
|
||||
|
||||
skb_dst_force(skb);
|
||||
if (!skb_dst(skb)) {
|
||||
dst = skb_dst(skb);
|
||||
if (!dst) {
|
||||
XFRM_INC_STATS(net, LINUX_MIB_XFRMFWDHDRERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, XFRM_LOOKUP_QUEUE);
|
||||
/* ignore return value from skb_dstref_steal, xfrm_lookup takes
|
||||
* care of dropping the refcnt if needed.
|
||||
*/
|
||||
skb_dstref_steal(skb);
|
||||
|
||||
dst = xfrm_lookup(net, dst, &fl, NULL, XFRM_LOOKUP_QUEUE);
|
||||
if (IS_ERR(dst)) {
|
||||
res = 0;
|
||||
dst = NULL;
|
||||
|
||||
Reference in New Issue
Block a user