android_kernel_samsung_sm8650/drivers
Yang Yingliang 7f21735ffb rbd: fix possible memory leak in rbd_sysfs_init()
If device_register() returns error in rbd_sysfs_init(), name of kobject
which is allocated in dev_set_name() called in device_add() is leaked.

As comment of device_add() says, it should call put_device() to drop
the reference count that was set in device_initialize() when it fails,
so the name can be freed in kobject_cleanup().

Fault injection test can trigger this problem:

unreferenced object 0xffff88810173aa78 (size 8):
  comm "modprobe", pid 247, jiffies 4294714278 (age 31.789s)
  hex dump (first 8 bytes):
    72 62 64 00 81 88 ff ff                          rbd.....
  backtrace:
    [<00000000f58fae56>] __kmalloc_node_track_caller+0x44/0x1b0
    [<00000000bdd44fe7>] kstrdup+0x3a/0x70
    [<00000000f7844d0b>] kstrdup_const+0x63/0x80
    [<000000001b0a0eeb>] kvasprintf_const+0x10b/0x190
    [<00000000a47bd894>] kobject_set_name_vargs+0x56/0x150
    [<00000000d5edbf18>] dev_set_name+0xab/0xe0
    [<00000000f5153e80>] device_add+0x106/0x1f20

Fixes: dfc5606dc5 ("rbd: replace the rbd sysfs interface")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Link: https://lore.kernel.org/r/20221027091918.2294132-1-yangyingliang@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-10-27 07:15:30 -06:00
..
accessibility
acpi platform-drivers-x86 for v6.1-1 2022-10-05 10:38:24 -07:00
amba
android
ata ata changes for 6.1-rc1 2022-10-07 10:48:49 -07:00
atm
auxdisplay
base RISC-V Patches for the 6.1 Merge Window, Part 1 2022-10-09 13:24:01 -07:00
bcma
block rbd: fix possible memory leak in rbd_sysfs_init() 2022-10-27 07:15:30 -06:00
bluetooth
bus Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
cdrom
char TTY/Serial driver update for 6.1-rc1 2022-10-07 16:36:24 -07:00
clk Here's the main clk pull request for this merge window. We have some 2022-10-08 10:06:48 -07:00
clocksource
comedi
connector
counter gpio updates for v6.1-rc1 2022-10-08 09:46:29 -07:00
cpufreq Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
cpuidle RISC-V Patches for the 6.1 Merge Window, Part 1 2022-10-09 13:24:01 -07:00
crypto * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
cxl
dax devdax: Fix soft-reservation memory description 2022-09-24 18:05:53 -07:00
dca
devfreq PM / devfreq: rockchip-dfi: Fix an error message 2022-09-26 03:59:43 +09:00
dio
dma dmaengine updates for v6.1-rc1 2022-10-07 15:56:34 -07:00
dma-buf whack-a-mole: cropped up open-coded file_inode() uses... 2022-10-06 17:22:11 -07:00
edac Merge branches 'edac-drivers' and 'edac-misc' into edac-updates-for-v6.1 2022-10-04 10:00:25 +02:00
eisa
extcon Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
firewire
firmware EFI updates for v6.1 2022-10-09 08:56:54 -07:00
fpga Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
fsi fsi: core: Check error number after calling ida_simple_get 2022-09-28 21:10:57 +09:30
gnss
gpio gpio updates for v6.1-rc1 2022-10-08 09:46:29 -07:00
gpu Driver core changes for 6.1-rc1 2022-10-07 17:04:10 -07:00
greybus
hid Assorted HID drivers updates and fixes for 6.1 2022-10-07 11:13:42 -07:00
hsi
hte
hv Merge branch 'acpi-dev' 2022-09-30 20:05:16 +02:00
hwmon Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
hwspinlock
hwtracing Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
i2c ARM: driver updates for 6.1 2022-10-06 11:04:57 -07:00
i3c
idle
iio Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
infiniband v6.1 merge window pull request 2022-10-07 12:05:29 -07:00
input * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
interconnect
iommu Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
ipack Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
irqchip arm64 updates for 6.1: 2022-10-06 11:51:49 -07:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-10-03 17:44:18 -07:00
leds platform-drivers-x86 for v6.1-1 2022-10-05 10:38:24 -07:00
macintosh powerpc updates for 6.1 2022-10-09 14:05:15 -07:00
mailbox mailbox: qcom-ipcc: flag IRQ NO_THREAD 2022-10-05 21:51:58 -05:00
mcb
md for-6.1/passthrough-2022-10-04 2022-10-07 09:35:50 -07:00
media USB/Thunderbolt changes for 6.1-rc1 2022-10-07 16:48:26 -07:00
memory
memstick
message
mfd - Core Frameworks 2022-10-07 11:24:20 -07:00
misc Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
mmc TTY/Serial driver update for 6.1-rc1 2022-10-07 16:36:24 -07:00
most
mtd Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
mux
net TTY/Serial driver update for 6.1-rc1 2022-10-07 16:36:24 -07:00
nfc
ntb
nubus
nvdimm Merge branch 'for-6.0/dax' into libnvdimm-fixes 2022-09-24 18:14:12 -07:00
nvme nvmet: fix invalid memory reference in nvmet_subsys_attr_qid_max_show 2022-10-19 12:43:13 +02:00
nvmem nvmem: u-boot-env: fix crc32 casting type 2022-09-24 14:56:37 +02:00
of * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
opp
parisc asm-generic updates for v6.1 2022-10-06 12:10:37 -07:00
parport
pci
pcmcia pcmcia: remove AT91RM9200 Compact Flash driver 2022-09-27 08:12:16 +02:00
peci
perf RISC-V Patches for the 6.1 Merge Window, Part 1 2022-10-09 13:24:01 -07:00
phy USB/Thunderbolt changes for 6.1-rc1 2022-10-07 16:48:26 -07:00
pinctrl ARM: driver updates for 6.1 2022-10-06 11:04:57 -07:00
platform platform-drivers-x86 for v6.1-1 2022-10-05 10:38:24 -07:00
pnp PNPBIOS: remove unused pnpid32_to_pnpid() declaration 2022-09-24 18:07:42 +02:00
power power supply and reset changes for the v6.1 series 2022-10-07 11:48:30 -07:00
powercap powercap: intel_rapl: Use standard Energy Unit for SPR Dram RAPL domain 2022-09-24 19:32:46 +02:00
pps
ps3
ptp ptp: Remove usage of the deprecated ida_simple_xxx API 2022-09-27 17:33:11 -07:00
pwm pwm: Changes for v6.1-rc1 2022-10-07 11:32:10 -07:00
rapidio
ras
regulator - Core Frameworks 2022-10-07 11:24:20 -07:00
remoteproc remoteproc: virtio: Fix warning on bindings by removing the of_match_table 2022-10-05 09:20:44 -06:00
reset Here's the main clk pull request for this merge window. We have some 2022-10-08 10:06:48 -07:00
rpmsg
rtc
s390 s390 updates for the 6.1 merge window 2022-10-09 13:51:40 -07:00
sbus
scsi SCSI misc on 20221007 2022-10-07 12:33:18 -07:00
sh
siox
slimbus slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register 2022-09-24 14:53:06 +02:00
soc Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
soundwire soundwire updates for 6.1-rc1 2022-10-07 16:13:55 -07:00
spi spi: Updates for v6.1 2022-10-04 19:36:53 -07:00
spmi spmi: pmic-arb: increase SPMI transaction timeout delay 2022-09-30 14:33:23 +02:00
ssb
staging Here's the main clk pull request for this merge window. We have some 2022-10-08 10:06:48 -07:00
target SCSI misc on 20221007 2022-10-07 12:33:18 -07:00
tc
tee ARM: driver updates for 6.1 2022-10-06 11:04:57 -07:00
thermal Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
thunderbolt USB/Thunderbolt changes for 6.1-rc1 2022-10-07 16:48:26 -07:00
tty TTY/Serial driver update for 6.1-rc1 2022-10-07 16:36:24 -07:00
ufs SCSI misc on 20221007 2022-10-07 12:33:18 -07:00
uio
usb USB/Thunderbolt changes for 6.1-rc1 2022-10-07 16:48:26 -07:00
vdpa Networking changes for 6.1. 2022-10-04 13:38:03 -07:00
vfio
vhost Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-10-03 17:44:18 -07:00
video drm pull for 6.1-rc1 2022-10-05 11:24:12 -07:00
virt Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
virtio
vlynq
w1 Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
watchdog powerpc updates for 6.1 2022-10-09 14:05:15 -07:00
xen SCSI misc on 20221007 2022-10-07 12:33:18 -07:00
zorro
Kconfig
Makefile