Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-7944

Suspicious dereference of pointer before NULL check in mdt_obd_connect()

Details

    • Bug
    • Resolution: Duplicate
    • Minor
    • None
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      Suspicious dereference of pointer 'data' before NULL check at line 5174

      • An event which alters the program's state, leading to the defect
        mdt_handler.c:5163: 'data' is dereferenced.
      • An event which alters the program's state, leading to the defect
        mdt_handler.c:5174: 'data' is checked for NULL.
      5144		static int mdt_obd_connect(const struct lu_env *env,
      5145					   struct obd_export **exp, struct obd_device *obd,
      5146					   struct obd_uuid *cluuid,
      5147					   struct obd_connect_data *data,
      5148					   void *localdata)
      5149		{
      5150			struct obd_export	*lexp;
      5151			struct lustre_handle	conn = { 0 };
      5152			struct mdt_device	*mdt;
      5153			int			 rc;
      5154			lnet_nid_t		*client_nid = localdata;
      5155			ENTRY;
      5156		 
      5157			LASSERT(env != NULL);
      5158			if (!exp || !obd || !cluuid)
      5159				RETURN(-EINVAL);
      5160		 
      5161			mdt = mdt_dev(obd->obd_lu_dev);
      5162		 
      5163			if ((data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) &&
      5164			    !(data->ocd_connect_flags & OBD_CONNECT_LIGHTWEIGHT)) {...}
      5168		 
      5169			/*
      5170			 * first, check whether the stack is ready to handle requests
      5171			 * XXX: probably not very appropriate method is used now
      5172			 *      at some point we should find a better one
      5173			 */
      5174			if (!test_bit(MDT_FL_SYNCED, &mdt->mdt_state) && data != NULL &&
      5175			    !(data->ocd_connect_flags & OBD_CONNECT_LIGHTWEIGHT) &&
      5176			    !(data->ocd_connect_flags & OBD_CONNECT_MDS_MDS)) {
      

      Attachments

        Issue Links

          Activity

            [LU-7944] Suspicious dereference of pointer before NULL check in mdt_obd_connect()
            pjones Peter Jones added a comment -

            Thanks Arshad. Closing as a duplicate of LU-8182

            pjones Peter Jones added a comment - Thanks Arshad. Closing as a duplicate of LU-8182

            While attempting to provide a fix for this. I noticed that this bug is already fixed by Fan's patch https://review.whamcloud.com/#/c/20391/2

            Thanks
            Arshad

            arshad512 Arshad Hussain added a comment - While attempting to provide a fix for this. I noticed that this bug is already fixed by Fan's patch https://review.whamcloud.com/#/c/20391/2 Thanks Arshad

            People

              wc-triage WC Triage
              dmiter Dmitry Eremin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: