• Sabrina Dubroca's avatar
    macsec: always read MACSEC_SA_ATTR_PN as a u64 · c630d1fe
    Sabrina Dubroca authored
    Currently, MACSEC_SA_ATTR_PN is handled inconsistently, sometimes as a
    u32, sometimes forced into a u64 without checking the actual length of
    the attribute. Instead, we can use nla_get_u64 everywhere, which will
    read up to 64 bits into a u64, capped by the actual length of the
    attribute coming from userspace.
    
    This fixes several issues:
     - the check in validate_add_rxsa doesn't work with 32-bit attributes
     - the checks in validate_add_txsa and validate_upd_sa incorrectly
       reject X << 32 (with X != 0)
    
    Fixes: 48ef50fa ("macsec: Netlink support of XPN cipher suites (IEEE 802.1AEbw)")
    Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c630d1fe
macsec.c 107 KB