Patch "iavf: prevent accidental free of filter structure" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    iavf: prevent accidental free of filter structure

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iavf-prevent-accidental-free-of-filter-structure.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 697aaedf8084718895a7db5591c56fd72c2b9695
Author: Jacob Keller <jacob.e.keller@xxxxxxxxx>
Date:   Fri Jun 4 09:48:57 2021 -0700

    iavf: prevent accidental free of filter structure
    
    [ Upstream commit 4f0400803818f2642f066d3eacaf013f23554cc7 ]
    
    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: 0075fa0fadd0 ("i40evf: Add support to apply cloud filters")
    Signed-off-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>
    Tested-by: Tony Brelinski <tony.brelinski@xxxxxxxxx>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
index 43afe887cac9e..6f6cd013eef3e 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
@@ -3033,11 +3033,11 @@ static int iavf_configure_clsflower(struct iavf_adapter *adapter,
 	/* start out with flow type and eth type IPv4 to begin with */
 	filter->f.flow_type = VIRTCHNL_TCP_V4_FLOW;
 	err = iavf_parse_cls_flower(adapter, cls_flower, filter);
-	if (err < 0)
+	if (err)
 		goto err;
 
 	err = iavf_handle_tclass(adapter, tc, filter);
-	if (err < 0)
+	if (err)
 		goto err;
 
 	/* add filter to the list */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux