No description
  • C 98.2%
  • Assembly 1%
  • Makefile 0.3%
  • Shell 0.2%
  • Python 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jakub Kicinski 598c956b62 netlink: terminate outstanding dump on socket close
[ Upstream commit 1904fb9ebf911441f90a68e96b22aa73e4410505 ]

Netlink supports iterative dumping of data. It provides the families
the following ops:
 - start - (optional) kicks off the dumping process
 - dump  - actual dump helper, keeps getting called until it returns 0
 - done  - (optional) pairs with .start, can be used for cleanup
The whole process is asynchronous and the repeated calls to .dump
don't actually happen in a tight loop, but rather are triggered
in response to recvmsg() on the socket.

This gives the user full control over the dump, but also means that
the user can close the socket without getting to the end of the dump.
To make sure .start is always paired with .done we check if there
is an ongoing dump before freeing the socket, and if so call .done.

The complication is that sockets can get freed from BH and .done
is allowed to sleep. So we use a workqueue to defer the call, when
needed.

Unfortunately this does not work correctly. What we defer is not
the cleanup but rather releasing a reference on the socket.
We have no guarantee that we own the last reference, if someone
else holds the socket they may release it in BH and we're back
to square one.

The whole dance, however, appears to be unnecessary. Only the user
can interact with dumps, so we can clean up when socket is closed.
And close always happens in process context. Some async code may
still access the socket after close, queue notification skbs to it etc.
but no dumps can start, end or otherwise make progress.

Delete the workqueue and flush the dump state directly from the release
handler. Note that further cleanup is possible in -next, for instance
we now always call .done before releasing the main module reference,
so dump doesn't have to take a reference of its own.

Reported-by: syzkaller <syzkaller@googlegroups.com>
Fixes: ed5d7788a9 ("netlink: Do not schedule work from sk_destruct")
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20241106015235.2458807-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-12-14 19:44:18 +01:00
arch powerpc/powernv: Free name on error in opal_event_init() 2024-11-17 14:58:53 +01:00
block blk-rq-qos: fix crash on rq_qos_wait vs. rq_qos_wake_function race 2024-11-08 16:20:48 +01:00
certs
crypto crypto: aead,cipher - zeroize key buffer after use 2024-11-08 16:20:33 +01:00
Documentation dt-bindings: gpu: Convert Samsung Image Rotator to dt-schema 2024-11-08 16:20:52 +01:00
drivers md/raid10: improve code of mrdev in raid10_sync_request 2024-11-17 14:58:53 +01:00
fs fs: Fix uninitialized value issue in from_kuid and from_kgid 2024-11-17 14:58:53 +01:00
include mm: add remap_pfn_range_notrack 2024-11-17 14:58:53 +01:00
init init: open /initrd.image with O_LARGEFILE 2024-04-13 12:51:36 +02:00
ipc ipc: replace costly bailout check in sysvipc_find_ipc() 2024-09-04 13:15:02 +02:00
kernel bpf: use kvzmalloc to allocate BPF verifier environment 2024-11-17 14:58:53 +01:00
lib debugobjects: Fix conditions in fill_pool() 2024-11-08 16:20:34 +01:00
LICENSES
mm mm: avoid leaving partial pfn mappings around in error case 2024-11-17 14:58:53 +01:00
net netlink: terminate outstanding dump on socket close 2024-12-14 19:44:18 +01:00
samples
scripts scripts: kconfig: merge_config: config files: add a trailing newline 2024-11-08 16:20:24 +01:00
security security/keys: fix slab-out-of-bounds in key_task_permission 2024-11-17 14:58:50 +01:00
sound sound: Make CONFIG_SND depend on INDIRECT_IOMEM instead of UML 2024-11-17 14:58:53 +01:00
tools usbip: tools: Fix detach_port() invalid port error path 2024-11-08 16:20:53 +01:00
usr
virt KVM: Fix a data race on last_boosted_vcpu in kvm_vcpu_on_spin() 2024-11-08 16:20:47 +01:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore Remove *.orig pattern from .gitignore 2024-11-08 16:20:33 +01:00
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile Linux 5.4.286 2024-11-17 14:58:53 +01: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 Restructured Text 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.