From: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 2/3] opensm/osm_ucast_cache.c: fix crash in osm_ucast_mgr
Date: Sat, 19 May 2012 23:11:57 +0300 [thread overview]
Message-ID: <20120519201157.GG2110@calypso> (raw)
When leaf switch returns, the SM crashed when trying to retrieve lft block
usually p_sw->lft is allocated during the routing calculation.
If use_ucast_cache TRUE and cache is valid the SM skips the routing calculation
and uses the cached lft. In this case p_sw->lft was null.
FIX: allocate p_sw->lft if it is null (cached switch that returns).
Signed-off-by: Tamir Ronen <tamirr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Vladimir Koushnir <vladimirk-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
opensm/osm_ucast_cache.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/opensm/osm_ucast_cache.c b/opensm/osm_ucast_cache.c
index 6e46191..820273a 100644
--- a/opensm/osm_ucast_cache.c
+++ b/opensm/osm_ucast_cache.c
@@ -316,6 +316,8 @@ cache_restore_ucast_info(osm_ucast_mgr_t * p_mgr,
free(p_sw->new_lft);
p_sw->new_lft = p_cache_sw->lft;
p_cache_sw->lft = NULL;
+ p_sw->lft_size = (p_sw->max_lid_ho / IB_SMP_DATA_SIZE + 1)
+ * IB_SMP_DATA_SIZE;
p_sw->num_hops = p_cache_sw->num_hops;
p_cache_sw->num_hops = 0;
@@ -1018,10 +1020,13 @@ int osm_ucast_cache_process(osm_ucast_mgr_t * p_mgr)
item = cl_qmap_next(item)) {
p_sw = (osm_switch_t *) item;
- if (p_sw->need_update && !p_sw->new_lft) {
- /* no new routing was recently calculated for this
- switch, but the LFT needs to be updated anyway */
- p_sw->new_lft = p_sw->lft;
+ if (p_sw->need_update) {
+ if (!p_sw->new_lft)
+ /* no new routing was recently calculated for this
+ switch, but the LFT needs to be updated anyway */
+ p_sw->new_lft = p_sw->lft;
+
+
p_sw->lft = malloc(p_sw->lft_size);
if (!p_sw->lft)
return IB_INSUFFICIENT_MEMORY;
--
1.7.7.6
--
-- Alex
--
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
reply other threads:[~2012-05-19 20:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120519201157.GG2110@calypso \
--to=alexne-vpraknaxozvwk0htik3j/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox