[PATCH] net: microchip: vcap api: Fix memory leaks in vcap_api_encode_rule_test()

Daniel Machon daniel.machon at microchip.com
Fri Oct 11 03:24:59 PDT 2024


> Cc: stable at vger.kernel.org
> Fixes: a3c1e45156ad ("net: microchip: vcap: Fix use-after-free error in kunit test")
> Signed-off-by: Jinjie Ruan <ruanjinjie at huawei.com>
> ---
>  drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c b/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c
> index f2a5a36fdacd..7251121ab196 100644
> --- a/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c
> +++ b/drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c
> @@ -1444,6 +1444,8 @@ static void vcap_api_encode_rule_test(struct kunit *test)
> 
>         ret = vcap_del_rule(&test_vctrl, &test_netdev, id);
>         KUNIT_EXPECT_EQ(test, 0, ret);
> +
> +       vcap_free_rule(rule);
>  }

Wait, should vcap_del_rule not handle the freeing of the rule?
Maybe Emil can shed some light on this..

/Daniel

> 
>  static void vcap_api_set_rule_counter_test(struct kunit *test)
> --
> 2.34.1
> 



More information about the linux-arm-kernel mailing list