aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2008-05-30 10:40:28 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-05-30 10:40:28 -0400
commit501a5250589be41c4c060afa855bc60b4539a340 (patch)
treea2411e9367fd265f1327c51bdef6d3c8f793d0b0 /drivers/input/tablet
parent471637a575329f9250e7e4099e84084820a35e11 (diff)
Input: gtco - fix double kfree in error handling path
The code would try to free 'report' twice upon input_register_device() failure. Reported-by: Julia Lawall <julia@diku.dk> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r--drivers/input/tablet/gtco.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c
index c5a8661a1baa..1e748e46d12e 100644
--- a/drivers/input/tablet/gtco.c
+++ b/drivers/input/tablet/gtco.c
@@ -830,7 +830,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
830 struct gtco *gtco; 830 struct gtco *gtco;
831 struct input_dev *input_dev; 831 struct input_dev *input_dev;
832 struct hid_descriptor *hid_desc; 832 struct hid_descriptor *hid_desc;
833 char *report = NULL; 833 char *report;
834 int result = 0, retry; 834 int result = 0, retry;
835 int error; 835 int error;
836 struct usb_endpoint_descriptor *endpoint; 836 struct usb_endpoint_descriptor *endpoint;
@@ -916,12 +916,16 @@ static int gtco_probe(struct usb_interface *usbinterface,
916 le16_to_cpu(hid_desc->wDescriptorLength), 916 le16_to_cpu(hid_desc->wDescriptorLength),
917 5000); /* 5 secs */ 917 5000); /* 5 secs */
918 918
919 if (result == le16_to_cpu(hid_desc->wDescriptorLength)) 919 dbg("usb_control_msg result: %d", result);
920 if (result == le16_to_cpu(hid_desc->wDescriptorLength)) {
921 parse_hid_report_descriptor(gtco, report, result);
920 break; 922 break;
923 }
921 } 924 }
922 925
926 kfree(report);
927
923 /* If we didn't get the report, fail */ 928 /* If we didn't get the report, fail */
924 dbg("usb_control_msg result: :%d", result);
925 if (result != le16_to_cpu(hid_desc->wDescriptorLength)) { 929 if (result != le16_to_cpu(hid_desc->wDescriptorLength)) {
926 err("Failed to get HID Report Descriptor of size: %d", 930 err("Failed to get HID Report Descriptor of size: %d",
927 hid_desc->wDescriptorLength); 931 hid_desc->wDescriptorLength);
@@ -929,12 +933,6 @@ static int gtco_probe(struct usb_interface *usbinterface,
929 goto err_free_urb; 933 goto err_free_urb;
930 } 934 }
931 935
932 /* Now we parse the report */
933 parse_hid_report_descriptor(gtco, report, result);
934
935 /* Now we delete it */
936 kfree(report);
937
938 /* Create a device file node */ 936 /* Create a device file node */
939 usb_make_path(gtco->usbdev, gtco->usbpath, sizeof(gtco->usbpath)); 937 usb_make_path(gtco->usbdev, gtco->usbpath, sizeof(gtco->usbpath));
940 strlcat(gtco->usbpath, "/input0", sizeof(gtco->usbpath)); 938 strlcat(gtco->usbpath, "/input0", sizeof(gtco->usbpath));
@@ -988,7 +986,6 @@ static int gtco_probe(struct usb_interface *usbinterface,
988 usb_buffer_free(gtco->usbdev, REPORT_MAX_SIZE, 986 usb_buffer_free(gtco->usbdev, REPORT_MAX_SIZE,
989 gtco->buffer, gtco->buf_dma); 987 gtco->buffer, gtco->buf_dma);
990 err_free_devs: 988 err_free_devs:
991 kfree(report);
992 input_free_device(input_dev); 989 input_free_device(input_dev);
993 kfree(gtco); 990 kfree(gtco);
994 return error; 991 return error;