linux-IllusionX/drivers
Yang Yingliang 09776d9374 iio: buffer: Fix double-free in iio_buffers_alloc_sysfs_and_mask()
When __iio_buffer_alloc_sysfs_and_mask() failed, 'unwind_idx' should be
set to 'i - 1' to prevent double-free when cleanup resources.

BUG: KASAN: double-free or invalid-free in __iio_buffer_free_sysfs_and_mask+0x32/0xb0 [industrialio]
Call Trace:
 kfree+0x117/0x4c0
 __iio_buffer_free_sysfs_and_mask+0x32/0xb0 [industrialio]
 iio_buffers_alloc_sysfs_and_mask+0x60d/0x1570 [industrialio]
 __iio_device_register+0x483/0x1a30 [industrialio]
 ina2xx_probe+0x625/0x980 [ina2xx_adc]

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: ee708e6baa ("iio: buffer: introduce support for attaching more IIO buffers")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211013094923.2473-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-10-17 15:24:18 +01:00
..
accessibility
acpi Revert "ACPI: Add memory semantics to acpi_os_map_memory()" 2021-09-23 20:39:36 +02:00
amba
android binder: make sure fd closes complete 2021-09-14 09:02:13 +02:00
ata libata: Add ATA_HORKAGE_NO_NCQ_ON_ATI for Samsung 860 and 870 SSD. 2021-09-03 08:06:02 -06:00
atm
auxdisplay
base Device properties framework fix for 5.15-rc3 2021-09-24 11:20:29 -07:00
bcma
block virtio,vdpa,vhost: features, fixes 2021-09-11 14:48:42 -07:00
bluetooth
bus ARM: SoC drivers for 5.15 2021-09-01 15:25:28 -07:00
cdrom
char IPMI: A couple of very minor fixes for style and rate limiting 2021-09-12 11:44:58 -07:00
clk One patch to fix an unused variable warning in a Qualcomm clk driver. 2021-09-11 10:05:56 -07:00
clocksource - converted Pistachio platform to use MIPS generic kernel 2021-09-03 11:11:54 -07:00
comedi comedi: Fix memory leak in compat_insnlist() 2021-09-21 17:53:54 +02:00
connector
counter
cpufreq Power management fixes for 5.15-rc2 2021-09-17 12:05:04 -07:00
cpuidle - Core Frameworks 2021-09-07 12:38:59 -07:00
crypto pci-v5.15-changes 2021-09-07 19:13:42 -07:00
cxl cxl for v5.15 2021-09-09 11:48:27 -07:00
dax libnvdimm for v5.15 2021-09-09 11:39:57 -07:00
dca
devfreq devfreq: use HZ macros 2021-09-08 11:50:26 -07:00
dio
dma dmaengine updates for v5.15-rc1 2021-09-09 11:07:47 -07:00
dma-buf dma-buf: DMABUF_SYSFS_STATS should depend on DMA_SHARED_BUFFER 2021-09-07 12:42:21 +05:30
edac EDAC/dmc520: Assign the proper type to dimm->edac_mode 2021-09-16 11:00:12 +02:00
eisa
extcon
firewire FireWire (IEEE 1394) subsystem updates: 2021-09-11 09:47:33 -07:00
firmware - Add the tegra3 thermal sensor and fix the compilation testing on 2021-09-11 09:20:57 -07:00
fpga fpga: dfl: Avoid reads to AFU CSRs during enumeration 2021-09-16 15:20:55 -07:00
fsi
gnss
gpio gpio/rockchip: fix get_direction value handling 2021-09-22 11:31:52 +02:00
gpu drm fixes for 5.15-rc3 2021-09-24 10:14:19 -07:00
greybus
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid 2021-09-02 14:30:46 -07:00
hsi
hv hyperv-fixes for 5.15-rc2 2021-09-15 17:18:56 -07:00
hwmon Merge branch 'akpm' (patches from Andrew) 2021-09-08 12:55:35 -07:00
hwspinlock
hwtracing coresight: syscfg: Fix compiler warning 2021-09-14 09:03:16 +02:00
i2c platform-drivers-x86 for v5.15-1 2021-09-02 13:49:39 -07:00
i3c
idle
iio iio: buffer: Fix double-free in iio_buffers_alloc_sysfs_and_mask() 2021-10-17 15:24:18 +01:00
infiniband RDMA v5.15 merge window 2nd Pull Request 2021-09-09 11:14:14 -07:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2021-09-11 09:08:28 -07:00
interconnect
iommu virtio,vdpa,vhost: features, fixes 2021-09-11 14:48:42 -07:00
ipack
irqchip irqchip/gic: Work around broken Renesas integration 2021-09-22 14:44:25 +01:00
isdn Kbuild updates for v5.15 2021-09-03 15:33:47 -07:00
leds
macintosh memblock: introduce saner 'memblock_free_ptr()' interface 2021-09-14 13:23:22 -07:00
mailbox
mcb mcb: fix error handling in mcb_alloc_bus() 2021-09-14 11:22:26 +02:00
md md: fix a lock order reversal in md_alloc 2021-09-22 08:45:58 -07:00
media Merge branch 'akpm' (patches from Andrew) 2021-09-08 12:55:35 -07:00
memory
memstick
message
mfd - Core Frameworks 2021-09-07 12:38:59 -07:00
misc misc: bcm-vk: fix tty registration race 2021-09-21 16:17:15 +02:00
mmc Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
most
mtd Merge branch 'akpm' (patches from Andrew) 2021-09-08 12:55:35 -07:00
mux
net Networking fixes for 5.15-rc3. 2021-09-23 10:30:31 -07:00
nfc nfc: st-nci: Add SPI ID matching DT compatible 2021-09-23 12:53:06 +01:00
ntb Bug fixes and clean-ups for Linux v5.15 2021-09-07 13:05:02 -07:00
nubus
nvdimm cxl for v5.15 2021-09-09 11:48:27 -07:00
nvme nvme: keep ctrl->namespaces ordered 2021-09-21 09:17:15 +02:00
nvmem nvmem: NVMEM_NINTENDO_OTP should depend on WII 2021-09-21 17:38:37 +02:00
of of: restricted dma: Fix condition for rmem init 2021-09-17 15:58:09 -05:00
opp
parisc parisc: Move pci_dev_is_behind_card_dino to where it is used 2021-09-09 12:44:31 +02:00
parport parisc architecture updates for kernel 5.15: 2021-09-02 13:16:00 -07:00
pci xen: branch for v5.15-rc3 2021-09-25 15:37:31 -07:00
pcmcia
perf
phy Merge branch 'akpm' (patches from Andrew) 2021-09-08 12:55:35 -07:00
pinctrl Kbuild updates for v5.15 2021-09-03 15:33:47 -07:00
platform platform/x86: gigabyte-wmi: add support for B550I Aorus Pro AX 2021-09-21 15:49:23 +02:00
pnp
power
powercap
pps
ps3
ptp ptp: ocp: add COMMON_CLK dependency 2021-09-20 11:11:54 +01:00
pwm pwm: mtk-disp: Implement atomic API .get_state() 2021-09-02 22:27:46 +02:00
rapidio
ras
regulator regulator: max14577: Revert "regulator: max14577: Add proper module aliases strings" 2021-09-17 13:16:38 +01:00
remoteproc
reset ARM: SoC drivers for 5.15 2021-09-01 15:25:28 -07:00
rpmsg
rtc rtc: cmos: Disable irq around direct invocation of cmos_interrupt() 2021-09-14 10:20:19 +02:00
s390 Networking fixes for 5.15-rc3. 2021-09-23 10:30:31 -07:00
sbus
scsi scsi: ses: Retry failed Send/Receive Diagnostic commands 2021-09-22 00:36:40 -04:00
sh
siox
slimbus
soc ARM: SoC drivers for 5.15 2021-09-01 15:25:28 -07:00
soundwire
spi spi: Fix modalias issues 2021-09-22 11:58:24 -07:00
spmi
ssb
staging staging: r8188eu: prevent array underflow in rtw_hal_update_ra_mask() 2021-10-05 12:35:30 +02:00
target scsi: target: Fix spelling mistake "CONFLIFT" -> "CONFLICT" 2021-09-22 00:17:29 -04:00
tc
tee
thermal thermal/drivers/tsens: Fix wrong check for tzd in irq handlers 2021-09-21 15:17:11 +02:00
thunderbolt thunderbolt: test: split up test cases in tb_test_credit_alloc_all 2021-09-06 12:27:03 -07:00
tty tty: unexport tty_ldisc_release 2021-09-14 11:18:47 +02:00
uio
usb USB-serial fixes for 5.15-rc3 2021-09-24 10:22:53 +02:00
vdpa virtio,vdpa,vhost: features, fixes 2021-09-11 14:48:42 -07:00
vfio VFIO update for v5.15-rc1 2021-09-02 13:41:33 -07:00
vhost Networking fixes for 5.15-rc2, including fixes from bpf. 2021-09-16 13:05:42 -07:00
video tgafb: clarify dependencies 2021-09-18 11:15:01 -07:00
virt
virtio virtio,vdpa,vhost: features, fixes 2021-09-11 14:48:42 -07:00
visorbus
vlynq
vme
w1
watchdog
xen xen: branch for v5.15-rc3 2021-09-25 15:37:31 -07:00
zorro
Kconfig
Makefile