]> www.infradead.org Git - users/hch/dma-mapping.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)
commitaaf461af729b81dbb19ec33abe6da74702b352d2
tree3e5deb8abf9b6b474e42cafa672843e285f2d366
parentacb16b395c3f3d7502443e0c799c2b42df645642
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: e6ba5273d4ed ("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