From: John L. Hammond Date: Mon, 22 Jul 2013 16:06:27 +0000 (+0800) Subject: staging/lustre/llite: check alloc in ll_file_data_get, ll_dir_ioctl X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=73863d83b8066b3f7973fd5671162c846b7aea8f;p=openwrt%2Fstaging%2Fblogic.git staging/lustre/llite: check alloc in ll_file_data_get, ll_dir_ioctl In ll_file_data_get() and ll_dir_ioctl() return error on failed allocations. Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2753 Lustre-change: http://review.whamcloud.com/5845 Signed-off-by: John L. Hammond Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin Reviewed-by: Sebastien Buisson Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 1084999be959..bfc914e4be08 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1561,6 +1561,8 @@ out_rmdir: RETURN(rc); OBD_ALLOC_LARGE(lmm, lmmsize); + if (lmm == NULL) + RETURN(-ENOMEM); if (copy_from_user(lmm, lum, lmmsize)) GOTO(free_lmm, rc = -EFAULT); diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index efe66d996f5e..927b3a03e654 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -55,6 +55,8 @@ struct ll_file_data *ll_file_data_get(void) struct ll_file_data *fd; OBD_SLAB_ALLOC_PTR_GFP(fd, ll_file_data_slab, __GFP_IO); + if (fd == NULL) + return NULL; fd->fd_write_failed = false; return fd; }