nfsd4: warn on finding lockowner without stateid's
authorJ. Bruce Fields <bfields@redhat.com>
Thu, 8 May 2014 15:19:41 +0000 (11:19 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 9 Jun 2014 12:29:15 +0000 (13:29 +0100)
commit 27b11428b7de097c42f205beabb1764f4365443b upstream.

The current code assumes a one-to-one lockowner<->lock stateid
correspondance.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/nfsd/nfs4state.c

index 6445fbd..b2e0a55 100644 (file)
@@ -3820,6 +3820,10 @@ static bool same_lockowner_ino(struct nfs4_lockowner *lo, struct inode *inode, c
 
        if (!same_owner_str(&lo->lo_owner, owner, clid))
                return false;
+       if (list_empty(&lo->lo_owner.so_stateids)) {
+               WARN_ON_ONCE(1);
+               return false;
+       }
        lst = list_first_entry(&lo->lo_owner.so_stateids,
                               struct nfs4_ol_stateid, st_perstateowner);
        return lst->st_file->fi_inode == inode;