Go to file
Wang Liang d0e34c9f79 net: atm: fix memory leak in atm_register_sysfs when device_register fail
[ Upstream commit 0a228624bc ]

When device_register() return error in atm_register_sysfs(), which can be
triggered by kzalloc fail in device_private_init() or other reasons,
kmemleak reports the following memory leaks:

unreferenced object 0xffff88810182fb80 (size 8):
  comm "insmod", pid 504, jiffies 4294852464
  hex dump (first 8 bytes):
    61 64 75 6d 6d 79 30 00                          adummy0.
  backtrace (crc 14dfadaf):
    __kmalloc_node_track_caller_noprof+0x335/0x450
    kvasprintf+0xb3/0x130
    kobject_set_name_vargs+0x45/0x120
    dev_set_name+0xa9/0xe0
    atm_register_sysfs+0xf3/0x220
    atm_dev_register+0x40b/0x780
    0xffffffffa000b089
    do_one_initcall+0x89/0x300
    do_init_module+0x27b/0x7d0
    load_module+0x54cd/0x5ff0
    init_module_from_file+0xe4/0x150
    idempotent_init_module+0x32c/0x610
    __x64_sys_finit_module+0xbd/0x120
    do_syscall_64+0xa8/0x270
    entry_SYSCALL_64_after_hwframe+0x77/0x7f

When device_create_file() return error in atm_register_sysfs(), the same
issue also can be triggered.

Function put_device() should be called to release kobj->name memory and
other device resource, instead of kfree().

Fixes: 1fa5ae857b ("driver core: get rid of struct device's bus_id string array")
Signed-off-by: Wang Liang <wangliang74@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250901063537.1472221-1-wangliang74@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-09-09 18:43:58 +02:00
arch powerpc: boot: Remove leading zero in label in udelay() 2025-09-09 18:43:56 +02:00
block
certs
crypto crypto: algif_hash - fix double free in hash_accept 2025-06-04 14:32:35 +02:00
Documentation Documentation: ACPI: Fix parent device references 2025-08-28 16:21:23 +02:00
drivers net: thunder_bgx: decrement cleanup index before use 2025-09-09 18:43:58 +02:00
fs efivarfs: Fix slab-out-of-bounds in efivarfs_d_compare 2025-09-04 14:05:55 +02:00
include atm: atmtcp: Prevent arbitrary write in atmtcp_recv_control(). 2025-09-04 14:05:54 +02:00
init bpfilter: match bit size of bpfilter_umh to that of the kernel 2025-07-17 18:24:51 +02:00
ipc ipc: fix to protect IPCS lookups using RCU 2025-06-27 11:02:52 +01:00
kernel ftrace: Fix potential warning in trace_printk_seq during ftrace_dump 2025-09-04 14:05:53 +02:00
lib lib: test_objagg: Set error message in check_expect_hints_stats() 2025-07-17 18:24:56 +02:00
LICENSES
mm mm: perform the mapping_map_writable() check after call_mmap() 2025-08-28 16:21:36 +02:00
net net: atm: fix memory leak in atm_register_sysfs when device_register fail 2025-09-09 18:43:58 +02:00
samples samples: mei: Fix building on musl libc 2025-08-28 16:21:19 +02:00
scripts kbuild: Add KBUILD_CPPFLAGS to as-option invocation 2025-08-28 16:21:33 +02:00
security securityfs: don't pin dentries twice, once is enough... 2025-08-28 16:21:24 +02:00
sound ALSA: usb-audio: Use correct sub-type for UAC3 feature unit validation 2025-08-28 16:21:37 +02:00
tools act_mirred: use the backlog for nested calls to mirred ingress 2025-08-28 16:21:36 +02:00
usr kbuild: hdrcheck: fix cross build with clang 2025-07-17 18:24:51 +02:00
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS platform: Add Surface platform directory 2025-06-27 11:02:56 +01:00
Makefile Linux 5.4.298 2025-09-04 14:05:56 +02: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.