IB/core: Avoid a potential OOPs for an unused optional parameter
authorMichael J. Ruhl <michael.j.ruhl@intel.com>
Thu, 1 Feb 2018 20:31:06 +0000 (12:31 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Feb 2018 14:42:15 +0000 (15:42 +0100)
commit1d6eb826e65d8b92d1f8cb081b33bb0786a5a4ab
tree0429b400b12d9fcceda1fbb4ed95069cd9c807d7
parentd40ad865704b0a3547ca199acba102020ebb947e
IB/core: Avoid a potential OOPs for an unused optional parameter

commit 2ff124d597c2df8696169ce0006fc974c49a4569 upstream.

The ev_file is an optional parameter for CQ creation. If the parameter
is not passed, the ev_file pointer will be NULL.  Using that pointer
to set the cq_context will result in an OOPs.

Verify that ev_file is not NULL before using.

Cc: <stable@vger.kernel.org> # 4.14.x
Fixes: 9ee79fce3642 ("IB/core: Add completion queue (cq) object actions")
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/core/uverbs_std_types.c