]>
Commit | Line | Data |
---|---|---|
700b5fa6 GKH |
1 | From c755f4afa66ad3ed98870bd3254f37c47fb2c800 Mon Sep 17 00:00:00 2001 |
2 | From: Mike Marciniszyn <mike.marciniszyn@intel.com> | |
3 | Date: Wed, 22 Jun 2016 13:29:33 -0700 | |
4 | Subject: IB/rdmavt: Correct qp_priv_alloc() return value test | |
5 | ||
6 | From: Mike Marciniszyn <mike.marciniszyn@intel.com> | |
7 | ||
8 | commit c755f4afa66ad3ed98870bd3254f37c47fb2c800 upstream. | |
9 | ||
10 | The current drivers return errors from this calldown | |
11 | wrapped in an ERR_PTR(). | |
12 | ||
13 | The rdmavt code incorrectly tests for NULL. | |
14 | ||
15 | The code is fixed to use IS_ERR() and change ret according | |
16 | to the driver return value. | |
17 | ||
18 | Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> | |
19 | Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com> | |
20 | Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> | |
21 | Signed-off-by: Doug Ledford <dledford@redhat.com> | |
22 | Signed-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); |