crypto: qat - add check for invalid PFVF protocol version 0
authorWojciech Ziemba <wojciech.ziemba@intel.com>
Thu, 7 Apr 2022 16:54:47 +0000 (17:54 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 15 Apr 2022 08:34:26 +0000 (16:34 +0800)
PFVF protocol version 0 is not a valid version, but PF drivers
currently would report any such version from VFs as compatible.
This patch adds an extra check for the invalid PFVF protocol
version 0.

Signed-off-by: Wojciech Ziemba <wojciech.ziemba@intel.com>
Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c

index 588352d..c059b98 100644 (file)
@@ -242,7 +242,9 @@ static int adf_handle_vf2pf_msg(struct adf_accel_dev *accel_dev, u8 vf_nr,
                        "VersionRequest received from VF%d (vers %d) to PF (vers %d)\n",
                        vf_nr, vf_compat_ver, ADF_PFVF_COMPAT_THIS_VERSION);
 
-               if (vf_compat_ver <= ADF_PFVF_COMPAT_THIS_VERSION)
+               if (vf_compat_ver == 0)
+                       compat = ADF_PF2VF_VF_INCOMPATIBLE;
+               else if (vf_compat_ver <= ADF_PFVF_COMPAT_THIS_VERSION)
                        compat = ADF_PF2VF_VF_COMPATIBLE;
                else
                        compat = ADF_PF2VF_VF_COMPAT_UNKNOWN;