]> www.infradead.org Git - users/hch/misc.git/commitdiff
usb-storage: reject probe of device one non-DMA HCDs when using highmem
authorChristoph Hellwig <hch@lst.de>
Wed, 30 Apr 2025 14:38:51 +0000 (09:38 -0500)
committerChristoph Hellwig <hch@lst.de>
Wed, 30 Apr 2025 14:58:05 +0000 (09:58 -0500)
usb-storage is the last user of the block layer bounce buffering now,
and only uses it for HCDs that do not support DMA on highmem configs.

Remove this support and fail the probe so that the block layer bounce
buffering can go away.

Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/usb/storage/usb.c

index d36f3b6992bbd290fb1cc350247ee5580abc1845..49bbfe4610d58427794d90da8f6d79aa473af951 100644 (file)
@@ -1057,12 +1057,15 @@ int usb_stor_probe1(struct us_data **pus,
 
        /*
         * Some USB host controllers can't do DMA; they have to use PIO.
-        * For such controllers we need to make sure the block layer sets
-        * up bounce buffers in addressable memory.
+        * We can't support these controllers on highmem systems as the
+        * usb-storage code lacks the code to kmap or bounce buffer.
         */
-       if (!hcd_uses_dma(bus_to_hcd(us->pusb_dev->bus)) ||
-           bus_to_hcd(us->pusb_dev->bus)->localmem_pool)
-               host->no_highmem = true;
+       if (IS_ENABLED(CONFIG_HIGHMEM) &&
+           (!hcd_uses_dma(bus_to_hcd(us->pusb_dev->bus)) ||
+            bus_to_hcd(us->pusb_dev->bus)->localmem_pool)) {
+               dev_warn(&intf->dev, "USB Mass Storage device not support on this HCD\n");
+               goto release;
+       }
 
        /* Get the unusual_devs entries and the descriptors */
        result = get_device_info(us, id, unusual_dev);
@@ -1081,6 +1084,7 @@ int usb_stor_probe1(struct us_data **pus,
 
 BadDevice:
        usb_stor_dbg(us, "storage_probe() failed\n");
+release:
        release_everything(us);
        return result;
 }