From: Jia-Ju Bai <baijiaju1990@163.com>
To: monis@mellanox.com, sean.hefty@intel.com, dledford@redhat.com,
hal.rosenstock@gmail.com, yuval.shaia@oracle.com
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
Jia-Ju Bai <baijiaju1990@163.com>
Subject: [PATCH V4] rxe: Fix a sleep-in-atomic bug in post_one_send
Date: Mon, 5 Jun 2017 17:39:48 +0800 [thread overview]
Message-ID: <1496655588-5598-1-git-send-email-baijiaju1990@163.com> (raw)
The driver may sleep under a spin lock, and the function call path is:
post_one_send (acquire the lock by spin_lock_irqsave)
init_send_wqe
copy_from_user --> may sleep
There is no flow that makes "qp->is_user" true, and copy_from_user may
cause bug when a non-user pointer is used. So, the line of copy_from_user
is removed.
Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
V4:
* Remove the line of copy_from_user.
V3:
* It corrects the mistakes of remaining legacy code in V2.
(Thank Ram for pointing it out)
V2:
* The parameter "flags" is added to restore and save the irq status.
Thank Leon for good advice.
---
drivers/infiniband/sw/rxe/rxe_verbs.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 83d709e..7c52c7c 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -740,11 +740,7 @@ static int init_send_wqe(struct rxe_qp *qp, struct ib_send_wr *ibwr,
sge = ibwr->sg_list;
for (i = 0; i < num_sge; i++, sge++) {
- if (qp->is_user && copy_from_user(p, (__user void *)
- (uintptr_t)sge->addr, sge->length))
- return -EFAULT;
-
- else if (!qp->is_user)
+ if (!qp->is_user)
memcpy(p, (void *)(uintptr_t)sge->addr,
sge->length);
--
1.7.9.5
next reply other threads:[~2017-06-05 9:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-05 9:39 Jia-Ju Bai [this message]
2017-06-05 10:12 ` Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1496655588-5598-1-git-send-email-baijiaju1990@163.com \
--to=baijiaju1990@163.com \
--cc=dledford@redhat.com \
--cc=hal.rosenstock@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=monis@mellanox.com \
--cc=sean.hefty@intel.com \
--cc=yuval.shaia@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®