]> git.baikalelectronics.ru Git - kernel.git/commit
net/smc: protect smc ib device initialization
authorKarsten Graul <kgraul@linux.ibm.com>
Sat, 18 Jul 2020 13:06:12 +0000 (15:06 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 19 Jul 2020 22:30:22 +0000 (15:30 -0700)
commit89f51ef1541de1acf0d03a2d8728bad2936717bf
tree14ebeb9eadeb32c3021ba843b01a1e48147c9db3
parenta324e7ce8579af34f6eb75a066cca3962b60c088
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: b81516ce2643 ("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>
net/smc/smc_ib.c
net/smc/smc_ib.h