]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.10
authorSasha Levin <sashal@kernel.org>
Sat, 4 Jan 2025 02:42:50 +0000 (21:42 -0500)
committerSasha Levin <sashal@kernel.org>
Sat, 4 Jan 2025 02:42:50 +0000 (21:42 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
14 files changed:
queue-5.10/block-remove-the-update_bdev-parameter-to-set_capaci.patch [new file with mode: 0644]
queue-5.10/drivers-block-zram-zram_drv.c-do-not-keep-dangling-z.patch [new file with mode: 0644]
queue-5.10/loop-let-set_capacity_revalidate_and_notify-update-t.patch [new file with mode: 0644]
queue-5.10/nvme-let-set_capacity_revalidate_and_notify-update-t.patch [new file with mode: 0644]
queue-5.10/sd-update-the-bdev-size-in-sd_revalidate_disk.patch [new file with mode: 0644]
queue-5.10/series
queue-5.10/thunderbolt-add-intel-barlow-ridge-pci-id.patch [new file with mode: 0644]
queue-5.10/thunderbolt-add-support-for-intel-alder-lake.patch [new file with mode: 0644]
queue-5.10/thunderbolt-add-support-for-intel-lunar-lake.patch [new file with mode: 0644]
queue-5.10/thunderbolt-add-support-for-intel-meteor-lake.patch [new file with mode: 0644]
queue-5.10/thunderbolt-add-support-for-intel-panther-lake-m-p.patch [new file with mode: 0644]
queue-5.10/thunderbolt-add-support-for-intel-raptor-lake.patch [new file with mode: 0644]
queue-5.10/zram-fix-uninitialized-zram-not-releasing-backing-de.patch [new file with mode: 0644]
queue-5.10/zram-use-set_capacity_and_notify.patch [new file with mode: 0644]

diff --git a/queue-5.10/block-remove-the-update_bdev-parameter-to-set_capaci.patch b/queue-5.10/block-remove-the-update_bdev-parameter-to-set_capaci.patch
new file mode 100644 (file)
index 0000000..c6dda89
--- /dev/null
@@ -0,0 +1,159 @@
+From 4e42e03746043963bf20a69e60e408470e1c083e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 16 Nov 2020 15:56:56 +0100
+Subject: block: remove the update_bdev parameter to
+ set_capacity_revalidate_and_notify
+
+From: Christoph Hellwig <hch@lst.de>
+
+[ Upstream commit 449f4ec9892ebc2f37a7eae6d97db2cf7c65e09a ]
+
+The update_bdev argument is always set to true, so remove it.  Also
+rename the function to the slighly less verbose set_capacity_and_notify,
+as propagating the disk size to the block device isn't really
+revalidation.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Hannes Reinecke <hare@suse.de>
+Reviewed-by: Petr Vorel <pvorel@suse.cz>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Stable-dep-of: 74363ec674cb ("zram: fix uninitialized ZRAM not releasing backing device")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ block/genhd.c                | 13 +++++--------
+ drivers/block/loop.c         |  2 +-
+ drivers/block/virtio_blk.c   |  2 +-
+ drivers/block/xen-blkfront.c |  2 +-
+ drivers/nvme/host/core.c     |  2 +-
+ drivers/scsi/sd.c            |  5 ++---
+ include/linux/genhd.h        |  3 +--
+ 7 files changed, 12 insertions(+), 17 deletions(-)
+
+diff --git a/block/genhd.c b/block/genhd.c
+index 796baf761202..768a49460bf1 100644
+--- a/block/genhd.c
++++ b/block/genhd.c
+@@ -46,17 +46,15 @@ static void disk_del_events(struct gendisk *disk);
+ static void disk_release_events(struct gendisk *disk);
+ /*
+- * Set disk capacity and notify if the size is not currently
+- * zero and will not be set to zero
++ * Set disk capacity and notify if the size is not currently zero and will not
++ * be set to zero.  Returns true if a uevent was sent, otherwise false.
+  */
+-bool set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
+-                                      bool update_bdev)
++bool set_capacity_and_notify(struct gendisk *disk, sector_t size)
+ {
+       sector_t capacity = get_capacity(disk);
+       set_capacity(disk, size);
+-      if (update_bdev)
+-              revalidate_disk_size(disk, true);
++      revalidate_disk_size(disk, true);
+       if (capacity != size && capacity != 0 && size != 0) {
+               char *envp[] = { "RESIZE=1", NULL };
+@@ -67,8 +65,7 @@ bool set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
+       return false;
+ }
+-
+-EXPORT_SYMBOL_GPL(set_capacity_revalidate_and_notify);
++EXPORT_SYMBOL_GPL(set_capacity_and_notify);
+ /*
+  * Format the device name of the indicated disk into the supplied buffer and
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c
+index 198f7ce3234b..b30f4d525bc8 100644
+--- a/drivers/block/loop.c
++++ b/drivers/block/loop.c
+@@ -238,7 +238,7 @@ static void __loop_update_dio(struct loop_device *lo, bool dio)
+  */
+ static void loop_set_size(struct loop_device *lo, loff_t size)
+ {
+-      if (!set_capacity_revalidate_and_notify(lo->lo_disk, size, true))
++      if (!set_capacity_and_notify(lo->lo_disk, size))
+               kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE);
+ }
+diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
+index 28ea9b511fd0..c87c6a4eb3b3 100644
+--- a/drivers/block/virtio_blk.c
++++ b/drivers/block/virtio_blk.c
+@@ -470,7 +470,7 @@ static void virtblk_update_capacity(struct virtio_blk *vblk, bool resize)
+                  cap_str_10,
+                  cap_str_2);
+-      set_capacity_revalidate_and_notify(vblk->disk, capacity, true);
++      set_capacity_and_notify(vblk->disk, capacity);
+ }
+ static void virtblk_config_changed_work(struct work_struct *work)
+diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
+index d68a8ca2161f..19ddbf977d28 100644
+--- a/drivers/block/xen-blkfront.c
++++ b/drivers/block/xen-blkfront.c
+@@ -2443,7 +2443,7 @@ static void blkfront_connect(struct blkfront_info *info)
+                       return;
+               printk(KERN_INFO "Setting capacity to %Lu\n",
+                      sectors);
+-              set_capacity_revalidate_and_notify(info->gd, sectors, true);
++              set_capacity_and_notify(info->gd, sectors);
+               return;
+       case BLKIF_STATE_SUSPENDED:
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
+index c8e64a1e2fc0..c739ac1761ba 100644
+--- a/drivers/nvme/host/core.c
++++ b/drivers/nvme/host/core.c
+@@ -2132,7 +2132,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
+                       capacity = 0;
+       }
+-      set_capacity_revalidate_and_notify(disk, capacity, true);
++      set_capacity_and_notify(disk, capacity);
+       nvme_config_discard(disk, ns);
+       nvme_config_write_zeroes(disk->queue, ns->ctrl);
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
+index 355d38cab862..da6df9809b0c 100644
+--- a/drivers/scsi/sd.c
++++ b/drivers/scsi/sd.c
+@@ -3292,8 +3292,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
+       sdkp->first_scan = 0;
+-      set_capacity_revalidate_and_notify(disk,
+-              logical_to_sectors(sdp, sdkp->capacity), true);
++      set_capacity_and_notify(disk, logical_to_sectors(sdp, sdkp->capacity));
+       sd_config_write_same(sdkp);
+       kfree(buffer);
+@@ -3303,7 +3302,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
+        * capacity to 0.
+        */
+       if (sd_zbc_revalidate_zones(sdkp))
+-              set_capacity_revalidate_and_notify(disk, 0, true);
++              set_capacity_and_notify(disk, 0);
+  out:
+       return 0;
+diff --git a/include/linux/genhd.h b/include/linux/genhd.h
+index 03da3f603d30..4b22bfd9336e 100644
+--- a/include/linux/genhd.h
++++ b/include/linux/genhd.h
+@@ -315,8 +315,7 @@ static inline int get_disk_ro(struct gendisk *disk)
+ extern void disk_block_events(struct gendisk *disk);
+ extern void disk_unblock_events(struct gendisk *disk);
+ extern void disk_flush_events(struct gendisk *disk, unsigned int mask);
+-bool set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
+-              bool update_bdev);
++bool set_capacity_and_notify(struct gendisk *disk, sector_t size);
+ /* drivers/char/random.c */
+ extern void add_disk_randomness(struct gendisk *disk) __latent_entropy;
+-- 
+2.39.5
+
diff --git a/queue-5.10/drivers-block-zram-zram_drv.c-do-not-keep-dangling-z.patch b/queue-5.10/drivers-block-zram-zram_drv.c-do-not-keep-dangling-z.patch
new file mode 100644 (file)
index 0000000..0c20742
--- /dev/null
@@ -0,0 +1,66 @@
+From 6c5f7461bae51ae92a916c899f0378ba84775dd0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 24 Aug 2022 12:51:00 +0900
+Subject: drivers/block/zram/zram_drv.c: do not keep dangling zcomp pointer
+ after zram reset
+
+From: Sergey Senozhatsky <senozhatsky@chromium.org>
+
+[ Upstream commit 6d2453c3dbc5f70eafc1c866289a90a1fc57ce18 ]
+
+We do all reset operations under write lock, so we don't need to save
+->disksize and ->comp to stack variables.  Another thing is that ->comp is
+freed during zram reset, but comp pointer is not NULL-ed, so zram keeps
+the freed pointer value.
+
+Link: https://lkml.kernel.org/r/20220824035100.971816-1-senozhatsky@chromium.org
+Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
+Cc: Minchan Kim <minchan@kernel.org>
+Cc: Nitin Gupta <ngupta@vflare.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Stable-dep-of: 74363ec674cb ("zram: fix uninitialized ZRAM not releasing backing device")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/zram/zram_drv.c | 13 ++++---------
+ 1 file changed, 4 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
+index 8f38e5a1a63f..8e13586be8c9 100644
+--- a/drivers/block/zram/zram_drv.c
++++ b/drivers/block/zram/zram_drv.c
+@@ -1690,9 +1690,6 @@ static int zram_rw_page(struct block_device *bdev, sector_t sector,
+ static void zram_reset_device(struct zram *zram)
+ {
+-      struct zcomp *comp;
+-      u64 disksize;
+-
+       down_write(&zram->init_lock);
+       zram->limit_pages = 0;
+@@ -1702,18 +1699,16 @@ static void zram_reset_device(struct zram *zram)
+               return;
+       }
+-      comp = zram->comp;
+-      disksize = zram->disksize;
+-      zram->disksize = 0;
+-
+       set_capacity_and_notify(zram->disk, 0);
+       part_stat_set_all(&zram->disk->part0, 0);
+       up_write(&zram->init_lock);
+       /* I/O operation under all of CPU are done so let's free */
+-      zram_meta_free(zram, disksize);
++      zram_meta_free(zram, zram->disksize);
++      zram->disksize = 0;
+       memset(&zram->stats, 0, sizeof(zram->stats));
+-      zcomp_destroy(comp);
++      zcomp_destroy(zram->comp);
++      zram->comp = NULL;
+       reset_bdev(zram);
+ }
+-- 
+2.39.5
+
diff --git a/queue-5.10/loop-let-set_capacity_revalidate_and_notify-update-t.patch b/queue-5.10/loop-let-set_capacity_revalidate_and_notify-update-t.patch
new file mode 100644 (file)
index 0000000..f702463
--- /dev/null
@@ -0,0 +1,42 @@
+From 549838e515708f8ed50c9c55cb15965698642aaf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 16 Nov 2020 15:56:53 +0100
+Subject: loop: let set_capacity_revalidate_and_notify update the bdev size
+
+From: Christoph Hellwig <hch@lst.de>
+
+[ Upstream commit 3b4f85d02a4bd85cbea999a064235a47694bbb7b ]
+
+There is no good reason to call revalidate_disk_size separately.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Hannes Reinecke <hare@suse.de>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Stable-dep-of: 74363ec674cb ("zram: fix uninitialized ZRAM not releasing backing device")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/loop.c | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c
+index 7444cc2a6c86..198f7ce3234b 100644
+--- a/drivers/block/loop.c
++++ b/drivers/block/loop.c
+@@ -238,12 +238,8 @@ static void __loop_update_dio(struct loop_device *lo, bool dio)
+  */
+ static void loop_set_size(struct loop_device *lo, loff_t size)
+ {
+-      struct block_device *bdev = lo->lo_device;
+-
+-      bd_set_nr_sectors(bdev, size);
+-
+-      if (!set_capacity_revalidate_and_notify(lo->lo_disk, size, false))
+-              kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
++      if (!set_capacity_revalidate_and_notify(lo->lo_disk, size, true))
++              kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE);
+ }
+ static inline int
+-- 
+2.39.5
+
diff --git a/queue-5.10/nvme-let-set_capacity_revalidate_and_notify-update-t.patch b/queue-5.10/nvme-let-set_capacity_revalidate_and_notify-update-t.patch
new file mode 100644 (file)
index 0000000..c112063
--- /dev/null
@@ -0,0 +1,53 @@
+From 3559f7961e40869ab03a3b82135b76f9e5ec1e6e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 16 Nov 2020 15:56:54 +0100
+Subject: nvme: let set_capacity_revalidate_and_notify update the bdev size
+
+From: Christoph Hellwig <hch@lst.de>
+
+[ Upstream commit 5dd55749b79cdf471ca0966ad91541daebac3e2f ]
+
+There is no good reason to call revalidate_disk_size separately.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Hannes Reinecke <hare@suse.de>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Stable-dep-of: 74363ec674cb ("zram: fix uninitialized ZRAM not releasing backing device")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nvme/host/core.c | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
+index bee55902fe6c..c8e64a1e2fc0 100644
+--- a/drivers/nvme/host/core.c
++++ b/drivers/nvme/host/core.c
+@@ -2132,7 +2132,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
+                       capacity = 0;
+       }
+-      set_capacity_revalidate_and_notify(disk, capacity, false);
++      set_capacity_revalidate_and_notify(disk, capacity, true);
+       nvme_config_discard(disk, ns);
+       nvme_config_write_zeroes(disk->queue, ns->ctrl);
+@@ -2213,7 +2213,6 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
+               blk_stack_limits(&ns->head->disk->queue->limits,
+                                &ns->queue->limits, 0);
+               blk_queue_update_readahead(ns->head->disk->queue);
+-              nvme_update_bdev_size(ns->head->disk);
+               blk_mq_unfreeze_queue(ns->head->disk->queue);
+       }
+ #endif
+@@ -4095,8 +4094,6 @@ static void nvme_validate_ns(struct nvme_ns *ns, struct nvme_ns_ids *ids)
+        */
+       if (ret > 0 && (ret & NVME_SC_DNR))
+               nvme_ns_remove(ns);
+-      else
+-              revalidate_disk_size(ns->disk, true);
+ }
+ static void nvme_validate_or_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
+-- 
+2.39.5
+
diff --git a/queue-5.10/sd-update-the-bdev-size-in-sd_revalidate_disk.patch b/queue-5.10/sd-update-the-bdev-size-in-sd_revalidate_disk.patch
new file mode 100644 (file)
index 0000000..4bbb325
--- /dev/null
@@ -0,0 +1,60 @@
+From 8f5f6fd0d69bcc9ced33435207c039bcc88d81b3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 16 Nov 2020 15:56:55 +0100
+Subject: sd: update the bdev size in sd_revalidate_disk
+
+From: Christoph Hellwig <hch@lst.de>
+
+[ Upstream commit b200e38c493b2a5acff4f86d40a3e45d546c664c ]
+
+This avoids the extra call to revalidate_disk_size in sd_rescan and
+is otherwise a no-op because the size did not change, or we are in
+the probe path.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Hannes Reinecke <hare@suse.de>
+Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Stable-dep-of: 74363ec674cb ("zram: fix uninitialized ZRAM not releasing backing device")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/sd.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
+index 2f2ca2878876..355d38cab862 100644
+--- a/drivers/scsi/sd.c
++++ b/drivers/scsi/sd.c
+@@ -1767,10 +1767,8 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)
+ static void sd_rescan(struct device *dev)
+ {
+       struct scsi_disk *sdkp = dev_get_drvdata(dev);
+-      int ret;
+-      ret = sd_revalidate_disk(sdkp->disk);
+-      revalidate_disk_size(sdkp->disk, ret == 0);
++      sd_revalidate_disk(sdkp->disk);
+ }
+ static int sd_ioctl(struct block_device *bdev, fmode_t mode,
+@@ -3295,7 +3293,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
+       sdkp->first_scan = 0;
+       set_capacity_revalidate_and_notify(disk,
+-              logical_to_sectors(sdp, sdkp->capacity), false);
++              logical_to_sectors(sdp, sdkp->capacity), true);
+       sd_config_write_same(sdkp);
+       kfree(buffer);
+@@ -3305,7 +3303,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
+        * capacity to 0.
+        */
+       if (sd_zbc_revalidate_zones(sdkp))
+-              set_capacity_revalidate_and_notify(disk, 0, false);
++              set_capacity_revalidate_and_notify(disk, 0, true);
+  out:
+       return 0;
+-- 
+2.39.5
+
index ebe22736006953371da759527af47dc98cdb7527..d10bf037de4ccb028a7a14484f8738c922f90589 100644 (file)
@@ -83,3 +83,16 @@ skb_expand_head-adjust-skb-truesize-incorrectly.patch
 ipv6-prevent-possible-uaf-in-ip6_xmit.patch
 x86-hyperv-fix-hv-tsc-page-based-sched_clock-for-hibernation.patch
 selinux-ignore-unknown-extended-permissions.patch
+thunderbolt-add-support-for-intel-alder-lake.patch
+thunderbolt-add-support-for-intel-raptor-lake.patch
+thunderbolt-add-support-for-intel-meteor-lake.patch
+thunderbolt-add-intel-barlow-ridge-pci-id.patch
+thunderbolt-add-support-for-intel-lunar-lake.patch
+thunderbolt-add-support-for-intel-panther-lake-m-p.patch
+loop-let-set_capacity_revalidate_and_notify-update-t.patch
+nvme-let-set_capacity_revalidate_and_notify-update-t.patch
+sd-update-the-bdev-size-in-sd_revalidate_disk.patch
+block-remove-the-update_bdev-parameter-to-set_capaci.patch
+zram-use-set_capacity_and_notify.patch
+drivers-block-zram-zram_drv.c-do-not-keep-dangling-z.patch
+zram-fix-uninitialized-zram-not-releasing-backing-de.patch
diff --git a/queue-5.10/thunderbolt-add-intel-barlow-ridge-pci-id.patch b/queue-5.10/thunderbolt-add-intel-barlow-ridge-pci-id.patch
new file mode 100644 (file)
index 0000000..2055466
--- /dev/null
@@ -0,0 +1,54 @@
+From 084d414b2b0cdeb529f602196f191781e4c85e47 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 17 Dec 2022 08:35:04 +0200
+Subject: thunderbolt: Add Intel Barlow Ridge PCI ID
+
+From: Mika Westerberg <mika.westerberg@linux.intel.com>
+
+[ Upstream commit 6f14a210661ce03988ef4ed3c8402037c8e06539 ]
+
+Intel Barlow Ridge is the first USB4 v2 controller from Intel. The
+controller exposes standard USB4 PCI class ID in typical configurations,
+however there is a way to configure it so that it uses a special class
+ID to allow using s different driver than the Windows inbox one. For
+this reason add the Barlow Ridge PCI ID to the Linux driver too so that
+the driver can attach regardless of the class ID.
+
+Tested-by: Pengfei Xu <pengfei.xu@intel.com>
+Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Stable-dep-of: 8644b48714dc ("thunderbolt: Add support for Intel Panther Lake-M/P")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/thunderbolt/nhi.c | 2 ++
+ drivers/thunderbolt/nhi.h | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
+index ea2fff90d162..331157b99e24 100644
+--- a/drivers/thunderbolt/nhi.c
++++ b/drivers/thunderbolt/nhi.c
+@@ -1363,6 +1363,8 @@ static struct pci_device_id nhi_ids[] = {
+         .driver_data = (kernel_ulong_t)&icl_nhi_ops },
+       { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL_P_NHI1),
+         .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_80G_NHI) },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_40G_NHI) },
+       /* Any USB4 compliant host */
+       { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_USB4, ~0) },
+diff --git a/drivers/thunderbolt/nhi.h b/drivers/thunderbolt/nhi.h
+index b0718020c6f5..c15a0c46c9cf 100644
+--- a/drivers/thunderbolt/nhi.h
++++ b/drivers/thunderbolt/nhi.h
+@@ -75,6 +75,8 @@ extern const struct tb_nhi_ops icl_nhi_ops;
+ #define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_BRIDGE     0x15ef
+ #define PCI_DEVICE_ID_INTEL_ADL_NHI0                  0x463e
+ #define PCI_DEVICE_ID_INTEL_ADL_NHI1                  0x466d
++#define PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_80G_NHI 0x5781
++#define PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_40G_NHI 0x5784
+ #define PCI_DEVICE_ID_INTEL_MTL_M_NHI0                        0x7eb2
+ #define PCI_DEVICE_ID_INTEL_MTL_P_NHI0                        0x7ec2
+ #define PCI_DEVICE_ID_INTEL_MTL_P_NHI1                        0x7ec3
+-- 
+2.39.5
+
diff --git a/queue-5.10/thunderbolt-add-support-for-intel-alder-lake.patch b/queue-5.10/thunderbolt-add-support-for-intel-alder-lake.patch
new file mode 100644 (file)
index 0000000..497b329
--- /dev/null
@@ -0,0 +1,70 @@
+From aa757bc027274fd225a6131bce7fcef94e5e8e78 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Apr 2021 14:46:16 -0700
+Subject: thunderbolt: Add support for Intel Alder Lake
+
+From: Azhar Shaikh <azhar.shaikh@intel.com>
+
+[ Upstream commit 135794868ad83d0327cdd78df469e118f1fe7cc4 ]
+
+Alder Lake has the same integrated Thunderbolt/USB4 controller as
+Intel Tiger Lake. By default it is still using firmware based connection
+manager so we can use most of the Tiger Lake flows.
+
+Add the Alder Lake PCI IDs to the driver list of supported devices.
+
+Signed-off-by: Azhar Shaikh <azhar.shaikh@intel.com>
+Reviewed-by: Yehezkel Bernat <YehezkelShB@gmail.com>
+Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Stable-dep-of: 8644b48714dc ("thunderbolt: Add support for Intel Panther Lake-M/P")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/thunderbolt/icm.c | 2 ++
+ drivers/thunderbolt/nhi.c | 4 ++++
+ drivers/thunderbolt/nhi.h | 2 ++
+ 3 files changed, 8 insertions(+)
+
+diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c
+index 90f1d9a53461..b038e530d6cb 100644
+--- a/drivers/thunderbolt/icm.c
++++ b/drivers/thunderbolt/icm.c
+@@ -2290,6 +2290,8 @@ struct tb *icm_probe(struct tb_nhi *nhi)
+       case PCI_DEVICE_ID_INTEL_TGL_NHI1:
+       case PCI_DEVICE_ID_INTEL_TGL_H_NHI0:
+       case PCI_DEVICE_ID_INTEL_TGL_H_NHI1:
++      case PCI_DEVICE_ID_INTEL_ADL_NHI0:
++      case PCI_DEVICE_ID_INTEL_ADL_NHI1:
+               icm->is_supported = icm_tgl_is_supported;
+               icm->driver_ready = icm_icl_driver_ready;
+               icm->set_uuid = icm_icl_set_uuid;
+diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
+index fd1b59397c70..1e732d2d15ad 100644
+--- a/drivers/thunderbolt/nhi.c
++++ b/drivers/thunderbolt/nhi.c
+@@ -1349,6 +1349,10 @@ static struct pci_device_id nhi_ids[] = {
+         .driver_data = (kernel_ulong_t)&icl_nhi_ops },
+       { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL_H_NHI1),
+         .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADL_NHI0),
++        .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADL_NHI1),
++        .driver_data = (kernel_ulong_t)&icl_nhi_ops },
+       /* Any USB4 compliant host */
+       { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_USB4, ~0) },
+diff --git a/drivers/thunderbolt/nhi.h b/drivers/thunderbolt/nhi.h
+index 7ad6d3f0583b..5091677b3f4b 100644
+--- a/drivers/thunderbolt/nhi.h
++++ b/drivers/thunderbolt/nhi.h
+@@ -73,6 +73,8 @@ extern const struct tb_nhi_ops icl_nhi_ops;
+ #define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_BRIDGE     0x15ea
+ #define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_NHI                0x15eb
+ #define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_BRIDGE     0x15ef
++#define PCI_DEVICE_ID_INTEL_ADL_NHI0                  0x463e
++#define PCI_DEVICE_ID_INTEL_ADL_NHI1                  0x466d
+ #define PCI_DEVICE_ID_INTEL_ICL_NHI1                  0x8a0d
+ #define PCI_DEVICE_ID_INTEL_ICL_NHI0                  0x8a17
+ #define PCI_DEVICE_ID_INTEL_TGL_NHI0                  0x9a1b
+-- 
+2.39.5
+
diff --git a/queue-5.10/thunderbolt-add-support-for-intel-lunar-lake.patch b/queue-5.10/thunderbolt-add-support-for-intel-lunar-lake.patch
new file mode 100644 (file)
index 0000000..bf55655
--- /dev/null
@@ -0,0 +1,54 @@
+From 1837b3f3a7792f3ff1c7d0538601ab6458491927 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 20 May 2022 13:47:11 +0300
+Subject: thunderbolt: Add support for Intel Lunar Lake
+
+From: Mika Westerberg <mika.westerberg@linux.intel.com>
+
+[ Upstream commit 2cd3da4e37453019e21a486d9de3144f46b4fdf7 ]
+
+Intel Lunar Lake has similar integrated Thunderbolt/USB4 controller as
+Intel Meteor Lake with some small differences in the host router (it has
+3 DP IN adapters for instance). Add the Intel Lunar Lake PCI IDs to the
+driver list of supported devices.
+
+Tested-by: Pengfei Xu <pengfei.xu@intel.com>
+Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Stable-dep-of: 8644b48714dc ("thunderbolt: Add support for Intel Panther Lake-M/P")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/thunderbolt/nhi.c | 4 ++++
+ drivers/thunderbolt/nhi.h | 2 ++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
+index 331157b99e24..ada11c239e73 100644
+--- a/drivers/thunderbolt/nhi.c
++++ b/drivers/thunderbolt/nhi.c
+@@ -1363,6 +1363,10 @@ static struct pci_device_id nhi_ids[] = {
+         .driver_data = (kernel_ulong_t)&icl_nhi_ops },
+       { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL_P_NHI1),
+         .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_LNL_NHI0),
++        .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_LNL_NHI1),
++        .driver_data = (kernel_ulong_t)&icl_nhi_ops },
+       { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_80G_NHI) },
+       { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_40G_NHI) },
+diff --git a/drivers/thunderbolt/nhi.h b/drivers/thunderbolt/nhi.h
+index c15a0c46c9cf..4b0fccf033e1 100644
+--- a/drivers/thunderbolt/nhi.h
++++ b/drivers/thunderbolt/nhi.h
+@@ -88,6 +88,8 @@ extern const struct tb_nhi_ops icl_nhi_ops;
+ #define PCI_DEVICE_ID_INTEL_TGL_H_NHI1                        0x9a21
+ #define PCI_DEVICE_ID_INTEL_RPL_NHI0                  0xa73e
+ #define PCI_DEVICE_ID_INTEL_RPL_NHI1                  0xa76d
++#define PCI_DEVICE_ID_INTEL_LNL_NHI0                  0xa833
++#define PCI_DEVICE_ID_INTEL_LNL_NHI1                  0xa834
+ #define PCI_CLASS_SERIAL_USB_USB4                     0x0c0340
+-- 
+2.39.5
+
diff --git a/queue-5.10/thunderbolt-add-support-for-intel-meteor-lake.patch b/queue-5.10/thunderbolt-add-support-for-intel-meteor-lake.patch
new file mode 100644 (file)
index 0000000..e95defc
--- /dev/null
@@ -0,0 +1,70 @@
+From 16eac61f635dc72fc3ece797e27a43b10b3bd9b1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 29 Jun 2021 13:32:29 -0700
+Subject: thunderbolt: Add support for Intel Meteor Lake
+
+From: Mika Westerberg <mika.westerberg@linux.intel.com>
+
+[ Upstream commit 32249fd8c8cccd7a1ed86c3b6d9b6ae9b4a83623 ]
+
+Intel Meteor Lake has the same integrated Thunderbolt/USB4 controller as
+Intel Alder Lake. Add the Intel Meteor Lake PCI IDs to the driver list
+of supported devices.
+
+Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Stable-dep-of: 8644b48714dc ("thunderbolt: Add support for Intel Panther Lake-M/P")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/thunderbolt/icm.c | 3 +++
+ drivers/thunderbolt/nhi.c | 6 ++++++
+ drivers/thunderbolt/nhi.h | 3 +++
+ 3 files changed, 12 insertions(+)
+
+diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c
+index eab5199ccc5b..51e3ac78c022 100644
+--- a/drivers/thunderbolt/icm.c
++++ b/drivers/thunderbolt/icm.c
+@@ -2294,6 +2294,9 @@ struct tb *icm_probe(struct tb_nhi *nhi)
+       case PCI_DEVICE_ID_INTEL_ADL_NHI1:
+       case PCI_DEVICE_ID_INTEL_RPL_NHI0:
+       case PCI_DEVICE_ID_INTEL_RPL_NHI1:
++      case PCI_DEVICE_ID_INTEL_MTL_M_NHI0:
++      case PCI_DEVICE_ID_INTEL_MTL_P_NHI0:
++      case PCI_DEVICE_ID_INTEL_MTL_P_NHI1:
+               icm->is_supported = icm_tgl_is_supported;
+               icm->driver_ready = icm_icl_driver_ready;
+               icm->set_uuid = icm_icl_set_uuid;
+diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
+index d41ff5e0f9ca..ea2fff90d162 100644
+--- a/drivers/thunderbolt/nhi.c
++++ b/drivers/thunderbolt/nhi.c
+@@ -1357,6 +1357,12 @@ static struct pci_device_id nhi_ids[] = {
+         .driver_data = (kernel_ulong_t)&icl_nhi_ops },
+       { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPL_NHI1),
+         .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL_M_NHI0),
++        .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL_P_NHI0),
++        .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL_P_NHI1),
++        .driver_data = (kernel_ulong_t)&icl_nhi_ops },
+       /* Any USB4 compliant host */
+       { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_USB4, ~0) },
+diff --git a/drivers/thunderbolt/nhi.h b/drivers/thunderbolt/nhi.h
+index 01190d9ced16..b0718020c6f5 100644
+--- a/drivers/thunderbolt/nhi.h
++++ b/drivers/thunderbolt/nhi.h
+@@ -75,6 +75,9 @@ extern const struct tb_nhi_ops icl_nhi_ops;
+ #define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_BRIDGE     0x15ef
+ #define PCI_DEVICE_ID_INTEL_ADL_NHI0                  0x463e
+ #define PCI_DEVICE_ID_INTEL_ADL_NHI1                  0x466d
++#define PCI_DEVICE_ID_INTEL_MTL_M_NHI0                        0x7eb2
++#define PCI_DEVICE_ID_INTEL_MTL_P_NHI0                        0x7ec2
++#define PCI_DEVICE_ID_INTEL_MTL_P_NHI1                        0x7ec3
+ #define PCI_DEVICE_ID_INTEL_ICL_NHI1                  0x8a0d
+ #define PCI_DEVICE_ID_INTEL_ICL_NHI0                  0x8a17
+ #define PCI_DEVICE_ID_INTEL_TGL_NHI0                  0x9a1b
+-- 
+2.39.5
+
diff --git a/queue-5.10/thunderbolt-add-support-for-intel-panther-lake-m-p.patch b/queue-5.10/thunderbolt-add-support-for-intel-panther-lake-m-p.patch
new file mode 100644 (file)
index 0000000..8eff289
--- /dev/null
@@ -0,0 +1,58 @@
+From aa62d5347fbd191f394955a010784922ac15eaa7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 May 2024 10:15:14 +0300
+Subject: thunderbolt: Add support for Intel Panther Lake-M/P
+
+From: Mika Westerberg <mika.westerberg@linux.intel.com>
+
+[ Upstream commit 8644b48714dca8bf2f42a4ff8311de8efc9bd8c3 ]
+
+Intel Panther Lake-M/P has the same integrated Thunderbolt/USB4
+controller as Lunar Lake. Add these PCI IDs to the driver list of
+supported devices.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/thunderbolt/nhi.c | 8 ++++++++
+ drivers/thunderbolt/nhi.h | 4 ++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
+index ada11c239e73..710c905a62d8 100644
+--- a/drivers/thunderbolt/nhi.c
++++ b/drivers/thunderbolt/nhi.c
+@@ -1367,6 +1367,14 @@ static struct pci_device_id nhi_ids[] = {
+         .driver_data = (kernel_ulong_t)&icl_nhi_ops },
+       { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_LNL_NHI1),
+         .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_PTL_M_NHI0),
++        .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_PTL_M_NHI1),
++        .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_PTL_P_NHI0),
++        .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_PTL_P_NHI1),
++        .driver_data = (kernel_ulong_t)&icl_nhi_ops },
+       { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_80G_NHI) },
+       { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_40G_NHI) },
+diff --git a/drivers/thunderbolt/nhi.h b/drivers/thunderbolt/nhi.h
+index 4b0fccf033e1..67ecee94d7b9 100644
+--- a/drivers/thunderbolt/nhi.h
++++ b/drivers/thunderbolt/nhi.h
+@@ -90,6 +90,10 @@ extern const struct tb_nhi_ops icl_nhi_ops;
+ #define PCI_DEVICE_ID_INTEL_RPL_NHI1                  0xa76d
+ #define PCI_DEVICE_ID_INTEL_LNL_NHI0                  0xa833
+ #define PCI_DEVICE_ID_INTEL_LNL_NHI1                  0xa834
++#define PCI_DEVICE_ID_INTEL_PTL_M_NHI0                        0xe333
++#define PCI_DEVICE_ID_INTEL_PTL_M_NHI1                        0xe334
++#define PCI_DEVICE_ID_INTEL_PTL_P_NHI0                        0xe433
++#define PCI_DEVICE_ID_INTEL_PTL_P_NHI1                        0xe434
+ #define PCI_CLASS_SERIAL_USB_USB4                     0x0c0340
+-- 
+2.39.5
+
diff --git a/queue-5.10/thunderbolt-add-support-for-intel-raptor-lake.patch b/queue-5.10/thunderbolt-add-support-for-intel-raptor-lake.patch
new file mode 100644 (file)
index 0000000..67eaae7
--- /dev/null
@@ -0,0 +1,67 @@
+From 5313c13a32df8f0e3ee2e3c000407d64bac9197a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 1 Jun 2022 15:41:02 -0700
+Subject: thunderbolt: Add support for Intel Raptor Lake
+
+From: George D Sworo <george.d.sworo@intel.com>
+
+[ Upstream commit 7ec58378a985618909ffae18e4ac0de2ae625f33 ]
+
+Intel Raptor Lake has the same integrated Thunderbolt/USB4 controller as
+Intel Alder Lake. By default it is still using firmware based connection
+manager so we can use most of the Alder Lake flows.
+
+Signed-off-by: George D Sworo <george.d.sworo@intel.com>
+Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Stable-dep-of: 8644b48714dc ("thunderbolt: Add support for Intel Panther Lake-M/P")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/thunderbolt/icm.c | 2 ++
+ drivers/thunderbolt/nhi.c | 4 ++++
+ drivers/thunderbolt/nhi.h | 2 ++
+ 3 files changed, 8 insertions(+)
+
+diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c
+index b038e530d6cb..eab5199ccc5b 100644
+--- a/drivers/thunderbolt/icm.c
++++ b/drivers/thunderbolt/icm.c
+@@ -2292,6 +2292,8 @@ struct tb *icm_probe(struct tb_nhi *nhi)
+       case PCI_DEVICE_ID_INTEL_TGL_H_NHI1:
+       case PCI_DEVICE_ID_INTEL_ADL_NHI0:
+       case PCI_DEVICE_ID_INTEL_ADL_NHI1:
++      case PCI_DEVICE_ID_INTEL_RPL_NHI0:
++      case PCI_DEVICE_ID_INTEL_RPL_NHI1:
+               icm->is_supported = icm_tgl_is_supported;
+               icm->driver_ready = icm_icl_driver_ready;
+               icm->set_uuid = icm_icl_set_uuid;
+diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
+index 1e732d2d15ad..d41ff5e0f9ca 100644
+--- a/drivers/thunderbolt/nhi.c
++++ b/drivers/thunderbolt/nhi.c
+@@ -1353,6 +1353,10 @@ static struct pci_device_id nhi_ids[] = {
+         .driver_data = (kernel_ulong_t)&icl_nhi_ops },
+       { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADL_NHI1),
+         .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPL_NHI0),
++        .driver_data = (kernel_ulong_t)&icl_nhi_ops },
++      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPL_NHI1),
++        .driver_data = (kernel_ulong_t)&icl_nhi_ops },
+       /* Any USB4 compliant host */
+       { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_USB4, ~0) },
+diff --git a/drivers/thunderbolt/nhi.h b/drivers/thunderbolt/nhi.h
+index 5091677b3f4b..01190d9ced16 100644
+--- a/drivers/thunderbolt/nhi.h
++++ b/drivers/thunderbolt/nhi.h
+@@ -81,6 +81,8 @@ extern const struct tb_nhi_ops icl_nhi_ops;
+ #define PCI_DEVICE_ID_INTEL_TGL_NHI1                  0x9a1d
+ #define PCI_DEVICE_ID_INTEL_TGL_H_NHI0                        0x9a1f
+ #define PCI_DEVICE_ID_INTEL_TGL_H_NHI1                        0x9a21
++#define PCI_DEVICE_ID_INTEL_RPL_NHI0                  0xa73e
++#define PCI_DEVICE_ID_INTEL_RPL_NHI1                  0xa76d
+ #define PCI_CLASS_SERIAL_USB_USB4                     0x0c0340
+-- 
+2.39.5
+
diff --git a/queue-5.10/zram-fix-uninitialized-zram-not-releasing-backing-de.patch b/queue-5.10/zram-fix-uninitialized-zram-not-releasing-backing-de.patch
new file mode 100644 (file)
index 0000000..5a84fee
--- /dev/null
@@ -0,0 +1,65 @@
+From f8f08cc9436187c1fcb912e5f756e96f512935c3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Dec 2024 00:57:16 +0800
+Subject: zram: fix uninitialized ZRAM not releasing backing device
+
+From: Kairui Song <kasong@tencent.com>
+
+[ Upstream commit 74363ec674cb172d8856de25776c8f3103f05e2f ]
+
+Setting backing device is done before ZRAM initialization.  If we set the
+backing device, then remove the ZRAM module without initializing the
+device, the backing device reference will be leaked and the device will be
+hold forever.
+
+Fix this by always reset the ZRAM fully on rmmod or reset store.
+
+Link: https://lkml.kernel.org/r/20241209165717.94215-3-ryncsn@gmail.com
+Fixes: 013bf95a83ec ("zram: add interface to specif backing device")
+Signed-off-by: Kairui Song <kasong@tencent.com>
+Reported-by: Desheng Wu <deshengwu@tencent.com>
+Suggested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
+Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/zram/zram_drv.c | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
+index 8e13586be8c9..05a46fbe0ea9 100644
+--- a/drivers/block/zram/zram_drv.c
++++ b/drivers/block/zram/zram_drv.c
+@@ -1146,12 +1146,16 @@ static void zram_meta_free(struct zram *zram, u64 disksize)
+       size_t num_pages = disksize >> PAGE_SHIFT;
+       size_t index;
++      if (!zram->table)
++              return;
++
+       /* Free all pages that are still in this zram device */
+       for (index = 0; index < num_pages; index++)
+               zram_free_page(zram, index);
+       zs_destroy_pool(zram->mem_pool);
+       vfree(zram->table);
++      zram->table = NULL;
+ }
+ static bool zram_meta_alloc(struct zram *zram, u64 disksize)
+@@ -1694,11 +1698,6 @@ static void zram_reset_device(struct zram *zram)
+       zram->limit_pages = 0;
+-      if (!init_done(zram)) {
+-              up_write(&zram->init_lock);
+-              return;
+-      }
+-
+       set_capacity_and_notify(zram->disk, 0);
+       part_stat_set_all(&zram->disk->part0, 0);
+-- 
+2.39.5
+
diff --git a/queue-5.10/zram-use-set_capacity_and_notify.patch b/queue-5.10/zram-use-set_capacity_and_notify.patch
new file mode 100644 (file)
index 0000000..3aba5ee
--- /dev/null
@@ -0,0 +1,55 @@
+From a92b088a5e9f5bb5a2933fab8ffa30ebcbf63295 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 16 Nov 2020 15:57:09 +0100
+Subject: zram: use set_capacity_and_notify
+
+From: Christoph Hellwig <hch@lst.de>
+
+[ Upstream commit 6e017a3931d7722260e3656a6fc9b02de5fb3c5d ]
+
+Use set_capacity_and_notify to set the size of both the disk and block
+device.  This also gets the uevent notifications for the resize for free.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Stable-dep-of: 74363ec674cb ("zram: fix uninitialized ZRAM not releasing backing device")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/zram/zram_drv.c | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
+index 16db4fae5145..8f38e5a1a63f 100644
+--- a/drivers/block/zram/zram_drv.c
++++ b/drivers/block/zram/zram_drv.c
+@@ -1706,7 +1706,7 @@ static void zram_reset_device(struct zram *zram)
+       disksize = zram->disksize;
+       zram->disksize = 0;
+-      set_capacity(zram->disk, 0);
++      set_capacity_and_notify(zram->disk, 0);
+       part_stat_set_all(&zram->disk->part0, 0);
+       up_write(&zram->init_lock);
+@@ -1752,9 +1752,7 @@ static ssize_t disksize_store(struct device *dev,
+       zram->comp = comp;
+       zram->disksize = disksize;
+-      set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);
+-
+-      revalidate_disk_size(zram->disk, true);
++      set_capacity_and_notify(zram->disk, zram->disksize >> SECTOR_SHIFT);
+       up_write(&zram->init_lock);
+       return len;
+@@ -1801,7 +1799,6 @@ static ssize_t reset_store(struct device *dev,
+       /* Make sure all the pending I/O are finished */
+       fsync_bdev(bdev);
+       zram_reset_device(zram);
+-      revalidate_disk_size(zram->disk, true);
+       bdput(bdev);
+       mutex_lock(&bdev->bd_mutex);
+-- 
+2.39.5
+