Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1353 - genpatches-2.6/trunk/2.6.27
Date: Sat, 11 Oct 2008 01:09:53
Message-Id: E1KoSzN-0001iM-PP@stork.gentoo.org
1 Author: mpagano
2 Date: 2008-10-11 01:09:49 +0000 (Sat, 11 Oct 2008)
3 New Revision: 1353
4
5 Removed:
6 genpatches-2.6/trunk/2.6.27/1502_wan-sbni_ioctl-add-missing-capability-checks.patch
7 genpatches-2.6/trunk/2.6.27/1900_UTC-timestamp-option.patch
8 genpatches-2.6/trunk/2.6.27/2600_evdev-compat-ioctl-force-feedback.patch
9 Modified:
10 genpatches-2.6/trunk/2.6.27/0000_README
11 Log:
12 More patches removed and updates to README
13
14 Modified: genpatches-2.6/trunk/2.6.27/0000_README
15 ===================================================================
16 --- genpatches-2.6/trunk/2.6.27/0000_README 2008-10-11 00:03:51 UTC (rev 1352)
17 +++ genpatches-2.6/trunk/2.6.27/0000_README 2008-10-11 01:09:49 UTC (rev 1353)
18 @@ -39,46 +39,6 @@
19 Individual Patch Descriptions:
20 --------------------------------------------------------------------------
21
22 -Patch: 1000_linux-2.6.26.1.patch
23 -From: http://www.kernel.org
24 -Desc: Linux 2.6.26.1
25 -
26 -Patch: 1001_linux-2.6.26.2.patch
27 -From: http://www.kernel.org
28 -Desc: Linux 2.6.26.2
29 -
30 -Patch: 1002_linux-2.6.26.3.patch
31 -From: http://www.kernel.org
32 -Desc: Linux 2.6.26.3
33 -
34 -Patch: 1003_linux-2.6.26.4.patch
35 -From: http://www.kernel.org
36 -Desc: Linux 2.6.26.4
37 -
38 -Patch: 1004_linux-2.6.26.5.patch
39 -From: http://www.kernel.org
40 -Desc: Linux 2.6.26.5
41 -
42 -Patch: 1005_linux-2.6.26.6.patch
43 -From: http://www.kernel.org
44 -Desc: Linux 2.6.26.6
45 -
46 -Patch: 1502_wan-sbni_ioctl-add-missing-capability-checks.patch
47 -From: http://www.kernel.org
48 -Desc: Adds missing capability checks in drivers/net/wan/sbni.c -> sbni_ioctl()
49 -
50 -Patch: 1900_UTC-timestamp-option.patch
51 -From: http://bugs.gentoo.org/233307
52 -Desc: Fix to add UTC timestamp option
53 -
54 -Patch: 2600_evdev-compat-ioctl-force-feedback.patch
55 -From: http://bugs.gentoo.org/214700
56 -Desc: Fix evdev force feedback in 32-bit compat mode
57 -
58 -Patch: 2900_linux-2.6.27-makefile.patch
59 -From: http://www.kernel.org
60 -Desc: Makefile patch
61 -
62 Patch: 4105_dm-bbr.patch
63 From: EVMS 2.5.2
64 Desc: Bad block relocation support for LiveCD users
65
66 Deleted: genpatches-2.6/trunk/2.6.27/1502_wan-sbni_ioctl-add-missing-capability-checks.patch
67 ===================================================================
68 --- genpatches-2.6/trunk/2.6.27/1502_wan-sbni_ioctl-add-missing-capability-checks.patch 2008-10-11 00:03:51 UTC (rev 1352)
69 +++ genpatches-2.6/trunk/2.6.27/1502_wan-sbni_ioctl-add-missing-capability-checks.patch 2008-10-11 01:09:49 UTC (rev 1353)
70 @@ -1,79 +0,0 @@
71 -From: Eugene Teo <eugeneteo@××××××.sg>
72 -Date: Wed, 27 Aug 2008 11:50:30 +0000 (-0700)
73 -Subject: wan: Missing capability checks in sbni_ioctl()
74 -X-Git-Tag: v2.6.27-rc5~8^2~2
75 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=f2455eb176ac87081bbfc9a44b21c7cd2bc1967e
76 -
77 -wan: Missing capability checks in sbni_ioctl()
78 -
79 -There are missing capability checks in the following code:
80 -
81 -1300 static int
82 -1301 sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd)
83 -1302 {
84 -[...]
85 -1319 case SIOCDEVRESINSTATS :
86 -1320 if( current->euid != 0 ) /* root only */
87 -1321 return -EPERM;
88 -[...]
89 -1336 case SIOCDEVSHWSTATE :
90 -1337 if( current->euid != 0 ) /* root only */
91 -1338 return -EPERM;
92 -[...]
93 -1357 case SIOCDEVENSLAVE :
94 -1358 if( current->euid != 0 ) /* root only */
95 -1359 return -EPERM;
96 -[...]
97 -1372 case SIOCDEVEMANSIPATE :
98 -1373 if( current->euid != 0 ) /* root only */
99 -1374 return -EPERM;
100 -
101 -Here's my proposed fix:
102 -
103 -Missing capability checks.
104 -
105 -Signed-off-by: Eugene Teo <eugeneteo@××××××.sg>
106 -Signed-off-by: David S. Miller <davem@×××××××××.net>
107 ----
108 -
109 -diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
110 -index e59255a..6596cd0 100644
111 ---- a/drivers/net/wan/sbni.c
112 -+++ b/drivers/net/wan/sbni.c
113 -@@ -1317,7 +1317,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )
114 - break;
115 -
116 - case SIOCDEVRESINSTATS :
117 -- if( current->euid != 0 ) /* root only */
118 -+ if (!capable(CAP_NET_ADMIN))
119 - return -EPERM;
120 - memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) );
121 - break;
122 -@@ -1334,7 +1334,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )
123 - break;
124 -
125 - case SIOCDEVSHWSTATE :
126 -- if( current->euid != 0 ) /* root only */
127 -+ if (!capable(CAP_NET_ADMIN))
128 - return -EPERM;
129 -
130 - spin_lock( &nl->lock );
131 -@@ -1355,7 +1355,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )
132 - #ifdef CONFIG_SBNI_MULTILINE
133 -
134 - case SIOCDEVENSLAVE :
135 -- if( current->euid != 0 ) /* root only */
136 -+ if (!capable(CAP_NET_ADMIN))
137 - return -EPERM;
138 -
139 - if (copy_from_user( slave_name, ifr->ifr_data, sizeof slave_name ))
140 -@@ -1370,7 +1370,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )
141 - return enslave( dev, slave_dev );
142 -
143 - case SIOCDEVEMANSIPATE :
144 -- if( current->euid != 0 ) /* root only */
145 -+ if (!capable(CAP_NET_ADMIN))
146 - return -EPERM;
147 -
148 - return emancipate( dev );
149 -
150
151 Deleted: genpatches-2.6/trunk/2.6.27/1900_UTC-timestamp-option.patch
152 ===================================================================
153 --- genpatches-2.6/trunk/2.6.27/1900_UTC-timestamp-option.patch 2008-10-11 00:03:51 UTC (rev 1352)
154 +++ genpatches-2.6/trunk/2.6.27/1900_UTC-timestamp-option.patch 2008-10-11 01:09:49 UTC (rev 1353)
155 @@ -1,221 +0,0 @@
156 -New mount option ("tz=UTC") for FAT (vfat/msdos) filesystems allowing
157 -timestamps to be in coordinated universal time (UTC) rather than
158 -local time in applications where doing this is advantageous (like
159 -digital cameras, etc.)
160 -
161 -Signed-off-by: Joe Peterson <joe@×××××××.com>
162 -Acked-by: OGAWA Hirofumi <hirofumi@×××××××××××××××.jp>
163 ----
164 -
165 -diff -puNr a/fs/fat/dir.c b/fs/fat/dir.c
166 ---- a/fs/fat/dir.c 2008-06-25 08:53:35.676901351 -0600
167 -+++ b/fs/fat/dir.c 2008-06-26 12:58:56.096272279 -0600
168 -@@ -1082,7 +1082,7 @@ int fat_alloc_new_dir(struct inode *dir,
169 - goto error_free;
170 - }
171 -
172 -- fat_date_unix2dos(ts->tv_sec, &time, &date);
173 -+ fat_date_unix2dos(ts->tv_sec, &time, &date, sbi->options.tz_utc);
174 -
175 - de = (struct msdos_dir_entry *)bhs[0]->b_data;
176 - /* filling the new directory slots ("." and ".." entries) */
177 -diff -puNr a/fs/fat/inode.c b/fs/fat/inode.c
178 ---- a/fs/fat/inode.c 2008-06-25 08:53:35.676901351 -0600
179 -+++ b/fs/fat/inode.c 2008-06-26 14:57:07.087942764 -0600
180 -@@ -382,17 +382,20 @@ static int fat_fill_inode(struct inode *
181 - inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1))
182 - & ~((loff_t)sbi->cluster_size - 1)) >> 9;
183 - inode->i_mtime.tv_sec =
184 -- date_dos2unix(le16_to_cpu(de->time), le16_to_cpu(de->date));
185 -+ date_dos2unix(le16_to_cpu(de->time), le16_to_cpu(de->date),
186 -+ sbi->options.tz_utc);
187 - inode->i_mtime.tv_nsec = 0;
188 - if (sbi->options.isvfat) {
189 - int secs = de->ctime_cs / 100;
190 - int csecs = de->ctime_cs % 100;
191 - inode->i_ctime.tv_sec =
192 - date_dos2unix(le16_to_cpu(de->ctime),
193 -- le16_to_cpu(de->cdate)) + secs;
194 -+ le16_to_cpu(de->cdate),
195 -+ sbi->options.tz_utc) + secs;
196 - inode->i_ctime.tv_nsec = csecs * 10000000;
197 - inode->i_atime.tv_sec =
198 -- date_dos2unix(0, le16_to_cpu(de->adate));
199 -+ date_dos2unix(0, le16_to_cpu(de->adate),
200 -+ sbi->options.tz_utc);
201 - inode->i_atime.tv_nsec = 0;
202 - } else
203 - inode->i_ctime = inode->i_atime = inode->i_mtime;
204 -@@ -592,11 +595,14 @@ retry:
205 - raw_entry->attr = fat_attr(inode);
206 - raw_entry->start = cpu_to_le16(MSDOS_I(inode)->i_logstart);
207 - raw_entry->starthi = cpu_to_le16(MSDOS_I(inode)->i_logstart >> 16);
208 -- fat_date_unix2dos(inode->i_mtime.tv_sec, &raw_entry->time, &raw_entry->date);
209 -+ fat_date_unix2dos(inode->i_mtime.tv_sec, &raw_entry->time,
210 -+ &raw_entry->date, sbi->options.tz_utc);
211 - if (sbi->options.isvfat) {
212 - __le16 atime;
213 -- fat_date_unix2dos(inode->i_ctime.tv_sec,&raw_entry->ctime,&raw_entry->cdate);
214 -- fat_date_unix2dos(inode->i_atime.tv_sec,&atime,&raw_entry->adate);
215 -+ fat_date_unix2dos(inode->i_ctime.tv_sec, &raw_entry->ctime,
216 -+ &raw_entry->cdate, sbi->options.tz_utc);
217 -+ fat_date_unix2dos(inode->i_atime.tv_sec, &atime,
218 -+ &raw_entry->adate, sbi->options.tz_utc);
219 - raw_entry->ctime_cs = (inode->i_ctime.tv_sec & 1) * 100 +
220 - inode->i_ctime.tv_nsec / 10000000;
221 - }
222 -@@ -836,6 +842,8 @@ static int fat_show_options(struct seq_f
223 - }
224 - if (sbi->options.flush)
225 - seq_puts(m, ",flush");
226 -+ if (opts->tz_utc)
227 -+ seq_puts(m, ",tz=UTC");
228 -
229 - return 0;
230 - }
231 -@@ -848,7 +856,7 @@ enum {
232 - Opt_charset, Opt_shortname_lower, Opt_shortname_win95,
233 - Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes,
234 - Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes,
235 -- Opt_obsolate, Opt_flush, Opt_err,
236 -+ Opt_obsolate, Opt_flush, Opt_tz_utc, Opt_err,
237 - };
238 -
239 - static match_table_t fat_tokens = {
240 -@@ -883,6 +891,7 @@ static match_table_t fat_tokens = {
241 - {Opt_obsolate, "cvf_options=%100s"},
242 - {Opt_obsolate, "posix"},
243 - {Opt_flush, "flush"},
244 -+ {Opt_tz_utc, "tz=UTC"},
245 - {Opt_err, NULL},
246 - };
247 - static match_table_t msdos_tokens = {
248 -@@ -947,6 +956,7 @@ static int parse_options(char *options,
249 - opts->utf8 = opts->unicode_xlate = 0;
250 - opts->numtail = 1;
251 - opts->usefree = opts->nocase = 0;
252 -+ opts->tz_utc = 0;
253 - *debug = 0;
254 -
255 - if (!options)
256 -@@ -1036,6 +1046,9 @@ static int parse_options(char *options,
257 - case Opt_flush:
258 - opts->flush = 1;
259 - break;
260 -+ case Opt_tz_utc:
261 -+ opts->tz_utc = 1;
262 -+ break;
263 -
264 - /* msdos specific */
265 - case Opt_dots:
266 -diff -puNr a/fs/fat/misc.c b/fs/fat/misc.c
267 ---- a/fs/fat/misc.c 2008-06-25 08:53:35.676901351 -0600
268 -+++ b/fs/fat/misc.c 2008-06-26 12:59:08.627376422 -0600
269 -@@ -142,7 +142,7 @@ static int day_n[] = {
270 - };
271 -
272 - /* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */
273 --int date_dos2unix(unsigned short time, unsigned short date)
274 -+int date_dos2unix(unsigned short time, unsigned short date, int tz_utc)
275 - {
276 - int month, year, secs;
277 -
278 -@@ -156,16 +156,18 @@ int date_dos2unix(unsigned short time, u
279 - ((date & 31)-1+day_n[month]+(year/4)+year*365-((year & 3) == 0 &&
280 - month < 2 ? 1 : 0)+3653);
281 - /* days since 1.1.70 plus 80's leap day */
282 -- secs += sys_tz.tz_minuteswest*60;
283 -+ if (!tz_utc)
284 -+ secs += sys_tz.tz_minuteswest*60;
285 - return secs;
286 - }
287 -
288 - /* Convert linear UNIX date to a MS-DOS time/date pair. */
289 --void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date)
290 -+void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date, int tz_utc)
291 - {
292 - int day, year, nl_day, month;
293 -
294 -- unix_date -= sys_tz.tz_minuteswest*60;
295 -+ if (!tz_utc)
296 -+ unix_date -= sys_tz.tz_minuteswest*60;
297 -
298 - /* Jan 1 GMT 00:00:00 1980. But what about another time zone? */
299 - if (unix_date < 315532800)
300 -diff -puNr a/fs/msdos/namei.c b/fs/msdos/namei.c
301 ---- a/fs/msdos/namei.c 2008-06-25 08:53:35.696902410 -0600
302 -+++ b/fs/msdos/namei.c 2008-06-26 12:58:42.255055811 -0600
303 -@@ -243,6 +243,7 @@ static int msdos_add_entry(struct inode
304 - int is_dir, int is_hid, int cluster,
305 - struct timespec *ts, struct fat_slot_info *sinfo)
306 - {
307 -+ struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
308 - struct msdos_dir_entry de;
309 - __le16 time, date;
310 - int err;
311 -@@ -252,7 +253,7 @@ static int msdos_add_entry(struct inode
312 - if (is_hid)
313 - de.attr |= ATTR_HIDDEN;
314 - de.lcase = 0;
315 -- fat_date_unix2dos(ts->tv_sec, &time, &date);
316 -+ fat_date_unix2dos(ts->tv_sec, &time, &date, sbi->options.tz_utc);
317 - de.cdate = de.adate = 0;
318 - de.ctime = 0;
319 - de.ctime_cs = 0;
320 -diff -puNr a/fs/vfat/namei.c b/fs/vfat/namei.c
321 ---- a/fs/vfat/namei.c 2008-06-25 08:53:35.686902663 -0600
322 -+++ b/fs/vfat/namei.c 2008-06-26 12:58:27.073724049 -0600
323 -@@ -621,7 +621,7 @@ shortname:
324 - memcpy(de->name, msdos_name, MSDOS_NAME);
325 - de->attr = is_dir ? ATTR_DIR : ATTR_ARCH;
326 - de->lcase = lcase;
327 -- fat_date_unix2dos(ts->tv_sec, &time, &date);
328 -+ fat_date_unix2dos(ts->tv_sec, &time, &date, sbi->options.tz_utc);
329 - de->time = de->ctime = time;
330 - de->date = de->cdate = de->adate = date;
331 - de->ctime_cs = 0;
332 -diff -puNr a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
333 ---- a/include/linux/msdos_fs.h 2008-06-25 08:53:17.435303045 -0600
334 -+++ b/include/linux/msdos_fs.h 2008-06-26 14:58:40.626135522 -0600
335 -@@ -205,7 +205,8 @@ struct fat_mount_options {
336 - atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */
337 - flush:1, /* write things quickly */
338 - nocase:1, /* Does this need case conversion? 0=need case conversion*/
339 -- usefree:1; /* Use free_clusters for FAT32 */
340 -+ usefree:1, /* Use free_clusters for FAT32 */
341 -+ tz_utc:1; /* Filesystem timestamps are in UTC */
342 - };
343 -
344 - #define FAT_HASH_BITS 8
345 -@@ -428,8 +429,9 @@ extern int fat_flush_inodes(struct super
346 - extern void fat_fs_panic(struct super_block *s, const char *fmt, ...);
347 - extern void fat_clusters_flush(struct super_block *sb);
348 - extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster);
349 --extern int date_dos2unix(unsigned short time, unsigned short date);
350 --extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date);
351 -+extern int date_dos2unix(unsigned short time, unsigned short date, int tz_utc);
352 -+extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date,
353 -+ int tz_utc);
354 - extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs);
355 -
356 - int fat_cache_init(void);
357 -
358 -diff -puN Documentation/filesystems/vfat.txt~utc-timestamp-option-for-fat-filesystems-fix Documentation/filesystems/vfat.txt
359 ---- a/Documentation/filesystems/vfat.txt~utc-timestamp-option-for-fat-filesystems-fix
360 -+++ a/Documentation/filesystems/vfat.txt
361 -@@ -96,6 +96,14 @@ shortname=lower|win95|winnt|mixed
362 - emulate the Windows 95 rule for create.
363 - Default setting is `lower'.
364 -
365 -+tz=UTC -- Interpret timestamps as UTC rather than local time.
366 -+ This option disables the conversion of timestamps
367 -+ between local time (as used by Windows on FAT) and UTC
368 -+ (which Linux uses internally). This is particuluarly
369 -+ useful when mounting devices (like digital cameras)
370 -+ that are set to UTC in order to avoid the pitfalls of
371 -+ local time.
372 -+
373 - <bool>: 0,1,yes,no,true,false
374 -
375 - TODO
376 -
377
378 Deleted: genpatches-2.6/trunk/2.6.27/2600_evdev-compat-ioctl-force-feedback.patch
379 ===================================================================
380 --- genpatches-2.6/trunk/2.6.27/2600_evdev-compat-ioctl-force-feedback.patch 2008-10-11 00:03:51 UTC (rev 1352)
381 +++ genpatches-2.6/trunk/2.6.27/2600_evdev-compat-ioctl-force-feedback.patch 2008-10-11 01:09:49 UTC (rev 1353)
382 @@ -1,159 +0,0 @@
383 -From: Adam Dawidowski <drake_ster@××.pl>
384 -Date: Mon, 2 Jun 2008 05:08:10 +0000 (-0400)
385 -Subject: Input: fix force feedback upload issue in compat mode
386 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fdtor%2Finput.git;a=commitdiff_plain;h=bb00421d9b684253468bf751e7ce0a4667b721e8
387 -
388 -Input: fix force feedback upload issue in compat mode
389 -
390 -Force feedback upload of effects through the event device (ioctl
391 -EVIOCSFF) is not working in 32 bit applications running on 64-bit
392 -kernel due to the fact that struct ff_effect contains a pointer,
393 -resulting in the structure having different sizes in 64 and 32 bit
394 -programs and causing difference in ioctl numbers.
395 -
396 -[dtor@××××.ru: refactor to keep all ugliness in evdev]
397 -
398 -Signed-off-by: Adam Dawidowski <drake_ster@××.pl>
399 -Signed-off-by: Dmitry Torokhov <dtor@××××.ru>
400 ----
401 -
402 -diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
403 -index b32984b..2d65411 100644
404 ---- a/drivers/input/evdev.c
405 -+++ b/drivers/input/evdev.c
406 -@@ -300,6 +300,35 @@ struct input_event_compat {
407 - __s32 value;
408 - };
409 -
410 -+struct ff_periodic_effect_compat {
411 -+ __u16 waveform;
412 -+ __u16 period;
413 -+ __s16 magnitude;
414 -+ __s16 offset;
415 -+ __u16 phase;
416 -+
417 -+ struct ff_envelope envelope;
418 -+
419 -+ __u32 custom_len;
420 -+ compat_uptr_t custom_data;
421 -+};
422 -+
423 -+struct ff_effect_compat {
424 -+ __u16 type;
425 -+ __s16 id;
426 -+ __u16 direction;
427 -+ struct ff_trigger trigger;
428 -+ struct ff_replay replay;
429 -+
430 -+ union {
431 -+ struct ff_constant_effect constant;
432 -+ struct ff_ramp_effect ramp;
433 -+ struct ff_periodic_effect_compat periodic;
434 -+ struct ff_condition_effect condition[2]; /* One for each axis */
435 -+ struct ff_rumble_effect rumble;
436 -+ } u;
437 -+};
438 -+
439 - /* Note to the author of this code: did it ever occur to
440 - you why the ifdefs are needed? Think about it again. -AK */
441 - #ifdef CONFIG_X86_64
442 -@@ -368,6 +397,42 @@ static int evdev_event_to_user(char __user *buffer,
443 - return 0;
444 - }
445 -
446 -+static int evdev_ff_effect_from_user(const char __user *buffer, size_t size,
447 -+ struct ff_effect *effect)
448 -+{
449 -+ if (COMPAT_TEST) {
450 -+ struct ff_effect_compat *compat_effect;
451 -+
452 -+ if (size != sizeof(struct ff_effect_compat))
453 -+ return -EINVAL;
454 -+
455 -+ /*
456 -+ * It so happens that the pointer which needs to be changed
457 -+ * is the last field in the structure, so we can copy the
458 -+ * whole thing and replace just the pointer.
459 -+ */
460 -+
461 -+ compat_effect = (struct ff_effect_compat *)effect;
462 -+
463 -+ if (copy_from_user(compat_effect, buffer,
464 -+ sizeof(struct ff_effect_compat)))
465 -+ return -EFAULT;
466 -+
467 -+ if (compat_effect->type == FF_PERIODIC &&
468 -+ compat_effect->u.periodic.waveform == FF_CUSTOM)
469 -+ effect->u.periodic.custom_data =
470 -+ compat_ptr(compat_effect->u.periodic.custom_data);
471 -+ } else {
472 -+ if (size != sizeof(struct ff_effect))
473 -+ return -EINVAL;
474 -+
475 -+ if (copy_from_user(effect, buffer, sizeof(struct ff_effect)))
476 -+ return -EFAULT;
477 -+ }
478 -+
479 -+ return 0;
480 -+}
481 -+
482 - #else
483 -
484 - static inline size_t evdev_event_size(void)
485 -@@ -393,6 +458,18 @@ static int evdev_event_to_user(char __user *buffer,
486 - return 0;
487 - }
488 -
489 -+static int evdev_ff_effect_from_user(const char __user *buffer, size_t size,
490 -+ struct ff_effect *effect)
491 -+{
492 -+ if (size != sizeof(struct ff_effect))
493 -+ return -EINVAL;
494 -+
495 -+ if (copy_from_user(effect, buffer, sizeof(struct ff_effect)))
496 -+ return -EFAULT;
497 -+
498 -+ return 0;
499 -+}
500 -+
501 - #endif /* CONFIG_COMPAT */
502 -
503 - static ssize_t evdev_write(struct file *file, const char __user *buffer,
504 -@@ -633,17 +710,6 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
505 -
506 - return input_set_keycode(dev, t, v);
507 -
508 -- case EVIOCSFF:
509 -- if (copy_from_user(&effect, p, sizeof(effect)))
510 -- return -EFAULT;
511 --
512 -- error = input_ff_upload(dev, &effect, file);
513 --
514 -- if (put_user(effect.id, &(((struct ff_effect __user *)p)->id)))
515 -- return -EFAULT;
516 --
517 -- return error;
518 --
519 - case EVIOCRMFF:
520 - return input_ff_erase(dev, (int)(unsigned long) p, file);
521 -
522 -@@ -733,6 +799,19 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
523 -
524 - if (_IOC_DIR(cmd) == _IOC_WRITE) {
525 -
526 -+ if (_IOC_NR(cmd) == _IOC_NR(EVIOCSFF)) {
527 -+
528 -+ if (evdev_ff_effect_from_user(p, _IOC_SIZE(cmd), &effect))
529 -+ return -EFAULT;
530 -+
531 -+ error = input_ff_upload(dev, &effect, file);
532 -+
533 -+ if (put_user(effect.id, &(((struct ff_effect __user *)p)->id)))
534 -+ return -EFAULT;
535 -+
536 -+ return error;
537 -+ }
538 -+
539 - if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) {
540 -
541 - t = _IOC_NR(cmd) & ABS_MAX;