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

cfs_hash_rehash_key() passed wrong parameters to cfs_hash_keycpy

Details

    • 3
    • 11945

    Description

      cfs_hash_rehash_key()->cfs_hash_keycpy(hs, new_key, hnode);
      but define of cfs_hash_keycpy is:
      void cfs_hash_keycpy(cfs_hash_t *hs, struct hlist_node *hnode, void *key)

      This is very dangerous because it can corrupt memory.
      I will post a patch soon

      Attachments

        Activity

          [LU-4362] cfs_hash_rehash_key() passed wrong parameters to cfs_hash_keycpy
          pjones Peter Jones made changes -
          Link New: This issue is related to SGI-31 [ SGI-31 ]
          pjones Peter Jones made changes -
          Labels Original: mq114
          adilger Andreas Dilger made changes -
          Labels New: mq114
          adilger Andreas Dilger made changes -
          Affects Version/s New: Lustre 2.5.0 [ 10295 ]
          Affects Version/s New: Lustre 2.4.1 [ 10294 ]
          Affects Version/s New: Lustre 2.6.0 [ 10595 ]
          pjones Peter Jones made changes -
          Fix Version/s New: Lustre 2.5.1 [ 10608 ]
          Labels Original: mq114
          pjones Peter Jones made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          pjones Peter Jones added a comment -

          Landed for 2.4.2 and 2.6. Will land for 2.5.1 shortly

          pjones Peter Jones added a comment - Landed for 2.4.2 and 2.6. Will land for 2.5.1 shortly

          Karsten, I will add const for key type in upcoming patch, which can prevent this from happening.

          liang Liang Zhen (Inactive) added a comment - Karsten, I will add const for key type in upcoming patch, which can prevent this from happening.

          IMHO the interesting question is: Why couldn't the compiler help to prevent this bug as a type error in the first place? Wouldn't it help if the prototype of cfs_hash_keycpy() did not use a void* type for the "key" argument?

          knweiss Karsten Weiss added a comment - IMHO the interesting question is: Why couldn't the compiler help to prevent this bug as a type error in the first place? Wouldn't it help if the prototype of cfs_hash_keycpy() did not use a void* type for the "key" argument?
          pjones Peter Jones made changes -
          Fix Version/s New: Lustre 2.4.2 [ 10605 ]

          People

            liang Liang Zhen (Inactive)
            liang Liang Zhen (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: