xen/blkback: Check device permissions before allowing OP_DISCARD
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 16 Jan 2013 16:33:52 +0000 (11:33 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Aug 2013 08:50:53 +0000 (16:50 +0800)
commit07221c8c2109ae56d9f83cd0644498069ed7cfed
tree4d2628eaebaf93e64fd6d1e99a380c1ca0dc5937
parentf4b5b99f18cd5984120ab2334aeadc5384f260cf
xen/blkback: Check device permissions before allowing OP_DISCARD

commit 604c499cbbcc3d5fe5fb8d53306aa0fae1990109 upstream.

We need to make sure that the device is not RO or that
the request is not past the number of sectors we want to
issue the DISCARD operation for.

This fixes CVE-2013-2140.

Acked-by: Jan Beulich <JBeulich@suse.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
[v1: Made it pr_warn instead of pr_debug]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/xen-blkback/blkback.c