All of lore.kernel.org
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: darrick.wong@oracle.com, gregkh@linuxfoundation.org, hch@lst.de
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "xfs: fix over-copying of getbmap parameters from userspace" has been added to the 4.4-stable tree
Date: Mon, 05 Jun 2017 17:08:19 +0200	[thread overview]
Message-ID: <149667529914610@kroah.com> (raw)


This is a note to let you know that I've just added the patch titled

    xfs: fix over-copying of getbmap parameters from userspace

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xfs-fix-over-copying-of-getbmap-parameters-from-userspace.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From be6324c00c4d1e0e665f03ed1fc18863a88da119 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Mon, 3 Apr 2017 15:17:57 -0700
Subject: xfs: fix over-copying of getbmap parameters from userspace

From: Darrick J. Wong <darrick.wong@oracle.com>

commit be6324c00c4d1e0e665f03ed1fc18863a88da119 upstream.

In xfs_ioc_getbmap, we should only copy the fields of struct getbmap
from userspace, or else we end up copying random stack contents into the
kernel.  struct getbmap is a strict subset of getbmapx, so a partial
structure copy should work fine.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/xfs/xfs_ioctl.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1379,10 +1379,11 @@ xfs_ioc_getbmap(
 	unsigned int		cmd,
 	void			__user *arg)
 {
-	struct getbmapx		bmx;
+	struct getbmapx		bmx = { 0 };
 	int			error;
 
-	if (copy_from_user(&bmx, arg, sizeof(struct getbmapx)))
+	/* struct getbmap is a strict subset of struct getbmapx. */
+	if (copy_from_user(&bmx, arg, offsetof(struct getbmapx, bmv_iflags)))
 		return -EFAULT;
 
 	if (bmx.bmv_count < 2)


Patches currently in stable-queue which might be from darrick.wong@oracle.com are

queue-4.4/xfs-fix-missed-holes-in-seek_hole-implementation.patch
queue-4.4/xfs-fix-indlen-accounting-error-on-partial-delalloc-conversion.patch
queue-4.4/xfs-fix-over-copying-of-getbmap-parameters-from-userspace.patch
queue-4.4/xfs-bad-assertion-for-delalloc-an-extent-that-start-at-i_size.patch
queue-4.4/xfs-fix-off-by-one-on-max-nr_pages-in-xfs_find_get_desired_pgoff.patch
queue-4.4/xfs-update-ag-iterator-to-support-wait-on-new-inodes.patch
queue-4.4/xfs-fix-up-quotacheck-buffer-list-error-handling.patch
queue-4.4/xfs-wait-on-new-inodes-during-quotaoff-dquot-release.patch
queue-4.4/xfs-support-ability-to-wait-on-new-inodes.patch
queue-4.4/xfs-prevent-multi-fsb-dir-readahead-from-reading-random-blocks.patch
queue-4.4/xfs-fix-unaligned-access-in-xfs_btree_visit_blocks.patch
queue-4.4/xfs-handle-array-index-overrun-in-xfs_dir2_leaf_readbuf.patch

                 reply	other threads:[~2017-06-05 15:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=149667529914610@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=darrick.wong@oracle.com \
    --cc=hch@lst.de \
    --cc=stable-commits@vger.kernel.org \
    --cc=stable@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.