From: mikem <mikem@beardog.cca.cpqcorp.net>
To: Jens Axboe <axboe@suse.de>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2/3] cciss: bug fix for BIG_PASS_THRU
Date: Fri, 18 Nov 2005 15:32:17 -0600 [thread overview]
Message-ID: <20051118213217.GA23551@beardog.cca.cpqcorp.net> (raw)
In-Reply-To: <20051118210123.GC25454@suse.de>
On Fri, Nov 18, 2005 at 10:01:24PM +0100, Jens Axboe wrote:
> On Fri, Nov 18 2005, mikem wrote:
> > Patch 2 of 3
> >
> > Applications using CCISS_BIG_PASSTHRU complained that the data written
> > was zeros. The code looked alright, but it seems that copy_from_user
> > already does a memset on the buffer. Removing it from the pass-through
> > fixes the apps.
>
> Hmm, I don't like this patch, since you never clear the buffer for reads
> now. If the controller for some reason doesn't overwrite this buffer,
> you could be leaking privileged data! Your bug is because you do:
>
> if (write && copy_from_user(...))
> fail
> else
> clear
>
> so you end up in the clear case for any case where copy_from_user()
> doesn't fail. I've fixed it up for you, this is what I committed:
Thanks, Jens.
>
> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> index e239a6c..33f8341 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -1017,10 +1017,11 @@ static int cciss_ioctl(struct inode *ino
> status = -ENOMEM;
> goto cleanup1;
> }
> - if (ioc->Request.Type.Direction == XFER_WRITE &&
> - copy_from_user(buff[sg_used], data_ptr, sz)) {
> + if (ioc->Request.Type.Direction == XFER_WRITE) {
> + if (copy_from_user(buff[sg_used], data_ptr, sz)) {
> status = -ENOMEM;
> - goto cleanup1;
> + goto cleanup1;
> + }
> } else {
> memset(buff[sg_used], 0, sz);
> }
>
> --
> Jens Axboe
>
next prev parent reply other threads:[~2005-11-18 21:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-18 16:41 mikem
2005-11-18 21:01 ` Jens Axboe
2005-11-18 21:32 ` mikem [this message]
2005-11-18 21:05 ` Philippe Pegon
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=20051118213217.GA23551@beardog.cca.cpqcorp.net \
--to=mikem@beardog.cca.cpqcorp.net \
--cc=akpm@osdl.org \
--cc=axboe@suse.de \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®