public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [opensm] [PATCH] Fix invalid error check, which lead to segfault
@ 2011-09-01 23:30 Albert Chu
       [not found] ` <1314919847.25283.446.camel-akkeaxHeDKRliZ7u+bvwcg@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Albert Chu @ 2011-09-01 23:30 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 720 bytes --]

This patch fixes a bug from:

commit 350c6e49fe3ee492b397346633dee76d3cad9ade
Author: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Date:   Mon Mar 7 10:03:59 2011 +0000

    opensm: fixed potential memory leak in osm_ucast_ftree()

    Need to free all the allocated variables in case of error.

The invalid error check would lead to sw_create() always returning NULL,
leading to fabric_add_sw() never adding a switch to sw_tbl, leading to
fabric_get_sw_by_guid() always returning NULL (i.e. can't find switch),
leading to rank_leaf_switches() segfaulting.

Al

-- 
Albert Chu
chu11-i2BcT+NCU+M@public.gmane.org
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory


[-- Attachment #2: 0001-Fix-invalid-error-check-which-lead-to-segfault.patch --]
[-- Type: message/rfc822, Size: 1192 bytes --]

From: Albert Chu <chu11-i2BcT+NCU+M@public.gmane.org>
Subject: [PATCH] Fix invalid error check, which lead to segfault
Date: Thu, 1 Sep 2011 16:24:27 -0700
Message-ID: <1314919834.25283.445.camel-akkeaxHeDKRliZ7u+bvwcg@public.gmane.org>

The invalid error check would lead to sw_create() always
returning NULL, leading to fabric_add_sw() never adding a
switch to sw_tbl, leading to fabric_get_sw_by_guid() always
returning NULL (i.e. can't find switch), leading to rank_leaf_switches()
segfaulting.

Signed-off-by: Albert Chu <chu11-i2BcT+NCU+M@public.gmane.org>
---
 opensm/osm_ucast_ftree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/opensm/osm_ucast_ftree.c b/opensm/osm_ucast_ftree.c
index 99a526d..06508c8 100644
--- a/opensm/osm_ucast_ftree.c
+++ b/opensm/osm_ucast_ftree.c
@@ -560,7 +560,7 @@ static ftree_sw_t *sw_create(IN ftree_fabric_t * p_ftree,
 	p_sw->up_port_groups =
 	    (ftree_port_group_t **) malloc(ports_num *
 					   sizeof(ftree_port_group_t *));
-	if (p_sw->sibling_port_groups == NULL)
+	if (p_sw->up_port_groups == NULL)
 		goto FREE_DOWN;
 
 	p_sw->sibling_port_groups =
-- 
1.7.1


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

* Re: [opensm] [PATCH] Fix invalid error check, which lead to segfault
       [not found] ` <1314919847.25283.446.camel-akkeaxHeDKRliZ7u+bvwcg@public.gmane.org>
@ 2011-09-02  6:46   ` Alex Netes
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Netes @ 2011-09-02  6:46 UTC (permalink / raw)
  To: Albert Chu; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Hi Al,

On 16:30 Thu 01 Sep     , Albert Chu wrote:
> This patch fixes a bug from:
> 
> commit 350c6e49fe3ee492b397346633dee76d3cad9ade
> Author: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Date:   Mon Mar 7 10:03:59 2011 +0000
> 
>     opensm: fixed potential memory leak in osm_ucast_ftree()
> 
>     Need to free all the allocated variables in case of error.
> 
> The invalid error check would lead to sw_create() always returning NULL,
> leading to fabric_add_sw() never adding a switch to sw_tbl, leading to
> fabric_get_sw_by_guid() always returning NULL (i.e. can't find switch),
> leading to rank_leaf_switches() segfaulting.
>

Applied, thanks. 
--
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:[~2011-09-02  6:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-01 23:30 [opensm] [PATCH] Fix invalid error check, which lead to segfault Albert Chu
     [not found] ` <1314919847.25283.446.camel-akkeaxHeDKRliZ7u+bvwcg@public.gmane.org>
2011-09-02  6:46   ` Alex Netes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox