mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kamal Mostafa <kamal@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: Matthew Daley <mattd@bugfuzz.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Kamal Mostafa <kamal@canonical.com>
Subject: [PATCH 3.13 3/3] floppy: don't write kernel-only members to FDRAWCMD ioctl output
Date: Tue,  6 May 2014 13:42:20 -0700	[thread overview]
Message-ID: <1399408940-22784-4-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1399408940-22784-1-git-send-email-kamal@canonical.com>

3.13.11.1 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Matthew Daley <mattd@bugfuzz.com>

commit 2145e15e0557a01b9195d1c7199a1b92cb9be81f upstream.

Do not leak kernel-only floppy_raw_cmd structure members to userspace.
This includes the linked-list pointer and the pointer to the allocated
DMA space.

Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
References: CVE-2014-1738
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/block/floppy.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 10fbd3f..738af94 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3053,7 +3053,10 @@ static int raw_cmd_copyout(int cmd, void __user *param,
 	int ret;
 
 	while (ptr) {
-		ret = copy_to_user(param, ptr, sizeof(*ptr));
+		struct floppy_raw_cmd cmd = *ptr;
+		cmd.next = NULL;
+		cmd.kernel_data = NULL;
+		ret = copy_to_user(param, &cmd, sizeof(cmd));
 		if (ret)
 			return -EFAULT;
 		param += sizeof(struct floppy_raw_cmd);
-- 
1.9.1


      parent reply	other threads:[~2014-05-06 20:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06 20:42 [3.13.y.z extended stable] Linux 3.13.11.1 stable review (new patches) Kamal Mostafa
2014-05-06 20:42 ` [PATCH 3.13 1/3] n_tty: Fix n_tty_write crash when echoing in raw mode Kamal Mostafa
2014-05-06 20:42 ` [PATCH 3.13 2/3] floppy: ignore kernel-only members in FDRAWCMD ioctl input Kamal Mostafa
2014-05-06 20:42 ` Kamal Mostafa [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=1399408940-22784-4-git-send-email-kamal@canonical.com \
    --to=kamal@canonical.com \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mattd@bugfuzz.com \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.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®