Hi Doug and Jason,
Here are a couple patches that we'd like to get into 4.18 rc cycle. These fix bugs and aren't too complex. One of them is an issue that Dan Carpenter just reported recently and is marked for stable.
---
Michael J. Ruhl (3): IB/hfi1: Set in_use_ctxts bits for user ctxts only IB/hfi1: Remove incorrect call to do_interrupt callback IB/hfi1: Fix incorrect mixing of ERR_PTR and NULL return values
drivers/infiniband/hw/hfi1/chip.c | 30 +++++++++++++++++------------- drivers/infiniband/hw/hfi1/file_ops.c | 4 ++++ drivers/infiniband/hw/hfi1/init.c | 1 - drivers/infiniband/hw/hfi1/rc.c | 2 +- drivers/infiniband/hw/hfi1/uc.c | 4 ++-- drivers/infiniband/hw/hfi1/ud.c | 4 ++-- drivers/infiniband/hw/hfi1/verbs_txreq.c | 4 ++-- drivers/infiniband/hw/hfi1/verbs_txreq.h | 4 ++-- 8 files changed, 30 insertions(+), 23 deletions(-)
-- -Denny
From: Michael J. Ruhl michael.j.ruhl@intel.com
The __get_txreq() function can return a pointer, ERR_PTR(-EBUSY), or NULL. All of the relevant call sites look for IS_ERR, so the NULL return would lead to a NULL pointer exception.
Do not use the ERR_PTR mechanism for this function.
Update all call sites to handle the return value correctly.
Clean up error paths to reflect return value.
cc: stable@vger.kernel.org # 4.9.x+ Reported-by: Dan Carpenter dan.carpenter@oracle.com Reviewed-by: Mike Marciniszyn mike.marciniszyn@intel.com Reviewed-by: Kamenee Arumugam kamenee.arumugam@intel.com Signed-off-by: Michael J. Ruhl michael.j.ruhl@intel.com Signed-off-by: Dennis Dalessandro dennis.dalessandro@intel.com --- drivers/infiniband/hw/hfi1/rc.c | 2 +- drivers/infiniband/hw/hfi1/uc.c | 4 ++-- drivers/infiniband/hw/hfi1/ud.c | 4 ++-- drivers/infiniband/hw/hfi1/verbs_txreq.c | 4 ++-- drivers/infiniband/hw/hfi1/verbs_txreq.h | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c index 1d31bd2..9bd63ab 100644 --- a/drivers/infiniband/hw/hfi1/rc.c +++ b/drivers/infiniband/hw/hfi1/rc.c @@ -271,7 +271,7 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
lockdep_assert_held(&qp->s_lock); ps->s_txreq = get_txreq(ps->dev, qp); - if (IS_ERR(ps->s_txreq)) + if (!ps->s_txreq) goto bail_no_tx;
if (priv->hdr_type == HFI1_PKT_TYPE_9B) { diff --git a/drivers/infiniband/hw/hfi1/uc.c b/drivers/infiniband/hw/hfi1/uc.c index b7b6710..e254dce 100644 --- a/drivers/infiniband/hw/hfi1/uc.c +++ b/drivers/infiniband/hw/hfi1/uc.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2015, 2016 Intel Corporation. + * Copyright(c) 2015 - 2018 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. @@ -72,7 +72,7 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) int middle = 0;
ps->s_txreq = get_txreq(ps->dev, qp); - if (IS_ERR(ps->s_txreq)) + if (!ps->s_txreq) goto bail_no_tx;
if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_SEND_OK)) { diff --git a/drivers/infiniband/hw/hfi1/ud.c b/drivers/infiniband/hw/hfi1/ud.c index 1ab332f..70d39fc 100644 --- a/drivers/infiniband/hw/hfi1/ud.c +++ b/drivers/infiniband/hw/hfi1/ud.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2015, 2016 Intel Corporation. + * Copyright(c) 2015 - 2018 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. @@ -503,7 +503,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) u32 lid;
ps->s_txreq = get_txreq(ps->dev, qp); - if (IS_ERR(ps->s_txreq)) + if (!ps->s_txreq) goto bail_no_tx;
if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_NEXT_SEND_OK)) { diff --git a/drivers/infiniband/hw/hfi1/verbs_txreq.c b/drivers/infiniband/hw/hfi1/verbs_txreq.c index 873e48e..c4ab2d5 100644 --- a/drivers/infiniband/hw/hfi1/verbs_txreq.c +++ b/drivers/infiniband/hw/hfi1/verbs_txreq.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2016 - 2017 Intel Corporation. + * Copyright(c) 2016 - 2018 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. @@ -94,7 +94,7 @@ struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev, struct rvt_qp *qp) __must_hold(&qp->s_lock) { - struct verbs_txreq *tx = ERR_PTR(-EBUSY); + struct verbs_txreq *tx = NULL;
write_seqlock(&dev->txwait_lock); if (ib_rvt_state_ops[qp->state] & RVT_PROCESS_RECV_OK) { diff --git a/drivers/infiniband/hw/hfi1/verbs_txreq.h b/drivers/infiniband/hw/hfi1/verbs_txreq.h index 729244c..1c19bbc 100644 --- a/drivers/infiniband/hw/hfi1/verbs_txreq.h +++ b/drivers/infiniband/hw/hfi1/verbs_txreq.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2016 Intel Corporation. + * Copyright(c) 2016 - 2018 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. @@ -83,7 +83,7 @@ struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev, if (unlikely(!tx)) { /* call slow path to get the lock */ tx = __get_txreq(dev, qp); - if (IS_ERR(tx)) + if (!tx) return tx; } tx->qp = qp;
On 6/20/2018 12:29 PM, Dennis Dalessandro wrote:
From: Michael J. Ruhl michael.j.ruhl@intel.com
The __get_txreq() function can return a pointer, ERR_PTR(-EBUSY), or NULL. All of the relevant call sites look for IS_ERR, so the NULL return would lead to a NULL pointer exception.
Do not use the ERR_PTR mechanism for this function.
Update all call sites to handle the return value correctly.
Clean up error paths to reflect return value.
cc: stable@vger.kernel.org # 4.9.x+ Reported-by: Dan Carpenter dan.carpenter@oracle.com Reviewed-by: Mike Marciniszyn mike.marciniszyn@intel.com Reviewed-by: Kamenee Arumugam kamenee.arumugam@intel.com Signed-off-by: Michael J. Ruhl michael.j.ruhl@intel.com Signed-off-by: Dennis Dalessandro dennis.dalessandro@intel.com
Fixes: 45842abbb292 ("staging/rdma/hfi1: move txreq header code")
-Denny
On Tue, Jun 26, 2018 at 11:19:19AM -0400, Dennis Dalessandro wrote:
On 6/20/2018 12:29 PM, Dennis Dalessandro wrote:
From: Michael J. Ruhl michael.j.ruhl@intel.com
The __get_txreq() function can return a pointer, ERR_PTR(-EBUSY), or NULL. All of the relevant call sites look for IS_ERR, so the NULL return would lead to a NULL pointer exception.
Do not use the ERR_PTR mechanism for this function.
Update all call sites to handle the return value correctly.
Clean up error paths to reflect return value.
cc: stable@vger.kernel.org # 4.9.x+ Reported-by: Dan Carpenter dan.carpenter@oracle.com Reviewed-by: Mike Marciniszyn mike.marciniszyn@intel.com Reviewed-by: Kamenee Arumugam kamenee.arumugam@intel.com Signed-off-by: Michael J. Ruhl michael.j.ruhl@intel.com Signed-off-by: Dennis Dalessandro dennis.dalessandro@intel.com
Fixes: 45842abbb292 ("staging/rdma/hfi1: move txreq header code")
Okay, I applied this to for-rc
Thanks, Jason
Doh! Sorry about that, forgot to type an actual subject. Don't think it merits a re-send of the series though.
-Denny
On 6/20/2018 12:28 PM, Dennis Dalessandro wrote:
Hi Doug and Jason,
Here are a couple patches that we'd like to get into 4.18 rc cycle. These fix bugs and aren't too complex. One of them is an issue that Dan Carpenter just reported recently and is marked for stable.
Michael J. Ruhl (3): IB/hfi1: Set in_use_ctxts bits for user ctxts only IB/hfi1: Remove incorrect call to do_interrupt callback IB/hfi1: Fix incorrect mixing of ERR_PTR and NULL return values
drivers/infiniband/hw/hfi1/chip.c | 30 +++++++++++++++++------------- drivers/infiniband/hw/hfi1/file_ops.c | 4 ++++ drivers/infiniband/hw/hfi1/init.c | 1 - drivers/infiniband/hw/hfi1/rc.c | 2 +- drivers/infiniband/hw/hfi1/uc.c | 4 ++-- drivers/infiniband/hw/hfi1/ud.c | 4 ++-- drivers/infiniband/hw/hfi1/verbs_txreq.c | 4 ++-- drivers/infiniband/hw/hfi1/verbs_txreq.h | 4 ++-- 8 files changed, 30 insertions(+), 23 deletions(-)
--
-Denny
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Jun 20, 2018 at 09:28:39AM -0700, Dennis Dalessandro wrote:
Hi Doug and Jason,
Here are a couple patches that we'd like to get into 4.18 rc cycle. These fix bugs and aren't too complex. One of them is an issue that Dan Carpenter just reported recently and is marked for stable.
All of these need Fixes lines for-rc and other than the last one the commit messages are not good enough - talk about what user visible effect this bug has.
Jason
On 6/20/2018 2:43 PM, Jason Gunthorpe wrote:
On Wed, Jun 20, 2018 at 09:28:39AM -0700, Dennis Dalessandro wrote:
Hi Doug and Jason,
Here are a couple patches that we'd like to get into 4.18 rc cycle. These fix bugs and aren't too complex. One of them is an issue that Dan Carpenter just reported recently and is marked for stable.
All of these need Fixes lines for-rc and other than the last one the commit messages are not good enough - talk about what user visible effect this bug has.
I talked to Mike and we are good with pushing the first two off till for-next. We'll make some commit message improvements and send a v2 for those.
The last one we still want for -rc. I replied to the patch with a fixes line, I think patchworks will append it for you won't it?
-Denny
On Tue, Jun 26, 2018 at 11:20:12AM -0400, Dennis Dalessandro wrote:
On 6/20/2018 2:43 PM, Jason Gunthorpe wrote:
On Wed, Jun 20, 2018 at 09:28:39AM -0700, Dennis Dalessandro wrote:
Hi Doug and Jason,
Here are a couple patches that we'd like to get into 4.18 rc cycle. These fix bugs and aren't too complex. One of them is an issue that Dan Carpenter just reported recently and is marked for stable.
All of these need Fixes lines for-rc and other than the last one the commit messages are not good enough - talk about what user visible effect this bug has.
I talked to Mike and we are good with pushing the first two off till for-next. We'll make some commit message improvements and send a v2 for those.
They could be OK to go to for-rc, but they need to meet the standard, and I can't tell from the commit message. I've dropped them from patchworks, so resend V2.
Jason
linux-stable-mirror@lists.linaro.org