All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
To: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] IB/srp: Fix possible use-after-free
Date: Mon, 10 Aug 2015 07:54:48 -0700	[thread overview]
Message-ID: <55C8BB38.1060808@sandisk.com> (raw)
In-Reply-To: <1439216574-25936-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

On 08/10/15 07:23, Sagi Grimberg wrote:
> srp_destroy_qp is designed to indicate we are safe to continue with
> freeing the channel resources by modifying the qp error state,
> posting a dummy wr on the queue-pair and waiting for it to flush.
> This also holds for the channel registration pool as we are unmapping
> the memory region when handling a scsi response. Destroying the
> channel registration pool before we make sure we processed all the
> inflight IO might introduce a use-after-free of the registration pool.
>
> This use-after-free is demonstrated in the stack trace below where
> srp is trying to unmap a used FMR after the fmr_pool was already destroyed.
>
> general protection fault: 0000 [#1] SMP
> RIP: 0010:[<ffffffff8151121b>]  [<ffffffff8151121b>] _raw_spin_lock_irqsave+0x1b/0x50
> Call Trace:
>   [<ffffffffa055d88a>] ib_fmr_pool_unmap+0x1a/0xb0 [ib_core]
>   [<ffffffffa06c00ed>] srp_unmap_data+0x17d/0x250 [ib_srp]
>   [<ffffffffa06c01eb>] srp_free_req+0x2b/0x60 [ib_srp]
>   [<ffffffffa06c0c94>] srp_recv_completion+0x174/0x580 [ib_srp]
>   [<ffffffffa04580fe>] mlx4_eq_int+0x4de/0xe50 [mlx4_core]
>   [<ffffffffa0458b00>] mlx4_msi_x_interrupt+0x10/0x20 [mlx4_core]
>   [<ffffffff810abc45>] handle_irq_event_percpu+0x35/0x1b0
>   [<ffffffff810abdf2>] handle_irq_event+0x32/0x50
>   [<ffffffff810ae5cf>] handle_edge_irq+0x6f/0x120
>   [<ffffffff8100455a>] handle_irq+0x1a/0x30
>   [<ffffffff8151b475>] do_IRQ+0x45/0xb0
>   [<ffffffff8151162d>] common_interrupt+0x6d/0x6d
>   [<ffffffff813e4d2f>] cpuidle_enter_state+0x4f/0xc0
>   [<ffffffff813e4e6c>] cpuidle_idle_call+0xcc/0x210
>   [<ffffffff8100b9ea>] arch_cpu_idle+0xa/0x30
>   [<ffffffff810ab1e1>] cpu_startup_entry+0xe1/0x270
>   [<ffffffff81030b3a>] start_secondary+0x21a/0x2c0

With which kernel version has this been observed ? scsi_remove_host() 
waits until all outstanding requests have finished. srp_free_ch_ib() is 
called either before a SCSI host is registered with the SCSI core or 
after scsi_remove_host() has finished. So I don't see how the above call 
trace could be triggered with a recent kernel ?

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-08-10 14:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 14:22 [PATCH] IB/srp: Fix possible use-after-free Sagi Grimberg
     [not found] ` <1439216574-25936-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-08-10 14:54   ` Bart Van Assche [this message]
     [not found]     ` <55C8BB38.1060808-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-08-11  7:01       ` Sagi Grimberg
2015-08-11 14:42       ` Sagi Grimberg
     [not found]         ` <55CA09E5.2070208-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-08-11 15:17           ` Bart Van Assche
2015-08-11 15:58           ` Bart Van Assche
     [not found]             ` <55CA1BC1.3060609-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-08-12  6:31               ` Sagi Grimberg
     [not found]                 ` <55CAE85D.7010602-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-09-03 20:00                   ` Doug Ledford

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=55C8BB38.1060808@sandisk.com \
    --to=bart.vanassche-xdaiopvojttbdgjk7y7tuq@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /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 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.