Suhas Athani has uploaded this change for review.
Normalize IPv4 addresses in hash_sockaddr() to match IPv4-mapped IPv6 form
`hash_sockaddr()` produces different hashes for the same IPv4 address
depending on whether it's stored as `AF_INET` or IPv4-mapped IPv6
(`::ffff:a.b.c.d`). This breaks consistency in the client_mgr cache:
NFS inserts using the mapped form, but RemoveClient clears using the
plain IPv4 form, leaving a stale pointer after free.
Problem:
- `sockaddr_cmp()` treats both forms as equal (canonicalization on compare)
- `hash_sockaddr()` did not normalize them the same way on little-endian hosts
- RemoveClient cache invalidation misses, leaving freed entry accessible
- Subsequent remount hits stale cache → use-after-free or crash in `sockaddr_cmp()`
Solution:
1. Normalize `AF_INET` to IPv4-mapped IPv6 before hashing in `hash_sockaddr()`
so both forms produce the same hash.
2. Use the stored client address hash in `remove_gsh_client()` for cache
invalidation (defensive; now redundant but future-proof).
Change-Id: Ibf2d8a5fc1a81b3ef48551c895e7af2c4d173897
Signed-off-by: Suhas Athani <Suhas.Athani@ibm.com>
---
M src/support/client_mgr.c
M src/support/ip_utils.c
2 files changed, 20 insertions(+), 11 deletions(-)
git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/48/1243948/1
To view, visit change 1243948. To unsubscribe, or for help writing mail filters, visit settings.