mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Zhipeng Lu <alexious@zju.edu.cn>
Cc: Sunil Goutham <sgoutham@marvell.com>,
	Linu Cherian <lcherian@marvell.com>,
	Geetha sowjanya <gakula@marvell.com>,
	Jerin Jacob <jerinj@marvell.com>, hariprasad <hkelam@marvell.com>,
	Subbaraya Sundeep <sbhatta@marvell.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	George Cherian <george.cherian@marvell.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] octeontx2-af: fix a use-after-free in rvu_npa_register_reporters
Date: Tue, 05 Dec 2023 13:35:05 +0100	[thread overview]
Message-ID: <6bb19e86b3f5c83bbc85c09b845e52208ce424d7.camel@redhat.com> (raw)
In-Reply-To: <20231202095902.3264863-1-alexious@zju.edu.cn>

On Sat, 2023-12-02 at 17:59 +0800, Zhipeng Lu wrote:
> The rvu_dl will be freed in rvu_npa_health_reporters_destroy(rvu_dl)
> after the create_workqueue fails, and after that free, the rvu_dl will
> be translate back through rvu_npa_health_reporters_create,
> rvu_health_reporters_create, and rvu_register_dl. Finally it goes to the
> err_dl_health label, being freed again in
> rvu_health_reporters_destroy(rvu) by rvu_npa_health_reporters_destroy.
> In the second calls of rvu_npa_health_reporters_destroy, however,
> it uses rvu_dl->rvu_npa_health_reporter, which is already freed at
> the end of rvu_npa_health_reporters_destroy in the first call.
> 
> So this patch prevents the first destroy by instantly returning -ENONMEN
> when create_workqueue fails. In addition, since the failure of
> create_workqueue is the only entrence of label err, it has been
> integrated into the error-handling path of create_workqueue.
> 
> Fixes: f1168d1e207c ("octeontx2-af: Add devlink health reporters for NPA")
> Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
> ---
>  drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> index 41df5ac23f92..058f75dc4c8a 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> @@ -1285,7 +1285,7 @@ static int rvu_npa_register_reporters(struct rvu_devlink *rvu_dl)
>  
>  	rvu_dl->devlink_wq = create_workqueue("rvu_devlink_wq");
>  	if (!rvu_dl->devlink_wq)
> -		goto err;
> +		return -ENOMEM;
>  
>  	INIT_WORK(&rvu_reporters->intr_work, rvu_npa_intr_work);
>  	INIT_WORK(&rvu_reporters->err_work, rvu_npa_err_work);
> @@ -1293,9 +1293,6 @@ static int rvu_npa_register_reporters(struct rvu_devlink *rvu_dl)
>  	INIT_WORK(&rvu_reporters->ras_work, rvu_npa_ras_work);
>  
>  	return 0;
> -err:
> -	rvu_npa_health_reporters_destroy(rvu_dl);
> -	return -ENOMEM;
>  }
>  
>  static int rvu_npa_health_reporters_create(struct rvu_devlink *rvu_dl)

LGTM

Acked-by: Paolo Abeni <pabeni@redhat.com>

but allow some little more time for Marvel's people to have a better
look.

Cheers,

Paolo


  reply	other threads:[~2023-12-05 12:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-02  9:59 Zhipeng Lu
2023-12-05 12:35 ` Paolo Abeni [this message]
2023-12-05 13:13   ` [EXT] " Geethasowjanya Akula
2023-12-05 14:43     ` Paolo Abeni
2023-12-05 14:50 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6bb19e86b3f5c83bbc85c09b845e52208ce424d7.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=alexious@zju.edu.cn \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=george.cherian@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kuba@kernel.org \
    --cc=lcherian@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®