From 88d7ea844da51acf6bd9902447274a453e8c2f67 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sat, 25 Apr 2020 19:30:19 -0400 Subject: [PATCH] Fixes for 4.19 Signed-off-by: Sasha Levin --- ...take-the-drv-lock-mutex-before-calli.patch | 43 ++ ..._rt5640-add-quirk-for-mpman-mpwin895.patch | 49 ++ ...ace-fix-dereference-after-null-check.patch | 70 +++ ...lktrace-protect-q-blk_trace-with-rcu.patch | 434 ++++++++++++++++++ ...updating-wanted-caps-when-cap-is-sta.patch | 49 ++ ..._mdsc_do_request-errors-from-__get_p.patch | 40 ++ ...not-doing-optimize-bandwidth-if-flip.patch | 73 +++ ...oid-memory-leakage-in-f2fs_listxattr.patch | 68 +++ ...pc_find_ipc-should-increase-position.patch | 52 +++ ...fig-qconf-fix-a-few-alignment-issues.patch | 59 +++ ...-gcov_seq_next-should-increase-posit.patch | 48 ++ ...er-discard-support-for-block-devices.patch | 117 +++++ ...-net-argument-to-ip6_dst_lookup_flow.patch | 247 ++++++++++ ...e-ip6_dst_lookup_flow-instead-of-ip6.patch | 270 +++++++++++ ...k-caused-by-ana-update-wrong-locking.patch | 72 +++ .../pci-aspm-allow-re-enabling-clock-pm.patch | 74 +++ ...e-page-faults-when-getting-phys-addr.patch | 71 +++ ...wm-bcm2835-dynamically-allocate-base.patch | 42 ++ ...-rcar-fix-late-runtime-pm-enablement.patch | 66 +++ ...s-tpu-fix-late-runtime-pm-enablement.patch | 63 +++ ...4-irq_work-avoid-interrupt-when-call.patch | 111 +++++ ...390-cio-avoid-duplicated-add-uevents.patch | 65 +++ ...t-unbind-session-event-when-the-targ.patch | 61 +++ ...ash-in-target-side-cable-pulls-hitti.patch | 76 +++ ...san-slab-out-of-bounds-error-in-lpfc.patch | 62 +++ ...i-fix-call-trace-in-device-discovery.patch | 43 ++ ...od-fix-handling-test-numbers-above-9.patch | 64 +++ queue-4.19/series | 31 ++ ...g-selftests-turn-off-timeout-setting.patch | 35 ++ ...k-improve-virtqueue-error-to-blk_sts.patch | 47 ++ ...eset-last_hw_keepalive-time-at-start.patch | 42 ++ ...-state-is-u3-after-setting-usb_ss_po.patch | 54 +++ 32 files changed, 2698 insertions(+) create mode 100644 queue-4.19/asoc-intel-atom-take-the-drv-lock-mutex-before-calli.patch create mode 100644 queue-4.19/asoc-intel-bytcr_rt5640-add-quirk-for-mpman-mpwin895.patch create mode 100644 queue-4.19/blktrace-fix-dereference-after-null-check.patch create mode 100644 queue-4.19/blktrace-protect-q-blk_trace-with-rcu.patch create mode 100644 queue-4.19/ceph-don-t-skip-updating-wanted-caps-when-cap-is-sta.patch create mode 100644 queue-4.19/ceph-return-ceph_mdsc_do_request-errors-from-__get_p.patch create mode 100644 queue-4.19/drm-amd-display-not-doing-optimize-bandwidth-if-flip.patch create mode 100644 queue-4.19/f2fs-fix-to-avoid-memory-leakage-in-f2fs_listxattr.patch create mode 100644 queue-4.19/ipc-util.c-sysvipc_find_ipc-should-increase-position.patch create mode 100644 queue-4.19/kconfig-qconf-fix-a-few-alignment-issues.patch create mode 100644 queue-4.19/kernel-gcov-fs.c-gcov_seq_next-should-increase-posit.patch create mode 100644 queue-4.19/loop-better-discard-support-for-block-devices.patch create mode 100644 queue-4.19/net-ipv6-add-net-argument-to-ip6_dst_lookup_flow.patch create mode 100644 queue-4.19/net-ipv6_stub-use-ip6_dst_lookup_flow-instead-of-ip6.patch create mode 100644 queue-4.19/nvme-fix-deadlock-caused-by-ana-update-wrong-locking.patch create mode 100644 queue-4.19/pci-aspm-allow-re-enabling-clock-pm.patch create mode 100644 queue-4.19/perf-core-disable-page-faults-when-getting-phys-addr.patch create mode 100644 queue-4.19/pwm-bcm2835-dynamically-allocate-base.patch create mode 100644 queue-4.19/pwm-rcar-fix-late-runtime-pm-enablement.patch create mode 100644 queue-4.19/pwm-renesas-tpu-fix-late-runtime-pm-enablement.patch create mode 100644 queue-4.19/revert-powerpc-64-irq_work-avoid-interrupt-when-call.patch create mode 100644 queue-4.19/s390-cio-avoid-duplicated-add-uevents.patch create mode 100644 queue-4.19/scsi-iscsi-report-unbind-session-event-when-the-targ.patch create mode 100644 queue-4.19/scsi-lpfc-fix-crash-in-target-side-cable-pulls-hitti.patch create mode 100644 queue-4.19/scsi-lpfc-fix-kasan-slab-out-of-bounds-error-in-lpfc.patch create mode 100644 queue-4.19/scsi-smartpqi-fix-call-trace-in-device-discovery.patch create mode 100644 queue-4.19/selftests-kmod-fix-handling-test-numbers-above-9.patch create mode 100644 queue-4.19/tracing-selftests-turn-off-timeout-setting.patch create mode 100644 queue-4.19/virtio-blk-improve-virtqueue-error-to-blk_sts.patch create mode 100644 queue-4.19/watchdog-reset-last_hw_keepalive-time-at-start.patch create mode 100644 queue-4.19/xhci-ensure-link-state-is-u3-after-setting-usb_ss_po.patch diff --git a/queue-4.19/asoc-intel-atom-take-the-drv-lock-mutex-before-calli.patch b/queue-4.19/asoc-intel-atom-take-the-drv-lock-mutex-before-calli.patch new file mode 100644 index 00000000000..64cfaf4bf8b --- /dev/null +++ b/queue-4.19/asoc-intel-atom-take-the-drv-lock-mutex-before-calli.patch @@ -0,0 +1,43 @@ +From c2e809bc9266e7b7b8bb0bec5da4e154527c7869 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Apr 2020 20:53:57 +0200 +Subject: ASoC: Intel: atom: Take the drv->lock mutex before calling + sst_send_slot_map() + +From: Hans de Goede + +[ Upstream commit 81630dc042af998b9f58cd8e2c29dab9777ea176 ] + +sst_send_slot_map() uses sst_fill_and_send_cmd_unlocked() because in some +places it is called with the drv->lock mutex already held. + +So it must always be called with the mutex locked. This commit adds missing +locking in the sst_set_be_modules() code-path. + +Fixes: 24c8d14192cc ("ASoC: Intel: mrfld: add DSP core controls") +Signed-off-by: Hans de Goede +Acked-by: Pierre-Louis Bossart +Link: https://lore.kernel.org/r/20200402185359.3424-1-hdegoede@redhat.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/atom/sst-atom-controls.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c +index 737f5d5533139..a1d7f93a08059 100644 +--- a/sound/soc/intel/atom/sst-atom-controls.c ++++ b/sound/soc/intel/atom/sst-atom-controls.c +@@ -974,7 +974,9 @@ static int sst_set_be_modules(struct snd_soc_dapm_widget *w, + dev_dbg(c->dev, "Enter: widget=%s\n", w->name); + + if (SND_SOC_DAPM_EVENT_ON(event)) { ++ mutex_lock(&drv->lock); + ret = sst_send_slot_map(drv); ++ mutex_unlock(&drv->lock); + if (ret) + return ret; + ret = sst_send_pipe_module_params(w, k); +-- +2.20.1 + diff --git a/queue-4.19/asoc-intel-bytcr_rt5640-add-quirk-for-mpman-mpwin895.patch b/queue-4.19/asoc-intel-bytcr_rt5640-add-quirk-for-mpman-mpwin895.patch new file mode 100644 index 00000000000..090438ddfb7 --- /dev/null +++ b/queue-4.19/asoc-intel-bytcr_rt5640-add-quirk-for-mpman-mpwin895.patch @@ -0,0 +1,49 @@ +From 175ea177aa505ddecd0ed2a4d2b93412acbbe226 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 5 Apr 2020 15:37:26 +0200 +Subject: ASoC: Intel: bytcr_rt5640: Add quirk for MPMAN MPWIN895CL tablet + +From: Hans de Goede + +[ Upstream commit c8b78f24c1247b7bd0882885c672d9dec5800bc6 ] + +The MPMAN MPWIN895CL tablet almost fully works with out default settings. +The only problem is that it has only 1 speaker so any sounds only playing +on the right channel get lost. + +Add a quirk for this model using the default settings + MONO_SPEAKER. + +Signed-off-by: Hans de Goede +Acked-by: Pierre-Louis Bossart +Link: https://lore.kernel.org/r/20200405133726.24154-1-hdegoede@redhat.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/boards/bytcr_rt5640.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c +index e58240e18b301..f29014a7d6723 100644 +--- a/sound/soc/intel/boards/bytcr_rt5640.c ++++ b/sound/soc/intel/boards/bytcr_rt5640.c +@@ -588,6 +588,17 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { + BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, ++ { ++ /* MPMAN MPWIN895CL */ ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MPMAN"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MPWIN8900CL"), ++ }, ++ .driver_data = (void *)(BYTCR_INPUT_DEFAULTS | ++ BYT_RT5640_MONO_SPEAKER | ++ BYT_RT5640_SSP0_AIF1 | ++ BYT_RT5640_MCLK_EN), ++ }, + { /* MSI S100 tablet */ + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Micro-Star International Co., Ltd."), +-- +2.20.1 + diff --git a/queue-4.19/blktrace-fix-dereference-after-null-check.patch b/queue-4.19/blktrace-fix-dereference-after-null-check.patch new file mode 100644 index 00000000000..b4b9d0ac755 --- /dev/null +++ b/queue-4.19/blktrace-fix-dereference-after-null-check.patch @@ -0,0 +1,70 @@ +From e48c8ff4c8a1fa28c051e1056ea40ede19651dcc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Mar 2020 13:58:19 +0300 +Subject: blktrace: fix dereference after null check + +From: Cengiz Can + +commit 153031a301bb07194e9c37466cfce8eacb977621 upstream. + +There was a recent change in blktrace.c that added a RCU protection to +`q->blk_trace` in order to fix a use-after-free issue during access. + +However the change missed an edge case that can lead to dereferencing of +`bt` pointer even when it's NULL: + +Coverity static analyzer marked this as a FORWARD_NULL issue with CID +1460458. + +``` +/kernel/trace/blktrace.c: 1904 in sysfs_blk_trace_attr_store() +1898 ret = 0; +1899 if (bt == NULL) +1900 ret = blk_trace_setup_queue(q, bdev); +1901 +1902 if (ret == 0) { +1903 if (attr == &dev_attr_act_mask) +>>> CID 1460458: Null pointer dereferences (FORWARD_NULL) +>>> Dereferencing null pointer "bt". +1904 bt->act_mask = value; +1905 else if (attr == &dev_attr_pid) +1906 bt->pid = value; +1907 else if (attr == &dev_attr_start_lba) +1908 bt->start_lba = value; +1909 else if (attr == &dev_attr_end_lba) +``` + +Added a reassignment with RCU annotation to fix the issue. + +Fixes: c780e86dd48 ("blktrace: Protect q->blk_trace with RCU") +Reviewed-by: Ming Lei +Reviewed-by: Bob Liu +Reviewed-by: Steven Rostedt (VMware) +Signed-off-by: Cengiz Can +Signed-off-by: Jens Axboe +Signed-off-by: Ben Hutchings +Signed-off-by: Sasha Levin +--- + kernel/trace/blktrace.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c +index 99f6cdbf2f540..6cea8bbca03cb 100644 +--- a/kernel/trace/blktrace.c ++++ b/kernel/trace/blktrace.c +@@ -1893,8 +1893,11 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev, + } + + ret = 0; +- if (bt == NULL) ++ if (bt == NULL) { + ret = blk_trace_setup_queue(q, bdev); ++ bt = rcu_dereference_protected(q->blk_trace, ++ lockdep_is_held(&q->blk_trace_mutex)); ++ } + + if (ret == 0) { + if (attr == &dev_attr_act_mask) +-- +2.20.1 + diff --git a/queue-4.19/blktrace-protect-q-blk_trace-with-rcu.patch b/queue-4.19/blktrace-protect-q-blk_trace-with-rcu.patch new file mode 100644 index 00000000000..fdd5c9e3993 --- /dev/null +++ b/queue-4.19/blktrace-protect-q-blk_trace-with-rcu.patch @@ -0,0 +1,434 @@ +From 3f499713df8d9098b82b1fe056500e95a4a5f7a6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 Feb 2020 15:28:12 +0100 +Subject: blktrace: Protect q->blk_trace with RCU + +From: Jan Kara + +commit c780e86dd48ef6467a1146cf7d0fe1e05a635039 upstream. + +KASAN is reporting that __blk_add_trace() has a use-after-free issue +when accessing q->blk_trace. Indeed the switching of block tracing (and +thus eventual freeing of q->blk_trace) is completely unsynchronized with +the currently running tracing and thus it can happen that the blk_trace +structure is being freed just while __blk_add_trace() works on it. +Protect accesses to q->blk_trace by RCU during tracing and make sure we +wait for the end of RCU grace period when shutting down tracing. Luckily +that is rare enough event that we can afford that. Note that postponing +the freeing of blk_trace to an RCU callback should better be avoided as +it could have unexpected user visible side-effects as debugfs files +would be still existing for a short while block tracing has been shut +down. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=205711 +CC: stable@vger.kernel.org +Reviewed-by: Chaitanya Kulkarni +Reviewed-by: Ming Lei +Tested-by: Ming Lei +Reviewed-by: Bart Van Assche +Reported-by: Tristan Madani +Signed-off-by: Jan Kara +Signed-off-by: Jens Axboe +[bwh: Backported to 4.19: adjust context] +Signed-off-by: Ben Hutchings +Signed-off-by: Sasha Levin +--- + include/linux/blkdev.h | 2 +- + include/linux/blktrace_api.h | 18 ++++-- + kernel/trace/blktrace.c | 114 +++++++++++++++++++++++++---------- + 3 files changed, 97 insertions(+), 37 deletions(-) + +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h +index 6e67aeb56928b..745b2d0dcf78c 100644 +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -624,7 +624,7 @@ struct request_queue { + unsigned int sg_reserved_size; + int node; + #ifdef CONFIG_BLK_DEV_IO_TRACE +- struct blk_trace *blk_trace; ++ struct blk_trace __rcu *blk_trace; + struct mutex blk_trace_mutex; + #endif + /* +diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h +index 7bb2d8de9f308..3b6ff5902edce 100644 +--- a/include/linux/blktrace_api.h ++++ b/include/linux/blktrace_api.h +@@ -51,9 +51,13 @@ void __trace_note_message(struct blk_trace *, struct blkcg *blkcg, const char *f + **/ + #define blk_add_cgroup_trace_msg(q, cg, fmt, ...) \ + do { \ +- struct blk_trace *bt = (q)->blk_trace; \ ++ struct blk_trace *bt; \ ++ \ ++ rcu_read_lock(); \ ++ bt = rcu_dereference((q)->blk_trace); \ + if (unlikely(bt)) \ + __trace_note_message(bt, cg, fmt, ##__VA_ARGS__);\ ++ rcu_read_unlock(); \ + } while (0) + #define blk_add_trace_msg(q, fmt, ...) \ + blk_add_cgroup_trace_msg(q, NULL, fmt, ##__VA_ARGS__) +@@ -61,10 +65,14 @@ void __trace_note_message(struct blk_trace *, struct blkcg *blkcg, const char *f + + static inline bool blk_trace_note_message_enabled(struct request_queue *q) + { +- struct blk_trace *bt = q->blk_trace; +- if (likely(!bt)) +- return false; +- return bt->act_mask & BLK_TC_NOTIFY; ++ struct blk_trace *bt; ++ bool ret; ++ ++ rcu_read_lock(); ++ bt = rcu_dereference(q->blk_trace); ++ ret = bt && (bt->act_mask & BLK_TC_NOTIFY); ++ rcu_read_unlock(); ++ return ret; + } + + extern void blk_add_driver_data(struct request_queue *q, struct request *rq, +diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c +index 2868d85f1fb1d..99f6cdbf2f540 100644 +--- a/kernel/trace/blktrace.c ++++ b/kernel/trace/blktrace.c +@@ -336,6 +336,7 @@ static void put_probe_ref(void) + + static void blk_trace_cleanup(struct blk_trace *bt) + { ++ synchronize_rcu(); + blk_trace_free(bt); + put_probe_ref(); + } +@@ -636,8 +637,10 @@ static int compat_blk_trace_setup(struct request_queue *q, char *name, + static int __blk_trace_startstop(struct request_queue *q, int start) + { + int ret; +- struct blk_trace *bt = q->blk_trace; ++ struct blk_trace *bt; + ++ bt = rcu_dereference_protected(q->blk_trace, ++ lockdep_is_held(&q->blk_trace_mutex)); + if (bt == NULL) + return -EINVAL; + +@@ -746,8 +749,8 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg) + void blk_trace_shutdown(struct request_queue *q) + { + mutex_lock(&q->blk_trace_mutex); +- +- if (q->blk_trace) { ++ if (rcu_dereference_protected(q->blk_trace, ++ lockdep_is_held(&q->blk_trace_mutex))) { + __blk_trace_startstop(q, 0); + __blk_trace_remove(q); + } +@@ -759,8 +762,10 @@ void blk_trace_shutdown(struct request_queue *q) + static union kernfs_node_id * + blk_trace_bio_get_cgid(struct request_queue *q, struct bio *bio) + { +- struct blk_trace *bt = q->blk_trace; ++ struct blk_trace *bt; + ++ /* We don't use the 'bt' value here except as an optimization... */ ++ bt = rcu_dereference_protected(q->blk_trace, 1); + if (!bt || !(blk_tracer_flags.val & TRACE_BLK_OPT_CGROUP)) + return NULL; + +@@ -805,10 +810,14 @@ static void blk_add_trace_rq(struct request *rq, int error, + unsigned int nr_bytes, u32 what, + union kernfs_node_id *cgid) + { +- struct blk_trace *bt = rq->q->blk_trace; ++ struct blk_trace *bt; + +- if (likely(!bt)) ++ rcu_read_lock(); ++ bt = rcu_dereference(rq->q->blk_trace); ++ if (likely(!bt)) { ++ rcu_read_unlock(); + return; ++ } + + if (blk_rq_is_passthrough(rq)) + what |= BLK_TC_ACT(BLK_TC_PC); +@@ -817,6 +826,7 @@ static void blk_add_trace_rq(struct request *rq, int error, + + __blk_add_trace(bt, blk_rq_trace_sector(rq), nr_bytes, req_op(rq), + rq->cmd_flags, what, error, 0, NULL, cgid); ++ rcu_read_unlock(); + } + + static void blk_add_trace_rq_insert(void *ignore, +@@ -862,14 +872,19 @@ static void blk_add_trace_rq_complete(void *ignore, struct request *rq, + static void blk_add_trace_bio(struct request_queue *q, struct bio *bio, + u32 what, int error) + { +- struct blk_trace *bt = q->blk_trace; ++ struct blk_trace *bt; + +- if (likely(!bt)) ++ rcu_read_lock(); ++ bt = rcu_dereference(q->blk_trace); ++ if (likely(!bt)) { ++ rcu_read_unlock(); + return; ++ } + + __blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size, + bio_op(bio), bio->bi_opf, what, error, 0, NULL, + blk_trace_bio_get_cgid(q, bio)); ++ rcu_read_unlock(); + } + + static void blk_add_trace_bio_bounce(void *ignore, +@@ -914,11 +929,14 @@ static void blk_add_trace_getrq(void *ignore, + if (bio) + blk_add_trace_bio(q, bio, BLK_TA_GETRQ, 0); + else { +- struct blk_trace *bt = q->blk_trace; ++ struct blk_trace *bt; + ++ rcu_read_lock(); ++ bt = rcu_dereference(q->blk_trace); + if (bt) + __blk_add_trace(bt, 0, 0, rw, 0, BLK_TA_GETRQ, 0, 0, + NULL, NULL); ++ rcu_read_unlock(); + } + } + +@@ -930,27 +948,35 @@ static void blk_add_trace_sleeprq(void *ignore, + if (bio) + blk_add_trace_bio(q, bio, BLK_TA_SLEEPRQ, 0); + else { +- struct blk_trace *bt = q->blk_trace; ++ struct blk_trace *bt; + ++ rcu_read_lock(); ++ bt = rcu_dereference(q->blk_trace); + if (bt) + __blk_add_trace(bt, 0, 0, rw, 0, BLK_TA_SLEEPRQ, + 0, 0, NULL, NULL); ++ rcu_read_unlock(); + } + } + + static void blk_add_trace_plug(void *ignore, struct request_queue *q) + { +- struct blk_trace *bt = q->blk_trace; ++ struct blk_trace *bt; + ++ rcu_read_lock(); ++ bt = rcu_dereference(q->blk_trace); + if (bt) + __blk_add_trace(bt, 0, 0, 0, 0, BLK_TA_PLUG, 0, 0, NULL, NULL); ++ rcu_read_unlock(); + } + + static void blk_add_trace_unplug(void *ignore, struct request_queue *q, + unsigned int depth, bool explicit) + { +- struct blk_trace *bt = q->blk_trace; ++ struct blk_trace *bt; + ++ rcu_read_lock(); ++ bt = rcu_dereference(q->blk_trace); + if (bt) { + __be64 rpdu = cpu_to_be64(depth); + u32 what; +@@ -962,14 +988,17 @@ static void blk_add_trace_unplug(void *ignore, struct request_queue *q, + + __blk_add_trace(bt, 0, 0, 0, 0, what, 0, sizeof(rpdu), &rpdu, NULL); + } ++ rcu_read_unlock(); + } + + static void blk_add_trace_split(void *ignore, + struct request_queue *q, struct bio *bio, + unsigned int pdu) + { +- struct blk_trace *bt = q->blk_trace; ++ struct blk_trace *bt; + ++ rcu_read_lock(); ++ bt = rcu_dereference(q->blk_trace); + if (bt) { + __be64 rpdu = cpu_to_be64(pdu); + +@@ -978,6 +1007,7 @@ static void blk_add_trace_split(void *ignore, + BLK_TA_SPLIT, bio->bi_status, sizeof(rpdu), + &rpdu, blk_trace_bio_get_cgid(q, bio)); + } ++ rcu_read_unlock(); + } + + /** +@@ -997,11 +1027,15 @@ static void blk_add_trace_bio_remap(void *ignore, + struct request_queue *q, struct bio *bio, + dev_t dev, sector_t from) + { +- struct blk_trace *bt = q->blk_trace; ++ struct blk_trace *bt; + struct blk_io_trace_remap r; + +- if (likely(!bt)) ++ rcu_read_lock(); ++ bt = rcu_dereference(q->blk_trace); ++ if (likely(!bt)) { ++ rcu_read_unlock(); + return; ++ } + + r.device_from = cpu_to_be32(dev); + r.device_to = cpu_to_be32(bio_dev(bio)); +@@ -1010,6 +1044,7 @@ static void blk_add_trace_bio_remap(void *ignore, + __blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size, + bio_op(bio), bio->bi_opf, BLK_TA_REMAP, bio->bi_status, + sizeof(r), &r, blk_trace_bio_get_cgid(q, bio)); ++ rcu_read_unlock(); + } + + /** +@@ -1030,11 +1065,15 @@ static void blk_add_trace_rq_remap(void *ignore, + struct request *rq, dev_t dev, + sector_t from) + { +- struct blk_trace *bt = q->blk_trace; ++ struct blk_trace *bt; + struct blk_io_trace_remap r; + +- if (likely(!bt)) ++ rcu_read_lock(); ++ bt = rcu_dereference(q->blk_trace); ++ if (likely(!bt)) { ++ rcu_read_unlock(); + return; ++ } + + r.device_from = cpu_to_be32(dev); + r.device_to = cpu_to_be32(disk_devt(rq->rq_disk)); +@@ -1043,6 +1082,7 @@ static void blk_add_trace_rq_remap(void *ignore, + __blk_add_trace(bt, blk_rq_pos(rq), blk_rq_bytes(rq), + rq_data_dir(rq), 0, BLK_TA_REMAP, 0, + sizeof(r), &r, blk_trace_request_get_cgid(q, rq)); ++ rcu_read_unlock(); + } + + /** +@@ -1060,14 +1100,19 @@ void blk_add_driver_data(struct request_queue *q, + struct request *rq, + void *data, size_t len) + { +- struct blk_trace *bt = q->blk_trace; ++ struct blk_trace *bt; + +- if (likely(!bt)) ++ rcu_read_lock(); ++ bt = rcu_dereference(q->blk_trace); ++ if (likely(!bt)) { ++ rcu_read_unlock(); + return; ++ } + + __blk_add_trace(bt, blk_rq_trace_sector(rq), blk_rq_bytes(rq), 0, 0, + BLK_TA_DRV_DATA, 0, len, data, + blk_trace_request_get_cgid(q, rq)); ++ rcu_read_unlock(); + } + EXPORT_SYMBOL_GPL(blk_add_driver_data); + +@@ -1594,6 +1639,7 @@ static int blk_trace_remove_queue(struct request_queue *q) + return -EINVAL; + + put_probe_ref(); ++ synchronize_rcu(); + blk_trace_free(bt); + return 0; + } +@@ -1755,6 +1801,7 @@ static ssize_t sysfs_blk_trace_attr_show(struct device *dev, + struct hd_struct *p = dev_to_part(dev); + struct request_queue *q; + struct block_device *bdev; ++ struct blk_trace *bt; + ssize_t ret = -ENXIO; + + bdev = bdget(part_devt(p)); +@@ -1767,21 +1814,23 @@ static ssize_t sysfs_blk_trace_attr_show(struct device *dev, + + mutex_lock(&q->blk_trace_mutex); + ++ bt = rcu_dereference_protected(q->blk_trace, ++ lockdep_is_held(&q->blk_trace_mutex)); + if (attr == &dev_attr_enable) { +- ret = sprintf(buf, "%u\n", !!q->blk_trace); ++ ret = sprintf(buf, "%u\n", !!bt); + goto out_unlock_bdev; + } + +- if (q->blk_trace == NULL) ++ if (bt == NULL) + ret = sprintf(buf, "disabled\n"); + else if (attr == &dev_attr_act_mask) +- ret = blk_trace_mask2str(buf, q->blk_trace->act_mask); ++ ret = blk_trace_mask2str(buf, bt->act_mask); + else if (attr == &dev_attr_pid) +- ret = sprintf(buf, "%u\n", q->blk_trace->pid); ++ ret = sprintf(buf, "%u\n", bt->pid); + else if (attr == &dev_attr_start_lba) +- ret = sprintf(buf, "%llu\n", q->blk_trace->start_lba); ++ ret = sprintf(buf, "%llu\n", bt->start_lba); + else if (attr == &dev_attr_end_lba) +- ret = sprintf(buf, "%llu\n", q->blk_trace->end_lba); ++ ret = sprintf(buf, "%llu\n", bt->end_lba); + + out_unlock_bdev: + mutex_unlock(&q->blk_trace_mutex); +@@ -1798,6 +1847,7 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev, + struct block_device *bdev; + struct request_queue *q; + struct hd_struct *p; ++ struct blk_trace *bt; + u64 value; + ssize_t ret = -EINVAL; + +@@ -1828,8 +1878,10 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev, + + mutex_lock(&q->blk_trace_mutex); + ++ bt = rcu_dereference_protected(q->blk_trace, ++ lockdep_is_held(&q->blk_trace_mutex)); + if (attr == &dev_attr_enable) { +- if (!!value == !!q->blk_trace) { ++ if (!!value == !!bt) { + ret = 0; + goto out_unlock_bdev; + } +@@ -1841,18 +1893,18 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev, + } + + ret = 0; +- if (q->blk_trace == NULL) ++ if (bt == NULL) + ret = blk_trace_setup_queue(q, bdev); + + if (ret == 0) { + if (attr == &dev_attr_act_mask) +- q->blk_trace->act_mask = value; ++ bt->act_mask = value; + else if (attr == &dev_attr_pid) +- q->blk_trace->pid = value; ++ bt->pid = value; + else if (attr == &dev_attr_start_lba) +- q->blk_trace->start_lba = value; ++ bt->start_lba = value; + else if (attr == &dev_attr_end_lba) +- q->blk_trace->end_lba = value; ++ bt->end_lba = value; + } + + out_unlock_bdev: +-- +2.20.1 + diff --git a/queue-4.19/ceph-don-t-skip-updating-wanted-caps-when-cap-is-sta.patch b/queue-4.19/ceph-don-t-skip-updating-wanted-caps-when-cap-is-sta.patch new file mode 100644 index 00000000000..862edf06f97 --- /dev/null +++ b/queue-4.19/ceph-don-t-skip-updating-wanted-caps-when-cap-is-sta.patch @@ -0,0 +1,49 @@ +From ffc2cc3a08c2e362a2528c847381e2c13fe9cdbf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Mar 2020 19:34:20 +0800 +Subject: ceph: don't skip updating wanted caps when cap is stale + +From: Yan, Zheng + +[ Upstream commit 0aa971b6fd3f92afef6afe24ef78d9bb14471519 ] + +1. try_get_cap_refs() fails to get caps and finds that mds_wanted + does not include what it wants. It returns -ESTALE. +2. ceph_get_caps() calls ceph_renew_caps(). ceph_renew_caps() finds + that inode has cap, so it calls ceph_check_caps(). +3. ceph_check_caps() finds that issued caps (without checking if it's + stale) already includes caps wanted by open file, so it skips + updating wanted caps. + +Above events can cause an infinite loop inside ceph_get_caps(). + +Signed-off-by: "Yan, Zheng" +Reviewed-by: Jeff Layton +Signed-off-by: Ilya Dryomov +Signed-off-by: Sasha Levin +--- + fs/ceph/caps.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c +index 4c0b220e20bab..5241102b81a82 100644 +--- a/fs/ceph/caps.c ++++ b/fs/ceph/caps.c +@@ -1972,8 +1972,12 @@ retry_locked: + } + + /* want more caps from mds? */ +- if (want & ~(cap->mds_wanted | cap->issued)) +- goto ack; ++ if (want & ~cap->mds_wanted) { ++ if (want & ~(cap->mds_wanted | cap->issued)) ++ goto ack; ++ if (!__cap_is_valid(cap)) ++ goto ack; ++ } + + /* things we might delay */ + if ((cap->issued & ~retain) == 0 && +-- +2.20.1 + diff --git a/queue-4.19/ceph-return-ceph_mdsc_do_request-errors-from-__get_p.patch b/queue-4.19/ceph-return-ceph_mdsc_do_request-errors-from-__get_p.patch new file mode 100644 index 00000000000..4ebf42b33e4 --- /dev/null +++ b/queue-4.19/ceph-return-ceph_mdsc_do_request-errors-from-__get_p.patch @@ -0,0 +1,40 @@ +From 00ca04097d8de2aea06dabeb2cd1e1f7d67bd029 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Mar 2020 09:34:20 +0800 +Subject: ceph: return ceph_mdsc_do_request() errors from __get_parent() + +From: Qiujun Huang + +[ Upstream commit c6d50296032f0b97473eb2e274dc7cc5d0173847 ] + +Return the error returned by ceph_mdsc_do_request(). Otherwise, +r_target_inode ends up being NULL this ends up returning ENOENT +regardless of the error. + +Signed-off-by: Qiujun Huang +Reviewed-by: Jeff Layton +Signed-off-by: Ilya Dryomov +Signed-off-by: Sasha Levin +--- + fs/ceph/export.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/fs/ceph/export.c b/fs/ceph/export.c +index 3c59ad180ef0b..4cfe1154d4c72 100644 +--- a/fs/ceph/export.c ++++ b/fs/ceph/export.c +@@ -151,6 +151,11 @@ static struct dentry *__get_parent(struct super_block *sb, + + req->r_num_caps = 1; + err = ceph_mdsc_do_request(mdsc, NULL, req); ++ if (err) { ++ ceph_mdsc_put_request(req); ++ return ERR_PTR(err); ++ } ++ + inode = req->r_target_inode; + if (inode) + ihold(inode); +-- +2.20.1 + diff --git a/queue-4.19/drm-amd-display-not-doing-optimize-bandwidth-if-flip.patch b/queue-4.19/drm-amd-display-not-doing-optimize-bandwidth-if-flip.patch new file mode 100644 index 00000000000..a223d9f801f --- /dev/null +++ b/queue-4.19/drm-amd-display-not-doing-optimize-bandwidth-if-flip.patch @@ -0,0 +1,73 @@ +From 47ecc3ead5ca6252f9d530d0971ad0b9dc01bee7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Mar 2020 17:13:02 -0400 +Subject: drm/amd/display: Not doing optimize bandwidth if flip pending. + +From: Yongqiang Sun + +[ Upstream commit 9941b8129030c9202aaf39114477a0e58c0d6ffc ] + +[Why] +In some scenario like 1366x768 VSR enabled connected with a 4K monitor +and playing 4K video in clone mode, underflow will be observed due to +decrease dppclk when previouse surface scan isn't finished + +[How] +In this use case, surface flip is switching between 4K and 1366x768, +1366x768 needs smaller dppclk, and when decrease the clk and previous +surface scan is for 4K and scan isn't done, underflow will happen. Not +doing optimize bandwidth in case of flip pending. + +Signed-off-by: Yongqiang Sun +Reviewed-by: Tony Cheng +Acked-by: Rodrigo Siqueira +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/core/dc.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c +index 2b2efe443c36d..b64ad9e1f0c38 100644 +--- a/drivers/gpu/drm/amd/display/dc/core/dc.c ++++ b/drivers/gpu/drm/amd/display/dc/core/dc.c +@@ -996,6 +996,26 @@ bool dc_commit_state(struct dc *dc, struct dc_state *context) + return (result == DC_OK); + } + ++static bool is_flip_pending_in_pipes(struct dc *dc, struct dc_state *context) ++{ ++ int i; ++ struct pipe_ctx *pipe; ++ ++ for (i = 0; i < MAX_PIPES; i++) { ++ pipe = &context->res_ctx.pipe_ctx[i]; ++ ++ if (!pipe->plane_state) ++ continue; ++ ++ /* Must set to false to start with, due to OR in update function */ ++ pipe->plane_state->status.is_flip_pending = false; ++ dc->hwss.update_pending_status(pipe); ++ if (pipe->plane_state->status.is_flip_pending) ++ return true; ++ } ++ return false; ++} ++ + bool dc_post_update_surfaces_to_stream(struct dc *dc) + { + int i; +@@ -1003,6 +1023,9 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc) + + post_surface_trace(dc); + ++ if (is_flip_pending_in_pipes(dc, context)) ++ return true; ++ + for (i = 0; i < dc->res_pool->pipe_count; i++) + if (context->res_ctx.pipe_ctx[i].stream == NULL || + context->res_ctx.pipe_ctx[i].plane_state == NULL) { +-- +2.20.1 + diff --git a/queue-4.19/f2fs-fix-to-avoid-memory-leakage-in-f2fs_listxattr.patch b/queue-4.19/f2fs-fix-to-avoid-memory-leakage-in-f2fs_listxattr.patch new file mode 100644 index 00000000000..55c13bd2783 --- /dev/null +++ b/queue-4.19/f2fs-fix-to-avoid-memory-leakage-in-f2fs_listxattr.patch @@ -0,0 +1,68 @@ +From acfb18e7f702c299f286ecbb47b8dfa30401d09b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Oct 2019 14:56:22 +0800 +Subject: f2fs: fix to avoid memory leakage in f2fs_listxattr + +From: Randall Huang + +commit 688078e7f36c293dae25b338ddc9e0a2790f6e06 upstream. + +In f2fs_listxattr, there is no boundary check before +memcpy e_name to buffer. +If the e_name_len is corrupted, +unexpected memory contents may be returned to the buffer. + +Signed-off-by: Randall Huang +Reviewed-by: Chao Yu +Signed-off-by: Jaegeuk Kim +[bwh: Backported to 4.19: Use f2fs_msg() instead of f2fs_err()] +Signed-off-by: Ben Hutchings +Signed-off-by: Sasha Levin +--- + fs/f2fs/xattr.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c +index 1dae74f7cccac..201e9da1692a4 100644 +--- a/fs/f2fs/xattr.c ++++ b/fs/f2fs/xattr.c +@@ -538,8 +538,9 @@ out: + ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) + { + struct inode *inode = d_inode(dentry); ++ nid_t xnid = F2FS_I(inode)->i_xattr_nid; + struct f2fs_xattr_entry *entry; +- void *base_addr; ++ void *base_addr, *last_base_addr; + int error = 0; + size_t rest = buffer_size; + +@@ -549,6 +550,8 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) + if (error) + return error; + ++ last_base_addr = (void *)base_addr + XATTR_SIZE(xnid, inode); ++ + list_for_each_xattr(entry, base_addr) { + const struct xattr_handler *handler = + f2fs_xattr_handler(entry->e_name_index); +@@ -556,6 +559,16 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) + size_t prefix_len; + size_t size; + ++ if ((void *)(entry) + sizeof(__u32) > last_base_addr || ++ (void *)XATTR_NEXT_ENTRY(entry) > last_base_addr) { ++ f2fs_msg(dentry->d_sb, KERN_ERR, ++ "inode (%lu) has corrupted xattr", ++ inode->i_ino); ++ set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK); ++ error = -EFSCORRUPTED; ++ goto cleanup; ++ } ++ + if (!handler || (handler->list && !handler->list(dentry))) + continue; + +-- +2.20.1 + diff --git a/queue-4.19/ipc-util.c-sysvipc_find_ipc-should-increase-position.patch b/queue-4.19/ipc-util.c-sysvipc_find_ipc-should-increase-position.patch new file mode 100644 index 00000000000..ed3b67f0e79 --- /dev/null +++ b/queue-4.19/ipc-util.c-sysvipc_find_ipc-should-increase-position.patch @@ -0,0 +1,52 @@ +From cdf568a069c9857bd437449f6ae4b0579a6a3221 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Apr 2020 14:34:13 -0700 +Subject: ipc/util.c: sysvipc_find_ipc() should increase position index + +From: Vasily Averin + +[ Upstream commit 89163f93c6f969da5811af5377cc10173583123b ] + +If seq_file .next function does not change position index, read after +some lseek can generate unexpected output. + +https://bugzilla.kernel.org/show_bug.cgi?id=206283 +Signed-off-by: Vasily Averin +Signed-off-by: Andrew Morton +Acked-by: Waiman Long +Cc: Davidlohr Bueso +Cc: Manfred Spraul +Cc: Al Viro +Cc: Ingo Molnar +Cc: NeilBrown +Cc: Peter Oberparleiter +Cc: Steven Rostedt +Link: http://lkml.kernel.org/r/b7a20945-e315-8bb0-21e6-3875c14a8494@virtuozzo.com +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + ipc/util.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ipc/util.c b/ipc/util.c +index 0af05752969f1..b111e792b3125 100644 +--- a/ipc/util.c ++++ b/ipc/util.c +@@ -735,13 +735,13 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos, + total++; + } + ++ *new_pos = pos + 1; + if (total >= ids->in_use) + return NULL; + + for (; pos < IPCMNI; pos++) { + ipc = idr_find(&ids->ipcs_idr, pos); + if (ipc != NULL) { +- *new_pos = pos + 1; + rcu_read_lock(); + ipc_lock_object(ipc); + return ipc; +-- +2.20.1 + diff --git a/queue-4.19/kconfig-qconf-fix-a-few-alignment-issues.patch b/queue-4.19/kconfig-qconf-fix-a-few-alignment-issues.patch new file mode 100644 index 00000000000..9752943fc37 --- /dev/null +++ b/queue-4.19/kconfig-qconf-fix-a-few-alignment-issues.patch @@ -0,0 +1,59 @@ +From fb655d159315fa898016f08aefef642f7978dcc9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Apr 2020 11:28:03 +0200 +Subject: kconfig: qconf: Fix a few alignment issues + +From: Mauro Carvalho Chehab + +[ Upstream commit 60969f02f07ae1445730c7b293c421d179da729c ] + +There are a few items with wrong alignments. Solve them. + +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Masahiro Yamada +Signed-off-by: Sasha Levin +--- + scripts/kconfig/qconf.cc | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc +index ef4310f2558b1..8f004db6f6034 100644 +--- a/scripts/kconfig/qconf.cc ++++ b/scripts/kconfig/qconf.cc +@@ -627,7 +627,7 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu) + last = item; + continue; + } +- hide: ++hide: + if (item && item->menu == child) { + last = parent->firstChild(); + if (last == item) +@@ -692,7 +692,7 @@ void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) + last = item; + continue; + } +- hide: ++hide: + if (item && item->menu == child) { + last = (ConfigItem*)parent->topLevelItem(0); + if (last == item) +@@ -1225,10 +1225,11 @@ QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) + { + QMenu* popup = Parent::createStandardContextMenu(pos); + QAction* action = new QAction("Show Debug Info", popup); +- action->setCheckable(true); +- connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); +- connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); +- action->setChecked(showDebug()); ++ ++ action->setCheckable(true); ++ connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); ++ connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); ++ action->setChecked(showDebug()); + popup->addSeparator(); + popup->addAction(action); + return popup; +-- +2.20.1 + diff --git a/queue-4.19/kernel-gcov-fs.c-gcov_seq_next-should-increase-posit.patch b/queue-4.19/kernel-gcov-fs.c-gcov_seq_next-should-increase-posit.patch new file mode 100644 index 00000000000..259a45cae10 --- /dev/null +++ b/queue-4.19/kernel-gcov-fs.c-gcov_seq_next-should-increase-posit.patch @@ -0,0 +1,48 @@ +From 5f91ec91a9670dd6dd7e71501e2344f88ac59853 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Apr 2020 14:34:10 -0700 +Subject: kernel/gcov/fs.c: gcov_seq_next() should increase position index + +From: Vasily Averin + +[ Upstream commit f4d74ef6220c1eda0875da30457bef5c7111ab06 ] + +If seq_file .next function does not change position index, read after +some lseek can generate unexpected output. + +https://bugzilla.kernel.org/show_bug.cgi?id=206283 +Signed-off-by: Vasily Averin +Signed-off-by: Andrew Morton +Acked-by: Peter Oberparleiter +Cc: Al Viro +Cc: Davidlohr Bueso +Cc: Ingo Molnar +Cc: Manfred Spraul +Cc: NeilBrown +Cc: Steven Rostedt +Cc: Waiman Long +Link: http://lkml.kernel.org/r/f65c6ee7-bd00-f910-2f8a-37cc67e4ff88@virtuozzo.com +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + kernel/gcov/fs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c +index 6e40ff6be083d..291e0797125b6 100644 +--- a/kernel/gcov/fs.c ++++ b/kernel/gcov/fs.c +@@ -109,9 +109,9 @@ static void *gcov_seq_next(struct seq_file *seq, void *data, loff_t *pos) + { + struct gcov_iterator *iter = data; + ++ (*pos)++; + if (gcov_iter_next(iter)) + return NULL; +- (*pos)++; + + return iter; + } +-- +2.20.1 + diff --git a/queue-4.19/loop-better-discard-support-for-block-devices.patch b/queue-4.19/loop-better-discard-support-for-block-devices.patch new file mode 100644 index 00000000000..52e772d2da5 --- /dev/null +++ b/queue-4.19/loop-better-discard-support-for-block-devices.patch @@ -0,0 +1,117 @@ +From 3ffe6c62b078bfded79e6b276c7da6faf11574da Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Apr 2020 16:43:04 +0200 +Subject: loop: Better discard support for block devices + +From: Evan Green + +[ Upstream commit c52abf563049e787c1341cdf15c7dbe1bfbc951b ] + +If the backing device for a loop device is itself a block device, +then mirror the "write zeroes" capabilities of the underlying +block device into the loop device. Copy this capability into both +max_write_zeroes_sectors and max_discard_sectors of the loop device. + +The reason for this is that REQ_OP_DISCARD on a loop device translates +into blkdev_issue_zeroout(), rather than blkdev_issue_discard(). This +presents a consistent interface for loop devices (that discarded data +is zeroed), regardless of the backing device type of the loop device. +There should be no behavior change for loop devices backed by regular +files. + +This change fixes blktest block/003, and removes an extraneous +error print in block/013 when testing on a loop device backed +by a block device that does not support discard. + +Signed-off-by: Evan Green +Reviewed-by: Gwendal Grignou +Reviewed-by: Chaitanya Kulkarni +[used updated version of Evan's comment in loop_config_discard()] +[moved backingq to local scope, removed redundant braces] +Signed-off-by: Andrzej Pietrasiewicz +Reviewed-by: Christoph Hellwig +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/block/loop.c | 42 +++++++++++++++++++++++++++++++----------- + 1 file changed, 31 insertions(+), 11 deletions(-) + +diff --git a/drivers/block/loop.c b/drivers/block/loop.c +index 9cd231a27328e..c1341c86bcded 100644 +--- a/drivers/block/loop.c ++++ b/drivers/block/loop.c +@@ -426,11 +426,12 @@ static int lo_fallocate(struct loop_device *lo, struct request *rq, loff_t pos, + * information. + */ + struct file *file = lo->lo_backing_file; ++ struct request_queue *q = lo->lo_queue; + int ret; + + mode |= FALLOC_FL_KEEP_SIZE; + +- if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) { ++ if (!blk_queue_discard(q)) { + ret = -EOPNOTSUPP; + goto out; + } +@@ -864,28 +865,47 @@ static void loop_config_discard(struct loop_device *lo) + struct inode *inode = file->f_mapping->host; + struct request_queue *q = lo->lo_queue; + ++ /* ++ * If the backing device is a block device, mirror its zeroing ++ * capability. Set the discard sectors to the block device's zeroing ++ * capabilities because loop discards result in blkdev_issue_zeroout(), ++ * not blkdev_issue_discard(). This maintains consistent behavior with ++ * file-backed loop devices: discarded regions read back as zero. ++ */ ++ if (S_ISBLK(inode->i_mode) && !lo->lo_encrypt_key_size) { ++ struct request_queue *backingq; ++ ++ backingq = bdev_get_queue(inode->i_bdev); ++ blk_queue_max_discard_sectors(q, ++ backingq->limits.max_write_zeroes_sectors); ++ ++ blk_queue_max_write_zeroes_sectors(q, ++ backingq->limits.max_write_zeroes_sectors); ++ + /* + * We use punch hole to reclaim the free space used by the + * image a.k.a. discard. However we do not support discard if + * encryption is enabled, because it may give an attacker + * useful information. + */ +- if ((!file->f_op->fallocate) || +- lo->lo_encrypt_key_size) { ++ } else if (!file->f_op->fallocate || lo->lo_encrypt_key_size) { + q->limits.discard_granularity = 0; + q->limits.discard_alignment = 0; + blk_queue_max_discard_sectors(q, 0); + blk_queue_max_write_zeroes_sectors(q, 0); +- blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q); +- return; +- } + +- q->limits.discard_granularity = inode->i_sb->s_blocksize; +- q->limits.discard_alignment = 0; ++ } else { ++ q->limits.discard_granularity = inode->i_sb->s_blocksize; ++ q->limits.discard_alignment = 0; + +- blk_queue_max_discard_sectors(q, UINT_MAX >> 9); +- blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9); +- blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); ++ blk_queue_max_discard_sectors(q, UINT_MAX >> 9); ++ blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9); ++ } ++ ++ if (q->limits.max_write_zeroes_sectors) ++ blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); ++ else ++ blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q); + } + + static void loop_unprepare_queue(struct loop_device *lo) +-- +2.20.1 + diff --git a/queue-4.19/net-ipv6-add-net-argument-to-ip6_dst_lookup_flow.patch b/queue-4.19/net-ipv6-add-net-argument-to-ip6_dst_lookup_flow.patch new file mode 100644 index 00000000000..15ab1fe0279 --- /dev/null +++ b/queue-4.19/net-ipv6-add-net-argument-to-ip6_dst_lookup_flow.patch @@ -0,0 +1,247 @@ +From 6f7503885f18ecf3fb882556aefb983202854bc5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Dec 2019 15:35:52 +0100 +Subject: net: ipv6: add net argument to ip6_dst_lookup_flow + +From: Sabrina Dubroca + +commit c4e85f73afb6384123e5ef1bba3315b2e3ad031e upstream. + +This will be used in the conversion of ipv6_stub to ip6_dst_lookup_flow, +as some modules currently pass a net argument without a socket to +ip6_dst_lookup. This is equivalent to commit 343d60aada5a ("ipv6: change +ipv6_stub_impl.ipv6_dst_lookup to take net argument"). + +Signed-off-by: Sabrina Dubroca +Signed-off-by: David S. Miller +[bwh: Backported to 4.19: adjust context] +Signed-off-by: Ben Hutchings +Signed-off-by: Sasha Levin +--- + include/net/ipv6.h | 2 +- + net/dccp/ipv6.c | 6 +++--- + net/ipv6/af_inet6.c | 2 +- + net/ipv6/datagram.c | 2 +- + net/ipv6/inet6_connection_sock.c | 4 ++-- + net/ipv6/ip6_output.c | 8 ++++---- + net/ipv6/raw.c | 2 +- + net/ipv6/syncookies.c | 2 +- + net/ipv6/tcp_ipv6.c | 4 ++-- + net/l2tp/l2tp_ip6.c | 2 +- + net/sctp/ipv6.c | 4 ++-- + 11 files changed, 19 insertions(+), 19 deletions(-) + +diff --git a/include/net/ipv6.h b/include/net/ipv6.h +index ff33f498c1373..4c2e40882e884 100644 +--- a/include/net/ipv6.h ++++ b/include/net/ipv6.h +@@ -959,7 +959,7 @@ static inline struct sk_buff *ip6_finish_skb(struct sock *sk) + + int ip6_dst_lookup(struct net *net, struct sock *sk, struct dst_entry **dst, + struct flowi6 *fl6); +-struct dst_entry *ip6_dst_lookup_flow(const struct sock *sk, struct flowi6 *fl6, ++struct dst_entry *ip6_dst_lookup_flow(struct net *net, const struct sock *sk, struct flowi6 *fl6, + const struct in6_addr *final_dst); + struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, + const struct in6_addr *final_dst, +diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c +index 58a401e9cf09d..b438bed6749d4 100644 +--- a/net/dccp/ipv6.c ++++ b/net/dccp/ipv6.c +@@ -211,7 +211,7 @@ static int dccp_v6_send_response(const struct sock *sk, struct request_sock *req + final_p = fl6_update_dst(&fl6, rcu_dereference(np->opt), &final); + rcu_read_unlock(); + +- dst = ip6_dst_lookup_flow(sk, &fl6, final_p); ++ dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p); + if (IS_ERR(dst)) { + err = PTR_ERR(dst); + dst = NULL; +@@ -282,7 +282,7 @@ static void dccp_v6_ctl_send_reset(const struct sock *sk, struct sk_buff *rxskb) + security_skb_classify_flow(rxskb, flowi6_to_flowi(&fl6)); + + /* sk = NULL, but it is safe for now. RST socket required. */ +- dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL); ++ dst = ip6_dst_lookup_flow(sock_net(ctl_sk), ctl_sk, &fl6, NULL); + if (!IS_ERR(dst)) { + skb_dst_set(skb, dst); + ip6_xmit(ctl_sk, skb, &fl6, 0, NULL, 0); +@@ -912,7 +912,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, + opt = rcu_dereference_protected(np->opt, lockdep_sock_is_held(sk)); + final_p = fl6_update_dst(&fl6, opt, &final); + +- dst = ip6_dst_lookup_flow(sk, &fl6, final_p); ++ dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p); + if (IS_ERR(dst)) { + err = PTR_ERR(dst); + goto failure; +diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c +index 79fcd9550fd2e..5db88be8b6ecb 100644 +--- a/net/ipv6/af_inet6.c ++++ b/net/ipv6/af_inet6.c +@@ -740,7 +740,7 @@ int inet6_sk_rebuild_header(struct sock *sk) + &final); + rcu_read_unlock(); + +- dst = ip6_dst_lookup_flow(sk, &fl6, final_p); ++ dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p); + if (IS_ERR(dst)) { + sk->sk_route_caps = 0; + sk->sk_err_soft = -PTR_ERR(dst); +diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c +index 971a0fdf1fbc3..727f958dd8695 100644 +--- a/net/ipv6/datagram.c ++++ b/net/ipv6/datagram.c +@@ -89,7 +89,7 @@ int ip6_datagram_dst_update(struct sock *sk, bool fix_sk_saddr) + final_p = fl6_update_dst(&fl6, opt, &final); + rcu_read_unlock(); + +- dst = ip6_dst_lookup_flow(sk, &fl6, final_p); ++ dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p); + if (IS_ERR(dst)) { + err = PTR_ERR(dst); + goto out; +diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c +index 890adadcda16a..92fe9e565da0b 100644 +--- a/net/ipv6/inet6_connection_sock.c ++++ b/net/ipv6/inet6_connection_sock.c +@@ -52,7 +52,7 @@ struct dst_entry *inet6_csk_route_req(const struct sock *sk, + fl6->flowi6_uid = sk->sk_uid; + security_req_classify_flow(req, flowi6_to_flowi(fl6)); + +- dst = ip6_dst_lookup_flow(sk, fl6, final_p); ++ dst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, final_p); + if (IS_ERR(dst)) + return NULL; + +@@ -107,7 +107,7 @@ static struct dst_entry *inet6_csk_route_socket(struct sock *sk, + + dst = __inet6_csk_dst_check(sk, np->dst_cookie); + if (!dst) { +- dst = ip6_dst_lookup_flow(sk, fl6, final_p); ++ dst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, final_p); + + if (!IS_ERR(dst)) + ip6_dst_store(sk, dst, NULL, NULL); +diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c +index 9886a84c25117..22665e3638ac4 100644 +--- a/net/ipv6/ip6_output.c ++++ b/net/ipv6/ip6_output.c +@@ -1071,19 +1071,19 @@ EXPORT_SYMBOL_GPL(ip6_dst_lookup); + * It returns a valid dst pointer on success, or a pointer encoded + * error code. + */ +-struct dst_entry *ip6_dst_lookup_flow(const struct sock *sk, struct flowi6 *fl6, ++struct dst_entry *ip6_dst_lookup_flow(struct net *net, const struct sock *sk, struct flowi6 *fl6, + const struct in6_addr *final_dst) + { + struct dst_entry *dst = NULL; + int err; + +- err = ip6_dst_lookup_tail(sock_net(sk), sk, &dst, fl6); ++ err = ip6_dst_lookup_tail(net, sk, &dst, fl6); + if (err) + return ERR_PTR(err); + if (final_dst) + fl6->daddr = *final_dst; + +- return xfrm_lookup_route(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); ++ return xfrm_lookup_route(net, dst, flowi6_to_flowi(fl6), sk, 0); + } + EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow); + +@@ -1115,7 +1115,7 @@ struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, + if (dst) + return dst; + +- dst = ip6_dst_lookup_flow(sk, fl6, final_dst); ++ dst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, final_dst); + if (connected && !IS_ERR(dst)) + ip6_sk_dst_store_flow(sk, dst_clone(dst), fl6); + +diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c +index a41156a00dd44..8d19729f85162 100644 +--- a/net/ipv6/raw.c ++++ b/net/ipv6/raw.c +@@ -928,7 +928,7 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) + + fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel); + +- dst = ip6_dst_lookup_flow(sk, &fl6, final_p); ++ dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p); + if (IS_ERR(dst)) { + err = PTR_ERR(dst); + goto out; +diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c +index e997141aed8c0..a377be8a9fb44 100644 +--- a/net/ipv6/syncookies.c ++++ b/net/ipv6/syncookies.c +@@ -240,7 +240,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) + fl6.flowi6_uid = sk->sk_uid; + security_req_classify_flow(req, flowi6_to_flowi(&fl6)); + +- dst = ip6_dst_lookup_flow(sk, &fl6, final_p); ++ dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p); + if (IS_ERR(dst)) + goto out_free; + } +diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c +index 7b0c2498f461b..2e76ebfdc907d 100644 +--- a/net/ipv6/tcp_ipv6.c ++++ b/net/ipv6/tcp_ipv6.c +@@ -268,7 +268,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, + + security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); + +- dst = ip6_dst_lookup_flow(sk, &fl6, final_p); ++ dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p); + if (IS_ERR(dst)) { + err = PTR_ERR(dst); + goto failure; +@@ -885,7 +885,7 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32 + * Underlying function will use this to retrieve the network + * namespace + */ +- dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL); ++ dst = ip6_dst_lookup_flow(sock_net(ctl_sk), ctl_sk, &fl6, NULL); + if (!IS_ERR(dst)) { + skb_dst_set(buff, dst); + ip6_xmit(ctl_sk, buff, &fl6, fl6.flowi6_mark, NULL, tclass); +diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c +index 37a69df17cab9..2f28f9910b92e 100644 +--- a/net/l2tp/l2tp_ip6.c ++++ b/net/l2tp/l2tp_ip6.c +@@ -619,7 +619,7 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) + + fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel); + +- dst = ip6_dst_lookup_flow(sk, &fl6, final_p); ++ dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p); + if (IS_ERR(dst)) { + err = PTR_ERR(dst); + goto out; +diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c +index 7657194f396e1..736d8ca9821bc 100644 +--- a/net/sctp/ipv6.c ++++ b/net/sctp/ipv6.c +@@ -288,7 +288,7 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr, + final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final); + rcu_read_unlock(); + +- dst = ip6_dst_lookup_flow(sk, fl6, final_p); ++ dst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, final_p); + if (!asoc || saddr) { + t->dst = dst; + memcpy(fl, &_fl, sizeof(_fl)); +@@ -346,7 +346,7 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr, + fl6->saddr = laddr->a.v6.sin6_addr; + fl6->fl6_sport = laddr->a.v6.sin6_port; + final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final); +- bdst = ip6_dst_lookup_flow(sk, fl6, final_p); ++ bdst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, final_p); + + if (IS_ERR(bdst)) + continue; +-- +2.20.1 + diff --git a/queue-4.19/net-ipv6_stub-use-ip6_dst_lookup_flow-instead-of-ip6.patch b/queue-4.19/net-ipv6_stub-use-ip6_dst_lookup_flow-instead-of-ip6.patch new file mode 100644 index 00000000000..8114040ea26 --- /dev/null +++ b/queue-4.19/net-ipv6_stub-use-ip6_dst_lookup_flow-instead-of-ip6.patch @@ -0,0 +1,270 @@ +From 5ab35bd509e7607c769ced6e76926a4b69ad05a9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Dec 2019 15:35:53 +0100 +Subject: net: ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup + +From: Sabrina Dubroca + +commit 6c8991f41546c3c472503dff1ea9daaddf9331c2 upstream. + +ipv6_stub uses the ip6_dst_lookup function to allow other modules to +perform IPv6 lookups. However, this function skips the XFRM layer +entirely. + +All users of ipv6_stub->ip6_dst_lookup use ip_route_output_flow (via the +ip_route_output_key and ip_route_output helpers) for their IPv4 lookups, +which calls xfrm_lookup_route(). This patch fixes this inconsistent +behavior by switching the stub to ip6_dst_lookup_flow, which also calls +xfrm_lookup_route(). + +This requires some changes in all the callers, as these two functions +take different arguments and have different return types. + +Fixes: 5f81bd2e5d80 ("ipv6: export a stub for IPv6 symbols used by vxlan") +Reported-by: Xiumei Mu +Signed-off-by: Sabrina Dubroca +Signed-off-by: David S. Miller +[bwh: Backported to 4.19: + - Drop change in lwt_bpf.c + - Delete now-unused "ret" in mlx5e_route_lookup_ipv6() + - Initialise "out_dev" in mlx5e_create_encap_header_ipv6() to avoid + introducing a spurious "may be used uninitialised" warning + - Adjust filenames, context, indentation] +Signed-off-by: Ben Hutchings +Signed-off-by: Sasha Levin +--- + drivers/infiniband/core/addr.c | 7 +++---- + drivers/infiniband/sw/rxe/rxe_net.c | 8 +++++--- + drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 11 +++++------ + drivers/net/geneve.c | 4 +++- + drivers/net/vxlan.c | 8 +++----- + include/net/addrconf.h | 6 ++++-- + net/ipv6/addrconf_core.c | 11 ++++++----- + net/ipv6/af_inet6.c | 2 +- + net/mpls/af_mpls.c | 7 +++---- + net/tipc/udp_media.c | 9 ++++++--- + 10 files changed, 39 insertions(+), 34 deletions(-) + +diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c +index 6e96a2fb97dc4..df8f5ceea2dd4 100644 +--- a/drivers/infiniband/core/addr.c ++++ b/drivers/infiniband/core/addr.c +@@ -408,16 +408,15 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, + struct flowi6 fl6; + struct dst_entry *dst; + struct rt6_info *rt; +- int ret; + + memset(&fl6, 0, sizeof fl6); + fl6.daddr = dst_in->sin6_addr; + fl6.saddr = src_in->sin6_addr; + fl6.flowi6_oif = addr->bound_dev_if; + +- ret = ipv6_stub->ipv6_dst_lookup(addr->net, NULL, &dst, &fl6); +- if (ret < 0) +- return ret; ++ dst = ipv6_stub->ipv6_dst_lookup_flow(addr->net, NULL, &fl6, NULL); ++ if (IS_ERR(dst)) ++ return PTR_ERR(dst); + + rt = (struct rt6_info *)dst; + if (ipv6_addr_any(&src_in->sin6_addr)) { +diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c +index 54add70c22b5c..7903bd5c639ea 100644 +--- a/drivers/infiniband/sw/rxe/rxe_net.c ++++ b/drivers/infiniband/sw/rxe/rxe_net.c +@@ -154,10 +154,12 @@ static struct dst_entry *rxe_find_route6(struct net_device *ndev, + memcpy(&fl6.daddr, daddr, sizeof(*daddr)); + fl6.flowi6_proto = IPPROTO_UDP; + +- if (unlikely(ipv6_stub->ipv6_dst_lookup(sock_net(recv_sockets.sk6->sk), +- recv_sockets.sk6->sk, &ndst, &fl6))) { ++ ndst = ipv6_stub->ipv6_dst_lookup_flow(sock_net(recv_sockets.sk6->sk), ++ recv_sockets.sk6->sk, &fl6, ++ NULL); ++ if (unlikely(IS_ERR(ndst))) { + pr_err_ratelimited("no route to %pI6\n", daddr); +- goto put; ++ return NULL; + } + + if (unlikely(ndst->error)) { +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +index c8928ce69185f..3050853774ee0 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +@@ -2217,12 +2217,11 @@ static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv, + #if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6) + struct mlx5e_rep_priv *uplink_rpriv; + struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; +- int ret; + +- ret = ipv6_stub->ipv6_dst_lookup(dev_net(mirred_dev), NULL, &dst, +- fl6); +- if (ret < 0) +- return ret; ++ dst = ipv6_stub->ipv6_dst_lookup_flow(dev_net(mirred_dev), NULL, fl6, ++ NULL); ++ if (IS_ERR(dst)) ++ return PTR_ERR(dst); + + if (!(*out_ttl)) + *out_ttl = ip6_dst_hoplimit(dst); +@@ -2428,7 +2427,7 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv, + int max_encap_size = MLX5_CAP_ESW(priv->mdev, max_encap_header_size); + int ipv6_encap_size = ETH_HLEN + sizeof(struct ipv6hdr) + VXLAN_HLEN; + struct ip_tunnel_key *tun_key = &e->tun_info.key; +- struct net_device *out_dev; ++ struct net_device *out_dev = NULL; + struct neighbour *n = NULL; + struct flowi6 fl6 = {}; + u8 nud_state, tos, ttl; +diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c +index ff83408733d45..36444de701cd9 100644 +--- a/drivers/net/geneve.c ++++ b/drivers/net/geneve.c +@@ -801,7 +801,9 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb, + if (dst) + return dst; + } +- if (ipv6_stub->ipv6_dst_lookup(geneve->net, gs6->sock->sk, &dst, fl6)) { ++ dst = ipv6_stub->ipv6_dst_lookup_flow(geneve->net, gs6->sock->sk, fl6, ++ NULL); ++ if (IS_ERR(dst)) { + netdev_dbg(dev, "no route to %pI6\n", &fl6->daddr); + return ERR_PTR(-ENETUNREACH); + } +diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c +index 64751b089482b..7ee0bad184662 100644 +--- a/drivers/net/vxlan.c ++++ b/drivers/net/vxlan.c +@@ -1963,7 +1963,6 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan, + bool use_cache = ip_tunnel_dst_cache_usable(skb, info); + struct dst_entry *ndst; + struct flowi6 fl6; +- int err; + + if (!sock6) + return ERR_PTR(-EIO); +@@ -1986,10 +1985,9 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan, + fl6.fl6_dport = dport; + fl6.fl6_sport = sport; + +- err = ipv6_stub->ipv6_dst_lookup(vxlan->net, +- sock6->sock->sk, +- &ndst, &fl6); +- if (unlikely(err < 0)) { ++ ndst = ipv6_stub->ipv6_dst_lookup_flow(vxlan->net, sock6->sock->sk, ++ &fl6, NULL); ++ if (unlikely(IS_ERR(ndst))) { + netdev_dbg(dev, "no route to %pI6\n", daddr); + return ERR_PTR(-ENETUNREACH); + } +diff --git a/include/net/addrconf.h b/include/net/addrconf.h +index 6def0351bcc33..c8d5bb8b36169 100644 +--- a/include/net/addrconf.h ++++ b/include/net/addrconf.h +@@ -235,8 +235,10 @@ struct ipv6_stub { + const struct in6_addr *addr); + int (*ipv6_sock_mc_drop)(struct sock *sk, int ifindex, + const struct in6_addr *addr); +- int (*ipv6_dst_lookup)(struct net *net, struct sock *sk, +- struct dst_entry **dst, struct flowi6 *fl6); ++ struct dst_entry *(*ipv6_dst_lookup_flow)(struct net *net, ++ const struct sock *sk, ++ struct flowi6 *fl6, ++ const struct in6_addr *final_dst); + + struct fib6_table *(*fib6_get_table)(struct net *net, u32 id); + struct fib6_info *(*fib6_lookup)(struct net *net, int oif, +diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c +index 5cd0029d930e2..66a1a0eb2ed05 100644 +--- a/net/ipv6/addrconf_core.c ++++ b/net/ipv6/addrconf_core.c +@@ -127,11 +127,12 @@ int inet6addr_validator_notifier_call_chain(unsigned long val, void *v) + } + EXPORT_SYMBOL(inet6addr_validator_notifier_call_chain); + +-static int eafnosupport_ipv6_dst_lookup(struct net *net, struct sock *u1, +- struct dst_entry **u2, +- struct flowi6 *u3) ++static struct dst_entry *eafnosupport_ipv6_dst_lookup_flow(struct net *net, ++ const struct sock *sk, ++ struct flowi6 *fl6, ++ const struct in6_addr *final_dst) + { +- return -EAFNOSUPPORT; ++ return ERR_PTR(-EAFNOSUPPORT); + } + + static struct fib6_table *eafnosupport_fib6_get_table(struct net *net, u32 id) +@@ -169,7 +170,7 @@ eafnosupport_ip6_mtu_from_fib6(struct fib6_info *f6i, struct in6_addr *daddr, + } + + const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) { +- .ipv6_dst_lookup = eafnosupport_ipv6_dst_lookup, ++ .ipv6_dst_lookup_flow = eafnosupport_ipv6_dst_lookup_flow, + .fib6_get_table = eafnosupport_fib6_get_table, + .fib6_table_lookup = eafnosupport_fib6_table_lookup, + .fib6_lookup = eafnosupport_fib6_lookup, +diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c +index 5db88be8b6ecb..5c2351deedc8f 100644 +--- a/net/ipv6/af_inet6.c ++++ b/net/ipv6/af_inet6.c +@@ -904,7 +904,7 @@ static struct pernet_operations inet6_net_ops = { + static const struct ipv6_stub ipv6_stub_impl = { + .ipv6_sock_mc_join = ipv6_sock_mc_join, + .ipv6_sock_mc_drop = ipv6_sock_mc_drop, +- .ipv6_dst_lookup = ip6_dst_lookup, ++ .ipv6_dst_lookup_flow = ip6_dst_lookup_flow, + .fib6_get_table = fib6_get_table, + .fib6_table_lookup = fib6_table_lookup, + .fib6_lookup = fib6_lookup, +diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c +index d5a4db5b3fe7b..7623d9aec6364 100644 +--- a/net/mpls/af_mpls.c ++++ b/net/mpls/af_mpls.c +@@ -618,16 +618,15 @@ static struct net_device *inet6_fib_lookup_dev(struct net *net, + struct net_device *dev; + struct dst_entry *dst; + struct flowi6 fl6; +- int err; + + if (!ipv6_stub) + return ERR_PTR(-EAFNOSUPPORT); + + memset(&fl6, 0, sizeof(fl6)); + memcpy(&fl6.daddr, addr, sizeof(struct in6_addr)); +- err = ipv6_stub->ipv6_dst_lookup(net, NULL, &dst, &fl6); +- if (err) +- return ERR_PTR(err); ++ dst = ipv6_stub->ipv6_dst_lookup_flow(net, NULL, &fl6, NULL); ++ if (IS_ERR(dst)) ++ return ERR_CAST(dst); + + dev = dst->dev; + dev_hold(dev); +diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c +index 382c84d9339d6..1d62354797061 100644 +--- a/net/tipc/udp_media.c ++++ b/net/tipc/udp_media.c +@@ -189,10 +189,13 @@ static int tipc_udp_xmit(struct net *net, struct sk_buff *skb, + .saddr = src->ipv6, + .flowi6_proto = IPPROTO_UDP + }; +- err = ipv6_stub->ipv6_dst_lookup(net, ub->ubsock->sk, &ndst, +- &fl6); +- if (err) ++ ndst = ipv6_stub->ipv6_dst_lookup_flow(net, ++ ub->ubsock->sk, ++ &fl6, NULL); ++ if (IS_ERR(ndst)) { ++ err = PTR_ERR(ndst); + goto tx_error; ++ } + ttl = ip6_dst_hoplimit(ndst); + err = udp_tunnel6_xmit_skb(ndst, ub->ubsock->sk, skb, NULL, + &src->ipv6, &dst->ipv6, 0, ttl, 0, +-- +2.20.1 + diff --git a/queue-4.19/nvme-fix-deadlock-caused-by-ana-update-wrong-locking.patch b/queue-4.19/nvme-fix-deadlock-caused-by-ana-update-wrong-locking.patch new file mode 100644 index 00000000000..e4820edebea --- /dev/null +++ b/queue-4.19/nvme-fix-deadlock-caused-by-ana-update-wrong-locking.patch @@ -0,0 +1,72 @@ +From 5b5b53d544b791efe2cabb09160d17a19e11dcb1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Apr 2020 09:34:54 -0700 +Subject: nvme: fix deadlock caused by ANA update wrong locking + +From: Sagi Grimberg + +[ Upstream commit 657f1975e9d9c880fa13030e88ba6cc84964f1db ] + +The deadlock combines 4 flows in parallel: +- ns scanning (triggered from reconnect) +- request timeout +- ANA update (triggered from reconnect) +- I/O coming into the mpath device + +(1) ns scanning triggers disk revalidation -> update disk info -> + freeze queue -> but blocked, due to (2) + +(2) timeout handler reference the g_usage_counter - > but blocks in + the transport .timeout() handler, due to (3) + +(3) the transport timeout handler (indirectly) calls nvme_stop_queue() -> + which takes the (down_read) namespaces_rwsem - > but blocks, due to (4) + +(4) ANA update takes the (down_write) namespaces_rwsem -> calls + nvme_mpath_set_live() -> which synchronize the ns_head srcu + (see commit 504db087aacc) -> but blocks, due to (5) + +(5) I/O came into nvme_mpath_make_request -> took srcu_read_lock -> + direct_make_request > blk_queue_enter -> but blocked, due to (1) + +==> the request queue is under freeze -> deadlock. + +The fix is making ANA update take a read lock as the namespaces list +is not manipulated, it is just the ns and ns->head that are being +updated (which is protected with the ns->head lock). + +Fixes: 0d0b660f214dc ("nvme: add ANA support") +Signed-off-by: Sagi Grimberg +Reviewed-by: Keith Busch +Reviewed-by: Hannes Reinecke +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/multipath.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c +index e8bc25aed44ca..588864beabd80 100644 +--- a/drivers/nvme/host/multipath.c ++++ b/drivers/nvme/host/multipath.c +@@ -402,7 +402,7 @@ static int nvme_update_ana_state(struct nvme_ctrl *ctrl, + if (!nr_nsids) + return 0; + +- down_write(&ctrl->namespaces_rwsem); ++ down_read(&ctrl->namespaces_rwsem); + list_for_each_entry(ns, &ctrl->namespaces, list) { + unsigned nsid = le32_to_cpu(desc->nsids[n]); + +@@ -413,7 +413,7 @@ static int nvme_update_ana_state(struct nvme_ctrl *ctrl, + if (++n == nr_nsids) + break; + } +- up_write(&ctrl->namespaces_rwsem); ++ up_read(&ctrl->namespaces_rwsem); + return 0; + } + +-- +2.20.1 + diff --git a/queue-4.19/pci-aspm-allow-re-enabling-clock-pm.patch b/queue-4.19/pci-aspm-allow-re-enabling-clock-pm.patch new file mode 100644 index 00000000000..7be01278359 --- /dev/null +++ b/queue-4.19/pci-aspm-allow-re-enabling-clock-pm.patch @@ -0,0 +1,74 @@ +From 6554831e12c2ad24e319a75e4ff4ac4c931ee3cb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 5 Oct 2019 14:03:57 +0200 +Subject: PCI/ASPM: Allow re-enabling Clock PM + +From: Heiner Kallweit + +[ Upstream commit 35efea32b26f9aacc99bf07e0d2cdfba2028b099 ] + +Previously Clock PM could not be re-enabled after being disabled by +pci_disable_link_state() because clkpm_capable was reset. Change this by +adding a clkpm_disable field similar to aspm_disable. + +Link: https://lore.kernel.org/r/4e8a66db-7d53-4a66-c26c-f0037ffaa705@gmail.com +Signed-off-by: Heiner Kallweit +Signed-off-by: Bjorn Helgaas +Signed-off-by: Sasha Levin +--- + drivers/pci/pcie/aspm.c | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c +index af79a7168677d..db2efa219028c 100644 +--- a/drivers/pci/pcie/aspm.c ++++ b/drivers/pci/pcie/aspm.c +@@ -67,6 +67,7 @@ struct pcie_link_state { + u32 clkpm_capable:1; /* Clock PM capable? */ + u32 clkpm_enabled:1; /* Current Clock PM state */ + u32 clkpm_default:1; /* Default Clock PM state by BIOS */ ++ u32 clkpm_disable:1; /* Clock PM disabled */ + + /* Exit latencies */ + struct aspm_latency latency_up; /* Upstream direction exit latency */ +@@ -164,8 +165,11 @@ static void pcie_set_clkpm_nocheck(struct pcie_link_state *link, int enable) + + static void pcie_set_clkpm(struct pcie_link_state *link, int enable) + { +- /* Don't enable Clock PM if the link is not Clock PM capable */ +- if (!link->clkpm_capable) ++ /* ++ * Don't enable Clock PM if the link is not Clock PM capable ++ * or Clock PM is disabled ++ */ ++ if (!link->clkpm_capable || link->clkpm_disable) + enable = 0; + /* Need nothing if the specified equals to current state */ + if (link->clkpm_enabled == enable) +@@ -195,7 +199,8 @@ static void pcie_clkpm_cap_init(struct pcie_link_state *link, int blacklist) + } + link->clkpm_enabled = enabled; + link->clkpm_default = enabled; +- link->clkpm_capable = (blacklist) ? 0 : capable; ++ link->clkpm_capable = capable; ++ link->clkpm_disable = blacklist ? 1 : 0; + } + + static bool pcie_retrain_link(struct pcie_link_state *link) +@@ -1106,10 +1111,9 @@ static void __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) + link->aspm_disable |= ASPM_STATE_L1; + pcie_config_aspm_link(link, policy_to_aspm_state(link)); + +- if (state & PCIE_LINK_STATE_CLKPM) { +- link->clkpm_capable = 0; +- pcie_set_clkpm(link, 0); +- } ++ if (state & PCIE_LINK_STATE_CLKPM) ++ link->clkpm_disable = 1; ++ pcie_set_clkpm(link, policy_to_clkpm_state(link)); + mutex_unlock(&aspm_lock); + if (sem) + up_read(&pci_bus_sem); +-- +2.20.1 + diff --git a/queue-4.19/perf-core-disable-page-faults-when-getting-phys-addr.patch b/queue-4.19/perf-core-disable-page-faults-when-getting-phys-addr.patch new file mode 100644 index 00000000000..5f03f77e4b3 --- /dev/null +++ b/queue-4.19/perf-core-disable-page-faults-when-getting-phys-addr.patch @@ -0,0 +1,71 @@ +From 011ee9099496fb47c35e7d530afadf42041a540d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Apr 2020 16:14:27 +0200 +Subject: perf/core: Disable page faults when getting phys address + +From: Jiri Olsa + +[ Upstream commit d3296fb372bf7497b0e5d0478c4e7a677ec6f6e9 ] + +We hit following warning when running tests on kernel +compiled with CONFIG_DEBUG_ATOMIC_SLEEP=y: + + WARNING: CPU: 19 PID: 4472 at mm/gup.c:2381 __get_user_pages_fast+0x1a4/0x200 + CPU: 19 PID: 4472 Comm: dummy Not tainted 5.6.0-rc6+ #3 + RIP: 0010:__get_user_pages_fast+0x1a4/0x200 + ... + Call Trace: + perf_prepare_sample+0xff1/0x1d90 + perf_event_output_forward+0xe8/0x210 + __perf_event_overflow+0x11a/0x310 + __intel_pmu_pebs_event+0x657/0x850 + intel_pmu_drain_pebs_nhm+0x7de/0x11d0 + handle_pmi_common+0x1b2/0x650 + intel_pmu_handle_irq+0x17b/0x370 + perf_event_nmi_handler+0x40/0x60 + nmi_handle+0x192/0x590 + default_do_nmi+0x6d/0x150 + do_nmi+0x2f9/0x3c0 + nmi+0x8e/0xd7 + +While __get_user_pages_fast() is IRQ-safe, it calls access_ok(), +which warns on: + + WARN_ON_ONCE(!in_task() && !pagefault_disabled()) + +Peter suggested disabling page faults around __get_user_pages_fast(), +which gets rid of the warning in access_ok() call. + +Suggested-by: Peter Zijlstra +Signed-off-by: Jiri Olsa +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Ingo Molnar +Link: https://lkml.kernel.org/r/20200407141427.3184722-1-jolsa@kernel.org +Signed-off-by: Sasha Levin +--- + kernel/events/core.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/kernel/events/core.c b/kernel/events/core.c +index 8c70ee23fbe91..00fb2fe92c4d6 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -6411,9 +6411,12 @@ static u64 perf_virt_to_phys(u64 virt) + * Try IRQ-safe __get_user_pages_fast first. + * If failed, leave phys_addr as 0. + */ +- if ((current->mm != NULL) && +- (__get_user_pages_fast(virt, 1, 0, &p) == 1)) +- phys_addr = page_to_phys(p) + virt % PAGE_SIZE; ++ if (current->mm != NULL) { ++ pagefault_disable(); ++ if (__get_user_pages_fast(virt, 1, 0, &p) == 1) ++ phys_addr = page_to_phys(p) + virt % PAGE_SIZE; ++ pagefault_enable(); ++ } + + if (p) + put_page(p); +-- +2.20.1 + diff --git a/queue-4.19/pwm-bcm2835-dynamically-allocate-base.patch b/queue-4.19/pwm-bcm2835-dynamically-allocate-base.patch new file mode 100644 index 00000000000..cd65a36b1de --- /dev/null +++ b/queue-4.19/pwm-bcm2835-dynamically-allocate-base.patch @@ -0,0 +1,42 @@ +From bea963a1b03eae7c647ce885814d8c9635c44c97 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 3 Feb 2020 13:35:35 -0800 +Subject: pwm: bcm2835: Dynamically allocate base +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Florian Fainelli + +[ Upstream commit 2c25b07e5ec119cab609e41407a1fb3fa61442f5 ] + +The newer 2711 and 7211 chips have two PWM controllers and failure to +dynamically allocate the PWM base would prevent the second PWM +controller instance being probed for succeeding with an -EEXIST error +from alloc_pwms(). + +Fixes: e5a06dc5ac1f ("pwm: Add BCM2835 PWM driver") +Signed-off-by: Florian Fainelli +Acked-by: Uwe Kleine-König +Reviewed-by: Nicolas Saenz Julienne +Signed-off-by: Thierry Reding +Signed-off-by: Sasha Levin +--- + drivers/pwm/pwm-bcm2835.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c +index db001cba937fd..e340ad79a1ec9 100644 +--- a/drivers/pwm/pwm-bcm2835.c ++++ b/drivers/pwm/pwm-bcm2835.c +@@ -166,6 +166,7 @@ static int bcm2835_pwm_probe(struct platform_device *pdev) + + pc->chip.dev = &pdev->dev; + pc->chip.ops = &bcm2835_pwm_ops; ++ pc->chip.base = -1; + pc->chip.npwm = 2; + pc->chip.of_xlate = of_pwm_xlate_with_flags; + pc->chip.of_pwm_n_cells = 3; +-- +2.20.1 + diff --git a/queue-4.19/pwm-rcar-fix-late-runtime-pm-enablement.patch b/queue-4.19/pwm-rcar-fix-late-runtime-pm-enablement.patch new file mode 100644 index 00000000000..a8195b1d34e --- /dev/null +++ b/queue-4.19/pwm-rcar-fix-late-runtime-pm-enablement.patch @@ -0,0 +1,66 @@ +From d510ddb427d1c183446c859b3ee6e6d6b390538f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Mar 2020 11:32:14 +0100 +Subject: pwm: rcar: Fix late Runtime PM enablement +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Geert Uytterhoeven + +[ Upstream commit 1451a3eed24b5fd6a604683f0b6995e0e7e16c79 ] + +Runtime PM should be enabled before calling pwmchip_add(), as PWM users +can appear immediately after the PWM chip has been added. +Likewise, Runtime PM should be disabled after the removal of the PWM +chip. + +Fixes: ed6c1476bf7f16d5 ("pwm: Add support for R-Car PWM Timer") +Signed-off-by: Geert Uytterhoeven +Reviewed-by: Uwe Kleine-König +Reviewed-by: Laurent Pinchart +Signed-off-by: Thierry Reding +Signed-off-by: Sasha Levin +--- + drivers/pwm/pwm-rcar.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c +index 748f614d53755..b7d71bf297d69 100644 +--- a/drivers/pwm/pwm-rcar.c ++++ b/drivers/pwm/pwm-rcar.c +@@ -232,24 +232,28 @@ static int rcar_pwm_probe(struct platform_device *pdev) + rcar_pwm->chip.base = -1; + rcar_pwm->chip.npwm = 1; + ++ pm_runtime_enable(&pdev->dev); ++ + ret = pwmchip_add(&rcar_pwm->chip); + if (ret < 0) { + dev_err(&pdev->dev, "failed to register PWM chip: %d\n", ret); ++ pm_runtime_disable(&pdev->dev); + return ret; + } + +- pm_runtime_enable(&pdev->dev); +- + return 0; + } + + static int rcar_pwm_remove(struct platform_device *pdev) + { + struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev); ++ int ret; ++ ++ ret = pwmchip_remove(&rcar_pwm->chip); + + pm_runtime_disable(&pdev->dev); + +- return pwmchip_remove(&rcar_pwm->chip); ++ return ret; + } + + static const struct of_device_id rcar_pwm_of_table[] = { +-- +2.20.1 + diff --git a/queue-4.19/pwm-renesas-tpu-fix-late-runtime-pm-enablement.patch b/queue-4.19/pwm-renesas-tpu-fix-late-runtime-pm-enablement.patch new file mode 100644 index 00000000000..c0c1013153a --- /dev/null +++ b/queue-4.19/pwm-renesas-tpu-fix-late-runtime-pm-enablement.patch @@ -0,0 +1,63 @@ +From 41cc334a48d688bcdad7100e4b76adc7a0d9f11f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Mar 2020 11:32:15 +0100 +Subject: pwm: renesas-tpu: Fix late Runtime PM enablement + +From: Geert Uytterhoeven + +[ Upstream commit d5a3c7a4536e1329a758e14340efd0e65252bd3d ] + +Runtime PM should be enabled before calling pwmchip_add(), as PWM users +can appear immediately after the PWM chip has been added. +Likewise, Runtime PM should always be disabled after the removal of the +PWM chip, even if the latter failed. + +Fixes: 99b82abb0a35b073 ("pwm: Add Renesas TPU PWM driver") +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Thierry Reding +Signed-off-by: Sasha Levin +--- + drivers/pwm/pwm-renesas-tpu.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/drivers/pwm/pwm-renesas-tpu.c b/drivers/pwm/pwm-renesas-tpu.c +index 29267d12fb4c9..9c7962f2f0aa4 100644 +--- a/drivers/pwm/pwm-renesas-tpu.c ++++ b/drivers/pwm/pwm-renesas-tpu.c +@@ -423,16 +423,17 @@ static int tpu_probe(struct platform_device *pdev) + tpu->chip.base = -1; + tpu->chip.npwm = TPU_CHANNEL_MAX; + ++ pm_runtime_enable(&pdev->dev); ++ + ret = pwmchip_add(&tpu->chip); + if (ret < 0) { + dev_err(&pdev->dev, "failed to register PWM chip\n"); ++ pm_runtime_disable(&pdev->dev); + return ret; + } + + dev_info(&pdev->dev, "TPU PWM %d registered\n", tpu->pdev->id); + +- pm_runtime_enable(&pdev->dev); +- + return 0; + } + +@@ -442,12 +443,10 @@ static int tpu_remove(struct platform_device *pdev) + int ret; + + ret = pwmchip_remove(&tpu->chip); +- if (ret) +- return ret; + + pm_runtime_disable(&pdev->dev); + +- return 0; ++ return ret; + } + + #ifdef CONFIG_OF +-- +2.20.1 + diff --git a/queue-4.19/revert-powerpc-64-irq_work-avoid-interrupt-when-call.patch b/queue-4.19/revert-powerpc-64-irq_work-avoid-interrupt-when-call.patch new file mode 100644 index 00000000000..73348a9598c --- /dev/null +++ b/queue-4.19/revert-powerpc-64-irq_work-avoid-interrupt-when-call.patch @@ -0,0 +1,111 @@ +From 747bf44084f49f04767693034e8b94aac4273c15 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Apr 2020 22:04:01 +1000 +Subject: Revert "powerpc/64: irq_work avoid interrupt when called with + hardware irqs enabled" + +From: Nicholas Piggin + +[ Upstream commit abc3fce76adbdfa8f87272c784b388cd20b46049 ] + +This reverts commit ebb37cf3ffd39fdb6ec5b07111f8bb2f11d92c5f. + +That commit does not play well with soft-masked irq state +manipulations in idle, interrupt replay, and possibly others due to +tracing code sometimes using irq_work_queue (e.g., in +trace_hardirqs_on()). That can cause PACA_IRQ_DEC to become set when +it is not expected, and be ignored or cleared or cause warnings. + +The net result seems to be missing an irq_work until the next timer +interrupt in the worst case which is usually not going to be noticed, +however it could be a long time if the tick is disabled, which is +against the spirit of irq_work and might cause real problems. + +The idea is still solid, but it would need more work. It's not really +clear if it would be worth added complexity, so revert this for +now (not a straight revert, but replace with a comment explaining why +we might see interrupts happening, and gives git blame something to +find). + +Fixes: ebb37cf3ffd3 ("powerpc/64: irq_work avoid interrupt when called with hardware irqs enabled") +Signed-off-by: Nicholas Piggin +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20200402120401.1115883-1-npiggin@gmail.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/kernel/time.c | 44 +++++++++++--------------------------- + 1 file changed, 13 insertions(+), 31 deletions(-) + +diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c +index 5449e76cf2dfd..f6c21f6af274e 100644 +--- a/arch/powerpc/kernel/time.c ++++ b/arch/powerpc/kernel/time.c +@@ -492,35 +492,6 @@ static inline void clear_irq_work_pending(void) + "i" (offsetof(struct paca_struct, irq_work_pending))); + } + +-void arch_irq_work_raise(void) +-{ +- preempt_disable(); +- set_irq_work_pending_flag(); +- /* +- * Non-nmi code running with interrupts disabled will replay +- * irq_happened before it re-enables interrupts, so setthe +- * decrementer there instead of causing a hardware exception +- * which would immediately hit the masked interrupt handler +- * and have the net effect of setting the decrementer in +- * irq_happened. +- * +- * NMI interrupts can not check this when they return, so the +- * decrementer hardware exception is raised, which will fire +- * when interrupts are next enabled. +- * +- * BookE does not support this yet, it must audit all NMI +- * interrupt handlers to ensure they call nmi_enter() so this +- * check would be correct. +- */ +- if (IS_ENABLED(CONFIG_BOOKE) || !irqs_disabled() || in_nmi()) { +- set_dec(1); +- } else { +- hard_irq_disable(); +- local_paca->irq_happened |= PACA_IRQ_DEC; +- } +- preempt_enable(); +-} +- + #else /* 32-bit */ + + DEFINE_PER_CPU(u8, irq_work_pending); +@@ -529,16 +500,27 @@ DEFINE_PER_CPU(u8, irq_work_pending); + #define test_irq_work_pending() __this_cpu_read(irq_work_pending) + #define clear_irq_work_pending() __this_cpu_write(irq_work_pending, 0) + ++#endif /* 32 vs 64 bit */ ++ + void arch_irq_work_raise(void) + { ++ /* ++ * 64-bit code that uses irq soft-mask can just cause an immediate ++ * interrupt here that gets soft masked, if this is called under ++ * local_irq_disable(). It might be possible to prevent that happening ++ * by noticing interrupts are disabled and setting decrementer pending ++ * to be replayed when irqs are enabled. The problem there is that ++ * tracing can call irq_work_raise, including in code that does low ++ * level manipulations of irq soft-mask state (e.g., trace_hardirqs_on) ++ * which could get tangled up if we're messing with the same state ++ * here. ++ */ + preempt_disable(); + set_irq_work_pending_flag(); + set_dec(1); + preempt_enable(); + } + +-#endif /* 32 vs 64 bit */ +- + #else /* CONFIG_IRQ_WORK */ + + #define test_irq_work_pending() 0 +-- +2.20.1 + diff --git a/queue-4.19/s390-cio-avoid-duplicated-add-uevents.patch b/queue-4.19/s390-cio-avoid-duplicated-add-uevents.patch new file mode 100644 index 00000000000..08a7a931cab --- /dev/null +++ b/queue-4.19/s390-cio-avoid-duplicated-add-uevents.patch @@ -0,0 +1,65 @@ +From c95c580f00477e8956a884b3bffdc7284d2c5d03 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 27 Mar 2020 13:45:02 +0100 +Subject: s390/cio: avoid duplicated 'ADD' uevents + +From: Cornelia Huck + +[ Upstream commit 05ce3e53f375295c2940390b2b429e506e07655c ] + +The common I/O layer delays the ADD uevent for subchannels and +delegates generating this uevent to the individual subchannel +drivers. The io_subchannel driver will do so when the associated +ccw_device has been registered -- but unconditionally, so more +ADD uevents will be generated if a subchannel has been unbound +from the io_subchannel driver and later rebound. + +To fix this, only generate the ADD event if uevents were still +suppressed for the device. + +Fixes: fa1a8c23eb7d ("s390: cio: Delay uevents for subchannels") +Message-Id: <20200327124503.9794-2-cohuck@redhat.com> +Reported-by: Boris Fiuczynski +Reviewed-by: Peter Oberparleiter +Reviewed-by: Boris Fiuczynski +Signed-off-by: Cornelia Huck +Signed-off-by: Vasily Gorbik +Signed-off-by: Sasha Levin +--- + drivers/s390/cio/device.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c +index 1540229a37bba..c9bc9a6bd73b7 100644 +--- a/drivers/s390/cio/device.c ++++ b/drivers/s390/cio/device.c +@@ -827,8 +827,10 @@ static void io_subchannel_register(struct ccw_device *cdev) + * Now we know this subchannel will stay, we can throw + * our delayed uevent. + */ +- dev_set_uevent_suppress(&sch->dev, 0); +- kobject_uevent(&sch->dev.kobj, KOBJ_ADD); ++ if (dev_get_uevent_suppress(&sch->dev)) { ++ dev_set_uevent_suppress(&sch->dev, 0); ++ kobject_uevent(&sch->dev.kobj, KOBJ_ADD); ++ } + /* make it known to the system */ + ret = ccw_device_add(cdev); + if (ret) { +@@ -1036,8 +1038,11 @@ static int io_subchannel_probe(struct subchannel *sch) + * Throw the delayed uevent for the subchannel, register + * the ccw_device and exit. + */ +- dev_set_uevent_suppress(&sch->dev, 0); +- kobject_uevent(&sch->dev.kobj, KOBJ_ADD); ++ if (dev_get_uevent_suppress(&sch->dev)) { ++ /* should always be the case for the console */ ++ dev_set_uevent_suppress(&sch->dev, 0); ++ kobject_uevent(&sch->dev.kobj, KOBJ_ADD); ++ } + cdev = sch_get_cdev(sch); + rc = ccw_device_add(cdev); + if (rc) { +-- +2.20.1 + diff --git a/queue-4.19/scsi-iscsi-report-unbind-session-event-when-the-targ.patch b/queue-4.19/scsi-iscsi-report-unbind-session-event-when-the-targ.patch new file mode 100644 index 00000000000..2deec9ae6d7 --- /dev/null +++ b/queue-4.19/scsi-iscsi-report-unbind-session-event-when-the-targ.patch @@ -0,0 +1,61 @@ +From 1679ef7d9ee534ce8bc1a9e042fc03186e9ff2b5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Mar 2020 15:58:50 +0800 +Subject: scsi: iscsi: Report unbind session event when the target has been + removed + +From: Wu Bo + +[ Upstream commit 13e60d3ba287d96eeaf1deaadba51f71578119a3 ] + +If the daemon is restarted or crashes while logging out of a session, the +unbind session event sent by the kernel is not processed and is lost. When +the daemon starts again, the session can't be unbound because the daemon is +waiting for the event message. However, the kernel has already logged out +and the event will not be resent. + +When iscsid restart is complete, logout session reports error: + +Logging out of session [sid: 6, target: iqn.xxxxx, portal: xx.xx.xx.xx,3260] +iscsiadm: Could not logout of [sid: 6, target: iscsiadm -m node iqn.xxxxx, portal: xx.xx.xx.xx,3260]. +iscsiadm: initiator reported error (9 - internal error) +iscsiadm: Could not logout of all requested sessions + +Make sure the unbind event is emitted. + +[mkp: commit desc and applied by hand since patch was mangled] + +Link: https://lore.kernel.org/r/4eab1771-2cb3-8e79-b31c-923652340e99@huawei.com +Reviewed-by: Lee Duncan +Signed-off-by: Wu Bo +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/scsi_transport_iscsi.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c +index c0fb9e7890807..04d095488c764 100644 +--- a/drivers/scsi/scsi_transport_iscsi.c ++++ b/drivers/scsi/scsi_transport_iscsi.c +@@ -2010,7 +2010,7 @@ static void __iscsi_unbind_session(struct work_struct *work) + if (session->target_id == ISCSI_MAX_TARGET) { + spin_unlock_irqrestore(&session->lock, flags); + mutex_unlock(&ihost->mutex); +- return; ++ goto unbind_session_exit; + } + + target_id = session->target_id; +@@ -2022,6 +2022,8 @@ static void __iscsi_unbind_session(struct work_struct *work) + ida_simple_remove(&iscsi_sess_ida, target_id); + + scsi_remove_target(&session->dev); ++ ++unbind_session_exit: + iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION); + ISCSI_DBG_TRANS_SESSION(session, "Completed target removal\n"); + } +-- +2.20.1 + diff --git a/queue-4.19/scsi-lpfc-fix-crash-in-target-side-cable-pulls-hitti.patch b/queue-4.19/scsi-lpfc-fix-crash-in-target-side-cable-pulls-hitti.patch new file mode 100644 index 00000000000..7f92fbfe02b --- /dev/null +++ b/queue-4.19/scsi-lpfc-fix-crash-in-target-side-cable-pulls-hitti.patch @@ -0,0 +1,76 @@ +From 7122d234ef7170bb1f9fcff4fcd56e9e018d1811 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 22 Mar 2020 11:12:59 -0700 +Subject: scsi: lpfc: Fix crash in target side cable pulls hitting + WAIT_FOR_UNREG + +From: James Smart + +[ Upstream commit 807e7353d8a7105ce884d22b0dbc034993c6679c ] + +Kernel is crashing with the following stacktrace: + + BUG: unable to handle kernel NULL pointer dereference at + 00000000000005bc + IP: lpfc_nvme_register_port+0x1a8/0x3a0 [lpfc] + ... + Call Trace: + lpfc_nlp_state_cleanup+0x2b2/0x500 [lpfc] + lpfc_nlp_set_state+0xd7/0x1a0 [lpfc] + lpfc_cmpl_prli_prli_issue+0x1f7/0x450 [lpfc] + lpfc_disc_state_machine+0x7a/0x1e0 [lpfc] + lpfc_cmpl_els_prli+0x16f/0x1e0 [lpfc] + lpfc_sli_sp_handle_rspiocb+0x5b2/0x690 [lpfc] + lpfc_sli_handle_slow_ring_event_s4+0x182/0x230 [lpfc] + lpfc_do_work+0x87f/0x1570 [lpfc] + kthread+0x10d/0x130 + ret_from_fork+0x35/0x40 + +During target side fault injections, it is possible to hit the +NLP_WAIT_FOR_UNREG case in lpfc_nvme_remoteport_delete. A prior commit +fixed a rebind and delete race condition, but called lpfc_nlp_put +unconditionally. This triggered a deletion and the crash. + +Fix by movng nlp_put to inside the NLP_WAIT_FOR_UNREG case, where the nlp +will be being unregistered/removed. Leave the reference if the flag isn't +set. + +Link: https://lore.kernel.org/r/20200322181304.37655-8-jsmart2021@gmail.com +Fixes: b15bd3e6212e ("scsi: lpfc: Fix nvme remoteport registration race conditions") +Signed-off-by: James Smart +Signed-off-by: Dick Kennedy +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/lpfc/lpfc_nvme.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c +index f73726e55e44d..e3013858937b7 100644 +--- a/drivers/scsi/lpfc/lpfc_nvme.c ++++ b/drivers/scsi/lpfc/lpfc_nvme.c +@@ -342,13 +342,15 @@ lpfc_nvme_remoteport_delete(struct nvme_fc_remote_port *remoteport) + if (ndlp->upcall_flags & NLP_WAIT_FOR_UNREG) { + ndlp->nrport = NULL; + ndlp->upcall_flags &= ~NLP_WAIT_FOR_UNREG; +- } +- spin_unlock_irq(&vport->phba->hbalock); ++ spin_unlock_irq(&vport->phba->hbalock); + +- /* Remove original register reference. The host transport +- * won't reference this rport/remoteport any further. +- */ +- lpfc_nlp_put(ndlp); ++ /* Remove original register reference. The host transport ++ * won't reference this rport/remoteport any further. ++ */ ++ lpfc_nlp_put(ndlp); ++ } else { ++ spin_unlock_irq(&vport->phba->hbalock); ++ } + + rport_err: + return; +-- +2.20.1 + diff --git a/queue-4.19/scsi-lpfc-fix-kasan-slab-out-of-bounds-error-in-lpfc.patch b/queue-4.19/scsi-lpfc-fix-kasan-slab-out-of-bounds-error-in-lpfc.patch new file mode 100644 index 00000000000..8aaef6d8268 --- /dev/null +++ b/queue-4.19/scsi-lpfc-fix-kasan-slab-out-of-bounds-error-in-lpfc.patch @@ -0,0 +1,62 @@ +From 9c9c7b0792d4cac6fe3628c3d08d1a3370cf86ee Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 22 Mar 2020 11:12:53 -0700 +Subject: scsi: lpfc: Fix kasan slab-out-of-bounds error in lpfc_unreg_login + +From: James Smart + +[ Upstream commit 38503943c89f0bafd9e3742f63f872301d44cbea ] + +The following kasan bug was called out: + + BUG: KASAN: slab-out-of-bounds in lpfc_unreg_login+0x7c/0xc0 [lpfc] + Read of size 2 at addr ffff889fc7c50a22 by task lpfc_worker_3/6676 + ... + Call Trace: + dump_stack+0x96/0xe0 + ? lpfc_unreg_login+0x7c/0xc0 [lpfc] + print_address_description.constprop.6+0x1b/0x220 + ? lpfc_unreg_login+0x7c/0xc0 [lpfc] + ? lpfc_unreg_login+0x7c/0xc0 [lpfc] + __kasan_report.cold.9+0x37/0x7c + ? lpfc_unreg_login+0x7c/0xc0 [lpfc] + kasan_report+0xe/0x20 + lpfc_unreg_login+0x7c/0xc0 [lpfc] + lpfc_sli_def_mbox_cmpl+0x334/0x430 [lpfc] + ... + +When processing the completion of a "Reg Rpi" login mailbox command in +lpfc_sli_def_mbox_cmpl, a call may be made to lpfc_unreg_login. The vpi is +extracted from the completing mailbox context and passed as an input for +the next. However, the vpi stored in the mailbox command context is an +absolute vpi, which for SLI4 represents both base + offset. When used with +a non-zero base component, (function id > 0) this results in an +out-of-range access beyond the allocated phba->vpi_ids array. + +Fix by subtracting the function's base value to get an accurate vpi number. + +Link: https://lore.kernel.org/r/20200322181304.37655-2-jsmart2021@gmail.com +Signed-off-by: James Smart +Signed-off-by: Dick Kennedy +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/lpfc/lpfc_sli.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c +index a801917d3c193..a56a939792ac1 100644 +--- a/drivers/scsi/lpfc/lpfc_sli.c ++++ b/drivers/scsi/lpfc/lpfc_sli.c +@@ -2472,6 +2472,8 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) + !pmb->u.mb.mbxStatus) { + rpi = pmb->u.mb.un.varWords[0]; + vpi = pmb->u.mb.un.varRegLogin.vpi; ++ if (phba->sli_rev == LPFC_SLI_REV4) ++ vpi -= phba->sli4_hba.max_cfg_param.vpi_base; + lpfc_unreg_login(phba, vpi, rpi, pmb); + pmb->vport = vport; + pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; +-- +2.20.1 + diff --git a/queue-4.19/scsi-smartpqi-fix-call-trace-in-device-discovery.patch b/queue-4.19/scsi-smartpqi-fix-call-trace-in-device-discovery.patch new file mode 100644 index 00000000000..e51a5a6481b --- /dev/null +++ b/queue-4.19/scsi-smartpqi-fix-call-trace-in-device-discovery.patch @@ -0,0 +1,43 @@ +From 5a277c052af47f4ea26e7f4630fede192e9f0c3c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Oct 2019 17:31:28 -0500 +Subject: scsi: smartpqi: fix call trace in device discovery + +From: Murthy Bhat + +[ Upstream commit b969261134c1b990b96ea98fe5e0fcf8ec937c04 ] + +Use sas_phy_delete rather than sas_phy_free which, according to +comments, should not be called for PHYs that have been set up +successfully. + +Link: https://lore.kernel.org/r/157048748876.11757.17773443136670011786.stgit@brunhilda +Reviewed-by: Scott Benesh +Reviewed-by: Scott Teel +Reviewed-by: Kevin Barnett +Signed-off-by: Murthy Bhat +Signed-off-by: Don Brace +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/smartpqi/smartpqi_sas_transport.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/scsi/smartpqi/smartpqi_sas_transport.c b/drivers/scsi/smartpqi/smartpqi_sas_transport.c +index b209a35e482ef..01dfb97b07786 100644 +--- a/drivers/scsi/smartpqi/smartpqi_sas_transport.c ++++ b/drivers/scsi/smartpqi/smartpqi_sas_transport.c +@@ -50,9 +50,9 @@ static void pqi_free_sas_phy(struct pqi_sas_phy *pqi_sas_phy) + struct sas_phy *phy = pqi_sas_phy->phy; + + sas_port_delete_phy(pqi_sas_phy->parent_port->port, phy); +- sas_phy_free(phy); + if (pqi_sas_phy->added_to_port) + list_del(&pqi_sas_phy->phy_list_entry); ++ sas_phy_delete(phy); + kfree(pqi_sas_phy); + } + +-- +2.20.1 + diff --git a/queue-4.19/selftests-kmod-fix-handling-test-numbers-above-9.patch b/queue-4.19/selftests-kmod-fix-handling-test-numbers-above-9.patch new file mode 100644 index 00000000000..4e2e970c5e4 --- /dev/null +++ b/queue-4.19/selftests-kmod-fix-handling-test-numbers-above-9.patch @@ -0,0 +1,64 @@ +From feb77df6548ce4aad0df97ae0dfaf5bfee4f0283 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Apr 2020 14:33:53 -0700 +Subject: selftests: kmod: fix handling test numbers above 9 + +From: Eric Biggers + +[ Upstream commit 6d573a07528308eb77ec072c010819c359bebf6e ] + +get_test_count() and get_test_enabled() were broken for test numbers +above 9 due to awk interpreting a field specification like '$0010' as +octal rather than decimal. Fix it by stripping the leading zeroes. + +Signed-off-by: Eric Biggers +Signed-off-by: Andrew Morton +Acked-by: Luis Chamberlain +Cc: Alexei Starovoitov +Cc: Greg Kroah-Hartman +Cc: Jeff Vander Stoep +Cc: Jessica Yu +Cc: Kees Cook +Cc: NeilBrown +Link: http://lkml.kernel.org/r/20200318230515.171692-5-ebiggers@kernel.org +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/kmod/kmod.sh | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/tools/testing/selftests/kmod/kmod.sh b/tools/testing/selftests/kmod/kmod.sh +index 0a76314b44149..1f118916a83e4 100755 +--- a/tools/testing/selftests/kmod/kmod.sh ++++ b/tools/testing/selftests/kmod/kmod.sh +@@ -505,18 +505,23 @@ function test_num() + fi + } + +-function get_test_count() ++function get_test_data() + { + test_num $1 +- TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') ++ local field_num=$(echo $1 | sed 's/^0*//') ++ echo $ALL_TESTS | awk '{print $'$field_num'}' ++} ++ ++function get_test_count() ++{ ++ TEST_DATA=$(get_test_data $1) + LAST_TWO=${TEST_DATA#*:*} + echo ${LAST_TWO%:*} + } + + function get_test_enabled() + { +- test_num $1 +- TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') ++ TEST_DATA=$(get_test_data $1) + echo ${TEST_DATA#*:*:} + } + +-- +2.20.1 + diff --git a/queue-4.19/series b/queue-4.19/series index 973e6d7ea5e..431589e07e2 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -8,3 +8,34 @@ arm64-errata-hide-ctr_el0.dic-on-systems-affected-by.patch arm64-fake-the-iminline-size-on-systems-affected-by-.patch arm64-compat-workaround-neoverse-n1-1542419-for-comp.patch arm64-silence-clang-warning-on-mismatched-value-regi.patch +watchdog-reset-last_hw_keepalive-time-at-start.patch +scsi-lpfc-fix-kasan-slab-out-of-bounds-error-in-lpfc.patch +scsi-lpfc-fix-crash-in-target-side-cable-pulls-hitti.patch +ceph-return-ceph_mdsc_do_request-errors-from-__get_p.patch +ceph-don-t-skip-updating-wanted-caps-when-cap-is-sta.patch +pwm-rcar-fix-late-runtime-pm-enablement.patch +scsi-iscsi-report-unbind-session-event-when-the-targ.patch +asoc-intel-atom-take-the-drv-lock-mutex-before-calli.patch +nvme-fix-deadlock-caused-by-ana-update-wrong-locking.patch +kernel-gcov-fs.c-gcov_seq_next-should-increase-posit.patch +selftests-kmod-fix-handling-test-numbers-above-9.patch +ipc-util.c-sysvipc_find_ipc-should-increase-position.patch +kconfig-qconf-fix-a-few-alignment-issues.patch +s390-cio-avoid-duplicated-add-uevents.patch +loop-better-discard-support-for-block-devices.patch +revert-powerpc-64-irq_work-avoid-interrupt-when-call.patch +pwm-renesas-tpu-fix-late-runtime-pm-enablement.patch +pwm-bcm2835-dynamically-allocate-base.patch +perf-core-disable-page-faults-when-getting-phys-addr.patch +asoc-intel-bytcr_rt5640-add-quirk-for-mpman-mpwin895.patch +xhci-ensure-link-state-is-u3-after-setting-usb_ss_po.patch +drm-amd-display-not-doing-optimize-bandwidth-if-flip.patch +tracing-selftests-turn-off-timeout-setting.patch +virtio-blk-improve-virtqueue-error-to-blk_sts.patch +scsi-smartpqi-fix-call-trace-in-device-discovery.patch +pci-aspm-allow-re-enabling-clock-pm.patch +net-ipv6-add-net-argument-to-ip6_dst_lookup_flow.patch +net-ipv6_stub-use-ip6_dst_lookup_flow-instead-of-ip6.patch +blktrace-protect-q-blk_trace-with-rcu.patch +blktrace-fix-dereference-after-null-check.patch +f2fs-fix-to-avoid-memory-leakage-in-f2fs_listxattr.patch diff --git a/queue-4.19/tracing-selftests-turn-off-timeout-setting.patch b/queue-4.19/tracing-selftests-turn-off-timeout-setting.patch new file mode 100644 index 00000000000..a9a1cb181e8 --- /dev/null +++ b/queue-4.19/tracing-selftests-turn-off-timeout-setting.patch @@ -0,0 +1,35 @@ +From 4530557ddf969042f0839898d785506bfd8e7072 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Nov 2019 11:48:39 -0500 +Subject: tracing/selftests: Turn off timeout setting + +From: Steven Rostedt (VMware) + +[ Upstream commit b43e78f65b1d35fd3e13c7b23f9b64ea83c9ad3a ] + +As the ftrace selftests can run for a long period of time, disable the +timeout that the general selftests have. If a selftest hangs, then it +probably means the machine will hang too. + +Link: https://lore.kernel.org/r/alpine.LSU.2.21.1911131604170.18679@pobox.suse.cz + +Suggested-by: Miroslav Benes +Tested-by: Miroslav Benes +Reviewed-by: Miroslav Benes +Signed-off-by: Steven Rostedt (VMware) +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/ftrace/settings | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 tools/testing/selftests/ftrace/settings + +diff --git a/tools/testing/selftests/ftrace/settings b/tools/testing/selftests/ftrace/settings +new file mode 100644 +index 0000000000000..e7b9417537fbc +--- /dev/null ++++ b/tools/testing/selftests/ftrace/settings +@@ -0,0 +1 @@ ++timeout=0 +-- +2.20.1 + diff --git a/queue-4.19/virtio-blk-improve-virtqueue-error-to-blk_sts.patch b/queue-4.19/virtio-blk-improve-virtqueue-error-to-blk_sts.patch new file mode 100644 index 00000000000..98712e39fd9 --- /dev/null +++ b/queue-4.19/virtio-blk-improve-virtqueue-error-to-blk_sts.patch @@ -0,0 +1,47 @@ +From d236b00e08936954c9351d9eaa49ae69097098ac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 13 Feb 2020 13:37:28 +0100 +Subject: virtio-blk: improve virtqueue error to BLK_STS + +From: Halil Pasic + +[ Upstream commit 3d973b2e9a625996ee997c7303cd793b9d197c65 ] + +Let's change the mapping between virtqueue_add errors to BLK_STS +statuses, so that -ENOSPC, which indicates virtqueue full is still +mapped to BLK_STS_DEV_RESOURCE, but -ENOMEM which indicates non-device +specific resource outage is mapped to BLK_STS_RESOURCE. + +Signed-off-by: Halil Pasic +Link: https://lore.kernel.org/r/20200213123728.61216-3-pasic@linux.ibm.com +Signed-off-by: Michael S. Tsirkin +Reviewed-by: Stefan Hajnoczi +Signed-off-by: Sasha Levin +--- + drivers/block/virtio_blk.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c +index 728c9a9609f0c..9a3c2b14ac378 100644 +--- a/drivers/block/virtio_blk.c ++++ b/drivers/block/virtio_blk.c +@@ -277,9 +277,14 @@ static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx, + if (err == -ENOSPC) + blk_mq_stop_hw_queue(hctx); + spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags); +- if (err == -ENOMEM || err == -ENOSPC) ++ switch (err) { ++ case -ENOSPC: + return BLK_STS_DEV_RESOURCE; +- return BLK_STS_IOERR; ++ case -ENOMEM: ++ return BLK_STS_RESOURCE; ++ default: ++ return BLK_STS_IOERR; ++ } + } + + if (bd->last && virtqueue_kick_prepare(vblk->vqs[qid].vq)) +-- +2.20.1 + diff --git a/queue-4.19/watchdog-reset-last_hw_keepalive-time-at-start.patch b/queue-4.19/watchdog-reset-last_hw_keepalive-time-at-start.patch new file mode 100644 index 00000000000..ee13f2708d5 --- /dev/null +++ b/queue-4.19/watchdog-reset-last_hw_keepalive-time-at-start.patch @@ -0,0 +1,42 @@ +From dc365f5368ea3e41f1e0c73b06fdac4b7c17a2d8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Mar 2020 11:58:06 +0200 +Subject: watchdog: reset last_hw_keepalive time at start + +From: Tero Kristo + +[ Upstream commit 982bb70517aef2225bad1d802887b733db492cc0 ] + +Currently the watchdog core does not initialize the last_hw_keepalive +time during watchdog startup. This will cause the watchdog to be pinged +immediately if enough time has passed from the system boot-up time, and +some types of watchdogs like K3 RTI does not like this. + +To avoid the issue, setup the last_hw_keepalive time during watchdog +startup. + +Signed-off-by: Tero Kristo +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/20200302200426.6492-3-t-kristo@ti.com +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/watchdog_dev.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c +index e64aa88e99dab..10b2090f3e5e7 100644 +--- a/drivers/watchdog/watchdog_dev.c ++++ b/drivers/watchdog/watchdog_dev.c +@@ -264,6 +264,7 @@ static int watchdog_start(struct watchdog_device *wdd) + if (err == 0) { + set_bit(WDOG_ACTIVE, &wdd->status); + wd_data->last_keepalive = started_at; ++ wd_data->last_hw_keepalive = started_at; + watchdog_update_worker(wdd); + } + +-- +2.20.1 + diff --git a/queue-4.19/xhci-ensure-link-state-is-u3-after-setting-usb_ss_po.patch b/queue-4.19/xhci-ensure-link-state-is-u3-after-setting-usb_ss_po.patch new file mode 100644 index 00000000000..4d78c273720 --- /dev/null +++ b/queue-4.19/xhci-ensure-link-state-is-u3-after-setting-usb_ss_po.patch @@ -0,0 +1,54 @@ +From 221abe063c1aa2f6c705a5ec016ceba0c8abea67 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Mar 2020 16:45:14 +0200 +Subject: xhci: Ensure link state is U3 after setting USB_SS_PORT_LS_U3 + +From: Kai-Heng Feng + +[ Upstream commit eb002726fac7cefb98ff39ddb89e150a1c24fe85 ] + +The xHCI spec doesn't specify the upper bound of U3 transition time. For +some devices 20ms is not enough, so we need to make sure the link state +is in U3 before further actions. + +I've tried to use U3 Entry Capability by setting U3 Entry Enable in +config register, however the port change event for U3 transition +interrupts the system suspend process. + +For now let's use the less ideal method by polling PLS. + +[use usleep_range(), and shorten the delay time while polling -Mathias] +Signed-off-by: Kai-Heng Feng +Signed-off-by: Mathias Nyman +Link: https://lore.kernel.org/r/20200312144517.1593-7-mathias.nyman@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/host/xhci-hub.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c +index a024230f00e2d..eb4284696f25c 100644 +--- a/drivers/usb/host/xhci-hub.c ++++ b/drivers/usb/host/xhci-hub.c +@@ -1266,7 +1266,16 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, + xhci_set_link_state(xhci, ports[wIndex], link_state); + + spin_unlock_irqrestore(&xhci->lock, flags); +- msleep(20); /* wait device to enter */ ++ if (link_state == USB_SS_PORT_LS_U3) { ++ int retries = 16; ++ ++ while (retries--) { ++ usleep_range(4000, 8000); ++ temp = readl(ports[wIndex]->addr); ++ if ((temp & PORT_PLS_MASK) == XDEV_U3) ++ break; ++ } ++ } + spin_lock_irqsave(&xhci->lock, flags); + + temp = readl(ports[wIndex]->addr); +-- +2.20.1 + -- 2.47.3