diff mbox

[2/2] ibacm: Incorrect list used for subnet list causes a segfault

Message ID 20171016141950.11276.59779.stgit@phlsvslse11.ph.intel.com (mailing list archive)
State Superseded
Headers show

Commit Message

Michael J. Ruhl Oct. 16, 2017, 2:19 p.m. UTC
From: Michael J. Ruhl <michael.j.ruhl@intel.com>

Setting the provider keyword in the ibacm_opts.cfg file to something
other than 'default' will cause ibacm to segfault on startup:

ibacm[32739]: segfault at 302e40 ip 000000000040432d
sp 00007ffe4039e1c0 error 4 in ibacm[400000+c000]

To re-produce the segfault, change the provider keyword in
ibacm_opts.cfg from:

provider ibacmp default

to:

provider ibacmp 0xFE80000000000000

When adding subnets to a provider subnet list, the incorrect list is
used.  The list used is the provider_list (list of all providers)
rather than the (specific) provider subnet list.

This corrupts the provider_list, and causes ibacm to crash with the
above segfault.

Use the correct list when adding subnet information to a provider.

Fixes: 26e05f8304a506 ("ibacm: use ccan/list.h")
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
---
 ibacm/src/acm.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


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

Comments

Michael J. Ruhl Oct. 16, 2017, 2:22 p.m. UTC | #1
Missed the versioning information.  Please ignore these two patches.

Resending with the correct information.

> -----Original Message-----

> From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma-

> owner@vger.kernel.org] On Behalf Of Michael J. Ruhl

> Sent: Monday, October 16, 2017 10:20 AM

> To: Hefty, Sean <sean.hefty@intel.com>

> Cc: linux-rdma@vger.kernel.org; hal@dev.mellanox.co.il

> Subject: [PATCH 2/2] ibacm: Incorrect list used for subnet list causes a

> segfault

> 

> From: Michael J. Ruhl <michael.j.ruhl@intel.com>

> 

> Setting the provider keyword in the ibacm_opts.cfg file to something

> other than 'default' will cause ibacm to segfault on startup:

> 

> ibacm[32739]: segfault at 302e40 ip 000000000040432d

> sp 00007ffe4039e1c0 error 4 in ibacm[400000+c000]

> 

> To re-produce the segfault, change the provider keyword in

> ibacm_opts.cfg from:

> 

> provider ibacmp default

> 

> to:

> 

> provider ibacmp 0xFE80000000000000

> 

> When adding subnets to a provider subnet list, the incorrect list is

> used.  The list used is the provider_list (list of all providers)

> rather than the (specific) provider subnet list.

> 

> This corrupts the provider_list, and causes ibacm to crash with the

> above segfault.

> 

> Use the correct list when adding subnet information to a provider.

> 

> Fixes: 26e05f8304a506 ("ibacm: use ccan/list.h")

> Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>

> Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>

> ---

>  ibacm/src/acm.c |    4 ++--

>  1 files changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c

> index 1ccef94..a67001d 100644

> --- a/ibacm/src/acm.c

> +++ b/ibacm/src/acm.c

> @@ -2587,8 +2587,8 @@ static void acm_load_prov_config(void)

>  					return;

>  				}

>  				subnet->subnet_prefix = htobe64(prefix);

> -				list_add_after(&provider_list, &prov->entry,

> -						&subnet->entry);

> +				list_add_tail(&prov->subnet_list,

> +					      &subnet->entry);

>  			}

>  		}

>  	}

> 

> --

> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in

> the body of a message to majordomo@vger.kernel.org

> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index 1ccef94..a67001d 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -2587,8 +2587,8 @@  static void acm_load_prov_config(void)
 					return;
 				}
 				subnet->subnet_prefix = htobe64(prefix);
-				list_add_after(&provider_list, &prov->entry,
-						&subnet->entry);
+				list_add_tail(&prov->subnet_list,
+					      &subnet->entry);
 			}
 		}
 	}