[M] Change in ...nfs-ganesha[next]: NFSv4: fix share_access_prev/share_deny_prev bitmask corruption
JAGNYA DATTA TRIPATHY has uploaded this change for review. ( https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/1238099?usp=email ) Change subject: NFSv4: fix share_access_prev/share_deny_prev bitmask corruption ...................................................................... NFSv4: fix share_access_prev/share_deny_prev bitmask corruption When OPEN4_SHARE_ACCESS_BOTH (3) is passed, the original code computes (1 << 3) = 8, setting only a phantom bit 3 in the share_access_prev tracking mask. The OPEN_DOWNGRADE validator looks for (1 << OPEN4_SHARE_ACCESS_READ) = bit 1 and (1 << OPEN4_SHARE_ACCESS_WRITE) = bit 2, neither of which is ever set, so any OPEN_DOWNGRADE following a BOTH-access open returns NFS4ERR_INVAL. This violates RFC 5661 §9.9.1. Introduce build_atomic_prev_mask() in nfs4_op_open.c to decompose a composite share value into its atomic component bit positions (READ and WRITE) before storing in the share_access_prev / share_deny_prev fields. Apply it to both the new-state creation path and the open-upgrade path. Introduce share_prev_covers() in nfs4_op_open_downgrade.c to perform the symmetric decomposition on the downgrade request before checking coverage. This fixes a secondary regression that the init-only fix would introduce: without this change a client downgrading back to BOTH (valid no-op) would see NFS4ERR_INVAL because (1 << 3) = 8 is no longer present in the corrected mask (which stores 6 = (1<<1)|(1<<2)). Truth table after fix (OPEN with BOTH, share_access_prev = 6): OPEN_DOWNGRADE to READ (1): required=2, 6&2=2 -> NFS4_OK OPEN_DOWNGRADE to WRITE (2): required=4, 6&4=4 -> NFS4_OK OPEN_DOWNGRADE to BOTH (3): required=6, 6&6=6 -> NFS4_OK Change-Id: I55dd120bd1fe71b6e5d54fc0fc33b1e92047411f Signed-off-by: Jagnya Tripathy <jagnya.tripathy@gmail.com> --- M src/Protocols/NFS/nfs4_op_open.c M src/Protocols/NFS/nfs4_op_open_downgrade.c 2 files changed, 43 insertions(+), 11 deletions(-) git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/99/1238099/1 -- To view, visit https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/1238099?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: I55dd120bd1fe71b6e5d54fc0fc33b1e92047411f Gerrit-Change-Number: 1238099 Gerrit-PatchSet: 1 Gerrit-Owner: JAGNYA DATTA TRIPATHY <jagnya.tripathy@gmail.com>
participants (1)
-
JAGNYA DATTA TRIPATHY (GerritHub)