* [PATCH] IB/hfi1: Incorrect sizing of sge for PIO will OOPs
@ 2019-01-07 14:43 Mike Marciniszyn
0 siblings, 0 replies; 3+ messages in thread
From: Mike Marciniszyn @ 2019-01-07 14:43 UTC (permalink / raw)
To: stable; +Cc: linux-rdma, stable-commits
From: Michael J. Ruhl <michael.j.ruhl@intel.com>
Upstream commit dbc2970caef74e8ff41923d302aa6fb5a4812d0e.
An incorrect sge sizing in the HFI PIO path will cause an OOPs similar to
this:
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [] hfi1_verbs_send_pio+0x3d8/0x530 [hfi1]
PGD 0
Oops: 0000 1 SMP
Call Trace:
? hfi1_verbs_send_dma+0xad0/0xad0 [hfi1]
hfi1_verbs_send+0xdf/0x250 [hfi1]
? make_rc_ack+0xa80/0xa80 [hfi1]
hfi1_do_send+0x192/0x430 [hfi1]
hfi1_do_send_from_rvt+0x10/0x20 [hfi1]
rvt_post_send+0x369/0x820 [rdmavt]
ib_uverbs_post_send+0x317/0x570 [ib_uverbs]
ib_uverbs_write+0x26f/0x420 [ib_uverbs]
? security_file_permission+0x21/0xa0
vfs_write+0xbd/0x1e0
? mntput+0x24/0x40
SyS_write+0x7f/0xe0
system_call_fastpath+0x16/0x1b
Fix by adding the missing sizing check to correctly determine the sge
length.
[adjusted path for different update_sge]
Fixes: 7724105686e7 ("IB/hfi1: add driver files")
Cc: <stable@vger.kernel.org> # 4.9.x
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@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>
---
drivers/infiniband/hw/hfi1/verbs.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c
index 14ddb75..d9c7175 100644
--- a/drivers/infiniband/hw/hfi1/verbs.c
+++ b/drivers/infiniband/hw/hfi1/verbs.c
@@ -1088,6 +1088,8 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps,
if (slen > len)
slen = len;
+ if (slen > ss->sge.sge_length)
+ slen = ss->sge.sge_length;
update_sge(ss, slen);
seg_pio_copy_mid(pbuf, addr, slen);
len -= slen;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] IB/hfi1: Incorrect sizing of sge for PIO will OOPs
2019-01-02 17:59 Mike Marciniszyn
@ 2019-01-05 8:22 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2019-01-05 8:22 UTC (permalink / raw)
To: Mike Marciniszyn; +Cc: stable, linux-rdma, stable-commits
On Wed, Jan 02, 2019 at 09:59:10AM -0800, Mike Marciniszyn wrote:
> From: Michael J. Ruhl <michael.j.ruhl@intel.com>
>
> Upstream commit dbc2970caef74e8ff41923d302aa6fb5a4812d0e.
>
> An incorrect sge sizing in the HFI PIO path will cause an OOPs similar to
> this:
>
> BUG: unable to handle kernel NULL pointer dereference at (null)
> IP: [] hfi1_verbs_send_pio+0x3d8/0x530 [hfi1]
> PGD 0
> Oops: 0000 1 SMP
> Call Trace:
> ? hfi1_verbs_send_dma+0xad0/0xad0 [hfi1]
> hfi1_verbs_send+0xdf/0x250 [hfi1]
> ? make_rc_ack+0xa80/0xa80 [hfi1]
> hfi1_do_send+0x192/0x430 [hfi1]
> hfi1_do_send_from_rvt+0x10/0x20 [hfi1]
> rvt_post_send+0x369/0x820 [rdmavt]
> ib_uverbs_post_send+0x317/0x570 [ib_uverbs]
> ib_uverbs_write+0x26f/0x420 [ib_uverbs]
> ? security_file_permission+0x21/0xa0
> vfs_write+0xbd/0x1e0
> ? mntput+0x24/0x40
> SyS_write+0x7f/0xe0
> system_call_fastpath+0x16/0x1b
>
> Fix by adding the missing sizing check to correctly determine the sge
> length.
>
> Fixes: 7724105686e7 ("IB/hfi1: add driver files")
> Cc: <stable@vger.kernel.org> # 4.9.x+
This fails to apply to 4.9.y :(
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] IB/hfi1: Incorrect sizing of sge for PIO will OOPs
@ 2019-01-02 17:59 Mike Marciniszyn
2019-01-05 8:22 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Mike Marciniszyn @ 2019-01-02 17:59 UTC (permalink / raw)
To: stable; +Cc: linux-rdma, stable-commits
From: Michael J. Ruhl <michael.j.ruhl@intel.com>
Upstream commit dbc2970caef74e8ff41923d302aa6fb5a4812d0e.
An incorrect sge sizing in the HFI PIO path will cause an OOPs similar to
this:
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [] hfi1_verbs_send_pio+0x3d8/0x530 [hfi1]
PGD 0
Oops: 0000 1 SMP
Call Trace:
? hfi1_verbs_send_dma+0xad0/0xad0 [hfi1]
hfi1_verbs_send+0xdf/0x250 [hfi1]
? make_rc_ack+0xa80/0xa80 [hfi1]
hfi1_do_send+0x192/0x430 [hfi1]
hfi1_do_send_from_rvt+0x10/0x20 [hfi1]
rvt_post_send+0x369/0x820 [rdmavt]
ib_uverbs_post_send+0x317/0x570 [ib_uverbs]
ib_uverbs_write+0x26f/0x420 [ib_uverbs]
? security_file_permission+0x21/0xa0
vfs_write+0xbd/0x1e0
? mntput+0x24/0x40
SyS_write+0x7f/0xe0
system_call_fastpath+0x16/0x1b
Fix by adding the missing sizing check to correctly determine the sge
length.
Fixes: 7724105686e7 ("IB/hfi1: add driver files")
Cc: <stable@vger.kernel.org> # 4.9.x+
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@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>
---
drivers/infiniband/hw/hfi1/verbs.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c
index a365089..b7257d7 100644
--- a/drivers/infiniband/hw/hfi1/verbs.c
+++ b/drivers/infiniband/hw/hfi1/verbs.c
@@ -919,6 +919,8 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps,
if (slen > len)
slen = len;
+ if (slen > ss->sge.sge_length)
+ slen = ss->sge.sge_length;
rvt_update_sge(ss, slen, false);
seg_pio_copy_mid(pbuf, addr, slen);
len -= slen;
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-07 14:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-07 14:43 [PATCH] IB/hfi1: Incorrect sizing of sge for PIO will OOPs Mike Marciniszyn
-- strict thread matches above, loose matches on Subject: below --
2019-01-02 17:59 Mike Marciniszyn
2019-01-05 8:22 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.