net: psample: fix flag being set in wrong skb
Subsystems (3)
PATCH v3 1/1 net: psample: fix flag being set in wrong skb
A typo makes PSAMPLE_ATTR_SAMPLE_RATE netlink flag be added to the wrong sk_buff.
Fix the error and make the input sk_buff pointer "const" so that it doesn't happen again.
--- include/net/psample.h | 8 +++++--- net/psample/psample.c | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-)
include/net/psample.h +5 -3
@@ -38,13 +38,15 @@ struct sk_buff;#if IS_ENABLED (CONFIG_PSAMPLE ) -void psample_sample_packet (struct psample_group *group,struct sk_buff *skb, -u32 sample_rate,const struct psample_metadata *md); +void psample_sample_packet (struct psample_group *group, +const struct sk_buff *skb,u32 sample_rate, +const struct psample_metadata *md);#else static inline void psample_sample_packet (struct psample_group *group, -struct sk_buff *skb,u32 sample_rate, +const struct sk_buff *skb, +u32 sample_rate,const struct psample_metadata *md) { }
net/psample/psample.c +4 -3
@@ -360,8 +360,9 @@ static int psample_tunnel_meta_len(struct ip_tunnel_info *tun_info) }#endif -void psample_sample_packet (struct psample_group *group,struct sk_buff *skb, -u32 sample_rate,const struct psample_metadata *md) +void psample_sample_packet (struct psample_group *group, +const struct sk_buff *skb,u32 sample_rate, +const struct psample_metadata *md) {ktime_t tstamp =ktime_get_real ();int out_ifindex = md->out_ifindex;
@@ -498,7 +499,7 @@ void psample_sample_packet(struct psample_group *group, struct sk_buff *skb, goto error;if (md->rate_as_probability) -nla_put_flag (skb,PSAMPLE_ATTR_SAMPLE_PROBABILITY ); +nla_put_flag (nl_skb,PSAMPLE_ATTR_SAMPLE_PROBABILITY );genlmsg_end (nl_skb, data); genlmsg_multicast_netns(&psample_nl_family, group->net, nl_skb, 0,
Signature · 1 line
2.45.2
Quoted 9 lines · Adrian Moreno
A typo makes
PSAMPLE_ATTR_SAMPLE_RATEnetlink flag be added to the wrongsk_buff.Fix the error and make the input
sk_buffpointer "const" so that it doesn't happen again.Acked-by Eelco Chaudron <[email protected]>Fixes 7b1b2b60c63f ("net: psample: allow using rate as probability")Signed-off-by Adrian Moreno <[email protected]>
Quoting Adrian Moreno (2024-07-10 19:10:04)
Quoted 9 lines
A typo makes
PSAMPLE_ATTR_SAMPLE_RATEnetlink flag be added to the wrongsk_buff.Fix the error and make the input
sk_buffpointer "const" so that it doesn't happen again.Acked-by Eelco Chaudron <[email protected]>Fixes 7b1b2b60c63f ("net: psample: allow using rate as probability")Signed-off-by Adrian Moreno <[email protected]>
Thanks!
Quoted 57 lines
--- include/net/psample.h | 8 +++++--- net/psample/psample.c | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-)include/net/psample.h +5
-3@@ -38,13 +38,15 @@ struct sk_buff;#if IS_ENABLED (CONFIG_PSAMPLE ) -void psample_sample_packet (struct psample_group *group,struct sk_buff *skb, -u32 sample_rate,const struct psample_metadata *md); +void psample_sample_packet (struct psample_group *group, +const struct sk_buff *skb,u32 sample_rate, +const struct psample_metadata *md);#else static inline void psample_sample_packet (struct psample_group *group, -struct sk_buff *skb,u32 sample_rate, +const struct sk_buff *skb, +u32 sample_rate,const struct psample_metadata *md) { }net/psample/psample.c +4
-3@@ -360,8 +360,9 @@ static int psample_tunnel_meta_len(struct ip_tunnel_info *tun_info) }#endif -void psample_sample_packet (struct psample_group *group,struct sk_buff *skb, -u32 sample_rate,const struct psample_metadata *md) +void psample_sample_packet (struct psample_group *group, +const struct sk_buff *skb,u32 sample_rate, +const struct psample_metadata *md) {ktime_t tstamp =ktime_get_real ();int out_ifindex = md->out_ifindex;@@ -498,7 +499,7 @@ void psample_sample_packet(struct psample_group *group, struct sk_buff *skb, goto error;if (md->rate_as_probability) -nla_put_flag (skb,PSAMPLE_ATTR_SAMPLE_PROBABILITY ); +nla_put_flag (nl_skb,PSAMPLE_ATTR_SAMPLE_PROBABILITY );genlmsg_end (nl_skb, data); genlmsg_multicast_netns(&psample_nl_family, group->net, nl_skb, 0,Signature · 1 line
2.45.2
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Wed, 10 Jul 2024 19:10:04 +0200 you wrote:
A typo makes
PSAMPLE_ATTR_SAMPLE_RATEnetlink flag be added to the wrongsk_buff.Fix the error and make the input
sk_buffpointer "const" so that it doesn't happen again.Acked-by Eelco Chaudron <[email protected]>Fixes 7b1b2b60c63f ("net: psample: allow using rate as probability")Signed-off-by Adrian Moreno <[email protected]>[...]
Here is the summary with links:
- [net-next,v3] net: psample: fix flag being set in wrong skb
https://git.kernel.org/netdev/net-next/c/8341eee81c79
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html