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


Groups > linux.kernel > #1557630 > unrolled thread

[PATCH 0/2] HID: corsair: fix DMA to stack and info leaks

Started byJohan Hovold <johan@kernel.org>
First post2017-01-12 18:20 +0100
Last post2017-01-13 12:10 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] HID: corsair: fix DMA to stack and info leaks Johan Hovold <johan@kernel.org> - 2017-01-12 18:20 +0100
    [PATCH 2/2] HID: corsair: fix control-transfer error handling Johan Hovold <johan@kernel.org> - 2017-01-12 18:40 +0100
    Re: [PATCH 0/2] HID: corsair: fix DMA to stack and info leaks Jiri Kosina <jikos@kernel.org> - 2017-01-13 12:10 +0100

#1557630 — [PATCH 0/2] HID: corsair: fix DMA to stack and info leaks

FromJohan Hovold <johan@kernel.org>
Date2017-01-12 18:20 +0100
Subject[PATCH 0/2] HID: corsair: fix DMA to stack and info leaks
Message-ID<sYRcC-6Fw-5@gated-at.bofh.it>
These patches fix DMA buffers on stack and information leaks in the
corsair HID driver.

Note that this series has only been compile tested.

Johan


Johan Hovold (2):
  HID: corsair: fix DMA buffers on stack
  HID: corsair: fix control-transfer error handling

 drivers/hid/hid-corsair.c | 60 +++++++++++++++++++++++++++++++++++------------
 1 file changed, 45 insertions(+), 15 deletions(-)

-- 
2.10.2

[toc] | [next] | [standalone]


#1557651 — [PATCH 2/2] HID: corsair: fix control-transfer error handling

FromJohan Hovold <johan@kernel.org>
Date2017-01-12 18:40 +0100
Subject[PATCH 2/2] HID: corsair: fix control-transfer error handling
Message-ID<sYRvZ-6LY-41@gated-at.bofh.it>
In reply to#1557630
Make sure to check for short control transfers in order to avoid parsing
uninitialised buffer data and leaking it to user space.

Note that the backlight and macro-mode buffer constraints are kept as
loose as possible in order to avoid any regressions should the current
buffer sizes be larger than necessary.

Fixes: 6f78193ee9ea ("HID: corsair: Add Corsair Vengeance K90 driver")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/hid/hid-corsair.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-corsair.c b/drivers/hid/hid-corsair.c
index 5971907a23b1..c0303f61c26a 100644
--- a/drivers/hid/hid-corsair.c
+++ b/drivers/hid/hid-corsair.c
@@ -159,7 +159,7 @@ static enum led_brightness k90_backlight_get(struct led_classdev *led_cdev)
 			      USB_DIR_IN | USB_TYPE_VENDOR |
 			      USB_RECIP_DEVICE, 0, 0, data, 8,
 			      USB_CTRL_SET_TIMEOUT);
-	if (ret < 0) {
+	if (ret < 5) {
 		dev_warn(dev, "Failed to get K90 initial state (error %d).\n",
 			 ret);
 		ret = -EIO;
@@ -274,7 +274,7 @@ static ssize_t k90_show_macro_mode(struct device *dev,
 			      USB_DIR_IN | USB_TYPE_VENDOR |
 			      USB_RECIP_DEVICE, 0, 0, data, 2,
 			      USB_CTRL_SET_TIMEOUT);
-	if (ret < 0) {
+	if (ret < 1) {
 		dev_warn(dev, "Failed to get K90 initial mode (error %d).\n",
 			 ret);
 		ret = -EIO;
@@ -351,7 +351,7 @@ static ssize_t k90_show_current_profile(struct device *dev,
 			      USB_DIR_IN | USB_TYPE_VENDOR |
 			      USB_RECIP_DEVICE, 0, 0, data, 8,
 			      USB_CTRL_SET_TIMEOUT);
-	if (ret < 0) {
+	if (ret < 8) {
 		dev_warn(dev, "Failed to get K90 initial state (error %d).\n",
 			 ret);
 		ret = -EIO;
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1558222

FromJiri Kosina <jikos@kernel.org>
Date2017-01-13 12:10 +0100
Message-ID<sZ7U5-7f-7@gated-at.bofh.it>
In reply to#1557630
On Thu, 12 Jan 2017, Johan Hovold wrote:

> These patches fix DMA buffers on stack and information leaks in the
> corsair HID driver.
> 
> Note that this series has only been compile tested.

Adding Clément to CC, and applying to for-4.10/upstream-fixes branch.

Thanks!

-- 
Jiri Kosina
SUSE Labs

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web