pNFS: Fix NULL dereference in pnfs_generic_alloc_ds_commits
authorFred Isaman <fred.isaman@gmail.com>
Tue, 2 May 2017 20:53:36 +0000 (16:53 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 3 May 2017 16:29:41 +0000 (12:29 -0400)
Signed-off-by: Fred Isaman <fred.isaman@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/pnfs_nfs.c

index ae600ab1a646c3c145cfb811ab1362abe6ca3c72..d40755a0984bbb0942e96aee388ed50fe7629a6e 100644 (file)
@@ -221,7 +221,7 @@ pnfs_generic_alloc_ds_commits(struct nfs_commit_info *cinfo,
                 * If the layout segment is invalid, then let
                 * pnfs_generic_retry_commit() clean up the bucket.
                 */
-               if (!pnfs_is_valid_lseg(bucket->clseg) &&
+               if (bucket->clseg && !pnfs_is_valid_lseg(bucket->clseg) &&
                    !test_bit(NFS_LSEG_LAYOUTRETURN, &bucket->clseg->pls_flags))
                        break;
                data = nfs_commitdata_alloc(false);