]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Jun 2023 20:06:26 +0000 (22:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Jun 2023 20:06:26 +0000 (22:06 +0200)
added patches:
drm-edid-fix-objtool-warning-in-drm_cvt_modes.patch
drm-edid-fix-uninitialized-variable-in-drm_cvt_modes.patch
rdma-bnxt_re-remove-set-but-not-used-variable-dev_attr.patch
rdma-bnxt_re-remove-the-qp-from-list-only-if-the-qp-destroy-succeeds.patch
wifi-rtlwifi-8192de-correct-checking-of-iqk-reload.patch

queue-5.4/drm-edid-fix-objtool-warning-in-drm_cvt_modes.patch [new file with mode: 0644]
queue-5.4/drm-edid-fix-uninitialized-variable-in-drm_cvt_modes.patch [new file with mode: 0644]
queue-5.4/rdma-bnxt_re-remove-set-but-not-used-variable-dev_attr.patch [new file with mode: 0644]
queue-5.4/rdma-bnxt_re-remove-the-qp-from-list-only-if-the-qp-destroy-succeeds.patch [new file with mode: 0644]
queue-5.4/series
queue-5.4/wifi-rtlwifi-8192de-correct-checking-of-iqk-reload.patch [new file with mode: 0644]

diff --git a/queue-5.4/drm-edid-fix-objtool-warning-in-drm_cvt_modes.patch b/queue-5.4/drm-edid-fix-objtool-warning-in-drm_cvt_modes.patch
new file mode 100644 (file)
index 0000000..4630388
--- /dev/null
@@ -0,0 +1,90 @@
+From d652d5f1eeeb06046009f4fcb9b4542249526916 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Thu, 17 Dec 2020 09:27:57 -0800
+Subject: drm/edid: fix objtool warning in drm_cvt_modes()
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit d652d5f1eeeb06046009f4fcb9b4542249526916 upstream.
+
+Commit 991fcb77f490 ("drm/edid: Fix uninitialized variable in
+drm_cvt_modes()") just replaced one warning with another.
+
+The original warning about a possibly uninitialized variable was due to
+the compiler not being smart enough to see that the case statement
+actually enumerated all possible cases.  And the initial fix was just to
+add a "default" case that had a single "unreachable()", just to tell the
+compiler that that situation cannot happen.
+
+However, that doesn't actually fix the fundamental reason for the
+problem: the compiler still doesn't see that the existing case
+statements enumerate all possibilities, so the compiler will still
+generate code to jump to that unreachable case statement.  It just won't
+complain about an uninitialized variable any more.
+
+So now the compiler generates code to our inline asm marker that we told
+it would not fall through, and end end result is basically random.  We
+have created a bridge to nowhere.
+
+And then, depending on the random details of just exactly what the
+compiler ends up doing, 'objtool' might end up complaining about the
+conditional branches (for conditions that cannot happen, and that thus
+will never be taken - but if the compiler was not smart enough to figure
+that out, we can't expect objtool to do so) going off in the weeds.
+
+So depending on how the compiler has laid out the result, you might see
+something like this:
+
+    drivers/gpu/drm/drm_edid.o: warning: objtool: do_cvt_mode() falls through to next function drm_mode_detailed.isra.0()
+
+and now you have a truly inscrutable warning that makes no sense at all
+unless you start looking at whatever random code the compiler happened
+to generate for our bare "unreachable()" statement.
+
+IOW, don't use "unreachable()" unless you have an _active_ operation
+that generates code that actually makes it obvious that something is not
+reachable (ie an UD instruction or similar).
+
+Solve the "compiler isn't smart enough" problem by just marking one of
+the cases as "default", so that even when the compiler doesn't otherwise
+see that we've enumerated all cases, the compiler will feel happy and
+safe about there always being a valid case that initializes the 'width'
+variable.
+
+This also generates better code, since now the compiler doesn't generate
+comparisons for five different possibilities (the four real ones and the
+one that can't happen), but just for the three real ones and "the rest"
+(which is that last one).
+
+A smart enough compiler that sees that we cover all the cases won't care.
+
+Cc: Lyude Paul <lyude@redhat.com>
+Cc: Ilia Mirkin <imirkin@alum.mit.edu>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/drm_edid.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/drm_edid.c
++++ b/drivers/gpu/drm/drm_edid.c
+@@ -2779,6 +2779,8 @@ static int drm_cvt_modes(struct drm_conn
+               height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 4) + 1) * 2;
+               switch (cvt->code[1] & 0x0c) {
++              /* default - because compiler doesn't see that we've enumerated all cases */
++              default:
+               case 0x00:
+                       width = height * 4 / 3;
+                       break;
+@@ -2791,8 +2793,6 @@ static int drm_cvt_modes(struct drm_conn
+               case 0x0c:
+                       width = height * 15 / 9;
+                       break;
+-              default:
+-                      unreachable();
+               }
+               for (j = 1; j < 5; j++) {
diff --git a/queue-5.4/drm-edid-fix-uninitialized-variable-in-drm_cvt_modes.patch b/queue-5.4/drm-edid-fix-uninitialized-variable-in-drm_cvt_modes.patch
new file mode 100644 (file)
index 0000000..c4527aa
--- /dev/null
@@ -0,0 +1,39 @@
+From 991fcb77f490390bcad89fa67d95763c58cdc04c Mon Sep 17 00:00:00 2001
+From: Lyude Paul <lyude@redhat.com>
+Date: Thu, 5 Nov 2020 18:57:02 -0500
+Subject: drm/edid: Fix uninitialized variable in drm_cvt_modes()
+
+From: Lyude Paul <lyude@redhat.com>
+
+commit 991fcb77f490390bcad89fa67d95763c58cdc04c upstream.
+
+Noticed this when trying to compile with -Wall on a kernel fork. We
+potentially don't set width here, which causes the compiler to complain
+about width potentially being uninitialized in drm_cvt_modes(). So, let's
+fix that.
+
+Changes since v1:
+* Don't emit an error as this code isn't reachable, just mark it as such
+Changes since v2:
+* Remove now unused variable
+
+Fixes: 3f649ab728cd ("treewide: Remove uninitialized_var() usage")
+Signed-off-by: Lyude Paul <lyude@redhat.com>
+Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
+Link: https://patchwork.freedesktop.org/patch/msgid/20201105235703.1328115-1-lyude@redhat.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/drm_edid.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/gpu/drm/drm_edid.c
++++ b/drivers/gpu/drm/drm_edid.c
+@@ -2791,6 +2791,8 @@ static int drm_cvt_modes(struct drm_conn
+               case 0x0c:
+                       width = height * 15 / 9;
+                       break;
++              default:
++                      unreachable();
+               }
+               for (j = 1; j < 5; j++) {
diff --git a/queue-5.4/rdma-bnxt_re-remove-set-but-not-used-variable-dev_attr.patch b/queue-5.4/rdma-bnxt_re-remove-set-but-not-used-variable-dev_attr.patch
new file mode 100644 (file)
index 0000000..fd35b40
--- /dev/null
@@ -0,0 +1,44 @@
+From a0b404a98e274b5fc0cfb7c108d99127d482e5ff Mon Sep 17 00:00:00 2001
+From: YueHaibing <yuehaibing@huawei.com>
+Date: Thu, 27 Feb 2020 06:45:42 +0000
+Subject: RDMA/bnxt_re: Remove set but not used variable 'dev_attr'
+
+From: YueHaibing <yuehaibing@huawei.com>
+
+commit a0b404a98e274b5fc0cfb7c108d99127d482e5ff upstream.
+
+Fixes gcc '-Wunused-but-set-variable' warning:
+
+drivers/infiniband/hw/bnxt_re/ib_verbs.c: In function 'bnxt_re_create_gsi_qp':
+drivers/infiniband/hw/bnxt_re/ib_verbs.c:1283:30: warning:
+ variable 'dev_attr' set but not used [-Wunused-but-set-variable]
+
+commit 8dae419f9ec7 ("RDMA/bnxt_re: Refactor queue pair creation code")
+involved this, but not used, so remove it.
+
+Link: https://lore.kernel.org/r/20200227064542.91205-1-yuehaibing@huawei.com
+Reported-by: Hulk Robot <hulkci@huawei.com>
+Signed-off-by: YueHaibing <yuehaibing@huawei.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/infiniband/hw/bnxt_re/ib_verbs.c |    2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
++++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+@@ -1286,14 +1286,12 @@ out:
+ static int bnxt_re_create_gsi_qp(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd,
+                                struct ib_qp_init_attr *init_attr)
+ {
+-      struct bnxt_qplib_dev_attr *dev_attr;
+       struct bnxt_re_dev *rdev;
+       struct bnxt_qplib_qp *qplqp;
+       int rc = 0;
+       rdev = qp->rdev;
+       qplqp = &qp->qplib_qp;
+-      dev_attr = &rdev->dev_attr;
+       qplqp->rq_hdr_buf_size = BNXT_QPLIB_MAX_QP1_RQ_HDR_SIZE_V2;
+       qplqp->sq_hdr_buf_size = BNXT_QPLIB_MAX_QP1_SQ_HDR_SIZE_V2;
diff --git a/queue-5.4/rdma-bnxt_re-remove-the-qp-from-list-only-if-the-qp-destroy-succeeds.patch b/queue-5.4/rdma-bnxt_re-remove-the-qp-from-list-only-if-the-qp-destroy-succeeds.patch
new file mode 100644 (file)
index 0000000..e7bedde
--- /dev/null
@@ -0,0 +1,79 @@
+From 097a9d23b7250355b182c5fd47dd4c55b22b1c33 Mon Sep 17 00:00:00 2001
+From: Selvin Xavier <selvin.xavier@broadcom.com>
+Date: Mon, 24 Aug 2020 11:14:31 -0700
+Subject: RDMA/bnxt_re: Remove the qp from list only if the qp destroy succeeds
+
+From: Selvin Xavier <selvin.xavier@broadcom.com>
+
+commit 097a9d23b7250355b182c5fd47dd4c55b22b1c33 upstream.
+
+Driver crashes when destroy_qp is re-tried because of an error
+returned. This is because the qp entry was removed from the qp list during
+the first call.
+
+Remove qp from the list only if destroy_qp returns success.
+
+The driver will still trigger a WARN_ON due to the memory leaking, but at
+least it isn't corrupting memory too.
+
+Fixes: 8dae419f9ec7 ("RDMA/bnxt_re: Refactor queue pair creation code")
+Link: https://lore.kernel.org/r/1598292876-26529-2-git-send-email-selvin.xavier@broadcom.com
+Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
+Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/infiniband/hw/bnxt_re/ib_verbs.c |   22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
++++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+@@ -771,12 +771,6 @@ static int bnxt_re_destroy_gsi_sqp(struc
+       gsi_sqp = rdev->gsi_ctx.gsi_sqp;
+       gsi_sah = rdev->gsi_ctx.gsi_sah;
+-      /* remove from active qp list */
+-      mutex_lock(&rdev->qp_lock);
+-      list_del(&gsi_sqp->list);
+-      mutex_unlock(&rdev->qp_lock);
+-      atomic_dec(&rdev->qp_count);
+-
+       dev_dbg(rdev_to_dev(rdev), "Destroy the shadow AH\n");
+       bnxt_qplib_destroy_ah(&rdev->qplib_res,
+                             &gsi_sah->qplib_ah,
+@@ -791,6 +785,12 @@ static int bnxt_re_destroy_gsi_sqp(struc
+       }
+       bnxt_qplib_free_qp_res(&rdev->qplib_res, &gsi_sqp->qplib_qp);
++      /* remove from active qp list */
++      mutex_lock(&rdev->qp_lock);
++      list_del(&gsi_sqp->list);
++      mutex_unlock(&rdev->qp_lock);
++      atomic_dec(&rdev->qp_count);
++
+       kfree(rdev->gsi_ctx.sqp_tbl);
+       kfree(gsi_sah);
+       kfree(gsi_sqp);
+@@ -811,11 +811,6 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_
+       unsigned int flags;
+       int rc;
+-      mutex_lock(&rdev->qp_lock);
+-      list_del(&qp->list);
+-      mutex_unlock(&rdev->qp_lock);
+-      atomic_dec(&rdev->qp_count);
+-
+       bnxt_qplib_flush_cqn_wq(&qp->qplib_qp);
+       rc = bnxt_qplib_destroy_qp(&rdev->qplib_res, &qp->qplib_qp);
+@@ -838,6 +833,11 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_
+                       goto sh_fail;
+       }
++      mutex_lock(&rdev->qp_lock);
++      list_del(&qp->list);
++      mutex_unlock(&rdev->qp_lock);
++      atomic_dec(&rdev->qp_count);
++
+       ib_umem_release(qp->rumem);
+       ib_umem_release(qp->sumem);
index 2e0a29752aacf146df1148230fe48dbe8da4ab0d..d2a4054f7f29a10ce108e7a042ba8f4f95417098 100644 (file)
@@ -92,3 +92,8 @@ test_firmware-fix-the-memory-leak-of-the-allocated-firmware-buffer.patch
 regmap-account-for-register-length-when-chunking.patch
 scsi-dpt_i2o-remove-broken-pass-through-ioctl-i2ousercmd.patch
 scsi-dpt_i2o-do-not-process-completions-with-invalid-addresses.patch
+rdma-bnxt_re-remove-set-but-not-used-variable-dev_attr.patch
+rdma-bnxt_re-remove-the-qp-from-list-only-if-the-qp-destroy-succeeds.patch
+drm-edid-fix-uninitialized-variable-in-drm_cvt_modes.patch
+wifi-rtlwifi-8192de-correct-checking-of-iqk-reload.patch
+drm-edid-fix-objtool-warning-in-drm_cvt_modes.patch
diff --git a/queue-5.4/wifi-rtlwifi-8192de-correct-checking-of-iqk-reload.patch b/queue-5.4/wifi-rtlwifi-8192de-correct-checking-of-iqk-reload.patch
new file mode 100644 (file)
index 0000000..e989c81
--- /dev/null
@@ -0,0 +1,47 @@
+From 93fbc1ebd978cf408ef5765e9c1630fce9a8621b Mon Sep 17 00:00:00 2001
+From: Ping-Ke Shih <pkshih@realtek.com>
+Date: Mon, 1 Aug 2022 19:33:45 +0800
+Subject: wifi: rtlwifi: 8192de: correct checking of IQK reload
+
+From: Ping-Ke Shih <pkshih@realtek.com>
+
+commit 93fbc1ebd978cf408ef5765e9c1630fce9a8621b upstream.
+
+Since IQK could spend time, we make a cache of IQK result matrix that looks
+like iqk_matrix[channel_idx].val[x][y], and we can reload the matrix if we
+have made a cache. To determine a cache is made, we check
+iqk_matrix[channel_idx].val[0][0].
+
+The initial commit 7274a8c22980 ("rtlwifi: rtl8192de: Merge phy routines")
+make a mistake that checks incorrect iqk_matrix[channel_idx].val[0] that
+is always true, and this mistake is found by commit ee3db469dd31
+("wifi: rtlwifi: remove always-true condition pointed out by GCC 12"), so
+I recall the vendor driver to find fix and apply the correctness.
+
+Fixes: 7274a8c22980 ("rtlwifi: rtl8192de: Merge phy routines")
+Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
+Signed-off-by: Kalle Valo <kvalo@kernel.org>
+Link: https://lore.kernel.org/r/20220801113345.42016-1-pkshih@realtek.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c |    9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
+@@ -2392,11 +2392,10 @@ void rtl92d_phy_reload_iqk_setting(struc
+                       RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD,
+                                "Just Read IQK Matrix reg for channel:%d....\n",
+                                channel);
+-                      _rtl92d_phy_patha_fill_iqk_matrix(hw, true,
+-                                      rtlphy->iqk_matrix[
+-                                      indexforchannel].value, 0,
+-                                      (rtlphy->iqk_matrix[
+-                                      indexforchannel].value[0][2] == 0));
++                      if (rtlphy->iqk_matrix[indexforchannel].value[0][0] != 0)
++                              _rtl92d_phy_patha_fill_iqk_matrix(hw, true,
++                                      rtlphy->iqk_matrix[indexforchannel].value, 0,
++                                      rtlphy->iqk_matrix[indexforchannel].value[0][2] == 0);
+                       if (IS_92D_SINGLEPHY(rtlhal->version)) {
+                               if ((rtlphy->iqk_matrix[
+                                       indexforchannel].value[0][4] != 0)