* [PATCH] ib_srpt: Fix a use-after-free in srpt_close_ch()
@ 2018-07-02 21:08 Bart Van Assche
2018-07-03 20:17 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2018-07-02 21:08 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: Doug Ledford, linux-rdma, Bart Van Assche, stable
Avoid that KASAN reports the following:
BUG: KASAN: use-after-free in srpt_close_ch+0x4f/0x1b0 [ib_srpt]
Read of size 4 at addr ffff880151180cb8 by task check/4681
CPU: 15 PID: 4681 Comm: check Not tainted 4.18.0-rc2-dbg+ #4
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
Call Trace:
dump_stack+0xa4/0xf5
print_address_description+0x6f/0x270
kasan_report+0x241/0x360
__asan_load4+0x78/0x80
srpt_close_ch+0x4f/0x1b0 [ib_srpt]
srpt_set_enabled+0xf7/0x1e0 [ib_srpt]
srpt_tpg_enable_store+0xb8/0x120 [ib_srpt]
configfs_write_file+0x14e/0x1d0 [configfs]
__vfs_write+0xd2/0x3b0
vfs_write+0x101/0x270
ksys_write+0xab/0x120
__x64_sys_write+0x43/0x50
do_syscall_64+0x77/0x230
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Fixes: aaf45bd83eba ("IB/srpt: Detect session shutdown reliably")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: <stable@vger.kernel.org>
---
drivers/infiniband/ulp/srpt/ib_srpt.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 3acb0c16b7ac..e42eec20c631 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -1834,8 +1834,7 @@ static bool srpt_close_ch(struct srpt_rdma_ch *ch)
int ret;
if (!srpt_set_ch_state(ch, CH_DRAINING)) {
- pr_debug("%s-%d: already closed\n", ch->sess_name,
- ch->qp->qp_num);
+ pr_debug("%s: already closed\n", ch->sess_name);
return false;
}
--
2.18.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ib_srpt: Fix a use-after-free in srpt_close_ch()
2018-07-02 21:08 [PATCH] ib_srpt: Fix a use-after-free in srpt_close_ch() Bart Van Assche
@ 2018-07-03 20:17 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2018-07-03 20:17 UTC (permalink / raw)
To: Bart Van Assche; +Cc: Doug Ledford, linux-rdma, stable
On Mon, Jul 02, 2018 at 02:08:18PM -0700, Bart Van Assche wrote:
> Avoid that KASAN reports the following:
>
> BUG: KASAN: use-after-free in srpt_close_ch+0x4f/0x1b0 [ib_srpt]
> Read of size 4 at addr ffff880151180cb8 by task check/4681
>
> CPU: 15 PID: 4681 Comm: check Not tainted 4.18.0-rc2-dbg+ #4
> Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
> Call Trace:
> dump_stack+0xa4/0xf5
> print_address_description+0x6f/0x270
> kasan_report+0x241/0x360
> __asan_load4+0x78/0x80
> srpt_close_ch+0x4f/0x1b0 [ib_srpt]
> srpt_set_enabled+0xf7/0x1e0 [ib_srpt]
> srpt_tpg_enable_store+0xb8/0x120 [ib_srpt]
> configfs_write_file+0x14e/0x1d0 [configfs]
> __vfs_write+0xd2/0x3b0
> vfs_write+0x101/0x270
> ksys_write+0xab/0x120
> __x64_sys_write+0x43/0x50
> do_syscall_64+0x77/0x230
> entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> Fixes: aaf45bd83eba ("IB/srpt: Detect session shutdown reliably")
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: <stable@vger.kernel.org>
> ---
> drivers/infiniband/ulp/srpt/ib_srpt.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Applied to for-next
Thanks,
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-03 20:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-02 21:08 [PATCH] ib_srpt: Fix a use-after-free in srpt_close_ch() Bart Van Assche
2018-07-03 20:17 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).