Skip to content

Commit 63cfd21

Browse files
wanghuanhuan12kuba-moo
authored andcommitted
nfp: fix incorrect pointer deference when offloading IPsec with bonding
There are two pointers in struct xfrm_dev_offload, *dev, *real_dev. The *dev points whether bonding interface or real interface, if bonding IPsec offload is used, it points bonding interface; if not, it points real interface. And *real_dev always points real interface. So nfp should always use real_dev instead of dev. Prior to this change the system becomes unresponsive when offloading IPsec for a device which is a lower device to a bonding device. Fixes: 859a497 ("nfp: implement xfrm callbacks and expose ipsec offload feature to upper layer") CC: stable@vger.kernel.org Signed-off-by: Huanhuan Wang <huanhuan.wang@corigine.com> Acked-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Louis Peens <louis.peens@corigine.com> Link: https://lore.kernel.org/r/20230420140125.38521-1-louis.peens@corigine.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 461bb5b commit 63cfd21

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • drivers/net/ethernet/netronome/nfp/crypto

drivers/net/ethernet/netronome/nfp/crypto/ipsec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static void set_sha2_512hmac(struct nfp_ipsec_cfg_add_sa *cfg, int *trunc_len)
269269
static int nfp_net_xfrm_add_state(struct xfrm_state *x,
270270
struct netlink_ext_ack *extack)
271271
{
272-
struct net_device *netdev = x->xso.dev;
272+
struct net_device *netdev = x->xso.real_dev;
273273
struct nfp_ipsec_cfg_mssg msg = {};
274274
int i, key_len, trunc_len, err = 0;
275275
struct nfp_ipsec_cfg_add_sa *cfg;
@@ -513,7 +513,7 @@ static void nfp_net_xfrm_del_state(struct xfrm_state *x)
513513
.cmd = NFP_IPSEC_CFG_MSSG_INV_SA,
514514
.sa_idx = x->xso.offload_handle - 1,
515515
};
516-
struct net_device *netdev = x->xso.dev;
516+
struct net_device *netdev = x->xso.real_dev;
517517
struct nfp_net *nn;
518518
int err;
519519

0 commit comments

Comments
 (0)