From: Paolo Bonzini <pbonzini@redhat.com>
To: Matthew Wilcox <willy@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-scsi <linux-scsi@vger.kernel.org>,
Vishal Verma <vishal.l.verma@intel.com>
Subject: Re: NVMe: Add nvme-scsi.c (was Re: [PULL REQUEST] NVMe driver updates)
Date: Thu, 27 Jun 2013 01:28:45 +0200 [thread overview]
Message-ID: <51CB792D.6030504@redhat.com> (raw)
In-Reply-To: <20130509202015.GJ6057@linux.intel.com>
Il 09/05/2013 22:20, Matthew Wilcox ha scritto:
> NVMe: Add nvme-scsi.c
I couldn't find the original patch on LKML, so I'll just quote the
relevant piece of code.
> +int nvme_sg_io(struct nvme_ns *ns, struct sg_io_hdr __user *u_hdr)
> +{
> + struct sg_io_hdr hdr;
> + int retcode;
> +
> + if (!capable(CAP_SYS_ADMIN))
> + return -EACCES;
This should be EPERM, and also it should use the same checks as other
implementations of SG_IO, including:
- checking if it's operating on a partition, and requiring CAP_SYS_RAWIO
if so;
- allowing a limited number of commands even for !capable(CAP_SYS_RAWIO).
All this is done by scsi_cmd_blk_ioctl.
Paolo
> + if (copy_from_user(&hdr, u_hdr, sizeof(hdr)))
> + return -EFAULT;
> + if (hdr.interface_id != 'S')
> + return -EINVAL;
> + if (hdr.cmd_len > BLK_MAX_CDB)
> + return -EINVAL;
> +
> + retcode = nvme_scsi_translate(ns, &hdr);
> + if (retcode < 0)
> + return retcode;
> + if (retcode > 0)
> + retcode = SNTI_TRANSLATION_SUCCESS;
> + if (copy_to_user(__user u_hdr, &hdr, sizeof(sg_io_hdr_t)) > 0)
> + return -EFAULT;
> +
> + return retcode;
> +}
parent reply other threads:[~2013-06-26 23:28 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20130509202015.GJ6057@linux.intel.com>]
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=51CB792D.6030504@redhat.com \
--to=pbonzini@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=vishal.l.verma@intel.com \
--cc=willy@linux.intel.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;
as well as URLs for NNTP newsgroup(s).