diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2007-07-20 15:21:36 +0200 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2007-08-25 17:24:04 +0200 |
commit | 07acaa4834f61f28e7ea98cdb54ccc57a5c8af74 (patch) | |
tree | 20641787dda538465ed1eb88c0287b9c1d179d6f | |
parent | f97119d87106f6bbb3f1e829f53b638c522f23a5 (diff) | |
download | lwn-07acaa4834f61f28e7ea98cdb54ccc57a5c8af74.tar.gz lwn-07acaa4834f61f28e7ea98cdb54ccc57a5c8af74.zip |
[PATCH] splice: fix double page unlock
If add_to_page_cache_lru() fails, the page will not be locked. But
splice jumps to an error path that does a page release and unlock,
causing a BUG() in unlock_page().
Fix this by adding one more label that just releases the page. This bug
was actually triggered on EL5 by gurudas pai <gurudas.pai@oracle.com>
using fio.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Willy Tarreau <w@1wt.eu>
-rw-r--r-- | fs/splice.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/splice.c b/fs/splice.c index 2fca6ebf4cc2..b6572170280f 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -614,7 +614,7 @@ find_page: ret = add_to_page_cache_lru(page, mapping, index, GFP_KERNEL); if (unlikely(ret)) - goto out; + goto out_release; } /* @@ -695,8 +695,9 @@ find_page: goto find_page; } out: - page_cache_release(page); unlock_page(page); +out_release: + page_cache_release(page); out_ret: return ret; } |