Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: Pei Xiao <xiaopei01@kylinos.cn>,
	linux-ide@vger.kernel.org, dlemoal@kernel.org
Subject: Re: [PATCH 1/2] ata: pata_parport: pin the protocol module before device_register()
Date: Fri, 4 Sep 2026 18:29:52 +0200	[thread overview]
Message-ID: <apryADzYkvYwj358@ryzen> (raw)
In-Reply-To: <20260902120609.635581F000E9@smtp.kernel.org>

On Wed, Sep 02, 2026 at 12:06:08PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] Unused label `out_unreg_dev` causes compiler warning.
> --
> 
> commit 99f7607699410f6446da6e37e3bed84251a51bd8
> Author: Pei Xiao <xiaopei01@kylinos.cn>
> 
> ata: pata_parport: pin the protocol module before device_register()
> 
> Take the module reference before registering the device to prevent a race
> condition where the device is visible but the protocol module is not yet
> pinned. Also ensure the reference is dropped on the device_register()
> failure path.
> 
> > diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_parport/pata_parport.c
> > index cf81a6128f552..7462f9b1acc57 100644
> > --- a/drivers/ata/pata_parport/pata_parport.c
> > +++ b/drivers/ata/pata_parport/pata_parport.c
> 
> [ ... ]
> 
> > @@ -517,15 +525,12 @@ static struct pi_adapter *pi_init_one(struct parport *parport,
> >  	pi->dev.id = id;
> >  	dev_set_name(&pi->dev, "pata_parport.%u", pi->dev.id);
> >  	if (device_register(&pi->dev)) {
> > +		module_put(pi->proto->owner);
> >  		put_device(&pi->dev);
> >  		/* pata_parport_dev_release will do ida_free(dev->id) and kfree(pi) */
> >  		return NULL;
> >  	}
> >  
> > -	pi->proto = pr;
> > -
> > -	if (!try_module_get(pi->proto->owner))
> > -		goto out_unreg_dev;
> 
> [Severity: Low]
> Does removing this goto leave the out_unreg_dev label unused at the bottom
> of pi_init_one()?
> 
> If the label is no longer referenced, compiling the kernel will emit a
> -Wunused-label warning. This can cause build failures in configurations
> that enforce -Werror.

We don't want to introduce any new build warnings.

W=1 builds are important too, even if not default.


Kind regards,
Niklas

  reply	other threads:[~2026-09-04 16:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 11:50 [PATCH 0/2] ata: pata_parport: fix UAF on protocol module unload Pei Xiao
2026-09-02 11:50 ` [PATCH 1/2] ata: pata_parport: pin the protocol module before device_register() Pei Xiao
2026-09-02 12:06   ` sashiko-bot
2026-09-04 16:29     ` Niklas Cassel [this message]
2026-09-02 11:50 ` [PATCH 2/2] ata: pata_parport: unregister devices on protocol unregister Pei Xiao
2026-09-02 12:07   ` sashiko-bot

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=apryADzYkvYwj358@ryzen \
    --to=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=xiaopei01@kylinos.cn \
    /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