Skip to content

Commit 4f04008

Browse files
jacob-kelleranguy11
authored andcommitted
iavf: prevent accidental free of filter structure
In iavf_config_clsflower, the filter structure could be accidentally released at the end, if iavf_parse_cls_flower or iavf_handle_tclass ever return a non-zero but positive value. In this case, the function continues through to the end, and will call kfree() on the filter structure even though it has been added to the linked list. This can actually happen because iavf_parse_cls_flower will return a positive IAVF_ERR_CONFIG value instead of the traditional negative error codes. Fix this by ensuring that the kfree() check and error checks are similar. Use the more idiomatic "if (err)" to catch all non-zero error codes. Fixes: 0075fa0 ("i40evf: Add support to apply cloud filters") Signed-off-by: Jacob Keller <[email protected]> Tested-by: Tony Brelinski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 8905072 commit 4f04008

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3108,11 +3108,11 @@ static int iavf_configure_clsflower(struct iavf_adapter *adapter,
31083108
/* start out with flow type and eth type IPv4 to begin with */
31093109
filter->f.flow_type = VIRTCHNL_TCP_V4_FLOW;
31103110
err = iavf_parse_cls_flower(adapter, cls_flower, filter);
3111-
if (err < 0)
3111+
if (err)
31123112
goto err;
31133113

31143114
err = iavf_handle_tclass(adapter, tc, filter);
3115-
if (err < 0)
3115+
if (err)
31163116
goto err;
31173117

31183118
/* add filter to the list */

0 commit comments

Comments
 (0)