summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorTaehee Yoo <ap420073@gmail.com>2021-07-05 15:38:12 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-28 14:35:33 +0200
commit56ccdf868ab6010739a24a3d72c3e53fd0e1ace2 (patch)
tree4144a40b5c4a0f9077d08fe786db0594d7b48fed /include/net
parentb3bd1f5e503716e09610e49bdccc36ed9356d27c (diff)
downloadlinux-stable-56ccdf868ab6010739a24a3d72c3e53fd0e1ace2.tar.gz
linux-stable-56ccdf868ab6010739a24a3d72c3e53fd0e1ace2.tar.bz2
linux-stable-56ccdf868ab6010739a24a3d72c3e53fd0e1ace2.zip
bonding: Add struct bond_ipesc to manage SA
[ Upstream commit 9a5605505d9c7dbfdb89cc29a8f5fc5cf9fd2334 ] bonding has been supporting ipsec offload. When SA is added, bonding just passes SA to its own active real interface. But it doesn't manage SA. So, when events(add/del real interface, active real interface change, etc) occur, bonding can't handle that well because It doesn't manage SA. So some problems(panic, UAF, refcnt leak)occur. In order to make it stable, it should manage SA. That's the reason why struct bond_ipsec is added. When a new SA is added to bonding interface, it is stored in the bond_ipsec list. And the SA is passed to a current active real interface. If events occur, it uses bond_ipsec data to handle these events. bond->ipsec_list is protected by bond->ipsec_lock. If a current active real interface is changed, the following logic works. 1. delete all SAs from old active real interface 2. Add all SAs to the new active real interface. 3. If a new active real interface doesn't support ipsec offload or SA's option, it sets real_dev to NULL. Fixes: 18cb261afd7b ("bonding: support hardware encryption offload to slaves") Signed-off-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/bonding.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/net/bonding.h b/include/net/bonding.h
index adc3da776970..67d676059aa0 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -199,6 +199,11 @@ struct bond_up_slave {
*/
#define BOND_LINK_NOCHANGE -1
+struct bond_ipsec {
+ struct list_head list;
+ struct xfrm_state *xs;
+};
+
/*
* Here are the locking policies for the two bonding locks:
* Get rcu_read_lock when reading or RTNL when writing slave list.
@@ -247,7 +252,9 @@ struct bonding {
#endif /* CONFIG_DEBUG_FS */
struct rtnl_link_stats64 bond_stats;
#ifdef CONFIG_XFRM_OFFLOAD
- struct xfrm_state *xs;
+ struct list_head ipsec_list;
+ /* protecting ipsec_list */
+ spinlock_t ipsec_lock;
#endif /* CONFIG_XFRM_OFFLOAD */
};