Suhas Athani has uploaded this change for review. (
https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/1243948?usp=email )
Change subject: Normalize IPv4 addresses in hash_sockaddr() to match IPv4-mapped IPv6
form
......................................................................
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(a)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
https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/1243948?usp=email
To unsubscribe, or for help writing mail filters, visit
https://review.gerrithub.io/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: Ibf2d8a5fc1a81b3ef48551c895e7af2c4d173897
Gerrit-Change-Number: 1243948
Gerrit-PatchSet: 1
Gerrit-Owner: Suhas Athani <Suhas.Athani(a)ibm.com>