Xie Yongji
353ca06c86
BACKPORT: virtio-blk: Use blk_validate_block_size() to validate block size
The block layer can't support a block size larger than
page size yet. And a block size that's too small or
not a power of two won't work either. If a misconfigured
device presents an invalid block size in configuration space,
it will result in the kernel crash something like below:
[ 506.154324] BUG: kernel NULL pointer dereference, address: 0000000000000008
[ 506.160416] RIP: 0010:create_empty_buffers+0x24/0x100
[ 506.174302] Call Trace:
[ 506.174651] create_page_buffers+0x4d/0x60
[ 506.175207] block_read_full_page+0x50/0x380
[ 506.175798] ? __mod_lruvec_page_state+0x60/0xa0
[ 506.176412] ? __add_to_page_cache_locked+0x1b2/0x390
[ 506.177085] ? blkdev_direct_IO+0x4a0/0x4a0
[ 506.177644] ? scan_shadow_nodes+0x30/0x30
[ 506.178206] ? lru_cache_add+0x42/0x60
[ 506.178716] do_read_cache_page+0x695/0x740
[ 506.179278] ? read_part_sector+0xe0/0xe0
[ 506.179821] read_part_sector+0x36/0xe0
[ 506.180337] adfspart_check_ICS+0x32/0x320
[ 506.180890] ? snprintf+0x45/0x70
[ 506.181350] ? read_part_sector+0xe0/0xe0
[ 506.181906] bdev_disk_changed+0x229/0x5c0
[ 506.182483] blkdev_get_whole+0x6d/0x90
[ 506.183013] blkdev_get_by_dev+0x122/0x2d0
[ 506.183562] device_add_disk+0x39e/0x3c0
[ 506.184472] virtblk_probe+0x3f8/0x79b [virtio_blk]
[ 506.185461] virtio_dev_probe+0x15e/0x1d0 [virtio]
So let's use a block layer helper to validate the block size.
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/r/20211026144015.188-5-xieyongji@bytedance.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 57a13a5b8157d9a8606490aaa1b805bafe6c37e1)
[keirf@: Implement missing error path]
Bug: 226679849
Signed-off-by: Keir Fraser <keirf@google.com>
Change-Id: I78cde1101baf8da2f68d0b9f942a0f1ec89fb30e
(cherry picked from commit 588affc843da96cda1747b4caa8fcd9bd8796d3c)
|
2022-04-28 11:35:38 +00:00 |
| .. |
|
accessibility
|
|
|
|
acpi
|
This is the 5.4.180 stable release
|
2022-02-16 17:17:22 +01:00 |
|
amba
|
This is the 5.4.158 stable release
|
2021-11-06 14:08:38 +01:00 |
|
android
|
Merge branch 'android11-5.4' into 'android11-5.4-lts'
|
2022-02-11 16:21:49 +01:00 |
|
ata
|
libata: if T_LENGTH is zero, dma direction should be DMA_NONE
|
2021-12-22 09:29:39 +01:00 |
|
atm
|
|
|
|
auxdisplay
|
auxdisplay: ht16k33: Fix frame buffer device blanking
|
2021-11-17 09:48:45 +01:00 |
|
base
|
This is the 5.4.180 stable release
|
2022-02-16 17:17:22 +01:00 |
|
bcma
|
bcma: Fix memory leak for internally-handled cores
|
2021-09-15 09:47:37 +02:00 |
|
block
|
BACKPORT: virtio-blk: Use blk_validate_block_size() to validate block size
|
2022-04-28 11:35:38 +00:00 |
|
bluetooth
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
bus
|
bus: ti-sysc: Use CLKDM_NOAUTO for dra7 dcan1 for errata i893
|
2021-10-13 10:08:19 +02:00 |
|
cdrom
|
|
|
|
char
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
clk
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
clocksource
|
This is the 5.4.160 stable release
|
2021-11-17 10:19:21 +01:00 |
|
connector
|
|
|
|
counter
|
counter: 104-quad-8: Return error when invalid mode during ceiling_write
|
2021-09-15 09:47:34 +02:00 |
|
cpufreq
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
cpuidle
|
This is the 5.4.160 stable release
|
2021-11-17 10:19:21 +01:00 |
|
crypto
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
dax
|
|
|
|
dca
|
|
|
|
devfreq
|
|
|
|
dio
|
|
|
|
dma
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
dma-buf
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
edac
|
EDAC/xgene: Fix deferred probing
|
2022-02-08 18:24:34 +01:00 |
|
eisa
|
|
|
|
extcon
|
|
|
|
firewire
|
|
|
|
firmware
|
Merge tag 'android11-5.4.180_r00' into android11-5.4
|
2022-03-21 12:44:03 +01:00 |
|
fpga
|
fpga: machxo2-spi: Fix missing error code in machxo2_write_complete()
|
2021-09-30 10:09:23 +02:00 |
|
fsi
|
|
|
|
gnss
|
|
|
|
gpio
|
gpio: aspeed: Convert aspeed_gpio.lock to raw_spinlock
|
2022-01-27 09:19:43 +01:00 |
|
gpu
|
This is the 5.4.180 stable release
|
2022-02-16 17:17:22 +01:00 |
|
greybus
|
|
|
|
hid
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
hsi
|
HSI: core: Fix return freed object in hsi_new_client
|
2022-01-27 09:19:41 +01:00 |
|
hv
|
hyperv/vmbus: include linux/bitops.h
|
2021-11-17 09:48:20 +01:00 |
|
hwmon
|
This is the 5.4.180 stable release
|
2022-02-16 17:17:22 +01:00 |
|
hwspinlock
|
|
|
|
hwtracing
|
|
|
|
i2c
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
i3c
|
|
|
|
ide
|
|
|
|
idle
|
|
|
|
iio
|
iio: adc: stm32: fix a current leak by resetting pcsel before disabling vdda
|
2021-12-22 09:29:35 +01:00 |
|
infiniband
|
This is the 5.4.178 stable release
|
2022-02-09 14:02:29 +01:00 |
|
input
|
Input: touchscreen - Fix backport of a02dcde595f7cbd240ccd64de96034ad91cffc40
|
2022-01-11 15:23:30 +01:00 |
|
interconnect
|
|
|
|
iommu
|
This is the 5.4.178 stable release
|
2022-02-09 14:02:29 +01:00 |
|
ipack
|
ipack: ipoctal: fix module reference leak
|
2021-10-06 15:42:36 +02:00 |
|
irqchip
|
This is the 5.4.165 stable release
|
2021-12-14 15:19:08 +01:00 |
|
isdn
|
mISDN: change function names to avoid conflicts
|
2022-01-11 15:23:33 +01:00 |
|
leds
|
|
|
|
lightnvm
|
|
|
|
macintosh
|
|
|
|
mailbox
|
|
|
|
mcb
|
mcb: fix error handling in mcb_alloc_bus()
|
2021-09-30 10:09:22 +02:00 |
|
md
|
Revert "ANDROID: dm-bow: Protect Ranges fetched and erased from the RB tree"
|
2022-03-31 11:20:47 +00:00 |
|
media
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
memory
|
memory: fsl_ifc: fix leak of irq and nand_irq in fsl_ifc_ctrl_probe
|
2021-11-17 09:48:42 +01:00 |
|
memstick
|
memstick: jmb38x_ms: use appropriate free function in jmb38x_ms_alloc_host()
|
2021-11-17 09:48:37 +01:00 |
|
message
|
|
|
|
mfd
|
Merge 5.4.172 into android11-5.4-lts
|
2022-01-17 10:00:47 +01:00 |
|
misc
|
This is the 5.4.180 stable release
|
2022-02-16 17:17:22 +01:00 |
|
mmc
|
Merge tag 'android11-5.4.180_r00' into android11-5.4
|
2022-03-21 12:44:03 +01:00 |
|
mtd
|
This is the 5.4.176 stable release
|
2022-02-01 17:48:27 +01:00 |
|
mux
|
|
|
|
net
|
UPSTREAM: sr9700: sanity check for packet length
|
2022-03-24 13:17:21 +00:00 |
|
nfc
|
NFC: st21nfca: Fix memory leak in device probe and remove
|
2022-01-05 12:37:44 +01:00 |
|
ntb
|
NTB: perf: Fix an error code in perf_setup_inbuf()
|
2021-09-22 12:26:44 +02:00 |
|
nubus
|
|
|
|
nvdimm
|
libnvdimm/pmem: Fix crash triggered when I/O in-flight during unbind
|
2021-10-06 15:42:38 +02:00 |
|
nvme
|
nvme-tcp: fix bogus request completion when failing to send AER
|
2022-02-16 12:52:49 +01:00 |
|
nvmem
|
This is the 5.4.155 stable release
|
2021-10-20 12:35:49 +02:00 |
|
of
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
opp
|
This is the 5.4.160 stable release
|
2021-11-17 10:19:21 +01:00 |
|
oprofile
|
|
|
|
parisc
|
parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries
|
2022-01-27 09:19:53 +01:00 |
|
parport
|
parport: remove non-zero check on count
|
2021-09-22 12:26:36 +02:00 |
|
pci
|
This is the 5.4.177 stable release
|
2022-02-09 12:23:04 +01:00 |
|
pcmcia
|
pcmcia: fix setting of kthread task states
|
2022-01-27 09:19:37 +01:00 |
|
perf
|
|
|
|
phy
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
pinctrl
|
This is the 5.4.178 stable release
|
2022-02-09 14:02:29 +01:00 |
|
platform
|
This is the 5.4.170 stable release
|
2022-01-05 13:23:05 +01:00 |
|
pnp
|
|
|
|
power
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
powercap
|
|
|
|
pps
|
|
|
|
ps3
|
|
|
|
ptp
|
ptp_pch: Load module automatically if ID matches
|
2021-10-13 10:08:19 +02:00 |
|
pwm
|
Merge 5.4.149 into android11-5.4-lts
|
2021-10-01 14:07:54 +02:00 |
|
rapidio
|
|
|
|
ras
|
|
|
|
regulator
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
remoteproc
|
|
|
|
reset
|
This is the 5.4.160 stable release
|
2021-11-17 10:19:21 +01:00 |
|
rpmsg
|
This is the 5.4.176 stable release
|
2022-02-01 17:48:27 +01:00 |
|
rtc
|
This is the 5.4.178 stable release
|
2022-02-09 14:02:29 +01:00 |
|
s390
|
scsi: zfcp: Fix failed recovery on gone remote port with non-NPIV FCP devices
|
2022-02-01 17:24:33 +01:00 |
|
sbus
|
|
|
|
scsi
|
This is the 5.4.180 stable release
|
2022-02-16 17:17:22 +01:00 |
|
sfi
|
|
|
|
sh
|
maple: fix wrong return value of maple_bus_init().
|
2021-11-26 10:47:17 +01:00 |
|
siox
|
|
|
|
slimbus
|
|
|
|
soc
|
This is the 5.4.178 stable release
|
2022-02-09 14:02:29 +01:00 |
|
soundwire
|
|
|
|
spi
|
This is the 5.4.178 stable release
|
2022-02-09 14:02:29 +01:00 |
|
spmi
|
|
|
|
ssb
|
|
|
|
staging
|
This is the 5.4.180 stable release
|
2022-02-16 17:17:22 +01:00 |
|
target
|
scsi: target: iscsi: Make sure the np under each tpg is unique
|
2022-02-16 12:52:48 +01:00 |
|
tc
|
|
|
|
tee
|
tee: fix put order in teedev_close_context()
|
2022-01-27 09:19:30 +01:00 |
|
thermal
|
This is the 5.4.164 stable release
|
2021-12-08 09:19:28 +01:00 |
|
thunderbolt
|
|
|
|
tty
|
This is the 5.4.180 stable release
|
2022-02-16 17:17:22 +01:00 |
|
uio
|
|
|
|
usb
|
ANDROID: usb: gadget: f_accessory: add compat_ioctl support
|
2022-03-25 08:19:14 +00:00 |
|
vfio
|
This is the 5.4.148 stable release
|
2021-09-25 14:41:58 +02:00 |
|
vhost
|
This is the 5.4.163 stable release
|
2021-12-01 09:41:48 +01:00 |
|
video
|
This is the 5.4.164 stable release
|
2021-12-08 09:19:28 +01:00 |
|
virt
|
|
|
|
virtio
|
This is the 5.4.168 stable release
|
2021-12-22 10:08:44 +01:00 |
|
visorbus
|
|
|
|
vlynq
|
|
|
|
vme
|
|
|
|
w1
|
w1: Misuse of get_user()/put_user() reported by sparse
|
2022-01-27 09:19:48 +01:00 |
|
watchdog
|
ar7: fix kernel builds for compiler test
|
2021-11-17 09:48:46 +01:00 |
|
xen
|
xen: detect uninitialized xenbus in xenbus_init
|
2021-12-01 09:23:28 +01:00 |
|
zorro
|
|
|
|
Kconfig
|
|
|
|
Makefile
|
|
|
|
OWNERS
|
|
|