diff options
author | Karsten Graul <kgraul@linux.ibm.com> | 2020-07-18 15:06:12 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-07-20 00:30:22 +0200 |
commit | 63673597cca93ef6fa12414933da01d5806547af (patch) | |
tree | 14ebeb9eadeb32c3021ba843b01a1e48147c9db3 /net/smc/smc_ib.h | |
parent | net/smc: fix link lookup for new rdma connections (diff) | |
download | linux-63673597cca93ef6fa12414933da01d5806547af.tar.xz linux-63673597cca93ef6fa12414933da01d5806547af.zip |
net/smc: protect smc ib device initialization
Before an smc ib device is used the first time for an smc link it is
lazily initialized. When there are 2 active link groups and a new ib
device is brought online then it might happen that 2 link creations run
in parallel and enter smc_ib_setup_per_ibdev(). Both allocate new send
and receive completion queues on the device, but only one set of them
keeps assigned and the other leaks.
Fix that by protecting the setup and cleanup code using a mutex.
Reviewed-by: Ursula Braun <ubraun@linux.ibm.com>
Fixes: f3c1deddb21c ("net/smc: separate function for link initialization")
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc/smc_ib.h')
-rw-r--r-- | net/smc/smc_ib.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/smc/smc_ib.h b/net/smc/smc_ib.h index ae6776e1e726..2ce481187dd0 100644 --- a/net/smc/smc_ib.h +++ b/net/smc/smc_ib.h @@ -52,6 +52,7 @@ struct smc_ib_device { /* ib-device infos for smc */ DECLARE_BITMAP(ports_going_away, SMC_MAX_PORTS); atomic_t lnk_cnt; /* number of links on ibdev */ wait_queue_head_t lnks_deleted; /* wait 4 removal of all links*/ + struct mutex mutex; /* protect dev setup+cleanup */ }; struct smc_buf_desc; |