From: NeilBrown Date: Sat, 10 Sep 2011 07:20:21 +0000 (+1000) Subject: Avoid dereferencing a 'request_queue' after last close. X-Git-Tag: v3.1-rc6~12^2~3 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94007751bb02797ba87bac7aacee2731ac2039a3;p=pandora-kernel.git Avoid dereferencing a 'request_queue' after last close. On the last close of an 'md' device which as been stopped, the device is destroyed and in particular the request_queue is freed. The free is done in a separate thread so it might happen a short time later. __blkdev_put calls bdev_inode_switch_bdi *after* ->release has been called. Since commit f758eeabeb96f878c860e8f110f94ec8820822a9 bdev_inode_switch_bdi will dereference the 'old' bdi, which lives inside a request_queue, to get a spin lock. This causes the last close on an md device to sometime take a spin_lock which lives in freed memory - which results in an oops. So move the called to bdev_inode_switch_bdi before the call to ->release. Cc: Christoph Hellwig Cc: Hugh Dickins Cc: Andrew Morton Cc: Wu Fengguang Acked-by: Wu Fengguang Cc: stable@kernel.org Signed-off-by: NeilBrown --- Reading git-diff-tree failed