[PATCH v3 4/4] staging/lustre/lnet: fix potential null pointer dereference

From: Oleg Drokin
Date: Sun Apr 27 2014 - 22:27:01 EST


Pointer 'ni' checked for NULL at line 1569 may be passed to
function and may be dereferenced there by passing argument 1 to
function 'lnet_ni_notify_locked' at line 1621.
found by Klocwork Insight tool

Signed-off-by: Oleg Drokin <oleg.drokin@xxxxxxxxx>
CC: Dmitry Eremin <dmitry.eremin@xxxxxxxxx>
CC: Liang Zhen <liang.zhen@xxxxxxxxx>
---
drivers/staging/lustre/lnet/lnet/router.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c
index 995f509..926923a 100644
--- a/drivers/staging/lustre/lnet/lnet/router.c
+++ b/drivers/staging/lustre/lnet/lnet/router.c
@@ -145,7 +145,7 @@ lnet_ni_notify_locked(lnet_ni_t *ni, lnet_peer_t *lp)
* NB individual events can be missed; the only guarantee is that you
* always get the most recent news */

- if (lp->lp_notifying)
+ if (lp->lp_notifying || ni == NULL)
return;

lp->lp_notifying = 1;
--
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/