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

bad NULL pointer check in cb_migrate_mdt_init()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.8.0
    • Lustre 2.8.0
    • 3
    • 9223372036854775807

    Description

      At the end of cb_migrate_mdt_init(), after calling opendir() we should test *dirp rather than dirp:

      out:
              if (dirp != NULL) {
                      /* If the directory is being migration, we need
                       * close the directory after migration,
                       * so the old directory cache will be cleanup
                       * on the client side, and re-open to get the
                       * new directory handle */
                      *dirp = opendir(path);
      		if (dirp == NULL) {
                              ret = -errno;
                              llapi_error(LLAPI_MSG_ERROR, ret,
                                          "%s: Failed to open '%s'", __func__, path);
      			return ret;
                      }
              }
      
              if (parent == NULL)
                      closedir(dir);
      
              return ret;
      
      

      We also may leak dir on early return but the logic of this function is so convoluted that it's hard to tell.

      Attachments

        Activity

          People

            emoly.liu Emoly Liu
            jhammond John Hammond
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: