Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1655554
| Path | csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Ben Hutchings <ben@decadent.org.uk> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 3.2 077/101] drm/vmwgfx: fix integer overflow in vmw_surface_define_ioctl() |
| Date | Thu, 01 Jun 2017 19:00:03 +0200 |
| Message-ID | <tNBC3-58o-65@gated-at.bofh.it> (permalink) |
| References | <tNAwh-4oP-11@gated-at.bofh.it> |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Disposition | inline |
| Content-Transfer-Encoding | 8bit |
| MIME-Version | 1.0 |
| X-Mailer | LinuxStableQueue (scripts by bwh) |
| X-Sa-Exim-Connect-IP | 82.70.136.246 |
| X-Sa-Exim-Mail-From | ben@decadent.org.uk |
| X-Sa-Exim-Scanned | No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 38 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | akpm@linux-foundation.org, "Li Qiang" <liqiang6-s@360.cn>, "Li Qiang" <liq3ea@gmail.com>, "Thomas Hellstrom" <thellstrom@vmware.com> |
| X-Original-Date | Thu, 01 Jun 2017 16:40:55 +0100 |
| X-Original-Message-ID | <lsq.1496331655.499106281@decadent.org.uk> |
| X-Original-References | <lsq.1496331653.552489284@decadent.org.uk> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1655554 |
Show key headers only | View raw
3.2.89-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Li Qiang <liq3ea@gmail.com>
commit e7e11f99564222d82f0ce84bd521e57d78a6b678 upstream.
In vmw_surface_define_ioctl(), the 'num_sizes' is the sum of the
'req->mip_levels' array. This array can be assigned any value from
the user space. As both the 'num_sizes' and the array is uint32_t,
it is easy to make 'num_sizes' overflow. The later 'mip_levels' is
used as the loop count. This can lead an oob write. Add the check of
'req->mip_levels' to avoid this.
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -1304,8 +1304,11 @@ int vmw_surface_define_ioctl(struct drm_
128;
num_sizes = 0;
- for (i = 0; i < DRM_VMW_MAX_SURFACE_FACES; ++i)
+ for (i = 0; i < DRM_VMW_MAX_SURFACE_FACES; ++i) {
+ if (req->mip_levels[i] > DRM_VMW_MAX_MIP_LEVELS)
+ return -EINVAL;
num_sizes += req->mip_levels[i];
+ }
if (num_sizes > DRM_VMW_MAX_SURFACE_FACES * DRM_VMW_MAX_MIP_LEVELS ||
num_sizes == 0)
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 3.2 077/101] drm/vmwgfx: fix integer overflow in vmw_surface_define_ioctl() Ben Hutchings <ben@decadent.org.uk> - 2017-06-01 19:00 +0200
csiph-web