]> 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)
commitc8a2e7980558aba72be90d6ca3e25580722f9659
tree3e5deb8abf9b6b474e42cafa672843e285f2d366
parentd64972b55dd2517b1d18a32abfd449350e05a7d4
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: 04ceb4f47b30 ("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