Blame SOURCES/0002-ibacm-incorrect-list-used-for.patch

95af3a
commit f3a969b4542204c9b09d5c2d229c7b55aaa0995e
95af3a
Author: Michael J. Ruhl <michael.j.ruhl@intel.com>
95af3a
Date:   Mon Oct 16 10:24:40 2017 -0400
95af3a
95af3a
    ibacm: Incorrect list used for subnet list causes a segfault
95af3a
    
95af3a
    Setting the provider keyword in the ibacm_opts.cfg file to something
95af3a
    other than 'default' will cause ibacm to segfault on startup:
95af3a
    
95af3a
    ibacm[32739]: segfault at 302e40 ip 000000000040432d
95af3a
    sp 00007ffe4039e1c0 error 4 in ibacm[400000+c000]
95af3a
    
95af3a
    To re-produce the segfault, change the provider keyword in
95af3a
    ibacm_opts.cfg from:
95af3a
    
95af3a
    provider ibacmp default
95af3a
    
95af3a
    to:
95af3a
    
95af3a
    provider ibacmp 0xFE80000000000000
95af3a
    
95af3a
    When adding subnets to a provider subnet list, the incorrect list is
95af3a
    used.  The list used is the provider_list (list of all providers)
95af3a
    rather than the (specific) provider subnet list.
95af3a
    
95af3a
    This corrupts the provider_list, and causes ibacm to crash with the
95af3a
    above segfault.
95af3a
    
95af3a
    Use the correct list when adding subnet information to a provider.
95af3a
    
95af3a
    Fixes: 26e05f8304a506 ("ibacm: use ccan/list.h")
95af3a
    Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
95af3a
    Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
95af3a
    Tested-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
95af3a
    Signed-off-by: Doug Ledford <dledford@redhat.com>
95af3a
95af3a
diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
95af3a
index 1ccef948..a67001d4 100644
95af3a
--- a/ibacm/src/acm.c
95af3a
+++ b/ibacm/src/acm.c
95af3a
@@ -2587,8 +2587,8 @@ static void acm_load_prov_config(void)
95af3a
 					return;
95af3a
 				}
95af3a
 				subnet->subnet_prefix = htobe64(prefix);
95af3a
-				list_add_after(&provider_list, &prov->entry,
95af3a
-						&subnet->entry);
95af3a
+				list_add_tail(&prov->subnet_list,
95af3a
+					      &subnet->entry);
95af3a
 			}
95af3a
 		}
95af3a
 	}