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)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 30 May 2013 13:35:07 +0000 (14:35 +0100)
commit6045e6d7315d2ed99b7ff383aa6a46cc706181e5
tree275758a6db0e1c6945182a91295e6f1dd7cf19ce
parentf45f28f4921a03d20d04f273dad68d30736304c6
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: Ben Hutchings <ben@decadent.org.uk>
drivers/block/brd.c