]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.fixes/do_anonymous_page-race
Merge branch 'master' of git://git.ipfire.org/ipfire-2.x
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / do_anonymous_page-race
1 From: Andrea Arcangeli <andrea@suse.de>
2 Subject: Race condition in userspace testcase
3 References: 46948, LTC11574
4
5
6 Additional Comment #103 From Andrea Arcangeli 2004-10-15 19:41
7 the last patch I attached is the safest I believe.
8
9 I'm not sure if a lock_unlock or lock_unlock is always guaranteed to happen
10 after the I/O, and this makes sure no race can happen anymore.
11
12 ---
13 fs/bio.c | 10 ++++++++++
14 1 file changed, 10 insertions(+)
15
16 --- a/fs/bio.c
17 +++ b/fs/bio.c
18 @@ -1192,6 +1192,16 @@ void bio_endio(struct bio *bio, int erro
19 else if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
20 error = -EIO;
21
22 + if (bio_data_dir(bio) == READ)
23 + /*
24 + * If the current cpu has written to the page by hand
25 + * without dma, we must enforce ordering to be sure
26 + * this written data will be visible before we expose
27 + * the page contents to other cpus (for example with
28 + * a set_pte).
29 + */
30 + smp_wmb();
31 +
32 if (bio->bi_end_io)
33 bio->bi_end_io(bio, error);
34 }