public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Wenchao Hao <haowenchao@huawei.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Feilong Lin <linfeilong@huawei.com>
Subject: Re: [Question] SCSI_EH: How does EH guarantee there is no UAF of scsi_cmnd if host reset failed
Date: Tue, 19 Apr 2022 16:56:53 +0200	[thread overview]
Message-ID: <da087e9b-bd07-e5fd-421d-242e6adce22b@suse.de> (raw)
In-Reply-To: <6301e87f-15f6-4c1f-41f5-d2f1aa4eedd7@huawei.com>

On 4/19/22 16:28, Wenchao Hao wrote:
> Hi all, I am wondered how does SCSI EH guarantee there is no UAF of scsi_cmnd
> if host reset failed. If host reset failed and eh_cmd_q of shost is not empty,
> these command in eh_cmd_q would be added to done_q in scsi_eh_offline_sdevs()
> and finished by scsi_eh_flush_done_q(). So these scsi_cmnd and it's related
> request would be freed.
> 
Yes.

> While since host reset failed, we can not guarantee the LLDDs has cleared all
> references to these commands in eh_cmd_q. Is there any possibility that the
> LLDDs reference to these commands? If this happened, then a using after free
> issue would occur.
> 
If host reset has failed there are _no_ assumptions we can make about 
commands, and not even about the PCI device itself.
So in effect, once host_reset failed the system is hosed.

We _might_ be able to resurrect the system by doing PCI EEH, but not 
many systems nor drivers implement that.

Cheers,

Hannes


  reply	other threads:[~2022-04-19 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 14:28 [Question] SCSI_EH: How does EH guarantee there is no UAF of scsi_cmnd if host reset failed Wenchao Hao
2022-04-19 14:56 ` Hannes Reinecke [this message]
2022-04-21 15:24   ` Wenchao Hao

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=da087e9b-bd07-e5fd-421d-242e6adce22b@suse.de \
    --to=hare@suse.de \
    --cc=haowenchao@huawei.com \
    --cc=jejb@linux.ibm.com \
    --cc=linfeilong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@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