--- /dev/null
+From 731dc4868311ee097757b8746eaa1b4f8b2b4f1c Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Mon, 21 Oct 2019 10:37:59 +0200
+Subject: bdev: Factor out bdev revalidation into a common helper
+
+From: Jan Kara <jack@suse.cz>
+
+commit 731dc4868311ee097757b8746eaa1b4f8b2b4f1c upstream.
+
+Factor out code handling revalidation of bdev on disk change into a
+common helper.
+
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Cc: Laura Abbott <labbott@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/block_dev.c | 26 ++++++++++++++------------
+ 1 file changed, 14 insertions(+), 12 deletions(-)
+
+--- a/fs/block_dev.c
++++ b/fs/block_dev.c
+@@ -1512,6 +1512,14 @@ EXPORT_SYMBOL(bd_set_size);
+
+ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part);
+
++static void bdev_disk_changed(struct block_device *bdev, bool invalidate)
++{
++ if (invalidate)
++ invalidate_partitions(bdev->bd_disk, bdev);
++ else
++ rescan_partitions(bdev->bd_disk, bdev);
++}
++
+ /*
+ * bd_mutex locking:
+ *
+@@ -1594,12 +1602,9 @@ static int __blkdev_get(struct block_dev
+ * The latter is necessary to prevent ghost
+ * partitions on a removed medium.
+ */
+- if (bdev->bd_invalidated) {
+- if (!ret)
+- rescan_partitions(disk, bdev);
+- else if (ret == -ENOMEDIUM)
+- invalidate_partitions(disk, bdev);
+- }
++ if (bdev->bd_invalidated &&
++ (!ret || ret == -ENOMEDIUM))
++ bdev_disk_changed(bdev, ret == -ENOMEDIUM);
+
+ if (ret)
+ goto out_clear;
+@@ -1632,12 +1637,9 @@ static int __blkdev_get(struct block_dev
+ if (bdev->bd_disk->fops->open)
+ ret = bdev->bd_disk->fops->open(bdev, mode);
+ /* the same as first opener case, read comment there */
+- if (bdev->bd_invalidated) {
+- if (!ret)
+- rescan_partitions(bdev->bd_disk, bdev);
+- else if (ret == -ENOMEDIUM)
+- invalidate_partitions(bdev->bd_disk, bdev);
+- }
++ if (bdev->bd_invalidated &&
++ (!ret || ret == -ENOMEDIUM))
++ bdev_disk_changed(bdev, ret == -ENOMEDIUM);
+ if (ret)
+ goto out_unlock_bdev;
+ }
--- /dev/null
+From cba22d86e0a10b7070d2e6a7379dbea51aa0883c Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Mon, 21 Oct 2019 10:38:00 +0200
+Subject: bdev: Refresh bdev size for disks without partitioning
+
+From: Jan Kara <jack@suse.cz>
+
+commit cba22d86e0a10b7070d2e6a7379dbea51aa0883c upstream.
+
+Currently, block device size in not updated on second and further open
+for block devices where partition scan is disabled. This is particularly
+annoying for example for DVD drives as that means block device size does
+not get updated once the media is inserted into a drive if the device is
+already open when inserting the media. This is actually always the case
+for example when pktcdvd is in use.
+
+Fix the problem by revalidating block device size on every open even for
+devices with partition scan disabled.
+
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Cc: Laura Abbott <labbott@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/block_dev.c | 19 ++++++++++---------
+ 1 file changed, 10 insertions(+), 9 deletions(-)
+
+--- a/fs/block_dev.c
++++ b/fs/block_dev.c
+@@ -1403,11 +1403,7 @@ static void flush_disk(struct block_devi
+ "resized disk %s\n",
+ bdev->bd_disk ? bdev->bd_disk->disk_name : "");
+ }
+-
+- if (!bdev->bd_disk)
+- return;
+- if (disk_part_scan_enabled(bdev->bd_disk))
+- bdev->bd_invalidated = 1;
++ bdev->bd_invalidated = 1;
+ }
+
+ /**
+@@ -1514,10 +1510,15 @@ static void __blkdev_put(struct block_de
+
+ static void bdev_disk_changed(struct block_device *bdev, bool invalidate)
+ {
+- if (invalidate)
+- invalidate_partitions(bdev->bd_disk, bdev);
+- else
+- rescan_partitions(bdev->bd_disk, bdev);
++ if (disk_part_scan_enabled(bdev->bd_disk)) {
++ if (invalidate)
++ invalidate_partitions(bdev->bd_disk, bdev);
++ else
++ rescan_partitions(bdev->bd_disk, bdev);
++ } else {
++ check_disk_size_change(bdev->bd_disk, bdev, !invalidate);
++ bdev->bd_invalidated = 0;
++ }
+ }
+
+ /*
--- /dev/null
+From 7ee23491b39259ae83899dd93b2a29ef0f22f0a7 Mon Sep 17 00:00:00 2001
+From: Viresh Kumar <viresh.kumar@linaro.org>
+Date: Thu, 7 Nov 2019 08:50:25 +0530
+Subject: RDMA/qib: Validate ->show()/store() callbacks before calling them
+
+From: Viresh Kumar <viresh.kumar@linaro.org>
+
+commit 7ee23491b39259ae83899dd93b2a29ef0f22f0a7 upstream.
+
+The permissions of the read-only or write-only sysfs files can be
+changed (as root) and the user can then try to read a write-only file or
+write to a read-only file which will lead to kernel crash here.
+
+Protect against that by always validating the show/store callbacks.
+
+Link: https://lore.kernel.org/r/d45cc26361a174ae12dbb86c994ef334d257924b.1573096807.git.viresh.kumar@linaro.org
+Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/hw/qib/qib_sysfs.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/infiniband/hw/qib/qib_sysfs.c
++++ b/drivers/infiniband/hw/qib/qib_sysfs.c
+@@ -301,6 +301,9 @@ static ssize_t qib_portattr_show(struct
+ struct qib_pportdata *ppd =
+ container_of(kobj, struct qib_pportdata, pport_kobj);
+
++ if (!pattr->show)
++ return -EIO;
++
+ return pattr->show(ppd, buf);
+ }
+
+@@ -312,6 +315,9 @@ static ssize_t qib_portattr_store(struct
+ struct qib_pportdata *ppd =
+ container_of(kobj, struct qib_pportdata, pport_kobj);
+
++ if (!pattr->store)
++ return -EIO;
++
+ return pattr->store(ppd, buf, len);
+ }
+
--- /dev/null
+From 8670b2b8b029a6650d133486be9d2ace146fd29a Mon Sep 17 00:00:00 2001
+From: Marcel Holtmann <marcel@holtmann.org>
+Date: Thu, 24 Oct 2019 19:40:42 +0200
+Subject: rfkill: allocate static minor
+
+From: Marcel Holtmann <marcel@holtmann.org>
+
+commit 8670b2b8b029a6650d133486be9d2ace146fd29a upstream.
+
+udev has a feature of creating /dev/<node> device-nodes if it finds
+a devnode:<node> modalias. This allows for auto-loading of modules that
+provide the node. This requires to use a statically allocated minor
+number for misc character devices.
+
+However, rfkill uses dynamic minor numbers and prevents auto-loading
+of the module. So allocate the next static misc minor number and use
+it for rfkill.
+
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+Link: https://lore.kernel.org/r/20191024174042.19851-1-marcel@holtmann.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+
+---
+ include/linux/miscdevice.h | 1 +
+ net/rfkill/core.c | 9 +++++++--
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+--- a/include/linux/miscdevice.h
++++ b/include/linux/miscdevice.h
+@@ -57,6 +57,7 @@
+ #define UHID_MINOR 239
+ #define USERIO_MINOR 240
+ #define VHOST_VSOCK_MINOR 241
++#define RFKILL_MINOR 242
+ #define MISC_DYNAMIC_MINOR 255
+
+ struct device;
+--- a/net/rfkill/core.c
++++ b/net/rfkill/core.c
+@@ -1316,10 +1316,12 @@ static const struct file_operations rfki
+ .llseek = no_llseek,
+ };
+
++#define RFKILL_NAME "rfkill"
++
+ static struct miscdevice rfkill_miscdev = {
+- .name = "rfkill",
+ .fops = &rfkill_fops,
+- .minor = MISC_DYNAMIC_MINOR,
++ .name = RFKILL_NAME,
++ .minor = RFKILL_MINOR,
+ };
+
+ static int __init rfkill_init(void)
+@@ -1371,3 +1373,6 @@ static void __exit rfkill_exit(void)
+ class_unregister(&rfkill_class);
+ }
+ module_exit(rfkill_exit);
++
++MODULE_ALIAS_MISCDEV(RFKILL_MINOR);
++MODULE_ALIAS("devname:" RFKILL_NAME);
spi-fix-spi_cs_high-setting-when-using-native-and-gpio-cs.patch
spi-fix-null-pointer-when-setting-spi_cs_high-for-gpio-cs.patch
can-ucan-fix-non-atomic-allocation-in-completion-handler.patch
+rdma-qib-validate-show-store-callbacks-before-calling-them.patch
+rfkill-allocate-static-minor.patch
+bdev-factor-out-bdev-revalidation-into-a-common-helper.patch
+bdev-refresh-bdev-size-for-disks-without-partitioning.patch