opensm/osm_ucast_lash: fix use after free bug
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 20090922185014.GF24398@me
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 20090925135256.GE26931@me
PATCH 1/1 opensm/osm_ucast_lash: fix use after free bug
When LASH runs its switch structures cleanup OpenSM can rediscover a subnet and 'p_sw' pointer may refer already freed memory, so don't touch it, just free our own stuff. (Note also that for valids OpenSM switches objects' 'priv' pointers are cleared on lash_cleanup()).
--- opensm/opensm/osm_ucast_lash.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
opensm/opensm/osm_ucast_lash.c +1 -4
@@ -628,8 +628,7 @@ static switch_t *switch_create(lash_t * p_lash, unsigned id, osm_switch_t * p_sw } sw->p_sw = p_sw; -if (p_sw) - p_sw->priv = sw; + p_sw->priv = sw;if (osm_mesh_node_create (p_lash, sw)) {free (sw->dij_channels);
@@ -644,8 +643,6 @@ static void switch_delete(lash_t *p_lash, switch_t * sw) {if (sw->dij_channels)free (sw->dij_channels); -if (sw->p_sw) - sw->p_sw->priv =NULL ;free (sw); }
Signature · 1 line
1.6.5.rc1
Hi Sasha,
Quoted 4 lines · Sasha Khapyorsky
When LASH runs its switch structures cleanup OpenSM can rediscover a subnet and '
p_sw' pointer may refer already freed memory, so don't touch it, just free our own stuff. (Note also that for valids OpenSM switches objects' 'priv' pointers are cleared onlash_cleanup()).
This worked for me on the test case that generated my earlier report.
Thanks -- Jim
Quoted 21 lines
--- opensm/opensm/osm_ucast_lash.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)opensm/opensm/osm_ucast_lash.c +1
-2@@ -628,8 +628,7 @@ static switch_t *switch_create(lash_t * p_lash, unsigned id, osm_switch_t * p_sw } sw->p_sw = p_sw; -if (p_sw) - p_sw->priv = sw; + p_sw->priv = sw;if (osm_mesh_node_create (p_lash, sw)) {free (sw->dij_channels);
opensm/opensm/osm_ucast_lash.c static void switch_delete(lash_t *p_lash, switch_t * sw) · line 648
Quoted 8 lines
opensm/opensm/osm_ucast_lash.c +0
-2@@ -644,8 +643,6 @@ static void switch_delete(lash_t *p_lash, switch_t * sw) {if (sw->dij_channels)free (sw->dij_channels); -if (sw->p_sw) - sw->p_sw->priv =NULL ;free (sw); }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Sasha Khapyorsky
When LASH runs its switch structures cleanup OpenSM can rediscover a subnet and '
p_sw' pointer may refer already freed memory, so don't touch it, just free our own stuff. (Note also that for valids OpenSM switches objects' 'priv' pointers are cleared onlash_cleanup()).
Quoted 29 lines
--- opensm/opensm/osm_ucast_lash.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)opensm/opensm/osm_ucast_lash.c +0
-0@@ -628,8 +628,7 @@ static switch_t *switch_create(lash_t * p_lash, unsignedid,
osm_switch_t*p_swopensm/opensm/osm_ucast_lash.c +1
-5} sw->p_sw = p_sw; -if (p_sw) - p_sw->priv = sw; + p_sw->priv = sw;if (osm_mesh_node_create (p_lash, sw)) {free (sw->dij_channels);@@ -644,8 +643,6 @@ static void switch_delete(lash_t *p_lash, switch_t * sw) {if (sw->dij_channels)free (sw->dij_channels); -if (sw->p_sw) - sw->p_sw->priv =NULL ;free (sw); } --
Quoted 3 lines
1.6.5.rc1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html