Go to file
Masahiro Yamada ff83cd07bf genksyms: fix memory leak when the same symbol is read from *.symref file
[ Upstream commit be2fa44b51 ]

When a symbol that is already registered is read again from *.symref
file, __add_symbol() removes the previous one from the hash table without
freeing it.

[Test Case]

  $ cat foo.c
  #include <linux/export.h>
  void foo(void);
  void foo(void) {}
  EXPORT_SYMBOL(foo);

  $ cat foo.symref
  foo void foo ( void )
  foo void foo ( void )

When a symbol is removed from the hash table, it must be freed along
with its ->name and ->defn members. However, sym->name cannot be freed
because it is sometimes shared with node->string, but not always. If
sym->name and node->string share the same memory, free(sym->name) could
lead to a double-free bug.

To resolve this issue, always assign a strdup'ed string to sym->name.

Fixes: 64e6c1e123 ("genksyms: track symbol checksum changes")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-02-21 13:49:23 +01:00
arch ARM: dts: mediatek: mt7623: fix IR nodename 2025-02-21 13:49:16 +01:00
block
certs
crypto
Documentation
drivers net: sh_eth: Fix missing rtnl lock in suspend/resume path 2025-02-21 13:49:23 +01:00
fs ubifs: skip dumping tnc tree when zroot is null 2025-02-21 13:49:21 +01:00
include module: Extend the preempt disabled section in dereference_symbol_descriptor(). 2025-02-21 13:49:20 +01:00
init
io_uring
ipc
kernel PM: hibernate: Add error handling for syscore_suspend() 2025-02-21 13:49:22 +01:00
lib
LICENSES
mm
net net: hsr: fix fill_frame_info() regression vs VLAN packets 2025-02-21 13:49:23 +01:00
rust
samples
scripts genksyms: fix memory leak when the same symbol is read from *.symref file 2025-02-21 13:49:23 +01:00
security landlock: Handle weird files 2025-02-21 13:49:04 +01:00
sound ALSA: hda/realtek - Fixed headphone distorted sound on Acer Aspire A115-31 laptop 2025-02-21 13:49:09 +01:00
tools net: netdevsim: try to close UDP port harness races 2025-02-21 13:49:22 +01:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
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.