Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1636984

[PATCH 4.10 5/5] dm ioctl: prevent stack leak in dm ioctl call

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.10 5/5] dm ioctl: prevent stack leak in dm ioctl call
Date 2017-05-06 22:50 +0200
Message-ID <tEeOl-4n6-9@gated-at.bofh.it> (permalink)
References <tEeEF-4je-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

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

From: Adrian Salido <salidoa@google.com>

commit 4617f564c06117c7d1b611be49521a4430042287 upstream.

When calling a dm ioctl that doesn't process any data
(IOCTL_FLAGS_NO_PARAMS), the contents of the data field in struct
dm_ioctl are left initialized.  Current code is incorrectly extending
the size of data copied back to user, causing the contents of kernel
stack to be leaked to user.  Fix by only copying contents before data
and allow the functions processing the ioctl to override.

Signed-off-by: Adrian Salido <salidoa@google.com>
Reviewed-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/dm-ioctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1847,7 +1847,7 @@ static int ctl_ioctl(uint command, struc
 	if (r)
 		goto out;
 
-	param->data_size = sizeof(*param);
+	param->data_size = offsetof(struct dm_ioctl, data);
 	r = fn(param, input_param_size);
 
 	if (unlikely(param->flags & DM_BUFFER_FULL_FLAG) &&

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.10 0/5] 4.10.15-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-06 22:40 +0200
  [PATCH 4.10 1/5] timerfd: Protect the might cancel mechanism proper Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-06 22:40 +0200
  [PATCH 4.10 2/5] Handle mismatched open calls Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-06 22:50 +0200
  [PATCH 4.10 5/5] dm ioctl: prevent stack leak in dm ioctl call Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-06 22:50 +0200
  [PATCH 4.10 3/5] scsi: storvsc: Workaround for virtual DVD SCSI version Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-06 22:50 +0200
  [PATCH 4.10 4/5] hwmon: (it87) Avoid registering the same chip on both SIO addresses Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-06 22:50 +0200
  Re: [PATCH 4.10 0/5] 4.10.15-stable review Guenter Roeck <linux@roeck-us.net> - 2017-05-08 00:10 +0200
    Re: [PATCH 4.10 0/5] 4.10.15-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-08 07:50 +0200
  Re: [PATCH 4.10 0/5] 4.10.15-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-05-08 21:20 +0200
    Re: [PATCH 4.10 0/5] 4.10.15-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-09 09:50 +0200

csiph-web