pNFS: Handle allocation errors correctly in filelayout_alloc_layout_hdr()

commit 6df200f5d5 upstream.

Return the NULL pointer when the allocation fails.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Trond Myklebust
2014-05-29 20:06:55 -04:00
committed by Greg Kroah-Hartman
parent fe5320465f
commit a01b18de19

View File

@@ -1330,7 +1330,7 @@ filelayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
struct nfs4_filelayout *flo;
flo = kzalloc(sizeof(*flo), gfp_flags);
return &flo->generic_hdr;
return flo != NULL ? &flo->generic_hdr : NULL;
}
static void