amt: do not use overwrapped cb area
Subsystems (3)
Taehee Yoo
maintainerPATCH 1/1 amt: do not use overwrapped cb area
amt driver uses skb->cb for storing tunnel information.
This job is worked before TC layer and then amt driver load tunnel info from skb->cb after TC layer.
So, its cb area should not be overwrapped with CB area used by TC. In order to not use cb area used by TC, it skips the biggest cb structure used by TC, which was qdisc_skb_cb.
But it's not anymore.
Currently, biggest structure of TC's CB is tc_skb_cb.
So, it should skip size of tc_skb_cb instead of qdisc_skb_cb.
--- drivers/net/amt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/amt.c +3 -3
@@ -11,7 +11,7 @@#include <linux/net.h> #include <linux/igmp.h> #include <linux/workqueue.h> -#include <net/sch_generic.h> +#include <net/pkt_sched.h> #include <net/net_namespace.h> #include <net/ip.h> #include <net/udp.h>
@@ -80,11 +80,11 @@ static struct mld2_grec mldv2_zero_grec;static struct amt_skb_cb *amt_skb_cb (struct sk_buff *skb) { -BUILD_BUG_ON (sizeof (struct amt_skb_cb ) +sizeof (struct qdisc_skb_cb ) > +BUILD_BUG_ON (sizeof (struct amt_skb_cb ) +sizeof (struct tc_skb_cb ) > sizeof_field(struct sk_buff, cb));return (struct amt_skb_cb *)((void *)skb->cb + -sizeof (struct qdisc_skb_cb )); +sizeof (struct tc_skb_cb )); }static void __amt_source_gc_work (void )
Signature · 1 line
2.34.1
Quoted 10 lines · Taehee Yoo
amt driver uses
skb->cbfor storing tunnel information.
This job is worked before TC layer and then amt driver load tunnel info fromskb->cbafter TC layer.
So, its cb area should not be overwrapped with CB area used by TC. In order to not use cb area used by TC, it skips the biggest cb structure used by TC, which wasqdisc_skb_cb.
But it's not anymore.
Currently, biggest structure of TC's CB istc_skb_cb.
So, it should skip size oftc_skb_cbinstead ofqdisc_skb_cb.
Quoted 2 lines
Fixes ec624fe740b4 ("net/sched: Extend qdisc control block with tc control block")Signed-off-by Taehee Yoo <[email protected]>
The patch LGTM, but I can't merge it ATM, as even the net tree is currently frozen until the net-next PR is merged back. Let me leave my tag explicitly to hopefully save some time for Jakub and/or Dave.
Cheers,
Paolo
Quoted 11 lines · Taehee Yoo
amt driver uses
skb->cbfor storing tunnel information.
This job is worked before TC layer and then amt driver load tunnel info fromskb->cbafter TC layer.
So, its cb area should not be overwrapped with CB area used by TC. In order to not use cb area used by TC, it skips the biggest cb structure used by TC, which wasqdisc_skb_cb.
But it's not anymore.
Currently, biggest structure of TC's CB istc_skb_cb.
So, it should skip size oftc_skb_cbinstead ofqdisc_skb_cb.
Quoted 2 lines
Fixes ec624fe740b4 ("net/sched: Extend qdisc control block with tc control block")Signed-off-by Taehee Yoo <[email protected]>
cheers,
jamal
Quoted 34 lines
--- drivers/net/amt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/net/amt.c +3
-4@@ -11,7 +11,7 @@#include <linux/net.h> #include <linux/igmp.h> #include <linux/workqueue.h> -#include <net/sch_generic.h> +#include <net/pkt_sched.h> #include <net/net_namespace.h> #include <net/ip.h> #include <net/udp.h> @@ -80,11 +80,11 @@ static struct mld2_grec mldv2_zero_grec;static struct amt_skb_cb *amt_skb_cb (struct sk_buff *skb) { -BUILD_BUG_ON (sizeof (struct amt_skb_cb ) +sizeof (struct qdisc_skb_cb ) > +BUILD_BUG_ON (sizeof (struct amt_skb_cb ) +sizeof (struct tc_skb_cb ) > sizeof_field(struct sk_buff, cb));return (struct amt_skb_cb *)((void *)skb->cb + -sizeof (struct qdisc_skb_cb )); +sizeof (struct tc_skb_cb )); }static void __amt_source_gc_work (void ) --2.34.1
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Sun, 7 Jan 2024 14:42:41 +0000 you wrote:
amt driver uses
skb->cbfor storing tunnel information.
This job is worked before TC layer and then amt driver load tunnel info fromskb->cbafter TC layer.
So, its cb area should not be overwrapped with CB area used by TC. In order to not use cb area used by TC, it skips the biggest cb structure used by TC, which wasqdisc_skb_cb.
But it's not anymore.
Currently, biggest structure of TC's CB istc_skb_cb.
So, it should skip size oftc_skb_cbinstead ofqdisc_skb_cb.[...]
Here is the summary with links:
- [net] amt: do not use overwrapped cb area
https://git.kernel.org/netdev/net/c/bec161add35b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html