linux/drivers
Lukas Czerner bc977749e9 [SCSI] scsi_debug: Fix off-by-one bug when unmapping region
Currently it is possible to unmap one more block than user requested to
due to the off-by-one error in unmap_region(). This is probably due to
the fact that the end variable despite its name actually points to the
last block to unmap + 1. However in the condition it is handled as the
last block of the region to unmap.

The bug was not previously spotted probably due to the fact that the
region was not zeroed, which has changed with commit
be1dd78de5. With that commit we were able
to corrupt the ext4 file system on 256M scsi_debug device with LBPRZ
enabled using fstrim.

Since the 'end' semantic is the same in several functions there this
commit just fixes the condition to use the 'end' variable correctly in
that context.

Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-10-09 12:23:11 +01:00
..
accessibility
acpi Power management updates for 3.7-rc1 2012-10-02 18:32:35 -07:00
amba
ata SCSI for-linus on 20121002 2012-10-02 19:01:32 -07:00
atm
auxdisplay
base Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2012-10-02 20:25:04 -07:00
bcma bcma: change delays to follow timers-howto guide 2012-09-28 13:54:02 -04:00
block Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2012-10-02 11:11:09 -07:00
bluetooth Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2012-10-02 13:38:27 -07:00
bus drivers: bus: omap_l3: fixup merge conflict resolution 2012-10-01 19:39:48 -07:00
cdrom
char Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2012-10-02 21:38:48 -07:00
clk spi: Updates for v3.7 2012-10-02 17:26:42 -07:00
clocksource Power management updates for 3.7-rc1 2012-10-02 18:32:35 -07:00
connector Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2012-10-02 13:38:27 -07:00
cpufreq Power management updates for 3.7-rc1 2012-10-02 18:32:35 -07:00
cpuidle cpuidle: rename function name "__cpuidle_register_driver", v2 2012-09-22 00:38:32 +02:00
crypto Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next 2012-10-02 12:57:42 -07:00
dca
devfreq
dio
dma ARM: soc: multiplatform enablement 2012-10-01 19:11:38 -07:00
edac Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
eisa
extcon Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
firewire
firmware
gpio So this is the LW GPIO patch stack for v3.7: 2012-10-02 16:05:10 -07:00
gpu Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2012-10-02 11:11:09 -07:00
hid Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
hsi
hv
hwmon ARM: soc: multiplatform enablement 2012-10-01 19:11:38 -07:00
hwspinlock
i2c ARM: soc: multiplatform enablement 2012-10-01 19:11:38 -07:00
ide
idle
iio iio: adc: add new lp8788 adc driver 2012-09-22 10:29:19 +01:00
infiniband Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2012-10-02 20:25:04 -07:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2012-10-02 17:16:10 -07:00
iommu PCI changes for the 3.7 merge window: 2012-10-01 12:05:36 -07:00
irqchip irqchip: fill in empty Kconfig 2012-09-24 10:07:40 -07:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2012-10-02 13:38:27 -07:00
leds Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
lguest lguest, x86: handle guest TS bit for lazy/non-lazy fpu host models 2012-09-18 15:52:09 -07:00
macintosh Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
md Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
media Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
memory memory: tegra{20,30}-mc: Fix reading incorrect register in mc_readl() 2012-09-26 14:04:09 -07:00
memstick
message
mfd Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
misc Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
mmc spi: Updates for v3.7 2012-10-02 17:26:42 -07:00
mtd The main change is the way we reserve eraseblocks for bad blocks 2012-10-02 20:49:15 -07:00
net Features: 2012-10-02 22:09:10 -07:00
nfc NFC: Fix missing mutex unlock in pn533_send_cmd_frame_async 2012-09-27 10:47:48 +02:00
nubus
of
oprofile
parisc
parport
pci Features: 2012-10-02 22:09:10 -07:00
pcmcia ARM: soc: multiplatform enablement 2012-10-01 19:11:38 -07:00
pinctrl These are the bulk pinctrl changes for kernel v3.7: 2012-10-02 16:20:20 -07:00
platform Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
pnp
power Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
pps
ps3
ptp ptp: link the phc device to its parent device 2012-09-22 15:42:38 -04:00
pwm
rapidio
regulator Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
remoteproc ARM: omap: move platform_data definitions 2012-09-19 17:39:52 +02:00
rpmsg
rtc ARM: soc: device tree updates 2012-10-01 18:28:06 -07:00
s390 SCSI for-linus on 20121002 2012-10-02 19:01:32 -07:00
sbus drivers/sbus/char: removes unnecessary semicolon 2012-09-21 12:08:56 -07:00
scsi [SCSI] scsi_debug: Fix off-by-one bug when unmapping region 2012-10-09 12:23:11 +01:00
sfi
sh ARM: soc: multiplatform enablement 2012-10-01 19:11:38 -07:00
sn
spi spi: Updates for v3.7 2012-10-02 17:26:42 -07:00
ssb
staging Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2012-10-02 20:25:04 -07:00
target Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2012-10-01 09:06:36 -07:00
tc
thermal
tty Features: 2012-10-02 22:09:10 -07:00
uio
usb Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2012-10-02 20:25:04 -07:00
uwb
vfio switch simple cases of fget_light to fdget 2012-09-26 22:20:08 -04:00
vhost vhost_set_vring(): turn pollstart/pollstop into bool 2012-09-26 21:10:12 -04:00
video Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2012-10-02 20:25:04 -07:00
virt
virtio
vlynq
vme
w1 char/misc driver merge for 3.7-rc1 2012-10-01 12:09:59 -07:00
watchdog ARM: soc: general cleanups 2012-10-01 18:19:05 -07:00
xen Features: 2012-10-02 22:09:10 -07:00
zorro
Kconfig ARM: soc: driver specific changes 2012-10-01 18:46:13 -07:00
Makefile Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2012-10-02 13:38:27 -07:00