Linux kernel modifications for the Kernel Hacking exam
Find a file
Stephen Hemminger c07ff8592d netem: fix return value if duplicate enqueue fails
There is a bug in netem_enqueue() introduced by
commit 5845f70638 ("net: netem: fix skb length BUG_ON in __skb_to_sgvec")
that can lead to a use-after-free.

This commit made netem_enqueue() always return NET_XMIT_SUCCESS
when a packet is duplicated, which can cause the parent qdisc's q.qlen
to be mistakenly incremented. When this happens qlen_notify() may be
skipped on the parent during destruction, leaving a dangling pointer
for some classful qdiscs like DRR.

There are two ways for the bug happen:

- If the duplicated packet is dropped by rootq->enqueue() and then
  the original packet is also dropped.
- If rootq->enqueue() sends the duplicated packet to a different qdisc
  and the original packet is dropped.

In both cases NET_XMIT_SUCCESS is returned even though no packets
are enqueued at the netem qdisc.

The fix is to defer the enqueue of the duplicate packet until after
the original packet has been guaranteed to return NET_XMIT_SUCCESS.

Fixes: 5845f70638 ("net: netem: fix skb length BUG_ON in __skb_to_sgvec")
Reported-by: Budimir Markovic <markovicbudimir@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20240819175753.5151-1-stephen@networkplumber.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-08-20 17:03:34 -07:00
arch KVM: x86: Disallow read-only memslots for SEV-ES and SEV-SNP (and TDX) 2024-08-14 12:28:24 -04:00
block
certs
crypto
Documentation Including fixes from wireless and netfilter 2024-08-15 10:35:20 -07:00
drivers net: dsa: mv88e6xxx: Fix out-of-bound access 2024-08-20 16:53:21 -07:00
fs for-6.11-rc3-tag 2024-08-14 17:56:15 -07:00
include kcm: Serialise kcm_sendmsg() for the same socket. 2024-08-19 18:36:12 -07:00
init
io_uring
ipc
kernel vfs-6.11-rc4.fixes 2024-08-14 09:06:28 -07:00
lib
LICENSES
mm 9 hotfixes. 5 are cc:stable, 4 either pertain to post-6.10 material or 2024-08-08 07:32:20 -07:00
net netem: fix return value if duplicate enqueue fails 2024-08-20 17:03:34 -07:00
rust
samples
scripts
security selinux: revert our use of vma_is_initial_heap() 2024-08-08 16:22:47 -04:00
sound ASoC: Fixes for v6.11 2024-08-09 09:58:07 +02:00
tools selftests: udpgro: no need to load xdp for gro 2024-08-19 09:54:24 +01:00
usr
virt KVM: x86: Disallow read-only memslots for SEV-ES and SEV-SNP (and TDX) 2024-08-14 12:28:24 -04:00
.clang-format
.cocciconfig
.editorconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS MAINTAINERS: add selftests to network drivers 2024-08-15 19:13:12 -07:00
Makefile Linux 6.11-rc3 2024-08-11 14:27:14 -07:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the reStructuredText markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.