Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: ALPS - fix sync loss on Acer Aspire 5720ZG
Input: psmouse - fix input_dev leak in lifebook driver
Input: psmouse - fix potential memory leak in psmouse_connect()
Input: usbtouchscreen - fix buffer overflow, make more egalax work
Input: mousedev - handle mice that use absolute coordinates

+51 -24
+1 -1
drivers/input/mouse/alps.c
··· 54 54 { { 0x20, 0x02, 0x0e }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */ 55 55 { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, 56 56 { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */ 57 - { { 0x73, 0x02, 0x50 }, 0xcf, 0xff, ALPS_FW_BK_1 } /* Dell Vostro 1400 */ 57 + { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FW_BK_1 } /* Dell Vostro 1400 */ 58 58 }; 59 59 60 60 /*
+6 -1
drivers/input/mouse/lifebook.c
··· 225 225 226 226 static void lifebook_disconnect(struct psmouse *psmouse) 227 227 { 228 + struct lifebook_data *priv = psmouse->private; 229 + 228 230 psmouse_reset(psmouse); 229 - kfree(psmouse->private); 231 + if (priv) { 232 + input_unregister_device(priv->dev2); 233 + kfree(priv); 234 + } 230 235 psmouse->private = NULL; 231 236 } 232 237
+2
drivers/input/mouse/psmouse-base.c
··· 1247 1247 err_pt_deactivate: 1248 1248 if (parent && parent->pt_deactivate) 1249 1249 parent->pt_deactivate(parent); 1250 + input_unregister_device(psmouse->dev); 1251 + input_dev = NULL; /* so we don't try to free it below */ 1250 1252 err_protocol_disconnect: 1251 1253 if (psmouse->disconnect) 1252 1254 psmouse->disconnect(psmouse);
+9
drivers/input/mousedev.c
··· 1029 1029 BIT_MASK(ABS_PRESSURE) | 1030 1030 BIT_MASK(ABS_TOOL_WIDTH) }, 1031 1031 }, /* A touchpad */ 1032 + { 1033 + .flags = INPUT_DEVICE_ID_MATCH_EVBIT | 1034 + INPUT_DEVICE_ID_MATCH_KEYBIT | 1035 + INPUT_DEVICE_ID_MATCH_ABSBIT, 1036 + .evbit = { BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_SYN) }, 1037 + .keybit = { [BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) }, 1038 + .absbit = { BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) }, 1039 + }, /* Mouse-like device with absolute X and Y but ordinary 1040 + clicks, like hp ILO2 High Performance mouse */ 1032 1041 1033 1042 { }, /* Terminating entry */ 1034 1043 };
+33 -22
drivers/input/touchscreen/usbtouchscreen.c
··· 11 11 * - DMC TSC-10/25 12 12 * - IRTOUCHSYSTEMS/UNITOP 13 13 * - IdealTEK URTC1000 14 + * - General Touch 14 15 * - GoTop Super_Q2/GogoPen/PenPower tablets 15 16 * 16 17 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> ··· 51 50 #include <linux/usb/input.h> 52 51 53 52 54 - #define DRIVER_VERSION "v0.5" 53 + #define DRIVER_VERSION "v0.6" 55 54 #define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>" 56 55 #define DRIVER_DESC "USB Touchscreen Driver" 57 56 ··· 66 65 int min_yc, max_yc; 67 66 int min_press, max_press; 68 67 int rept_size; 69 - int flags; 70 68 71 69 void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len); 70 + 71 + /* 72 + * used to get the packet len. possible return values: 73 + * > 0: packet len 74 + * = 0: skip one byte 75 + * < 0: -return value more bytes needed 76 + */ 72 77 int (*get_pkt_len) (unsigned char *pkt, int len); 78 + 73 79 int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt); 74 80 int (*init) (struct usbtouch_usb *usbtouch); 75 81 }; 76 - 77 - #define USBTOUCH_FLG_BUFFER 0x01 78 - 79 82 80 83 /* a usbtouch device */ 81 84 struct usbtouch_usb { ··· 98 93 int touch, press; 99 94 }; 100 95 101 - 102 - #if defined(CONFIG_TOUCHSCREEN_USB_EGALAX) || defined(CONFIG_TOUCHSCREEN_USB_ETURBO) || defined(CONFIG_TOUCHSCREEN_USB_IDEALTEK) 103 - #define MULTI_PACKET 104 - #endif 105 - 106 - #ifdef MULTI_PACKET 107 - static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, 108 - unsigned char *pkt, int len); 109 - #endif 110 96 111 97 /* device types */ 112 98 enum { ··· 181 185 */ 182 186 183 187 #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX 188 + 189 + #ifndef MULTI_PACKET 190 + #define MULTI_PACKET 191 + #endif 184 192 185 193 #define EGALAX_PKT_TYPE_MASK 0xFE 186 194 #define EGALAX_PKT_TYPE_REPT 0x80 ··· 323 323 * eTurboTouch part 324 324 */ 325 325 #ifdef CONFIG_TOUCHSCREEN_USB_ETURBO 326 + #ifndef MULTI_PACKET 327 + #define MULTI_PACKET 328 + #endif 326 329 static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt) 327 330 { 328 331 unsigned int shift; ··· 464 461 * IdealTEK URTC1000 Part 465 462 */ 466 463 #ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK 464 + #ifndef MULTI_PACKET 465 + #define MULTI_PACKET 466 + #endif 467 467 static int idealtek_get_pkt_len(unsigned char *buf, int len) 468 468 { 469 469 if (buf[0] & 0x80) ··· 531 525 /***************************************************************************** 532 526 * the different device descriptors 533 527 */ 528 + #ifdef MULTI_PACKET 529 + static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, 530 + unsigned char *pkt, int len); 531 + #endif 532 + 534 533 static struct usbtouch_device_info usbtouch_dev_info[] = { 535 534 #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX 536 535 [DEVTYPE_EGALAX] = { ··· 544 533 .min_yc = 0x0, 545 534 .max_yc = 0x07ff, 546 535 .rept_size = 16, 547 - .flags = USBTOUCH_FLG_BUFFER, 548 536 .process_pkt = usbtouch_process_multi, 549 537 .get_pkt_len = egalax_get_pkt_len, 550 538 .read_data = egalax_read_data, ··· 592 582 .min_yc = 0x0, 593 583 .max_yc = 0x07ff, 594 584 .rept_size = 8, 595 - .flags = USBTOUCH_FLG_BUFFER, 596 585 .process_pkt = usbtouch_process_multi, 597 586 .get_pkt_len = eturbo_get_pkt_len, 598 587 .read_data = eturbo_read_data, ··· 639 630 .min_yc = 0x0, 640 631 .max_yc = 0x0fff, 641 632 .rept_size = 8, 642 - .flags = USBTOUCH_FLG_BUFFER, 643 633 .process_pkt = usbtouch_process_multi, 644 634 .get_pkt_len = idealtek_get_pkt_len, 645 635 .read_data = idealtek_read_data, ··· 746 738 pos = 0; 747 739 while (pos < buf_len) { 748 740 /* get packet len */ 749 - pkt_len = usbtouch->type->get_pkt_len(buffer + pos, len); 741 + pkt_len = usbtouch->type->get_pkt_len(buffer + pos, 742 + buf_len - pos); 750 743 751 - /* unknown packet: drop everything */ 752 - if (unlikely(!pkt_len)) 753 - goto out_flush_buf; 744 + /* unknown packet: skip one byte */ 745 + if (unlikely(!pkt_len)) { 746 + pos++; 747 + continue; 748 + } 754 749 755 750 /* full packet: process */ 756 751 if (likely((pkt_len > 0) && (pkt_len <= buf_len - pos))) { ··· 868 857 if (!usbtouch->data) 869 858 goto out_free; 870 859 871 - if (type->flags & USBTOUCH_FLG_BUFFER) { 860 + if (type->get_pkt_len) { 872 861 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL); 873 862 if (!usbtouch->buffer) 874 863 goto out_free_buffers;