[lustre-devel] [PATCH 28/34] LU-7734 lnet: Fix crash in router_proc.c

NeilBrown neilb at suse.com
Mon Sep 24 18:07:15 PDT 2018


From: Amir Shehata <amir.shehata at intel.com>

Fixed NULL access in the case when a peer is a remote
peer. In that case lpni_net is NULL.

Signed-off-by: Amir Shehata <amir.shehata at intel.com>
Change-Id: Ida234ff016b2bdc305acf74df0f99600d2555e27
Reviewed-on: http://review.whamcloud.com/21327
Signed-off-by: NeilBrown <neilb at suse.com>
---
 drivers/staging/lustre/lnet/lnet/router_proc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/lnet/router_proc.c b/drivers/staging/lustre/lnet/lnet/router_proc.c
index 977a937f261c..a887ca446d42 100644
--- a/drivers/staging/lustre/lnet/lnet/router_proc.c
+++ b/drivers/staging/lustre/lnet/lnet/router_proc.c
@@ -492,7 +492,8 @@ static int proc_lnet_peers(struct ctl_table *table, int write,
 			int nrefs = atomic_read(&peer->lpni_refcount);
 			time64_t lastalive = -1;
 			char *aliveness = "NA";
-			int maxcr = peer->lpni_net->net_tunables.lct_peer_tx_credits;
+			int maxcr = peer->lpni_net ?
+				peer->lpni_net->net_tunables.lct_peer_tx_credits : 0;
 			int txcr = peer->lpni_txcredits;
 			int mintxcr = peer->lpni_mintxcredits;
 			int rtrcr = peer->lpni_rtrcredits;




More information about the lustre-devel mailing list