Whamcloud - gitweb
LU-7422 llite: don't panic when fid is insane 85/17985/3
authorSergey Cheremencev <sergey.cheremencev@seagate.com>
Mon, 16 Nov 2015 12:54:25 +0000 (15:54 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 31 May 2016 04:54:30 +0000 (04:54 +0000)
LASSERT should never be done on data that is
received to over the network. Return EINVAL
when server returns invalid fid despite of
it_status == 0.

Change-Id: I4341d1002761ab4c86bd7af4d0ca5718fe2a3623
Signed-off-by: Sergey Cheremencev <sergey.cheremencev@seagate.com>
Seagate-bug-id: MRP-3073
Reviewed-on: http://review.whamcloud.com/17985
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/llite_lib.c

index 578b171..cc1bab4 100644 (file)
@@ -2303,11 +2303,16 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req,
        } else {
                LASSERT(sb != NULL);
 
        } else {
                LASSERT(sb != NULL);
 
-                /*
-                 * At this point server returns to client's same fid as client
-                 * generated for creating. So using ->fid1 is okay here.
-                 */
-               LASSERT(fid_is_sane(&md.body->mbo_fid1));
+               /*
+                * At this point server returns to client's same fid as client
+                * generated for creating. So using ->fid1 is okay here.
+                */
+               if (!fid_is_sane(&md.body->mbo_fid1)) {
+                       CERROR("%s: Fid is insane "DFID"\n",
+                               ll_get_fsname(sb, NULL, 0),
+                               PFID(&md.body->mbo_fid1));
+                       GOTO(out, rc = -EINVAL);
+               }
 
                *inode = ll_iget(sb, cl_fid_build_ino(&md.body->mbo_fid1,
                                             sbi->ll_flags & LL_SBI_32BIT_API),
 
                *inode = ll_iget(sb, cl_fid_build_ino(&md.body->mbo_fid1,
                                             sbi->ll_flags & LL_SBI_32BIT_API),