Subject: + drivers-block-brdc-fix-brd_lookup_page-race.patch added to -mm tree To: behlendorf1@xxxxxxxx,axboe@xxxxxxxxx,cw@xxxxxxxx,stable@xxxxxxxxxxxxxxx From: akpm@xxxxxxxxxxxxxxxxxxxx Date: Wed, 22 May 2013 14:48:33 -0700 The patch titled Subject: drivers/block/brd.c: fix brd_lookup_page() race has been added to the -mm tree. Its filename is drivers-block-brdc-fix-brd_lookup_page-race.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Brian Behlendorf <behlendorf1@xxxxxxxx> Subject: drivers/block/brd.c: fix brd_lookup_page() race 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@xxxxxxxx> Reported-by: Chris Wedgwood <cw@xxxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/block/brd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -puN drivers/block/brd.c~drivers-block-brdc-fix-brd_lookup_page-race drivers/block/brd.c --- a/drivers/block/brd.c~drivers-block-brdc-fix-brd_lookup_page-race +++ a/drivers/block/brd.c @@ -117,13 +117,13 @@ static struct page *brd_insert_page(stru spin_lock(&brd->brd_lock); idx = sector >> PAGE_SECTORS_SHIFT; + page->index = idx; if (radix_tree_insert(&brd->brd_pages, idx, page)) { __free_page(page); page = radix_tree_lookup(&brd->brd_pages, idx); BUG_ON(!page); BUG_ON(page->index != idx); - } else - page->index = idx; + } spin_unlock(&brd->brd_lock); radix_tree_preload_end(); _ Patches currently in -mm which might be from behlendorf1@xxxxxxxx are drivers-block-brdc-fix-brd_lookup_page-race.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html