• Wei Yongjun's avatar
    xfrm: Fix kernel panic when flush and dump SPD entries · d5654efd
    Wei Yongjun authored
    After flush the SPD entries, dump the SPD entries will cause kernel painc.
    
    Used the following commands to reproduct:
    
    - echo 'spdflush;' | setkey -c
    - echo 'spdadd 3ffe:501:ffff:ff01::/64 3ffe:501:ffff:ff04::/64  any -P out ipsec \
      ah/tunnel/3ffe:501:ffff:ff00:200:ff:fe00:b0b0-3ffe:501:ffff:ff02:200:ff:fe00:a1a1/require;\
      spddump;' | setkey -c
    - echo 'spdflush; spddump;' | setkey -c
    - echo 'spdadd 3ffe:501:ffff:ff01::/64 3ffe:501:ffff:ff04::/64  any -P out ipsec \
      ah/tunnel/3ffe:501:ffff:ff00:200:ff:fe00:b0b0-3ffe:501:ffff:ff02:200:ff:fe00:a1a1/require;\
      spddump;' | setkey -c
    
    This is because when flush the SPD entries, the SPD entry is not remove
    from the list.
    
    This patch fix the problem by remove the SPD entry from the list.
    Signed-off-by: default avatarWei Yongjun <yjwei@cn.fujitsu.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    d5654efd
xfrm_policy.c 64 KB