]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: Add skb_dstref_steal and skb_dstref_restore
authorStanislav Fomichev <sdf@fomichev.me>
Mon, 18 Aug 2025 15:40:26 +0000 (08:40 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 20 Aug 2025 00:54:13 +0000 (17:54 -0700)
commitc3f0c02997c7f8489fec259e28e0e04e9811edac
tree3ec6463a3aa14015e41cc3ef657826cba8b100ef
parent0e041220ea064585d3d667b70e03bad0f31f86bb
net: Add skb_dstref_steal and skb_dstref_restore

Going forward skb_dst_set will assert that skb dst_entry
is empty during skb_dst_set to prevent potential leaks. There
are few places that still manually manage dst_entry not using
the helpers. Convert them to the following new helpers:
- skb_dstref_steal that resets dst_entry and returns previous dst_entry
  value
- skb_dstref_restore that restores dst_entry previously reset via
  skb_dstref_steal

Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20250818154032.3173645-2-sdf@fomichev.me
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/skbuff.h