linux-stable/drivers
Lukasz Majczak 826e525597 drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper()
commit 3d887d5124 upstream.

As drm_dp_get_mst_branch_device_by_guid() is called from
drm_dp_get_mst_branch_device_by_guid(), mstb parameter has to be checked,
otherwise NULL dereference may occur in the call to
the memcpy() and cause following:

[12579.365869] BUG: kernel NULL pointer dereference, address: 0000000000000049
[12579.365878] #PF: supervisor read access in kernel mode
[12579.365880] #PF: error_code(0x0000) - not-present page
[12579.365882] PGD 0 P4D 0
[12579.365887] Oops: 0000 [#1] PREEMPT SMP NOPTI
...
[12579.365895] Workqueue: events_long drm_dp_mst_up_req_work
[12579.365899] RIP: 0010:memcmp+0xb/0x29
[12579.365921] Call Trace:
[12579.365927] get_mst_branch_device_by_guid_helper+0x22/0x64
[12579.365930] drm_dp_mst_up_req_work+0x137/0x416
[12579.365933] process_one_work+0x1d0/0x419
[12579.365935] worker_thread+0x11a/0x289
[12579.365938] kthread+0x13e/0x14f
[12579.365941] ? process_one_work+0x419/0x419
[12579.365943] ? kthread_blkcg+0x31/0x31
[12579.365946] ret_from_fork+0x1f/0x30

As get_mst_branch_device_by_guid_helper() is recursive, moving condition
to the first line allow to remove a similar one for step over of NULL elements
inside a loop.

Fixes: 5e93b8208d ("drm/dp/mst: move GUID storage from mgr, port to only mst branch")
Cc: <stable@vger.kernel.org> # 4.14+
Signed-off-by: Lukasz Majczak <lma@semihalf.com>
Reviewed-by: Radoslaw Biernacki <rad@chromium.org>
Signed-off-by: Manasi Navare <navaremanasi@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230922063410.23626-1-lma@semihalf.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-11-08 11:21:07 +01:00
..
accessibility
acpi ACPI: irq: Fix incorrect return value in acpi_register_gsi() 2023-10-25 11:13:33 +02:00
amba amba: bus: fix refcount leak 2023-09-23 10:46:59 +02:00
android
ata ata: libata-eh: Fix compilation warning in ata_eh_link_report() 2023-10-25 11:13:32 +02:00
atm
auxdisplay
base regmap: fix NULL deref on lookup 2023-10-25 11:13:31 +02:00
bcma
block
bluetooth Bluetooth: vhci: Fix race when opening vhci device 2023-10-25 11:13:31 +02:00
bus
cdrom
char parisc: sba: Fix compile warning wrt list of SBA devices 2023-10-10 21:43:39 +02:00
clk clk: tegra: fix error return case for recalc_rate 2023-10-10 21:43:39 +02:00
clocksource
connector
cpufreq cpufreq: powernow-k8: Use related_cpus instead of cpus in driver.exit() 2023-09-23 10:46:54 +02:00
cpuidle
crypto crypto: stm32 - fix loop iterating through scatterlist for DMA 2023-09-23 10:47:01 +02:00
dax
dca
devfreq PM / devfreq: Fix leak in devfreq_dev_release() 2023-09-23 10:46:59 +02:00
dio
dma dmaengine: ste_dma40: Add missing IRQ check in d40_probe 2023-09-23 10:46:59 +02:00
dma-buf dma-buf/sw_sync: Avoid recursive lock during fence signal 2023-08-30 16:35:16 +02:00
edac
eisa
extcon
firewire
firmware
fmc
fpga
fsi
gpio gpio: vf610: set value before the direction to avoid a glitch 2023-10-25 11:13:33 +02:00
gpu drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper() 2023-11-08 11:21:07 +01:00
hid HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event 2023-10-25 11:13:32 +02:00
hsi
hv
hwmon
hwspinlock
hwtracing
i2c i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node() 2023-11-08 11:21:06 +01:00
ide
idle
iio iio: pressure: ms5611: ms5611_prom_is_valid false negative bug 2023-10-25 11:13:30 +02:00
infiniband RDMA/cxgb4: Check skb value for failure to allocate 2023-10-25 11:13:29 +02:00
input Input: xpad - add PXN V900 support 2023-10-25 11:13:30 +02:00
iommu
ipack
irqchip
isdn
leds
lightnvm
macintosh
mailbox
mcb mcb-lpc: Reallocate memory region to avoid memory overlapping 2023-11-08 11:21:05 +01:00
md md/raid1: fix error: ISO C90 forbids mixed declarations 2023-09-23 10:47:05 +02:00
media media: dvb: symbol fixup for dvb_attach() - again 2023-10-10 21:43:40 +02:00
memory
memstick
message
mfd
misc
mmc mmc: core: Capture correct oemid-bits for eMMC cards 2023-10-25 11:13:33 +02:00
mtd ubi: Refuse attaching if mtd's erasesize is 0 2023-10-10 21:43:41 +02:00
mux
net i40e: Fix wrong check for I40E_TXR_FLAGS_WB_ON_ITR 2023-11-08 11:21:06 +01:00
nfc
ntb ntb: Fix calculation ntb_transport_tx_free_entry() 2023-09-23 10:47:00 +02:00
nubus
nvdimm
nvme
nvmem
of of: unittest: fix null pointer dereferencing in of_unittest_find_node_by_name() 2023-09-23 10:46:56 +02:00
oprofile
parisc parisc: iosapic.c: Fix sparse warnings 2023-10-10 21:43:39 +02:00
parport
pci Revert "PCI: Mark NVIDIA T4 GPUs to avoid bus reset" 2023-09-23 10:47:00 +02:00
pcmcia
perf
phy
pinctrl Revert "pinctrl: avoid unsafe code pattern in find_pinctrl()" 2023-10-25 11:13:33 +02:00
platform
pnp
power
powercap
pps
ps3
ptp
pwm pwm: lpc32xx: Remove handling of PWM channels 2023-09-23 10:47:02 +02:00
rapidio
ras
regulator
remoteproc
reset
rpmsg rpmsg: glink: Add check for kstrdup 2023-09-23 10:46:59 +02:00
rtc rtc: ds1685: use EXPORT_SYMBOL_GPL for ds1685_rtc_poweroff 2023-09-23 10:46:52 +02:00
s390 scsi: zfcp: Fix a double put in zfcp_port_enqueue() 2023-10-10 21:43:40 +02:00
sbus
scsi scsi: qla2xxx: Turn off noisy message log 2023-09-23 10:47:01 +02:00
sfi
sh
sn
soc
spi spi: tegra20-sflash: fix to check return value of platform_get_irq() in tegra_sflash_probe() 2023-09-23 10:46:54 +02:00
spmi
ssb
staging
target scsi: target: core: Fix deadlock due to recursive locking 2023-10-10 21:43:41 +02:00
tc
tee
thermal
thunderbolt
tty vc_screen: reload load of struct vc_data pointer in vcs_write() to avoid UAF 2023-10-10 21:43:40 +02:00
uio
usb USB: serial: option: add Fibocom to DELL custom modem FM101R-GL 2023-10-25 11:13:33 +02:00
uwb
vfio
vhost
video fbdev/sh7760fb: Depend on FB=y 2023-10-10 21:43:39 +02:00
virt
virtio virtio_balloon: Fix endless deflation and inflation on arm64 2023-11-08 11:21:05 +01:00
vlynq
vme
w1
watchdog watchdog: iTCO_wdt: Set NO_REBOOT if the watchdog is not already running 2023-10-10 21:43:39 +02:00
xen xen/events: replace evtchn_rwlock with RCU 2023-10-10 21:43:42 +02:00
zorro
Kconfig
Makefile