diff options
author | Yanchuan Nian <ycnian@gmail.com> | 2012-10-31 09:05:48 +0100 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-31 21:26:25 +0100 |
commit | 7175fe90153e6375082d65884fbb41ab3bbb4901 (patch) | |
tree | 487e9206cc31f1a214ee43771325193abb4a2b89 /fs/nfs/pnfs.c | |
parent | NFS: fix bug in legacy DNS resolver. (diff) | |
download | linux-7175fe90153e6375082d65884fbb41ab3bbb4901.tar.xz linux-7175fe90153e6375082d65884fbb41ab3bbb4901.zip |
nfs: Check whether a layout pointer is NULL before free it
The new layout pointer in pnfs_find_alloc_layout() may be NULL because of
out of memory. we must do some check work, otherwise pnfs_free_layout_hdr()
will go wrong because it can not deal with a NULL pointer.
Signed-off-by: Yanchuan Nian <ycnian@gmail.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r-- | fs/nfs/pnfs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index fe624c91bd00..2878f97bd78d 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -925,8 +925,8 @@ pnfs_find_alloc_layout(struct inode *ino, if (likely(nfsi->layout == NULL)) { /* Won the race? */ nfsi->layout = new; return new; - } - pnfs_free_layout_hdr(new); + } else if (new != NULL) + pnfs_free_layout_hdr(new); out_existing: pnfs_get_layout_hdr(nfsi->layout); return nfsi->layout; |