All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Niklas Cassel <cassel@kernel.org>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	"Martin K. Petersen" <mkp@kernel.org>
Cc: stable@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: scsi_ioctl: require write access for the depopulation commands
Date: Mon, 16 Nov 2026 12:40:36 -0800	[thread overview]
Message-ID: <037b2eab-65a0-439a-814b-cc653e8cc629@kernel.org> (raw)
In-Reply-To: <20261116183139.2878673-2-cassel@kernel.org>

On 11/16/26 10:31, Niklas Cassel wrote:
> scsi_cmd_allowed() lets anybody who can open a SCSI device, even
> read-only, send any SERVICE ACTION IN(16) command. Besides READ
> CAPACITY(16) and the other read-only service actions, that opcode also
> carries the storage element depopulation commands of SBC-4: REMOVE
> ELEMENT AND TRUNCATE, RESTORE ELEMENTS AND REBUILD and REMOVE ELEMENT
> AND MODIFY ZONES. These change the capacity of the device, and after
> REMOVE ELEMENT AND TRUNCATE the contents of the user data area may have
> no relation to what they were before.

Since that is basically reformatting the drive, I thing we can say that the
content is likely gone...

> SCSI devices that support depopulation execute these commands directly,
> and libata translates them to the equivalent ATA commands, so a user
> with read-only access to the device node can truncate the device through
> SG_IO, SCSI_IOCTL_SEND_COMMAND or bsg.
> 
> Treat these service actions like FORMAT UNIT and ERASE, which also
> destroy data, and only allow them if the device is opened for writing.
> The other SERVICE ACTION IN(16) service actions remain allowed for
> everybody who can open the device.
> 
> Cc: stable@vger.kernel.org

Hmmm... SAI_REMOVE_ELEMENT_AND_TRUNCATE and friends was defined with
2a0adbb80a2f ("scsi: define depopulation capabilities related service actions"),
which is in 7.3 only.

So maybe make that

Cc: stable@vger.kernel.org #7.3

?

Or maybe simply add:

Fixes: db496721cb0d ("ata: libata-scsi: add support for the REMOVE ELEMENT AND
TRUNCATE command")
Fixes: 1e307ca61a9c ("ata: libata-scsi: add support for the RESTORE ELEMENTS AND
REBUILD command")
Fixes: b448bb42bd10 ("ata: libata-scsi: add support for the REMOVE ELEMENT AND
MODIFY ZONES command")

> Signed-off-by: Niklas Cassel <cassel@kernel.org>

Otherwise looks good.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2026-11-16 20:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 18:31 [PATCH] scsi: scsi_ioctl: require write access for the depopulation commands Niklas Cassel
2026-11-16 20:40 ` Damien Le Moal [this message]
2026-11-17 12:26   ` Niklas Cassel

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=037b2eab-65a0-439a-814b-cc653e8cc629@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=cassel@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mkp@kernel.org \
    --cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.