[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <71b8d0d34b7881dfaf4ca80fc710e149af8842d1.1457082108.git.jslaby@suse.cz>
Date: Fri, 4 Mar 2016 10:02:21 +0100
From: Jiri Slaby <jslaby@...e.cz>
To: stable@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Gerd Hoffmann <kraxel@...hat.com>,
gnomes@...rguk.ukuu.org.uk, Dave Airlie <airlied@...hat.com>,
Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH 3.12 096/116] drm/qxl: use kmalloc_array to alloc reloc_info in qxl_process_single_command
From: Gerd Hoffmann <kraxel@...hat.com>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 34855706c30d52b0a744da44348b5d1cc39fbe51 upstream.
This avoids integer overflows on 32bit machines when calculating
reloc_info size, as reported by Alan Cox.
Cc: gnomes@...rguk.ukuu.org.uk
Signed-off-by: Gerd Hoffmann <kraxel@...hat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@...ll.ch>
Signed-off-by: Dave Airlie <airlied@...hat.com>
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
drivers/gpu/drm/qxl/qxl_ioctl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c
index 729debf83fa3..94008582b5e0 100644
--- a/drivers/gpu/drm/qxl/qxl_ioctl.c
+++ b/drivers/gpu/drm/qxl/qxl_ioctl.c
@@ -168,7 +168,8 @@ static int qxl_process_single_command(struct qxl_device *qdev,
cmd->command_size))
return -EFAULT;
- reloc_info = kmalloc(sizeof(struct qxl_reloc_info) * cmd->relocs_num, GFP_KERNEL);
+ reloc_info = kmalloc_array(cmd->relocs_num,
+ sizeof(struct qxl_reloc_info), GFP_KERNEL);
if (!reloc_info)
return -ENOMEM;
--
2.7.2
Powered by blists - more mailing lists