1
0
Fork 0
alistair23-linux/drivers
Dmitry Monakhov b1fb2c52b2 block: guard bvec iteration logic
Currently if some one try to advance bvec beyond it's size we simply
dump WARN_ONCE and continue to iterate beyond bvec array boundaries.
This simply means that we endup dereferencing/corrupting random memory
region.

Sane reaction would be to propagate error back to calling context
But bvec_iter_advance's calling context is not always good for error
handling. For safity reason let truncate iterator size to zero which
will break external iteration loop which prevent us from unpredictable
memory range corruption. And even it caller ignores an error, it will
corrupt it's own bvecs, not others.

This patch does:
- Return error back to caller with hope that it will react on this
- Truncate iterator size

Code was added long time ago here 4550dd6c, luckily no one hit it
in real life :)

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
[hch: switch to true/false returns instead of errno values]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2017-07-03 16:56:26 -06:00
..
accessibility
acpi Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-03 13:08:04 -07:00
amba
android
ata libata: fix error checking in in ata_parse_force_one() 2017-05-31 14:26:26 -04:00
atm
auxdisplay
base Merge branch 'WIP.sched/core' into sched/core 2017-06-20 12:28:21 +02:00
bcma
block drbd: Drop unnecessary static 2017-06-27 17:56:50 -06:00
bluetooth sched/wait: Rename wait_queue_t => wait_queue_entry_t 2017-06-20 12:18:27 +02:00
bus
cdrom block: don't set bounce limit in blk_init_queue 2017-06-27 12:13:45 -06:00
char Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-03 13:08:04 -07:00
clk Allwinner clock fixes for 4.12 2017-06-14 16:48:03 -07:00
clocksource clocksource: Explicitly include linux/clocksource.h when needed 2017-06-13 17:57:16 +02:00
connector
cpufreq Merge branch 'WIP.sched/core' into sched/core 2017-06-20 12:28:21 +02:00
cpuidle Merge branch 'WIP.sched/core' into sched/core 2017-06-20 12:28:21 +02:00
crypto virtio: fixes, cleanups, performance 2017-05-10 11:33:08 -07:00
dax device-dax: fix 'dax' device filesystem inode destruction crash 2017-06-09 08:50:49 -07:00
dca
devfreq PM / devfreq: exynos-ppmu: Staticize event list 2017-06-12 10:12:07 +09:00
dio
dma dmaengine: pl330: fix warning in pl330_remove 2017-06-02 11:49:44 +05:30
dma-buf
edac EDAC, pnd2: Fix Apollo Lake DIMM detection 2017-06-29 10:37:50 +02:00
eisa
extcon
firewire
firmware Merge branch 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-03 12:12:05 -07:00
fmc
fpga fpga fr br: update supported version numbers 2017-04-26 11:38:56 +02:00
fsi
gpio gpio: acpi: Skip _AEI entries without a handler rather then aborting the scan 2017-06-29 14:55:08 +02:00
gpu Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-03 13:08:04 -07:00
hid UUID/GUID updates: 2017-07-03 09:55:26 -07:00
hsi hsi: Fix build regression due to netdev destructor fix. 2017-06-08 10:16:05 -04:00
hv char/misc patches for 4.12-rc1 2017-05-04 19:15:35 -07:00
hwmon hwmon: (aspeed-pwm-tacho) make fan/pwm names start with index 1 2017-06-03 03:55:43 -07:00
hwspinlock
hwtracing drivers/hwtracing/intel_th/msu.c: use set_memory.h header 2017-05-08 17:15:14 -07:00
i2c i2c: imx: Use correct function to write to register 2017-06-22 10:52:02 +02:00
ide block: Change argument type of scsi_req_init() 2017-06-20 19:27:14 -06:00
idle x86/intel_idle: add Gemini Lake support 2017-05-01 23:17:37 +02:00
iio iio: buffer-dmaengine: Add missing header buffer_impl.h 2017-06-13 20:56:05 +01:00
infiniband sched/wait: Rename wait_queue_t => wait_queue_entry_t 2017-06-20 12:18:27 +02:00
input Input: synaptics-rmi4 - only read the F54 query registers which are used 2017-06-23 00:08:48 -07:00
iommu Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-03 13:08:04 -07:00
ipack
irqchip irqchip/mips-gic: Mark count and compare accessors notrace 2017-06-20 21:41:58 +02:00
isdn mISDN: Fix a sleep-in-atomic bug 2017-06-01 14:49:47 -04:00
leds LED fixes for 4.12-rc6 2017-06-18 08:51:35 +09:00
lguest
lightnvm lightnvm: pblk: set line bitmap check under debug 2017-06-30 11:08:18 -06:00
macintosh DeviceTree for 4.12: 2017-05-05 19:33:07 -07:00
mailbox mailbox: handle empty message in tx_tick 2017-04-27 16:20:04 +05:30
mcb
md bio-integrity: fix interface for bio_integrity_trim 2017-07-03 16:56:22 -06:00
media media fixes for v4.12-rc6 2017-06-15 17:37:40 +09:00
memory Merge tag 'at91-4.12-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux into fixes 2017-06-01 17:07:31 -07:00
memstick block: introduce new block status code type 2017-06-09 09:27:32 -06:00
message scsi: mpt: Move scsi_remove_host() out of mptscsih_remove_host() 2017-04-24 18:21:17 -04:00
mfd mfd: arizona: Fix typo using hard-coded register 2017-06-06 10:17:42 +01:00
misc powerpc fixes for 4.12 #8 2017-06-30 10:55:34 -07:00
mmc Merge branch 'for-4.13/block' of git://git.kernel.dk/linux-block 2017-07-03 10:34:51 -07:00
mtd block: don't set bounce limit in blk_init_queue 2017-06-27 12:13:45 -06:00
net Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-03 13:08:04 -07:00
nfc
ntb ntb: no sleep in ntb_async_tx_submit 2017-06-19 14:24:41 -04:00
nubus
nvdimm block: guard bvec iteration logic 2017-07-03 16:56:26 -06:00
nvme Merge branch 'for-4.13/block' of git://git.kernel.dk/linux-block 2017-07-03 10:34:51 -07:00
nvmem ARM: SoC driver updates 2017-05-09 10:01:15 -07:00
of iommu/of: Ignore all errors except EPROBE_DEFER 2017-05-30 11:31:32 +02:00
oprofile
parisc
parport
pci UUID/GUID updates: 2017-07-03 09:55:26 -07:00
pcmcia Annotation of module parameters that specify device settings 2017-05-10 19:13:03 -07:00
perf drivers/perf: arm_pmu_acpi: avoid perf IRQ init when guest PMU is off 2017-05-30 12:40:03 +01:00
phy phy: qualcomm: phy-qcom-qmp: fix application of sizeof to pointer 2017-06-01 15:03:41 +05:30
pinctrl Revert "pinctrl: rockchip: avoid hardirq-unsafe functions in irq_chip" 2017-06-29 15:03:24 +02:00
platform platform-drivers-x86 for v4.12-2 2017-06-16 17:30:44 +09:00
pnp
power power supply and reset changes for the v4.12 series (part 2) 2017-05-12 12:02:21 -07:00
powercap PowerCap: Fix an error code in powercap_register_zone() 2017-05-14 13:30:05 +02:00
pps
ps3
ptp Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-05-01 16:15:18 -07:00
pwm
rapidio char/misc patches for 4.12-rc1 2017-05-04 19:15:35 -07:00
ras
regulator Merge remote-tracking branch 'regulator/topic/vctrl' into regulator-next 2017-04-30 22:17:44 +09:00
remoteproc virtio: fixes, cleanups, performance 2017-05-10 11:33:08 -07:00
reset reset: hi6220: Set module license so that it can be loaded 2017-05-24 10:53:41 +02:00
rpmsg virtio: fixes, cleanups, performance 2017-05-10 11:33:08 -07:00
rtc sched/wait: Disambiguate wq_entry->task_list and wq_head->task_list naming 2017-06-20 12:19:14 +02:00
s390 Merge branch 'for-4.13/block' of git://git.kernel.dk/linux-block 2017-07-03 10:34:51 -07:00
sbus block: don't set bounce limit in blk_init_queue 2017-06-27 12:13:45 -06:00
scsi t10-pi: Move opencoded contants to common header 2017-07-03 16:56:25 -06:00
sfi
sh
sn
soc ARM: SoC fixes (and a cross-arch dt-include fix) 2017-05-19 13:36:56 -07:00
spi Merge remote-tracking branches 'spi/topic/ti-qspi' and 'spi/topic/xlp' into spi-next 2017-04-26 15:58:22 +01:00
spmi
ssb
staging sched/wait: Rename wait_queue_t => wait_queue_entry_t 2017-06-20 12:18:27 +02:00
target t10-pi: Move opencoded contants to common header 2017-07-03 16:56:25 -06:00
tc
tee Linux 4.12-rc1 2017-05-18 23:54:47 -07:00
thermal thermal: int340x_thermal: fix compile after the UUID API switch 2017-06-09 16:37:31 +02:00
thunderbolt
tty sched/wait: Rename wait_queue_t => wait_queue_entry_t 2017-06-20 12:18:27 +02:00
uio uio: fix incorrect memory leak cleanup 2017-05-16 23:06:41 +02:00
usb UUID/GUID updates: 2017-07-03 09:55:26 -07:00
uwb uwb: fix device quirk on big-endian hosts 2017-05-17 11:27:41 +02:00
vfio sched/wait: Rename wait_queue_t => wait_queue_entry_t 2017-06-20 12:18:27 +02:00
vhost sched/wait: Rename wait_queue_t => wait_queue_entry_t 2017-06-20 12:18:27 +02:00
video video: fbdev: udlfb: drop log level for blanking 2017-06-14 12:40:36 +02:00
virt drivers/virt/fsl_hypervisor.c: use get_user_pages_unlocked() 2017-05-08 17:15:10 -07:00
virtio virtio_balloon: disable VIOMMU support 2017-06-18 23:13:35 +03:00
vlynq
vme
w1
watchdog watchdog: bcm281xx: Fix use of uninitialized spinlock. 2017-05-19 10:42:25 +02:00
xen Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-03 13:08:04 -07:00
zorro
Kconfig
Makefile Merge branch 'tee/initial-merge' into fixes 2017-05-10 21:03:31 +02:00