linux-stable/drivers
Pavel Skripkin 8afbbbbca1 net: caif: fix memory leak in ldisc_open
[ Upstream commit 58af3d3d54 ]

Syzbot reported memory leak in tty_init_dev().
The problem was in unputted tty in ldisc_open()

static int ldisc_open(struct tty_struct *tty)
{
...
	ser->tty = tty_kref_get(tty);
...
	result = register_netdevice(dev);
	if (result) {
		rtnl_unlock();
		free_netdev(dev);
		return -ENODEV;
	}
...
}

Ser pointer is netdev private_data, so after free_netdev()
this pointer goes away with unputted tty reference. So, fix
it by adding tty_kref_put() before freeing netdev.

Reported-and-tested-by: syzbot+f303e045423e617d2cad@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-06-30 08:48:58 -04:00
..
accessibility
acpi ACPI: scan: Fix a memory leak in an error handling path 2021-05-22 10:57:40 +02:00
amba
android
ata ata: libahci_platform: fix IRQ check 2021-05-22 10:57:31 +02:00
atm atm: idt77252: fix null-ptr-dereference 2021-03-30 14:40:09 +02:00
auxdisplay
base Revert "PM: runtime: Update device status before letting suppliers suspend" 2021-03-24 11:04:55 +01:00
bcma
block xen-blkback: don't leak persistent grants from xen_blkbk_map() 2021-03-30 14:40:13 +02:00
bluetooth
bus bus: qcom: Put child node before return 2021-05-22 10:57:28 +02:00
cdrom cdrom: gdrom: initialize global variable at init time 2021-05-26 11:47:00 +02:00
char char: hpet: add checks after calling ioremap 2021-06-03 08:36:21 +02:00
clk clk: exynos7: Mark aclk_fsys1_200 as critical 2021-05-22 10:57:41 +02:00
clocksource
connector
cpufreq
cpuidle
crypto crypto: qat - Fix a double free in adf_create_ring 2021-05-22 10:57:29 +02:00
dax
dca
devfreq
dio
dma dmaengine: pl330: fix wrong usage of spinlock flags in dma_cyclc 2021-06-30 08:48:54 -04:00
dma-buf
edac
eisa
extcon extcon: arizona: Fix some issues when HPDET IRQ fires after the jack has been unplugged 2021-05-22 10:57:18 +02:00
firewire firewire: nosy: Fix a use-after-free bug in nosy_ioctl() 2021-04-07 12:47:03 +02:00
firmware efi: cper: fix snprintf() use in cper_dimm_err_location() 2021-06-10 12:43:49 +02:00
fmc
fpga
fsi
gpio gpiolib: acpi: Add quirk to ignore EC wakeups on Dell Venue 10 Pro 5055 2021-05-22 10:57:42 +02:00
gpu drm/radeon: wait for moving fence after pinning 2021-06-30 08:48:56 -04:00
hid HID: gt683r: add missing MODULE_DEVICE_TABLE 2021-06-30 08:48:46 -04:00
hsi HSI: core: fix resource leaks in hsi_add_client_from_dt() 2021-05-22 10:57:31 +02:00
hv Drivers: hv: vmbus: Increase wait time for VMbus unload 2021-05-22 10:57:30 +02:00
hwmon hwmon: (scpi-hwmon) shows the negative temperature properly 2021-06-30 08:48:52 -04:00
hwspinlock
hwtracing intel_th: pci: Add Alder Lake-M support 2021-05-22 10:57:21 +02:00
i2c i2c: mpc: implement erratum A-004447 workaround 2021-06-16 11:53:02 +02:00
ide
idle
iio iio: adc: ad7793: Add missing error code in ad7793_setup() 2021-06-03 08:36:16 +02:00
infiniband RDMA/rxe: Clear all QP fields if creation failed 2021-05-26 11:46:58 +02:00
input Input: silead - add workaround for x86 BIOS-es which bring the chip up in a stuck state 2021-05-22 10:57:42 +02:00
iommu iommu/vt-d: Fix sysfs leak in alloc_iommu() 2021-06-03 08:36:12 +02:00
ipack
irqchip
isdn isdn: mISDN: netjet: Fix crash in nj_probe: 2021-06-16 11:53:00 +02:00
leds leds: lp5523: check return value of lp5xx_read and jump to cleanup code 2021-05-26 11:47:01 +02:00
lightnvm
macintosh
mailbox
mcb
md dm snapshot: properly fix a crash when an origin has no snapshots 2021-06-03 08:36:15 +02:00
media media: gspca: properly check for errors in po1030_probe() 2021-06-03 08:36:21 +02:00
memory memory: gpmc: fix out of bounds read and dereference on gpmc_cs[] 2021-05-22 10:57:26 +02:00
memstick
message
mfd mfd: stm32-timers: Avoid clearing auto reload register 2021-05-22 10:57:31 +02:00
misc platform/x86: hp_accel: Avoid invoking _INI to speed up resume 2021-06-03 08:36:20 +02:00
mmc mmc: core: Set read only for SD cards with permanent write protect bit 2021-05-22 10:57:15 +02:00
mtd mtd: rawnand: gpmi: Fix a double free in gpmi_nand_init 2021-05-22 10:57:28 +02:00
mux
net net: caif: fix memory leak in ldisc_open 2021-06-30 08:48:58 -04:00
nfc nfc: pn533: prevent potential memory corruption 2021-05-22 10:57:32 +02:00
ntb
nubus
nvdimm
nvme nvme-loop: check for NVME_LOOP_Q_LIVE in nvme_loop_destroy_admin_queue() 2021-06-30 08:48:47 -04:00
nvmem
of Revert "fdt: Properly handle "no-map" field in the memory region" 2021-05-22 10:57:35 +02:00
oprofile
parisc
parport
pci Revert "PCI: PM: Do not read power state in pci_enable_device_flags()" 2021-06-30 08:48:57 -04:00
pcmcia
perf perf/arm_pmu_platform: Fix error handling 2021-05-22 10:57:17 +02:00
phy phy: marvell: ARMADA375_USBCLUSTER_PHY should not default to y, unconditionally 2021-05-22 10:57:28 +02:00
pinctrl pinctrl: samsung: use 'int' for register masks in Exynos 2021-05-22 10:57:36 +02:00
platform platform/x86: intel_punit_ipc: Append MODULE_DEVICE_TABLE for ACPI 2021-06-03 08:36:22 +02:00
pnp
power power: supply: s3c_adc_battery: fix possible use-after-free in s3c_adc_bat_remove() 2021-05-22 10:57:19 +02:00
powercap
pps
ps3
ptp
pwm
rapidio rapidio: handle create_workqueue() failure 2021-05-26 11:46:59 +02:00
ras
regulator regulator: max77620: Use device_set_of_node_from_dev() 2021-06-16 11:53:04 +02:00
remoteproc
reset
rpmsg rpmsg: qcom_glink_native: fix error return code of qcom_glink_rx_data() 2021-05-22 10:57:38 +02:00
rtc rtc: ds1307: Fix wday settings for rx8130 2021-05-22 10:57:38 +02:00
s390
sbus
scsi scsi: core: Only put parent device if host state differs from SHOST_CREATED 2021-06-16 11:53:04 +02:00
sfi
sh
sn
soc soc: qcom: mdt_loader: Detect truncated read of segments 2021-05-22 10:57:29 +02:00
spi spi: Fix use-after-free with devm_spi_alloc_* 2021-05-22 10:57:29 +02:00
spmi
ssb
staging staging: rtl8723bs: Fix uninitialized variables 2021-06-16 11:53:02 +02:00
target scsi: target: core: Fix warning on realtime kernels 2021-06-30 08:48:46 -04:00
tc
tee tee: optee: do not check memref size on return from Secure World 2021-05-22 10:57:16 +02:00
thermal thermal/core/fair share: Lock the thermal zone while looping over instances 2021-05-22 10:57:41 +02:00
thunderbolt thunderbolt: dma_port: Fix NVM read buffer bounds and offset issue 2021-06-03 08:36:15 +02:00
tty serial: max310x: unregister uart driver in case of failure and abort 2021-06-03 08:36:20 +02:00
uio
usb usb: dwc3: core: fix kernel panic when do reboot 2021-06-30 08:48:55 -04:00
uwb
vfio vfio/platform: fix module_put call in error flow 2021-06-10 12:43:50 +02:00
vhost vhost: Fix vhost_vq_reset() 2021-04-07 12:47:01 +02:00
video video: hgafb: correctly handle card detect failure during probe 2021-05-26 11:47:01 +02:00
virt
virtio
vlynq
vme
w1
watchdog
xen xen-pciback: redo VF placement in the virtual topology 2021-06-10 12:43:53 +02:00
zorro
Kconfig
Makefile