]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.fixes/blk-get-extra-reference-before-unmap
Reenabled linux-xen and xen-image build
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.fixes / blk-get-extra-reference-before-unmap
CommitLineData
00e5a55c
BS
1Subject: block: hold extra reference to bio in blk_rq_map_user_iov()
2From: Jens Axboe <jens.axboe@oracle.com>
3Date: Tue Nov 18 15:08:56 2008 +0100:
4Git: c26156b2534c75bb3cdedf76f6ad1340971cf5bd
5
6If the size passed in is OK but we end up mapping too many segments,
7we call the unmap path directly like from IO completion. But from IO
8completion we have an extra reference to the bio, so this error case
9goes OOPS when it attempts to free and already free bio.
10
11Fix it by getting an extra reference to the bio before calling the
12unmap failure case.
13
14Reported-by: Petr Vandrovec <vandrove@vc.cvut.cz>
15
16Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
17Signed-off-by: Hannes Reinecke <hare@suse.de>
18
19---
20 block/blk-map.c | 6 ++++++
21 1 file changed, 6 insertions(+)
22
23--- a/block/blk-map.c
24+++ b/block/blk-map.c
25@@ -202,6 +202,12 @@ int blk_rq_map_user_iov(struct request_q
26 return PTR_ERR(bio);
27
28 if (bio->bi_size != len) {
29+ /*
30+ * Grab an extra reference to this bio, as bio_unmap_user()
31+ * expects to be able to drop it twice as it happens on the
32+ * normal IO completion path
33+ */
34+ bio_get(bio);
35 bio_endio(bio, 0);
36 bio_unmap_user(bio);
37 return -EINVAL;