Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Dingisoul <dingiso.kernel@gmail.com>
To: loberman@redhat.com
Cc: James.Bottomley@HansenPartnership.com, dingiso.kernel@gmail.com,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	mkp@kernel.org
Subject: Re: [BUG] scsi: st: use-after-free race between st_remove() and st_open()/scsi_tape_get()
Date: Tue, 13 Oct 2026 16:01:48 -0400	[thread overview]
Message-ID: <20261013200148.1942808-1-dingiso.kernel@gmail.com> (raw)
In-Reply-To: <e5312492c3d90322f362b1b148f7dce4290c2ba1.camel@redhat.com>

Hi Laurence,

Applied your patch, rebuilt, and reran the original reproducer.
No KASAN report, no warnings, no panic across the whole run.

Looks good to me -- feel free to send it upstream.

Best,
Dingisoul

On your patch:
> Hello
>
> Please try this patch, let me know if it fixes this and I will send a
> follow up to finalize this fix.
>
>
> diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
> index f1c3c49466..d5b90bd1c6 100644
> --- a/drivers/scsi/st.c
> +++ b/drivers/scsi/st.c
> @@ -4509,11 +4509,11 @@ static void st_remove(struct scsi_device *SDp)
>  	remove_cdevs(tpnt);
>
>  	mutex_lock(&st_ref_mutex);
> -	kref_put(&tpnt->kref, scsi_tape_release);
> -	mutex_unlock(&st_ref_mutex);
>  	spin_lock(&st_index_lock);
>  	idr_remove(&st_index_idr, index);
>  	spin_unlock(&st_index_lock);
> +	kref_put(&tpnt->kref, scsi_tape_release);
> +	mutex_unlock(&st_ref_mutex);
>  }

  reply	other threads:[~2026-10-13 20:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 21:15 [BUG] scsi: st: use-after-free race between st_remove() and st_open()/scsi_tape_get() Dingisoul
2026-10-12 20:17 ` Dingisoul
2026-10-13 12:52   ` Laurence Oberman
2026-10-13 20:01     ` Dingisoul [this message]
2026-10-13 20:25       ` [PATCH] scsi: st: Fix use-after-free race between st_remove() and st_open() loberman

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=20261013200148.1942808-1-dingiso.kernel@gmail.com \
    --to=dingiso.kernel@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=loberman@redhat.com \
    --cc=mkp@kernel.org \
    /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