All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: Benedikt Spranger <b.spranger@linutronix.de>, netdev@vger.kernel.org
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jiri Pirko <jiri@resnulli.us>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH net 1/1] net/sched: taprio: Check if socket flags are valid
Date: Fri, 18 Mar 2022 18:11:33 -0700	[thread overview]
Message-ID: <87k0cqvj96.fsf@intel.com> (raw)
In-Reply-To: <20220318142532.313226-2-b.spranger@linutronix.de>

Benedikt Spranger <b.spranger@linutronix.de> writes:

> A user may set the SO_TXTIME socket option to ensure a packet is send
> at a given time. The taprio scheduler has to confirm, that it is allowed
> to send a packet at that given time, by a check against the packet time
> schedule. The scheduler drop the packet, if the gates are closed at the
> given send time.
>
> The check, if SO_TXTIME is set, may fail since sk_flags are part of an
> union and the union is used otherwise. This happen, if a socket is not
> a full socket, like a request socket for example.
>
> Add a check to verify, if the union is used for sk_flags.
>
> Fixes: 4cfd5779bd6e ("taprio: Add support for txtime-assist mode")
> Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
> Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>
> ---

>  net/sched/sch_taprio.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
> index 1ce6416b4810..86911a61e739 100644
> --- a/net/sched/sch_taprio.c
> +++ b/net/sched/sch_taprio.c
> @@ -419,7 +419,8 @@ static int taprio_enqueue_one(struct sk_buff *skb, struct Qdisc *sch,
>  {
>  	struct taprio_sched *q = qdisc_priv(sch);
>  
> -	if (skb->sk && sock_flag(skb->sk, SOCK_TXTIME)) {
> +	/* sk_flags are only save to use on full sockets. */


A very minor nitpick: it should have been "safe to use".

Apart from that,

Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>

> +	if (skb->sk && sk_fullsock(skb->sk) && sock_flag(skb->sk, SOCK_TXTIME)) {
>  		if (!is_valid_interval(skb, sch))
>  			return qdisc_drop(skb, sch, to_free);
>  	} else if (TXTIME_ASSIST_IS_ENABLED(q->flags)) {
> -- 
> 2.20.1
>


Cheers,
-- 
Vinicius

      reply	other threads:[~2022-03-19  1:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 14:25 [PATCH net 0/1] net/sched: taprio: Check if sk_flags are valid Benedikt Spranger
2022-03-18 14:25 ` [PATCH net 1/1] net/sched: taprio: Check if socket flags " Benedikt Spranger
2022-03-19  1:11   ` Vinicius Costa Gomes [this message]

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=87k0cqvj96.fsf@intel.com \
    --to=vinicius.gomes@intel.com \
    --cc=b.spranger@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.