From: Chris Mason Signed-off-by: Andrew Morton --- 25-akpm/fs/bio.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) diff -puN fs/bio.c~bio_uncopy_user-mem-leak-fix fs/bio.c --- 25/fs/bio.c~bio_uncopy_user-mem-leak-fix Thu Aug 19 15:03:24 2004 +++ 25-akpm/fs/bio.c Thu Aug 19 15:03:24 2004 @@ -454,6 +454,7 @@ struct bio *bio_copy_user(request_queue_ */ if (!ret) { if (!write_to_vm) { + unsigned long p = uaddr; bio->bi_rw |= (1 << BIO_RW); /* * for a write, copy in data to kernel pages @@ -462,8 +463,9 @@ struct bio *bio_copy_user(request_queue_ bio_for_each_segment(bvec, bio, i) { char *addr = page_address(bvec->bv_page); - if (copy_from_user(addr, (char *) uaddr, bvec->bv_len)) + if (copy_from_user(addr, (char *) p, bvec->bv_len)) goto cleanup; + p += bvec->bv_len; } } _