linux-uconsole/drivers
Yang Yingliang c358255ff1 serial: 8250: fix null-ptr-deref in serial8250_start_tx()
commit f4c23a140d upstream.

I got null-ptr-deref in serial8250_start_tx():

[   78.114630] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[   78.123778] Mem abort info:
[   78.126560]   ESR = 0x86000007
[   78.129603]   EC = 0x21: IABT (current EL), IL = 32 bits
[   78.134891]   SET = 0, FnV = 0
[   78.137933]   EA = 0, S1PTW = 0
[   78.141064] user pgtable: 64k pages, 48-bit VAs, pgdp=00000027d41a8600
[   78.147562] [0000000000000000] pgd=00000027893f0003, p4d=00000027893f0003, pud=00000027893f0003, pmd=00000027c9a20003, pte=0000000000000000
[   78.160029] Internal error: Oops: 86000007 [#1] SMP
[   78.164886] Modules linked in: sunrpc vfat fat aes_ce_blk crypto_simd cryptd aes_ce_cipher crct10dif_ce ghash_ce sha2_ce sha256_arm64 sha1_ce ses enclosure sg sbsa_gwdt ipmi_ssif spi_dw_mmio sch_fq_codel vhost_net tun vhost vhost_iotlb tap ip_tables ext4 mbcache jbd2 ahci hisi_sas_v3_hw libahci hisi_sas_main libsas hns3 scsi_transport_sas hclge libata megaraid_sas ipmi_si hnae3 ipmi_devintf ipmi_msghandler br_netfilter bridge stp llc nvme nvme_core xt_sctp sctp libcrc32c dm_mod nbd
[   78.207383] CPU: 11 PID: 23258 Comm: null-ptr Not tainted 5.8.0-rc6+ #48
[   78.214056] Hardware name: Huawei TaiShan 2280 V2/BC82AMDC, BIOS 2280-V2 CS V3.B210.01 03/12/2020
[   78.222888] pstate: 80400089 (Nzcv daIf +PAN -UAO BTYPE=--)
[   78.228435] pc : 0x0
[   78.230618] lr : serial8250_start_tx+0x160/0x260
[   78.235215] sp : ffff800062eefb80
[   78.238517] x29: ffff800062eefb80 x28: 0000000000000fff
[   78.243807] x27: ffff800062eefd80 x26: ffff202fd83b3000
[   78.249098] x25: ffff800062eefd80 x24: ffff202fd83b3000
[   78.254388] x23: ffff002fc5e50be8 x22: 0000000000000002
[   78.259679] x21: 0000000000000001 x20: 0000000000000000
[   78.264969] x19: ffffa688827eecc8 x18: 0000000000000000
[   78.270259] x17: 0000000000000000 x16: 0000000000000000
[   78.275550] x15: ffffa68881bc67a8 x14: 00000000000002e6
[   78.280841] x13: ffffa68881bc67a8 x12: 000000000000c539
[   78.286131] x11: d37a6f4de9bd37a7 x10: ffffa68881cccff0
[   78.291421] x9 : ffffa68881bc6000 x8 : ffffa688819daa88
[   78.296711] x7 : ffffa688822a0f20 x6 : ffffa688819e0000
[   78.302002] x5 : ffff800062eef9d0 x4 : ffffa68881e707a8
[   78.307292] x3 : 0000000000000000 x2 : 0000000000000002
[   78.312582] x1 : 0000000000000001 x0 : ffffa688827eecc8
[   78.317873] Call trace:
[   78.320312]  0x0
[   78.322147]  __uart_start.isra.9+0x64/0x78
[   78.326229]  uart_start+0xb8/0x1c8
[   78.329620]  uart_flush_chars+0x24/0x30
[   78.333442]  n_tty_receive_buf_common+0x7b0/0xc30
[   78.338128]  n_tty_receive_buf+0x44/0x2c8
[   78.342122]  tty_ioctl+0x348/0x11f8
[   78.345599]  ksys_ioctl+0xd8/0xf8
[   78.348903]  __arm64_sys_ioctl+0x2c/0xc8
[   78.352812]  el0_svc_common.constprop.2+0x88/0x1b0
[   78.357583]  do_el0_svc+0x44/0xd0
[   78.360887]  el0_sync_handler+0x14c/0x1d0
[   78.364880]  el0_sync+0x140/0x180
[   78.368185] Code: bad PC value

SERIAL_PORT_DFNS is not defined on each arch, if it's not defined,
serial8250_set_defaults() won't be called in serial8250_isa_init_ports(),
so the p->serial_in pointer won't be initialized, and it leads a null-ptr-deref.
Fix this problem by calling serial8250_set_defaults() after init uart port.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200721143852.4058352-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-29 10:16:56 +02:00
..
accessibility
acpi ACPI: video: Use native backlight on Acer TravelMate 5735Z 2020-07-22 09:32:05 +02:00
amba
android binder: Don't use mmput() from shrinker function. 2020-07-29 10:16:54 +02:00
ata ata/libata: Fix usage of page address by page_address in ata_scsi_mode_select_xlat function 2020-06-30 23:17:13 -04:00
atm fore200e: Fix incorrect checks of NULL pointer dereference 2020-02-24 08:34:42 +01:00
auxdisplay
base regmap: dev_get_regmap_match(): fix string comparison 2020-07-29 10:16:53 +02:00
bcma bcma: fix incorrect update of BCMA_CORE_PCI_MDIO_DATA 2020-01-27 14:51:09 +01:00
block Revert "zram: convert remaining CLASS_ATTR() to CLASS_ATTR_RO()" 2020-07-22 09:32:10 +02:00
bluetooth Bluetooth: hci_bcm: fix freeing not-requested IRQ 2020-06-22 09:05:26 +02:00
bus bus: sunxi-rsb: Return correct data when mixing 16-bit and 8-bit reads 2020-04-17 10:48:37 +02:00
cdrom
char virtio: virtio_console: add missing MODULE_DEVICE_TABLE() for rproc serial 2020-07-22 09:32:10 +02:00
clk clk: sprd: return correct type of value for _sprd_pll_recalc_rate 2020-06-25 15:33:00 +02:00
clocksource clocksource: dw_apb_timer_of: Fix missing clockevent timers 2020-06-22 09:05:11 +02:00
connector
cpufreq cpufreq: intel_pstate: Only mention the BIOS disabling turbo mode once 2020-05-20 08:18:40 +02:00
cpuidle cpuidle: Fix three reference count leaks 2020-06-22 09:05:20 +02:00
crypto crypto: omap-sham - add proper load balancing support for multicore 2020-06-25 15:33:02 +02:00
dax
dca
devfreq Revert "PM / devfreq: Modify the device name as devfreq(X) for sysfs" 2020-03-05 16:42:18 +01:00
dio
dma dmaengine: ioat setting ioat timeout as module parameter 2020-07-29 10:16:53 +02:00
dma-buf
edac EDAC/amd64: Read back the scrub rate PCI register on F15h 2020-07-09 09:37:09 +02:00
eisa
extcon extcon: adc-jack: Fix an error handling path in 'adc_jack_probe()' 2020-06-25 15:33:01 +02:00
firewire
firmware drivers/firmware/psci: Fix memory leakage in alloc_init_cpu_groups() 2020-07-29 10:16:46 +02:00
fmc
fpga fpga: dfl: fix bug in port reset handshake 2020-07-29 10:16:48 +02:00
fsi fsi: sbefifo: Don't fail operations when in SBE IPL state 2020-01-27 14:51:00 +01:00
gnss gnss: sirf: fix error return code in sirf_probe() 2020-06-22 09:05:28 +02:00
gpio gpio: arizona: put pm_runtime in case of failure 2020-07-29 10:16:44 +02:00
gpu drm: sun4i: hdmi: Fix inverted HPD result 2020-07-29 10:16:49 +02:00
hid HID: apple: Disable Fn-key key-re-mapping on clone keyboards 2020-07-29 10:16:52 +02:00
hsi
hv x86/Hyper-V: Report crash data in die() when panic_on_oops is set 2020-04-23 10:30:17 +02:00
hwmon hwmon: (scmi) Fix potential buffer overflow in scmi_hwmon_probe() 2020-07-29 10:16:54 +02:00
hwspinlock
hwtracing intel_th: Fix a NULL dereference when hub driver is not loaded 2020-07-22 09:32:12 +02:00
i2c i2c: rcar: always clear ICSAR to avoid side effects 2020-07-29 10:16:50 +02:00
ide ide: serverworks: potential overflow in svwks_set_pio_mode() 2020-02-24 08:34:49 +01:00
idle
iio iio:health:afe4404 Fix timestamp alignment and prevent data leak. 2020-07-22 09:32:05 +02:00
infiniband IB/umem: fix reference count leak in ib_umem_odp_get() 2020-07-29 10:16:47 +02:00
input Input: synaptics - enable InterTouch for ThinkPad X1E 1st gen 2020-07-29 10:16:53 +02:00
iommu irqdomain/treewide: Keep firmware node unconditionally allocated 2020-07-29 10:16:46 +02:00
ipack ipack: tpci200: fix error return code in tpci200_register() 2020-05-27 17:37:43 +02:00
irqchip irqchip/gic: Atomically update affinity 2020-07-09 09:37:12 +02:00
isdn PCI: add USR vendor id and use it in r8169 and w6692 driver 2020-06-22 09:05:23 +02:00
leds leds: pca963x: Fix open-drain initialization 2020-02-24 08:34:35 +01:00
lightnvm lightnvm: pblk: fix lock order in pblk_rb_tear_down_check 2020-01-27 14:50:45 +01:00
macintosh drivers/macintosh: Fix memleak in windfarm_pm112 driver 2020-06-22 09:05:29 +02:00
mailbox mailbox: qcom-apcs: fix max_register value 2020-01-27 14:51:14 +01:00
mcb
md dm: use noio when sending kobject event 2020-07-16 08:17:27 +02:00
media media: ov5640: fix use of destroyed mutex 2020-06-22 09:05:27 +02:00
memory memory: tegra: Don't invoke Tegra30+ specific memory timing setup on Tegra20 2020-01-27 14:50:13 +01:00
memstick
message scsi: mptscsih: Fix read sense data size 2020-07-16 08:17:23 +02:00
mfd mfd: wm8994: Fix driver operation if loaded as modules 2020-06-25 15:32:50 +02:00
misc misc: atmel-ssc: lock with mutex instead of spinlock 2020-07-22 09:32:12 +02:00
mmc mmc: sdhci: do not enable card detect interrupt for gpio cd type 2020-07-22 09:32:04 +02:00
mtd mtd: rawnand: oxnas: Release all devices in the _remove() path 2020-07-22 09:32:07 +02:00
mux
net bonding: check return value of register_netdevice() in bond_newlink() 2020-07-29 10:16:51 +02:00
nfc NFC: st21nfca: add missed kfree_skb() in an error path 2020-06-10 21:34:59 +02:00
ntb NTB: perf: Fix race condition when run with ntb_test 2020-06-25 15:33:03 +02:00
nubus
nvdimm libnvdimm: Fix endian conversion issues 2020-06-07 13:17:53 +02:00
nvme nvme-rdma: assign completion vector correctly 2020-07-16 08:17:23 +02:00
nvmem nvmem: qfprom: remove incorrect write support 2020-06-10 21:35:00 +02:00
of of: of_mdio: Correct loop scanning logic 2020-07-22 09:32:03 +02:00
opp OPP: Fix missing debugfs supply directory for OPPs 2020-01-27 14:50:04 +01:00
oprofile
parisc
parport
pci irqdomain/treewide: Keep firmware node unconditionally allocated 2020-07-29 10:16:46 +02:00
pcmcia
perf drivers/perf: hisi: Fix wrong value for all counters enable 2020-06-25 15:33:04 +02:00
phy phy: sun4i-usb: fix dereference of pointer phy0 before it is null checked 2020-07-22 09:32:05 +02:00
pinctrl pinctrl: amd: fix npins for uart0 in kerncz_groups 2020-07-29 10:16:44 +02:00
platform platform/x86: intel-vbtn: Only blacklist SW_TABLET_MODE on the 9 / "Laptop" chasis-type 2020-06-22 09:05:20 +02:00
pnp
power power: supply: smb347-charger: IRQSTAT_D is volatile 2020-06-25 15:32:55 +02:00
powercap
pps
ps3
ptp ptp: free ptp device pin descriptors properly 2020-01-23 08:21:35 +01:00
pwm pwm: img: Call pm_runtime_put() in pm_runtime_get_sync() failed case 2020-06-25 15:32:51 +02:00
rapidio rapidio: fix an error in get_user_pages_fast() error handling 2020-05-27 17:37:43 +02:00
ras
regulator regualtor: pfuze100: correct sw1a/sw2 on pfuze3000 2020-06-30 23:17:10 -04:00
remoteproc remoteproc: Fix IDR initialisation in rproc_alloc() 2020-06-25 15:32:47 +02:00
reset reset: uniphier: Add SCSSI reset control for each channel 2020-02-24 08:34:44 +01:00
rpmsg rpmsg: glink: Remove chunk size word align warning 2020-04-13 10:45:16 +02:00
rtc rtc: 88pm860x: fix possible race condition 2020-04-23 10:30:18 +02:00
s390 scsi: zfcp: Fix panic on ERP timeout for previously dismissed ERP action 2020-06-30 23:17:08 -04:00
sbus
scsi scsi: scsi_transport_spi: Fix function pointer check 2020-07-29 10:16:45 +02:00
sfi
sh
siox
slimbus slimbus: core: Fix mismatch in of_node_get/put 2020-07-22 09:32:07 +02:00
sn
soc soc: qcom: rpmh: Dirt can only make you dirtier, not cleaner 2020-07-29 10:16:44 +02:00
soundwire
spi spi: mediatek: use correct SPI_CFG2_REG MACRO 2020-07-29 10:16:52 +02:00
spmi
ssb
staging staging: comedi: addi_apci_1564: check INSN_CONFIG_DIGITAL_TRIG shift 2020-07-29 10:16:56 +02:00
target scsi: target: tcmu: Fix a use after free in tcmu_check_expired_queue_cmd() 2020-06-25 15:32:59 +02:00
tc
tee tee: optee: Fix compilation issue with nommu 2020-02-05 14:43:50 +00:00
thermal thermal/drivers/cpufreq_cooling: Fix wrong frequency converted from power 2020-07-22 09:32:12 +02:00
thunderbolt thunderbolt: Drop duplicated get_switch_at_route() 2020-05-27 17:37:40 +02:00
tty serial: 8250: fix null-ptr-deref in serial8250_start_tx() 2020-07-29 10:16:56 +02:00
uio uio_pdrv_genirq: fix use without device tree and no interrupt 2020-07-22 09:32:11 +02:00
usb usb: xhci: Fix ASM2142/ASM3142 DMA addressing 2020-07-29 10:16:55 +02:00
uwb
vfio vfio/mdev: Fix reference count leak in add_mdev_supported_type 2020-06-25 15:33:01 +02:00
vhost vhost/vsock: fix packet delivery order to monitoring devices 2020-05-27 17:37:32 +02:00
video backlight: lp855x: Ensure regulators are disabled on probe failure 2020-06-25 15:32:48 +02:00
virt virt: vbox: Fix guest capabilities mask check 2020-07-22 09:32:10 +02:00
virtio virtio_balloon: prevent pfn array overflow 2020-02-24 08:34:54 +01:00
visorbus visorbus: fix uninitialized variable access 2020-02-24 08:34:47 +01:00
vlynq
vme vme: bridges: reduce stack usage 2020-02-24 08:34:47 +01:00
w1 w1: omap-hdq: cleanup to add missing newline for some dev_dbg 2020-06-22 09:05:30 +02:00
watchdog watchdog: da9062: No need to ping manually before setting timeout 2020-06-25 15:32:58 +02:00
xen xen/pvcalls-back: test for errors when calling backend_connect() 2020-06-22 09:05:09 +02:00
zorro
Kconfig
Makefile