All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1]  net/sched: taprio: Check if sk_flags are valid
@ 2022-04-08  9:47 Benedikt Spranger
  2022-04-08  9:47 ` [PATCH v2 1/1] net/sched: taprio: Check if socket flags " Benedikt Spranger
  2022-04-11 10:00 ` [PATCH v2 0/1] net/sched: taprio: Check if sk_flags " patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Benedikt Spranger @ 2022-04-08  9:47 UTC (permalink / raw)
  To: netdev
  Cc: Kurt Kanzenbach, Vinicius Costa Gomes, Jamal Hadi Salim,
	Cong Wang, Jiri Pirko, David S. Miller, Jakub Kicinski,
	Vedang Patel

While testing the software based scheduling of the taprio scheduler
new TCP connection failed to establish. Digging it down let to a missing
validity check in the enqueue function. Add the missing check.

v1..v2:
Fix a typo
Add a acked-by

Benedikt Spranger (1):
  net/sched: taprio: Check if socket flags are valid

 net/sched/sch_taprio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.20.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/1] net/sched: taprio: Check if socket flags are valid
  2022-04-08  9:47 [PATCH v2 0/1] net/sched: taprio: Check if sk_flags are valid Benedikt Spranger
@ 2022-04-08  9:47 ` Benedikt Spranger
  2022-04-11 10:00 ` [PATCH v2 0/1] net/sched: taprio: Check if sk_flags " patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Benedikt Spranger @ 2022-04-08  9:47 UTC (permalink / raw)
  To: netdev
  Cc: Kurt Kanzenbach, Vinicius Costa Gomes, Jamal Hadi Salim,
	Cong Wang, Jiri Pirko, David S. Miller, Jakub Kicinski,
	Vedang Patel

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>
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
 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..a871b3ef4bca 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 safe to use on full sockets. */
+	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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 0/1]  net/sched: taprio: Check if sk_flags are valid
  2022-04-08  9:47 [PATCH v2 0/1] net/sched: taprio: Check if sk_flags are valid Benedikt Spranger
  2022-04-08  9:47 ` [PATCH v2 1/1] net/sched: taprio: Check if socket flags " Benedikt Spranger
@ 2022-04-11 10:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-11 10:00 UTC (permalink / raw)
  To: Benedikt Spranger
  Cc: netdev, kurt, vinicius.gomes, jhs, xiyou.wangcong, jiri, davem,
	kuba, vedang.patel

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri,  8 Apr 2022 11:47:44 +0200 you wrote:
> While testing the software based scheduling of the taprio scheduler
> new TCP connection failed to establish. Digging it down let to a missing
> validity check in the enqueue function. Add the missing check.
> 
> v1..v2:
> Fix a typo
> Add a acked-by
> 
> [...]

Here is the summary with links:
  - [v2,1/1] net/sched: taprio: Check if socket flags are valid
    https://git.kernel.org/netdev/net/c/e8a64bbaaad1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-11 10:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-08  9:47 [PATCH v2 0/1] net/sched: taprio: Check if sk_flags are valid Benedikt Spranger
2022-04-08  9:47 ` [PATCH v2 1/1] net/sched: taprio: Check if socket flags " Benedikt Spranger
2022-04-11 10:00 ` [PATCH v2 0/1] net/sched: taprio: Check if sk_flags " patchwork-bot+netdevbpf

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.