Commit 2b51cb03 authored by Dmitry Eremin's avatar Dmitry Eremin Committed by Greg Kroah-Hartman

staging: lustre: fix socklnd issues found by Klocwork Insight tool

Null pointer 'best_iface' that comes from line 802 may be
dereferenced at line 832.
Signed-off-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
Reviewed-on: http://review.whamcloud.com/9386Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarIsaac Huang <he.huang@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0d923635
...@@ -804,6 +804,8 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips) ...@@ -804,6 +804,8 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips)
ip = peer->ksnp_passive_ips[i]; ip = peer->ksnp_passive_ips[i];
best_iface = ksocknal_ip2iface(peer->ksnp_ni, ip); best_iface = ksocknal_ip2iface(peer->ksnp_ni, ip);
/* peer passive ips are kept up to date */
LASSERT(best_iface);
} else { } else {
/* choose a new interface */ /* choose a new interface */
LASSERT(i == peer->ksnp_n_passive_ips); LASSERT(i == peer->ksnp_n_passive_ips);
...@@ -838,6 +840,8 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips) ...@@ -838,6 +840,8 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips)
best_npeers = iface->ksni_npeers; best_npeers = iface->ksni_npeers;
} }
LASSERT(best_iface);
best_iface->ksni_npeers++; best_iface->ksni_npeers++;
ip = best_iface->ksni_ipaddr; ip = best_iface->ksni_ipaddr;
peer->ksnp_passive_ips[i] = ip; peer->ksnp_passive_ips[i] = ip;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment