[LU-4362] cfs_hash_rehash_key() passed wrong parameters to cfs_hash_keycpy Created: 09/Dec/13 Updated: 20/Jan/16 Resolved: 18/Dec/13 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.4.1, Lustre 2.5.0, Lustre 2.6.0 |
| Fix Version/s: | Lustre 2.6.0, Lustre 2.4.2, Lustre 2.5.1 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Liang Zhen (Inactive) | Assignee: | Liang Zhen (Inactive) |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||
| Severity: | 3 | ||||
| Rank (Obsolete): | 11945 | ||||
| Description |
|
cfs_hash_rehash_key()->cfs_hash_keycpy(hs, new_key, hnode); This is very dangerous because it can corrupt memory. |
| Comments |
| Comment by Liang Zhen (Inactive) [ 09/Dec/13 ] |
|
patch for master: http://review.whamcloud.com/8509 |
| Comment by Karsten Weiss [ 10/Dec/13 ] |
|
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? |
| Comment by Liang Zhen (Inactive) [ 11/Dec/13 ] |
|
Karsten, I will add const for key type in upcoming patch, which can prevent this from happening. |
| Comment by Peter Jones [ 18/Dec/13 ] |
|
Landed for 2.4.2 and 2.6. Will land for 2.5.1 shortly |