Commit 90c9ab54 authored by Junxian Huang's avatar Junxian Huang Committed by openeuler-sync-bot
Browse files

RDMA/hns: Fix wild pointer error of RoCE bonding when rmmod hns3

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7WHE3



--------------------------------------------------------------------------

When rmmod hns3, the uninit procedure is in this order: pf0 roce uninit
instance, pf0 nic uninit instance, pf1 roce uninit instance, pf1 nic
uninit instance, and so on.

During pf0 nic uninit instance, pf0 netdev is unregistered and RoCE
bonding driver is will be notified by a bonding event. Then a clear-bond
work will be scheduled.

At this time, the clear-bond work and pf1 roce uninit instance are being
executed concurrently. As the clear-bond work modifies the instance state
of pf1 earlier, pf1 roce uninit instance will return when the state is
found changed. This leads to pf1 nic uninit instance fast enough to be
completed before the clear-bond work. When the clear-bond work accesses
pf1 nic resources which have been released, an error occurs.

To fix the error, add a new instance state to indicate an ongoing bond
work involving bonding uninit. The roce driver uninit instance will wait
for the completion of the bond work when the device being uninited is also
in the procedure of bonding uninit to avoid concurrency and make sure the
nic resources won't be released for the moment.

Fixes: e62a2027 ("RDMA/hns: support RoCE bonding")
Signed-off-by: default avatarJunxian Huang <huangjunxian6@hisilicon.com>
(cherry picked from commit 79c470b1)
parent d794ced4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment