@@ -2549,10 +2549,6 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode,
2549
2549
bool err_msg_format = false;
2550
2550
int valid_len = 0 ;
2551
2551
2552
- /* Check if VF is disabled. */
2553
- if (test_bit (I40E_VF_STATE_DISABLED , & vf -> vf_states ))
2554
- return I40E_ERR_PARAM ;
2555
-
2556
2552
/* Validate message length. */
2557
2553
switch (v_opcode ) {
2558
2554
case VIRTCHNL_OP_VERSION :
@@ -2657,10 +2653,6 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode,
2657
2653
if (msglen >= valid_len ) {
2658
2654
struct virtchnl_rss_key * vrk =
2659
2655
(struct virtchnl_rss_key * )msg ;
2660
- if (vrk -> key_len != I40E_HKEY_ARRAY_SIZE ) {
2661
- err_msg_format = true;
2662
- break ;
2663
- }
2664
2656
valid_len += vrk -> key_len - 1 ;
2665
2657
}
2666
2658
break ;
@@ -2669,10 +2661,6 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode,
2669
2661
if (msglen >= valid_len ) {
2670
2662
struct virtchnl_rss_lut * vrl =
2671
2663
(struct virtchnl_rss_lut * )msg ;
2672
- if (vrl -> lut_entries != I40E_VF_HLUT_ARRAY_SIZE ) {
2673
- err_msg_format = true;
2674
- break ;
2675
- }
2676
2664
valid_len += vrl -> lut_entries - 1 ;
2677
2665
}
2678
2666
break ;
@@ -2719,9 +2707,27 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode,
2719
2707
if (local_vf_id >= pf -> num_alloc_vfs )
2720
2708
return - EINVAL ;
2721
2709
vf = & (pf -> vf [local_vf_id ]);
2710
+
2711
+ /* Check if VF is disabled. */
2712
+ if (test_bit (I40E_VF_STATE_DISABLED , & vf -> vf_states ))
2713
+ return I40E_ERR_PARAM ;
2714
+
2722
2715
/* perform basic checks on the msg */
2723
2716
ret = i40e_vc_validate_vf_msg (vf , v_opcode , v_retval , msg , msglen );
2724
2717
2718
+ /* perform additional checks specific to this driver */
2719
+ if (v_opcode == VIRTCHNL_OP_CONFIG_RSS_KEY ) {
2720
+ struct virtchnl_rss_key * vrk = (struct virtchnl_rss_key * )msg ;
2721
+
2722
+ if (vrk -> key_len != I40E_HKEY_ARRAY_SIZE )
2723
+ ret = - EINVAL ;
2724
+ } else if (v_opcode == VIRTCHNL_OP_CONFIG_RSS_LUT ) {
2725
+ struct virtchnl_rss_lut * vrl = (struct virtchnl_rss_lut * )msg ;
2726
+
2727
+ if (vrl -> lut_entries != I40E_VF_HLUT_ARRAY_SIZE )
2728
+ ret = - EINVAL ;
2729
+ }
2730
+
2725
2731
if (ret ) {
2726
2732
dev_err (& pf -> pdev -> dev , "Invalid message from VF %d, opcode %d, len %d\n" ,
2727
2733
local_vf_id , v_opcode , msglen );
0 commit comments