From: Juergen Gross <jgross@suse.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
xen-devel@lists.xenproject.org, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Stefano Stabellini <sstabellini@kernel.org>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Subject: Re: [PATCH 4/4] xen/scsifront: harden driver against malicious backend
Date: Thu, 21 Apr 2022 17:29:27 +0200 [thread overview]
Message-ID: <15c89971-aefb-e71c-3798-c2e3820601f8@suse.com> (raw)
In-Reply-To: <9d8c453b-7147-d80c-3d4f-666a3b530929@suse.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 1830 bytes --]
On 21.04.22 12:13, Juergen Gross wrote:
> On 20.04.22 18:13, Boris Ostrovsky wrote:
>> Just a couple of nits.
>>
>>
>> On 4/20/22 5:25 AM, Juergen Gross wrote:
>>> -static int scsifront_ring_drain(struct vscsifrnt_info *info)
>>> +static int scsifront_ring_drain(struct vscsifrnt_info *info,
>>> + unsigned int *eoiflag)
>>> {
>>> - struct vscsiif_response *ring_rsp;
>>> + struct vscsiif_response ring_rsp;
>>> RING_IDX i, rp;
>>> int more_to_do = 0;
>>> - rp = info->ring.sring->rsp_prod;
>>> - rmb(); /* ordering required respective to dom0 */
>>> + rp = READ_ONCE(info->ring.sring->rsp_prod);
>>> + virt_rmb(); /* ordering required respective to backend */
>>> + if (RING_RESPONSE_PROD_OVERFLOW(&info->ring, rp)) {
>>> + scsifront_set_error(info, "illegal number of responses");
>>
>>
>> In net and block drivers we report number of such responses. (But not in usb)
> I'm not sure the specific value is of any interest.
>
>>> + return 0;
>>> + }
>>> for (i = info->ring.rsp_cons; i != rp; i++) {
>>> - ring_rsp = RING_GET_RESPONSE(&info->ring, i);
>>> - scsifront_do_response(info, ring_rsp);
>>> + RING_COPY_RESPONSE(&info->ring, i, &ring_rsp);
>>> + scsifront_do_response(info, &ring_rsp);
>>> + if (info->host_active == STATE_ERROR)
>>> + return 0;
>>> + *eoiflag = 0;
>>
>>
>> *eoiflags &= ~XEN_EOI_FLAG_SPURIOUS; ?
>
> Yes, probably better.
>
>> We also use eoi_flags name in other instances in this file.
>
> I'll unify the name.
Oh, eoi_flags is used in the backend driver. So nothing to unify.
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
prev parent reply other threads:[~2022-04-21 15:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 9:24 [PATCH 0/4] xen/pv-scsi: update header and harden frontend Juergen Gross
2022-04-20 9:25 ` [PATCH 1/4] xen: update vscsiif.h Juergen Gross
2022-04-20 9:25 ` [PATCH 2/4] xen/scsiback: use new command result macros Juergen Gross
2022-04-20 16:12 ` Boris Ostrovsky
2022-04-21 8:40 ` Juergen Gross
2022-04-21 20:56 ` Boris Ostrovsky
2022-04-28 7:06 ` Juergen Gross
2022-04-20 9:25 ` [PATCH 3/4] xen/scsifront: " Juergen Gross
2022-04-20 9:25 ` [PATCH 4/4] xen/scsifront: harden driver against malicious backend Juergen Gross
2022-04-20 16:13 ` Boris Ostrovsky
2022-04-21 10:13 ` Juergen Gross
2022-04-21 15:29 ` Juergen Gross [this message]
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=15c89971-aefb-e71c-3798-c2e3820601f8@suse.com \
--to=jgross@suse.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox