mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
bnxt_en: extend RTNL to VF check in devlink driver_reinit
The fixes the race condition between configuring SR-IOV and devlink
reload. The SR-IOV configure logic already takes the RTNL lock,
setting sriov_cfg under the lock while changes are underway. Extend
the lock scope in devlink driver_reinit to cover the VF check and
don't run concurrently with SR-IOV configure.
Reported-by: Leon Romanovsky <leon@kernel.org>
Fixes: 228ea8c187
("bnxt_en: implement devlink dev reload driver_reinit")
Cc: Leon Romanovsky <leon@kernel.org>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Andy Gospodarek <gospo@broadcom.com>
Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e97b21e946
commit
46d08f55d2
1 changed files with 4 additions and 3 deletions
|
@ -441,12 +441,13 @@ static int bnxt_dl_reload_down(struct devlink *dl, bool netns_change,
|
|||
|
||||
switch (action) {
|
||||
case DEVLINK_RELOAD_ACTION_DRIVER_REINIT: {
|
||||
if (BNXT_PF(bp) && bp->pf.active_vfs) {
|
||||
rtnl_lock();
|
||||
if (BNXT_PF(bp) && (bp->pf.active_vfs || bp->sriov_cfg)) {
|
||||
NL_SET_ERR_MSG_MOD(extack,
|
||||
"reload is unsupported when VFs are allocated");
|
||||
"reload is unsupported while VFs are allocated or being configured");
|
||||
rtnl_unlock();
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
rtnl_lock();
|
||||
if (bp->dev->reg_state == NETREG_UNREGISTERED) {
|
||||
rtnl_unlock();
|
||||
return -ENODEV;
|
||||
|
|
Loading…
Reference in a new issue