summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/qgroup.c
diff options
context:
space:
mode:
authorTsutomu Itoh <t-itoh@jp.fujitsu.com>2012-09-06 00:18:10 -0600
committerChris Mason <chris.mason@fusionio.com>2012-10-01 15:19:14 -0400
commit3d6b5c3b5c0b970ce8a9d3bac6854f5c0ce0295a (patch)
treeaadfc9ad81660e5ef11121a4529213e8cd1062de /fs/btrfs/qgroup.c
parentf54fb859da53f04a443c5e3f4cb9b936ed42d227 (diff)
downloadop-kernel-dev-3d6b5c3b5c0b970ce8a9d3bac6854f5c0ce0295a.zip
op-kernel-dev-3d6b5c3b5c0b970ce8a9d3bac6854f5c0ce0295a.tar.gz
Btrfs: check return value of ulist_alloc() properly
ulist_alloc() has the possibility of returning NULL. So, it is necessary to check the return value. Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Diffstat (limited to 'fs/btrfs/qgroup.c')
-rw-r--r--fs/btrfs/qgroup.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 9b707ba..5039686 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1469,6 +1469,10 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
* be exceeded
*/
ulist = ulist_alloc(GFP_ATOMIC);
+ if (!ulist) {
+ ret = -ENOMEM;
+ goto out;
+ }
ulist_add(ulist, qgroup->qgroupid, (uintptr_t)qgroup, GFP_ATOMIC);
ULIST_ITER_INIT(&uiter);
while ((unode = ulist_next(ulist, &uiter))) {
@@ -1541,6 +1545,10 @@ void btrfs_qgroup_free(struct btrfs_root *root, u64 num_bytes)
goto out;
ulist = ulist_alloc(GFP_ATOMIC);
+ if (!ulist) {
+ btrfs_std_error(fs_info, -ENOMEM);
+ goto out;
+ }
ulist_add(ulist, qgroup->qgroupid, (uintptr_t)qgroup, GFP_ATOMIC);
ULIST_ITER_INIT(&uiter);
while ((unode = ulist_next(ulist, &uiter))) {
OpenPOWER on IntegriCloud