[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87k0cqvj96.fsf@intel.com>
Date: Fri, 18 Mar 2022 18:11:33 -0700
From: Vinicius Costa Gomes <vinicius.gomes@...el.com>
To: Benedikt Spranger <b.spranger@...utronix.de>,
netdev@...r.kernel.org
Cc: Jamal Hadi Salim <jhs@...atatu.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH net 1/1] net/sched: taprio: Check if socket flags are valid
Benedikt Spranger <b.spranger@...utronix.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@...utronix.de>
> Reviewed-by: Kurt Kanzenbach <kurt@...utronix.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@...el.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
Powered by blists - more mailing lists