Linux ATA/IDE development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pei Xiao" <xiaopei01@kylinos.cn>
Cc: cassel@kernel.org, linux-ide@vger.kernel.org, dlemoal@kernel.org
Subject: Re: [PATCH 1/2] ata: pata_parport: pin the protocol module before device_register()
Date: Wed, 02 Sep 2026 12:06:08 +0000	[thread overview]
Message-ID: <20260902120609.635581F000E9@smtp.kernel.org> (raw)
In-Reply-To: <eae63a4231a9d669f3dc140f34c7b90c860cad72.1788349317.git.xiaopei01@kylinos.cn>

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.

>  	if (pi->proto->init_proto && pi->proto->init_proto(pi) < 0)
>  		goto out_module_put;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1788349317.git.xiaopei01@kylinos.cn?part=1

  reply	other threads:[~2026-09-02 12:06 UTC|newest]

Thread overview: 5+ 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 [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=20260902120609.635581F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=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