diff mbox series

net/sched: initialize noop_qdisc owner

Message ID 20240607175340.786bfb938803.I493bf8422e36be4454c08880a8d3703cea8e421a@changeid (mailing list archive)
State Accepted
Commit 44180feaccf266d9b0b28cc4ceaac019817deb5c
Delegated to: Netdev Maintainers
Headers show
Series net/sched: initialize noop_qdisc owner | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 872 this patch: 872
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers fail 5 blamed authors not CCed: kuba@kernel.org victor@mojatatu.com edumazet@google.com jhs@mojatatu.com pctammela@mojatatu.com; 8 maintainers not CCed: pabeni@redhat.com xiyou.wangcong@gmail.com edumazet@google.com jhs@mojatatu.com kuba@kernel.org victor@mojatatu.com pctammela@mojatatu.com jiri@resnulli.us
netdev/build_clang success Errors and warnings before: 868 this patch: 868
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 876 this patch: 876
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-06-09--21-00 (tests: 644)

Commit Message

Johannes Berg June 7, 2024, 3:53 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

When the noop_qdisc owner isn't initialized, then it will be 0,
so packets will erroneously be regarded as having been subject
to recursion as long as only CPU 0 queues them. For non-SMP,
that's all packets, of course. This causes a change in what's
reported to userspace, normally noop_qdisc would drop packets
silently, but with this change the syscall returns -ENOBUFS if
RECVERR is also set on the socket.

Fix this by initializing the owner field to -1, just like it
would be for dynamically allocated qdiscs by qdisc_alloc().

Fixes: 0f022d32c3ec ("net/sched: Fix mirred deadlock on device recursion")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/sched/sch_generic.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Eric Dumazet June 8, 2024, 8:05 a.m. UTC | #1
On 6/7/24 17:53, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> When the noop_qdisc owner isn't initialized, then it will be 0,
> so packets will erroneously be regarded as having been subject
> to recursion as long as only CPU 0 queues them. For non-SMP,
> that's all packets, of course. This causes a change in what's
> reported to userspace, normally noop_qdisc would drop packets
> silently, but with this change the syscall returns -ENOBUFS if
> RECVERR is also set on the socket.
>
> Fix this by initializing the owner field to -1, just like it
> would be for dynamically allocated qdiscs by qdisc_alloc().
>
> Fixes: 0f022d32c3ec ("net/sched: Fix mirred deadlock on device recursion")
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>


I found this quite by luck.

Please CC maintainers next time, and blamed patch authors :/

Believe it or not, I do not follow netdev@ traffic.

Reviewed-by: Eric Dumazet <edumazet@google.com>

Thanks.
patchwork-bot+netdevbpf@kernel.org June 11, 2024, 2:40 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri,  7 Jun 2024 17:53:32 +0200 you wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> When the noop_qdisc owner isn't initialized, then it will be 0,
> so packets will erroneously be regarded as having been subject
> to recursion as long as only CPU 0 queues them. For non-SMP,
> that's all packets, of course. This causes a change in what's
> reported to userspace, normally noop_qdisc would drop packets
> silently, but with this change the syscall returns -ENOBUFS if
> RECVERR is also set on the socket.
> 
> [...]

Here is the summary with links:
  - net/sched: initialize noop_qdisc owner
    https://git.kernel.org/netdev/net/c/44180feaccf2

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index d3f6006b563c..fb32984d7a16 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -673,6 +673,7 @@  struct Qdisc noop_qdisc = {
 		.qlen = 0,
 		.lock = __SPIN_LOCK_UNLOCKED(noop_qdisc.skb_bad_txq.lock),
 	},
+	.owner = -1,
 };
 EXPORT_SYMBOL(noop_qdisc);