netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3] net: psample: fix flag being set in wrong skb
@ 2024-07-10 17:10 Adrian Moreno
  2024-07-11  6:26 ` Ido Schimmel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Adrian Moreno @ 2024-07-10 17:10 UTC (permalink / raw)
  To: netdev
  Cc: Adrian Moreno, Eelco Chaudron, Yotam Gigi, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Aaron Conole,
	Ido Schimmel, linux-kernel

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.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Fixes: 7b1b2b60c63f ("net: psample: allow using rate as probability")
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
---
 include/net/psample.h | 8 +++++---
 net/psample/psample.c | 7 ++++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/net/psample.h b/include/net/psample.h
index c52e9ebd88dd..5071b5fc2b59 100644
--- a/include/net/psample.h
+++ b/include/net/psample.h
@@ -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)
 {
 }
diff --git a/net/psample/psample.c b/net/psample/psample.c
index f48b5b9cd409..a0ddae8a65f9 100644
--- a/net/psample/psample.c
+++ b/net/psample/psample.c
@@ -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,
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v3] net: psample: fix flag being set in wrong skb
  2024-07-10 17:10 [PATCH net-next v3] net: psample: fix flag being set in wrong skb Adrian Moreno
@ 2024-07-11  6:26 ` Ido Schimmel
  2024-07-11  8:59 ` Antoine Tenart
  2024-07-12  1:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2024-07-11  6:26 UTC (permalink / raw)
  To: Adrian Moreno
  Cc: netdev, Eelco Chaudron, Yotam Gigi, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Aaron Conole, linux-kernel

On Wed, Jul 10, 2024 at 07:10:04PM +0200, Adrian Moreno wrote:
> 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.
> 
> Acked-by: Eelco Chaudron <echaudro@redhat.com>
> Fixes: 7b1b2b60c63f ("net: psample: allow using rate as probability")
> Signed-off-by: Adrian Moreno <amorenoz@redhat.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v3] net: psample: fix flag being set in wrong skb
  2024-07-10 17:10 [PATCH net-next v3] net: psample: fix flag being set in wrong skb Adrian Moreno
  2024-07-11  6:26 ` Ido Schimmel
@ 2024-07-11  8:59 ` Antoine Tenart
  2024-07-12  1:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Antoine Tenart @ 2024-07-11  8:59 UTC (permalink / raw)
  To: Adrian Moreno, netdev
  Cc: Adrian Moreno, Eelco Chaudron, Yotam Gigi, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Aaron Conole,
	Ido Schimmel, linux-kernel

Quoting Adrian Moreno (2024-07-10 19:10:04)
> 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.
> 
> Acked-by: Eelco Chaudron <echaudro@redhat.com>
> Fixes: 7b1b2b60c63f ("net: psample: allow using rate as probability")
> Signed-off-by: Adrian Moreno <amorenoz@redhat.com>

Reviewed-by: Antoine Tenart <atenart@kernel.org>

Thanks!

> ---
>  include/net/psample.h | 8 +++++---
>  net/psample/psample.c | 7 ++++---
>  2 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/include/net/psample.h b/include/net/psample.h
> index c52e9ebd88dd..5071b5fc2b59 100644
> --- a/include/net/psample.h
> +++ b/include/net/psample.h
> @@ -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)
>  {
>  }
> diff --git a/net/psample/psample.c b/net/psample/psample.c
> index f48b5b9cd409..a0ddae8a65f9 100644
> --- a/net/psample/psample.c
> +++ b/net/psample/psample.c
> @@ -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,
> -- 
> 2.45.2
> 
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v3] net: psample: fix flag being set in wrong skb
  2024-07-10 17:10 [PATCH net-next v3] net: psample: fix flag being set in wrong skb Adrian Moreno
  2024-07-11  6:26 ` Ido Schimmel
  2024-07-11  8:59 ` Antoine Tenart
@ 2024-07-12  1:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-07-12  1:20 UTC (permalink / raw)
  To: =?utf-8?q?Adri=C3=A1n_Moreno_=3Camorenoz=40redhat=2Ecom=3E?=
  Cc: netdev, echaudro, yotam.gi, davem, edumazet, kuba, pabeni,
	aconole, idosch, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 10 Jul 2024 19:10:04 +0200 you wrote:
> 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.
> 
> Acked-by: Eelco Chaudron <echaudro@redhat.com>
> Fixes: 7b1b2b60c63f ("net: psample: allow using rate as probability")
> Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-07-12  1:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-10 17:10 [PATCH net-next v3] net: psample: fix flag being set in wrong skb Adrian Moreno
2024-07-11  6:26 ` Ido Schimmel
2024-07-11  8:59 ` Antoine Tenart
2024-07-12  1:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).