summaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lnet
diff options
context:
space:
mode:
authorJiayi Ye2014-10-25 05:40:32 +0200
committerGreg Kroah-Hartman2014-10-27 11:52:37 +0100
commit3247c4e5ef5d78b47bf2b223d2e684e77845431b (patch)
treef7f8921e55c84669105700613b230f739fdefd40 /drivers/staging/lustre/lnet
parentstaging: rtl8723au: Remove duplicated argument to || (diff)
downloadkernel-qcow2-linux-3247c4e5ef5d78b47bf2b223d2e684e77845431b.tar.gz
kernel-qcow2-linux-3247c4e5ef5d78b47bf2b223d2e684e77845431b.tar.xz
kernel-qcow2-linux-3247c4e5ef5d78b47bf2b223d2e684e77845431b.zip
staging: lustre: lnet: klnds: o2iblnd: fix null dereference on failed path in o2iblnd.c
If net is null and failed path is executed, dereference null may happen. This patch fixes it. The following Coccinelle semantic patch was used. @@ expression E, E1; identifier f; statement S1,S2,S3; @@ * if (E == NULL) { ... when != if (E == NULL) S1 else S2 when != E = E1 * E->f ... when any return ...; } else S3 Signed-off-by: Jiayi Ye <yejiayily@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lnet')
-rw-r--r--drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index 045f2beb41d2..bc479a721a60 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -3081,7 +3081,7 @@ kiblnd_startup (lnet_ni_t *ni)
LIBCFS_ALLOC(net, sizeof(*net));
ni->ni_data = net;
if (net == NULL)
- goto failed;
+ goto net_failed;
do_gettimeofday(&tv);
net->ibn_incarnation = (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
@@ -3147,6 +3147,7 @@ failed:
if (net->ibn_dev == NULL && ibdev != NULL)
kiblnd_destroy_dev(ibdev);
+net_failed:
kiblnd_shutdown(ni);
CDEBUG(D_NET, "kiblnd_startup failed\n");