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 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?
          liang Liang Zhen (Inactive) added a comment - - edited patch for master: http://review.whamcloud.com/8509 patch for b2_4: http://review.whamcloud.com/8510 patch for b2_1: http://review.whamcloud.com/8511 patch for b2_5: http://review.whamcloud.com/8512

          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: