From: Greg Kroah-Hartman Date: Fri, 17 Apr 2015 13:06:54 +0000 (+0200) Subject: 3.10-stable patches X-Git-Tag: v3.10.75~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ef6b0d7ba670af9615f2078a70a2e9fb150ec1d9;p=thirdparty%2Fkernel%2Fstable-queue.git 3.10-stable patches 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 --- 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 index 00000000000..880cc00afa3 --- /dev/null +++ b/queue-3.10/ib-mlx4-saturate-roce-port-pma-counters-in-case-of-overflow.patch @@ -0,0 +1,61 @@ +From 61a3855bb726cbb062ef02a31a832dea455456e0 Mon Sep 17 00:00:00 2001 +From: Majd Dibbiny +Date: Wed, 18 Mar 2015 16:51:37 +0200 +Subject: IB/mlx4: Saturate RoCE port PMA counters in case of overflow + +From: Majd Dibbiny + +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 +Signed-off-by: Eran Ben Elisha +Signed-off-by: Hadar Hen Zion +Signed-off-by: Or Gerlitz +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..7623e818f74 --- /dev/null +++ b/queue-3.10/kernel.h-define-u8-s8-u32-etc.-limits.patch @@ -0,0 +1,45 @@ +From 89a0714106aac7309c7dfa0f004b39e1e89d2942 Mon Sep 17 00:00:00 2001 +From: Alex Elder +Date: Thu, 23 Jan 2014 15:54:00 -0800 +Subject: kernel.h: define u8, s8, u32, etc. limits + +From: Alex Elder + +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 +Cc: Sage Weil +Cc: David Miller +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..80f87fedec2 --- /dev/null +++ b/queue-3.10/net-llc-use-correct-size-for-sysctl-timeout-entries.patch @@ -0,0 +1,56 @@ +From 6b8d9117ccb4f81b1244aafa7bc70ef8fa45fc49 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Jan 2015 20:47:00 -0500 +Subject: net: llc: use correct size for sysctl timeout entries + +From: Sasha Levin + +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 +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..cbbad53643d --- /dev/null +++ b/queue-3.10/net-rds-use-correct-size-for-max-unacked-packets-and-bytes.patch @@ -0,0 +1,42 @@ +From db27ebb111e9f69efece08e4cb6a34ff980f8896 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 3 Feb 2015 08:55:58 -0500 +Subject: net: rds: use correct size for max unacked packets and bytes + +From: Sasha Levin + +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 +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + 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, + }, diff --git a/queue-3.10/series b/queue-3.10/series index 45fb4804e61..d90890eafba 100644 --- a/queue-3.10/series +++ b/queue-3.10/series @@ -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