[PATCH] USB: storage: include US_FL_NO_SAME in quirks mask

6 views
Skip to first unread message

Xu Rao

unread,
Jun 2, 2026, 1:51:11 AMJun 2
to st...@rowland.harvard.edu, gre...@linuxfoundation.org, linu...@vger.kernel.org, usb-s...@lists.one-eyed-alien.net, linux-...@vger.kernel.org, ra...@uniontech.com
usb_stor_adjust_quirks() parses the usb-storage.quirks module
parameter into a new flag set and then applies it with the quirk
mask to override built-in flags.

The mask is meant to cover the flags that can be overridden by
the module parameter. The 'k' quirk character sets US_FL_NO_SAME,
but US_FL_NO_SAME is not included in the mask.

As a result, the module parameter can set US_FL_NO_SAME, but it
cannot clear a built-in US_FL_NO_SAME flag by providing an override
entry that omits 'k'.

Add US_FL_NO_SAME to the mask so that the module parameter can
override it in the same way as the other supported flags.

Fixes: 8010622c86ca ("USB: UAS: introduce a quirk to set no_write_same")
Signed-off-by: Xu Rao <ra...@uniontech.com>
---
drivers/usb/storage/usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index fa83fe0defe2..064c7fc8e368 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -570,7 +570,7 @@ void usb_stor_adjust_quirks(struct usb_device *udev, u64 *fflags)
US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE |
US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES |
US_FL_MAX_SECTORS_240 | US_FL_NO_REPORT_LUNS |
- US_FL_ALWAYS_SYNC);
+ US_FL_ALWAYS_SYNC | US_FL_NO_SAME);

p = quirks;
while (*p) {
--
2.50.1

Alan Stern

unread,
Jun 2, 2026, 3:46:18 PMJun 2
to Xu Rao, gre...@linuxfoundation.org, linu...@vger.kernel.org, usb-s...@lists.one-eyed-alien.net, linux-...@vger.kernel.org
On Tue, Jun 02, 2026 at 01:38:42PM +0800, Xu Rao wrote:
> usb_stor_adjust_quirks() parses the usb-storage.quirks module
> parameter into a new flag set and then applies it with the quirk
> mask to override built-in flags.
>
> The mask is meant to cover the flags that can be overridden by
> the module parameter. The 'k' quirk character sets US_FL_NO_SAME,
> but US_FL_NO_SAME is not included in the mask.
>
> As a result, the module parameter can set US_FL_NO_SAME, but it
> cannot clear a built-in US_FL_NO_SAME flag by providing an override
> entry that omits 'k'.
>
> Add US_FL_NO_SAME to the mask so that the module parameter can
> override it in the same way as the other supported flags.
>
> Fixes: 8010622c86ca ("USB: UAS: introduce a quirk to set no_write_same")
> Signed-off-by: Xu Rao <ra...@uniontech.com>
> ---

Reviewed-by: Alan Stern <st...@rowland.harvard.edu>
Reply all
Reply to author
Forward
0 new messages