[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM4PR12MB5357EB2AF3F1AA4184DBF7B2C9539@DM4PR12MB5357.namprd12.prod.outlook.com>
Date: Sun, 25 Sep 2022 07:29:36 +0000
From: Raed Salem <raeds@...dia.com>
To: Sabrina Dubroca <sd@...asysnail.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: Lior Nahmanson <liorna@...dia.com>,
Saeed Mahameed <saeedm@...dia.com>
Subject: RE: [PATCH net-next] macsec: don't free NULL metadata_dst
>From: Sabrina Dubroca <sd@...asysnail.net>
>Sent: Friday, 23 September 2022 12:07
>To: netdev@...r.kernel.org
>Cc: Lior Nahmanson <liorna@...dia.com>; Raed Salem <raeds@...dia.com>;
>Saeed Mahameed <saeedm@...dia.com>; Sabrina Dubroca
><sd@...asysnail.net>
>Subject: [PATCH net-next] macsec: don't free NULL metadata_dst
>
>External email: Use caution opening links or attachments
>
>
>Commit 0a28bfd4971f added a metadata_dst to each tx_sc, but that's only
>allocated when macsec_add_dev has run, which happens after device
>registration. If the requested or computed SCI already exists, or if linking to
>the lower device fails, we will panic because metadata_dst_free can't handle
>NULL.
>
>Reproducer:
> ip link add link $lower type macsec
> ip link add link $lower type macsec
>
>Fixes: 0a28bfd4971f ("net/macsec: Add MACsec skb_metadata_dst Tx Data
>path support")
>Signed-off-by: Sabrina Dubroca <sd@...asysnail.net>
>---
> drivers/net/macsec.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index
>617f850bdb3a..ebcfe87bed23 100644
>--- a/drivers/net/macsec.c
>+++ b/drivers/net/macsec.c
>@@ -3734,7 +3734,8 @@ static void macsec_free_netdev(struct net_device
>*dev) {
> struct macsec_dev *macsec = macsec_priv(dev);
>
>- metadata_dst_free(macsec->secy.tx_sc.md_dst);
>+ if (macsec->secy.tx_sc.md_dst)
>+ metadata_dst_free(macsec->secy.tx_sc.md_dst);
> free_percpu(macsec->stats);
> free_percpu(macsec->secy.tx_sc.stats);
>
>--
>2.37.3
Acked by me
Powered by blists - more mailing lists