* [PATCH net-next] net: psample: fix flag being set in wrong skb
@ 2024-07-09 20:34 Adrian Moreno
2024-07-09 22:57 ` Ilya Maximets
0 siblings, 1 reply; 3+ messages in thread
From: Adrian Moreno @ 2024-07-09 20:34 UTC (permalink / raw)
To: netdev
Cc: Adrian Moreno, Yotam Gigi, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Ido Schimmel, Eelco Chaudron,
Aaron Conole, linux-kernel
A typo makes PSAMPLE_ATTR_SAMPLE_RATE netlink flag be added to the wrong
sk_buff.
Fixes: 7b1b2b60c63f ("net: psample: allow using rate as probability")
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
---
net/psample/psample.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/psample/psample.c b/net/psample/psample.c
index f48b5b9cd409..11b7533067b8 100644
--- a/net/psample/psample.c
+++ b/net/psample/psample.c
@@ -498,7 +498,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] 3+ messages in thread
* Re: [PATCH net-next] net: psample: fix flag being set in wrong skb
2024-07-09 20:34 [PATCH net-next] net: psample: fix flag being set in wrong skb Adrian Moreno
@ 2024-07-09 22:57 ` Ilya Maximets
2024-07-09 23:11 ` Adrián Moreno
0 siblings, 1 reply; 3+ messages in thread
From: Ilya Maximets @ 2024-07-09 22:57 UTC (permalink / raw)
To: Adrian Moreno, netdev
Cc: Yotam Gigi, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Ido Schimmel, Eelco Chaudron, Aaron Conole,
linux-kernel, i.maximets
On 7/9/24 22:34, Adrian Moreno wrote:
> A typo makes PSAMPLE_ATTR_SAMPLE_RATE netlink flag be added to the wrong
> sk_buff.
>
> Fixes: 7b1b2b60c63f ("net: psample: allow using rate as probability")
> Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
> ---
> net/psample/psample.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/psample/psample.c b/net/psample/psample.c
> index f48b5b9cd409..11b7533067b8 100644
> --- a/net/psample/psample.c
> +++ b/net/psample/psample.c
> @@ -498,7 +498,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,
Uff. Nasty.
I'd say we should change the function argument to 'const' to avoid such
issues in the future. There is no reason for this function to modify
the original packet. What do you think?
Best regards, Ilya Maximets.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: psample: fix flag being set in wrong skb
2024-07-09 22:57 ` Ilya Maximets
@ 2024-07-09 23:11 ` Adrián Moreno
0 siblings, 0 replies; 3+ messages in thread
From: Adrián Moreno @ 2024-07-09 23:11 UTC (permalink / raw)
To: Ilya Maximets
Cc: netdev, Yotam Gigi, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Ido Schimmel, Eelco Chaudron,
Aaron Conole, linux-kernel
On Wed, Jul 10, 2024 at 12:57:14AM GMT, Ilya Maximets wrote:
> On 7/9/24 22:34, Adrian Moreno wrote:
> > A typo makes PSAMPLE_ATTR_SAMPLE_RATE netlink flag be added to the wrong
> > sk_buff.
> >
> > Fixes: 7b1b2b60c63f ("net: psample: allow using rate as probability")
> > Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
> > ---
> > net/psample/psample.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/net/psample/psample.c b/net/psample/psample.c
> > index f48b5b9cd409..11b7533067b8 100644
> > --- a/net/psample/psample.c
> > +++ b/net/psample/psample.c
> > @@ -498,7 +498,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,
>
> Uff. Nasty.
>
> I'd say we should change the function argument to 'const' to avoid such
> issues in the future. There is no reason for this function to modify
> the original packet. What do you think?
>
Yes, that's probably a good idea.
Adrián.
> Best regards, Ilya Maximets.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-09 23:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-09 20:34 [PATCH net-next] net: psample: fix flag being set in wrong skb Adrian Moreno
2024-07-09 22:57 ` Ilya Maximets
2024-07-09 23:11 ` Adrián Moreno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®