]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
nfsd: fix NULL dereference in setattr()
authorDan Carpenter <error27@gmail.com>
Wed, 27 Oct 2010 21:19:04 +0000 (23:19 +0200)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 19 Nov 2010 23:35:11 +0000 (18:35 -0500)
The original code would oops if this were called from nfsd4_setattr()
because "filpp" is NULL.

(Note this case is currently impossible, as long as we only give out
read delegations.)

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c

index ad2bfa68d534d28531c3788b955734b5d9a76985..2d191293e6aa3a406cb68be97cdc03e71780171e 100644 (file)
@@ -3081,9 +3081,10 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
                if (status)
                        goto out;
                renew_client(dp->dl_client);
-               if (filpp)
+               if (filpp) {
                        *filpp = find_readable_file(dp->dl_file);
-               BUG_ON(!*filpp);
+                       BUG_ON(!*filpp);
+               }
        } else { /* open or lock stateid */
                stp = find_stateid(stateid, flags);
                if (!stp)