Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Pei Xiao <xiaopei01@kylinos.cn>
To: dlemoal@kernel.org, cassel@kernel.org, linux-ide@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: shuangpeng.kernel@gmail.com, Pei Xiao <xiaopei01@kylinos.cn>
Subject: [PATCH 0/2] ata: pata_parport: fix UAF on protocol module unload
Date: Wed,  2 Sep 2026 19:50:25 +0800	[thread overview]
Message-ID: <cover.1788349317.git.xiaopei01@kylinos.cn> (raw)

This series fixes use-after-free issues in pata_parport when a protocol
module goes away while pi_adapter devices created by it are still
attached.

Patch 1 pins the protocol module before the device becomes visible.
Previously try_module_get() ran after device_register(), so a forced
module unload in between left pi->proto dangling from the moment the
device appeared on the bus.

Patch 2 makes pata_parport_unregister_driver() tear down all adapters
using the protocol. Without this, the rollback path of a multi-protocol
module init (e.g. kbic registering k951 then k971) left the devices of
the already-registered protocol alive while the module loader freed the
module memory; removing such a dangling device later crashed in
pi_disconnect() dereferencing pi->proto->disconnect.

Pei Xiao (2):
  ata: pata_parport: pin the protocol module before device_register()
  ata: pata_parport: unregister devices on protocol unregister

 drivers/ata/pata_parport/pata_parport.c | 27 +++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

-- 
2.25.1


             reply	other threads:[~2026-09-02 11:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 11:50 Pei Xiao [this message]
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-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=cover.1788349317.git.xiaopei01@kylinos.cn \
    --to=xiaopei01@kylinos.cn \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shuangpeng.kernel@gmail.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