drivers/block/brd.c: fix brd_lookup_page() race
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 24 May 2013 22:55:28 +0000 (15:55 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Jun 2013 19:49:26 +0000 (12:49 -0700)
commit60e255daee832c39d2099d8f942cbb901d9cb36f
treedbef26e86df30a147320f2fa3da944d68c304bc4
parentbfd7610d981cd0fab6d68576c638c8e7550f3e51
drivers/block/brd.c: fix brd_lookup_page() race

commit dfd20b2b174d3a9b258ea3b7a35ead33576587b1 upstream.

The index on the page must be set before it is inserted in the radix
tree.  Otherwise there is a small race which can occur during lookup
where the page can be found with the incorrect index.  This will trigger
the BUG_ON() in brd_lookup_page().

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reported-by: Chris Wedgwood <cw@f00f.org>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/brd.c