Whamcloud - gitweb
LU-7354 osd: avoid NULL pointer in osd_obj_update_entry 10/17010/3
authorFan Yong <fan.yong@intel.com>
Sun, 13 Sep 2015 09:41:13 +0000 (17:41 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 6 Nov 2015 13:12:39 +0000 (13:12 +0000)
In osd_obj_update_entry(), the variable @oi_fid may be NULL.
We need to check such case before further using it to avoid
accessing invalid RAM.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Ibf47e949d69f0b9e5657a6dce2007fe4f6f1a9f6
Reviewed-on: http://review.whamcloud.com/17010
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_compat.c

index 5291dcd..ec004e4 100644 (file)
@@ -586,7 +586,7 @@ static int osd_obj_update_entry(struct osd_thread_info *info,
                GOTO(out, rc = -EEXIST);
        }
 
                GOTO(out, rc = -EEXIST);
        }
 
-       if (fid_is_idif(fid) && fid_is_idif(oi_fid)) {
+       if (fid_is_idif(fid) && oi_fid != NULL && fid_is_idif(oi_fid)) {
                __u32 idx1 = fid_idif_ost_idx(fid);
                __u32 idx2 = fid_idif_ost_idx(oi_fid);
                struct ost_id *ostid = &info->oti_ostid;
                __u32 idx1 = fid_idif_ost_idx(fid);
                __u32 idx2 = fid_idif_ost_idx(oi_fid);
                struct ost_id *ostid = &info->oti_ostid;