diff options
author | liubo <liubo2009@cn.fujitsu.com> | 2011-01-26 07:22:08 +0100 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-01-28 22:40:36 +0100 |
commit | 2a29edc6b60a5248ccab588e7ba7dad38cef0235 (patch) | |
tree | 45a7939e9e061cb2f06b09ae5f48aa79853e1250 /fs/btrfs/file.c | |
parent | btrfs: fix uncheck memory allocation in btrfs_submit_compressed_read (diff) | |
download | linux-2a29edc6b60a5248ccab588e7ba7dad38cef0235.tar.xz linux-2a29edc6b60a5248ccab588e7ba7dad38cef0235.zip |
btrfs: fix several uncheck memory allocations
To make btrfs more stable, add several missing necessary memory allocation
checks, and when no memory, return proper errno.
We've checked that some of those -ENOMEM errors will be returned to
userspace, and some will be catched by BUG_ON() in the upper callers,
and none will be ignored silently.
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index f903433f5bdf..65b2424a4116 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -945,6 +945,10 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, PAGE_CACHE_SIZE, PAGE_CACHE_SIZE / (sizeof(struct page *))); pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL); + if (!pages) { + ret = -ENOMEM; + goto out; + } /* generic_write_checks can change our pos */ start_pos = pos; |