All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ewan Milne <emilne@redhat.com>
To: dgilbert@interlog.com
Cc: SCSI development list <linux-scsi@vger.kernel.org>, dvyukov@google.com
Subject: Re: [PATCH] sg: fix dxferp in from_to case
Date: Wed, 09 Mar 2016 11:09:21 -0500	[thread overview]
Message-ID: <1457539761.16707.81.camel@localhost.localdomain> (raw)
In-Reply-To: <56D7CC31.3070800@interlog.com>

On Thu, 2016-03-03 at 00:31 -0500, Douglas Gilbert wrote:
> This patch is in response to this report:
>     http://www.spinics.net/lists/linux-scsi/msg93456.html
> 
> One of the strange things that the original sg driver did was let
> the user provide both a data-out buffer (it followed the
> sg_header+cdb) _and_ specify a reply length greater than zero. What
> happened was that the user data-out buffer was copied into some
> kernel buffers and then the mid level was told a read type operation
> would take place with the data from the device overwriting the same
> kernel buffers. The user would then read those kernel buffers back
> into the user space.
> 
>  From what I can tell, the above action was broken by a change in
> 2008 and syzkaller found that out recently.
> 
>     ChangeLog:
>        make sure that a user space pointer is passed through
>        when data follows the sg_header structure and command.
>        Fix the abnormal case when a non-zero reply_len is also
>        given.
> 
> Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>

This looks correct to me.  hp->dxferp used to be set unconditionally,
but commit fad7f01e changed it to only be set in the SG_DXFER_TO_DEV
case.

Reviewed-by: Ewan D. Milne <emilne@redhat.com>



  parent reply	other threads:[~2016-03-09 16:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03  5:31 [PATCH] sg: fix dxferp in from_to case Douglas Gilbert
2016-03-08  2:18 ` Martin K. Petersen
2016-03-09 16:09 ` Ewan Milne [this message]
2016-03-10  1:42 ` Martin K. Petersen

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=1457539761.16707.81.camel@localhost.localdomain \
    --to=emilne@redhat.com \
    --cc=dgilbert@interlog.com \
    --cc=dvyukov@google.com \
    --cc=linux-scsi@vger.kernel.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.