]> git.baikalelectronics.ru Git - kernel.git/commit
ice: Fix incorrect locking in ice_vc_process_vf_msg()
authorIvan Vecera <ivecera@redhat.com>
Fri, 1 Apr 2022 10:40:52 +0000 (12:40 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 26 Apr 2022 16:26:33 +0000 (09:26 -0700)
commit1bb054be04ffb553b4652a12ab51239aca7f4ccf
tree3e5deb8abf9b6b474e42cafa672843e285f2d366
parentfd11c97aa4dab26af540f92914a30fe68016468d
ice: Fix incorrect locking in ice_vc_process_vf_msg()

Usage of mutex_trylock() in ice_vc_process_vf_msg() is incorrect
because message sent from VF is ignored and never processed.

Use mutex_lock() instead to fix the issue. It is safe because this
mutex is used to prevent races between VF related NDOs and
handlers processing request messages from VF and these handlers
are running in ice_service_task() context. Additionally move this
mutex lock prior ice_vc_is_opcode_allowed() call to avoid potential
races during allowlist access.

Fixes: f9f0a5ad8470 ("ice: Fix race conditions between virtchnl handling and VF ndo ops")
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_virtchnl.c