[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220504211020.dffltlb5is2rcz4g@skbuf>
Date: Wed, 4 May 2022 21:10:21 +0000
From: Vladimir Oltean <vladimir.oltean@....com>
To: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Vladimir Oltean <olteanv@...il.com>,
Claudiu Manoil <claudiu.manoil@....com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
"UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
Xiaoliang Yang <xiaoliang.yang_1@....com>,
Colin Foster <colin.foster@...advantage.com>
Subject: Re: [PATCH net 2/6] net: mscc: ocelot: avoid use after free with
deleted tc-trap rules
On Tue, May 03, 2022 at 02:57:24PM +0300, Vladimir Oltean wrote:
> The error path of ocelot_flower_parse() removes a VCAP filter from
> ocelot->traps, but the main deletion path - ocelot_vcap_filter_del() -
> does not.
>
> So functions such as felix_update_trapping_destinations() can still
> access the freed VCAP filter via ocelot->traps.
>
> Fix this bug by removing the filter from ocelot->traps when it gets
> deleted.
>
> Fixes: e42bd4ed09aa ("net: mscc: ocelot: keep traps in a list")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
> ---
> drivers/net/ethernet/mscc/ocelot_vcap.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/mscc/ocelot_vcap.c b/drivers/net/ethernet/mscc/ocelot_vcap.c
> index 1e74bdb215ec..571d43e59f63 100644
> --- a/drivers/net/ethernet/mscc/ocelot_vcap.c
> +++ b/drivers/net/ethernet/mscc/ocelot_vcap.c
> @@ -1232,6 +1232,8 @@ static void ocelot_vcap_block_remove_filter(struct ocelot *ocelot,
> if (ocelot_vcap_filter_equal(filter, tmp)) {
> ocelot_vcap_filter_del_aux_resources(ocelot, tmp);
> list_del(&tmp->list);
> + if (!list_empty(&tmp->trap_list))
> + list_del(&tmp->trap_list);
> kfree(tmp);
> }
> }
> --
> 2.25.1
>
This change introduces other breakage, please drop this patch set and
allow me to come up with a different solution.
Powered by blists - more mailing lists