]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Aug 2022 09:14:47 +0000 (11:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Aug 2022 09:14:47 +0000 (11:14 +0200)
added patches:
ceph-don-t-leak-snap_rwsem-in-handle_cap_grant.patch
ceph-use-correct-index-when-encoding-client-supported-features.patch
dt-bindings-arm-qcom-fix-msm8916-mtp-compatibles.patch
dt-bindings-clock-qcom-gcc-msm8996-add-more-gcc-clock-sources.patch
kbuild-dummy-tools-avoid-tmpdir-leak-in-dummy-gcc.patch
tools-build-switch-to-new-openssl-api-for-test-libcrypto.patch
tools-vm-slabinfo-use-alphabetic-order-when-two-values-are-equal.patch

queue-5.10/ceph-don-t-leak-snap_rwsem-in-handle_cap_grant.patch [new file with mode: 0644]
queue-5.10/ceph-use-correct-index-when-encoding-client-supported-features.patch [new file with mode: 0644]
queue-5.10/dt-bindings-arm-qcom-fix-msm8916-mtp-compatibles.patch [new file with mode: 0644]
queue-5.10/dt-bindings-clock-qcom-gcc-msm8996-add-more-gcc-clock-sources.patch [new file with mode: 0644]
queue-5.10/kbuild-dummy-tools-avoid-tmpdir-leak-in-dummy-gcc.patch [new file with mode: 0644]
queue-5.10/series
queue-5.10/tools-build-switch-to-new-openssl-api-for-test-libcrypto.patch [new file with mode: 0644]
queue-5.10/tools-vm-slabinfo-use-alphabetic-order-when-two-values-are-equal.patch [new file with mode: 0644]

diff --git a/queue-5.10/ceph-don-t-leak-snap_rwsem-in-handle_cap_grant.patch b/queue-5.10/ceph-don-t-leak-snap_rwsem-in-handle_cap_grant.patch
new file mode 100644 (file)
index 0000000..0744443
--- /dev/null
@@ -0,0 +1,66 @@
+From 58dd4385577ed7969b80cdc9e2a31575aba6c712 Mon Sep 17 00:00:00 2001
+From: Jeff Layton <jlayton@kernel.org>
+Date: Fri, 3 Jun 2022 16:39:57 -0400
+Subject: ceph: don't leak snap_rwsem in handle_cap_grant
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jeff Layton <jlayton@kernel.org>
+
+commit 58dd4385577ed7969b80cdc9e2a31575aba6c712 upstream.
+
+When handle_cap_grant is called on an IMPORT op, then the snap_rwsem is
+held and the function is expected to release it before returning. It
+currently fails to do that in all cases which could lead to a deadlock.
+
+Fixes: 6f05b30ea063 ("ceph: reset i_requested_max_size if file write is not wanted")
+Link: https://tracker.ceph.com/issues/55857
+Signed-off-by: Jeff Layton <jlayton@kernel.org>
+Reviewed-by: Luís Henriques <lhenriques@suse.de>
+Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ceph/caps.c |   27 +++++++++++++--------------
+ 1 file changed, 13 insertions(+), 14 deletions(-)
+
+--- a/fs/ceph/caps.c
++++ b/fs/ceph/caps.c
+@@ -3501,24 +3501,23 @@ static void handle_cap_grant(struct inod
+                       fill_inline = true;
+       }
+-      if (ci->i_auth_cap == cap &&
+-          le32_to_cpu(grant->op) == CEPH_CAP_OP_IMPORT) {
+-              if (newcaps & ~extra_info->issued)
+-                      wake = true;
++      if (le32_to_cpu(grant->op) == CEPH_CAP_OP_IMPORT) {
++              if (ci->i_auth_cap == cap) {
++                      if (newcaps & ~extra_info->issued)
++                              wake = true;
+-              if (ci->i_requested_max_size > max_size ||
+-                  !(le32_to_cpu(grant->wanted) & CEPH_CAP_ANY_FILE_WR)) {
+-                      /* re-request max_size if necessary */
+-                      ci->i_requested_max_size = 0;
+-                      wake = true;
+-              }
++                      if (ci->i_requested_max_size > max_size ||
++                          !(le32_to_cpu(grant->wanted) & CEPH_CAP_ANY_FILE_WR)) {
++                              /* re-request max_size if necessary */
++                              ci->i_requested_max_size = 0;
++                              wake = true;
++                      }
+-              ceph_kick_flushing_inode_caps(session, ci);
+-              spin_unlock(&ci->i_ceph_lock);
++                      ceph_kick_flushing_inode_caps(session, ci);
++              }
+               up_read(&session->s_mdsc->snap_rwsem);
+-      } else {
+-              spin_unlock(&ci->i_ceph_lock);
+       }
++      spin_unlock(&ci->i_ceph_lock);
+       if (fill_inline)
+               ceph_fill_inline_data(inode, NULL, extra_info->inline_data,
diff --git a/queue-5.10/ceph-use-correct-index-when-encoding-client-supported-features.patch b/queue-5.10/ceph-use-correct-index-when-encoding-client-supported-features.patch
new file mode 100644 (file)
index 0000000..ebd6074
--- /dev/null
@@ -0,0 +1,74 @@
+From fea013e020e6ecc7be75bea0d61697b7e916b44d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Lu=C3=ADs=20Henriques?= <lhenriques@suse.de>
+Date: Tue, 24 May 2022 17:06:27 +0100
+Subject: ceph: use correct index when encoding client supported features
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Luís Henriques <lhenriques@suse.de>
+
+commit fea013e020e6ecc7be75bea0d61697b7e916b44d upstream.
+
+Feature bits have to be encoded into the correct locations.  This hasn't
+been an issue so far because the only hole in the feature bits was in bit
+10 (CEPHFS_FEATURE_RECLAIM_CLIENT), which is located in the 2nd byte.  When
+adding more bits that go beyond the this 2nd byte, the bug will show up.
+
+[xiubli: remove incorrect comment for CEPHFS_FEATURES_CLIENT_SUPPORTED]
+
+Fixes: 9ba1e224538a ("ceph: allocate the correct amount of extra bytes for the session features")
+Signed-off-by: Luís Henriques <lhenriques@suse.de>
+Reviewed-by: Jeff Layton <jlayton@kernel.org>
+Signed-off-by: Xiubo Li <xiubli@redhat.com>
+Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ceph/mds_client.c |    7 +++++--
+ fs/ceph/mds_client.h |    6 ------
+ 2 files changed, 5 insertions(+), 8 deletions(-)
+
+--- a/fs/ceph/mds_client.c
++++ b/fs/ceph/mds_client.c
+@@ -1184,14 +1184,17 @@ static int encode_supported_features(voi
+       if (count > 0) {
+               size_t i;
+               size_t size = FEATURE_BYTES(count);
++              unsigned long bit;
+               if (WARN_ON_ONCE(*p + 4 + size > end))
+                       return -ERANGE;
+               ceph_encode_32(p, size);
+               memset(*p, 0, size);
+-              for (i = 0; i < count; i++)
+-                      ((unsigned char*)(*p))[i / 8] |= BIT(feature_bits[i] % 8);
++              for (i = 0; i < count; i++) {
++                      bit = feature_bits[i];
++                      ((unsigned char *)(*p))[bit / 8] |= BIT(bit % 8);
++              }
+               *p += size;
+       } else {
+               if (WARN_ON_ONCE(*p + 4 > end))
+--- a/fs/ceph/mds_client.h
++++ b/fs/ceph/mds_client.h
+@@ -33,10 +33,6 @@ enum ceph_feature_type {
+       CEPHFS_FEATURE_MAX = CEPHFS_FEATURE_METRIC_COLLECT,
+ };
+-/*
+- * This will always have the highest feature bit value
+- * as the last element of the array.
+- */
+ #define CEPHFS_FEATURES_CLIENT_SUPPORTED {    \
+       0, 1, 2, 3, 4, 5, 6, 7,                 \
+       CEPHFS_FEATURE_MIMIC,                   \
+@@ -45,8 +41,6 @@ enum ceph_feature_type {
+       CEPHFS_FEATURE_MULTI_RECONNECT,         \
+       CEPHFS_FEATURE_DELEG_INO,               \
+       CEPHFS_FEATURE_METRIC_COLLECT,          \
+-                                              \
+-      CEPHFS_FEATURE_MAX,                     \
+ }
+ #define CEPHFS_FEATURES_CLIENT_REQUIRED {}
diff --git a/queue-5.10/dt-bindings-arm-qcom-fix-msm8916-mtp-compatibles.patch b/queue-5.10/dt-bindings-arm-qcom-fix-msm8916-mtp-compatibles.patch
new file mode 100644 (file)
index 0000000..c69a102
--- /dev/null
@@ -0,0 +1,36 @@
+From bb35fe1efbae4114bd288fae0f56070f563adcfc Mon Sep 17 00:00:00 2001
+From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Date: Fri, 20 May 2022 14:32:46 +0200
+Subject: dt-bindings: arm: qcom: fix MSM8916 MTP compatibles
+
+From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+
+commit bb35fe1efbae4114bd288fae0f56070f563adcfc upstream.
+
+The order of compatibles for MSM8916 MTP board is different:
+
+  msm8916-mtp.dtb: /: compatible: 'oneOf' conditional failed, one must be fixed:
+    ['qcom,msm8916-mtp', 'qcom,msm8916-mtp/1', 'qcom,msm8916'] is too long
+
+Fixes: 9d3ef77fe568 ("dt-bindings: arm: Convert QCom board/soc bindings to json-schema")
+Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Acked-by: Rob Herring <robh@kernel.org>
+Link: https://lore.kernel.org/r/20220520123252.365762-3-krzysztof.kozlowski@linaro.org
+Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/devicetree/bindings/arm/qcom.yaml |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/Documentation/devicetree/bindings/arm/qcom.yaml
++++ b/Documentation/devicetree/bindings/arm/qcom.yaml
+@@ -123,8 +123,8 @@ properties:
+           - const: qcom,msm8974
+       - items:
+-          - const: qcom,msm8916-mtp/1
+           - const: qcom,msm8916-mtp
++          - const: qcom,msm8916-mtp/1
+           - const: qcom,msm8916
+       - items:
diff --git a/queue-5.10/dt-bindings-clock-qcom-gcc-msm8996-add-more-gcc-clock-sources.patch b/queue-5.10/dt-bindings-clock-qcom-gcc-msm8996-add-more-gcc-clock-sources.patch
new file mode 100644 (file)
index 0000000..d77ea34
--- /dev/null
@@ -0,0 +1,57 @@
+From 2b4e75a7a7c8d3531a40ebb103b92f88ff693f79 Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Date: Mon, 20 Jun 2022 10:19:33 +0300
+Subject: dt-bindings: clock: qcom,gcc-msm8996: add more GCC clock sources
+
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+
+commit 2b4e75a7a7c8d3531a40ebb103b92f88ff693f79 upstream.
+
+Add additional GCC clock sources. This includes PCIe and USB PIPE and
+UFS symbol clocks.
+
+Fixes: 2a8aa18c1131 ("dt-bindings: clk: qcom: Fix self-validation, split, and clean cruft")
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
+Link: https://lore.kernel.org/r/20220620071936.1558906-2-dmitry.baryshkov@linaro.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/devicetree/bindings/clock/qcom,gcc-msm8996.yaml |   16 ++++++++++
+ 1 file changed, 16 insertions(+)
+
+--- a/Documentation/devicetree/bindings/clock/qcom,gcc-msm8996.yaml
++++ b/Documentation/devicetree/bindings/clock/qcom,gcc-msm8996.yaml
+@@ -22,16 +22,32 @@ properties:
+     const: qcom,gcc-msm8996
+   clocks:
++    minItems: 3
+     items:
+       - description: XO source
+       - description: Second XO source
+       - description: Sleep clock source
++      - description: PCIe 0 PIPE clock (optional)
++      - description: PCIe 1 PIPE clock (optional)
++      - description: PCIe 2 PIPE clock (optional)
++      - description: USB3 PIPE clock (optional)
++      - description: UFS RX symbol 0 clock (optional)
++      - description: UFS RX symbol 1 clock (optional)
++      - description: UFS TX symbol 0 clock (optional)
+   clock-names:
++    minItems: 3
+     items:
+       - const: cxo
+       - const: cxo2
+       - const: sleep_clk
++      - const: pcie_0_pipe_clk_src
++      - const: pcie_1_pipe_clk_src
++      - const: pcie_2_pipe_clk_src
++      - const: usb3_phy_pipe_clk_src
++      - const: ufs_rx_symbol_0_clk_src
++      - const: ufs_rx_symbol_1_clk_src
++      - const: ufs_tx_symbol_0_clk_src
+   '#clock-cells':
+     const: 1
diff --git a/queue-5.10/kbuild-dummy-tools-avoid-tmpdir-leak-in-dummy-gcc.patch b/queue-5.10/kbuild-dummy-tools-avoid-tmpdir-leak-in-dummy-gcc.patch
new file mode 100644 (file)
index 0000000..86ec982
--- /dev/null
@@ -0,0 +1,40 @@
+From aac289653fa5adf9e9985e4912c1d24a3e8cbab2 Mon Sep 17 00:00:00 2001
+From: Ondrej Mosnacek <omosnace@redhat.com>
+Date: Mon, 11 Jul 2022 14:09:23 +0200
+Subject: kbuild: dummy-tools: avoid tmpdir leak in dummy gcc
+
+From: Ondrej Mosnacek <omosnace@redhat.com>
+
+commit aac289653fa5adf9e9985e4912c1d24a3e8cbab2 upstream.
+
+When passed -print-file-name=plugin, the dummy gcc script creates a
+temporary directory that is never cleaned up. To avoid cluttering
+$TMPDIR, instead use a static directory included in the source tree.
+
+Fixes: 76426e238834 ("kbuild: add dummy toolchains to enable all cc-option etc. in Kconfig")
+Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ .../dummy-tools/dummy-plugin-dir/include/plugin-version.h | 0
+ scripts/dummy-tools/gcc |    8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+ create mode 100644 scripts/dummy-tools/dummy-plugin-dir/include/plugin-version.h
+
+--- a/scripts/dummy-tools/gcc
++++ b/scripts/dummy-tools/gcc
+@@ -77,12 +77,8 @@ fi
+ # To set GCC_PLUGINS
+ if arg_contain -print-file-name=plugin "$@"; then
+-      plugin_dir=$(mktemp -d)
+-
+-      mkdir -p $plugin_dir/include
+-      touch $plugin_dir/include/plugin-version.h
+-
+-      echo $plugin_dir
++      # Use $0 to find the in-tree dummy directory
++      echo "$(dirname "$(readlink -f "$0")")/dummy-plugin-dir"
+       exit 0
+ fi
index 55d3a55e700f0f6c2035163211983c49c9e9fc41..02c3d1e555fe28c746c0a9fb4e57de408c0fd858 100644 (file)
@@ -47,3 +47,10 @@ ipv6-do-not-use-rt_tos-for-ipv6-flowlabel.patch
 plip-avoid-rcu-debug-splat.patch
 vsock-fix-memory-leak-in-vsock_connect.patch
 vsock-set-socket-state-back-to-ss_unconnected-in-vsock_connect_timeout.patch
+dt-bindings-arm-qcom-fix-msm8916-mtp-compatibles.patch
+dt-bindings-clock-qcom-gcc-msm8996-add-more-gcc-clock-sources.patch
+ceph-use-correct-index-when-encoding-client-supported-features.patch
+tools-vm-slabinfo-use-alphabetic-order-when-two-values-are-equal.patch
+ceph-don-t-leak-snap_rwsem-in-handle_cap_grant.patch
+kbuild-dummy-tools-avoid-tmpdir-leak-in-dummy-gcc.patch
+tools-build-switch-to-new-openssl-api-for-test-libcrypto.patch
diff --git a/queue-5.10/tools-build-switch-to-new-openssl-api-for-test-libcrypto.patch b/queue-5.10/tools-build-switch-to-new-openssl-api-for-test-libcrypto.patch
new file mode 100644 (file)
index 0000000..2e3c3fd
--- /dev/null
@@ -0,0 +1,70 @@
+From 5b245985a6de5ac18b5088c37068816d413fb8ed Mon Sep 17 00:00:00 2001
+From: Roberto Sassu <roberto.sassu@huawei.com>
+Date: Tue, 19 Jul 2022 19:05:55 +0200
+Subject: tools build: Switch to new openssl API for test-libcrypto
+
+From: Roberto Sassu <roberto.sassu@huawei.com>
+
+commit 5b245985a6de5ac18b5088c37068816d413fb8ed upstream.
+
+Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an
+error when it encounters the deprecated function MD5_Init() and the others.
+
+The error would be interpreted as missing libcrypto, while in reality it is
+not.
+
+Fixes: 6e8ccb4f624a73c5 ("tools/bpf: properly account for libbfd variations")
+Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
+Cc: Alexei Starovoitov <ast@kernel.org>
+Cc: Andrii Nakryiko <andrii@kernel.org>
+Cc: bpf@vger.kernel.org
+Cc: Daniel Borkmann <daniel@iogearbox.net>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: John Fastabend <john.fastabend@gmail.com>
+Cc: KP Singh <kpsingh@kernel.org>
+Cc: llvm@lists.linux.dev
+Cc: Martin KaFai Lau <martin.lau@linux.dev>
+Cc: Nathan Chancellor <nathan@kernel.org>
+Cc: Nick Desaulniers <ndesaulniers@google.com>
+Cc: Nick Terrell <terrelln@fb.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Quentin Monnet <quentin@isovalent.com>
+Cc: Song Liu <song@kernel.org>
+Cc: Stanislav Fomichev <sdf@google.com>
+Link: https://lore.kernel.org/r/20220719170555.2576993-4-roberto.sassu@huawei.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/build/feature/test-libcrypto.c |   15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+--- a/tools/build/feature/test-libcrypto.c
++++ b/tools/build/feature/test-libcrypto.c
+@@ -1,16 +1,23 @@
+ // SPDX-License-Identifier: GPL-2.0
++#include <openssl/evp.h>
+ #include <openssl/sha.h>
+ #include <openssl/md5.h>
+ int main(void)
+ {
+-      MD5_CTX context;
++      EVP_MD_CTX *mdctx;
+       unsigned char md[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH];
+       unsigned char dat[] = "12345";
++      unsigned int digest_len;
+-      MD5_Init(&context);
+-      MD5_Update(&context, &dat[0], sizeof(dat));
+-      MD5_Final(&md[0], &context);
++      mdctx = EVP_MD_CTX_new();
++      if (!mdctx)
++              return 0;
++
++      EVP_DigestInit_ex(mdctx, EVP_md5(), NULL);
++      EVP_DigestUpdate(mdctx, &dat[0], sizeof(dat));
++      EVP_DigestFinal_ex(mdctx, &md[0], &digest_len);
++      EVP_MD_CTX_free(mdctx);
+       SHA1(&dat[0], sizeof(dat), &md[0]);
diff --git a/queue-5.10/tools-vm-slabinfo-use-alphabetic-order-when-two-values-are-equal.patch b/queue-5.10/tools-vm-slabinfo-use-alphabetic-order-when-two-values-are-equal.patch
new file mode 100644 (file)
index 0000000..4aa46f1
--- /dev/null
@@ -0,0 +1,100 @@
+From 4f5ceb8851f0081af54313abbf56de1615911faf Mon Sep 17 00:00:00 2001
+From: Yuanzheng Song <songyuanzheng@huawei.com>
+Date: Sat, 28 May 2022 06:31:17 +0000
+Subject: tools/vm/slabinfo: use alphabetic order when two values are equal
+
+From: Yuanzheng Song <songyuanzheng@huawei.com>
+
+commit 4f5ceb8851f0081af54313abbf56de1615911faf upstream.
+
+When the number of partial slabs in each cache is the same (e.g., the
+value are 0), the results of the `slabinfo -X -N5` and `slabinfo -P -N5`
+are different.
+
+/ # slabinfo -X -N5
+...
+Slabs sorted by number of partial slabs
+---------------------------------------
+Name                   Objects Objsize           Space Slabs/Part/Cpu  O/S O %Fr %Ef Flg
+inode_cache              15180     392         6217728        758/0/1   20 1   0  95 a
+kernfs_node_cache        22494      88         2002944        488/0/1   46 0   0  98
+shmem_inode_cache          663     464          319488         38/0/1   17 1   0  96
+biovec-max                  50    3072          163840          4/0/1   10 3   0  93 A
+dentry                   19050     136         2600960        633/0/2   30 0   0  99 a
+
+/ # slabinfo -P -N5
+Name                   Objects Objsize           Space Slabs/Part/Cpu  O/S O %Fr %Ef Flg
+bdev_cache                  32     984           32.7K          1/0/1   16 2   0  96 Aa
+ext4_inode_cache            42     752           32.7K          1/0/1   21 2   0  96 a
+dentry                   19050     136            2.6M        633/0/2   30 0   0  99 a
+TCPv6                       17    1840           32.7K          0/0/1   17 3   0  95 A
+RAWv6                       18     856           16.3K          0/0/1   18 2   0  94 A
+
+This problem is caused by the sort_slabs().  So let's use alphabetic order
+when two values are equal in the sort_slabs().
+
+By the way, the content of the `slabinfo -h` is not aligned because the
+
+`-P|--partial Sort by number of partial slabs`
+
+uses tabs instead of spaces.  So let's use spaces instead of tabs to fix
+it.
+
+Link: https://lkml.kernel.org/r/20220528063117.935158-1-songyuanzheng@huawei.com
+Fixes: 1106b205a3fe ("tools/vm/slabinfo: add partial slab listing to -X")
+Signed-off-by: Yuanzheng Song <songyuanzheng@huawei.com>
+Cc: "Tobin C. Harding" <tobin@kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/vm/slabinfo.c |   32 ++++++++++++++++++++++----------
+ 1 file changed, 22 insertions(+), 10 deletions(-)
+
+--- a/tools/vm/slabinfo.c
++++ b/tools/vm/slabinfo.c
+@@ -125,7 +125,7 @@ static void usage(void)
+               "-n|--numa              Show NUMA information\n"
+               "-N|--lines=K           Show the first K slabs\n"
+               "-o|--ops               Show kmem_cache_ops\n"
+-              "-P|--partial           Sort by number of partial slabs\n"
++              "-P|--partial           Sort by number of partial slabs\n"
+               "-r|--report            Detailed report on single slabs\n"
+               "-s|--shrink            Shrink slabs\n"
+               "-S|--Size              Sort by size\n"
+@@ -1045,15 +1045,27 @@ static void sort_slabs(void)
+               for (s2 = s1 + 1; s2 < slabinfo + slabs; s2++) {
+                       int result;
+-                      if (sort_size)
+-                              result = slab_size(s1) < slab_size(s2);
+-                      else if (sort_active)
+-                              result = slab_activity(s1) < slab_activity(s2);
+-                      else if (sort_loss)
+-                              result = slab_waste(s1) < slab_waste(s2);
+-                      else if (sort_partial)
+-                              result = s1->partial < s2->partial;
+-                      else
++                      if (sort_size) {
++                              if (slab_size(s1) == slab_size(s2))
++                                      result = strcasecmp(s1->name, s2->name);
++                              else
++                                      result = slab_size(s1) < slab_size(s2);
++                      } else if (sort_active) {
++                              if (slab_activity(s1) == slab_activity(s2))
++                                      result = strcasecmp(s1->name, s2->name);
++                              else
++                                      result = slab_activity(s1) < slab_activity(s2);
++                      } else if (sort_loss) {
++                              if (slab_waste(s1) == slab_waste(s2))
++                                      result = strcasecmp(s1->name, s2->name);
++                              else
++                                      result = slab_waste(s1) < slab_waste(s2);
++                      } else if (sort_partial) {
++                              if (s1->partial == s2->partial)
++                                      result = strcasecmp(s1->name, s2->name);
++                              else
++                                      result = s1->partial < s2->partial;
++                      } else
+                               result = strcasecmp(s1->name, s2->name);
+                       if (show_inverted)