/[linux-patches]/genpatches-2.6/trunk/2.6.14/1422_15.4_db9-crash.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.14/1422_15.4_db9-crash.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 328 - (show annotations) (download) (as text)
Tue Mar 14 13:34:17 2006 UTC (14 years, 8 months ago) by johnm
File MIME type: text/x-diff
File size: 6493 byte(s)
2.6.14-11, rebase against local tree
1 Re-diffed for 2.6.14.7 by Kerin Millar <kerframil@gmail.com>:
2
3 From stable-bounces@linux.kernel.org Wed Feb 1 21:19:12 2006
4 Date: Thu, 02 Feb 2006 00:09:01 -0500
5 From: Dmitry Torokhov <dtor_core@ameritech.net>
6 To: stable@kernel.org
7 Cc:
8 Subject: Input: db9 - fix possible crash with Saturn gamepads
9
10 Input: db9 - fix possible crash with Saturn gamepads
11
12 Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
13 Signed-off-by: Chris Wright <chrisw@sous-sol.org>
14 ---
15
16 --- linux-2.6.14.7.orig/drivers/input/joystick/db9.c 2005-10-27 19:02:08.000000000 -0500
17 +++ linux-2.6.14.7/drivers/input/joystick/db9.c 2006-02-06 21:30:59.000000000 -0500
18 @@ -259,68 +259,70 @@ static unsigned char db9_saturn_read_pac
19 /*
20 * db9_saturn_report() analyzes packet and reports.
21 */
22 -static int db9_saturn_report(unsigned char id, unsigned char data[60], struct input_dev *dev, int n, int max_pads)
23 +static int db9_saturn_report(unsigned char id, unsigned char data[60], struct input_dev *devs[], int n, int max_pads)
24 {
25 + struct input_dev *dev;
26 int tmp, i, j;
27
28 tmp = (id == 0x41) ? 60 : 10;
29 - for (j = 0; (j < tmp) && (n < max_pads); j += 10, n++) {
30 + for (j = 0; j < tmp && n < max_pads; j += 10, n++) {
31 + dev = devs [n];
32 switch (data[j]) {
33 case 0x16: /* multi controller (analog 4 axis) */
34 - input_report_abs(dev + n, db9_abs[5], data[j + 6]);
35 + input_report_abs(dev, db9_abs[5], data[j + 6]);
36 case 0x15: /* mission stick (analog 3 axis) */
37 - input_report_abs(dev + n, db9_abs[3], data[j + 4]);
38 - input_report_abs(dev + n, db9_abs[4], data[j + 5]);
39 + input_report_abs(dev, db9_abs[3], data[j + 4]);
40 + input_report_abs(dev, db9_abs[4], data[j + 5]);
41 case 0x13: /* racing controller (analog 1 axis) */
42 - input_report_abs(dev + n, db9_abs[2], data[j + 3]);
43 + input_report_abs(dev, db9_abs[2], data[j + 3]);
44 case 0x34: /* saturn keyboard (udlr ZXC ASD QE Esc) */
45 case 0x02: /* digital pad (digital 2 axis + buttons) */
46 - input_report_abs(dev + n, db9_abs[0], !(data[j + 1] & 128) - !(data[j + 1] & 64));
47 - input_report_abs(dev + n, db9_abs[1], !(data[j + 1] & 32) - !(data[j + 1] & 16));
48 + input_report_abs(dev, db9_abs[0], !(data[j + 1] & 128) - !(data[j + 1] & 64));
49 + input_report_abs(dev, db9_abs[1], !(data[j + 1] & 32) - !(data[j + 1] & 16));
50 for (i = 0; i < 9; i++)
51 - input_report_key(dev + n, db9_cd32_btn[i], ~data[j + db9_saturn_byte[i]] & db9_saturn_mask[i]);
52 + input_report_key(dev, db9_cd32_btn[i], ~data[j + db9_saturn_byte[i]] & db9_saturn_mask[i]);
53 break;
54 case 0x19: /* mission stick x2 (analog 6 axis + buttons) */
55 - input_report_abs(dev + n, db9_abs[0], !(data[j + 1] & 128) - !(data[j + 1] & 64));
56 - input_report_abs(dev + n, db9_abs[1], !(data[j + 1] & 32) - !(data[j + 1] & 16));
57 + input_report_abs(dev, db9_abs[0], !(data[j + 1] & 128) - !(data[j + 1] & 64));
58 + input_report_abs(dev, db9_abs[1], !(data[j + 1] & 32) - !(data[j + 1] & 16));
59 for (i = 0; i < 9; i++)
60 - input_report_key(dev + n, db9_cd32_btn[i], ~data[j + db9_saturn_byte[i]] & db9_saturn_mask[i]);
61 - input_report_abs(dev + n, db9_abs[2], data[j + 3]);
62 - input_report_abs(dev + n, db9_abs[3], data[j + 4]);
63 - input_report_abs(dev + n, db9_abs[4], data[j + 5]);
64 + input_report_key(dev, db9_cd32_btn[i], ~data[j + db9_saturn_byte[i]] & db9_saturn_mask[i]);
65 + input_report_abs(dev, db9_abs[2], data[j + 3]);
66 + input_report_abs(dev, db9_abs[3], data[j + 4]);
67 + input_report_abs(dev, db9_abs[4], data[j + 5]);
68 /*
69 - input_report_abs(dev + n, db9_abs[8], (data[j + 6] & 128 ? 0 : 1) - (data[j + 6] & 64 ? 0 : 1));
70 - input_report_abs(dev + n, db9_abs[9], (data[j + 6] & 32 ? 0 : 1) - (data[j + 6] & 16 ? 0 : 1));
71 + input_report_abs(dev, db9_abs[8], (data[j + 6] & 128 ? 0 : 1) - (data[j + 6] & 64 ? 0 : 1));
72 + input_report_abs(dev, db9_abs[9], (data[j + 6] & 32 ? 0 : 1) - (data[j + 6] & 16 ? 0 : 1));
73 */
74 - input_report_abs(dev + n, db9_abs[6], data[j + 7]);
75 - input_report_abs(dev + n, db9_abs[7], data[j + 8]);
76 - input_report_abs(dev + n, db9_abs[5], data[j + 9]);
77 + input_report_abs(dev, db9_abs[6], data[j + 7]);
78 + input_report_abs(dev, db9_abs[7], data[j + 8]);
79 + input_report_abs(dev, db9_abs[5], data[j + 9]);
80 break;
81 case 0xd3: /* sankyo ff (analog 1 axis + stop btn) */
82 - input_report_key(dev + n, BTN_A, data[j + 3] & 0x80);
83 - input_report_abs(dev + n, db9_abs[2], data[j + 3] & 0x7f);
84 + input_report_key(dev, BTN_A, data[j + 3] & 0x80);
85 + input_report_abs(dev, db9_abs[2], data[j + 3] & 0x7f);
86 break;
87 case 0xe3: /* shuttle mouse (analog 2 axis + buttons. signed value) */
88 - input_report_key(dev + n, BTN_START, data[j + 1] & 0x08);
89 - input_report_key(dev + n, BTN_A, data[j + 1] & 0x04);
90 - input_report_key(dev + n, BTN_C, data[j + 1] & 0x02);
91 - input_report_key(dev + n, BTN_B, data[j + 1] & 0x01);
92 - input_report_abs(dev + n, db9_abs[2], data[j + 2] ^ 0x80);
93 - input_report_abs(dev + n, db9_abs[3], (0xff-(data[j + 3] ^ 0x80))+1); /* */
94 + input_report_key(dev, BTN_START, data[j + 1] & 0x08);
95 + input_report_key(dev, BTN_A, data[j + 1] & 0x04);
96 + input_report_key(dev, BTN_C, data[j + 1] & 0x02);
97 + input_report_key(dev, BTN_B, data[j + 1] & 0x01);
98 + input_report_abs(dev, db9_abs[2], data[j + 2] ^ 0x80);
99 + input_report_abs(dev, db9_abs[3], (0xff-(data[j + 3] ^ 0x80))+1); /* */
100 break;
101 case 0xff:
102 default: /* no pad */
103 - input_report_abs(dev + n, db9_abs[0], 0);
104 - input_report_abs(dev + n, db9_abs[1], 0);
105 + input_report_abs(dev, db9_abs[0], 0);
106 + input_report_abs(dev, db9_abs[1], 0);
107 for (i = 0; i < 9; i++)
108 - input_report_key(dev + n, db9_cd32_btn[i], 0);
109 + input_report_key(dev, db9_cd32_btn[i], 0);
110 break;
111 }
112 }
113 return n;
114 }
115
116 -static int db9_saturn(int mode, struct parport *port, struct input_dev *dev)
117 +static int db9_saturn(int mode, struct parport *port, struct input_dev *devs[])
118 {
119 unsigned char id, data[60];
120 int type, n, max_pads;
121 @@ -345,7 +347,7 @@ static int db9_saturn(int mode, struct p
122 max_pads = min(db9_max_pads[mode], DB9_MAX_DEVICES);
123 for (tmp = 0, i = 0; i < n; i++) {
124 id = db9_saturn_read_packet(port, data, type + i, 1);
125 - tmp = db9_saturn_report(id, data, dev, tmp, max_pads);
126 + tmp = db9_saturn_report(id, data, devs, tmp, max_pads);
127 }
128 return 0;
129 }
130 @@ -472,7 +474,7 @@ static void db9_timer(unsigned long priv
131 case DB9_SATURN_DPP:
132 case DB9_SATURN_DPP_2:
133
134 - db9_saturn(db9->mode, port, dev);
135 + db9_saturn(db9->mode, port, db9->dev);
136 break;
137
138 case DB9_CD32_PAD:

  ViewVC Help
Powered by ViewVC 1.1.20