From 57bf31ec6ff29dd044804af965e3d2a4442b415c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 6 Sep 2022 12:04:32 +0200 Subject: [PATCH] 5.10-stable patches added patches: thunderbolt-use-the-actual-buffer-in-tb_async_error.patch xen-blkback-advertise-feature-persistent-as-user-requested.patch xen-blkfront-advertise-feature-persistent-as-user-requested.patch --- queue-5.10/series | 3 + ...-the-actual-buffer-in-tb_async_error.patch | 31 ++++++++ ...feature-persistent-as-user-requested.patch | 73 +++++++++++++++++++ ...feature-persistent-as-user-requested.patch | 69 ++++++++++++++++++ 4 files changed, 176 insertions(+) create mode 100644 queue-5.10/thunderbolt-use-the-actual-buffer-in-tb_async_error.patch create mode 100644 queue-5.10/xen-blkback-advertise-feature-persistent-as-user-requested.patch create mode 100644 queue-5.10/xen-blkfront-advertise-feature-persistent-as-user-requested.patch diff --git a/queue-5.10/series b/queue-5.10/series index cdc7023daf0..9e99939cc65 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -44,3 +44,6 @@ gpio-pca953x-add-mutex_lock-for-regcache-sync-in-pm.patch kvm-x86-mask-off-unsupported-and-unknown-bits-of-ia3.patch xen-grants-prevent-integer-overflow-in-gnttab_dma_al.patch mm-pagewalk-fix-race-between-unmap-and-page-walker.patch +xen-blkback-advertise-feature-persistent-as-user-requested.patch +xen-blkfront-advertise-feature-persistent-as-user-requested.patch +thunderbolt-use-the-actual-buffer-in-tb_async_error.patch diff --git a/queue-5.10/thunderbolt-use-the-actual-buffer-in-tb_async_error.patch b/queue-5.10/thunderbolt-use-the-actual-buffer-in-tb_async_error.patch new file mode 100644 index 00000000000..9f0461f91ea --- /dev/null +++ b/queue-5.10/thunderbolt-use-the-actual-buffer-in-tb_async_error.patch @@ -0,0 +1,31 @@ +From eb100b8fa8e8b59eb3e5fc7a5fd4a1e3c5950f64 Mon Sep 17 00:00:00 2001 +From: Mika Westerberg +Date: Fri, 29 Apr 2022 17:10:17 +0300 +Subject: thunderbolt: Use the actual buffer in tb_async_error() + +From: Mika Westerberg + +commit eb100b8fa8e8b59eb3e5fc7a5fd4a1e3c5950f64 upstream. + +The received notification packet is held in pkg->buffer and not in pkg +itself. Fix this by using the correct buffer. + +Fixes: 81a54b5e1986 ("thunderbolt: Let the connection manager handle all notifications") +Cc: stable@vger.kernel.org +Signed-off-by: Mika Westerberg +Signed-off-by: Greg Kroah-Hartman +--- + drivers/thunderbolt/ctl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/thunderbolt/ctl.c ++++ b/drivers/thunderbolt/ctl.c +@@ -396,7 +396,7 @@ static void tb_ctl_rx_submit(struct ctl_ + + static int tb_async_error(const struct ctl_pkg *pkg) + { +- const struct cfg_error_pkg *error = (const struct cfg_error_pkg *)pkg; ++ const struct cfg_error_pkg *error = pkg->buffer; + + if (pkg->frame.eof != TB_CFG_PKG_ERROR) + return false; diff --git a/queue-5.10/xen-blkback-advertise-feature-persistent-as-user-requested.patch b/queue-5.10/xen-blkback-advertise-feature-persistent-as-user-requested.patch new file mode 100644 index 00000000000..2cbce17036e --- /dev/null +++ b/queue-5.10/xen-blkback-advertise-feature-persistent-as-user-requested.patch @@ -0,0 +1,73 @@ +From 06ba5d2e943e97bb66e75c152e87f1d2c7027a67 Mon Sep 17 00:00:00 2001 +From: SeongJae Park +Date: Wed, 31 Aug 2022 16:58:22 +0000 +Subject: xen-blkback: Advertise feature-persistent as user requested +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: SeongJae Park + +commit 06ba5d2e943e97bb66e75c152e87f1d2c7027a67 upstream. + +The advertisement of the persistent grants feature (writing +'feature-persistent' to xenbus) should mean not the decision for using +the feature but only the availability of the feature. However, commit +aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent +grants") made a field of blkback, which was a place for saving only the +negotiation result, to be used for yet another purpose: caching of the +'feature_persistent' parameter value. As a result, the advertisement, +which should follow only the parameter value, becomes inconsistent. + +This commit fixes the misuse of the semantic by making blkback saves the +parameter value in a separate place and advertises the support based on +only the saved value. + +Fixes: aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") +Cc: # 5.10.x +Suggested-by: Juergen Gross +Signed-off-by: SeongJae Park +Tested-by: Marek Marczykowski-Górecki +Reviewed-by: Juergen Gross +Link: https://lore.kernel.org/r/20220831165824.94815-2-sj@kernel.org +Signed-off-by: Juergen Gross +Signed-off-by: Greg Kroah-Hartman +--- + drivers/block/xen-blkback/common.h | 3 +++ + drivers/block/xen-blkback/xenbus.c | 6 ++++-- + 2 files changed, 7 insertions(+), 2 deletions(-) + +--- a/drivers/block/xen-blkback/common.h ++++ b/drivers/block/xen-blkback/common.h +@@ -226,6 +226,9 @@ struct xen_vbd { + sector_t size; + unsigned int flush_support:1; + unsigned int discard_secure:1; ++ /* Connect-time cached feature_persistent parameter value */ ++ unsigned int feature_gnt_persistent_parm:1; ++ /* Persistent grants feature negotiation result */ + unsigned int feature_gnt_persistent:1; + unsigned int overflow_max_grants:1; + }; +--- a/drivers/block/xen-blkback/xenbus.c ++++ b/drivers/block/xen-blkback/xenbus.c +@@ -911,7 +911,7 @@ again: + xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); + + err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", +- be->blkif->vbd.feature_gnt_persistent); ++ be->blkif->vbd.feature_gnt_persistent_parm); + if (err) { + xenbus_dev_fatal(dev, err, "writing %s/feature-persistent", + dev->nodename); +@@ -1089,7 +1089,9 @@ static int connect_ring(struct backend_i + return -ENOSYS; + } + +- blkif->vbd.feature_gnt_persistent = feature_persistent && ++ blkif->vbd.feature_gnt_persistent_parm = feature_persistent; ++ blkif->vbd.feature_gnt_persistent = ++ blkif->vbd.feature_gnt_persistent_parm && + xenbus_read_unsigned(dev->otherend, "feature-persistent", 0); + + blkif->vbd.overflow_max_grants = 0; diff --git a/queue-5.10/xen-blkfront-advertise-feature-persistent-as-user-requested.patch b/queue-5.10/xen-blkfront-advertise-feature-persistent-as-user-requested.patch new file mode 100644 index 00000000000..7f865692b6e --- /dev/null +++ b/queue-5.10/xen-blkfront-advertise-feature-persistent-as-user-requested.patch @@ -0,0 +1,69 @@ +From 9f5e0fe5d05f7e8de7f39b2b10089834eb0ff787 Mon Sep 17 00:00:00 2001 +From: SeongJae Park +Date: Wed, 31 Aug 2022 16:58:23 +0000 +Subject: xen-blkfront: Advertise feature-persistent as user requested +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: SeongJae Park + +commit 9f5e0fe5d05f7e8de7f39b2b10089834eb0ff787 upstream. + +The advertisement of the persistent grants feature (writing +'feature-persistent' to xenbus) should mean not the decision for using +the feature but only the availability of the feature. However, commit +74a852479c68 ("xen-blkfront: add a parameter for disabling of persistent +grants") made a field of blkfront, which was a place for saving only the +negotiation result, to be used for yet another purpose: caching of the +'feature_persistent' parameter value. As a result, the advertisement, +which should follow only the parameter value, becomes inconsistent. + +This commit fixes the misuse of the semantic by making blkfront saves +the parameter value in a separate place and advertises the support based +on only the saved value. + +Fixes: 74a852479c68 ("xen-blkfront: add a parameter for disabling of persistent grants") +Cc: # 5.10.x +Suggested-by: Juergen Gross +Signed-off-by: SeongJae Park +Tested-by: Marek Marczykowski-Górecki +Reviewed-by: Juergen Gross +Link: https://lore.kernel.org/r/20220831165824.94815-3-sj@kernel.org +Signed-off-by: Juergen Gross +Signed-off-by: Greg Kroah-Hartman +--- + drivers/block/xen-blkfront.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/drivers/block/xen-blkfront.c ++++ b/drivers/block/xen-blkfront.c +@@ -211,6 +211,9 @@ struct blkfront_info + unsigned int feature_fua:1; + unsigned int feature_discard:1; + unsigned int feature_secdiscard:1; ++ /* Connect-time cached feature_persistent parameter */ ++ unsigned int feature_persistent_parm:1; ++ /* Persistent grants feature negotiation result */ + unsigned int feature_persistent:1; + unsigned int bounce:1; + unsigned int discard_granularity; +@@ -1941,7 +1944,7 @@ again: + goto abort_transaction; + } + err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", +- info->feature_persistent); ++ info->feature_persistent_parm); + if (err) + dev_warn(&dev->dev, + "writing persistent grants feature to xenbus"); +@@ -2391,7 +2394,8 @@ static void blkfront_gather_backend_feat + if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0)) + blkfront_setup_discard(info); + +- if (feature_persistent) ++ info->feature_persistent_parm = feature_persistent; ++ if (info->feature_persistent_parm) + info->feature_persistent = + !!xenbus_read_unsigned(info->xbdev->otherend, + "feature-persistent", 0); -- 2.47.2