]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.6.5/ib-rdmavt-correct-qp_priv_alloc-return-value-test.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.5 / ib-rdmavt-correct-qp_priv_alloc-return-value-test.patch
CommitLineData
700b5fa6
GKH
1From c755f4afa66ad3ed98870bd3254f37c47fb2c800 Mon Sep 17 00:00:00 2001
2From: Mike Marciniszyn <mike.marciniszyn@intel.com>
3Date: Wed, 22 Jun 2016 13:29:33 -0700
4Subject: IB/rdmavt: Correct qp_priv_alloc() return value test
5
6From: Mike Marciniszyn <mike.marciniszyn@intel.com>
7
8commit c755f4afa66ad3ed98870bd3254f37c47fb2c800 upstream.
9
10The current drivers return errors from this calldown
11wrapped in an ERR_PTR().
12
13The rdmavt code incorrectly tests for NULL.
14
15The code is fixed to use IS_ERR() and change ret according
16to the driver return value.
17
18Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
19Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
20Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
21Signed-off-by: Doug Ledford <dledford@redhat.com>
22Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23
24---
25 drivers/infiniband/sw/rdmavt/qp.c | 4 +++-
26 include/rdma/rdma_vt.h | 4 +++-
27 2 files changed, 6 insertions(+), 2 deletions(-)
28
29--- a/drivers/infiniband/sw/rdmavt/qp.c
30+++ b/drivers/infiniband/sw/rdmavt/qp.c
31@@ -683,8 +683,10 @@ struct ib_qp *rvt_create_qp(struct ib_pd
32 * initialization that is needed.
33 */
34 priv = rdi->driver_f.qp_priv_alloc(rdi, qp, gfp);
35- if (!priv)
36+ if (IS_ERR(priv)) {
37+ ret = priv;
38 goto bail_qp;
39+ }
40 qp->priv = priv;
41 qp->timeout_jiffies =
42 usecs_to_jiffies((4096UL * (1UL << qp->timeout)) /
43--- a/include/rdma/rdma_vt.h
44+++ b/include/rdma/rdma_vt.h
45@@ -203,7 +203,9 @@ struct rvt_driver_provided {
46
47 /*
48 * Allocate a private queue pair data structure for driver specific
49- * information which is opaque to rdmavt.
50+ * information which is opaque to rdmavt. Errors are returned via
51+ * ERR_PTR(err). The driver is free to return NULL or a valid
52+ * pointer.
53 */
54 void * (*qp_priv_alloc)(struct rvt_dev_info *rdi, struct rvt_qp *qp,
55 gfp_t gfp);