All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH infiniband-diags] perfquery: Fix timeout on nodes supporting RS_FEC capability
@ 2015-09-01 12:28 Hal Rosenstock
       [not found] ` <55E599F6.2000503-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Hal Rosenstock @ 2015-09-01 12:28 UTC (permalink / raw)
  To: Ira Weiny; +Cc: linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)

>From 0e8341980ca7133fe0a472fddc1c622f766b8f8e Mon Sep 17 00:00:00 2001
From: Dan Ben Yosef <danby-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Date: Mon, 31 Aug 2015 10:49:04 +0300

perfquery -T (print Extended Speed Counters) times out on nodes
supporting RS_FEC capability.

Before sending ExtendedSpeedCounters PerfMgt GMP, perfquery sends
PortInfoExtended SMP to get CapMask and FECModeActive fields.
Upon reception of PortInfoExtended SMP, fec_mode_active field is
erroneously decoded to 16 bit buffer instead of 32 bit buffer.
As a result, memory corruption occurs and portid.dlid field is set to 0,
so that ExtendedSpeedCounters GMP is sent to wrong destination.

Signed-off-by: Dan Ben Yosef <danby-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 src/perfquery.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/perfquery.c b/src/perfquery.c
index 46451ef..9e3a307 100644
--- a/src/perfquery.c
+++ b/src/perfquery.c
@@ -469,7 +469,7 @@ static uint8_t is_rsfec_mode_active(ib_portid_t * portid, int port,
 				  uint16_t cap_mask)
 {
 	uint8_t data[IB_SMP_DATA_SIZE] = { 0 };
-	uint16_t fec_mode_active = 0;
+	uint32_t fec_mode_active = 0;
 	uint32_t pie_capmask = 0;
 	if (cap_mask & IS_PM_RSFEC_COUNTERS_SUP) {
 		if (!is_port_info_extended_supported(portid, port, srcport)) {
@@ -486,7 +486,7 @@ static uint8_t is_rsfec_mode_active(ib_portid_t * portid, int port,
 				 &fec_mode_active);
 		if((pie_capmask &
 		    CL_NTOH32(IB_PORT_EXT_CAP_IS_FEC_MODE_SUPPORTED)) &&
-		   (CL_NTOH16(IB_PORT_EXT_RS_FEC_MODE_ACTIVE) == fec_mode_active))
+		   (CL_NTOH16(IB_PORT_EXT_RS_FEC_MODE_ACTIVE) == (fec_mode_active & 0xffff)))
 			return 1;
 	}
 
-- 
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH infiniband-diags] perfquery: Fix timeout on nodes supporting RS_FEC capability
       [not found] ` <55E599F6.2000503-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
@ 2015-09-19 22:56   ` ira.weiny
  0 siblings, 0 replies; 2+ messages in thread
From: ira.weiny @ 2015-09-19 22:56 UTC (permalink / raw)
  To: Hal Rosenstock
  Cc: linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)

On Tue, Sep 01, 2015 at 08:28:38AM -0400, Hal Rosenstock wrote:
> From 0e8341980ca7133fe0a472fddc1c622f766b8f8e Mon Sep 17 00:00:00 2001
> From: Dan Ben Yosef <danby-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Date: Mon, 31 Aug 2015 10:49:04 +0300
> 
> perfquery -T (print Extended Speed Counters) times out on nodes
> supporting RS_FEC capability.
> 
> Before sending ExtendedSpeedCounters PerfMgt GMP, perfquery sends
> PortInfoExtended SMP to get CapMask and FECModeActive fields.
> Upon reception of PortInfoExtended SMP, fec_mode_active field is
> erroneously decoded to 16 bit buffer instead of 32 bit buffer.
> As a result, memory corruption occurs and portid.dlid field is set to 0,
> so that ExtendedSpeedCounters GMP is sent to wrong destination.
> 
> Signed-off-by: Dan Ben Yosef <danby-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Thanks applied,
Ira

> ---
>  src/perfquery.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/perfquery.c b/src/perfquery.c
> index 46451ef..9e3a307 100644
> --- a/src/perfquery.c
> +++ b/src/perfquery.c
> @@ -469,7 +469,7 @@ static uint8_t is_rsfec_mode_active(ib_portid_t * portid, int port,
>  				  uint16_t cap_mask)
>  {
>  	uint8_t data[IB_SMP_DATA_SIZE] = { 0 };
> -	uint16_t fec_mode_active = 0;
> +	uint32_t fec_mode_active = 0;
>  	uint32_t pie_capmask = 0;
>  	if (cap_mask & IS_PM_RSFEC_COUNTERS_SUP) {
>  		if (!is_port_info_extended_supported(portid, port, srcport)) {
> @@ -486,7 +486,7 @@ static uint8_t is_rsfec_mode_active(ib_portid_t * portid, int port,
>  				 &fec_mode_active);
>  		if((pie_capmask &
>  		    CL_NTOH32(IB_PORT_EXT_CAP_IS_FEC_MODE_SUPPORTED)) &&
> -		   (CL_NTOH16(IB_PORT_EXT_RS_FEC_MODE_ACTIVE) == fec_mode_active))
> +		   (CL_NTOH16(IB_PORT_EXT_RS_FEC_MODE_ACTIVE) == (fec_mode_active & 0xffff)))
>  			return 1;
>  	}
>  
> -- 
> 1.7.8.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-19 22:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-01 12:28 [PATCH infiniband-diags] perfquery: Fix timeout on nodes supporting RS_FEC capability Hal Rosenstock
     [not found] ` <55E599F6.2000503-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-09-19 22:56   ` ira.weiny

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.