OSDN Git Service

ice: Fix probe/open race condition
authorAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Fri, 8 May 2020 00:41:03 +0000 (17:41 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 22 May 2020 05:10:04 +0000 (22:10 -0700)
commitde75135b5c04c96dc8bbb005511b7a79d952d7eb
treeae495b83e608ae1c4f71fe5e26ce99e2a54578d6
parent46a316500e060abd4c5745f45ffdc28d426dc99b
ice: Fix probe/open race condition

As soon as the driver registers the PF netdev, userspace utilities
like NetworkManager try to bring up the associated interface. When
this happens, the driver may not have finished initializing fully,
resulting in a bunch of errors in the interface up flow.

The driver already has a mechanism to indicate if it's not up yet;
by setting the __ICE_DOWN bit in pf->state, but this bit gets
cleared too early in the current flow. So clear this bit only when
the driver is fully up. Also check for the same bit in the ice_open
flow, and return -EBUSY if the bit is set.

Also in ice_open, replace references of vsi->back with a local
variable.

Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ice/ice_main.c