提交 3247c4e5 编写于 作者: J Jiayi Ye 提交者: Greg Kroah-Hartman

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: NJiayi Ye <yejiayily@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 85b4260d
......@@ -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 @@ kiblnd_startup (lnet_ni_t *ni)
if (net->ibn_dev == NULL && ibdev != NULL)
kiblnd_destroy_dev(ibdev);
net_failed:
kiblnd_shutdown(ni);
CDEBUG(D_NET, "kiblnd_startup failed\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册