From b7c60acaf5e79630fd5d44a6340a04a1fc9a4983 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 4 May 2020 12:00:04 +0200 Subject: [PATCH] 4.19-stable patches added patches: alsa-hda-hdmi-fix-without-unlocked-before-return.patch alsa-hda-realtek-two-front-mics-on-a-lenovo-thinkcenter.patch alsa-pcm-oss-place-the-plugin-buffer-overflow-checks-correctly.patch alsa-usb-audio-correct-a-typo-of-nuprime-dac-10-usb-id.patch dm-multipath-use-updated-mpathf_queue_io-on-mapping-for-bio-based-mpath.patch dm-verity-fec-fix-hash-block-number-in-verity_fec_decode.patch dm-writecache-fix-data-corruption-when-reloading-the-target.patch pm-acpi-output-correct-message-on-target-power-state.patch pm-hibernate-freeze-kernel-threads-in-software_resume.patch --- ...i-fix-without-unlocked-before-return.patch | 41 ++++++ ...o-front-mics-on-a-lenovo-thinkcenter.patch | 33 +++++ ...gin-buffer-overflow-checks-correctly.patch | 92 +++++++++++++ ...rect-a-typo-of-nuprime-dac-10-usb-id.patch | 32 +++++ ...ue_io-on-mapping-for-bio-based-mpath.patch | 99 ++++++++++++++ ...sh-block-number-in-verity_fec_decode.patch | 35 +++++ ...corruption-when-reloading-the-target.patch | 129 ++++++++++++++++++ ...orrect-message-on-target-power-state.patch | 43 ++++++ ...ze-kernel-threads-in-software_resume.patch | 46 +++++++ queue-4.19/series | 9 ++ 10 files changed, 559 insertions(+) create mode 100644 queue-4.19/alsa-hda-hdmi-fix-without-unlocked-before-return.patch create mode 100644 queue-4.19/alsa-hda-realtek-two-front-mics-on-a-lenovo-thinkcenter.patch create mode 100644 queue-4.19/alsa-pcm-oss-place-the-plugin-buffer-overflow-checks-correctly.patch create mode 100644 queue-4.19/alsa-usb-audio-correct-a-typo-of-nuprime-dac-10-usb-id.patch create mode 100644 queue-4.19/dm-multipath-use-updated-mpathf_queue_io-on-mapping-for-bio-based-mpath.patch create mode 100644 queue-4.19/dm-verity-fec-fix-hash-block-number-in-verity_fec_decode.patch create mode 100644 queue-4.19/dm-writecache-fix-data-corruption-when-reloading-the-target.patch create mode 100644 queue-4.19/pm-acpi-output-correct-message-on-target-power-state.patch create mode 100644 queue-4.19/pm-hibernate-freeze-kernel-threads-in-software_resume.patch diff --git a/queue-4.19/alsa-hda-hdmi-fix-without-unlocked-before-return.patch b/queue-4.19/alsa-hda-hdmi-fix-without-unlocked-before-return.patch new file mode 100644 index 00000000000..6ebf6c9fedb --- /dev/null +++ b/queue-4.19/alsa-hda-hdmi-fix-without-unlocked-before-return.patch @@ -0,0 +1,41 @@ +From a2f647240998aa49632fb09b01388fdf2b87acfc Mon Sep 17 00:00:00 2001 +From: Wu Bo +Date: Sun, 26 Apr 2020 21:17:22 +0800 +Subject: ALSA: hda/hdmi: fix without unlocked before return + +From: Wu Bo + +commit a2f647240998aa49632fb09b01388fdf2b87acfc upstream. + +Fix the following coccicheck warning: +sound/pci/hda/patch_hdmi.c:1852:2-8: preceding lock on line 1846 + +After add sanity check to pass klockwork check, +The spdif_mutex should be unlock before return true +in check_non_pcm_per_cvt(). + +Fixes: 960a581e22d9 ("ALSA: hda: fix some klockwork scan warnings") +Signed-off-by: Wu Bo +Cc: +Link: https://lore.kernel.org/r/1587907042-694161-1-git-send-email-wubo40@huawei.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_hdmi.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/sound/pci/hda/patch_hdmi.c ++++ b/sound/pci/hda/patch_hdmi.c +@@ -1848,8 +1848,10 @@ static bool check_non_pcm_per_cvt(struct + /* Add sanity check to pass klockwork check. + * This should never happen. + */ +- if (WARN_ON(spdif == NULL)) ++ if (WARN_ON(spdif == NULL)) { ++ mutex_unlock(&codec->spdif_mutex); + return true; ++ } + non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO); + mutex_unlock(&codec->spdif_mutex); + return non_pcm; diff --git a/queue-4.19/alsa-hda-realtek-two-front-mics-on-a-lenovo-thinkcenter.patch b/queue-4.19/alsa-hda-realtek-two-front-mics-on-a-lenovo-thinkcenter.patch new file mode 100644 index 00000000000..de383542669 --- /dev/null +++ b/queue-4.19/alsa-hda-realtek-two-front-mics-on-a-lenovo-thinkcenter.patch @@ -0,0 +1,33 @@ +From ef0b3203c758b6b8abdb5dca651880347eae6b8c Mon Sep 17 00:00:00 2001 +From: Hui Wang +Date: Mon, 27 Apr 2020 11:00:39 +0800 +Subject: ALSA: hda/realtek - Two front mics on a Lenovo ThinkCenter + +From: Hui Wang + +commit ef0b3203c758b6b8abdb5dca651880347eae6b8c upstream. + +This new Lenovo ThinkCenter has two front mics which can't be handled +by PA so far, so apply the fixup ALC283_FIXUP_HEADSET_MIC to change +the location for one of the mics. + +Cc: +Signed-off-by: Hui Wang +Link: https://lore.kernel.org/r/20200427030039.10121-1-hui.wang@canonical.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_realtek.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6991,6 +6991,7 @@ static const struct snd_pci_quirk alc269 + SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC), + SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC), + SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS), ++ SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC), + SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), + SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), + SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), diff --git a/queue-4.19/alsa-pcm-oss-place-the-plugin-buffer-overflow-checks-correctly.patch b/queue-4.19/alsa-pcm-oss-place-the-plugin-buffer-overflow-checks-correctly.patch new file mode 100644 index 00000000000..570e214c7c5 --- /dev/null +++ b/queue-4.19/alsa-pcm-oss-place-the-plugin-buffer-overflow-checks-correctly.patch @@ -0,0 +1,92 @@ +From 4285de0725b1bf73608abbcd35ad7fd3ddc0b61e Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Fri, 24 Apr 2020 21:33:50 +0200 +Subject: ALSA: pcm: oss: Place the plugin buffer overflow checks correctly + +From: Takashi Iwai + +commit 4285de0725b1bf73608abbcd35ad7fd3ddc0b61e upstream. + +The checks of the plugin buffer overflow in the previous fix by commit + f2ecf903ef06 ("ALSA: pcm: oss: Avoid plugin buffer overflow") +are put in the wrong places mistakenly, which leads to the expected +(repeated) sound when the rate plugin is involved. Fix in the right +places. + +Also, at those right places, the zero check is needed for the +termination node, so added there as well, and let's get it done, +finally. + +Fixes: f2ecf903ef06 ("ALSA: pcm: oss: Avoid plugin buffer overflow") +Cc: +Link: https://lore.kernel.org/r/20200424193350.19678-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/core/oss/pcm_plugin.c | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +--- a/sound/core/oss/pcm_plugin.c ++++ b/sound/core/oss/pcm_plugin.c +@@ -211,21 +211,23 @@ static snd_pcm_sframes_t plug_client_siz + if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + plugin = snd_pcm_plug_last(plug); + while (plugin && drv_frames > 0) { +- if (check_size && drv_frames > plugin->buf_frames) +- drv_frames = plugin->buf_frames; + plugin_prev = plugin->prev; + if (plugin->src_frames) + drv_frames = plugin->src_frames(plugin, drv_frames); ++ if (check_size && plugin->buf_frames && ++ drv_frames > plugin->buf_frames) ++ drv_frames = plugin->buf_frames; + plugin = plugin_prev; + } + } else if (stream == SNDRV_PCM_STREAM_CAPTURE) { + plugin = snd_pcm_plug_first(plug); + while (plugin && drv_frames > 0) { + plugin_next = plugin->next; ++ if (check_size && plugin->buf_frames && ++ drv_frames > plugin->buf_frames) ++ drv_frames = plugin->buf_frames; + if (plugin->dst_frames) + drv_frames = plugin->dst_frames(plugin, drv_frames); +- if (check_size && drv_frames > plugin->buf_frames) +- drv_frames = plugin->buf_frames; + plugin = plugin_next; + } + } else +@@ -251,26 +253,28 @@ static snd_pcm_sframes_t plug_slave_size + plugin = snd_pcm_plug_first(plug); + while (plugin && frames > 0) { + plugin_next = plugin->next; ++ if (check_size && plugin->buf_frames && ++ frames > plugin->buf_frames) ++ frames = plugin->buf_frames; + if (plugin->dst_frames) { + frames = plugin->dst_frames(plugin, frames); + if (frames < 0) + return frames; + } +- if (check_size && frames > plugin->buf_frames) +- frames = plugin->buf_frames; + plugin = plugin_next; + } + } else if (stream == SNDRV_PCM_STREAM_CAPTURE) { + plugin = snd_pcm_plug_last(plug); + while (plugin) { +- if (check_size && frames > plugin->buf_frames) +- frames = plugin->buf_frames; + plugin_prev = plugin->prev; + if (plugin->src_frames) { + frames = plugin->src_frames(plugin, frames); + if (frames < 0) + return frames; + } ++ if (check_size && plugin->buf_frames && ++ frames > plugin->buf_frames) ++ frames = plugin->buf_frames; + plugin = plugin_prev; + } + } else diff --git a/queue-4.19/alsa-usb-audio-correct-a-typo-of-nuprime-dac-10-usb-id.patch b/queue-4.19/alsa-usb-audio-correct-a-typo-of-nuprime-dac-10-usb-id.patch new file mode 100644 index 00000000000..e92fcb2660b --- /dev/null +++ b/queue-4.19/alsa-usb-audio-correct-a-typo-of-nuprime-dac-10-usb-id.patch @@ -0,0 +1,32 @@ +From 547d2c9cf4f1f72adfecacbd5b093681fb0e8b3e Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 30 Apr 2020 14:47:55 +0200 +Subject: ALSA: usb-audio: Correct a typo of NuPrime DAC-10 USB ID + +From: Takashi Iwai + +commit 547d2c9cf4f1f72adfecacbd5b093681fb0e8b3e upstream. + +The USB vendor ID of NuPrime DAC-10 is not 16b0 but 16d0. + +Fixes: f656891c6619 ("ALSA: usb-audio: add more quirks for DSD interfaces") +Cc: +Link: https://lore.kernel.org/r/20200430124755.15940-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/quirks.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1385,7 +1385,7 @@ u64 snd_usb_interface_dsd_format_quirks( + + case USB_ID(0x0d8c, 0x0316): /* Hegel HD12 DSD */ + case USB_ID(0x10cb, 0x0103): /* The Bit Opus #3; with fp->dsd_raw */ +- case USB_ID(0x16b0, 0x06b2): /* NuPrime DAC-10 */ ++ case USB_ID(0x16d0, 0x06b2): /* NuPrime DAC-10 */ + case USB_ID(0x16d0, 0x09dd): /* Encore mDSD */ + case USB_ID(0x16d0, 0x0733): /* Furutech ADL Stratos */ + case USB_ID(0x16d0, 0x09db): /* NuPrime Audio DAC-9 */ diff --git a/queue-4.19/dm-multipath-use-updated-mpathf_queue_io-on-mapping-for-bio-based-mpath.patch b/queue-4.19/dm-multipath-use-updated-mpathf_queue_io-on-mapping-for-bio-based-mpath.patch new file mode 100644 index 00000000000..b3d9cea6e22 --- /dev/null +++ b/queue-4.19/dm-multipath-use-updated-mpathf_queue_io-on-mapping-for-bio-based-mpath.patch @@ -0,0 +1,99 @@ +From 5686dee34dbfe0238c0274e0454fa0174ac0a57a Mon Sep 17 00:00:00 2001 +From: Gabriel Krisman Bertazi +Date: Mon, 27 Apr 2020 20:39:11 -0400 +Subject: dm multipath: use updated MPATHF_QUEUE_IO on mapping for bio-based mpath + +From: Gabriel Krisman Bertazi + +commit 5686dee34dbfe0238c0274e0454fa0174ac0a57a upstream. + +When adding devices that don't have a scsi_dh on a BIO based multipath, +I was able to consistently hit the warning below and lock-up the system. + +The problem is that __map_bio reads the flag before it potentially being +modified by choose_pgpath, and ends up using the older value. + +The WARN_ON below is not trivially linked to the issue. It goes like +this: The activate_path delayed_work is not initialized for non-scsi_dh +devices, but we always set MPATHF_QUEUE_IO, asking for initialization. +That is fine, since MPATHF_QUEUE_IO would be cleared in choose_pgpath. +Nevertheless, only for BIO-based mpath, we cache the flag before calling +choose_pgpath, and use the older version when deciding if we should +initialize the path. Therefore, we end up trying to initialize the +paths, and calling the non-initialized activate_path work. + +[ 82.437100] ------------[ cut here ]------------ +[ 82.437659] WARNING: CPU: 3 PID: 602 at kernel/workqueue.c:1624 + __queue_delayed_work+0x71/0x90 +[ 82.438436] Modules linked in: +[ 82.438911] CPU: 3 PID: 602 Comm: systemd-udevd Not tainted 5.6.0-rc6+ #339 +[ 82.439680] RIP: 0010:__queue_delayed_work+0x71/0x90 +[ 82.440287] Code: c1 48 89 4a 50 81 ff 00 02 00 00 75 2a 4c 89 cf e9 +94 d6 07 00 e9 7f e9 ff ff 0f 0b eb c7 0f 0b 48 81 7a 58 40 74 a8 94 74 +a7 <0f> 0b 48 83 7a 48 00 74 a5 0f 0b eb a1 89 fe 4c 89 cf e9 c8 c4 07 +[ 82.441719] RSP: 0018:ffffb738803977c0 EFLAGS: 00010007 +[ 82.442121] RAX: ffffa086389f9740 RBX: 0000000000000002 RCX: 0000000000000000 +[ 82.442718] RDX: ffffa086350dd930 RSI: ffffa0863d76f600 RDI: 0000000000000200 +[ 82.443484] RBP: 0000000000000200 R08: 0000000000000000 R09: ffffa086350dd970 +[ 82.444128] R10: 0000000000000000 R11: 0000000000000000 R12: ffffa086350dd930 +[ 82.444773] R13: ffffa0863d76f600 R14: 0000000000000000 R15: ffffa08636738008 +[ 82.445427] FS: 00007f6abfe9dd40(0000) GS:ffffa0863dd80000(0000) knlGS:00000 +[ 82.446040] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 82.446478] CR2: 0000557d288db4e8 CR3: 0000000078b36000 CR4: 00000000000006e0 +[ 82.447104] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +[ 82.447561] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 +[ 82.448012] Call Trace: +[ 82.448164] queue_delayed_work_on+0x6d/0x80 +[ 82.448472] __pg_init_all_paths+0x7b/0xf0 +[ 82.448714] pg_init_all_paths+0x26/0x40 +[ 82.448980] __multipath_map_bio.isra.0+0x84/0x210 +[ 82.449267] __map_bio+0x3c/0x1f0 +[ 82.449468] __split_and_process_non_flush+0x14a/0x1b0 +[ 82.449775] __split_and_process_bio+0xde/0x340 +[ 82.450045] ? dm_get_live_table+0x5/0xb0 +[ 82.450278] dm_process_bio+0x98/0x290 +[ 82.450518] dm_make_request+0x54/0x120 +[ 82.450778] generic_make_request+0xd2/0x3e0 +[ 82.451038] ? submit_bio+0x3c/0x150 +[ 82.451278] submit_bio+0x3c/0x150 +[ 82.451492] mpage_readpages+0x129/0x160 +[ 82.451756] ? bdev_evict_inode+0x1d0/0x1d0 +[ 82.452033] read_pages+0x72/0x170 +[ 82.452260] __do_page_cache_readahead+0x1ba/0x1d0 +[ 82.452624] force_page_cache_readahead+0x96/0x110 +[ 82.452903] generic_file_read_iter+0x84f/0xae0 +[ 82.453192] ? __seccomp_filter+0x7c/0x670 +[ 82.453547] new_sync_read+0x10e/0x190 +[ 82.453883] vfs_read+0x9d/0x150 +[ 82.454172] ksys_read+0x65/0xe0 +[ 82.454466] do_syscall_64+0x4e/0x210 +[ 82.454828] entry_SYSCALL_64_after_hwframe+0x49/0xbe +[...] +[ 82.462501] ---[ end trace bb39975e9cf45daa ]--- + +Cc: stable@vger.kernel.org +Signed-off-by: Gabriel Krisman Bertazi +Signed-off-by: Mike Snitzer +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/dm-mpath.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/md/dm-mpath.c ++++ b/drivers/md/dm-mpath.c +@@ -586,10 +586,12 @@ static struct pgpath *__map_bio(struct m + + /* Do we need to select a new pgpath? */ + pgpath = READ_ONCE(m->current_pgpath); +- queue_io = test_bit(MPATHF_QUEUE_IO, &m->flags); +- if (!pgpath || !queue_io) ++ if (!pgpath || !test_bit(MPATHF_QUEUE_IO, &m->flags)) + pgpath = choose_pgpath(m, bio->bi_iter.bi_size); + ++ /* MPATHF_QUEUE_IO might have been cleared by choose_pgpath. */ ++ queue_io = test_bit(MPATHF_QUEUE_IO, &m->flags); ++ + if ((pgpath && queue_io) || + (!pgpath && test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))) { + /* Queue for the daemon to resubmit */ diff --git a/queue-4.19/dm-verity-fec-fix-hash-block-number-in-verity_fec_decode.patch b/queue-4.19/dm-verity-fec-fix-hash-block-number-in-verity_fec_decode.patch new file mode 100644 index 00000000000..6877e8ac877 --- /dev/null +++ b/queue-4.19/dm-verity-fec-fix-hash-block-number-in-verity_fec_decode.patch @@ -0,0 +1,35 @@ +From ad4e80a639fc61d5ecebb03caa5cdbfb91fcebfc Mon Sep 17 00:00:00 2001 +From: Sunwook Eom +Date: Fri, 10 Apr 2020 12:54:19 +0900 +Subject: dm verity fec: fix hash block number in verity_fec_decode + +From: Sunwook Eom + +commit ad4e80a639fc61d5ecebb03caa5cdbfb91fcebfc upstream. + +The error correction data is computed as if data and hash blocks +were concatenated. But hash block number starts from v->hash_start. +So, we have to calculate hash block number based on that. + +Fixes: a739ff3f543af ("dm verity: add support for forward error correction") +Cc: stable@vger.kernel.org +Signed-off-by: Sunwook Eom +Reviewed-by: Sami Tolvanen +Signed-off-by: Mike Snitzer +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/dm-verity-fec.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/md/dm-verity-fec.c ++++ b/drivers/md/dm-verity-fec.c +@@ -436,7 +436,7 @@ int verity_fec_decode(struct dm_verity * + fio->level++; + + if (type == DM_VERITY_BLOCK_TYPE_METADATA) +- block += v->data_blocks; ++ block = block - v->hash_start + v->data_blocks; + + /* + * For RS(M, N), the continuous FEC data is divided into blocks of N diff --git a/queue-4.19/dm-writecache-fix-data-corruption-when-reloading-the-target.patch b/queue-4.19/dm-writecache-fix-data-corruption-when-reloading-the-target.patch new file mode 100644 index 00000000000..5422ccf9977 --- /dev/null +++ b/queue-4.19/dm-writecache-fix-data-corruption-when-reloading-the-target.patch @@ -0,0 +1,129 @@ +From 31b22120194b5c0d460f59e0c98504de1d3f1f14 Mon Sep 17 00:00:00 2001 +From: Mikulas Patocka +Date: Wed, 15 Apr 2020 11:01:38 -0400 +Subject: dm writecache: fix data corruption when reloading the target + +From: Mikulas Patocka + +commit 31b22120194b5c0d460f59e0c98504de1d3f1f14 upstream. + +The dm-writecache reads metadata in the target constructor. However, when +we reload the target, there could be another active instance running on +the same device. This is the sequence of operations when doing a reload: + +1. construct new target +2. suspend old target +3. resume new target +4. destroy old target + +Metadata that were written by the old target between steps 1 and 2 would +not be visible by the new target. + +Fix the data corruption by loading the metadata in the resume handler. + +Also, validate block_size is at least as large as both the devices' +logical block size and only read 1 block from the metadata during +target constructor -- no need to read entirety of metadata now that it +is done during resume. + +Fixes: 48debafe4f2f ("dm: add writecache target") +Cc: stable@vger.kernel.org # v4.18+ +Signed-off-by: Mikulas Patocka +Signed-off-by: Mike Snitzer +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/dm-writecache.c | 52 ++++++++++++++++++++++++++++++++------------- + 1 file changed, 37 insertions(+), 15 deletions(-) + +--- a/drivers/md/dm-writecache.c ++++ b/drivers/md/dm-writecache.c +@@ -884,6 +884,24 @@ static int writecache_alloc_entries(stru + return 0; + } + ++static int writecache_read_metadata(struct dm_writecache *wc, sector_t n_sectors) ++{ ++ struct dm_io_region region; ++ struct dm_io_request req; ++ ++ region.bdev = wc->ssd_dev->bdev; ++ region.sector = wc->start_sector; ++ region.count = n_sectors; ++ req.bi_op = REQ_OP_READ; ++ req.bi_op_flags = REQ_SYNC; ++ req.mem.type = DM_IO_VMA; ++ req.mem.ptr.vma = (char *)wc->memory_map; ++ req.client = wc->dm_io; ++ req.notify.fn = NULL; ++ ++ return dm_io(&req, 1, ®ion, NULL); ++} ++ + static void writecache_resume(struct dm_target *ti) + { + struct dm_writecache *wc = ti->private; +@@ -894,8 +912,18 @@ static void writecache_resume(struct dm_ + + wc_lock(wc); + +- if (WC_MODE_PMEM(wc)) ++ if (WC_MODE_PMEM(wc)) { + persistent_memory_invalidate_cache(wc->memory_map, wc->memory_map_size); ++ } else { ++ r = writecache_read_metadata(wc, wc->metadata_sectors); ++ if (r) { ++ size_t sb_entries_offset; ++ writecache_error(wc, r, "unable to read metadata: %d", r); ++ sb_entries_offset = offsetof(struct wc_memory_superblock, entries); ++ memset((char *)wc->memory_map + sb_entries_offset, -1, ++ (wc->metadata_sectors << SECTOR_SHIFT) - sb_entries_offset); ++ } ++ } + + wc->tree = RB_ROOT; + INIT_LIST_HEAD(&wc->lru); +@@ -1978,6 +2006,12 @@ static int writecache_ctr(struct dm_targ + ti->error = "Invalid block size"; + goto bad; + } ++ if (wc->block_size < bdev_logical_block_size(wc->dev->bdev) || ++ wc->block_size < bdev_logical_block_size(wc->ssd_dev->bdev)) { ++ r = -EINVAL; ++ ti->error = "Block size is smaller than device logical block size"; ++ goto bad; ++ } + wc->block_size_bits = __ffs(wc->block_size); + + wc->max_writeback_jobs = MAX_WRITEBACK_JOBS; +@@ -2066,8 +2100,6 @@ invalid_optional: + goto bad; + } + } else { +- struct dm_io_region region; +- struct dm_io_request req; + size_t n_blocks, n_metadata_blocks; + uint64_t n_bitmap_bits; + +@@ -2124,19 +2156,9 @@ invalid_optional: + goto bad; + } + +- region.bdev = wc->ssd_dev->bdev; +- region.sector = wc->start_sector; +- region.count = wc->metadata_sectors; +- req.bi_op = REQ_OP_READ; +- req.bi_op_flags = REQ_SYNC; +- req.mem.type = DM_IO_VMA; +- req.mem.ptr.vma = (char *)wc->memory_map; +- req.client = wc->dm_io; +- req.notify.fn = NULL; +- +- r = dm_io(&req, 1, ®ion, NULL); ++ r = writecache_read_metadata(wc, wc->block_size >> SECTOR_SHIFT); + if (r) { +- ti->error = "Unable to read metadata"; ++ ti->error = "Unable to read first block of metadata"; + goto bad; + } + } diff --git a/queue-4.19/pm-acpi-output-correct-message-on-target-power-state.patch b/queue-4.19/pm-acpi-output-correct-message-on-target-power-state.patch new file mode 100644 index 00000000000..30828f80afe --- /dev/null +++ b/queue-4.19/pm-acpi-output-correct-message-on-target-power-state.patch @@ -0,0 +1,43 @@ +From a9b760b0266f563b4784f695bbd0e717610dc10a Mon Sep 17 00:00:00 2001 +From: Kai-Heng Feng +Date: Tue, 21 Apr 2020 15:55:16 +0800 +Subject: PM: ACPI: Output correct message on target power state + +From: Kai-Heng Feng + +commit a9b760b0266f563b4784f695bbd0e717610dc10a upstream. + +Transitioned power state logged at the end of setting ACPI power. + +However, D3cold won't be in the message because state can only be +D3hot at most. + +Use target_state to corretly report when power state is D3cold. + +Cc: All applicable +Signed-off-by: Kai-Heng Feng +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/device_pm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/acpi/device_pm.c ++++ b/drivers/acpi/device_pm.c +@@ -227,13 +227,13 @@ int acpi_device_set_power(struct acpi_de + end: + if (result) { + dev_warn(&device->dev, "Failed to change power state to %s\n", +- acpi_power_state_string(state)); ++ acpi_power_state_string(target_state)); + } else { + device->power.state = target_state; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Device [%s] transitioned to %s\n", + device->pnp.bus_id, +- acpi_power_state_string(state))); ++ acpi_power_state_string(target_state))); + } + + return result; diff --git a/queue-4.19/pm-hibernate-freeze-kernel-threads-in-software_resume.patch b/queue-4.19/pm-hibernate-freeze-kernel-threads-in-software_resume.patch new file mode 100644 index 00000000000..e2fef5b1b4f --- /dev/null +++ b/queue-4.19/pm-hibernate-freeze-kernel-threads-in-software_resume.patch @@ -0,0 +1,46 @@ +From 2351f8d295ed63393190e39c2f7c1fee1a80578f Mon Sep 17 00:00:00 2001 +From: Dexuan Cui +Date: Thu, 23 Apr 2020 20:40:16 -0700 +Subject: PM: hibernate: Freeze kernel threads in software_resume() + +From: Dexuan Cui + +commit 2351f8d295ed63393190e39c2f7c1fee1a80578f upstream. + +Currently the kernel threads are not frozen in software_resume(), so +between dpm_suspend_start(PMSG_QUIESCE) and resume_target_kernel(), +system_freezable_power_efficient_wq can still try to submit SCSI +commands and this can cause a panic since the low level SCSI driver +(e.g. hv_storvsc) has quiesced the SCSI adapter and can not accept +any SCSI commands: https://lkml.org/lkml/2020/4/10/47 + +At first I posted a fix (https://lkml.org/lkml/2020/4/21/1318) trying +to resolve the issue from hv_storvsc, but with the help of +Bart Van Assche, I realized it's better to fix software_resume(), +since this looks like a generic issue, not only pertaining to SCSI. + +Cc: All applicable +Signed-off-by: Dexuan Cui +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/power/hibernate.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/kernel/power/hibernate.c ++++ b/kernel/power/hibernate.c +@@ -901,6 +901,13 @@ static int software_resume(void) + error = freeze_processes(); + if (error) + goto Close_Finish; ++ ++ error = freeze_kernel_threads(); ++ if (error) { ++ thaw_processes(); ++ goto Close_Finish; ++ } ++ + error = load_image_and_restore(); + thaw_processes(); + Finish: diff --git a/queue-4.19/series b/queue-4.19/series index 63f604fb124..db7c972bd02 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -3,6 +3,15 @@ drm-qxl-qxl_release-leak-in-qxl_draw_dirty_fb.patch drm-qxl-qxl_release-leak-in-qxl_hw_surface_alloc.patch drm-qxl-qxl_release-use-after-free.patch btrfs-fix-block-group-leak-when-removing-fails.patch +alsa-hda-realtek-two-front-mics-on-a-lenovo-thinkcenter.patch +alsa-usb-audio-correct-a-typo-of-nuprime-dac-10-usb-id.patch +alsa-hda-hdmi-fix-without-unlocked-before-return.patch +alsa-pcm-oss-place-the-plugin-buffer-overflow-checks-correctly.patch +pm-acpi-output-correct-message-on-target-power-state.patch +pm-hibernate-freeze-kernel-threads-in-software_resume.patch +dm-verity-fec-fix-hash-block-number-in-verity_fec_decode.patch +dm-writecache-fix-data-corruption-when-reloading-the-target.patch +dm-multipath-use-updated-mpathf_queue_io-on-mapping-for-bio-based-mpath.patch btrfs-fix-partial-loss-of-prealloc-extent-past-i_size-after-fsync.patch btrfs-transaction-avoid-deadlock-due-to-bad-initialization-timing-of-fs_info-journal_info.patch mmc-cqhci-avoid-false-cqhci-cqe-stuck-on-by-not-open-coding-timeout-loop.patch -- 2.47.3