Annotation of /trunk/kernel26-alx/patches-3.10/0171-3.10.72-all-fixes.patch
Parent Directory | Revision Log
Revision 2672 -
(hide annotations)
(download)
Tue Jul 21 16:46:35 2015 UTC (9 years, 2 months ago) by niro
File size: 73972 byte(s)
Tue Jul 21 16:46:35 2015 UTC (9 years, 2 months ago) by niro
File size: 73972 byte(s)
-3.10.84-alx-r1
1 | niro | 2672 | diff --git a/Makefile b/Makefile |
2 | index d8b42f71ea5a..211bb34102bf 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,6 +1,6 @@ | ||
6 | VERSION = 3 | ||
7 | PATCHLEVEL = 10 | ||
8 | -SUBLEVEL = 71 | ||
9 | +SUBLEVEL = 72 | ||
10 | EXTRAVERSION = | ||
11 | NAME = TOSSUG Baby Fish | ||
12 | |||
13 | diff --git a/arch/mips/kvm/trace.h b/arch/mips/kvm/trace.h | ||
14 | index bc9e0f406c08..e51621e36152 100644 | ||
15 | --- a/arch/mips/kvm/trace.h | ||
16 | +++ b/arch/mips/kvm/trace.h | ||
17 | @@ -26,18 +26,18 @@ TRACE_EVENT(kvm_exit, | ||
18 | TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason), | ||
19 | TP_ARGS(vcpu, reason), | ||
20 | TP_STRUCT__entry( | ||
21 | - __field(struct kvm_vcpu *, vcpu) | ||
22 | + __field(unsigned long, pc) | ||
23 | __field(unsigned int, reason) | ||
24 | ), | ||
25 | |||
26 | TP_fast_assign( | ||
27 | - __entry->vcpu = vcpu; | ||
28 | + __entry->pc = vcpu->arch.pc; | ||
29 | __entry->reason = reason; | ||
30 | ), | ||
31 | |||
32 | TP_printk("[%s]PC: 0x%08lx", | ||
33 | kvm_mips_exit_types_str[__entry->reason], | ||
34 | - __entry->vcpu->arch.pc) | ||
35 | + __entry->pc) | ||
36 | ); | ||
37 | |||
38 | #endif /* _TRACE_KVM_H */ | ||
39 | diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S | ||
40 | index 948b2e14df8c..6ed8f16fd61b 100644 | ||
41 | --- a/arch/x86/kernel/entry_64.S | ||
42 | +++ b/arch/x86/kernel/entry_64.S | ||
43 | @@ -557,11 +557,14 @@ ENTRY(ret_from_fork) | ||
44 | testl $3, CS-ARGOFFSET(%rsp) # from kernel_thread? | ||
45 | jz 1f | ||
46 | |||
47 | - testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET | ||
48 | - jnz int_ret_from_sys_call | ||
49 | - | ||
50 | - RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET | ||
51 | - jmp ret_from_sys_call # go to the SYSRET fastpath | ||
52 | + /* | ||
53 | + * By the time we get here, we have no idea whether our pt_regs, | ||
54 | + * ti flags, and ti status came from the 64-bit SYSCALL fast path, | ||
55 | + * the slow path, or one of the ia32entry paths. | ||
56 | + * Use int_ret_from_sys_call to return, since it can safely handle | ||
57 | + * all of the above. | ||
58 | + */ | ||
59 | + jmp int_ret_from_sys_call | ||
60 | |||
61 | 1: | ||
62 | subq $REST_SKIP, %rsp # leave space for volatiles | ||
63 | diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c | ||
64 | index 4c01f022c6ac..af88fa20dbe8 100644 | ||
65 | --- a/arch/x86/kvm/emulate.c | ||
66 | +++ b/arch/x86/kvm/emulate.c | ||
67 | @@ -4732,7 +4732,8 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) | ||
68 | if (rc != X86EMUL_CONTINUE) | ||
69 | goto done; | ||
70 | } | ||
71 | - ctxt->dst.orig_val = ctxt->dst.val; | ||
72 | + /* Copy full 64-bit value for CMPXCHG8B. */ | ||
73 | + ctxt->dst.orig_val64 = ctxt->dst.val64; | ||
74 | |||
75 | special_insn: | ||
76 | |||
77 | diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c | ||
78 | index 82a01cc45f9c..0dc9ff61d7c2 100644 | ||
79 | --- a/drivers/acpi/video.c | ||
80 | +++ b/drivers/acpi/video.c | ||
81 | @@ -1953,6 +1953,17 @@ EXPORT_SYMBOL(acpi_video_unregister); | ||
82 | |||
83 | static int __init acpi_video_init(void) | ||
84 | { | ||
85 | + /* | ||
86 | + * Let the module load even if ACPI is disabled (e.g. due to | ||
87 | + * a broken BIOS) so that i915.ko can still be loaded on such | ||
88 | + * old systems without an AcpiOpRegion. | ||
89 | + * | ||
90 | + * acpi_video_register() will report -ENODEV later as well due | ||
91 | + * to acpi_disabled when i915.ko tries to register itself afterwards. | ||
92 | + */ | ||
93 | + if (acpi_disabled) | ||
94 | + return 0; | ||
95 | + | ||
96 | dmi_check_system(video_dmi_table); | ||
97 | |||
98 | if (intel_opregion_present()) | ||
99 | diff --git a/drivers/clk/sunxi/clk-factors.c b/drivers/clk/sunxi/clk-factors.c | ||
100 | index 88523f91d9b7..7555793097f2 100644 | ||
101 | --- a/drivers/clk/sunxi/clk-factors.c | ||
102 | +++ b/drivers/clk/sunxi/clk-factors.c | ||
103 | @@ -70,7 +70,7 @@ static unsigned long clk_factors_recalc_rate(struct clk_hw *hw, | ||
104 | p = FACTOR_GET(config->pshift, config->pwidth, reg); | ||
105 | |||
106 | /* Calculate the rate */ | ||
107 | - rate = (parent_rate * n * (k + 1) >> p) / (m + 1); | ||
108 | + rate = (parent_rate * (n + config->n_start) * (k + 1) >> p) / (m + 1); | ||
109 | |||
110 | return rate; | ||
111 | } | ||
112 | diff --git a/drivers/clk/sunxi/clk-factors.h b/drivers/clk/sunxi/clk-factors.h | ||
113 | index f49851cc4380..441fdc3f5717 100644 | ||
114 | --- a/drivers/clk/sunxi/clk-factors.h | ||
115 | +++ b/drivers/clk/sunxi/clk-factors.h | ||
116 | @@ -15,6 +15,7 @@ struct clk_factors_config { | ||
117 | u8 mwidth; | ||
118 | u8 pshift; | ||
119 | u8 pwidth; | ||
120 | + u8 n_start; | ||
121 | }; | ||
122 | |||
123 | struct clk *clk_register_factors(struct device *dev, const char *name, | ||
124 | diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c | ||
125 | index 451d7886644c..c254e467ac62 100644 | ||
126 | --- a/drivers/gpu/drm/radeon/ni.c | ||
127 | +++ b/drivers/gpu/drm/radeon/ni.c | ||
128 | @@ -930,12 +930,12 @@ static void cayman_gpu_init(struct radeon_device *rdev) | ||
129 | |||
130 | if ((rdev->config.cayman.max_backends_per_se == 1) && | ||
131 | (rdev->flags & RADEON_IS_IGP)) { | ||
132 | - if ((disabled_rb_mask & 3) == 1) { | ||
133 | - /* RB0 disabled, RB1 enabled */ | ||
134 | - tmp = 0x11111111; | ||
135 | - } else { | ||
136 | + if ((disabled_rb_mask & 3) == 2) { | ||
137 | /* RB1 disabled, RB0 enabled */ | ||
138 | tmp = 0x00000000; | ||
139 | + } else { | ||
140 | + /* RB0 disabled, RB1 enabled */ | ||
141 | + tmp = 0x11111111; | ||
142 | } | ||
143 | } else { | ||
144 | tmp = gb_addr_config & NUM_PIPES_MASK; | ||
145 | diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c | ||
146 | index 03a6acffed5d..a3915d12e746 100644 | ||
147 | --- a/drivers/hid/hid-input.c | ||
148 | +++ b/drivers/hid/hid-input.c | ||
149 | @@ -1066,6 +1066,23 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct | ||
150 | return; | ||
151 | } | ||
152 | |||
153 | + /* | ||
154 | + * Ignore reports for absolute data if the data didn't change. This is | ||
155 | + * not only an optimization but also fixes 'dead' key reports. Some | ||
156 | + * RollOver implementations for localized keys (like BACKSLASH/PIPE; HID | ||
157 | + * 0x31 and 0x32) report multiple keys, even though a localized keyboard | ||
158 | + * can only have one of them physically available. The 'dead' keys | ||
159 | + * report constant 0. As all map to the same keycode, they'd confuse | ||
160 | + * the input layer. If we filter the 'dead' keys on the HID level, we | ||
161 | + * skip the keycode translation and only forward real events. | ||
162 | + */ | ||
163 | + if (!(field->flags & (HID_MAIN_ITEM_RELATIVE | | ||
164 | + HID_MAIN_ITEM_BUFFERED_BYTE)) && | ||
165 | + (field->flags & HID_MAIN_ITEM_VARIABLE) && | ||
166 | + usage->usage_index < field->maxusage && | ||
167 | + value == field->value[usage->usage_index]) | ||
168 | + return; | ||
169 | + | ||
170 | /* report the usage code as scancode if the key status has changed */ | ||
171 | if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value) | ||
172 | input_event(input, EV_MSC, MSC_SCAN, usage->hid); | ||
173 | diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c | ||
174 | index 4004e54ef05d..f445b0840d33 100644 | ||
175 | --- a/drivers/hv/vmbus_drv.c | ||
176 | +++ b/drivers/hv/vmbus_drv.c | ||
177 | @@ -686,7 +686,7 @@ int vmbus_device_register(struct hv_device *child_device_obj) | ||
178 | if (ret) | ||
179 | pr_err("Unable to register child device\n"); | ||
180 | else | ||
181 | - pr_info("child device %s registered\n", | ||
182 | + pr_debug("child device %s registered\n", | ||
183 | dev_name(&child_device_obj->device)); | ||
184 | |||
185 | return ret; | ||
186 | @@ -698,14 +698,14 @@ int vmbus_device_register(struct hv_device *child_device_obj) | ||
187 | */ | ||
188 | void vmbus_device_unregister(struct hv_device *device_obj) | ||
189 | { | ||
190 | + pr_debug("child device %s unregistered\n", | ||
191 | + dev_name(&device_obj->device)); | ||
192 | + | ||
193 | /* | ||
194 | * Kick off the process of unregistering the device. | ||
195 | * This will call vmbus_remove() and eventually vmbus_device_release() | ||
196 | */ | ||
197 | device_unregister(&device_obj->device); | ||
198 | - | ||
199 | - pr_info("child device %s unregistered\n", | ||
200 | - dev_name(&device_obj->device)); | ||
201 | } | ||
202 | |||
203 | |||
204 | diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c | ||
205 | index d6ece2d17dec..7d60c85cc16d 100644 | ||
206 | --- a/drivers/iio/imu/adis16400_core.c | ||
207 | +++ b/drivers/iio/imu/adis16400_core.c | ||
208 | @@ -26,6 +26,7 @@ | ||
209 | #include <linux/list.h> | ||
210 | #include <linux/module.h> | ||
211 | #include <linux/debugfs.h> | ||
212 | +#include <linux/bitops.h> | ||
213 | |||
214 | #include <linux/iio/iio.h> | ||
215 | #include <linux/iio/sysfs.h> | ||
216 | @@ -447,7 +448,7 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, | ||
217 | mutex_unlock(&indio_dev->mlock); | ||
218 | if (ret) | ||
219 | return ret; | ||
220 | - val16 = ((val16 & 0xFFF) << 4) >> 4; | ||
221 | + val16 = sign_extend32(val16, 11); | ||
222 | *val = val16; | ||
223 | return IIO_VAL_INT; | ||
224 | case IIO_CHAN_INFO_OFFSET: | ||
225 | diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h | ||
226 | index 4d11575c2010..d1b30c66d604 100644 | ||
227 | --- a/drivers/infiniband/hw/qib/qib.h | ||
228 | +++ b/drivers/infiniband/hw/qib/qib.h | ||
229 | @@ -1055,12 +1055,6 @@ struct qib_devdata { | ||
230 | /* control high-level access to EEPROM */ | ||
231 | struct mutex eep_lock; | ||
232 | uint64_t traffic_wds; | ||
233 | - /* active time is kept in seconds, but logged in hours */ | ||
234 | - atomic_t active_time; | ||
235 | - /* Below are nominal shadow of EEPROM, new since last EEPROM update */ | ||
236 | - uint8_t eep_st_errs[QIB_EEP_LOG_CNT]; | ||
237 | - uint8_t eep_st_new_errs[QIB_EEP_LOG_CNT]; | ||
238 | - uint16_t eep_hrs; | ||
239 | /* | ||
240 | * masks for which bits of errs, hwerrs that cause | ||
241 | * each of the counters to increment. | ||
242 | @@ -1278,8 +1272,7 @@ int qib_twsi_blk_rd(struct qib_devdata *dd, int dev, int addr, void *buffer, | ||
243 | int qib_twsi_blk_wr(struct qib_devdata *dd, int dev, int addr, | ||
244 | const void *buffer, int len); | ||
245 | void qib_get_eeprom_info(struct qib_devdata *); | ||
246 | -int qib_update_eeprom_log(struct qib_devdata *dd); | ||
247 | -void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr); | ||
248 | +#define qib_inc_eeprom_err(dd, eidx, incr) | ||
249 | void qib_dump_lookup_output_queue(struct qib_devdata *); | ||
250 | void qib_force_pio_avail_update(struct qib_devdata *); | ||
251 | void qib_clear_symerror_on_linkup(unsigned long opaque); | ||
252 | diff --git a/drivers/infiniband/hw/qib/qib_eeprom.c b/drivers/infiniband/hw/qib/qib_eeprom.c | ||
253 | index 4d5d71aaa2b4..e2280b07df02 100644 | ||
254 | --- a/drivers/infiniband/hw/qib/qib_eeprom.c | ||
255 | +++ b/drivers/infiniband/hw/qib/qib_eeprom.c | ||
256 | @@ -267,190 +267,9 @@ void qib_get_eeprom_info(struct qib_devdata *dd) | ||
257 | "Board SN %s did not pass functional test: %s\n", | ||
258 | dd->serial, ifp->if_comment); | ||
259 | |||
260 | - memcpy(&dd->eep_st_errs, &ifp->if_errcntp, QIB_EEP_LOG_CNT); | ||
261 | - /* | ||
262 | - * Power-on (actually "active") hours are kept as little-endian value | ||
263 | - * in EEPROM, but as seconds in a (possibly as small as 24-bit) | ||
264 | - * atomic_t while running. | ||
265 | - */ | ||
266 | - atomic_set(&dd->active_time, 0); | ||
267 | - dd->eep_hrs = ifp->if_powerhour[0] | (ifp->if_powerhour[1] << 8); | ||
268 | - | ||
269 | done: | ||
270 | vfree(buf); | ||
271 | |||
272 | bail:; | ||
273 | } | ||
274 | |||
275 | -/** | ||
276 | - * qib_update_eeprom_log - copy active-time and error counters to eeprom | ||
277 | - * @dd: the qlogic_ib device | ||
278 | - * | ||
279 | - * Although the time is kept as seconds in the qib_devdata struct, it is | ||
280 | - * rounded to hours for re-write, as we have only 16 bits in EEPROM. | ||
281 | - * First-cut code reads whole (expected) struct qib_flash, modifies, | ||
282 | - * re-writes. Future direction: read/write only what we need, assuming | ||
283 | - * that the EEPROM had to have been "good enough" for driver init, and | ||
284 | - * if not, we aren't making it worse. | ||
285 | - * | ||
286 | - */ | ||
287 | -int qib_update_eeprom_log(struct qib_devdata *dd) | ||
288 | -{ | ||
289 | - void *buf; | ||
290 | - struct qib_flash *ifp; | ||
291 | - int len, hi_water; | ||
292 | - uint32_t new_time, new_hrs; | ||
293 | - u8 csum; | ||
294 | - int ret, idx; | ||
295 | - unsigned long flags; | ||
296 | - | ||
297 | - /* first, check if we actually need to do anything. */ | ||
298 | - ret = 0; | ||
299 | - for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { | ||
300 | - if (dd->eep_st_new_errs[idx]) { | ||
301 | - ret = 1; | ||
302 | - break; | ||
303 | - } | ||
304 | - } | ||
305 | - new_time = atomic_read(&dd->active_time); | ||
306 | - | ||
307 | - if (ret == 0 && new_time < 3600) | ||
308 | - goto bail; | ||
309 | - | ||
310 | - /* | ||
311 | - * The quick-check above determined that there is something worthy | ||
312 | - * of logging, so get current contents and do a more detailed idea. | ||
313 | - * read full flash, not just currently used part, since it may have | ||
314 | - * been written with a newer definition | ||
315 | - */ | ||
316 | - len = sizeof(struct qib_flash); | ||
317 | - buf = vmalloc(len); | ||
318 | - ret = 1; | ||
319 | - if (!buf) { | ||
320 | - qib_dev_err(dd, | ||
321 | - "Couldn't allocate memory to read %u bytes from eeprom for logging\n", | ||
322 | - len); | ||
323 | - goto bail; | ||
324 | - } | ||
325 | - | ||
326 | - /* Grab semaphore and read current EEPROM. If we get an | ||
327 | - * error, let go, but if not, keep it until we finish write. | ||
328 | - */ | ||
329 | - ret = mutex_lock_interruptible(&dd->eep_lock); | ||
330 | - if (ret) { | ||
331 | - qib_dev_err(dd, "Unable to acquire EEPROM for logging\n"); | ||
332 | - goto free_bail; | ||
333 | - } | ||
334 | - ret = qib_twsi_blk_rd(dd, dd->twsi_eeprom_dev, 0, buf, len); | ||
335 | - if (ret) { | ||
336 | - mutex_unlock(&dd->eep_lock); | ||
337 | - qib_dev_err(dd, "Unable read EEPROM for logging\n"); | ||
338 | - goto free_bail; | ||
339 | - } | ||
340 | - ifp = (struct qib_flash *)buf; | ||
341 | - | ||
342 | - csum = flash_csum(ifp, 0); | ||
343 | - if (csum != ifp->if_csum) { | ||
344 | - mutex_unlock(&dd->eep_lock); | ||
345 | - qib_dev_err(dd, "EEPROM cks err (0x%02X, S/B 0x%02X)\n", | ||
346 | - csum, ifp->if_csum); | ||
347 | - ret = 1; | ||
348 | - goto free_bail; | ||
349 | - } | ||
350 | - hi_water = 0; | ||
351 | - spin_lock_irqsave(&dd->eep_st_lock, flags); | ||
352 | - for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { | ||
353 | - int new_val = dd->eep_st_new_errs[idx]; | ||
354 | - if (new_val) { | ||
355 | - /* | ||
356 | - * If we have seen any errors, add to EEPROM values | ||
357 | - * We need to saturate at 0xFF (255) and we also | ||
358 | - * would need to adjust the checksum if we were | ||
359 | - * trying to minimize EEPROM traffic | ||
360 | - * Note that we add to actual current count in EEPROM, | ||
361 | - * in case it was altered while we were running. | ||
362 | - */ | ||
363 | - new_val += ifp->if_errcntp[idx]; | ||
364 | - if (new_val > 0xFF) | ||
365 | - new_val = 0xFF; | ||
366 | - if (ifp->if_errcntp[idx] != new_val) { | ||
367 | - ifp->if_errcntp[idx] = new_val; | ||
368 | - hi_water = offsetof(struct qib_flash, | ||
369 | - if_errcntp) + idx; | ||
370 | - } | ||
371 | - /* | ||
372 | - * update our shadow (used to minimize EEPROM | ||
373 | - * traffic), to match what we are about to write. | ||
374 | - */ | ||
375 | - dd->eep_st_errs[idx] = new_val; | ||
376 | - dd->eep_st_new_errs[idx] = 0; | ||
377 | - } | ||
378 | - } | ||
379 | - /* | ||
380 | - * Now update active-time. We would like to round to the nearest hour | ||
381 | - * but unless atomic_t are sure to be proper signed ints we cannot, | ||
382 | - * because we need to account for what we "transfer" to EEPROM and | ||
383 | - * if we log an hour at 31 minutes, then we would need to set | ||
384 | - * active_time to -29 to accurately count the _next_ hour. | ||
385 | - */ | ||
386 | - if (new_time >= 3600) { | ||
387 | - new_hrs = new_time / 3600; | ||
388 | - atomic_sub((new_hrs * 3600), &dd->active_time); | ||
389 | - new_hrs += dd->eep_hrs; | ||
390 | - if (new_hrs > 0xFFFF) | ||
391 | - new_hrs = 0xFFFF; | ||
392 | - dd->eep_hrs = new_hrs; | ||
393 | - if ((new_hrs & 0xFF) != ifp->if_powerhour[0]) { | ||
394 | - ifp->if_powerhour[0] = new_hrs & 0xFF; | ||
395 | - hi_water = offsetof(struct qib_flash, if_powerhour); | ||
396 | - } | ||
397 | - if ((new_hrs >> 8) != ifp->if_powerhour[1]) { | ||
398 | - ifp->if_powerhour[1] = new_hrs >> 8; | ||
399 | - hi_water = offsetof(struct qib_flash, if_powerhour) + 1; | ||
400 | - } | ||
401 | - } | ||
402 | - /* | ||
403 | - * There is a tiny possibility that we could somehow fail to write | ||
404 | - * the EEPROM after updating our shadows, but problems from holding | ||
405 | - * the spinlock too long are a much bigger issue. | ||
406 | - */ | ||
407 | - spin_unlock_irqrestore(&dd->eep_st_lock, flags); | ||
408 | - if (hi_water) { | ||
409 | - /* we made some change to the data, uopdate cksum and write */ | ||
410 | - csum = flash_csum(ifp, 1); | ||
411 | - ret = eeprom_write_with_enable(dd, 0, buf, hi_water + 1); | ||
412 | - } | ||
413 | - mutex_unlock(&dd->eep_lock); | ||
414 | - if (ret) | ||
415 | - qib_dev_err(dd, "Failed updating EEPROM\n"); | ||
416 | - | ||
417 | -free_bail: | ||
418 | - vfree(buf); | ||
419 | -bail: | ||
420 | - return ret; | ||
421 | -} | ||
422 | - | ||
423 | -/** | ||
424 | - * qib_inc_eeprom_err - increment one of the four error counters | ||
425 | - * that are logged to EEPROM. | ||
426 | - * @dd: the qlogic_ib device | ||
427 | - * @eidx: 0..3, the counter to increment | ||
428 | - * @incr: how much to add | ||
429 | - * | ||
430 | - * Each counter is 8-bits, and saturates at 255 (0xFF). They | ||
431 | - * are copied to the EEPROM (aka flash) whenever qib_update_eeprom_log() | ||
432 | - * is called, but it can only be called in a context that allows sleep. | ||
433 | - * This function can be called even at interrupt level. | ||
434 | - */ | ||
435 | -void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr) | ||
436 | -{ | ||
437 | - uint new_val; | ||
438 | - unsigned long flags; | ||
439 | - | ||
440 | - spin_lock_irqsave(&dd->eep_st_lock, flags); | ||
441 | - new_val = dd->eep_st_new_errs[eidx] + incr; | ||
442 | - if (new_val > 255) | ||
443 | - new_val = 255; | ||
444 | - dd->eep_st_new_errs[eidx] = new_val; | ||
445 | - spin_unlock_irqrestore(&dd->eep_st_lock, flags); | ||
446 | -} | ||
447 | diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c | ||
448 | index 0232ae56b1fa..4e2613325183 100644 | ||
449 | --- a/drivers/infiniband/hw/qib/qib_iba6120.c | ||
450 | +++ b/drivers/infiniband/hw/qib/qib_iba6120.c | ||
451 | @@ -2682,8 +2682,6 @@ static void qib_get_6120_faststats(unsigned long opaque) | ||
452 | spin_lock_irqsave(&dd->eep_st_lock, flags); | ||
453 | traffic_wds -= dd->traffic_wds; | ||
454 | dd->traffic_wds += traffic_wds; | ||
455 | - if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) | ||
456 | - atomic_add(5, &dd->active_time); /* S/B #define */ | ||
457 | spin_unlock_irqrestore(&dd->eep_st_lock, flags); | ||
458 | |||
459 | qib_chk_6120_errormask(dd); | ||
460 | diff --git a/drivers/infiniband/hw/qib/qib_iba7220.c b/drivers/infiniband/hw/qib/qib_iba7220.c | ||
461 | index 64d0ecb90cdc..3dbabf3a5d6d 100644 | ||
462 | --- a/drivers/infiniband/hw/qib/qib_iba7220.c | ||
463 | +++ b/drivers/infiniband/hw/qib/qib_iba7220.c | ||
464 | @@ -3299,8 +3299,6 @@ static void qib_get_7220_faststats(unsigned long opaque) | ||
465 | spin_lock_irqsave(&dd->eep_st_lock, flags); | ||
466 | traffic_wds -= dd->traffic_wds; | ||
467 | dd->traffic_wds += traffic_wds; | ||
468 | - if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) | ||
469 | - atomic_add(5, &dd->active_time); /* S/B #define */ | ||
470 | spin_unlock_irqrestore(&dd->eep_st_lock, flags); | ||
471 | done: | ||
472 | mod_timer(&dd->stats_timer, jiffies + HZ * ACTIVITY_TIMER); | ||
473 | diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c | ||
474 | index 14103ffb4839..5f5f20f42231 100644 | ||
475 | --- a/drivers/infiniband/hw/qib/qib_iba7322.c | ||
476 | +++ b/drivers/infiniband/hw/qib/qib_iba7322.c | ||
477 | @@ -4854,8 +4854,6 @@ static void qib_get_7322_faststats(unsigned long opaque) | ||
478 | spin_lock_irqsave(&ppd->dd->eep_st_lock, flags); | ||
479 | traffic_wds -= ppd->dd->traffic_wds; | ||
480 | ppd->dd->traffic_wds += traffic_wds; | ||
481 | - if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) | ||
482 | - atomic_add(ACTIVITY_TIMER, &ppd->dd->active_time); | ||
483 | spin_unlock_irqrestore(&ppd->dd->eep_st_lock, flags); | ||
484 | if (ppd->cpspec->qdr_dfe_on && (ppd->link_speed_active & | ||
485 | QIB_IB_QDR) && | ||
486 | diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c | ||
487 | index 173f805790da..8f936e36dd53 100644 | ||
488 | --- a/drivers/infiniband/hw/qib/qib_init.c | ||
489 | +++ b/drivers/infiniband/hw/qib/qib_init.c | ||
490 | @@ -892,7 +892,6 @@ static void qib_shutdown_device(struct qib_devdata *dd) | ||
491 | } | ||
492 | } | ||
493 | |||
494 | - qib_update_eeprom_log(dd); | ||
495 | } | ||
496 | |||
497 | /** | ||
498 | diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c | ||
499 | index 3c8e4e3caca6..b9ccbda7817d 100644 | ||
500 | --- a/drivers/infiniband/hw/qib/qib_sysfs.c | ||
501 | +++ b/drivers/infiniband/hw/qib/qib_sysfs.c | ||
502 | @@ -611,28 +611,6 @@ bail: | ||
503 | return ret < 0 ? ret : count; | ||
504 | } | ||
505 | |||
506 | -static ssize_t show_logged_errs(struct device *device, | ||
507 | - struct device_attribute *attr, char *buf) | ||
508 | -{ | ||
509 | - struct qib_ibdev *dev = | ||
510 | - container_of(device, struct qib_ibdev, ibdev.dev); | ||
511 | - struct qib_devdata *dd = dd_from_dev(dev); | ||
512 | - int idx, count; | ||
513 | - | ||
514 | - /* force consistency with actual EEPROM */ | ||
515 | - if (qib_update_eeprom_log(dd) != 0) | ||
516 | - return -ENXIO; | ||
517 | - | ||
518 | - count = 0; | ||
519 | - for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { | ||
520 | - count += scnprintf(buf + count, PAGE_SIZE - count, "%d%c", | ||
521 | - dd->eep_st_errs[idx], | ||
522 | - idx == (QIB_EEP_LOG_CNT - 1) ? '\n' : ' '); | ||
523 | - } | ||
524 | - | ||
525 | - return count; | ||
526 | -} | ||
527 | - | ||
528 | /* | ||
529 | * Dump tempsense regs. in decimal, to ease shell-scripts. | ||
530 | */ | ||
531 | @@ -679,7 +657,6 @@ static DEVICE_ATTR(nctxts, S_IRUGO, show_nctxts, NULL); | ||
532 | static DEVICE_ATTR(nfreectxts, S_IRUGO, show_nfreectxts, NULL); | ||
533 | static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL); | ||
534 | static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL); | ||
535 | -static DEVICE_ATTR(logged_errors, S_IRUGO, show_logged_errs, NULL); | ||
536 | static DEVICE_ATTR(tempsense, S_IRUGO, show_tempsense, NULL); | ||
537 | static DEVICE_ATTR(localbus_info, S_IRUGO, show_localbus_info, NULL); | ||
538 | static DEVICE_ATTR(chip_reset, S_IWUSR, NULL, store_chip_reset); | ||
539 | @@ -693,7 +670,6 @@ static struct device_attribute *qib_attributes[] = { | ||
540 | &dev_attr_nfreectxts, | ||
541 | &dev_attr_serial, | ||
542 | &dev_attr_boardversion, | ||
543 | - &dev_attr_logged_errors, | ||
544 | &dev_attr_tempsense, | ||
545 | &dev_attr_localbus_info, | ||
546 | &dev_attr_chip_reset, | ||
547 | diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c | ||
548 | index d1de1626a9d2..17cb2170e9d8 100644 | ||
549 | --- a/drivers/md/dm-io.c | ||
550 | +++ b/drivers/md/dm-io.c | ||
551 | @@ -291,6 +291,12 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where, | ||
552 | unsigned short logical_block_size = queue_logical_block_size(q); | ||
553 | sector_t num_sectors; | ||
554 | |||
555 | + /* Reject unsupported discard requests */ | ||
556 | + if ((rw & REQ_DISCARD) && !blk_queue_discard(q)) { | ||
557 | + dec_count(io, region, -EOPNOTSUPP); | ||
558 | + return; | ||
559 | + } | ||
560 | + | ||
561 | /* | ||
562 | * where->count may be zero if rw holds a flush and we need to | ||
563 | * send a zero-sized flush. | ||
564 | diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c | ||
565 | index 699b5be68d31..678556b8ee4d 100644 | ||
566 | --- a/drivers/md/dm-raid1.c | ||
567 | +++ b/drivers/md/dm-raid1.c | ||
568 | @@ -604,6 +604,15 @@ static void write_callback(unsigned long error, void *context) | ||
569 | return; | ||
570 | } | ||
571 | |||
572 | + /* | ||
573 | + * If the bio is discard, return an error, but do not | ||
574 | + * degrade the array. | ||
575 | + */ | ||
576 | + if (bio->bi_rw & REQ_DISCARD) { | ||
577 | + bio_endio(bio, -EOPNOTSUPP); | ||
578 | + return; | ||
579 | + } | ||
580 | + | ||
581 | for (i = 0; i < ms->nr_mirrors; i++) | ||
582 | if (test_bit(i, &error)) | ||
583 | fail_mirror(ms->mirror + i, DM_RAID1_WRITE_ERROR); | ||
584 | diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c | ||
585 | index 944690bafd93..d892a05c84f4 100644 | ||
586 | --- a/drivers/md/dm-snap.c | ||
587 | +++ b/drivers/md/dm-snap.c | ||
588 | @@ -1439,8 +1439,6 @@ out: | ||
589 | full_bio->bi_end_io = pe->full_bio_end_io; | ||
590 | full_bio->bi_private = pe->full_bio_private; | ||
591 | } | ||
592 | - free_pending_exception(pe); | ||
593 | - | ||
594 | increment_pending_exceptions_done_count(); | ||
595 | |||
596 | up_write(&s->lock); | ||
597 | @@ -1457,6 +1455,8 @@ out: | ||
598 | } | ||
599 | |||
600 | retry_origin_bios(s, origin_bios); | ||
601 | + | ||
602 | + free_pending_exception(pe); | ||
603 | } | ||
604 | |||
605 | static void commit_callback(void *context, int success) | ||
606 | diff --git a/drivers/md/dm.c b/drivers/md/dm.c | ||
607 | index 204a59fd872f..a87f0c42cb8b 100644 | ||
608 | --- a/drivers/md/dm.c | ||
609 | +++ b/drivers/md/dm.c | ||
610 | @@ -2270,7 +2270,7 @@ int dm_setup_md_queue(struct mapped_device *md) | ||
611 | return 0; | ||
612 | } | ||
613 | |||
614 | -static struct mapped_device *dm_find_md(dev_t dev) | ||
615 | +struct mapped_device *dm_get_md(dev_t dev) | ||
616 | { | ||
617 | struct mapped_device *md; | ||
618 | unsigned minor = MINOR(dev); | ||
619 | @@ -2281,12 +2281,15 @@ static struct mapped_device *dm_find_md(dev_t dev) | ||
620 | spin_lock(&_minor_lock); | ||
621 | |||
622 | md = idr_find(&_minor_idr, minor); | ||
623 | - if (md && (md == MINOR_ALLOCED || | ||
624 | - (MINOR(disk_devt(dm_disk(md))) != minor) || | ||
625 | - dm_deleting_md(md) || | ||
626 | - test_bit(DMF_FREEING, &md->flags))) { | ||
627 | - md = NULL; | ||
628 | - goto out; | ||
629 | + if (md) { | ||
630 | + if ((md == MINOR_ALLOCED || | ||
631 | + (MINOR(disk_devt(dm_disk(md))) != minor) || | ||
632 | + dm_deleting_md(md) || | ||
633 | + test_bit(DMF_FREEING, &md->flags))) { | ||
634 | + md = NULL; | ||
635 | + goto out; | ||
636 | + } | ||
637 | + dm_get(md); | ||
638 | } | ||
639 | |||
640 | out: | ||
641 | @@ -2294,16 +2297,6 @@ out: | ||
642 | |||
643 | return md; | ||
644 | } | ||
645 | - | ||
646 | -struct mapped_device *dm_get_md(dev_t dev) | ||
647 | -{ | ||
648 | - struct mapped_device *md = dm_find_md(dev); | ||
649 | - | ||
650 | - if (md) | ||
651 | - dm_get(md); | ||
652 | - | ||
653 | - return md; | ||
654 | -} | ||
655 | EXPORT_SYMBOL_GPL(dm_get_md); | ||
656 | |||
657 | void *dm_get_mdptr(struct mapped_device *md) | ||
658 | diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c | ||
659 | index 2d255ba911d5..8fc46fcaee54 100644 | ||
660 | --- a/drivers/net/macvtap.c | ||
661 | +++ b/drivers/net/macvtap.c | ||
662 | @@ -658,12 +658,15 @@ static unsigned long iov_pages(const struct iovec *iv, int offset, | ||
663 | return pages; | ||
664 | } | ||
665 | |||
666 | +/* Neighbour code has some assumptions on HH_DATA_MOD alignment */ | ||
667 | +#define MACVTAP_RESERVE HH_DATA_OFF(ETH_HLEN) | ||
668 | + | ||
669 | /* Get packet from user space buffer */ | ||
670 | static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, | ||
671 | const struct iovec *iv, unsigned long total_len, | ||
672 | size_t count, int noblock) | ||
673 | { | ||
674 | - int good_linear = SKB_MAX_HEAD(NET_IP_ALIGN); | ||
675 | + int good_linear = SKB_MAX_HEAD(MACVTAP_RESERVE); | ||
676 | struct sk_buff *skb; | ||
677 | struct macvlan_dev *vlan; | ||
678 | unsigned long len = total_len; | ||
679 | @@ -722,7 +725,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, | ||
680 | linear = vnet_hdr.hdr_len; | ||
681 | } | ||
682 | |||
683 | - skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen, | ||
684 | + skb = macvtap_alloc_skb(&q->sk, MACVTAP_RESERVE, copylen, | ||
685 | linear, noblock, &err); | ||
686 | if (!skb) | ||
687 | goto err; | ||
688 | diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c | ||
689 | index 38f0b312ff85..427e48a80efa 100644 | ||
690 | --- a/drivers/net/phy/phy.c | ||
691 | +++ b/drivers/net/phy/phy.c | ||
692 | @@ -203,6 +203,25 @@ static inline int phy_find_valid(int idx, u32 features) | ||
693 | } | ||
694 | |||
695 | /** | ||
696 | + * phy_check_valid - check if there is a valid PHY setting which matches | ||
697 | + * speed, duplex, and feature mask | ||
698 | + * @speed: speed to match | ||
699 | + * @duplex: duplex to match | ||
700 | + * @features: A mask of the valid settings | ||
701 | + * | ||
702 | + * Description: Returns true if there is a valid setting, false otherwise. | ||
703 | + */ | ||
704 | +static inline bool phy_check_valid(int speed, int duplex, u32 features) | ||
705 | +{ | ||
706 | + unsigned int idx; | ||
707 | + | ||
708 | + idx = phy_find_valid(phy_find_setting(speed, duplex), features); | ||
709 | + | ||
710 | + return settings[idx].speed == speed && settings[idx].duplex == duplex && | ||
711 | + (settings[idx].setting & features); | ||
712 | +} | ||
713 | + | ||
714 | +/** | ||
715 | * phy_sanitize_settings - make sure the PHY is set to supported speed and duplex | ||
716 | * @phydev: the target phy_device struct | ||
717 | * | ||
718 | @@ -1011,7 +1030,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | ||
719 | (phydev->interface == PHY_INTERFACE_MODE_RGMII))) { | ||
720 | int eee_lp, eee_cap, eee_adv; | ||
721 | u32 lp, cap, adv; | ||
722 | - int idx, status; | ||
723 | + int status; | ||
724 | |||
725 | /* Read phy status to properly get the right settings */ | ||
726 | status = phy_read_status(phydev); | ||
727 | @@ -1043,8 +1062,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | ||
728 | |||
729 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); | ||
730 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); | ||
731 | - idx = phy_find_setting(phydev->speed, phydev->duplex); | ||
732 | - if (!(lp & adv & settings[idx].setting)) | ||
733 | + if (!phy_check_valid(phydev->speed, phydev->duplex, lp & adv)) | ||
734 | goto eee_exit; | ||
735 | |||
736 | if (clk_stop_enable) { | ||
737 | diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c | ||
738 | index 12222290c802..14179a6593ef 100644 | ||
739 | --- a/drivers/net/team/team.c | ||
740 | +++ b/drivers/net/team/team.c | ||
741 | @@ -42,9 +42,7 @@ | ||
742 | |||
743 | static struct team_port *team_port_get_rcu(const struct net_device *dev) | ||
744 | { | ||
745 | - struct team_port *port = rcu_dereference(dev->rx_handler_data); | ||
746 | - | ||
747 | - return team_port_exists(dev) ? port : NULL; | ||
748 | + return rcu_dereference(dev->rx_handler_data); | ||
749 | } | ||
750 | |||
751 | static struct team_port *team_port_get_rtnl(const struct net_device *dev) | ||
752 | @@ -1523,11 +1521,11 @@ static int team_set_mac_address(struct net_device *dev, void *p) | ||
753 | if (dev->type == ARPHRD_ETHER && !is_valid_ether_addr(addr->sa_data)) | ||
754 | return -EADDRNOTAVAIL; | ||
755 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); | ||
756 | - rcu_read_lock(); | ||
757 | - list_for_each_entry_rcu(port, &team->port_list, list) | ||
758 | + mutex_lock(&team->lock); | ||
759 | + list_for_each_entry(port, &team->port_list, list) | ||
760 | if (team->ops.port_change_dev_addr) | ||
761 | team->ops.port_change_dev_addr(team, port); | ||
762 | - rcu_read_unlock(); | ||
763 | + mutex_unlock(&team->lock); | ||
764 | return 0; | ||
765 | } | ||
766 | |||
767 | diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c | ||
768 | index 0fcc8e65a068..74323e9d9004 100644 | ||
769 | --- a/drivers/net/usb/plusb.c | ||
770 | +++ b/drivers/net/usb/plusb.c | ||
771 | @@ -136,6 +136,11 @@ static const struct usb_device_id products [] = { | ||
772 | }, { | ||
773 | USB_DEVICE(0x050d, 0x258a), /* Belkin F5U258/F5U279 (PL-25A1) */ | ||
774 | .driver_info = (unsigned long) &prolific_info, | ||
775 | +}, { | ||
776 | + USB_DEVICE(0x3923, 0x7825), /* National Instruments USB | ||
777 | + * Host-to-Host Cable | ||
778 | + */ | ||
779 | + .driver_info = (unsigned long) &prolific_info, | ||
780 | }, | ||
781 | |||
782 | { }, // END | ||
783 | diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c | ||
784 | index a3399c4f13a9..b9b651ea9851 100644 | ||
785 | --- a/drivers/net/wireless/ath/ath5k/reset.c | ||
786 | +++ b/drivers/net/wireless/ath/ath5k/reset.c | ||
787 | @@ -478,7 +478,7 @@ ath5k_hw_wisoc_reset(struct ath5k_hw *ah, u32 flags) | ||
788 | regval = ioread32(reg); | ||
789 | iowrite32(regval | val, reg); | ||
790 | regval = ioread32(reg); | ||
791 | - usleep_range(100, 150); | ||
792 | + udelay(100); /* NB: should be atomic */ | ||
793 | |||
794 | /* Bring BB/MAC out of reset */ | ||
795 | iowrite32(regval & ~val, reg); | ||
796 | diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c | ||
797 | index d24a2867bc21..1ad39c799c74 100644 | ||
798 | --- a/drivers/scsi/be2iscsi/be_main.c | ||
799 | +++ b/drivers/scsi/be2iscsi/be_main.c | ||
800 | @@ -564,7 +564,6 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev) | ||
801 | "beiscsi_hba_alloc - iscsi_host_alloc failed\n"); | ||
802 | return NULL; | ||
803 | } | ||
804 | - shost->dma_boundary = pcidev->dma_mask; | ||
805 | shost->max_id = BE2_MAX_SESSIONS; | ||
806 | shost->max_channel = 0; | ||
807 | shost->max_cmd_len = BEISCSI_MAX_CMD_LEN; | ||
808 | diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c | ||
809 | index df5e961484e1..eb81c98386b9 100644 | ||
810 | --- a/drivers/scsi/sg.c | ||
811 | +++ b/drivers/scsi/sg.c | ||
812 | @@ -522,7 +522,7 @@ static ssize_t | ||
813 | sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) | ||
814 | { | ||
815 | sg_io_hdr_t *hp = &srp->header; | ||
816 | - int err = 0; | ||
817 | + int err = 0, err2; | ||
818 | int len; | ||
819 | |||
820 | if (count < SZ_SG_IO_HDR) { | ||
821 | @@ -551,8 +551,8 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) | ||
822 | goto err_out; | ||
823 | } | ||
824 | err_out: | ||
825 | - err = sg_finish_rem_req(srp); | ||
826 | - return (0 == err) ? count : err; | ||
827 | + err2 = sg_finish_rem_req(srp); | ||
828 | + return err ? : err2 ? : count; | ||
829 | } | ||
830 | |||
831 | static ssize_t | ||
832 | diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c | ||
833 | index ad208cdd53d4..83bcf968ac63 100644 | ||
834 | --- a/drivers/staging/comedi/comedi_compat32.c | ||
835 | +++ b/drivers/staging/comedi/comedi_compat32.c | ||
836 | @@ -270,7 +270,7 @@ static int compat_cmd(struct file *file, unsigned long arg) | ||
837 | { | ||
838 | struct comedi_cmd __user *cmd; | ||
839 | struct comedi32_cmd_struct __user *cmd32; | ||
840 | - int rc; | ||
841 | + int rc, err; | ||
842 | |||
843 | cmd32 = compat_ptr(arg); | ||
844 | cmd = compat_alloc_user_space(sizeof(*cmd)); | ||
845 | @@ -279,7 +279,15 @@ static int compat_cmd(struct file *file, unsigned long arg) | ||
846 | if (rc) | ||
847 | return rc; | ||
848 | |||
849 | - return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd); | ||
850 | + rc = translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd); | ||
851 | + if (rc == -EAGAIN) { | ||
852 | + /* Special case: copy cmd back to user. */ | ||
853 | + err = put_compat_cmd(cmd32, cmd); | ||
854 | + if (err) | ||
855 | + rc = err; | ||
856 | + } | ||
857 | + | ||
858 | + return rc; | ||
859 | } | ||
860 | |||
861 | /* Handle 32-bit COMEDI_CMDTEST ioctl. */ | ||
862 | diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c | ||
863 | index c3e5495b4f06..4220a44186c4 100644 | ||
864 | --- a/drivers/staging/comedi/drivers/cb_pcidas64.c | ||
865 | +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c | ||
866 | @@ -455,6 +455,29 @@ static const struct comedi_lrange ai_ranges_64xx = { | ||
867 | } | ||
868 | }; | ||
869 | |||
870 | +static const uint8_t ai_range_code_64xx[8] = { | ||
871 | + 0x0, 0x1, 0x2, 0x3, /* bipolar 10, 5, 2,5, 1.25 */ | ||
872 | + 0x8, 0x9, 0xa, 0xb /* unipolar 10, 5, 2.5, 1.25 */ | ||
873 | +}; | ||
874 | + | ||
875 | +/* analog input ranges for 64-Mx boards */ | ||
876 | +static const struct comedi_lrange ai_ranges_64_mx = { | ||
877 | + 7, { | ||
878 | + BIP_RANGE(5), | ||
879 | + BIP_RANGE(2.5), | ||
880 | + BIP_RANGE(1.25), | ||
881 | + BIP_RANGE(0.625), | ||
882 | + UNI_RANGE(5), | ||
883 | + UNI_RANGE(2.5), | ||
884 | + UNI_RANGE(1.25) | ||
885 | + } | ||
886 | +}; | ||
887 | + | ||
888 | +static const uint8_t ai_range_code_64_mx[7] = { | ||
889 | + 0x0, 0x1, 0x2, 0x3, /* bipolar 5, 2.5, 1.25, 0.625 */ | ||
890 | + 0x9, 0xa, 0xb /* unipolar 5, 2.5, 1.25 */ | ||
891 | +}; | ||
892 | + | ||
893 | /* analog input ranges for 60xx boards */ | ||
894 | static const struct comedi_lrange ai_ranges_60xx = { | ||
895 | 4, | ||
896 | @@ -466,6 +489,10 @@ static const struct comedi_lrange ai_ranges_60xx = { | ||
897 | } | ||
898 | }; | ||
899 | |||
900 | +static const uint8_t ai_range_code_60xx[4] = { | ||
901 | + 0x0, 0x1, 0x4, 0x7 /* bipolar 10, 5, 0.5, 0.05 */ | ||
902 | +}; | ||
903 | + | ||
904 | /* analog input ranges for 6030, etc boards */ | ||
905 | static const struct comedi_lrange ai_ranges_6030 = { | ||
906 | 14, | ||
907 | @@ -487,6 +514,11 @@ static const struct comedi_lrange ai_ranges_6030 = { | ||
908 | } | ||
909 | }; | ||
910 | |||
911 | +static const uint8_t ai_range_code_6030[14] = { | ||
912 | + 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, /* bip 10, 5, 2, 1, 0.5, 0.2, 0.1 */ | ||
913 | + 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* uni 10, 5, 2, 1, 0.5, 0.2, 0.1 */ | ||
914 | +}; | ||
915 | + | ||
916 | /* analog input ranges for 6052, etc boards */ | ||
917 | static const struct comedi_lrange ai_ranges_6052 = { | ||
918 | 15, | ||
919 | @@ -509,6 +541,11 @@ static const struct comedi_lrange ai_ranges_6052 = { | ||
920 | } | ||
921 | }; | ||
922 | |||
923 | +static const uint8_t ai_range_code_6052[15] = { | ||
924 | + 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, /* bipolar 10 ... 0.05 */ | ||
925 | + 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* unipolar 10 ... 0.1 */ | ||
926 | +}; | ||
927 | + | ||
928 | /* analog input ranges for 4020 board */ | ||
929 | static const struct comedi_lrange ai_ranges_4020 = { | ||
930 | 2, | ||
931 | @@ -616,6 +653,7 @@ struct pcidas64_board { | ||
932 | int ai_bits; /* analog input resolution */ | ||
933 | int ai_speed; /* fastest conversion period in ns */ | ||
934 | const struct comedi_lrange *ai_range_table; | ||
935 | + const uint8_t *ai_range_code; | ||
936 | int ao_nchan; /* number of analog out channels */ | ||
937 | int ao_bits; /* analog output resolution */ | ||
938 | int ao_scan_speed; /* analog output scan speed */ | ||
939 | @@ -674,6 +712,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
940 | .ao_scan_speed = 10000, | ||
941 | .layout = LAYOUT_64XX, | ||
942 | .ai_range_table = &ai_ranges_64xx, | ||
943 | + .ai_range_code = ai_range_code_64xx, | ||
944 | .ao_range_table = &ao_ranges_64xx, | ||
945 | .ao_range_code = ao_range_code_64xx, | ||
946 | .ai_fifo = &ai_fifo_64xx, | ||
947 | @@ -689,6 +728,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
948 | .ao_scan_speed = 10000, | ||
949 | .layout = LAYOUT_64XX, | ||
950 | .ai_range_table = &ai_ranges_64xx, | ||
951 | + .ai_range_code = ai_range_code_64xx, | ||
952 | .ao_range_table = &ao_ranges_64xx, | ||
953 | .ao_range_code = ao_range_code_64xx, | ||
954 | .ai_fifo = &ai_fifo_64xx, | ||
955 | @@ -703,7 +743,8 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
956 | .ao_bits = 16, | ||
957 | .ao_scan_speed = 10000, | ||
958 | .layout = LAYOUT_64XX, | ||
959 | - .ai_range_table = &ai_ranges_64xx, | ||
960 | + .ai_range_table = &ai_ranges_64_mx, | ||
961 | + .ai_range_code = ai_range_code_64_mx, | ||
962 | .ao_range_table = &ao_ranges_64xx, | ||
963 | .ao_range_code = ao_range_code_64xx, | ||
964 | .ai_fifo = &ai_fifo_64xx, | ||
965 | @@ -718,7 +759,8 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
966 | .ao_bits = 16, | ||
967 | .ao_scan_speed = 10000, | ||
968 | .layout = LAYOUT_64XX, | ||
969 | - .ai_range_table = &ai_ranges_64xx, | ||
970 | + .ai_range_table = &ai_ranges_64_mx, | ||
971 | + .ai_range_code = ai_range_code_64_mx, | ||
972 | .ao_range_table = &ao_ranges_64xx, | ||
973 | .ao_range_code = ao_range_code_64xx, | ||
974 | .ai_fifo = &ai_fifo_64xx, | ||
975 | @@ -733,7 +775,8 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
976 | .ao_bits = 16, | ||
977 | .ao_scan_speed = 10000, | ||
978 | .layout = LAYOUT_64XX, | ||
979 | - .ai_range_table = &ai_ranges_64xx, | ||
980 | + .ai_range_table = &ai_ranges_64_mx, | ||
981 | + .ai_range_code = ai_range_code_64_mx, | ||
982 | .ao_range_table = &ao_ranges_64xx, | ||
983 | .ao_range_code = ao_range_code_64xx, | ||
984 | .ai_fifo = &ai_fifo_64xx, | ||
985 | @@ -748,6 +791,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
986 | .ao_bits = 16, | ||
987 | .layout = LAYOUT_60XX, | ||
988 | .ai_range_table = &ai_ranges_60xx, | ||
989 | + .ai_range_code = ai_range_code_60xx, | ||
990 | .ao_range_table = &range_bipolar10, | ||
991 | .ao_range_code = ao_range_code_60xx, | ||
992 | .ai_fifo = &ai_fifo_60xx, | ||
993 | @@ -763,6 +807,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
994 | .ao_scan_speed = 100000, | ||
995 | .layout = LAYOUT_60XX, | ||
996 | .ai_range_table = &ai_ranges_60xx, | ||
997 | + .ai_range_code = ai_range_code_60xx, | ||
998 | .ao_range_table = &range_bipolar10, | ||
999 | .ao_range_code = ao_range_code_60xx, | ||
1000 | .ai_fifo = &ai_fifo_60xx, | ||
1001 | @@ -777,6 +822,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1002 | .ao_scan_speed = 100000, | ||
1003 | .layout = LAYOUT_60XX, | ||
1004 | .ai_range_table = &ai_ranges_60xx, | ||
1005 | + .ai_range_code = ai_range_code_60xx, | ||
1006 | .ao_range_table = &range_bipolar10, | ||
1007 | .ao_range_code = ao_range_code_60xx, | ||
1008 | .ai_fifo = &ai_fifo_60xx, | ||
1009 | @@ -792,6 +838,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1010 | .ao_scan_speed = 100000, | ||
1011 | .layout = LAYOUT_60XX, | ||
1012 | .ai_range_table = &ai_ranges_60xx, | ||
1013 | + .ai_range_code = ai_range_code_60xx, | ||
1014 | .ao_range_table = &range_bipolar10, | ||
1015 | .ao_range_code = ao_range_code_60xx, | ||
1016 | .ai_fifo = &ai_fifo_60xx, | ||
1017 | @@ -807,6 +854,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1018 | .ao_scan_speed = 10000, | ||
1019 | .layout = LAYOUT_60XX, | ||
1020 | .ai_range_table = &ai_ranges_6030, | ||
1021 | + .ai_range_code = ai_range_code_6030, | ||
1022 | .ao_range_table = &ao_ranges_6030, | ||
1023 | .ao_range_code = ao_range_code_6030, | ||
1024 | .ai_fifo = &ai_fifo_60xx, | ||
1025 | @@ -822,6 +870,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1026 | .ao_scan_speed = 10000, | ||
1027 | .layout = LAYOUT_60XX, | ||
1028 | .ai_range_table = &ai_ranges_6030, | ||
1029 | + .ai_range_code = ai_range_code_6030, | ||
1030 | .ao_range_table = &ao_ranges_6030, | ||
1031 | .ao_range_code = ao_range_code_6030, | ||
1032 | .ai_fifo = &ai_fifo_60xx, | ||
1033 | @@ -835,6 +884,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1034 | .ao_nchan = 0, | ||
1035 | .layout = LAYOUT_60XX, | ||
1036 | .ai_range_table = &ai_ranges_6030, | ||
1037 | + .ai_range_code = ai_range_code_6030, | ||
1038 | .ai_fifo = &ai_fifo_60xx, | ||
1039 | .has_8255 = 0, | ||
1040 | }, | ||
1041 | @@ -846,6 +896,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1042 | .ao_nchan = 0, | ||
1043 | .layout = LAYOUT_60XX, | ||
1044 | .ai_range_table = &ai_ranges_6030, | ||
1045 | + .ai_range_code = ai_range_code_6030, | ||
1046 | .ai_fifo = &ai_fifo_60xx, | ||
1047 | .has_8255 = 0, | ||
1048 | }, | ||
1049 | @@ -858,6 +909,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1050 | .ao_scan_speed = 0, | ||
1051 | .layout = LAYOUT_60XX, | ||
1052 | .ai_range_table = &ai_ranges_60xx, | ||
1053 | + .ai_range_code = ai_range_code_60xx, | ||
1054 | .ai_fifo = &ai_fifo_60xx, | ||
1055 | .has_8255 = 0, | ||
1056 | }, | ||
1057 | @@ -871,6 +923,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1058 | .ao_scan_speed = 100000, | ||
1059 | .layout = LAYOUT_60XX, | ||
1060 | .ai_range_table = &ai_ranges_60xx, | ||
1061 | + .ai_range_code = ai_range_code_60xx, | ||
1062 | .ao_range_table = &range_bipolar10, | ||
1063 | .ao_range_code = ao_range_code_60xx, | ||
1064 | .ai_fifo = &ai_fifo_60xx, | ||
1065 | @@ -886,6 +939,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1066 | .ao_scan_speed = 100000, | ||
1067 | .layout = LAYOUT_60XX, | ||
1068 | .ai_range_table = &ai_ranges_60xx, | ||
1069 | + .ai_range_code = ai_range_code_60xx, | ||
1070 | .ao_range_table = &range_bipolar10, | ||
1071 | .ao_range_code = ao_range_code_60xx, | ||
1072 | .ai_fifo = &ai_fifo_60xx, | ||
1073 | @@ -901,6 +955,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1074 | .ao_scan_speed = 1000, | ||
1075 | .layout = LAYOUT_60XX, | ||
1076 | .ai_range_table = &ai_ranges_6052, | ||
1077 | + .ai_range_code = ai_range_code_6052, | ||
1078 | .ao_range_table = &ao_ranges_6030, | ||
1079 | .ao_range_code = ao_range_code_6030, | ||
1080 | .ai_fifo = &ai_fifo_60xx, | ||
1081 | @@ -916,6 +971,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1082 | .ao_scan_speed = 3333, | ||
1083 | .layout = LAYOUT_60XX, | ||
1084 | .ai_range_table = &ai_ranges_6052, | ||
1085 | + .ai_range_code = ai_range_code_6052, | ||
1086 | .ao_range_table = &ao_ranges_6030, | ||
1087 | .ao_range_code = ao_range_code_6030, | ||
1088 | .ai_fifo = &ai_fifo_60xx, | ||
1089 | @@ -931,6 +987,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1090 | .ao_scan_speed = 1000, | ||
1091 | .layout = LAYOUT_60XX, | ||
1092 | .ai_range_table = &ai_ranges_6052, | ||
1093 | + .ai_range_code = ai_range_code_6052, | ||
1094 | .ao_range_table = &ao_ranges_6030, | ||
1095 | .ao_range_code = ao_range_code_6030, | ||
1096 | .ai_fifo = &ai_fifo_60xx, | ||
1097 | @@ -946,6 +1003,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1098 | .ao_scan_speed = 1000, | ||
1099 | .layout = LAYOUT_60XX, | ||
1100 | .ai_range_table = &ai_ranges_6052, | ||
1101 | + .ai_range_code = ai_range_code_6052, | ||
1102 | .ao_range_table = &ao_ranges_6030, | ||
1103 | .ao_range_code = ao_range_code_6030, | ||
1104 | .ai_fifo = &ai_fifo_60xx, | ||
1105 | @@ -980,6 +1038,7 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1106 | .ao_scan_speed = 10000, | ||
1107 | .layout = LAYOUT_64XX, | ||
1108 | .ai_range_table = &ai_ranges_64xx, | ||
1109 | + .ai_range_code = ai_range_code_64xx, | ||
1110 | .ai_fifo = ai_fifo_64xx, | ||
1111 | .has_8255 = 1, | ||
1112 | }, | ||
1113 | @@ -991,7 +1050,8 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1114 | .ao_nchan = 0, | ||
1115 | .ao_scan_speed = 10000, | ||
1116 | .layout = LAYOUT_64XX, | ||
1117 | - .ai_range_table = &ai_ranges_64xx, | ||
1118 | + .ai_range_table = &ai_ranges_64_mx, | ||
1119 | + .ai_range_code = ai_range_code_64_mx, | ||
1120 | .ai_fifo = ai_fifo_64xx, | ||
1121 | .has_8255 = 1, | ||
1122 | }, | ||
1123 | @@ -1003,7 +1063,8 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1124 | .ao_nchan = 0, | ||
1125 | .ao_scan_speed = 10000, | ||
1126 | .layout = LAYOUT_64XX, | ||
1127 | - .ai_range_table = &ai_ranges_64xx, | ||
1128 | + .ai_range_table = &ai_ranges_64_mx, | ||
1129 | + .ai_range_code = ai_range_code_64_mx, | ||
1130 | .ai_fifo = ai_fifo_64xx, | ||
1131 | .has_8255 = 1, | ||
1132 | }, | ||
1133 | @@ -1015,7 +1076,8 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1134 | .ao_nchan = 0, | ||
1135 | .ao_scan_speed = 10000, | ||
1136 | .layout = LAYOUT_64XX, | ||
1137 | - .ai_range_table = &ai_ranges_64xx, | ||
1138 | + .ai_range_table = &ai_ranges_64_mx, | ||
1139 | + .ai_range_code = ai_range_code_64_mx, | ||
1140 | .ai_fifo = ai_fifo_64xx, | ||
1141 | .has_8255 = 1, | ||
1142 | }, | ||
1143 | @@ -1027,7 +1089,8 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1144 | .ao_nchan = 2, | ||
1145 | .ao_scan_speed = 10000, | ||
1146 | .layout = LAYOUT_64XX, | ||
1147 | - .ai_range_table = &ai_ranges_64xx, | ||
1148 | + .ai_range_table = &ai_ranges_64_mx, | ||
1149 | + .ai_range_code = ai_range_code_64_mx, | ||
1150 | .ai_fifo = ai_fifo_64xx, | ||
1151 | .has_8255 = 1, | ||
1152 | }, | ||
1153 | @@ -1039,7 +1102,8 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1154 | .ao_nchan = 2, | ||
1155 | .ao_scan_speed = 10000, | ||
1156 | .layout = LAYOUT_64XX, | ||
1157 | - .ai_range_table = &ai_ranges_64xx, | ||
1158 | + .ai_range_table = &ai_ranges_64_mx, | ||
1159 | + .ai_range_code = ai_range_code_64_mx, | ||
1160 | .ai_fifo = ai_fifo_64xx, | ||
1161 | .has_8255 = 1, | ||
1162 | }, | ||
1163 | @@ -1051,7 +1115,8 @@ static const struct pcidas64_board pcidas64_boards[] = { | ||
1164 | .ao_nchan = 2, | ||
1165 | .ao_scan_speed = 10000, | ||
1166 | .layout = LAYOUT_64XX, | ||
1167 | - .ai_range_table = &ai_ranges_64xx, | ||
1168 | + .ai_range_table = &ai_ranges_64_mx, | ||
1169 | + .ai_range_code = ai_range_code_64_mx, | ||
1170 | .ai_fifo = ai_fifo_64xx, | ||
1171 | .has_8255 = 1, | ||
1172 | }, | ||
1173 | @@ -1148,45 +1213,8 @@ static unsigned int ai_range_bits_6xxx(const struct comedi_device *dev, | ||
1174 | unsigned int range_index) | ||
1175 | { | ||
1176 | const struct pcidas64_board *thisboard = comedi_board(dev); | ||
1177 | - const struct comedi_krange *range = | ||
1178 | - &thisboard->ai_range_table->range[range_index]; | ||
1179 | - unsigned int bits = 0; | ||
1180 | |||
1181 | - switch (range->max) { | ||
1182 | - case 10000000: | ||
1183 | - bits = 0x000; | ||
1184 | - break; | ||
1185 | - case 5000000: | ||
1186 | - bits = 0x100; | ||
1187 | - break; | ||
1188 | - case 2000000: | ||
1189 | - case 2500000: | ||
1190 | - bits = 0x200; | ||
1191 | - break; | ||
1192 | - case 1000000: | ||
1193 | - case 1250000: | ||
1194 | - bits = 0x300; | ||
1195 | - break; | ||
1196 | - case 500000: | ||
1197 | - bits = 0x400; | ||
1198 | - break; | ||
1199 | - case 200000: | ||
1200 | - case 250000: | ||
1201 | - bits = 0x500; | ||
1202 | - break; | ||
1203 | - case 100000: | ||
1204 | - bits = 0x600; | ||
1205 | - break; | ||
1206 | - case 50000: | ||
1207 | - bits = 0x700; | ||
1208 | - break; | ||
1209 | - default: | ||
1210 | - comedi_error(dev, "bug! in ai_range_bits_6xxx"); | ||
1211 | - break; | ||
1212 | - } | ||
1213 | - if (range->min == 0) | ||
1214 | - bits += 0x900; | ||
1215 | - return bits; | ||
1216 | + return thisboard->ai_range_code[range_index] << 8; | ||
1217 | } | ||
1218 | |||
1219 | static unsigned int hw_revision(const struct comedi_device *dev, | ||
1220 | diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c | ||
1221 | index 92e6c510e5d0..70b0d265c37d 100644 | ||
1222 | --- a/drivers/target/target_core_sbc.c | ||
1223 | +++ b/drivers/target/target_core_sbc.c | ||
1224 | @@ -562,7 +562,8 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) | ||
1225 | unsigned long long end_lba; | ||
1226 | |||
1227 | end_lba = dev->transport->get_blocks(dev) + 1; | ||
1228 | - if (cmd->t_task_lba + sectors > end_lba) { | ||
1229 | + if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) || | ||
1230 | + ((cmd->t_task_lba + sectors) > end_lba)) { | ||
1231 | pr_err("cmd exceeds last lba %llu " | ||
1232 | "(lba %llu, sectors %u)\n", | ||
1233 | end_lba, cmd->t_task_lba, sectors); | ||
1234 | diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c | ||
1235 | index d35afccdb6c9..2967b6eb4c70 100644 | ||
1236 | --- a/drivers/tty/tty_io.c | ||
1237 | +++ b/drivers/tty/tty_io.c | ||
1238 | @@ -992,8 +992,8 @@ EXPORT_SYMBOL(start_tty); | ||
1239 | /* We limit tty time update visibility to every 8 seconds or so. */ | ||
1240 | static void tty_update_time(struct timespec *time) | ||
1241 | { | ||
1242 | - unsigned long sec = get_seconds() & ~7; | ||
1243 | - if ((long)(sec - time->tv_sec) > 0) | ||
1244 | + unsigned long sec = get_seconds(); | ||
1245 | + if (abs(sec - time->tv_sec) & ~7) | ||
1246 | time->tv_sec = sec; | ||
1247 | } | ||
1248 | |||
1249 | diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c | ||
1250 | index 088b4ca7d805..b46aca5cc23c 100644 | ||
1251 | --- a/drivers/tty/tty_ioctl.c | ||
1252 | +++ b/drivers/tty/tty_ioctl.c | ||
1253 | @@ -217,11 +217,17 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout) | ||
1254 | #endif | ||
1255 | if (!timeout) | ||
1256 | timeout = MAX_SCHEDULE_TIMEOUT; | ||
1257 | + | ||
1258 | if (wait_event_interruptible_timeout(tty->write_wait, | ||
1259 | - !tty_chars_in_buffer(tty), timeout) >= 0) { | ||
1260 | - if (tty->ops->wait_until_sent) | ||
1261 | - tty->ops->wait_until_sent(tty, timeout); | ||
1262 | + !tty_chars_in_buffer(tty), timeout) < 0) { | ||
1263 | + return; | ||
1264 | } | ||
1265 | + | ||
1266 | + if (timeout == MAX_SCHEDULE_TIMEOUT) | ||
1267 | + timeout = 0; | ||
1268 | + | ||
1269 | + if (tty->ops->wait_until_sent) | ||
1270 | + tty->ops->wait_until_sent(tty, timeout); | ||
1271 | } | ||
1272 | EXPORT_SYMBOL(tty_wait_until_sent); | ||
1273 | |||
1274 | diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c | ||
1275 | index ce773cca2bf5..78ddfb43750a 100644 | ||
1276 | --- a/drivers/usb/core/devio.c | ||
1277 | +++ b/drivers/usb/core/devio.c | ||
1278 | @@ -501,6 +501,7 @@ static void async_completed(struct urb *urb) | ||
1279 | as->status = urb->status; | ||
1280 | signr = as->signr; | ||
1281 | if (signr) { | ||
1282 | + memset(&sinfo, 0, sizeof(sinfo)); | ||
1283 | sinfo.si_signo = as->signr; | ||
1284 | sinfo.si_errno = as->status; | ||
1285 | sinfo.si_code = SI_ASYNCIO; | ||
1286 | @@ -2228,6 +2229,7 @@ static void usbdev_remove(struct usb_device *udev) | ||
1287 | wake_up_all(&ps->wait); | ||
1288 | list_del_init(&ps->list); | ||
1289 | if (ps->discsignr) { | ||
1290 | + memset(&sinfo, 0, sizeof(sinfo)); | ||
1291 | sinfo.si_signo = ps->discsignr; | ||
1292 | sinfo.si_errno = EPIPE; | ||
1293 | sinfo.si_code = SI_ASYNCIO; | ||
1294 | diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c | ||
1295 | index eb45ac843712..9948890ef93e 100644 | ||
1296 | --- a/drivers/usb/host/xhci-ring.c | ||
1297 | +++ b/drivers/usb/host/xhci-ring.c | ||
1298 | @@ -2064,7 +2064,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | ||
1299 | if (event_trb != ep_ring->dequeue) { | ||
1300 | /* The event was for the status stage */ | ||
1301 | if (event_trb == td->last_trb) { | ||
1302 | - if (td->urb->actual_length != 0) { | ||
1303 | + if (td->urb_length_set) { | ||
1304 | /* Don't overwrite a previously set error code | ||
1305 | */ | ||
1306 | if ((*status == -EINPROGRESS || *status == 0) && | ||
1307 | @@ -2078,7 +2078,13 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | ||
1308 | td->urb->transfer_buffer_length; | ||
1309 | } | ||
1310 | } else { | ||
1311 | - /* Maybe the event was for the data stage? */ | ||
1312 | + /* | ||
1313 | + * Maybe the event was for the data stage? If so, update | ||
1314 | + * already the actual_length of the URB and flag it as | ||
1315 | + * set, so that it is not overwritten in the event for | ||
1316 | + * the last TRB. | ||
1317 | + */ | ||
1318 | + td->urb_length_set = true; | ||
1319 | td->urb->actual_length = | ||
1320 | td->urb->transfer_buffer_length - | ||
1321 | EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); | ||
1322 | diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h | ||
1323 | index 627fcd9388ca..373d4dada565 100644 | ||
1324 | --- a/drivers/usb/host/xhci.h | ||
1325 | +++ b/drivers/usb/host/xhci.h | ||
1326 | @@ -1,3 +1,4 @@ | ||
1327 | + | ||
1328 | /* | ||
1329 | * xHCI host controller driver | ||
1330 | * | ||
1331 | @@ -88,9 +89,10 @@ struct xhci_cap_regs { | ||
1332 | #define HCS_IST(p) (((p) >> 0) & 0xf) | ||
1333 | /* bits 4:7, max number of Event Ring segments */ | ||
1334 | #define HCS_ERST_MAX(p) (((p) >> 4) & 0xf) | ||
1335 | +/* bits 21:25 Hi 5 bits of Scratchpad buffers SW must allocate for the HW */ | ||
1336 | /* bit 26 Scratchpad restore - for save/restore HW state - not used yet */ | ||
1337 | -/* bits 27:31 number of Scratchpad buffers SW must allocate for the HW */ | ||
1338 | -#define HCS_MAX_SCRATCHPAD(p) (((p) >> 27) & 0x1f) | ||
1339 | +/* bits 27:31 Lo 5 bits of Scratchpad buffers SW must allocate for the HW */ | ||
1340 | +#define HCS_MAX_SCRATCHPAD(p) ((((p) >> 16) & 0x3e0) | (((p) >> 27) & 0x1f)) | ||
1341 | |||
1342 | /* HCSPARAMS3 - hcs_params3 - bitmasks */ | ||
1343 | /* bits 0:7, Max U1 to U0 latency for the roothub ports */ | ||
1344 | @@ -1258,6 +1260,8 @@ struct xhci_td { | ||
1345 | struct xhci_segment *start_seg; | ||
1346 | union xhci_trb *first_trb; | ||
1347 | union xhci_trb *last_trb; | ||
1348 | + /* actual_length of the URB has already been set */ | ||
1349 | + bool urb_length_set; | ||
1350 | }; | ||
1351 | |||
1352 | /* xHCI command default timeout value */ | ||
1353 | diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c | ||
1354 | index 7229b265870a..5c56efeaf202 100644 | ||
1355 | --- a/drivers/usb/serial/bus.c | ||
1356 | +++ b/drivers/usb/serial/bus.c | ||
1357 | @@ -76,7 +76,7 @@ static int usb_serial_device_probe(struct device *dev) | ||
1358 | retval = device_create_file(dev, &dev_attr_port_number); | ||
1359 | if (retval) { | ||
1360 | if (driver->port_remove) | ||
1361 | - retval = driver->port_remove(port); | ||
1362 | + driver->port_remove(port); | ||
1363 | goto exit_with_autopm; | ||
1364 | } | ||
1365 | |||
1366 | diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c | ||
1367 | index f48f5dfab245..79e9ea005c63 100644 | ||
1368 | --- a/drivers/usb/serial/cp210x.c | ||
1369 | +++ b/drivers/usb/serial/cp210x.c | ||
1370 | @@ -147,6 +147,8 @@ static const struct usb_device_id id_table[] = { | ||
1371 | { USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */ | ||
1372 | { USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */ | ||
1373 | { USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */ | ||
1374 | + { USB_DEVICE(0x16C0, 0x09B0) }, /* Lunatico Seletek */ | ||
1375 | + { USB_DEVICE(0x16C0, 0x09B1) }, /* Lunatico Seletek */ | ||
1376 | { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ | ||
1377 | { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ | ||
1378 | { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ | ||
1379 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c | ||
1380 | index c625f55667f1..cf127a080644 100644 | ||
1381 | --- a/drivers/usb/serial/ftdi_sio.c | ||
1382 | +++ b/drivers/usb/serial/ftdi_sio.c | ||
1383 | @@ -815,6 +815,8 @@ static struct usb_device_id id_table_combined [] = { | ||
1384 | { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, | ||
1385 | { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, | ||
1386 | { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, | ||
1387 | + { USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID), | ||
1388 | + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
1389 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), | ||
1390 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
1391 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID), | ||
1392 | diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h | ||
1393 | index ac703a6e2115..e8d352615297 100644 | ||
1394 | --- a/drivers/usb/serial/ftdi_sio_ids.h | ||
1395 | +++ b/drivers/usb/serial/ftdi_sio_ids.h | ||
1396 | @@ -38,6 +38,9 @@ | ||
1397 | |||
1398 | #define FTDI_LUMEL_PD12_PID 0x6002 | ||
1399 | |||
1400 | +/* Cyber Cortex AV by Fabulous Silicon (http://fabuloussilicon.com) */ | ||
1401 | +#define CYBER_CORTEX_AV_PID 0x8698 | ||
1402 | + | ||
1403 | /* | ||
1404 | * Marvell OpenRD Base, Client | ||
1405 | * http://www.open-rd.org | ||
1406 | diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c | ||
1407 | index 8335b484f14e..a10648d2596b 100644 | ||
1408 | --- a/drivers/usb/serial/generic.c | ||
1409 | +++ b/drivers/usb/serial/generic.c | ||
1410 | @@ -261,7 +261,8 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) | ||
1411 | * character or at least one jiffy. | ||
1412 | */ | ||
1413 | period = max_t(unsigned long, (10 * HZ / bps), 1); | ||
1414 | - period = min_t(unsigned long, period, timeout); | ||
1415 | + if (timeout) | ||
1416 | + period = min_t(unsigned long, period, timeout); | ||
1417 | |||
1418 | dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n", | ||
1419 | __func__, jiffies_to_msecs(timeout), | ||
1420 | @@ -271,7 +272,7 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) | ||
1421 | schedule_timeout_interruptible(period); | ||
1422 | if (signal_pending(current)) | ||
1423 | break; | ||
1424 | - if (time_after(jiffies, expire)) | ||
1425 | + if (timeout && time_after(jiffies, expire)) | ||
1426 | break; | ||
1427 | } | ||
1428 | } | ||
1429 | diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c | ||
1430 | index 743c7c2c949d..6aa8312ad89f 100644 | ||
1431 | --- a/fs/autofs4/dev-ioctl.c | ||
1432 | +++ b/fs/autofs4/dev-ioctl.c | ||
1433 | @@ -95,7 +95,7 @@ static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param) | ||
1434 | */ | ||
1435 | static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *in) | ||
1436 | { | ||
1437 | - struct autofs_dev_ioctl tmp; | ||
1438 | + struct autofs_dev_ioctl tmp, *res; | ||
1439 | |||
1440 | if (copy_from_user(&tmp, in, sizeof(tmp))) | ||
1441 | return ERR_PTR(-EFAULT); | ||
1442 | @@ -103,7 +103,11 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i | ||
1443 | if (tmp.size < sizeof(tmp)) | ||
1444 | return ERR_PTR(-EINVAL); | ||
1445 | |||
1446 | - return memdup_user(in, tmp.size); | ||
1447 | + res = memdup_user(in, tmp.size); | ||
1448 | + if (!IS_ERR(res)) | ||
1449 | + res->size = tmp.size; | ||
1450 | + | ||
1451 | + return res; | ||
1452 | } | ||
1453 | |||
1454 | static inline void free_dev_ioctl(struct autofs_dev_ioctl *param) | ||
1455 | diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c | ||
1456 | index 4205ba752d40..caaf30f9f27f 100644 | ||
1457 | --- a/fs/btrfs/file.c | ||
1458 | +++ b/fs/btrfs/file.c | ||
1459 | @@ -1593,22 +1593,10 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | ||
1460 | mutex_unlock(&inode->i_mutex); | ||
1461 | |||
1462 | /* | ||
1463 | - * we want to make sure fsync finds this change | ||
1464 | - * but we haven't joined a transaction running right now. | ||
1465 | - * | ||
1466 | - * Later on, someone is sure to update the inode and get the | ||
1467 | - * real transid recorded. | ||
1468 | - * | ||
1469 | - * We set last_trans now to the fs_info generation + 1, | ||
1470 | - * this will either be one more than the running transaction | ||
1471 | - * or the generation used for the next transaction if there isn't | ||
1472 | - * one running right now. | ||
1473 | - * | ||
1474 | * We also have to set last_sub_trans to the current log transid, | ||
1475 | * otherwise subsequent syncs to a file that's been synced in this | ||
1476 | * transaction will appear to have already occured. | ||
1477 | */ | ||
1478 | - BTRFS_I(inode)->last_trans = root->fs_info->generation + 1; | ||
1479 | BTRFS_I(inode)->last_sub_trans = root->log_transid; | ||
1480 | if (num_written > 0 || num_written == -EIOCBQUEUED) { | ||
1481 | err = generic_write_sync(file, pos, num_written); | ||
1482 | @@ -1706,25 +1694,37 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | ||
1483 | atomic_inc(&root->log_batch); | ||
1484 | |||
1485 | /* | ||
1486 | - * check the transaction that last modified this inode | ||
1487 | - * and see if its already been committed | ||
1488 | - */ | ||
1489 | - if (!BTRFS_I(inode)->last_trans) { | ||
1490 | - mutex_unlock(&inode->i_mutex); | ||
1491 | - goto out; | ||
1492 | - } | ||
1493 | - | ||
1494 | - /* | ||
1495 | - * if the last transaction that changed this file was before | ||
1496 | - * the current transaction, we can bail out now without any | ||
1497 | - * syncing | ||
1498 | + * If the last transaction that changed this file was before the current | ||
1499 | + * transaction and we have the full sync flag set in our inode, we can | ||
1500 | + * bail out now without any syncing. | ||
1501 | + * | ||
1502 | + * Note that we can't bail out if the full sync flag isn't set. This is | ||
1503 | + * because when the full sync flag is set we start all ordered extents | ||
1504 | + * and wait for them to fully complete - when they complete they update | ||
1505 | + * the inode's last_trans field through: | ||
1506 | + * | ||
1507 | + * btrfs_finish_ordered_io() -> | ||
1508 | + * btrfs_update_inode_fallback() -> | ||
1509 | + * btrfs_update_inode() -> | ||
1510 | + * btrfs_set_inode_last_trans() | ||
1511 | + * | ||
1512 | + * So we are sure that last_trans is up to date and can do this check to | ||
1513 | + * bail out safely. For the fast path, when the full sync flag is not | ||
1514 | + * set in our inode, we can not do it because we start only our ordered | ||
1515 | + * extents and don't wait for them to complete (that is when | ||
1516 | + * btrfs_finish_ordered_io runs), so here at this point their last_trans | ||
1517 | + * value might be less than or equals to fs_info->last_trans_committed, | ||
1518 | + * and setting a speculative last_trans for an inode when a buffered | ||
1519 | + * write is made (such as fs_info->generation + 1 for example) would not | ||
1520 | + * be reliable since after setting the value and before fsync is called | ||
1521 | + * any number of transactions can start and commit (transaction kthread | ||
1522 | + * commits the current transaction periodically), and a transaction | ||
1523 | + * commit does not start nor waits for ordered extents to complete. | ||
1524 | */ | ||
1525 | smp_mb(); | ||
1526 | if (btrfs_inode_in_log(inode, root->fs_info->generation) || | ||
1527 | - BTRFS_I(inode)->last_trans <= | ||
1528 | - root->fs_info->last_trans_committed) { | ||
1529 | - BTRFS_I(inode)->last_trans = 0; | ||
1530 | - | ||
1531 | + (full_sync && BTRFS_I(inode)->last_trans <= | ||
1532 | + root->fs_info->last_trans_committed)) { | ||
1533 | /* | ||
1534 | * We'v had everything committed since the last time we were | ||
1535 | * modified so clear this flag in case it was set for whatever | ||
1536 | diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c | ||
1537 | index 187911fbabce..d20db6437723 100644 | ||
1538 | --- a/fs/btrfs/inode.c | ||
1539 | +++ b/fs/btrfs/inode.c | ||
1540 | @@ -6825,7 +6825,6 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, | ||
1541 | ((BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW) && | ||
1542 | em->block_start != EXTENT_MAP_HOLE)) { | ||
1543 | int type; | ||
1544 | - int ret; | ||
1545 | u64 block_start, orig_start, orig_block_len, ram_bytes; | ||
1546 | |||
1547 | if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) | ||
1548 | diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c | ||
1549 | index bca436330681..7d3331cbccba 100644 | ||
1550 | --- a/fs/btrfs/tree-log.c | ||
1551 | +++ b/fs/btrfs/tree-log.c | ||
1552 | @@ -943,7 +943,7 @@ again: | ||
1553 | base = btrfs_item_ptr_offset(leaf, path->slots[0]); | ||
1554 | |||
1555 | while (cur_offset < item_size) { | ||
1556 | - extref = (struct btrfs_inode_extref *)base + cur_offset; | ||
1557 | + extref = (struct btrfs_inode_extref *)(base + cur_offset); | ||
1558 | |||
1559 | victim_name_len = btrfs_inode_extref_name_len(leaf, extref); | ||
1560 | |||
1561 | diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c | ||
1562 | index c7c83ff0f752..7269ec329c01 100644 | ||
1563 | --- a/fs/debugfs/inode.c | ||
1564 | +++ b/fs/debugfs/inode.c | ||
1565 | @@ -245,10 +245,19 @@ static int debugfs_show_options(struct seq_file *m, struct dentry *root) | ||
1566 | return 0; | ||
1567 | } | ||
1568 | |||
1569 | +static void debugfs_evict_inode(struct inode *inode) | ||
1570 | +{ | ||
1571 | + truncate_inode_pages(&inode->i_data, 0); | ||
1572 | + clear_inode(inode); | ||
1573 | + if (S_ISLNK(inode->i_mode)) | ||
1574 | + kfree(inode->i_private); | ||
1575 | +} | ||
1576 | + | ||
1577 | static const struct super_operations debugfs_super_operations = { | ||
1578 | .statfs = simple_statfs, | ||
1579 | .remount_fs = debugfs_remount, | ||
1580 | .show_options = debugfs_show_options, | ||
1581 | + .evict_inode = debugfs_evict_inode, | ||
1582 | }; | ||
1583 | |||
1584 | static int debug_fill_super(struct super_block *sb, void *data, int silent) | ||
1585 | @@ -465,23 +474,14 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) | ||
1586 | int ret = 0; | ||
1587 | |||
1588 | if (debugfs_positive(dentry)) { | ||
1589 | - if (dentry->d_inode) { | ||
1590 | - dget(dentry); | ||
1591 | - switch (dentry->d_inode->i_mode & S_IFMT) { | ||
1592 | - case S_IFDIR: | ||
1593 | - ret = simple_rmdir(parent->d_inode, dentry); | ||
1594 | - break; | ||
1595 | - case S_IFLNK: | ||
1596 | - kfree(dentry->d_inode->i_private); | ||
1597 | - /* fall through */ | ||
1598 | - default: | ||
1599 | - simple_unlink(parent->d_inode, dentry); | ||
1600 | - break; | ||
1601 | - } | ||
1602 | - if (!ret) | ||
1603 | - d_delete(dentry); | ||
1604 | - dput(dentry); | ||
1605 | - } | ||
1606 | + dget(dentry); | ||
1607 | + if (S_ISDIR(dentry->d_inode->i_mode)) | ||
1608 | + ret = simple_rmdir(parent->d_inode, dentry); | ||
1609 | + else | ||
1610 | + simple_unlink(parent->d_inode, dentry); | ||
1611 | + if (!ret) | ||
1612 | + d_delete(dentry); | ||
1613 | + dput(dentry); | ||
1614 | } | ||
1615 | return ret; | ||
1616 | } | ||
1617 | diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c | ||
1618 | index b2e3ff347620..ecdbae19a766 100644 | ||
1619 | --- a/fs/nilfs2/btree.c | ||
1620 | +++ b/fs/nilfs2/btree.c | ||
1621 | @@ -31,6 +31,8 @@ | ||
1622 | #include "alloc.h" | ||
1623 | #include "dat.h" | ||
1624 | |||
1625 | +static void __nilfs_btree_init(struct nilfs_bmap *bmap); | ||
1626 | + | ||
1627 | static struct nilfs_btree_path *nilfs_btree_alloc_path(void) | ||
1628 | { | ||
1629 | struct nilfs_btree_path *path; | ||
1630 | @@ -368,6 +370,34 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node, | ||
1631 | return ret; | ||
1632 | } | ||
1633 | |||
1634 | +/** | ||
1635 | + * nilfs_btree_root_broken - verify consistency of btree root node | ||
1636 | + * @node: btree root node to be examined | ||
1637 | + * @ino: inode number | ||
1638 | + * | ||
1639 | + * Return Value: If node is broken, 1 is returned. Otherwise, 0 is returned. | ||
1640 | + */ | ||
1641 | +static int nilfs_btree_root_broken(const struct nilfs_btree_node *node, | ||
1642 | + unsigned long ino) | ||
1643 | +{ | ||
1644 | + int level, flags, nchildren; | ||
1645 | + int ret = 0; | ||
1646 | + | ||
1647 | + level = nilfs_btree_node_get_level(node); | ||
1648 | + flags = nilfs_btree_node_get_flags(node); | ||
1649 | + nchildren = nilfs_btree_node_get_nchildren(node); | ||
1650 | + | ||
1651 | + if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN || | ||
1652 | + level > NILFS_BTREE_LEVEL_MAX || | ||
1653 | + nchildren < 0 || | ||
1654 | + nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) { | ||
1655 | + pr_crit("NILFS: bad btree root (inode number=%lu): level = %d, flags = 0x%x, nchildren = %d\n", | ||
1656 | + ino, level, flags, nchildren); | ||
1657 | + ret = 1; | ||
1658 | + } | ||
1659 | + return ret; | ||
1660 | +} | ||
1661 | + | ||
1662 | int nilfs_btree_broken_node_block(struct buffer_head *bh) | ||
1663 | { | ||
1664 | int ret; | ||
1665 | @@ -1713,7 +1743,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *btree, | ||
1666 | |||
1667 | /* convert and insert */ | ||
1668 | dat = NILFS_BMAP_USE_VBN(btree) ? nilfs_bmap_get_dat(btree) : NULL; | ||
1669 | - nilfs_btree_init(btree); | ||
1670 | + __nilfs_btree_init(btree); | ||
1671 | if (nreq != NULL) { | ||
1672 | nilfs_bmap_commit_alloc_ptr(btree, dreq, dat); | ||
1673 | nilfs_bmap_commit_alloc_ptr(btree, nreq, dat); | ||
1674 | @@ -2294,12 +2324,23 @@ static const struct nilfs_bmap_operations nilfs_btree_ops_gc = { | ||
1675 | .bop_gather_data = NULL, | ||
1676 | }; | ||
1677 | |||
1678 | -int nilfs_btree_init(struct nilfs_bmap *bmap) | ||
1679 | +static void __nilfs_btree_init(struct nilfs_bmap *bmap) | ||
1680 | { | ||
1681 | bmap->b_ops = &nilfs_btree_ops; | ||
1682 | bmap->b_nchildren_per_block = | ||
1683 | NILFS_BTREE_NODE_NCHILDREN_MAX(nilfs_btree_node_size(bmap)); | ||
1684 | - return 0; | ||
1685 | +} | ||
1686 | + | ||
1687 | +int nilfs_btree_init(struct nilfs_bmap *bmap) | ||
1688 | +{ | ||
1689 | + int ret = 0; | ||
1690 | + | ||
1691 | + __nilfs_btree_init(bmap); | ||
1692 | + | ||
1693 | + if (nilfs_btree_root_broken(nilfs_btree_get_root(bmap), | ||
1694 | + bmap->b_inode->i_ino)) | ||
1695 | + ret = -EIO; | ||
1696 | + return ret; | ||
1697 | } | ||
1698 | |||
1699 | void nilfs_btree_init_gc(struct nilfs_bmap *bmap) | ||
1700 | diff --git a/fs/proc/generic.c b/fs/proc/generic.c | ||
1701 | index a2596afffae6..846b1d7852ed 100644 | ||
1702 | --- a/fs/proc/generic.c | ||
1703 | +++ b/fs/proc/generic.c | ||
1704 | @@ -19,7 +19,6 @@ | ||
1705 | #include <linux/mount.h> | ||
1706 | #include <linux/init.h> | ||
1707 | #include <linux/idr.h> | ||
1708 | -#include <linux/namei.h> | ||
1709 | #include <linux/bitops.h> | ||
1710 | #include <linux/spinlock.h> | ||
1711 | #include <linux/completion.h> | ||
1712 | @@ -163,17 +162,6 @@ void proc_free_inum(unsigned int inum) | ||
1713 | spin_unlock_irqrestore(&proc_inum_lock, flags); | ||
1714 | } | ||
1715 | |||
1716 | -static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) | ||
1717 | -{ | ||
1718 | - nd_set_link(nd, __PDE_DATA(dentry->d_inode)); | ||
1719 | - return NULL; | ||
1720 | -} | ||
1721 | - | ||
1722 | -static const struct inode_operations proc_link_inode_operations = { | ||
1723 | - .readlink = generic_readlink, | ||
1724 | - .follow_link = proc_follow_link, | ||
1725 | -}; | ||
1726 | - | ||
1727 | /* | ||
1728 | * As some entries in /proc are volatile, we want to | ||
1729 | * get rid of unused dentries. This could be made | ||
1730 | diff --git a/fs/proc/inode.c b/fs/proc/inode.c | ||
1731 | index 073aea60cf8f..843b8ef04e84 100644 | ||
1732 | --- a/fs/proc/inode.c | ||
1733 | +++ b/fs/proc/inode.c | ||
1734 | @@ -23,6 +23,7 @@ | ||
1735 | #include <linux/slab.h> | ||
1736 | #include <linux/mount.h> | ||
1737 | #include <linux/magic.h> | ||
1738 | +#include <linux/namei.h> | ||
1739 | |||
1740 | #include <asm/uaccess.h> | ||
1741 | |||
1742 | @@ -373,6 +374,26 @@ static const struct file_operations proc_reg_file_ops_no_compat = { | ||
1743 | }; | ||
1744 | #endif | ||
1745 | |||
1746 | +static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) | ||
1747 | +{ | ||
1748 | + struct proc_dir_entry *pde = PDE(dentry->d_inode); | ||
1749 | + if (unlikely(!use_pde(pde))) | ||
1750 | + return ERR_PTR(-EINVAL); | ||
1751 | + nd_set_link(nd, pde->data); | ||
1752 | + return pde; | ||
1753 | +} | ||
1754 | + | ||
1755 | +static void proc_put_link(struct dentry *dentry, struct nameidata *nd, void *p) | ||
1756 | +{ | ||
1757 | + unuse_pde(p); | ||
1758 | +} | ||
1759 | + | ||
1760 | +const struct inode_operations proc_link_inode_operations = { | ||
1761 | + .readlink = generic_readlink, | ||
1762 | + .follow_link = proc_follow_link, | ||
1763 | + .put_link = proc_put_link, | ||
1764 | +}; | ||
1765 | + | ||
1766 | struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) | ||
1767 | { | ||
1768 | struct inode *inode = new_inode_pseudo(sb); | ||
1769 | diff --git a/fs/proc/internal.h b/fs/proc/internal.h | ||
1770 | index d600fb098b6a..ec335ef62533 100644 | ||
1771 | --- a/fs/proc/internal.h | ||
1772 | +++ b/fs/proc/internal.h | ||
1773 | @@ -202,6 +202,7 @@ struct pde_opener { | ||
1774 | int closing; | ||
1775 | struct completion *c; | ||
1776 | }; | ||
1777 | +extern const struct inode_operations proc_link_inode_operations; | ||
1778 | |||
1779 | extern const struct inode_operations proc_pid_link_inode_operations; | ||
1780 | |||
1781 | diff --git a/kernel/power/qos.c b/kernel/power/qos.c | ||
1782 | index 25cf89bc659e..8703fc729fb4 100644 | ||
1783 | --- a/kernel/power/qos.c | ||
1784 | +++ b/kernel/power/qos.c | ||
1785 | @@ -369,12 +369,6 @@ void pm_qos_update_request(struct pm_qos_request *req, | ||
1786 | } | ||
1787 | |||
1788 | cancel_delayed_work_sync(&req->work); | ||
1789 | - | ||
1790 | - if (new_value != req->node.prio) | ||
1791 | - pm_qos_update_target( | ||
1792 | - pm_qos_array[req->pm_qos_class]->constraints, | ||
1793 | - &req->node, PM_QOS_UPDATE_REQ, new_value); | ||
1794 | - | ||
1795 | __pm_qos_update_request(req, new_value); | ||
1796 | } | ||
1797 | EXPORT_SYMBOL_GPL(pm_qos_update_request); | ||
1798 | diff --git a/mm/compaction.c b/mm/compaction.c | ||
1799 | index fb797a32362f..eeaaa929d1de 100644 | ||
1800 | --- a/mm/compaction.c | ||
1801 | +++ b/mm/compaction.c | ||
1802 | @@ -881,7 +881,7 @@ static int compact_finished(struct zone *zone, | ||
1803 | return COMPACT_PARTIAL; | ||
1804 | |||
1805 | /* Job done if allocation would set block type */ | ||
1806 | - if (cc->order >= pageblock_order && area->nr_free) | ||
1807 | + if (order >= pageblock_order && area->nr_free) | ||
1808 | return COMPACT_PARTIAL; | ||
1809 | } | ||
1810 | |||
1811 | diff --git a/mm/hugetlb.c b/mm/hugetlb.c | ||
1812 | index 7de4f67c81fe..d9bc87ca062b 100644 | ||
1813 | --- a/mm/hugetlb.c | ||
1814 | +++ b/mm/hugetlb.c | ||
1815 | @@ -2451,9 +2451,10 @@ again: | ||
1816 | continue; | ||
1817 | |||
1818 | /* | ||
1819 | - * HWPoisoned hugepage is already unmapped and dropped reference | ||
1820 | + * Migrating hugepage or HWPoisoned hugepage is already | ||
1821 | + * unmapped and its refcount is dropped, so just clear pte here. | ||
1822 | */ | ||
1823 | - if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) { | ||
1824 | + if (unlikely(!pte_present(pte))) { | ||
1825 | huge_pte_clear(mm, address, ptep); | ||
1826 | continue; | ||
1827 | } | ||
1828 | diff --git a/mm/memory.c b/mm/memory.c | ||
1829 | index 8b2d75f61b32..04232bb173f0 100644 | ||
1830 | --- a/mm/memory.c | ||
1831 | +++ b/mm/memory.c | ||
1832 | @@ -4088,7 +4088,7 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, | ||
1833 | if (follow_phys(vma, addr, write, &prot, &phys_addr)) | ||
1834 | return -EINVAL; | ||
1835 | |||
1836 | - maddr = ioremap_prot(phys_addr, PAGE_SIZE, prot); | ||
1837 | + maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot); | ||
1838 | if (write) | ||
1839 | memcpy_toio(maddr + offset, buf, len); | ||
1840 | else | ||
1841 | diff --git a/mm/mmap.c b/mm/mmap.c | ||
1842 | index 43a7089c6a7c..70ff9b41c970 100644 | ||
1843 | --- a/mm/mmap.c | ||
1844 | +++ b/mm/mmap.c | ||
1845 | @@ -127,7 +127,7 @@ EXPORT_SYMBOL_GPL(vm_memory_committed); | ||
1846 | */ | ||
1847 | int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) | ||
1848 | { | ||
1849 | - unsigned long free, allowed, reserve; | ||
1850 | + long free, allowed, reserve; | ||
1851 | |||
1852 | vm_acct_memory(pages); | ||
1853 | |||
1854 | @@ -193,7 +193,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) | ||
1855 | */ | ||
1856 | if (mm) { | ||
1857 | reserve = sysctl_user_reserve_kbytes >> (PAGE_SHIFT - 10); | ||
1858 | - allowed -= min(mm->total_vm / 32, reserve); | ||
1859 | + allowed -= min_t(long, mm->total_vm / 32, reserve); | ||
1860 | } | ||
1861 | |||
1862 | if (percpu_counter_read_positive(&vm_committed_as) < allowed) | ||
1863 | diff --git a/mm/nommu.c b/mm/nommu.c | ||
1864 | index 298884dcd6e7..d9d07a5d2318 100644 | ||
1865 | --- a/mm/nommu.c | ||
1866 | +++ b/mm/nommu.c | ||
1867 | @@ -1898,7 +1898,7 @@ EXPORT_SYMBOL(unmap_mapping_range); | ||
1868 | */ | ||
1869 | int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) | ||
1870 | { | ||
1871 | - unsigned long free, allowed, reserve; | ||
1872 | + long free, allowed, reserve; | ||
1873 | |||
1874 | vm_acct_memory(pages); | ||
1875 | |||
1876 | @@ -1963,7 +1963,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) | ||
1877 | */ | ||
1878 | if (mm) { | ||
1879 | reserve = sysctl_user_reserve_kbytes >> (PAGE_SHIFT - 10); | ||
1880 | - allowed -= min(mm->total_vm / 32, reserve); | ||
1881 | + allowed -= min_t(long, mm->total_vm / 32, reserve); | ||
1882 | } | ||
1883 | |||
1884 | if (percpu_counter_read_positive(&vm_committed_as) < allowed) | ||
1885 | diff --git a/net/compat.c b/net/compat.c | ||
1886 | index cbc1a2a26587..275af79c131b 100644 | ||
1887 | --- a/net/compat.c | ||
1888 | +++ b/net/compat.c | ||
1889 | @@ -738,24 +738,18 @@ static unsigned char nas[21] = { | ||
1890 | |||
1891 | asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags) | ||
1892 | { | ||
1893 | - if (flags & MSG_CMSG_COMPAT) | ||
1894 | - return -EINVAL; | ||
1895 | return __sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); | ||
1896 | } | ||
1897 | |||
1898 | asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg, | ||
1899 | unsigned int vlen, unsigned int flags) | ||
1900 | { | ||
1901 | - if (flags & MSG_CMSG_COMPAT) | ||
1902 | - return -EINVAL; | ||
1903 | return __sys_sendmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, | ||
1904 | flags | MSG_CMSG_COMPAT); | ||
1905 | } | ||
1906 | |||
1907 | asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags) | ||
1908 | { | ||
1909 | - if (flags & MSG_CMSG_COMPAT) | ||
1910 | - return -EINVAL; | ||
1911 | return __sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); | ||
1912 | } | ||
1913 | |||
1914 | @@ -778,9 +772,6 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, | ||
1915 | int datagrams; | ||
1916 | struct timespec ktspec; | ||
1917 | |||
1918 | - if (flags & MSG_CMSG_COMPAT) | ||
1919 | - return -EINVAL; | ||
1920 | - | ||
1921 | if (timeout == NULL) | ||
1922 | return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, | ||
1923 | flags | MSG_CMSG_COMPAT, NULL); | ||
1924 | diff --git a/net/core/dev.c b/net/core/dev.c | ||
1925 | index c310440309bb..aeca8dd88b2a 100644 | ||
1926 | --- a/net/core/dev.c | ||
1927 | +++ b/net/core/dev.c | ||
1928 | @@ -927,7 +927,7 @@ bool dev_valid_name(const char *name) | ||
1929 | return false; | ||
1930 | |||
1931 | while (*name) { | ||
1932 | - if (*name == '/' || isspace(*name)) | ||
1933 | + if (*name == '/' || *name == ':' || isspace(*name)) | ||
1934 | return false; | ||
1935 | name++; | ||
1936 | } | ||
1937 | diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c | ||
1938 | index ddedf211e588..b96437b6e82b 100644 | ||
1939 | --- a/net/core/gen_stats.c | ||
1940 | +++ b/net/core/gen_stats.c | ||
1941 | @@ -32,6 +32,9 @@ gnet_stats_copy(struct gnet_dump *d, int type, void *buf, int size) | ||
1942 | return 0; | ||
1943 | |||
1944 | nla_put_failure: | ||
1945 | + kfree(d->xstats); | ||
1946 | + d->xstats = NULL; | ||
1947 | + d->xstats_len = 0; | ||
1948 | spin_unlock_bh(d->lock); | ||
1949 | return -1; | ||
1950 | } | ||
1951 | @@ -205,7 +208,9 @@ int | ||
1952 | gnet_stats_copy_app(struct gnet_dump *d, void *st, int len) | ||
1953 | { | ||
1954 | if (d->compat_xstats) { | ||
1955 | - d->xstats = st; | ||
1956 | + d->xstats = kmemdup(st, len, GFP_ATOMIC); | ||
1957 | + if (!d->xstats) | ||
1958 | + goto err_out; | ||
1959 | d->xstats_len = len; | ||
1960 | } | ||
1961 | |||
1962 | @@ -213,6 +218,11 @@ gnet_stats_copy_app(struct gnet_dump *d, void *st, int len) | ||
1963 | return gnet_stats_copy(d, TCA_STATS_APP, st, len); | ||
1964 | |||
1965 | return 0; | ||
1966 | + | ||
1967 | +err_out: | ||
1968 | + d->xstats_len = 0; | ||
1969 | + spin_unlock_bh(d->lock); | ||
1970 | + return -1; | ||
1971 | } | ||
1972 | EXPORT_SYMBOL(gnet_stats_copy_app); | ||
1973 | |||
1974 | @@ -245,6 +255,9 @@ gnet_stats_finish_copy(struct gnet_dump *d) | ||
1975 | return -1; | ||
1976 | } | ||
1977 | |||
1978 | + kfree(d->xstats); | ||
1979 | + d->xstats = NULL; | ||
1980 | + d->xstats_len = 0; | ||
1981 | spin_unlock_bh(d->lock); | ||
1982 | return 0; | ||
1983 | } | ||
1984 | diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c | ||
1985 | index 279b5dcf09ae..a67310e00b3f 100644 | ||
1986 | --- a/net/core/rtnetlink.c | ||
1987 | +++ b/net/core/rtnetlink.c | ||
1988 | @@ -1138,14 +1138,10 @@ static const struct nla_policy ifla_vfinfo_policy[IFLA_VF_INFO_MAX+1] = { | ||
1989 | }; | ||
1990 | |||
1991 | static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { | ||
1992 | - [IFLA_VF_MAC] = { .type = NLA_BINARY, | ||
1993 | - .len = sizeof(struct ifla_vf_mac) }, | ||
1994 | - [IFLA_VF_VLAN] = { .type = NLA_BINARY, | ||
1995 | - .len = sizeof(struct ifla_vf_vlan) }, | ||
1996 | - [IFLA_VF_TX_RATE] = { .type = NLA_BINARY, | ||
1997 | - .len = sizeof(struct ifla_vf_tx_rate) }, | ||
1998 | - [IFLA_VF_SPOOFCHK] = { .type = NLA_BINARY, | ||
1999 | - .len = sizeof(struct ifla_vf_spoofchk) }, | ||
2000 | + [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) }, | ||
2001 | + [IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) }, | ||
2002 | + [IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate) }, | ||
2003 | + [IFLA_VF_SPOOFCHK] = { .len = sizeof(struct ifla_vf_spoofchk) }, | ||
2004 | }; | ||
2005 | |||
2006 | static const struct nla_policy ifla_port_policy[IFLA_PORT_MAX+1] = { | ||
2007 | @@ -1855,8 +1851,16 @@ replay: | ||
2008 | goto out; | ||
2009 | |||
2010 | err = rtnl_configure_link(dev, ifm); | ||
2011 | - if (err < 0) | ||
2012 | - unregister_netdevice(dev); | ||
2013 | + if (err < 0) { | ||
2014 | + if (ops->newlink) { | ||
2015 | + LIST_HEAD(list_kill); | ||
2016 | + | ||
2017 | + ops->dellink(dev, &list_kill); | ||
2018 | + unregister_netdevice_many(&list_kill); | ||
2019 | + } else { | ||
2020 | + unregister_netdevice(dev); | ||
2021 | + } | ||
2022 | + } | ||
2023 | out: | ||
2024 | put_net(dest_net); | ||
2025 | return err; | ||
2026 | diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c | ||
2027 | index b66910aaef4d..4c1884fed548 100644 | ||
2028 | --- a/net/ipv4/ip_fragment.c | ||
2029 | +++ b/net/ipv4/ip_fragment.c | ||
2030 | @@ -678,27 +678,30 @@ EXPORT_SYMBOL(ip_defrag); | ||
2031 | struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user) | ||
2032 | { | ||
2033 | struct iphdr iph; | ||
2034 | + int netoff; | ||
2035 | u32 len; | ||
2036 | |||
2037 | if (skb->protocol != htons(ETH_P_IP)) | ||
2038 | return skb; | ||
2039 | |||
2040 | - if (!skb_copy_bits(skb, 0, &iph, sizeof(iph))) | ||
2041 | + netoff = skb_network_offset(skb); | ||
2042 | + | ||
2043 | + if (skb_copy_bits(skb, netoff, &iph, sizeof(iph)) < 0) | ||
2044 | return skb; | ||
2045 | |||
2046 | if (iph.ihl < 5 || iph.version != 4) | ||
2047 | return skb; | ||
2048 | |||
2049 | len = ntohs(iph.tot_len); | ||
2050 | - if (skb->len < len || len < (iph.ihl * 4)) | ||
2051 | + if (skb->len < netoff + len || len < (iph.ihl * 4)) | ||
2052 | return skb; | ||
2053 | |||
2054 | if (ip_is_fragment(&iph)) { | ||
2055 | skb = skb_share_check(skb, GFP_ATOMIC); | ||
2056 | if (skb) { | ||
2057 | - if (!pskb_may_pull(skb, iph.ihl*4)) | ||
2058 | + if (!pskb_may_pull(skb, netoff + iph.ihl * 4)) | ||
2059 | return skb; | ||
2060 | - if (pskb_trim_rcsum(skb, len)) | ||
2061 | + if (pskb_trim_rcsum(skb, netoff + len)) | ||
2062 | return skb; | ||
2063 | memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); | ||
2064 | if (ip_defrag(skb, user)) | ||
2065 | diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c | ||
2066 | index def18547748e..57e745086302 100644 | ||
2067 | --- a/net/ipv4/ip_output.c | ||
2068 | +++ b/net/ipv4/ip_output.c | ||
2069 | @@ -845,7 +845,8 @@ static int __ip_append_data(struct sock *sk, | ||
2070 | cork->length += length; | ||
2071 | if (((length > mtu) || (skb && skb_has_frags(skb))) && | ||
2072 | (sk->sk_protocol == IPPROTO_UDP) && | ||
2073 | - (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len) { | ||
2074 | + (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len && | ||
2075 | + (sk->sk_type == SOCK_DGRAM)) { | ||
2076 | err = ip_ufo_append_data(sk, queue, getfrag, from, length, | ||
2077 | hh_len, fragheaderlen, transhdrlen, | ||
2078 | maxfraglen, flags); | ||
2079 | diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c | ||
2080 | index 071edcba4158..1ce7ea1f40b7 100644 | ||
2081 | --- a/net/ipv6/ip6_output.c | ||
2082 | +++ b/net/ipv6/ip6_output.c | ||
2083 | @@ -1286,7 +1286,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | ||
2084 | if (((length > mtu) || | ||
2085 | (skb && skb_has_frags(skb))) && | ||
2086 | (sk->sk_protocol == IPPROTO_UDP) && | ||
2087 | - (rt->dst.dev->features & NETIF_F_UFO)) { | ||
2088 | + (rt->dst.dev->features & NETIF_F_UFO) && | ||
2089 | + (sk->sk_type == SOCK_DGRAM)) { | ||
2090 | err = ip6_ufo_append_data(sk, getfrag, from, length, | ||
2091 | hh_len, fragheaderlen, | ||
2092 | transhdrlen, mtu, flags, rt); | ||
2093 | diff --git a/net/ipv6/route.c b/net/ipv6/route.c | ||
2094 | index 92274796eb71..d94d224f7e68 100644 | ||
2095 | --- a/net/ipv6/route.c | ||
2096 | +++ b/net/ipv6/route.c | ||
2097 | @@ -109,7 +109,7 @@ static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old) | ||
2098 | u32 *p = NULL; | ||
2099 | |||
2100 | if (!(rt->dst.flags & DST_HOST)) | ||
2101 | - return NULL; | ||
2102 | + return dst_cow_metrics_generic(dst, old); | ||
2103 | |||
2104 | peer = rt6_get_peer_create(rt); | ||
2105 | if (peer) { | ||
2106 | diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c | ||
2107 | index 41ac7938268b..2ee29ed13bd4 100644 | ||
2108 | --- a/net/irda/ircomm/ircomm_tty.c | ||
2109 | +++ b/net/irda/ircomm/ircomm_tty.c | ||
2110 | @@ -820,7 +820,9 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) | ||
2111 | orig_jiffies = jiffies; | ||
2112 | |||
2113 | /* Set poll time to 200 ms */ | ||
2114 | - poll_time = IRDA_MIN(timeout, msecs_to_jiffies(200)); | ||
2115 | + poll_time = msecs_to_jiffies(200); | ||
2116 | + if (timeout) | ||
2117 | + poll_time = min_t(unsigned long, timeout, poll_time); | ||
2118 | |||
2119 | spin_lock_irqsave(&self->spinlock, flags); | ||
2120 | while (self->tx_skb && self->tx_skb->len) { | ||
2121 | diff --git a/net/sched/ematch.c b/net/sched/ematch.c | ||
2122 | index 3a633debb6df..a2abc449ce8f 100644 | ||
2123 | --- a/net/sched/ematch.c | ||
2124 | +++ b/net/sched/ematch.c | ||
2125 | @@ -227,6 +227,7 @@ static int tcf_em_validate(struct tcf_proto *tp, | ||
2126 | * to replay the request. | ||
2127 | */ | ||
2128 | module_put(em->ops->owner); | ||
2129 | + em->ops = NULL; | ||
2130 | err = -EAGAIN; | ||
2131 | } | ||
2132 | #endif | ||
2133 | diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c | ||
2134 | index 80fe5c86efd1..231b71944c52 100644 | ||
2135 | --- a/net/sunrpc/cache.c | ||
2136 | +++ b/net/sunrpc/cache.c | ||
2137 | @@ -930,7 +930,7 @@ static unsigned int cache_poll(struct file *filp, poll_table *wait, | ||
2138 | poll_wait(filp, &queue_wait, wait); | ||
2139 | |||
2140 | /* alway allow write */ | ||
2141 | - mask = POLL_OUT | POLLWRNORM; | ||
2142 | + mask = POLLOUT | POLLWRNORM; | ||
2143 | |||
2144 | if (!rp) | ||
2145 | return mask; | ||
2146 | diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c | ||
2147 | index 175dca44c97e..707405cbc5c9 100644 | ||
2148 | --- a/sound/core/pcm_native.c | ||
2149 | +++ b/sound/core/pcm_native.c | ||
2150 | @@ -1404,6 +1404,8 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state) | ||
2151 | if (! snd_pcm_playback_empty(substream)) { | ||
2152 | snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING); | ||
2153 | snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING); | ||
2154 | + } else { | ||
2155 | + runtime->status->state = SNDRV_PCM_STATE_SETUP; | ||
2156 | } | ||
2157 | break; | ||
2158 | case SNDRV_PCM_STATE_RUNNING: | ||
2159 | diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c | ||
2160 | index 4ae5767a2cf5..44d3fb95ebba 100644 | ||
2161 | --- a/sound/pci/hda/patch_sigmatel.c | ||
2162 | +++ b/sound/pci/hda/patch_sigmatel.c | ||
2163 | @@ -85,6 +85,7 @@ enum { | ||
2164 | STAC_ALIENWARE_M17X, | ||
2165 | STAC_92HD89XX_HP_FRONT_JACK, | ||
2166 | STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK, | ||
2167 | + STAC_92HD73XX_ASUS_MOBO, | ||
2168 | STAC_92HD73XX_MODELS | ||
2169 | }; | ||
2170 | |||
2171 | @@ -1915,7 +1916,18 @@ static const struct hda_fixup stac92hd73xx_fixups[] = { | ||
2172 | [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = { | ||
2173 | .type = HDA_FIXUP_PINS, | ||
2174 | .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs, | ||
2175 | - } | ||
2176 | + }, | ||
2177 | + [STAC_92HD73XX_ASUS_MOBO] = { | ||
2178 | + .type = HDA_FIXUP_PINS, | ||
2179 | + .v.pins = (const struct hda_pintbl[]) { | ||
2180 | + /* enable 5.1 and SPDIF out */ | ||
2181 | + { 0x0c, 0x01014411 }, | ||
2182 | + { 0x0d, 0x01014410 }, | ||
2183 | + { 0x0e, 0x01014412 }, | ||
2184 | + { 0x22, 0x014b1180 }, | ||
2185 | + { } | ||
2186 | + } | ||
2187 | + }, | ||
2188 | }; | ||
2189 | |||
2190 | static const struct hda_model_fixup stac92hd73xx_models[] = { | ||
2191 | @@ -1927,6 +1939,7 @@ static const struct hda_model_fixup stac92hd73xx_models[] = { | ||
2192 | { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" }, | ||
2193 | { .id = STAC_DELL_EQ, .name = "dell-eq" }, | ||
2194 | { .id = STAC_ALIENWARE_M17X, .name = "alienware" }, | ||
2195 | + { .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" }, | ||
2196 | {} | ||
2197 | }; | ||
2198 | |||
2199 | @@ -1979,6 +1992,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = { | ||
2200 | "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK), | ||
2201 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, | ||
2202 | "unknown HP", STAC_92HD89XX_HP_FRONT_JACK), | ||
2203 | + SND_PCI_QUIRK(PCI_VENDOR_ID_ASUSTEK, 0x83f8, "ASUS AT4NM10", | ||
2204 | + STAC_92HD73XX_ASUS_MOBO), | ||
2205 | {} /* terminator */ | ||
2206 | }; | ||
2207 |