]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jul 2019 15:24:55 +0000 (17:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jul 2019 15:24:55 +0000 (17:24 +0200)
added patches:
clk-socfpga-stratix10-fix-divider-entry-for-the-emac-clocks.patch
dm-log-writes-make-sure-super-sector-log-updates-are-written-in-order.patch
mm-hugetlb-soft-offline-dissolve_free_huge_page-return-zero-on-pagehuge.patch
mm-page_idle.c-fix-oops-because-end_pfn-is-larger-than-max_pfn.patch
mm-soft-offline-return-ebusy-if-set_hwpoison_free_buddy_page-fails.patch
scsi-vmw_pscsi-fix-use-after-free-in-pvscsi_queue_lck.patch

queue-4.19/clk-socfpga-stratix10-fix-divider-entry-for-the-emac-clocks.patch [new file with mode: 0644]
queue-4.19/dm-log-writes-make-sure-super-sector-log-updates-are-written-in-order.patch [new file with mode: 0644]
queue-4.19/mm-hugetlb-soft-offline-dissolve_free_huge_page-return-zero-on-pagehuge.patch [new file with mode: 0644]
queue-4.19/mm-page_idle.c-fix-oops-because-end_pfn-is-larger-than-max_pfn.patch [new file with mode: 0644]
queue-4.19/mm-soft-offline-return-ebusy-if-set_hwpoison_free_buddy_page-fails.patch [new file with mode: 0644]
queue-4.19/scsi-vmw_pscsi-fix-use-after-free-in-pvscsi_queue_lck.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/clk-socfpga-stratix10-fix-divider-entry-for-the-emac-clocks.patch b/queue-4.19/clk-socfpga-stratix10-fix-divider-entry-for-the-emac-clocks.patch
new file mode 100644 (file)
index 0000000..95de1a3
--- /dev/null
@@ -0,0 +1,34 @@
+From 74684cce5ebd567b01e9bc0e9a1945c70a32f32f Mon Sep 17 00:00:00 2001
+From: Dinh Nguyen <dinguyen@kernel.org>
+Date: Fri, 7 Jun 2019 10:12:46 -0500
+Subject: clk: socfpga: stratix10: fix divider entry for the emac clocks
+
+From: Dinh Nguyen <dinguyen@kernel.org>
+
+commit 74684cce5ebd567b01e9bc0e9a1945c70a32f32f upstream.
+
+The fixed dividers for the emac clocks should be 2 not 4.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
+Signed-off-by: Stephen Boyd <sboyd@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/clk/socfpga/clk-s10.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/clk/socfpga/clk-s10.c
++++ b/drivers/clk/socfpga/clk-s10.c
+@@ -103,9 +103,9 @@ static const struct stratix10_perip_cnt_
+       { STRATIX10_NOC_CLK, "noc_clk", NULL, noc_mux, ARRAY_SIZE(noc_mux),
+         0, 0, 0, 0x3C, 1},
+       { STRATIX10_EMAC_A_FREE_CLK, "emaca_free_clk", NULL, emaca_free_mux, ARRAY_SIZE(emaca_free_mux),
+-        0, 0, 4, 0xB0, 0},
++        0, 0, 2, 0xB0, 0},
+       { STRATIX10_EMAC_B_FREE_CLK, "emacb_free_clk", NULL, emacb_free_mux, ARRAY_SIZE(emacb_free_mux),
+-        0, 0, 4, 0xB0, 1},
++        0, 0, 2, 0xB0, 1},
+       { STRATIX10_EMAC_PTP_FREE_CLK, "emac_ptp_free_clk", NULL, emac_ptp_free_mux,
+         ARRAY_SIZE(emac_ptp_free_mux), 0, 0, 4, 0xB0, 2},
+       { STRATIX10_GPIO_DB_FREE_CLK, "gpio_db_free_clk", NULL, gpio_db_free_mux,
diff --git a/queue-4.19/dm-log-writes-make-sure-super-sector-log-updates-are-written-in-order.patch b/queue-4.19/dm-log-writes-make-sure-super-sector-log-updates-are-written-in-order.patch
new file mode 100644 (file)
index 0000000..babfd7f
--- /dev/null
@@ -0,0 +1,106 @@
+From 211ad4b733037f66f9be0a79eade3da7ab11cbb8 Mon Sep 17 00:00:00 2001
+From: "zhangyi (F)" <yi.zhang@huawei.com>
+Date: Wed, 5 Jun 2019 21:27:08 +0800
+Subject: dm log writes: make sure super sector log updates are written in order
+
+From: zhangyi (F) <yi.zhang@huawei.com>
+
+commit 211ad4b733037f66f9be0a79eade3da7ab11cbb8 upstream.
+
+Currently, although we submit super bios in order (and super.nr_entries
+is incremented by each logged entry), submit_bio() is async so each
+super sector may not be written to log device in order and then the
+final nr_entries may be smaller than it should be.
+
+This problem can be reproduced by the xfstests generic/455 with ext4:
+
+  QA output created by 455
+ -Silence is golden
+ +mark 'end' does not exist
+
+Fix this by serializing submission of super sectors to make sure each
+is written to the log disk in order.
+
+Fixes: 0e9cebe724597 ("dm: add log writes target")
+Cc: stable@vger.kernel.org
+Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
+Suggested-by: Josef Bacik <josef@toxicpanda.com>
+Reviewed-by: Josef Bacik <josef@toxicpanda.com>
+Signed-off-by: Mike Snitzer <snitzer@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/md/dm-log-writes.c |   23 +++++++++++++++++++++--
+ 1 file changed, 21 insertions(+), 2 deletions(-)
+
+--- a/drivers/md/dm-log-writes.c
++++ b/drivers/md/dm-log-writes.c
+@@ -60,6 +60,7 @@
+ #define WRITE_LOG_VERSION 1ULL
+ #define WRITE_LOG_MAGIC 0x6a736677736872ULL
++#define WRITE_LOG_SUPER_SECTOR 0
+ /*
+  * The disk format for this is braindead simple.
+@@ -115,6 +116,7 @@ struct log_writes_c {
+       struct list_head logging_blocks;
+       wait_queue_head_t wait;
+       struct task_struct *log_kthread;
++      struct completion super_done;
+ };
+ struct pending_block {
+@@ -180,6 +182,14 @@ static void log_end_io(struct bio *bio)
+       bio_put(bio);
+ }
++static void log_end_super(struct bio *bio)
++{
++      struct log_writes_c *lc = bio->bi_private;
++
++      complete(&lc->super_done);
++      log_end_io(bio);
++}
++
+ /*
+  * Meant to be called if there is an error, it will free all the pages
+  * associated with the block.
+@@ -215,7 +225,8 @@ static int write_metadata(struct log_wri
+       bio->bi_iter.bi_size = 0;
+       bio->bi_iter.bi_sector = sector;
+       bio_set_dev(bio, lc->logdev->bdev);
+-      bio->bi_end_io = log_end_io;
++      bio->bi_end_io = (sector == WRITE_LOG_SUPER_SECTOR) ?
++                        log_end_super : log_end_io;
+       bio->bi_private = lc;
+       bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
+@@ -418,11 +429,18 @@ static int log_super(struct log_writes_c
+       super.nr_entries = cpu_to_le64(lc->logged_entries);
+       super.sectorsize = cpu_to_le32(lc->sectorsize);
+-      if (write_metadata(lc, &super, sizeof(super), NULL, 0, 0)) {
++      if (write_metadata(lc, &super, sizeof(super), NULL, 0,
++                         WRITE_LOG_SUPER_SECTOR)) {
+               DMERR("Couldn't write super");
+               return -1;
+       }
++      /*
++       * Super sector should be writen in-order, otherwise the
++       * nr_entries could be rewritten incorrectly by an old bio.
++       */
++      wait_for_completion_io(&lc->super_done);
++
+       return 0;
+ }
+@@ -531,6 +549,7 @@ static int log_writes_ctr(struct dm_targ
+       INIT_LIST_HEAD(&lc->unflushed_blocks);
+       INIT_LIST_HEAD(&lc->logging_blocks);
+       init_waitqueue_head(&lc->wait);
++      init_completion(&lc->super_done);
+       atomic_set(&lc->io_blocks, 0);
+       atomic_set(&lc->pending_blocks, 0);
diff --git a/queue-4.19/mm-hugetlb-soft-offline-dissolve_free_huge_page-return-zero-on-pagehuge.patch b/queue-4.19/mm-hugetlb-soft-offline-dissolve_free_huge_page-return-zero-on-pagehuge.patch
new file mode 100644 (file)
index 0000000..5a9ebef
--- /dev/null
@@ -0,0 +1,133 @@
+From faf53def3b143df11062d87c12afe6afeb6f8cc7 Mon Sep 17 00:00:00 2001
+From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+Date: Fri, 28 Jun 2019 12:06:56 -0700
+Subject: mm: hugetlb: soft-offline: dissolve_free_huge_page() return zero on !PageHuge
+
+From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+
+commit faf53def3b143df11062d87c12afe6afeb6f8cc7 upstream.
+
+madvise(MADV_SOFT_OFFLINE) often returns -EBUSY when calling soft offline
+for hugepages with overcommitting enabled.  That was caused by the
+suboptimal code in current soft-offline code.  See the following part:
+
+    ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL,
+                            MIGRATE_SYNC, MR_MEMORY_FAILURE);
+    if (ret) {
+            ...
+    } else {
+            /*
+             * We set PG_hwpoison only when the migration source hugepage
+             * was successfully dissolved, because otherwise hwpoisoned
+             * hugepage remains on free hugepage list, then userspace will
+             * find it as SIGBUS by allocation failure. That's not expected
+             * in soft-offlining.
+             */
+            ret = dissolve_free_huge_page(page);
+            if (!ret) {
+                    if (set_hwpoison_free_buddy_page(page))
+                            num_poisoned_pages_inc();
+            }
+    }
+    return ret;
+
+Here dissolve_free_huge_page() returns -EBUSY if the migration source page
+was freed into buddy in migrate_pages(), but even in that case we actually
+has a chance that set_hwpoison_free_buddy_page() succeeds.  So that means
+current code gives up offlining too early now.
+
+dissolve_free_huge_page() checks that a given hugepage is suitable for
+dissolving, where we should return success for !PageHuge() case because
+the given hugepage is considered as already dissolved.
+
+This change also affects other callers of dissolve_free_huge_page(), which
+are cleaned up together.
+
+[n-horiguchi@ah.jp.nec.com: v3]
+  Link: http://lkml.kernel.org/r/1560761476-4651-3-git-send-email-n-horiguchi@ah.jp.nec.comLink: http://lkml.kernel.org/r/1560154686-18497-3-git-send-email-n-horiguchi@ah.jp.nec.com
+Fixes: 6bc9b56433b76 ("mm: fix race on soft-offlining")
+Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+Reported-by: Chen, Jerry T <jerry.t.chen@intel.com>
+Tested-by: Chen, Jerry T <jerry.t.chen@intel.com>
+Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
+Reviewed-by: Oscar Salvador <osalvador@suse.de>
+Cc: Michal Hocko <mhocko@kernel.org>
+Cc: Xishi Qiu <xishi.qiuxishi@alibaba-inc.com>
+Cc: "Chen, Jerry T" <jerry.t.chen@intel.com>
+Cc: "Zhuo, Qiuxu" <qiuxu.zhuo@intel.com>
+Cc: <stable@vger.kernel.org>   [4.19+]
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/hugetlb.c        |   29 ++++++++++++++++++++---------
+ mm/memory-failure.c |    5 +----
+ 2 files changed, 21 insertions(+), 13 deletions(-)
+
+--- a/mm/hugetlb.c
++++ b/mm/hugetlb.c
+@@ -1489,16 +1489,29 @@ static int free_pool_huge_page(struct hs
+ /*
+  * Dissolve a given free hugepage into free buddy pages. This function does
+- * nothing for in-use (including surplus) hugepages. Returns -EBUSY if the
+- * dissolution fails because a give page is not a free hugepage, or because
+- * free hugepages are fully reserved.
++ * nothing for in-use hugepages and non-hugepages.
++ * This function returns values like below:
++ *
++ *  -EBUSY: failed to dissolved free hugepages or the hugepage is in-use
++ *          (allocated or reserved.)
++ *       0: successfully dissolved free hugepages or the page is not a
++ *          hugepage (considered as already dissolved)
+  */
+ int dissolve_free_huge_page(struct page *page)
+ {
+       int rc = -EBUSY;
++      /* Not to disrupt normal path by vainly holding hugetlb_lock */
++      if (!PageHuge(page))
++              return 0;
++
+       spin_lock(&hugetlb_lock);
+-      if (PageHuge(page) && !page_count(page)) {
++      if (!PageHuge(page)) {
++              rc = 0;
++              goto out;
++      }
++
++      if (!page_count(page)) {
+               struct page *head = compound_head(page);
+               struct hstate *h = page_hstate(head);
+               int nid = page_to_nid(head);
+@@ -1543,11 +1556,9 @@ int dissolve_free_huge_pages(unsigned lo
+       for (pfn = start_pfn; pfn < end_pfn; pfn += 1 << minimum_order) {
+               page = pfn_to_page(pfn);
+-              if (PageHuge(page) && !page_count(page)) {
+-                      rc = dissolve_free_huge_page(page);
+-                      if (rc)
+-                              break;
+-              }
++              rc = dissolve_free_huge_page(page);
++              if (rc)
++                      break;
+       }
+       return rc;
+--- a/mm/memory-failure.c
++++ b/mm/memory-failure.c
+@@ -1857,11 +1857,8 @@ static int soft_offline_in_use_page(stru
+ static int soft_offline_free_page(struct page *page)
+ {
+-      int rc = 0;
+-      struct page *head = compound_head(page);
++      int rc = dissolve_free_huge_page(page);
+-      if (PageHuge(head))
+-              rc = dissolve_free_huge_page(page);
+       if (!rc) {
+               if (set_hwpoison_free_buddy_page(page))
+                       num_poisoned_pages_inc();
diff --git a/queue-4.19/mm-page_idle.c-fix-oops-because-end_pfn-is-larger-than-max_pfn.patch b/queue-4.19/mm-page_idle.c-fix-oops-because-end_pfn-is-larger-than-max_pfn.patch
new file mode 100644 (file)
index 0000000..ce10994
--- /dev/null
@@ -0,0 +1,85 @@
+From 7298e3b0a149c91323b3205d325e942c3b3b9ef6 Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.king@canonical.com>
+Date: Fri, 28 Jun 2019 12:07:05 -0700
+Subject: mm/page_idle.c: fix oops because end_pfn is larger than max_pfn
+
+From: Colin Ian King <colin.king@canonical.com>
+
+commit 7298e3b0a149c91323b3205d325e942c3b3b9ef6 upstream.
+
+Currently the calcuation of end_pfn can round up the pfn number to more
+than the actual maximum number of pfns, causing an Oops.  Fix this by
+ensuring end_pfn is never more than max_pfn.
+
+This can be easily triggered when on systems where the end_pfn gets
+rounded up to more than max_pfn using the idle-page stress-ng stress test:
+
+sudo stress-ng --idle-page 0
+
+  BUG: unable to handle kernel paging request at 00000000000020d8
+  #PF error: [normal kernel read fault]
+  PGD 0 P4D 0
+  Oops: 0000 [#1] SMP PTI
+  CPU: 1 PID: 11039 Comm: stress-ng-idle- Not tainted 5.0.0-5-generic #6-Ubuntu
+  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
+  RIP: 0010:page_idle_get_page+0xc8/0x1a0
+  Code: 0f b1 0a 75 7d 48 8b 03 48 89 c2 48 c1 e8 33 83 e0 07 48 c1 ea 36 48 8d 0c 40 4c 8d 24 88 49 c1 e4 07 4c 03 24 d5 00 89 c3 be <49> 8b 44 24 58 48 8d b8 80 a1 02 00 e8 07 d5 77 00 48 8b 53 08 48
+  RSP: 0018:ffffafd7c672fde8 EFLAGS: 00010202
+  RAX: 0000000000000005 RBX: ffffe36341fff700 RCX: 000000000000000f
+  RDX: 0000000000000284 RSI: 0000000000000275 RDI: 0000000001fff700
+  RBP: ffffafd7c672fe00 R08: ffffa0bc34056410 R09: 0000000000000276
+  R10: ffffa0bc754e9b40 R11: ffffa0bc330f6400 R12: 0000000000002080
+  R13: ffffe36341fff700 R14: 0000000000080000 R15: ffffa0bc330f6400
+  FS: 00007f0ec1ea5740(0000) GS:ffffa0bc7db00000(0000) knlGS:0000000000000000
+  CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+  CR2: 00000000000020d8 CR3: 0000000077d68000 CR4: 00000000000006e0
+  Call Trace:
+    page_idle_bitmap_write+0x8c/0x140
+    sysfs_kf_bin_write+0x5c/0x70
+    kernfs_fop_write+0x12e/0x1b0
+    __vfs_write+0x1b/0x40
+    vfs_write+0xab/0x1b0
+    ksys_write+0x55/0xc0
+    __x64_sys_write+0x1a/0x20
+    do_syscall_64+0x5a/0x110
+    entry_SYSCALL_64_after_hwframe+0x44/0xa9
+
+Link: http://lkml.kernel.org/r/20190618124352.28307-1-colin.king@canonical.com
+Fixes: 33c3fc71c8cf ("mm: introduce idle page tracking")
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
+Acked-by: Vladimir Davydov <vdavydov.dev@gmail.com>
+Cc: Michal Hocko <mhocko@suse.com>
+Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
+Cc: Mel Gorman <mgorman@techsingularity.net>
+Cc: Stephen Rothwell <sfr@canb.auug.org.au>
+Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/page_idle.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/mm/page_idle.c
++++ b/mm/page_idle.c
+@@ -136,7 +136,7 @@ static ssize_t page_idle_bitmap_read(str
+       end_pfn = pfn + count * BITS_PER_BYTE;
+       if (end_pfn > max_pfn)
+-              end_pfn = ALIGN(max_pfn, BITMAP_CHUNK_BITS);
++              end_pfn = max_pfn;
+       for (; pfn < end_pfn; pfn++) {
+               bit = pfn % BITMAP_CHUNK_BITS;
+@@ -181,7 +181,7 @@ static ssize_t page_idle_bitmap_write(st
+       end_pfn = pfn + count * BITS_PER_BYTE;
+       if (end_pfn > max_pfn)
+-              end_pfn = ALIGN(max_pfn, BITMAP_CHUNK_BITS);
++              end_pfn = max_pfn;
+       for (; pfn < end_pfn; pfn++) {
+               bit = pfn % BITMAP_CHUNK_BITS;
diff --git a/queue-4.19/mm-soft-offline-return-ebusy-if-set_hwpoison_free_buddy_page-fails.patch b/queue-4.19/mm-soft-offline-return-ebusy-if-set_hwpoison_free_buddy_page-fails.patch
new file mode 100644 (file)
index 0000000..0de9a46
--- /dev/null
@@ -0,0 +1,47 @@
+From b38e5962f8ed0d2a2b28a887fc2221f7f41db119 Mon Sep 17 00:00:00 2001
+From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+Date: Fri, 28 Jun 2019 12:06:53 -0700
+Subject: mm: soft-offline: return -EBUSY if set_hwpoison_free_buddy_page() fails
+
+From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+
+commit b38e5962f8ed0d2a2b28a887fc2221f7f41db119 upstream.
+
+The pass/fail of soft offline should be judged by checking whether the
+raw error page was finally contained or not (i.e.  the result of
+set_hwpoison_free_buddy_page()), but current code do not work like
+that.  It might lead us to misjudge the test result when
+set_hwpoison_free_buddy_page() fails.
+
+Without this fix, there are cases where madvise(MADV_SOFT_OFFLINE) may
+not offline the original page and will not return an error.
+
+Link: http://lkml.kernel.org/r/1560154686-18497-2-git-send-email-n-horiguchi@ah.jp.nec.com
+Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+Fixes: 6bc9b56433b76 ("mm: fix race on soft-offlining")
+Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
+Reviewed-by: Oscar Salvador <osalvador@suse.de>
+Cc: Michal Hocko <mhocko@kernel.org>
+Cc: Xishi Qiu <xishi.qiuxishi@alibaba-inc.com>
+Cc: "Chen, Jerry T" <jerry.t.chen@intel.com>
+Cc: "Zhuo, Qiuxu" <qiuxu.zhuo@intel.com>
+Cc: <stable@vger.kernel.org>   [4.19+]
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/memory-failure.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/mm/memory-failure.c
++++ b/mm/memory-failure.c
+@@ -1731,6 +1731,8 @@ static int soft_offline_huge_page(struct
+               if (!ret) {
+                       if (set_hwpoison_free_buddy_page(page))
+                               num_poisoned_pages_inc();
++                      else
++                              ret = -EBUSY;
+               }
+       }
+       return ret;
diff --git a/queue-4.19/scsi-vmw_pscsi-fix-use-after-free-in-pvscsi_queue_lck.patch b/queue-4.19/scsi-vmw_pscsi-fix-use-after-free-in-pvscsi_queue_lck.patch
new file mode 100644 (file)
index 0000000..0cbc089
--- /dev/null
@@ -0,0 +1,52 @@
+From 240b4cc8fd5db138b675297d4226ec46594d9b3b Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Wed, 19 Jun 2019 09:05:41 +0200
+Subject: scsi: vmw_pscsi: Fix use-after-free in pvscsi_queue_lck()
+
+From: Jan Kara <jack@suse.cz>
+
+commit 240b4cc8fd5db138b675297d4226ec46594d9b3b upstream.
+
+Once we unlock adapter->hw_lock in pvscsi_queue_lck() nothing prevents just
+queued scsi_cmnd from completing and freeing the request. Thus cmd->cmnd[0]
+dereference can dereference already freed request leading to kernel crashes
+or other issues (which one of our customers observed). Store cmd->cmnd[0]
+in a local variable before unlocking adapter->hw_lock to fix the issue.
+
+CC: <stable@vger.kernel.org>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Reviewed-by: Ewan D. Milne <emilne@redhat.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/vmw_pvscsi.c |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/scsi/vmw_pvscsi.c
++++ b/drivers/scsi/vmw_pvscsi.c
+@@ -763,6 +763,7 @@ static int pvscsi_queue_lck(struct scsi_
+       struct pvscsi_adapter *adapter = shost_priv(host);
+       struct pvscsi_ctx *ctx;
+       unsigned long flags;
++      unsigned char op;
+       spin_lock_irqsave(&adapter->hw_lock, flags);
+@@ -775,13 +776,14 @@ static int pvscsi_queue_lck(struct scsi_
+       }
+       cmd->scsi_done = done;
++      op = cmd->cmnd[0];
+       dev_dbg(&cmd->device->sdev_gendev,
+-              "queued cmd %p, ctx %p, op=%x\n", cmd, ctx, cmd->cmnd[0]);
++              "queued cmd %p, ctx %p, op=%x\n", cmd, ctx, op);
+       spin_unlock_irqrestore(&adapter->hw_lock, flags);
+-      pvscsi_kick_io(adapter, cmd->cmnd[0]);
++      pvscsi_kick_io(adapter, op);
+       return 0;
+ }
index 2e45a3edd318d35fb8b03cfc1decbcb9533f5d22..a24bbbaa1f2b8a411047b929737f7a53cf897145 100644 (file)
@@ -32,3 +32,9 @@ usb-dwc3-gadget-clear-req-needs_extra_trb-flag-on-cl.patch
 fs-proc-array.c-allow-reporting-eip-esp-for-all-coredumping-threads.patch
 mm-mempolicy.c-fix-an-incorrect-rebind-node-in-mpol_rebind_nodemask.patch
 fs-binfmt_flat.c-make-load_flat_shared_library-work.patch
+clk-socfpga-stratix10-fix-divider-entry-for-the-emac-clocks.patch
+mm-soft-offline-return-ebusy-if-set_hwpoison_free_buddy_page-fails.patch
+mm-hugetlb-soft-offline-dissolve_free_huge_page-return-zero-on-pagehuge.patch
+mm-page_idle.c-fix-oops-because-end_pfn-is-larger-than-max_pfn.patch
+dm-log-writes-make-sure-super-sector-log-updates-are-written-in-order.patch
+scsi-vmw_pscsi-fix-use-after-free-in-pvscsi_queue_lck.patch