Skip to content

Commit d5be67e

Browse files
bene42gregkh
authored andcommitted
net/sched: taprio: Check if socket flags are valid
[ Upstream commit e8a64bb ] 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: 4cfd577 ("taprio: Add support for txtime-assist mode") Signed-off-by: Benedikt Spranger <[email protected]> Reviewed-by: Kurt Kanzenbach <[email protected]> Acked-by: Vinicius Costa Gomes <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 62a4838 commit d5be67e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/sched/sch_taprio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ static int taprio_enqueue_one(struct sk_buff *skb, struct Qdisc *sch,
417417
{
418418
struct taprio_sched *q = qdisc_priv(sch);
419419

420-
if (skb->sk && sock_flag(skb->sk, SOCK_TXTIME)) {
420+
/* sk_flags are only safe to use on full sockets. */
421+
if (skb->sk && sk_fullsock(skb->sk) && sock_flag(skb->sk, SOCK_TXTIME)) {
421422
if (!is_valid_interval(skb, sch))
422423
return qdisc_drop(skb, sch, to_free);
423424
} else if (TXTIME_ASSIST_IS_ENABLED(q->flags)) {

0 commit comments

Comments
 (0)