]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Apr 2015 13:06:54 +0000 (15:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Apr 2015 13:06:54 +0000 (15:06 +0200)
added patches:
ib-mlx4-saturate-roce-port-pma-counters-in-case-of-overflow.patch
kernel.h-define-u8-s8-u32-etc.-limits.patch
net-llc-use-correct-size-for-sysctl-timeout-entries.patch
net-rds-use-correct-size-for-max-unacked-packets-and-bytes.patch

queue-3.10/ib-mlx4-saturate-roce-port-pma-counters-in-case-of-overflow.patch [new file with mode: 0644]
queue-3.10/kernel.h-define-u8-s8-u32-etc.-limits.patch [new file with mode: 0644]
queue-3.10/net-llc-use-correct-size-for-sysctl-timeout-entries.patch [new file with mode: 0644]
queue-3.10/net-rds-use-correct-size-for-max-unacked-packets-and-bytes.patch [new file with mode: 0644]
queue-3.10/series

diff --git a/queue-3.10/ib-mlx4-saturate-roce-port-pma-counters-in-case-of-overflow.patch b/queue-3.10/ib-mlx4-saturate-roce-port-pma-counters-in-case-of-overflow.patch
new file mode 100644 (file)
index 0000000..880cc00
--- /dev/null
@@ -0,0 +1,61 @@
+From 61a3855bb726cbb062ef02a31a832dea455456e0 Mon Sep 17 00:00:00 2001
+From: Majd Dibbiny <majd@mellanox.com>
+Date: Wed, 18 Mar 2015 16:51:37 +0200
+Subject: IB/mlx4: Saturate RoCE port PMA counters in case of overflow
+
+From: Majd Dibbiny <majd@mellanox.com>
+
+commit 61a3855bb726cbb062ef02a31a832dea455456e0 upstream.
+
+For RoCE ports, we set the u32 PMA values based on u64 HCA counters. In case of
+overflow, according to the IB spec, we have to saturate a counter to its
+max value, do that.
+
+Fixes: c37791349cc7 ('IB/mlx4: Support PMA counters for IBoE')
+Signed-off-by: Majd Dibbiny <majd@mellanox.com>
+Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
+Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
+Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/hw/mlx4/mad.c |   20 ++++++++++++++++----
+ 1 file changed, 16 insertions(+), 4 deletions(-)
+
+--- a/drivers/infiniband/hw/mlx4/mad.c
++++ b/drivers/infiniband/hw/mlx4/mad.c
+@@ -64,6 +64,14 @@ enum {
+ #define GUID_TBL_BLK_NUM_ENTRIES 8
+ #define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES)
++/* Counters should be saturate once they reach their maximum value */
++#define ASSIGN_32BIT_COUNTER(counter, value) do {\
++      if ((value) > U32_MAX)                   \
++              counter = cpu_to_be32(U32_MAX); \
++      else                                     \
++              counter = cpu_to_be32(value);    \
++} while (0)
++
+ struct mlx4_mad_rcv_buf {
+       struct ib_grh grh;
+       u8 payload[256];
+@@ -730,10 +738,14 @@ static int ib_process_mad(struct ib_devi
+ static void edit_counter(struct mlx4_counter *cnt,
+                                       struct ib_pma_portcounters *pma_cnt)
+ {
+-      pma_cnt->port_xmit_data = cpu_to_be32((be64_to_cpu(cnt->tx_bytes)>>2));
+-      pma_cnt->port_rcv_data  = cpu_to_be32((be64_to_cpu(cnt->rx_bytes)>>2));
+-      pma_cnt->port_xmit_packets = cpu_to_be32(be64_to_cpu(cnt->tx_frames));
+-      pma_cnt->port_rcv_packets  = cpu_to_be32(be64_to_cpu(cnt->rx_frames));
++      ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_data,
++                           (be64_to_cpu(cnt->tx_bytes) >> 2));
++      ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_data,
++                           (be64_to_cpu(cnt->rx_bytes) >> 2));
++      ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_packets,
++                           be64_to_cpu(cnt->tx_frames));
++      ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_packets,
++                           be64_to_cpu(cnt->rx_frames));
+ }
+ static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
diff --git a/queue-3.10/kernel.h-define-u8-s8-u32-etc.-limits.patch b/queue-3.10/kernel.h-define-u8-s8-u32-etc.-limits.patch
new file mode 100644 (file)
index 0000000..7623e81
--- /dev/null
@@ -0,0 +1,45 @@
+From 89a0714106aac7309c7dfa0f004b39e1e89d2942 Mon Sep 17 00:00:00 2001
+From: Alex Elder <alex.elder@linaro.org>
+Date: Thu, 23 Jan 2014 15:54:00 -0800
+Subject: kernel.h: define u8, s8, u32, etc. limits
+
+From: Alex Elder <alex.elder@linaro.org>
+
+commit 89a0714106aac7309c7dfa0f004b39e1e89d2942 upstream.
+
+Create constants that define the maximum and minimum values
+representable by the kernel types u8, s8, u16, s16, and so on.
+
+Signed-off-by: Alex Elder <elder@linaro.org>
+Cc: Sage Weil <sage@inktank.com>
+Cc: David Miller <davem@davemloft.net>
+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>
+
+---
+ include/linux/kernel.h |   13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+--- a/include/linux/kernel.h
++++ b/include/linux/kernel.h
+@@ -29,6 +29,19 @@
+ #define ULLONG_MAX    (~0ULL)
+ #define SIZE_MAX      (~(size_t)0)
++#define U8_MAX                ((u8)~0U)
++#define S8_MAX                ((s8)(U8_MAX>>1))
++#define S8_MIN                ((s8)(-S8_MAX - 1))
++#define U16_MAX               ((u16)~0U)
++#define S16_MAX               ((s16)(U16_MAX>>1))
++#define S16_MIN               ((s16)(-S16_MAX - 1))
++#define U32_MAX               ((u32)~0U)
++#define S32_MAX               ((s32)(U32_MAX>>1))
++#define S32_MIN               ((s32)(-S32_MAX - 1))
++#define U64_MAX               ((u64)~0ULL)
++#define S64_MAX               ((s64)(U64_MAX>>1))
++#define S64_MIN               ((s64)(-S64_MAX - 1))
++
+ #define STACK_MAGIC   0xdeadbeef
+ #define REPEAT_BYTE(x)        ((~0ul / 0xff) * (x))
diff --git a/queue-3.10/net-llc-use-correct-size-for-sysctl-timeout-entries.patch b/queue-3.10/net-llc-use-correct-size-for-sysctl-timeout-entries.patch
new file mode 100644 (file)
index 0000000..80f87fe
--- /dev/null
@@ -0,0 +1,56 @@
+From 6b8d9117ccb4f81b1244aafa7bc70ef8fa45fc49 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sasha.levin@oracle.com>
+Date: Fri, 23 Jan 2015 20:47:00 -0500
+Subject: net: llc: use correct size for sysctl timeout entries
+
+From: Sasha Levin <sasha.levin@oracle.com>
+
+commit 6b8d9117ccb4f81b1244aafa7bc70ef8fa45fc49 upstream.
+
+The timeout entries are sizeof(int) rather than sizeof(long), which
+means that when they were getting read we'd also leak kernel memory
+to userspace along with the timeout values.
+
+Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/llc/sysctl_net_llc.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/net/llc/sysctl_net_llc.c
++++ b/net/llc/sysctl_net_llc.c
+@@ -18,28 +18,28 @@ static struct ctl_table llc2_timeout_tab
+       {
+               .procname       = "ack",
+               .data           = &sysctl_llc2_ack_timeout,
+-              .maxlen         = sizeof(long),
++              .maxlen         = sizeof(sysctl_llc2_ack_timeout),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_jiffies,
+       },
+       {
+               .procname       = "busy",
+               .data           = &sysctl_llc2_busy_timeout,
+-              .maxlen         = sizeof(long),
++              .maxlen         = sizeof(sysctl_llc2_busy_timeout),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_jiffies,
+       },
+       {
+               .procname       = "p",
+               .data           = &sysctl_llc2_p_timeout,
+-              .maxlen         = sizeof(long),
++              .maxlen         = sizeof(sysctl_llc2_p_timeout),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_jiffies,
+       },
+       {
+               .procname       = "rej",
+               .data           = &sysctl_llc2_rej_timeout,
+-              .maxlen         = sizeof(long),
++              .maxlen         = sizeof(sysctl_llc2_rej_timeout),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_jiffies,
+       },
diff --git a/queue-3.10/net-rds-use-correct-size-for-max-unacked-packets-and-bytes.patch b/queue-3.10/net-rds-use-correct-size-for-max-unacked-packets-and-bytes.patch
new file mode 100644 (file)
index 0000000..cbbad53
--- /dev/null
@@ -0,0 +1,42 @@
+From db27ebb111e9f69efece08e4cb6a34ff980f8896 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sasha.levin@oracle.com>
+Date: Tue, 3 Feb 2015 08:55:58 -0500
+Subject: net: rds: use correct size for max unacked packets and bytes
+
+From: Sasha Levin <sasha.levin@oracle.com>
+
+commit db27ebb111e9f69efece08e4cb6a34ff980f8896 upstream.
+
+Max unacked packets/bytes is an int while sizeof(long) was used in the
+sysctl table.
+
+This means that when they were getting read we'd also leak kernel memory
+to userspace along with the timeout values.
+
+Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/rds/sysctl.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/net/rds/sysctl.c
++++ b/net/rds/sysctl.c
+@@ -71,14 +71,14 @@ static ctl_table rds_sysctl_rds_table[]
+       {
+               .procname       = "max_unacked_packets",
+               .data           = &rds_sysctl_max_unacked_packets,
+-              .maxlen         = sizeof(unsigned long),
++              .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec,
+       },
+       {
+               .procname       = "max_unacked_bytes",
+               .data           = &rds_sysctl_max_unacked_bytes,
+-              .maxlen         = sizeof(unsigned long),
++              .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec,
+       },
index 45fb4804e616d465a392d50d5554af96cfac012c..d90890eafba54c48a1291cd99ee72754a223c9ac 100644 (file)
@@ -26,3 +26,7 @@ iscsi-target-fix-oops-when-adding-reject-pdu.patch
 media-s5p-mfc-fix-mmap-support-for-64bit-arch.patch
 core-nfqueue-openvswitch-fix-compilation-warning.patch
 ipc-fix-compat-msgrcv-with-negative-msgtyp.patch
+net-rds-use-correct-size-for-max-unacked-packets-and-bytes.patch
+net-llc-use-correct-size-for-sysctl-timeout-entries.patch
+kernel.h-define-u8-s8-u32-etc.-limits.patch
+ib-mlx4-saturate-roce-port-pma-counters-in-case-of-overflow.patch