aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Patrick-Evans <james@jmp-e.com>2016-07-15 11:40:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-07-15 17:15:40 -0400
commitaa93d1fee85c890a34f2510a310e55ee76a27848 (patch)
tree9b73ec6447103649523c514c537d3c10d62974a2
parent0ba169ac3600ae4032ee14b4192e6bf5d67723f5 (diff)
media: fix airspy usb probe error path
Fix a memory leak on probe error of the airspy usb device driver. The problem is triggered when more than 64 usb devices register with v4l2 of type VFL_TYPE_SDR or VFL_TYPE_SUBDEV. The memory leak is caused by the probe function of the airspy driver mishandeling errors and not freeing the corresponding control structures when an error occours registering the device to v4l2 core. A badusb device can emulate 64 of these devices, and then through continual emulated connect/disconnect of the 65th device, cause the kernel to run out of RAM and crash the kernel, thus causing a local DOS vulnerability. Fixes CVE-2016-5400 Signed-off-by: James Patrick-Evans <james@jmp-e.com> Reviewed-by: Kees Cook <keescook@chromium.org> Cc: stable@vger.kernel.org # 3.17+ Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/media/usb/airspy/airspy.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c
index 87c12930416f..92d9d4214c3a 100644
--- a/drivers/media/usb/airspy/airspy.c
+++ b/drivers/media/usb/airspy/airspy.c
@@ -1072,7 +1072,7 @@ static int airspy_probe(struct usb_interface *intf,
1072 if (ret) { 1072 if (ret) {
1073 dev_err(s->dev, "Failed to register as video device (%d)\n", 1073 dev_err(s->dev, "Failed to register as video device (%d)\n",
1074 ret); 1074 ret);
1075 goto err_unregister_v4l2_dev; 1075 goto err_free_controls;
1076 } 1076 }
1077 dev_info(s->dev, "Registered as %s\n", 1077 dev_info(s->dev, "Registered as %s\n",
1078 video_device_node_name(&s->vdev)); 1078 video_device_node_name(&s->vdev));
@@ -1081,7 +1081,6 @@ static int airspy_probe(struct usb_interface *intf,
1081 1081
1082err_free_controls: 1082err_free_controls:
1083 v4l2_ctrl_handler_free(&s->hdl); 1083 v4l2_ctrl_handler_free(&s->hdl);
1084err_unregister_v4l2_dev:
1085 v4l2_device_unregister(&s->v4l2_dev); 1084 v4l2_device_unregister(&s->v4l2_dev);
1086err_free_mem: 1085err_free_mem:
1087 kfree(s); 1086 kfree(s);