]> git.baikalelectronics.ru Git - kernel.git/commit
bonding: deal with xfrm state in all modes and add more error-checking
authorJarod Wilson <jarod@redhat.com>
Wed, 8 Jul 2020 17:46:31 +0000 (13:46 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 Jul 2020 22:37:14 +0000 (15:37 -0700)
commitaa48af102213eed3d5916e81cb9074c2b3d4d778
tree6c344b7909a47fb3b8ccc2048c48e9591e7d2793
parentc3f6a00b0aab35e7f23999ebc123e880ec9f459f
bonding: deal with xfrm state in all modes and add more error-checking

It's possible that device removal happens when the bond is in non-AB mode,
and addition happens in AB mode, so bond_ipsec_del_sa() never gets called,
which leaves security associations in an odd state if bond_ipsec_add_sa()
then gets called after switching the bond into AB. Just call add and
delete universally for all modes to keep things consistent.

However, it's also possible that this code gets called when the system is
shutting down, and the xfrm subsystem has already been disconnected from
the bond device, so we need to do some error-checking and bail, lest we
hit a null ptr deref.

Fixes: 4a36c3eccd30 ("bonding: allow xfrm offload setup post-module-load")
CC: Huy Nguyen <huyn@mellanox.com>
CC: Saeed Mahameed <saeedm@mellanox.com>
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: "David S. Miller" <davem@davemloft.net>
CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
CC: Jakub Kicinski <kuba@kernel.org>
CC: Steffen Klassert <steffen.klassert@secunet.com>
CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: netdev@vger.kernel.org
CC: intel-wired-lan@lists.osuosl.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c