mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ilya Maximets <i.maximets@ovn.org>
To: Adrian Moreno <amorenoz@redhat.com>, netdev@vger.kernel.org
Cc: Yotam Gigi <yotam.gi@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Ido Schimmel <idosch@nvidia.com>,
	Eelco Chaudron <echaudro@redhat.com>,
	Aaron Conole <aconole@redhat.com>,
	linux-kernel@vger.kernel.org, i.maximets@ovn.org
Subject: Re: [PATCH net-next] net: psample: fix flag being set in wrong skb
Date: Wed, 10 Jul 2024 00:57:14 +0200	[thread overview]
Message-ID: <28d092ae-96c8-4145-b679-399d2f71bf8e@ovn.org> (raw)
In-Reply-To: <20240709203437.1257952-1-amorenoz@redhat.com>

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.

  reply	other threads:[~2024-07-09 22:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09 20:34 Adrian Moreno
2024-07-09 22:57 ` Ilya Maximets [this message]
2024-07-09 23:11   ` Adrián Moreno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28d092ae-96c8-4145-b679-399d2f71bf8e@ovn.org \
    --to=i.maximets@ovn.org \
    --cc=aconole@redhat.com \
    --cc=amorenoz@redhat.com \
    --cc=davem@davemloft.net \
    --cc=echaudro@redhat.com \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yotam.gi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®