target: Add range checking to UNMAP emulation
authorRoland Dreier <roland@purestorage.com>
Mon, 16 Jul 2012 22:34:22 +0000 (15:34 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 2 Aug 2012 13:37:49 +0000 (14:37 +0100)
commit8681d6103dc63879b6b679b2bfa9f59121277b41
tree7505f4cb1e8a21fcdaf949db8ea9ac3b280a1a9c
parent0c2305d15f446ea286545b12587a7c836a1fb08c
target: Add range checking to UNMAP emulation

commit 2594e29865c291db162313187612cd9f14538f33 upstream.

When processing an UNMAP command, we need to make sure that the number
of blocks we're asked to UNMAP does not exceed our reported maximum
number of blocks per UNMAP, and that the range of blocks we're
unmapping doesn't go past the end of the device.

Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
[bwh: Backported to 3.2: adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/target/target_core_cdb.c