• Olga Kornievskaia's avatar
    NFSD: fix seqid in copy stateid · 3f9544ca
    Olga Kornievskaia authored
    s_stid->si_generation is a u32, copy->stateid.seqid is a __be32, so we
    should be byte-swapping here if necessary.
    
    This effectively undoes the byte-swap performed when reading
    s_stid->s_generation in nfsd4_decode_copy().  Without this second swap,
    the stateid we sent to the source in READ could be different from the
    one the client provided us in the COPY.  We didn't spot this in testing
    since our implementation always uses a 0 in the seqid field.  But other
    implementations might not do that.
    
    You'd think we should just skip the byte-swapping entirely, but the
    s_stid field can be used for either our own stateids (in the
    intra-server case) or foreign stateids (in the inter-server case), and
    the former are interpreted by us and need byte-swapping.
    Reported-by: default avatarkbuild test robot <lkp@intel.com>
    Fixes: d5e54eeb0e3d ("NFSD add nfs4 inter ssc to nfsd4_copy")
    Signed-off-by: default avatarOlga Kornievskaia <kolga@netapp.com>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
    3f9544ca
nfs4proc.c 85.8 KB