staging/lustre/lnet: fix potential null pointer dereference
authorOleg Drokin <green@linuxhacker.ru>
Mon, 28 Apr 2014 02:25:58 +0000 (22:25 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 May 2014 23:35:21 +0000 (19:35 -0400)
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@intel.com>
CC: Dmitry Eremin <dmitry.eremin@intel.com>
CC: Liang Zhen <liang.zhen@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/lnet/router.c

index 995f50976c429899bab981387ece6df3de02533d..926923a104c559d6343adb070113bb91bce4b880 100644 (file)
@@ -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;