Skip to content

Commit

Permalink
xfrm: Fix NETDEV_DOWN with IPSec offload
Browse files Browse the repository at this point in the history
Upon NETDEV_DOWN event, all xfrm_state objects which are bound to
the device are flushed.

The condition for this is wrong, though, testing dev->hw_features
instead of dev->features. If a device has non-user-modifiable
NETIF_F_HW_ESP, then its xfrm_state objects are not flushed,
causing a crash later on after the device is deleted.

Check dev->features instead of dev->hw_features.

Fixes: d77e38e ("xfrm: Add an IPsec hardware offloading API")
Signed-off-by: Ilan Tayari <ilant@mellanox.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
  • Loading branch information
Ilan Tayari authored and Steffen Klassert committed May 8, 2017
1 parent d90c902 commit 2c1497b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/xfrm/xfrm_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ static int xfrm_dev_feat_change(struct net_device *dev)

static int xfrm_dev_down(struct net_device *dev)
{
if (dev->hw_features & NETIF_F_HW_ESP)
if (dev->features & NETIF_F_HW_ESP)
xfrm_dev_state_flush(dev_net(dev), dev, true);

xfrm_garbage_collect(dev_net(dev));
Expand Down

0 comments on commit 2c1497b

Please sign in to comment.