1 |
Author: tomwij |
2 |
Date: 2013-03-31 21:28:05 +0000 (Sun, 31 Mar 2013) |
3 |
New Revision: 2327 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/3.0/1070_linux-3.0.71.patch |
7 |
genpatches-2.6/trunk/3.2/1041_linux-3.2.42.patch |
8 |
genpatches-2.6/trunk/3.4/1037_linux-3.4.38.patch |
9 |
Modified: |
10 |
genpatches-2.6/trunk/3.0/0000_README |
11 |
genpatches-2.6/trunk/3.2/0000_README |
12 |
genpatches-2.6/trunk/3.4/0000_README |
13 |
Log: |
14 |
Linux patches 3.0.71, 3.2.42 and 3.4.38. |
15 |
|
16 |
Modified: genpatches-2.6/trunk/3.0/0000_README |
17 |
=================================================================== |
18 |
--- genpatches-2.6/trunk/3.0/0000_README 2013-03-30 11:08:52 UTC (rev 2326) |
19 |
+++ genpatches-2.6/trunk/3.0/0000_README 2013-03-31 21:28:05 UTC (rev 2327) |
20 |
@@ -315,6 +315,10 @@ |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 3.0.70 |
23 |
|
24 |
+Patch: 1070_linux-3.0.71.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 3.0.71 |
27 |
+ |
28 |
Patch: 1800_fix-zcache-build.patch |
29 |
From: http://bugs.gentoo.org/show_bug.cgi?id=376325 |
30 |
Desc: Fix zcache build error |
31 |
|
32 |
Added: genpatches-2.6/trunk/3.0/1070_linux-3.0.71.patch |
33 |
=================================================================== |
34 |
--- genpatches-2.6/trunk/3.0/1070_linux-3.0.71.patch (rev 0) |
35 |
+++ genpatches-2.6/trunk/3.0/1070_linux-3.0.71.patch 2013-03-31 21:28:05 UTC (rev 2327) |
36 |
@@ -0,0 +1,1817 @@ |
37 |
+diff --git a/Makefile b/Makefile |
38 |
+index 6754172..fbba8bc 100644 |
39 |
+--- a/Makefile |
40 |
++++ b/Makefile |
41 |
+@@ -1,6 +1,6 @@ |
42 |
+ VERSION = 3 |
43 |
+ PATCHLEVEL = 0 |
44 |
+-SUBLEVEL = 70 |
45 |
++SUBLEVEL = 71 |
46 |
+ EXTRAVERSION = |
47 |
+ NAME = Sneaky Weasel |
48 |
+ |
49 |
+diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c |
50 |
+index b7c2849..554b7b5 100644 |
51 |
+--- a/arch/x86/lib/usercopy_64.c |
52 |
++++ b/arch/x86/lib/usercopy_64.c |
53 |
+@@ -169,10 +169,10 @@ copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest) |
54 |
+ char c; |
55 |
+ unsigned zero_len; |
56 |
+ |
57 |
+- for (; len; --len) { |
58 |
++ for (; len; --len, to++) { |
59 |
+ if (__get_user_nocheck(c, from++, sizeof(char))) |
60 |
+ break; |
61 |
+- if (__put_user_nocheck(c, to++, sizeof(char))) |
62 |
++ if (__put_user_nocheck(c, to, sizeof(char))) |
63 |
+ break; |
64 |
+ } |
65 |
+ |
66 |
+diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
67 |
+index a303b61..b4d7898 100644 |
68 |
+--- a/drivers/gpu/drm/drm_edid.c |
69 |
++++ b/drivers/gpu/drm/drm_edid.c |
70 |
+@@ -841,7 +841,7 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, |
71 |
+ unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | pt->vblank_lo; |
72 |
+ unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) << 2 | pt->hsync_offset_lo; |
73 |
+ unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) << 4 | pt->hsync_pulse_width_lo; |
74 |
+- unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) >> 2 | pt->vsync_offset_pulse_width_lo >> 4; |
75 |
++ unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) << 2 | pt->vsync_offset_pulse_width_lo >> 4; |
76 |
+ unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 4 | (pt->vsync_offset_pulse_width_lo & 0xf); |
77 |
+ |
78 |
+ /* ignore tiny modes */ |
79 |
+diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c |
80 |
+index e36efdc..19bab81 100644 |
81 |
+--- a/drivers/gpu/drm/i915/i915_debugfs.c |
82 |
++++ b/drivers/gpu/drm/i915/i915_debugfs.c |
83 |
+@@ -119,7 +119,7 @@ static const char *cache_level_str(int type) |
84 |
+ static void |
85 |
+ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) |
86 |
+ { |
87 |
+- seq_printf(m, "%p: %s%s %8zd %04x %04x %d %d%s%s%s", |
88 |
++ seq_printf(m, "%pK: %s%s %8zd %04x %04x %d %d%s%s%s", |
89 |
+ &obj->base, |
90 |
+ get_pin_flag(obj), |
91 |
+ get_tiling_flag(obj), |
92 |
+diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
93 |
+index 490ab6b..1ca53ff 100644 |
94 |
+--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
95 |
++++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
96 |
+@@ -888,15 +888,20 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, |
97 |
+ int count) |
98 |
+ { |
99 |
+ int i; |
100 |
++ int relocs_total = 0; |
101 |
++ int relocs_max = INT_MAX / sizeof(struct drm_i915_gem_relocation_entry); |
102 |
+ |
103 |
+ for (i = 0; i < count; i++) { |
104 |
+ char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr; |
105 |
+ int length; /* limited by fault_in_pages_readable() */ |
106 |
+ |
107 |
+- /* First check for malicious input causing overflow */ |
108 |
+- if (exec[i].relocation_count > |
109 |
+- INT_MAX / sizeof(struct drm_i915_gem_relocation_entry)) |
110 |
++ /* First check for malicious input causing overflow in |
111 |
++ * the worst case where we need to allocate the entire |
112 |
++ * relocation tree as a single array. |
113 |
++ */ |
114 |
++ if (exec[i].relocation_count > relocs_max - relocs_total) |
115 |
+ return -EINVAL; |
116 |
++ relocs_total += exec[i].relocation_count; |
117 |
+ |
118 |
+ length = exec[i].relocation_count * |
119 |
+ sizeof(struct drm_i915_gem_relocation_entry); |
120 |
+diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c |
121 |
+index d2c7104..e7a97b5 100644 |
122 |
+--- a/drivers/gpu/drm/i915/intel_opregion.c |
123 |
++++ b/drivers/gpu/drm/i915/intel_opregion.c |
124 |
+@@ -413,6 +413,25 @@ blind_set: |
125 |
+ goto end; |
126 |
+ } |
127 |
+ |
128 |
++static void intel_setup_cadls(struct drm_device *dev) |
129 |
++{ |
130 |
++ struct drm_i915_private *dev_priv = dev->dev_private; |
131 |
++ struct intel_opregion *opregion = &dev_priv->opregion; |
132 |
++ int i = 0; |
133 |
++ u32 disp_id; |
134 |
++ |
135 |
++ /* Initialize the CADL field by duplicating the DIDL values. |
136 |
++ * Technically, this is not always correct as display outputs may exist, |
137 |
++ * but not active. This initialization is necessary for some Clevo |
138 |
++ * laptops that check this field before processing the brightness and |
139 |
++ * display switching hotkeys. Just like DIDL, CADL is NULL-terminated if |
140 |
++ * there are less than eight devices. */ |
141 |
++ do { |
142 |
++ disp_id = ioread32(&opregion->acpi->didl[i]); |
143 |
++ iowrite32(disp_id, &opregion->acpi->cadl[i]); |
144 |
++ } while (++i < 8 && disp_id != 0); |
145 |
++} |
146 |
++ |
147 |
+ void intel_opregion_init(struct drm_device *dev) |
148 |
+ { |
149 |
+ struct drm_i915_private *dev_priv = dev->dev_private; |
150 |
+@@ -422,8 +441,10 @@ void intel_opregion_init(struct drm_device *dev) |
151 |
+ return; |
152 |
+ |
153 |
+ if (opregion->acpi) { |
154 |
+- if (drm_core_check_feature(dev, DRIVER_MODESET)) |
155 |
++ if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
156 |
+ intel_didl_outputs(dev); |
157 |
++ intel_setup_cadls(dev); |
158 |
++ } |
159 |
+ |
160 |
+ /* Notify BIOS we are ready to handle ACPI video ext notifs. |
161 |
+ * Right now, all the events are handled by the ACPI video module. |
162 |
+diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c |
163 |
+index 39913a0..073acdf 100644 |
164 |
+--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c |
165 |
++++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c |
166 |
+@@ -753,9 +753,13 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_ |
167 |
+ if (++priv->tx_outstanding == ipoib_sendq_size) { |
168 |
+ ipoib_dbg(priv, "TX ring 0x%x full, stopping kernel net queue\n", |
169 |
+ tx->qp->qp_num); |
170 |
+- if (ib_req_notify_cq(priv->send_cq, IB_CQ_NEXT_COMP)) |
171 |
+- ipoib_warn(priv, "request notify on send CQ failed\n"); |
172 |
+ netif_stop_queue(dev); |
173 |
++ rc = ib_req_notify_cq(priv->send_cq, |
174 |
++ IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS); |
175 |
++ if (rc < 0) |
176 |
++ ipoib_warn(priv, "request notify on send CQ failed\n"); |
177 |
++ else if (rc) |
178 |
++ ipoib_send_comp_handler(priv->send_cq, dev); |
179 |
+ } |
180 |
+ } |
181 |
+ } |
182 |
+diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c |
183 |
+index 4309296..8824dd4 100644 |
184 |
+--- a/drivers/net/netconsole.c |
185 |
++++ b/drivers/net/netconsole.c |
186 |
+@@ -630,6 +630,7 @@ static int netconsole_netdev_event(struct notifier_block *this, |
187 |
+ goto done; |
188 |
+ |
189 |
+ spin_lock_irqsave(&target_list_lock, flags); |
190 |
++restart: |
191 |
+ list_for_each_entry(nt, &target_list, list) { |
192 |
+ netconsole_target_get(nt); |
193 |
+ if (nt->np.dev == dev) { |
194 |
+@@ -642,20 +643,17 @@ static int netconsole_netdev_event(struct notifier_block *this, |
195 |
+ case NETDEV_UNREGISTER: |
196 |
+ /* |
197 |
+ * rtnl_lock already held |
198 |
++ * we might sleep in __netpoll_cleanup() |
199 |
+ */ |
200 |
+- if (nt->np.dev) { |
201 |
+- spin_unlock_irqrestore( |
202 |
+- &target_list_lock, |
203 |
+- flags); |
204 |
+- __netpoll_cleanup(&nt->np); |
205 |
+- spin_lock_irqsave(&target_list_lock, |
206 |
+- flags); |
207 |
+- dev_put(nt->np.dev); |
208 |
+- nt->np.dev = NULL; |
209 |
+- } |
210 |
++ spin_unlock_irqrestore(&target_list_lock, flags); |
211 |
++ __netpoll_cleanup(&nt->np); |
212 |
++ spin_lock_irqsave(&target_list_lock, flags); |
213 |
++ dev_put(nt->np.dev); |
214 |
++ nt->np.dev = NULL; |
215 |
+ nt->enabled = 0; |
216 |
+ stopped = true; |
217 |
+- break; |
218 |
++ netconsole_target_put(nt); |
219 |
++ goto restart; |
220 |
+ } |
221 |
+ } |
222 |
+ netconsole_target_put(nt); |
223 |
+diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c |
224 |
+index be3cade..07e526d 100644 |
225 |
+--- a/drivers/net/sfc/efx.c |
226 |
++++ b/drivers/net/sfc/efx.c |
227 |
+@@ -651,25 +651,30 @@ static void efx_fini_channels(struct efx_nic *efx) |
228 |
+ struct efx_channel *channel; |
229 |
+ struct efx_tx_queue *tx_queue; |
230 |
+ struct efx_rx_queue *rx_queue; |
231 |
++ struct pci_dev *dev = efx->pci_dev; |
232 |
+ int rc; |
233 |
+ |
234 |
+ EFX_ASSERT_RESET_SERIALISED(efx); |
235 |
+ BUG_ON(efx->port_enabled); |
236 |
+ |
237 |
+- rc = efx_nic_flush_queues(efx); |
238 |
+- if (rc && EFX_WORKAROUND_7803(efx)) { |
239 |
+- /* Schedule a reset to recover from the flush failure. The |
240 |
+- * descriptor caches reference memory we're about to free, |
241 |
+- * but falcon_reconfigure_mac_wrapper() won't reconnect |
242 |
+- * the MACs because of the pending reset. */ |
243 |
+- netif_err(efx, drv, efx->net_dev, |
244 |
+- "Resetting to recover from flush failure\n"); |
245 |
+- efx_schedule_reset(efx, RESET_TYPE_ALL); |
246 |
+- } else if (rc) { |
247 |
+- netif_err(efx, drv, efx->net_dev, "failed to flush queues\n"); |
248 |
+- } else { |
249 |
+- netif_dbg(efx, drv, efx->net_dev, |
250 |
+- "successfully flushed all queues\n"); |
251 |
++ /* Only perform flush if dma is enabled */ |
252 |
++ if (dev->is_busmaster) { |
253 |
++ rc = efx_nic_flush_queues(efx); |
254 |
++ |
255 |
++ if (rc && EFX_WORKAROUND_7803(efx)) { |
256 |
++ /* Schedule a reset to recover from the flush failure. The |
257 |
++ * descriptor caches reference memory we're about to free, |
258 |
++ * but falcon_reconfigure_mac_wrapper() won't reconnect |
259 |
++ * the MACs because of the pending reset. */ |
260 |
++ netif_err(efx, drv, efx->net_dev, |
261 |
++ "Resetting to recover from flush failure\n"); |
262 |
++ efx_schedule_reset(efx, RESET_TYPE_ALL); |
263 |
++ } else if (rc) { |
264 |
++ netif_err(efx, drv, efx->net_dev, "failed to flush queues\n"); |
265 |
++ } else { |
266 |
++ netif_dbg(efx, drv, efx->net_dev, |
267 |
++ "successfully flushed all queues\n"); |
268 |
++ } |
269 |
+ } |
270 |
+ |
271 |
+ efx_for_each_channel(channel, efx) { |
272 |
+@@ -715,6 +720,7 @@ efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) |
273 |
+ unsigned i; |
274 |
+ int rc; |
275 |
+ |
276 |
++ efx_device_detach_sync(efx); |
277 |
+ efx_stop_all(efx); |
278 |
+ efx_fini_channels(efx); |
279 |
+ |
280 |
+@@ -758,6 +764,7 @@ out: |
281 |
+ |
282 |
+ efx_init_channels(efx); |
283 |
+ efx_start_all(efx); |
284 |
++ netif_device_attach(efx->net_dev); |
285 |
+ return rc; |
286 |
+ |
287 |
+ rollback: |
288 |
+@@ -1525,8 +1532,12 @@ static void efx_stop_all(struct efx_nic *efx) |
289 |
+ /* Flush efx_mac_work(), refill_workqueue, monitor_work */ |
290 |
+ efx_flush_all(efx); |
291 |
+ |
292 |
+- /* Stop the kernel transmit interface late, so the watchdog |
293 |
+- * timer isn't ticking over the flush */ |
294 |
++ /* Stop the kernel transmit interface. This is only valid if |
295 |
++ * the device is stopped or detached; otherwise the watchdog |
296 |
++ * may fire immediately. |
297 |
++ */ |
298 |
++ WARN_ON(netif_running(efx->net_dev) && |
299 |
++ netif_device_present(efx->net_dev)); |
300 |
+ if (efx_dev_registered(efx)) { |
301 |
+ netif_tx_stop_all_queues(efx->net_dev); |
302 |
+ netif_tx_lock_bh(efx->net_dev); |
303 |
+@@ -1796,10 +1807,11 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu) |
304 |
+ if (new_mtu > EFX_MAX_MTU) |
305 |
+ return -EINVAL; |
306 |
+ |
307 |
+- efx_stop_all(efx); |
308 |
+- |
309 |
+ netif_dbg(efx, drv, efx->net_dev, "changing MTU to %d\n", new_mtu); |
310 |
+ |
311 |
++ efx_device_detach_sync(efx); |
312 |
++ efx_stop_all(efx); |
313 |
++ |
314 |
+ efx_fini_channels(efx); |
315 |
+ |
316 |
+ mutex_lock(&efx->mac_lock); |
317 |
+@@ -1812,6 +1824,7 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu) |
318 |
+ efx_init_channels(efx); |
319 |
+ |
320 |
+ efx_start_all(efx); |
321 |
++ netif_device_attach(efx->net_dev); |
322 |
+ return rc; |
323 |
+ } |
324 |
+ |
325 |
+@@ -2101,7 +2114,7 @@ int efx_reset(struct efx_nic *efx, enum reset_type method) |
326 |
+ netif_info(efx, drv, efx->net_dev, "resetting (%s)\n", |
327 |
+ RESET_TYPE(method)); |
328 |
+ |
329 |
+- netif_device_detach(efx->net_dev); |
330 |
++ efx_device_detach_sync(efx); |
331 |
+ efx_reset_down(efx, method); |
332 |
+ |
333 |
+ rc = efx->type->reset(efx, method); |
334 |
+@@ -2560,7 +2573,7 @@ static int efx_pm_freeze(struct device *dev) |
335 |
+ |
336 |
+ efx->state = STATE_FINI; |
337 |
+ |
338 |
+- netif_device_detach(efx->net_dev); |
339 |
++ efx_device_detach_sync(efx); |
340 |
+ |
341 |
+ efx_stop_all(efx); |
342 |
+ efx_fini_channels(efx); |
343 |
+diff --git a/drivers/net/sfc/efx.h b/drivers/net/sfc/efx.h |
344 |
+index a5d1c60d..76e891e 100644 |
345 |
+--- a/drivers/net/sfc/efx.h |
346 |
++++ b/drivers/net/sfc/efx.h |
347 |
+@@ -150,4 +150,17 @@ extern void efx_link_status_changed(struct efx_nic *efx); |
348 |
+ extern void efx_link_set_advertising(struct efx_nic *efx, u32); |
349 |
+ extern void efx_link_set_wanted_fc(struct efx_nic *efx, u8); |
350 |
+ |
351 |
++static inline void efx_device_detach_sync(struct efx_nic *efx) |
352 |
++{ |
353 |
++ struct net_device *dev = efx->net_dev; |
354 |
++ |
355 |
++ /* Lock/freeze all TX queues so that we can be sure the |
356 |
++ * TX scheduler is stopped when we're done and before |
357 |
++ * netif_device_present() becomes false. |
358 |
++ */ |
359 |
++ netif_tx_lock_bh(dev); |
360 |
++ netif_device_detach(dev); |
361 |
++ netif_tx_unlock_bh(dev); |
362 |
++} |
363 |
++ |
364 |
+ #endif /* EFX_EFX_H */ |
365 |
+diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c |
366 |
+index 60176e8..19b996b3 100644 |
367 |
+--- a/drivers/net/sfc/falcon.c |
368 |
++++ b/drivers/net/sfc/falcon.c |
369 |
+@@ -1714,6 +1714,7 @@ const struct efx_nic_type falcon_a1_nic_type = { |
370 |
+ .remove_port = falcon_remove_port, |
371 |
+ .handle_global_event = falcon_handle_global_event, |
372 |
+ .prepare_flush = falcon_prepare_flush, |
373 |
++ .finish_flush = efx_port_dummy_op_void, |
374 |
+ .update_stats = falcon_update_nic_stats, |
375 |
+ .start_stats = falcon_start_nic_stats, |
376 |
+ .stop_stats = falcon_stop_nic_stats, |
377 |
+@@ -1755,6 +1756,7 @@ const struct efx_nic_type falcon_b0_nic_type = { |
378 |
+ .remove_port = falcon_remove_port, |
379 |
+ .handle_global_event = falcon_handle_global_event, |
380 |
+ .prepare_flush = falcon_prepare_flush, |
381 |
++ .finish_flush = efx_port_dummy_op_void, |
382 |
+ .update_stats = falcon_update_nic_stats, |
383 |
+ .start_stats = falcon_start_nic_stats, |
384 |
+ .stop_stats = falcon_stop_nic_stats, |
385 |
+diff --git a/drivers/net/sfc/filter.c b/drivers/net/sfc/filter.c |
386 |
+index 95a980f..08addc9 100644 |
387 |
+--- a/drivers/net/sfc/filter.c |
388 |
++++ b/drivers/net/sfc/filter.c |
389 |
+@@ -335,28 +335,35 @@ static int efx_filter_search(struct efx_filter_table *table, |
390 |
+ bool for_insert, int *depth_required) |
391 |
+ { |
392 |
+ unsigned hash, incr, filter_idx, depth, depth_max; |
393 |
+- struct efx_filter_spec *cmp; |
394 |
+ |
395 |
+ hash = efx_filter_hash(key); |
396 |
+ incr = efx_filter_increment(key); |
397 |
+- depth_max = (spec->priority <= EFX_FILTER_PRI_HINT ? |
398 |
+- FILTER_CTL_SRCH_HINT_MAX : FILTER_CTL_SRCH_MAX); |
399 |
+- |
400 |
+- for (depth = 1, filter_idx = hash & (table->size - 1); |
401 |
+- depth <= depth_max && test_bit(filter_idx, table->used_bitmap); |
402 |
+- ++depth) { |
403 |
+- cmp = &table->spec[filter_idx]; |
404 |
+- if (efx_filter_equal(spec, cmp)) |
405 |
+- goto found; |
406 |
++ |
407 |
++ filter_idx = hash & (table->size - 1); |
408 |
++ depth = 1; |
409 |
++ depth_max = (for_insert ? |
410 |
++ (spec->priority <= EFX_FILTER_PRI_HINT ? |
411 |
++ FILTER_CTL_SRCH_HINT_MAX : FILTER_CTL_SRCH_MAX) : |
412 |
++ table->search_depth[spec->type]); |
413 |
++ |
414 |
++ for (;;) { |
415 |
++ /* Return success if entry is used and matches this spec |
416 |
++ * or entry is unused and we are trying to insert. |
417 |
++ */ |
418 |
++ if (test_bit(filter_idx, table->used_bitmap) ? |
419 |
++ efx_filter_equal(spec, &table->spec[filter_idx]) : |
420 |
++ for_insert) { |
421 |
++ *depth_required = depth; |
422 |
++ return filter_idx; |
423 |
++ } |
424 |
++ |
425 |
++ /* Return failure if we reached the maximum search depth */ |
426 |
++ if (depth == depth_max) |
427 |
++ return for_insert ? -EBUSY : -ENOENT; |
428 |
++ |
429 |
+ filter_idx = (filter_idx + incr) & (table->size - 1); |
430 |
++ ++depth; |
431 |
+ } |
432 |
+- if (!for_insert) |
433 |
+- return -ENOENT; |
434 |
+- if (depth > depth_max) |
435 |
+- return -EBUSY; |
436 |
+-found: |
437 |
+- *depth_required = depth; |
438 |
+- return filter_idx; |
439 |
+ } |
440 |
+ |
441 |
+ /* Construct/deconstruct external filter IDs */ |
442 |
+diff --git a/drivers/net/sfc/mcdi.c b/drivers/net/sfc/mcdi.c |
443 |
+index 81a4253..c1000ce 100644 |
444 |
+--- a/drivers/net/sfc/mcdi.c |
445 |
++++ b/drivers/net/sfc/mcdi.c |
446 |
+@@ -30,7 +30,7 @@ |
447 |
+ #define REBOOT_FLAG_PORT0 0x3f8 |
448 |
+ #define REBOOT_FLAG_PORT1 0x3fc |
449 |
+ |
450 |
+-#define MCDI_RPC_TIMEOUT 10 /*seconds */ |
451 |
++#define MCDI_RPC_TIMEOUT (10 * HZ) |
452 |
+ |
453 |
+ #define MCDI_PDU(efx) \ |
454 |
+ (efx_port_num(efx) ? CMD_PDU_PORT1 : CMD_PDU_PORT0) |
455 |
+@@ -120,7 +120,7 @@ static void efx_mcdi_copyout(struct efx_nic *efx, u8 *outbuf, size_t outlen) |
456 |
+ static int efx_mcdi_poll(struct efx_nic *efx) |
457 |
+ { |
458 |
+ struct efx_mcdi_iface *mcdi = efx_mcdi(efx); |
459 |
+- unsigned int time, finish; |
460 |
++ unsigned long time, finish; |
461 |
+ unsigned int respseq, respcmd, error; |
462 |
+ unsigned int pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); |
463 |
+ unsigned int rc, spins; |
464 |
+@@ -136,7 +136,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) |
465 |
+ * and poll once a jiffy (approximately) |
466 |
+ */ |
467 |
+ spins = TICK_USEC; |
468 |
+- finish = get_seconds() + MCDI_RPC_TIMEOUT; |
469 |
++ finish = jiffies + MCDI_RPC_TIMEOUT; |
470 |
+ |
471 |
+ while (1) { |
472 |
+ if (spins != 0) { |
473 |
+@@ -146,7 +146,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) |
474 |
+ schedule_timeout_uninterruptible(1); |
475 |
+ } |
476 |
+ |
477 |
+- time = get_seconds(); |
478 |
++ time = jiffies; |
479 |
+ |
480 |
+ rmb(); |
481 |
+ efx_readd(efx, ®, pdu); |
482 |
+@@ -158,7 +158,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) |
483 |
+ EFX_DWORD_FIELD(reg, MCDI_HEADER_RESPONSE)) |
484 |
+ break; |
485 |
+ |
486 |
+- if (time >= finish) |
487 |
++ if (time_after(time, finish)) |
488 |
+ return -ETIMEDOUT; |
489 |
+ } |
490 |
+ |
491 |
+@@ -250,7 +250,7 @@ static int efx_mcdi_await_completion(struct efx_nic *efx) |
492 |
+ if (wait_event_timeout( |
493 |
+ mcdi->wq, |
494 |
+ atomic_read(&mcdi->state) == MCDI_STATE_COMPLETED, |
495 |
+- msecs_to_jiffies(MCDI_RPC_TIMEOUT * 1000)) == 0) |
496 |
++ MCDI_RPC_TIMEOUT) == 0) |
497 |
+ return -ETIMEDOUT; |
498 |
+ |
499 |
+ /* Check if efx_mcdi_set_mode() switched us back to polled completions. |
500 |
+@@ -666,9 +666,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, |
501 |
+ u16 *fw_subtype_list) |
502 |
+ { |
503 |
+ uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LEN]; |
504 |
+- size_t outlen; |
505 |
++ size_t outlen, offset, i; |
506 |
+ int port_num = efx_port_num(efx); |
507 |
+- int offset; |
508 |
+ int rc; |
509 |
+ |
510 |
+ BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_IN_LEN != 0); |
511 |
+@@ -688,10 +687,16 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, |
512 |
+ : MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST; |
513 |
+ if (mac_address) |
514 |
+ memcpy(mac_address, outbuf + offset, ETH_ALEN); |
515 |
+- if (fw_subtype_list) |
516 |
+- memcpy(fw_subtype_list, |
517 |
+- outbuf + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST, |
518 |
+- MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_LEN); |
519 |
++ if (fw_subtype_list) { |
520 |
++ offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST; |
521 |
++ for (i = 0; |
522 |
++ i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_LEN / 2; |
523 |
++ i++) { |
524 |
++ fw_subtype_list[i] = |
525 |
++ le16_to_cpup((__le16 *)(outbuf + offset)); |
526 |
++ offset += 2; |
527 |
++ } |
528 |
++ } |
529 |
+ |
530 |
+ return 0; |
531 |
+ |
532 |
+diff --git a/drivers/net/sfc/mcdi.h b/drivers/net/sfc/mcdi.h |
533 |
+index aced2a7..b61eea0 100644 |
534 |
+--- a/drivers/net/sfc/mcdi.h |
535 |
++++ b/drivers/net/sfc/mcdi.h |
536 |
+@@ -126,5 +126,6 @@ extern int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx, |
537 |
+ extern int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out); |
538 |
+ extern int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id); |
539 |
+ extern int efx_mcdi_wol_filter_reset(struct efx_nic *efx); |
540 |
++extern int efx_mcdi_set_mac(struct efx_nic *efx); |
541 |
+ |
542 |
+ #endif /* EFX_MCDI_H */ |
543 |
+diff --git a/drivers/net/sfc/mcdi_mac.c b/drivers/net/sfc/mcdi_mac.c |
544 |
+index 50c2077..da269d7 100644 |
545 |
+--- a/drivers/net/sfc/mcdi_mac.c |
546 |
++++ b/drivers/net/sfc/mcdi_mac.c |
547 |
+@@ -13,7 +13,7 @@ |
548 |
+ #include "mcdi.h" |
549 |
+ #include "mcdi_pcol.h" |
550 |
+ |
551 |
+-static int efx_mcdi_set_mac(struct efx_nic *efx) |
552 |
++int efx_mcdi_set_mac(struct efx_nic *efx) |
553 |
+ { |
554 |
+ u32 reject, fcntl; |
555 |
+ u8 cmdbytes[MC_CMD_SET_MAC_IN_LEN]; |
556 |
+@@ -45,6 +45,8 @@ static int efx_mcdi_set_mac(struct efx_nic *efx) |
557 |
+ } |
558 |
+ if (efx->wanted_fc & EFX_FC_AUTO) |
559 |
+ fcntl = MC_CMD_FCNTL_AUTO; |
560 |
++ if (efx->fc_disable) |
561 |
++ fcntl = MC_CMD_FCNTL_OFF; |
562 |
+ |
563 |
+ MCDI_SET_DWORD(cmdbytes, SET_MAC_IN_FCNTL, fcntl); |
564 |
+ |
565 |
+diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h |
566 |
+index e8d5f03..2f932c5 100644 |
567 |
+--- a/drivers/net/sfc/net_driver.h |
568 |
++++ b/drivers/net/sfc/net_driver.h |
569 |
+@@ -214,6 +214,7 @@ struct efx_tx_queue { |
570 |
+ * If both this and page are %NULL, the buffer slot is currently free. |
571 |
+ * @page: The associated page buffer, if any. |
572 |
+ * If both this and skb are %NULL, the buffer slot is currently free. |
573 |
++ * @page_offset: Offset within page. Valid iff @flags & %EFX_RX_BUF_PAGE. |
574 |
+ * @len: Buffer length, in bytes. |
575 |
+ * @is_page: Indicates if @page is valid. If false, @skb is valid. |
576 |
+ */ |
577 |
+@@ -223,7 +224,8 @@ struct efx_rx_buffer { |
578 |
+ struct sk_buff *skb; |
579 |
+ struct page *page; |
580 |
+ } u; |
581 |
+- unsigned int len; |
582 |
++ u16 page_offset; |
583 |
++ u16 len; |
584 |
+ bool is_page; |
585 |
+ }; |
586 |
+ |
587 |
+@@ -690,6 +692,9 @@ struct efx_filter_state; |
588 |
+ * @promiscuous: Promiscuous flag. Protected by netif_tx_lock. |
589 |
+ * @multicast_hash: Multicast hash table |
590 |
+ * @wanted_fc: Wanted flow control flags |
591 |
++ * @fc_disable: When non-zero flow control is disabled. Typically used to |
592 |
++ * ensure that network back pressure doesn't delay dma queue flushes. |
593 |
++ * Serialised by the rtnl lock. |
594 |
+ * @mac_work: Work item for changing MAC promiscuity and multicast hash |
595 |
+ * @loopback_mode: Loopback status |
596 |
+ * @loopback_modes: Supported loopback mode bitmask |
597 |
+@@ -783,6 +788,7 @@ struct efx_nic { |
598 |
+ bool promiscuous; |
599 |
+ union efx_multicast_hash multicast_hash; |
600 |
+ u8 wanted_fc; |
601 |
++ unsigned fc_disable; |
602 |
+ |
603 |
+ atomic_t rx_reset; |
604 |
+ enum efx_loopback_mode loopback_mode; |
605 |
+@@ -834,6 +840,7 @@ static inline unsigned int efx_port_num(struct efx_nic *efx) |
606 |
+ * @remove_port: Free resources allocated by probe_port() |
607 |
+ * @handle_global_event: Handle a "global" event (may be %NULL) |
608 |
+ * @prepare_flush: Prepare the hardware for flushing the DMA queues |
609 |
++ * @finish_flush: Clean up after flushing the DMA queues |
610 |
+ * @update_stats: Update statistics not provided by event handling |
611 |
+ * @start_stats: Start the regular fetching of statistics |
612 |
+ * @stop_stats: Stop the regular fetching of statistics |
613 |
+@@ -879,6 +886,7 @@ struct efx_nic_type { |
614 |
+ void (*remove_port)(struct efx_nic *efx); |
615 |
+ bool (*handle_global_event)(struct efx_channel *channel, efx_qword_t *); |
616 |
+ void (*prepare_flush)(struct efx_nic *efx); |
617 |
++ void (*finish_flush)(struct efx_nic *efx); |
618 |
+ void (*update_stats)(struct efx_nic *efx); |
619 |
+ void (*start_stats)(struct efx_nic *efx); |
620 |
+ void (*stop_stats)(struct efx_nic *efx); |
621 |
+diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c |
622 |
+index 5ac9fa2..4949004 100644 |
623 |
+--- a/drivers/net/sfc/nic.c |
624 |
++++ b/drivers/net/sfc/nic.c |
625 |
+@@ -370,7 +370,8 @@ efx_may_push_tx_desc(struct efx_tx_queue *tx_queue, unsigned int write_count) |
626 |
+ return false; |
627 |
+ |
628 |
+ tx_queue->empty_read_count = 0; |
629 |
+- return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0; |
630 |
++ return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0 |
631 |
++ && tx_queue->write_count - write_count == 1; |
632 |
+ } |
633 |
+ |
634 |
+ /* For each entry inserted into the software descriptor ring, create a |
635 |
+@@ -1260,13 +1261,27 @@ int efx_nic_flush_queues(struct efx_nic *efx) |
636 |
+ } |
637 |
+ efx_for_each_possible_channel_tx_queue(tx_queue, channel) { |
638 |
+ if (tx_queue->initialised && |
639 |
+- tx_queue->flushed != FLUSH_DONE) |
640 |
+- ++tx_pending; |
641 |
++ tx_queue->flushed != FLUSH_DONE) { |
642 |
++ efx_oword_t txd_ptr_tbl; |
643 |
++ |
644 |
++ efx_reado_table(efx, &txd_ptr_tbl, |
645 |
++ FR_BZ_TX_DESC_PTR_TBL, |
646 |
++ tx_queue->queue); |
647 |
++ if (EFX_OWORD_FIELD(txd_ptr_tbl, |
648 |
++ FRF_AZ_TX_DESCQ_FLUSH) || |
649 |
++ EFX_OWORD_FIELD(txd_ptr_tbl, |
650 |
++ FRF_AZ_TX_DESCQ_EN)) |
651 |
++ ++tx_pending; |
652 |
++ else |
653 |
++ tx_queue->flushed = FLUSH_DONE; |
654 |
++ } |
655 |
+ } |
656 |
+ } |
657 |
+ |
658 |
+- if (rx_pending == 0 && tx_pending == 0) |
659 |
++ if (rx_pending == 0 && tx_pending == 0) { |
660 |
++ efx->type->finish_flush(efx); |
661 |
+ return 0; |
662 |
++ } |
663 |
+ |
664 |
+ msleep(EFX_FLUSH_INTERVAL); |
665 |
+ efx_poll_flush_events(efx); |
666 |
+@@ -1292,6 +1307,7 @@ int efx_nic_flush_queues(struct efx_nic *efx) |
667 |
+ } |
668 |
+ } |
669 |
+ |
670 |
++ efx->type->finish_flush(efx); |
671 |
+ return -ETIMEDOUT; |
672 |
+ } |
673 |
+ |
674 |
+diff --git a/drivers/net/sfc/nic.h b/drivers/net/sfc/nic.h |
675 |
+index d2405ce..8a2c4f5 100644 |
676 |
+--- a/drivers/net/sfc/nic.h |
677 |
++++ b/drivers/net/sfc/nic.h |
678 |
+@@ -211,6 +211,8 @@ extern void falcon_irq_ack_a1(struct efx_nic *efx); |
679 |
+ |
680 |
+ /* Global Resources */ |
681 |
+ extern int efx_nic_flush_queues(struct efx_nic *efx); |
682 |
++extern void siena_prepare_flush(struct efx_nic *efx); |
683 |
++extern void siena_finish_flush(struct efx_nic *efx); |
684 |
+ extern void falcon_start_nic_stats(struct efx_nic *efx); |
685 |
+ extern void falcon_stop_nic_stats(struct efx_nic *efx); |
686 |
+ extern void falcon_setup_xaui(struct efx_nic *efx); |
687 |
+diff --git a/drivers/net/sfc/rx.c b/drivers/net/sfc/rx.c |
688 |
+index 4004fc2..d429f0a 100644 |
689 |
+--- a/drivers/net/sfc/rx.c |
690 |
++++ b/drivers/net/sfc/rx.c |
691 |
+@@ -94,11 +94,7 @@ static unsigned int rx_refill_limit = 95; |
692 |
+ static inline unsigned int efx_rx_buf_offset(struct efx_nic *efx, |
693 |
+ struct efx_rx_buffer *buf) |
694 |
+ { |
695 |
+- /* Offset is always within one page, so we don't need to consider |
696 |
+- * the page order. |
697 |
+- */ |
698 |
+- return (((__force unsigned long) buf->dma_addr & (PAGE_SIZE - 1)) + |
699 |
+- efx->type->rx_buffer_hash_size); |
700 |
++ return buf->page_offset + efx->type->rx_buffer_hash_size; |
701 |
+ } |
702 |
+ static inline unsigned int efx_rx_buf_size(struct efx_nic *efx) |
703 |
+ { |
704 |
+@@ -193,6 +189,7 @@ static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue) |
705 |
+ struct efx_rx_buffer *rx_buf; |
706 |
+ struct page *page; |
707 |
+ void *page_addr; |
708 |
++ unsigned int page_offset; |
709 |
+ struct efx_rx_page_state *state; |
710 |
+ dma_addr_t dma_addr; |
711 |
+ unsigned index, count; |
712 |
+@@ -219,12 +216,14 @@ static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue) |
713 |
+ |
714 |
+ page_addr += sizeof(struct efx_rx_page_state); |
715 |
+ dma_addr += sizeof(struct efx_rx_page_state); |
716 |
++ page_offset = sizeof(struct efx_rx_page_state); |
717 |
+ |
718 |
+ split: |
719 |
+ index = rx_queue->added_count & rx_queue->ptr_mask; |
720 |
+ rx_buf = efx_rx_buffer(rx_queue, index); |
721 |
+ rx_buf->dma_addr = dma_addr + EFX_PAGE_IP_ALIGN; |
722 |
+ rx_buf->u.page = page; |
723 |
++ rx_buf->page_offset = page_offset + EFX_PAGE_IP_ALIGN; |
724 |
+ rx_buf->len = efx->rx_buffer_len - EFX_PAGE_IP_ALIGN; |
725 |
+ rx_buf->is_page = true; |
726 |
+ ++rx_queue->added_count; |
727 |
+@@ -236,6 +235,7 @@ static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue) |
728 |
+ get_page(page); |
729 |
+ dma_addr += (PAGE_SIZE >> 1); |
730 |
+ page_addr += (PAGE_SIZE >> 1); |
731 |
++ page_offset += (PAGE_SIZE >> 1); |
732 |
+ ++count; |
733 |
+ goto split; |
734 |
+ } |
735 |
+@@ -245,7 +245,8 @@ static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue) |
736 |
+ } |
737 |
+ |
738 |
+ static void efx_unmap_rx_buffer(struct efx_nic *efx, |
739 |
+- struct efx_rx_buffer *rx_buf) |
740 |
++ struct efx_rx_buffer *rx_buf, |
741 |
++ unsigned int used_len) |
742 |
+ { |
743 |
+ if (rx_buf->is_page && rx_buf->u.page) { |
744 |
+ struct efx_rx_page_state *state; |
745 |
+@@ -256,6 +257,10 @@ static void efx_unmap_rx_buffer(struct efx_nic *efx, |
746 |
+ state->dma_addr, |
747 |
+ efx_rx_buf_size(efx), |
748 |
+ PCI_DMA_FROMDEVICE); |
749 |
++ } else if (used_len) { |
750 |
++ dma_sync_single_for_cpu(&efx->pci_dev->dev, |
751 |
++ rx_buf->dma_addr, used_len, |
752 |
++ DMA_FROM_DEVICE); |
753 |
+ } |
754 |
+ } else if (!rx_buf->is_page && rx_buf->u.skb) { |
755 |
+ pci_unmap_single(efx->pci_dev, rx_buf->dma_addr, |
756 |
+@@ -278,7 +283,7 @@ static void efx_free_rx_buffer(struct efx_nic *efx, |
757 |
+ static void efx_fini_rx_buffer(struct efx_rx_queue *rx_queue, |
758 |
+ struct efx_rx_buffer *rx_buf) |
759 |
+ { |
760 |
+- efx_unmap_rx_buffer(rx_queue->efx, rx_buf); |
761 |
++ efx_unmap_rx_buffer(rx_queue->efx, rx_buf, 0); |
762 |
+ efx_free_rx_buffer(rx_queue->efx, rx_buf); |
763 |
+ } |
764 |
+ |
765 |
+@@ -549,10 +554,10 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, |
766 |
+ goto out; |
767 |
+ } |
768 |
+ |
769 |
+- /* Release card resources - assumes all RX buffers consumed in-order |
770 |
+- * per RX queue |
771 |
++ /* Release and/or sync DMA mapping - assumes all RX buffers |
772 |
++ * consumed in-order per RX queue |
773 |
+ */ |
774 |
+- efx_unmap_rx_buffer(efx, rx_buf); |
775 |
++ efx_unmap_rx_buffer(efx, rx_buf, len); |
776 |
+ |
777 |
+ /* Prefetch nice and early so data will (hopefully) be in cache by |
778 |
+ * the time we look at it. |
779 |
+diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c |
780 |
+index 822f6c2..4907885 100644 |
781 |
+--- a/drivers/net/sfc/selftest.c |
782 |
++++ b/drivers/net/sfc/selftest.c |
783 |
+@@ -698,7 +698,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, |
784 |
+ /* Detach the device so the kernel doesn't transmit during the |
785 |
+ * loopback test and the watchdog timeout doesn't fire. |
786 |
+ */ |
787 |
+- netif_device_detach(efx->net_dev); |
788 |
++ efx_device_detach_sync(efx); |
789 |
+ |
790 |
+ mutex_lock(&efx->mac_lock); |
791 |
+ if (efx->loopback_modes) { |
792 |
+diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c |
793 |
+index ceac1c9..062494a 100644 |
794 |
+--- a/drivers/net/sfc/siena.c |
795 |
++++ b/drivers/net/sfc/siena.c |
796 |
+@@ -135,6 +135,18 @@ static void siena_remove_port(struct efx_nic *efx) |
797 |
+ efx_nic_free_buffer(efx, &efx->stats_buffer); |
798 |
+ } |
799 |
+ |
800 |
++void siena_prepare_flush(struct efx_nic *efx) |
801 |
++{ |
802 |
++ if (efx->fc_disable++ == 0) |
803 |
++ efx_mcdi_set_mac(efx); |
804 |
++} |
805 |
++ |
806 |
++void siena_finish_flush(struct efx_nic *efx) |
807 |
++{ |
808 |
++ if (--efx->fc_disable == 0) |
809 |
++ efx_mcdi_set_mac(efx); |
810 |
++} |
811 |
++ |
812 |
+ static const struct efx_nic_register_test siena_register_tests[] = { |
813 |
+ { FR_AZ_ADR_REGION, |
814 |
+ EFX_OWORD32(0x0003FFFF, 0x0003FFFF, 0x0003FFFF, 0x0003FFFF) }, |
815 |
+@@ -372,14 +384,13 @@ static void siena_remove_nic(struct efx_nic *efx) |
816 |
+ efx->nic_data = NULL; |
817 |
+ } |
818 |
+ |
819 |
+-#define STATS_GENERATION_INVALID ((u64)(-1)) |
820 |
++#define STATS_GENERATION_INVALID ((__force __le64)(-1)) |
821 |
+ |
822 |
+ static int siena_try_update_nic_stats(struct efx_nic *efx) |
823 |
+ { |
824 |
+- u64 *dma_stats; |
825 |
++ __le64 *dma_stats; |
826 |
+ struct efx_mac_stats *mac_stats; |
827 |
+- u64 generation_start; |
828 |
+- u64 generation_end; |
829 |
++ __le64 generation_start, generation_end; |
830 |
+ |
831 |
+ mac_stats = &efx->mac_stats; |
832 |
+ dma_stats = (u64 *)efx->stats_buffer.addr; |
833 |
+@@ -390,7 +401,7 @@ static int siena_try_update_nic_stats(struct efx_nic *efx) |
834 |
+ rmb(); |
835 |
+ |
836 |
+ #define MAC_STAT(M, D) \ |
837 |
+- mac_stats->M = dma_stats[MC_CMD_MAC_ ## D] |
838 |
++ mac_stats->M = le64_to_cpu(dma_stats[MC_CMD_MAC_ ## D]) |
839 |
+ |
840 |
+ MAC_STAT(tx_bytes, TX_BYTES); |
841 |
+ MAC_STAT(tx_bad_bytes, TX_BAD_BYTES); |
842 |
+@@ -460,7 +471,8 @@ static int siena_try_update_nic_stats(struct efx_nic *efx) |
843 |
+ MAC_STAT(rx_internal_error, RX_INTERNAL_ERROR_PKTS); |
844 |
+ mac_stats->rx_good_lt64 = 0; |
845 |
+ |
846 |
+- efx->n_rx_nodesc_drop_cnt = dma_stats[MC_CMD_MAC_RX_NODESC_DROPS]; |
847 |
++ efx->n_rx_nodesc_drop_cnt = |
848 |
++ le64_to_cpu(dma_stats[MC_CMD_MAC_RX_NODESC_DROPS]); |
849 |
+ |
850 |
+ #undef MAC_STAT |
851 |
+ |
852 |
+@@ -489,7 +501,7 @@ static void siena_update_nic_stats(struct efx_nic *efx) |
853 |
+ |
854 |
+ static void siena_start_nic_stats(struct efx_nic *efx) |
855 |
+ { |
856 |
+- u64 *dma_stats = (u64 *)efx->stats_buffer.addr; |
857 |
++ __le64 *dma_stats = efx->stats_buffer.addr; |
858 |
+ |
859 |
+ dma_stats[MC_CMD_MAC_GENERATION_END] = STATS_GENERATION_INVALID; |
860 |
+ |
861 |
+@@ -590,7 +602,8 @@ const struct efx_nic_type siena_a0_nic_type = { |
862 |
+ .reset = siena_reset_hw, |
863 |
+ .probe_port = siena_probe_port, |
864 |
+ .remove_port = siena_remove_port, |
865 |
+- .prepare_flush = efx_port_dummy_op_void, |
866 |
++ .prepare_flush = siena_prepare_flush, |
867 |
++ .finish_flush = siena_finish_flush, |
868 |
+ .update_stats = siena_update_nic_stats, |
869 |
+ .start_stats = siena_start_nic_stats, |
870 |
+ .stop_stats = siena_stop_nic_stats, |
871 |
+diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c |
872 |
+index 5eab3dc..890841a 100644 |
873 |
+--- a/drivers/net/wireless/mwifiex/join.c |
874 |
++++ b/drivers/net/wireless/mwifiex/join.c |
875 |
+@@ -1102,10 +1102,9 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, |
876 |
+ adhoc_join->bss_descriptor.bssid, |
877 |
+ adhoc_join->bss_descriptor.ssid); |
878 |
+ |
879 |
+- for (i = 0; bss_desc->supported_rates[i] && |
880 |
+- i < MWIFIEX_SUPPORTED_RATES; |
881 |
+- i++) |
882 |
+- ; |
883 |
++ for (i = 0; i < MWIFIEX_SUPPORTED_RATES && |
884 |
++ bss_desc->supported_rates[i]; i++) |
885 |
++ ; |
886 |
+ rates_size = i; |
887 |
+ |
888 |
+ /* Copy Data Rates from the Rates recorded in scan response */ |
889 |
+diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c |
890 |
+index 5bd2c55..031aa2b 100644 |
891 |
+--- a/drivers/net/wireless/rt2x00/rt2x00dev.c |
892 |
++++ b/drivers/net/wireless/rt2x00/rt2x00dev.c |
893 |
+@@ -1113,7 +1113,9 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) |
894 |
+ rt2x00dev->hw->wiphy->interface_modes |= |
895 |
+ BIT(NL80211_IFTYPE_ADHOC) | |
896 |
+ BIT(NL80211_IFTYPE_AP) | |
897 |
++#ifdef CONFIG_MAC80211_MESH |
898 |
+ BIT(NL80211_IFTYPE_MESH_POINT) | |
899 |
++#endif |
900 |
+ BIT(NL80211_IFTYPE_WDS); |
901 |
+ |
902 |
+ /* |
903 |
+diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c |
904 |
+index 26f7f01..f0bf9c2 100644 |
905 |
+--- a/drivers/platform/x86/asus-laptop.c |
906 |
++++ b/drivers/platform/x86/asus-laptop.c |
907 |
+@@ -643,8 +643,10 @@ static ssize_t show_infos(struct device *dev, |
908 |
+ /* |
909 |
+ * The HWRS method return informations about the hardware. |
910 |
+ * 0x80 bit is for WLAN, 0x100 for Bluetooth. |
911 |
++ * 0x40 for WWAN, 0x10 for WIMAX. |
912 |
+ * The significance of others is yet to be found. |
913 |
+- * If we don't find the method, we assume the device are present. |
914 |
++ * We don't currently use this for device detection, and it |
915 |
++ * takes several seconds to run on some systems. |
916 |
+ */ |
917 |
+ rv = acpi_evaluate_integer(asus->handle, "HWRS", NULL, &temp); |
918 |
+ if (!ACPI_FAILURE(rv)) |
919 |
+@@ -1271,7 +1273,7 @@ static int asus_laptop_get_info(struct asus_laptop *asus) |
920 |
+ { |
921 |
+ struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
922 |
+ union acpi_object *model = NULL; |
923 |
+- unsigned long long bsts_result, hwrs_result; |
924 |
++ unsigned long long bsts_result; |
925 |
+ char *string = NULL; |
926 |
+ acpi_status status; |
927 |
+ |
928 |
+@@ -1333,17 +1335,6 @@ static int asus_laptop_get_info(struct asus_laptop *asus) |
929 |
+ if (*string) |
930 |
+ pr_notice(" %s model detected\n", string); |
931 |
+ |
932 |
+- /* |
933 |
+- * The HWRS method return informations about the hardware. |
934 |
+- * 0x80 bit is for WLAN, 0x100 for Bluetooth, |
935 |
+- * 0x40 for WWAN, 0x10 for WIMAX. |
936 |
+- * The significance of others is yet to be found. |
937 |
+- */ |
938 |
+- status = |
939 |
+- acpi_evaluate_integer(asus->handle, "HWRS", NULL, &hwrs_result); |
940 |
+- if (!ACPI_FAILURE(status)) |
941 |
+- pr_notice(" HWRS returned %x", (int)hwrs_result); |
942 |
+- |
943 |
+ if (!acpi_check_handle(asus->handle, METHOD_WL_STATUS, NULL)) |
944 |
+ asus->have_rsts = true; |
945 |
+ |
946 |
+diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c |
947 |
+index 92aa545..bf583fa 100644 |
948 |
+--- a/drivers/tty/serial/sunsu.c |
949 |
++++ b/drivers/tty/serial/sunsu.c |
950 |
+@@ -968,6 +968,7 @@ static struct uart_ops sunsu_pops = { |
951 |
+ #define UART_NR 4 |
952 |
+ |
953 |
+ static struct uart_sunsu_port sunsu_ports[UART_NR]; |
954 |
++static int nr_inst; /* Number of already registered ports */ |
955 |
+ |
956 |
+ #ifdef CONFIG_SERIO |
957 |
+ |
958 |
+@@ -1337,13 +1338,8 @@ static int __init sunsu_console_setup(struct console *co, char *options) |
959 |
+ printk("Console: ttyS%d (SU)\n", |
960 |
+ (sunsu_reg.minor - 64) + co->index); |
961 |
+ |
962 |
+- /* |
963 |
+- * Check whether an invalid uart number has been specified, and |
964 |
+- * if so, search for the first available port that does have |
965 |
+- * console support. |
966 |
+- */ |
967 |
+- if (co->index >= UART_NR) |
968 |
+- co->index = 0; |
969 |
++ if (co->index > nr_inst) |
970 |
++ return -ENODEV; |
971 |
+ port = &sunsu_ports[co->index].port; |
972 |
+ |
973 |
+ /* |
974 |
+@@ -1408,7 +1404,6 @@ static enum su_type __devinit su_get_type(struct device_node *dp) |
975 |
+ |
976 |
+ static int __devinit su_probe(struct platform_device *op) |
977 |
+ { |
978 |
+- static int inst; |
979 |
+ struct device_node *dp = op->dev.of_node; |
980 |
+ struct uart_sunsu_port *up; |
981 |
+ struct resource *rp; |
982 |
+@@ -1418,16 +1413,16 @@ static int __devinit su_probe(struct platform_device *op) |
983 |
+ |
984 |
+ type = su_get_type(dp); |
985 |
+ if (type == SU_PORT_PORT) { |
986 |
+- if (inst >= UART_NR) |
987 |
++ if (nr_inst >= UART_NR) |
988 |
+ return -EINVAL; |
989 |
+- up = &sunsu_ports[inst]; |
990 |
++ up = &sunsu_ports[nr_inst]; |
991 |
+ } else { |
992 |
+ up = kzalloc(sizeof(*up), GFP_KERNEL); |
993 |
+ if (!up) |
994 |
+ return -ENOMEM; |
995 |
+ } |
996 |
+ |
997 |
+- up->port.line = inst; |
998 |
++ up->port.line = nr_inst; |
999 |
+ |
1000 |
+ spin_lock_init(&up->port.lock); |
1001 |
+ |
1002 |
+@@ -1461,6 +1456,8 @@ static int __devinit su_probe(struct platform_device *op) |
1003 |
+ } |
1004 |
+ dev_set_drvdata(&op->dev, up); |
1005 |
+ |
1006 |
++ nr_inst++; |
1007 |
++ |
1008 |
+ return 0; |
1009 |
+ } |
1010 |
+ |
1011 |
+@@ -1488,7 +1485,7 @@ static int __devinit su_probe(struct platform_device *op) |
1012 |
+ |
1013 |
+ dev_set_drvdata(&op->dev, up); |
1014 |
+ |
1015 |
+- inst++; |
1016 |
++ nr_inst++; |
1017 |
+ |
1018 |
+ return 0; |
1019 |
+ |
1020 |
+diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c |
1021 |
+index a54c380..923153c 100644 |
1022 |
+--- a/drivers/usb/host/ehci-q.c |
1023 |
++++ b/drivers/usb/host/ehci-q.c |
1024 |
+@@ -137,7 +137,7 @@ qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh) |
1025 |
+ * qtd is updated in qh_completions(). Update the QH |
1026 |
+ * overlay here. |
1027 |
+ */ |
1028 |
+- if (qh->hw->hw_token & ACTIVE_BIT(ehci)) { |
1029 |
++ if (cpu_to_hc32(ehci, qtd->qtd_dma) == qh->hw->hw_current) { |
1030 |
+ qh->hw->hw_qtd_next = qtd->hw_next; |
1031 |
+ qtd = NULL; |
1032 |
+ } |
1033 |
+@@ -450,19 +450,11 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) |
1034 |
+ else if (last_status == -EINPROGRESS && !urb->unlinked) |
1035 |
+ continue; |
1036 |
+ |
1037 |
+- /* |
1038 |
+- * If this was the active qtd when the qh was unlinked |
1039 |
+- * and the overlay's token is active, then the overlay |
1040 |
+- * hasn't been written back to the qtd yet so use its |
1041 |
+- * token instead of the qtd's. After the qtd is |
1042 |
+- * processed and removed, the overlay won't be valid |
1043 |
+- * any more. |
1044 |
+- */ |
1045 |
+- if (state == QH_STATE_IDLE && |
1046 |
+- qh->qtd_list.next == &qtd->qtd_list && |
1047 |
+- (hw->hw_token & ACTIVE_BIT(ehci))) { |
1048 |
++ /* qh unlinked; token in overlay may be most current */ |
1049 |
++ if (state == QH_STATE_IDLE |
1050 |
++ && cpu_to_hc32(ehci, qtd->qtd_dma) |
1051 |
++ == hw->hw_current) { |
1052 |
+ token = hc32_to_cpu(ehci, hw->hw_token); |
1053 |
+- hw->hw_token &= ~ACTIVE_BIT(ehci); |
1054 |
+ |
1055 |
+ /* An unlink may leave an incomplete |
1056 |
+ * async transaction in the TT buffer. |
1057 |
+diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
1058 |
+index 1d72895..8b94412 100644 |
1059 |
+--- a/drivers/usb/host/xhci.h |
1060 |
++++ b/drivers/usb/host/xhci.h |
1061 |
+@@ -206,8 +206,8 @@ struct xhci_op_regs { |
1062 |
+ /* bits 12:31 are reserved (and should be preserved on writes). */ |
1063 |
+ |
1064 |
+ /* IMAN - Interrupt Management Register */ |
1065 |
+-#define IMAN_IP (1 << 1) |
1066 |
+-#define IMAN_IE (1 << 0) |
1067 |
++#define IMAN_IE (1 << 1) |
1068 |
++#define IMAN_IP (1 << 0) |
1069 |
+ |
1070 |
+ /* USBSTS - USB status - status bitmasks */ |
1071 |
+ /* HC not running - set to 1 when run/stop bit is cleared. */ |
1072 |
+diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c |
1073 |
+index b0a7a9e..51b22c3 100644 |
1074 |
+--- a/drivers/usb/serial/garmin_gps.c |
1075 |
++++ b/drivers/usb/serial/garmin_gps.c |
1076 |
+@@ -973,10 +973,7 @@ static void garmin_close(struct usb_serial_port *port) |
1077 |
+ if (!serial) |
1078 |
+ return; |
1079 |
+ |
1080 |
+- mutex_lock(&port->serial->disc_mutex); |
1081 |
+- |
1082 |
+- if (!port->serial->disconnected) |
1083 |
+- garmin_clear(garmin_data_p); |
1084 |
++ garmin_clear(garmin_data_p); |
1085 |
+ |
1086 |
+ /* shutdown our urbs */ |
1087 |
+ usb_kill_urb(port->read_urb); |
1088 |
+@@ -985,8 +982,6 @@ static void garmin_close(struct usb_serial_port *port) |
1089 |
+ /* keep reset state so we know that we must start a new session */ |
1090 |
+ if (garmin_data_p->state != STATE_RESET) |
1091 |
+ garmin_data_p->state = STATE_DISCONNECTED; |
1092 |
+- |
1093 |
+- mutex_unlock(&port->serial->disc_mutex); |
1094 |
+ } |
1095 |
+ |
1096 |
+ |
1097 |
+diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c |
1098 |
+index 8a90d58..bdb44fc 100644 |
1099 |
+--- a/drivers/usb/serial/io_ti.c |
1100 |
++++ b/drivers/usb/serial/io_ti.c |
1101 |
+@@ -2793,6 +2793,7 @@ static struct usb_serial_driver edgeport_2port_device = { |
1102 |
+ .set_termios = edge_set_termios, |
1103 |
+ .tiocmget = edge_tiocmget, |
1104 |
+ .tiocmset = edge_tiocmset, |
1105 |
++ .get_icount = edge_get_icount, |
1106 |
+ .write = edge_write, |
1107 |
+ .write_room = edge_write_room, |
1108 |
+ .chars_in_buffer = edge_chars_in_buffer, |
1109 |
+diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c |
1110 |
+index 637dfa4..f678532 100644 |
1111 |
+--- a/drivers/usb/serial/usb-serial.c |
1112 |
++++ b/drivers/usb/serial/usb-serial.c |
1113 |
+@@ -168,6 +168,7 @@ static void destroy_serial(struct kref *kref) |
1114 |
+ } |
1115 |
+ } |
1116 |
+ |
1117 |
++ usb_put_intf(serial->interface); |
1118 |
+ usb_put_dev(serial->dev); |
1119 |
+ kfree(serial); |
1120 |
+ } |
1121 |
+@@ -624,7 +625,7 @@ static struct usb_serial *create_serial(struct usb_device *dev, |
1122 |
+ } |
1123 |
+ serial->dev = usb_get_dev(dev); |
1124 |
+ serial->type = driver; |
1125 |
+- serial->interface = interface; |
1126 |
++ serial->interface = usb_get_intf(interface); |
1127 |
+ kref_init(&serial->kref); |
1128 |
+ mutex_init(&serial->disc_mutex); |
1129 |
+ serial->minor = SERIAL_TTY_NO_MINOR; |
1130 |
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
1131 |
+index fa8a1b2..7b8d564 100644 |
1132 |
+--- a/drivers/usb/storage/unusual_devs.h |
1133 |
++++ b/drivers/usb/storage/unusual_devs.h |
1134 |
+@@ -488,6 +488,13 @@ UNUSUAL_DEV( 0x04e8, 0x5122, 0x0000, 0x9999, |
1135 |
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1136 |
+ US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), |
1137 |
+ |
1138 |
++/* Added by Dmitry Artamonow <mad_soft@×××××.ru> */ |
1139 |
++UNUSUAL_DEV( 0x04e8, 0x5136, 0x0000, 0x9999, |
1140 |
++ "Samsung", |
1141 |
++ "YP-Z3", |
1142 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1143 |
++ US_FL_MAX_SECTORS_64), |
1144 |
++ |
1145 |
+ /* Entry and supporting patch by Theodore Kilgore <kilgota@××××××.edu>. |
1146 |
+ * Device uses standards-violating 32-byte Bulk Command Block Wrappers and |
1147 |
+ * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. |
1148 |
+diff --git a/fs/binfmt_em86.c b/fs/binfmt_em86.c |
1149 |
+index b8e8b0a..4a1b984 100644 |
1150 |
+--- a/fs/binfmt_em86.c |
1151 |
++++ b/fs/binfmt_em86.c |
1152 |
+@@ -42,7 +42,6 @@ static int load_em86(struct linux_binprm *bprm,struct pt_regs *regs) |
1153 |
+ return -ENOEXEC; |
1154 |
+ } |
1155 |
+ |
1156 |
+- bprm->recursion_depth++; /* Well, the bang-shell is implicit... */ |
1157 |
+ allow_write_access(bprm->file); |
1158 |
+ fput(bprm->file); |
1159 |
+ bprm->file = NULL; |
1160 |
+diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c |
1161 |
+index 5463952..b2497d4 100644 |
1162 |
+--- a/fs/binfmt_misc.c |
1163 |
++++ b/fs/binfmt_misc.c |
1164 |
+@@ -116,10 +116,6 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs) |
1165 |
+ if (!enabled) |
1166 |
+ goto _ret; |
1167 |
+ |
1168 |
+- retval = -ENOEXEC; |
1169 |
+- if (bprm->recursion_depth > BINPRM_MAX_RECURSION) |
1170 |
+- goto _ret; |
1171 |
+- |
1172 |
+ /* to keep locking time low, we copy the interpreter string */ |
1173 |
+ read_lock(&entries_lock); |
1174 |
+ fmt = check_file(bprm); |
1175 |
+@@ -200,8 +196,6 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs) |
1176 |
+ if (retval < 0) |
1177 |
+ goto _error; |
1178 |
+ |
1179 |
+- bprm->recursion_depth++; |
1180 |
+- |
1181 |
+ retval = search_binary_handler (bprm, regs); |
1182 |
+ if (retval < 0) |
1183 |
+ goto _error; |
1184 |
+diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c |
1185 |
+index e39c18a..211ede0 100644 |
1186 |
+--- a/fs/binfmt_script.c |
1187 |
++++ b/fs/binfmt_script.c |
1188 |
+@@ -22,15 +22,13 @@ static int load_script(struct linux_binprm *bprm,struct pt_regs *regs) |
1189 |
+ char interp[BINPRM_BUF_SIZE]; |
1190 |
+ int retval; |
1191 |
+ |
1192 |
+- if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!') || |
1193 |
+- (bprm->recursion_depth > BINPRM_MAX_RECURSION)) |
1194 |
++ if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!')) |
1195 |
+ return -ENOEXEC; |
1196 |
+ /* |
1197 |
+ * This section does the #! interpretation. |
1198 |
+ * Sorta complicated, but hopefully it will work. -TYT |
1199 |
+ */ |
1200 |
+ |
1201 |
+- bprm->recursion_depth++; |
1202 |
+ allow_write_access(bprm->file); |
1203 |
+ fput(bprm->file); |
1204 |
+ bprm->file = NULL; |
1205 |
+diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c |
1206 |
+index cfd1ce3..1d36db1 100644 |
1207 |
+--- a/fs/cifs/asn1.c |
1208 |
++++ b/fs/cifs/asn1.c |
1209 |
+@@ -614,53 +614,10 @@ decode_negTokenInit(unsigned char *security_blob, int length, |
1210 |
+ } |
1211 |
+ } |
1212 |
+ |
1213 |
+- /* mechlistMIC */ |
1214 |
+- if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { |
1215 |
+- /* Check if we have reached the end of the blob, but with |
1216 |
+- no mechListMic (e.g. NTLMSSP instead of KRB5) */ |
1217 |
+- if (ctx.error == ASN1_ERR_DEC_EMPTY) |
1218 |
+- goto decode_negtoken_exit; |
1219 |
+- cFYI(1, "Error decoding last part negTokenInit exit3"); |
1220 |
+- return 0; |
1221 |
+- } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { |
1222 |
+- /* tag = 3 indicating mechListMIC */ |
1223 |
+- cFYI(1, "Exit 4 cls = %d con = %d tag = %d end = %p (%d)", |
1224 |
+- cls, con, tag, end, *end); |
1225 |
+- return 0; |
1226 |
+- } |
1227 |
+- |
1228 |
+- /* sequence */ |
1229 |
+- if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { |
1230 |
+- cFYI(1, "Error decoding last part negTokenInit exit5"); |
1231 |
+- return 0; |
1232 |
+- } else if ((cls != ASN1_UNI) || (con != ASN1_CON) |
1233 |
+- || (tag != ASN1_SEQ)) { |
1234 |
+- cFYI(1, "cls = %d con = %d tag = %d end = %p (%d)", |
1235 |
+- cls, con, tag, end, *end); |
1236 |
+- } |
1237 |
+- |
1238 |
+- /* sequence of */ |
1239 |
+- if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { |
1240 |
+- cFYI(1, "Error decoding last part negTokenInit exit 7"); |
1241 |
+- return 0; |
1242 |
+- } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { |
1243 |
+- cFYI(1, "Exit 8 cls = %d con = %d tag = %d end = %p (%d)", |
1244 |
+- cls, con, tag, end, *end); |
1245 |
+- return 0; |
1246 |
+- } |
1247 |
+- |
1248 |
+- /* general string */ |
1249 |
+- if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { |
1250 |
+- cFYI(1, "Error decoding last part negTokenInit exit9"); |
1251 |
+- return 0; |
1252 |
+- } else if ((cls != ASN1_UNI) || (con != ASN1_PRI) |
1253 |
+- || (tag != ASN1_GENSTR)) { |
1254 |
+- cFYI(1, "Exit10 cls = %d con = %d tag = %d end = %p (%d)", |
1255 |
+- cls, con, tag, end, *end); |
1256 |
+- return 0; |
1257 |
+- } |
1258 |
+- cFYI(1, "Need to call asn1_octets_decode() function for %s", |
1259 |
+- ctx.pointer); /* is this UTF-8 or ASCII? */ |
1260 |
+-decode_negtoken_exit: |
1261 |
++ /* |
1262 |
++ * We currently ignore anything at the end of the SPNEGO blob after |
1263 |
++ * the mechTypes have been parsed, since none of that info is |
1264 |
++ * used at the moment. |
1265 |
++ */ |
1266 |
+ return 1; |
1267 |
+ } |
1268 |
+diff --git a/fs/compat.c b/fs/compat.c |
1269 |
+index e5358c2..f77a963 100644 |
1270 |
+--- a/fs/compat.c |
1271 |
++++ b/fs/compat.c |
1272 |
+@@ -576,6 +576,10 @@ ssize_t compat_rw_copy_check_uvector(int type, |
1273 |
+ } |
1274 |
+ *ret_pointer = iov; |
1275 |
+ |
1276 |
++ ret = -EFAULT; |
1277 |
++ if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector))) |
1278 |
++ goto out; |
1279 |
++ |
1280 |
+ /* |
1281 |
+ * Single unix specification: |
1282 |
+ * We should -EINVAL if an element length is not >= 0 and fitting an |
1283 |
+@@ -1106,17 +1110,12 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, |
1284 |
+ if (!file->f_op) |
1285 |
+ goto out; |
1286 |
+ |
1287 |
+- ret = -EFAULT; |
1288 |
+- if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector))) |
1289 |
+- goto out; |
1290 |
+- |
1291 |
+- tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs, |
1292 |
++ ret = compat_rw_copy_check_uvector(type, uvector, nr_segs, |
1293 |
+ UIO_FASTIOV, iovstack, &iov); |
1294 |
+- if (tot_len == 0) { |
1295 |
+- ret = 0; |
1296 |
++ if (ret <= 0) |
1297 |
+ goto out; |
1298 |
+- } |
1299 |
+ |
1300 |
++ tot_len = ret; |
1301 |
+ ret = rw_verify_area(type, file, pos, tot_len); |
1302 |
+ if (ret < 0) |
1303 |
+ goto out; |
1304 |
+diff --git a/fs/exec.c b/fs/exec.c |
1305 |
+index 08f3e4e..3801daf 100644 |
1306 |
+--- a/fs/exec.c |
1307 |
++++ b/fs/exec.c |
1308 |
+@@ -1369,6 +1369,10 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) |
1309 |
+ int try,retval; |
1310 |
+ struct linux_binfmt *fmt; |
1311 |
+ |
1312 |
++ /* This allows 4 levels of binfmt rewrites before failing hard. */ |
1313 |
++ if (depth > 5) |
1314 |
++ return -ELOOP; |
1315 |
++ |
1316 |
+ retval = security_bprm_check(bprm); |
1317 |
+ if (retval) |
1318 |
+ return retval; |
1319 |
+@@ -1387,12 +1391,8 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) |
1320 |
+ if (!try_module_get(fmt->module)) |
1321 |
+ continue; |
1322 |
+ read_unlock(&binfmt_lock); |
1323 |
++ bprm->recursion_depth = depth + 1; |
1324 |
+ retval = fn(bprm, regs); |
1325 |
+- /* |
1326 |
+- * Restore the depth counter to its starting value |
1327 |
+- * in this call, so we don't have to rely on every |
1328 |
+- * load_binary function to restore it on return. |
1329 |
+- */ |
1330 |
+ bprm->recursion_depth = depth; |
1331 |
+ if (retval >= 0) { |
1332 |
+ if (depth == 0) |
1333 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
1334 |
+index 680df5d..354ba48 100644 |
1335 |
+--- a/fs/ext4/extents.c |
1336 |
++++ b/fs/ext4/extents.c |
1337 |
+@@ -2901,6 +2901,7 @@ static int ext4_split_extent(handle_t *handle, |
1338 |
+ int err = 0; |
1339 |
+ int uninitialized; |
1340 |
+ int split_flag1, flags1; |
1341 |
++ int allocated = map->m_len; |
1342 |
+ |
1343 |
+ depth = ext_depth(inode); |
1344 |
+ ex = path[depth].p_ext; |
1345 |
+@@ -2919,6 +2920,8 @@ static int ext4_split_extent(handle_t *handle, |
1346 |
+ map->m_lblk + map->m_len, split_flag1, flags1); |
1347 |
+ if (err) |
1348 |
+ goto out; |
1349 |
++ } else { |
1350 |
++ allocated = ee_len - (map->m_lblk - ee_block); |
1351 |
+ } |
1352 |
+ |
1353 |
+ ext4_ext_drop_refs(path); |
1354 |
+@@ -2941,7 +2944,7 @@ static int ext4_split_extent(handle_t *handle, |
1355 |
+ |
1356 |
+ ext4_ext_show_leaf(inode, path); |
1357 |
+ out: |
1358 |
+- return err ? err : map->m_len; |
1359 |
++ return err ? err : allocated; |
1360 |
+ } |
1361 |
+ |
1362 |
+ #define EXT4_EXT_ZERO_LEN 7 |
1363 |
+@@ -3309,6 +3312,7 @@ out: |
1364 |
+ allocated - map->m_len); |
1365 |
+ allocated = map->m_len; |
1366 |
+ } |
1367 |
++ map->m_len = allocated; |
1368 |
+ |
1369 |
+ /* |
1370 |
+ * If we have done fallocate with the offset that is already |
1371 |
+diff --git a/fs/isofs/export.c b/fs/isofs/export.c |
1372 |
+index 516eb21..fd88add 100644 |
1373 |
+--- a/fs/isofs/export.c |
1374 |
++++ b/fs/isofs/export.c |
1375 |
+@@ -135,6 +135,7 @@ isofs_export_encode_fh(struct dentry *dentry, |
1376 |
+ len = 3; |
1377 |
+ fh32[0] = ei->i_iget5_block; |
1378 |
+ fh16[2] = (__u16)ei->i_iget5_offset; /* fh16 [sic] */ |
1379 |
++ fh16[3] = 0; /* avoid leaking uninitialized data */ |
1380 |
+ fh32[2] = inode->i_generation; |
1381 |
+ if (connectable && !S_ISDIR(inode->i_mode)) { |
1382 |
+ struct inode *parent; |
1383 |
+diff --git a/fs/udf/namei.c b/fs/udf/namei.c |
1384 |
+index f1dce84..d8c1bb5 100644 |
1385 |
+--- a/fs/udf/namei.c |
1386 |
++++ b/fs/udf/namei.c |
1387 |
+@@ -1297,6 +1297,7 @@ static int udf_encode_fh(struct dentry *de, __u32 *fh, int *lenp, |
1388 |
+ *lenp = 3; |
1389 |
+ fid->udf.block = location.logicalBlockNum; |
1390 |
+ fid->udf.partref = location.partitionReferenceNum; |
1391 |
++ fid->udf.parent_partref = 0; |
1392 |
+ fid->udf.generation = inode->i_generation; |
1393 |
+ |
1394 |
+ if (connectable && !S_ISDIR(inode->i_mode)) { |
1395 |
+diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h |
1396 |
+index 4858c19..54706dc 100644 |
1397 |
+--- a/fs/udf/udf_sb.h |
1398 |
++++ b/fs/udf/udf_sb.h |
1399 |
+@@ -79,7 +79,7 @@ struct udf_virtual_data { |
1400 |
+ struct udf_bitmap { |
1401 |
+ __u32 s_extLength; |
1402 |
+ __u32 s_extPosition; |
1403 |
+- __u16 s_nr_groups; |
1404 |
++ int s_nr_groups; |
1405 |
+ struct buffer_head **s_block_bitmap; |
1406 |
+ }; |
1407 |
+ |
1408 |
+diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h |
1409 |
+index 384e37f..718eb0b 100644 |
1410 |
+--- a/include/linux/binfmts.h |
1411 |
++++ b/include/linux/binfmts.h |
1412 |
+@@ -67,8 +67,6 @@ struct linux_binprm { |
1413 |
+ #define BINPRM_FLAGS_EXECFD_BIT 1 |
1414 |
+ #define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT) |
1415 |
+ |
1416 |
+-#define BINPRM_MAX_RECURSION 4 |
1417 |
+- |
1418 |
+ /* Function parameter for binfmt->coredump */ |
1419 |
+ struct coredump_params { |
1420 |
+ long signr; |
1421 |
+diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h |
1422 |
+index 16ff29a..b289bd2 100644 |
1423 |
+--- a/include/net/inet_frag.h |
1424 |
++++ b/include/net/inet_frag.h |
1425 |
+@@ -33,6 +33,13 @@ struct inet_frag_queue { |
1426 |
+ |
1427 |
+ #define INETFRAGS_HASHSZ 64 |
1428 |
+ |
1429 |
++/* averaged: |
1430 |
++ * max_depth = default ipfrag_high_thresh / INETFRAGS_HASHSZ / |
1431 |
++ * rounded up (SKB_TRUELEN(0) + sizeof(struct ipq or |
1432 |
++ * struct frag_queue)) |
1433 |
++ */ |
1434 |
++#define INETFRAGS_MAXDEPTH 128 |
1435 |
++ |
1436 |
+ struct inet_frags { |
1437 |
+ struct hlist_head hash[INETFRAGS_HASHSZ]; |
1438 |
+ rwlock_t lock; |
1439 |
+@@ -64,6 +71,8 @@ int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f); |
1440 |
+ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, |
1441 |
+ struct inet_frags *f, void *key, unsigned int hash) |
1442 |
+ __releases(&f->lock); |
1443 |
++void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q, |
1444 |
++ const char *prefix); |
1445 |
+ |
1446 |
+ static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) |
1447 |
+ { |
1448 |
+diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h |
1449 |
+index 10422ef..2124004 100644 |
1450 |
+--- a/include/net/ip_fib.h |
1451 |
++++ b/include/net/ip_fib.h |
1452 |
+@@ -129,18 +129,16 @@ struct fib_result_nl { |
1453 |
+ }; |
1454 |
+ |
1455 |
+ #ifdef CONFIG_IP_ROUTE_MULTIPATH |
1456 |
+- |
1457 |
+ #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) |
1458 |
+- |
1459 |
+-#define FIB_TABLE_HASHSZ 2 |
1460 |
+- |
1461 |
+ #else /* CONFIG_IP_ROUTE_MULTIPATH */ |
1462 |
+- |
1463 |
+ #define FIB_RES_NH(res) ((res).fi->fib_nh[0]) |
1464 |
++#endif /* CONFIG_IP_ROUTE_MULTIPATH */ |
1465 |
+ |
1466 |
++#ifdef CONFIG_IP_MULTIPLE_TABLES |
1467 |
+ #define FIB_TABLE_HASHSZ 256 |
1468 |
+- |
1469 |
+-#endif /* CONFIG_IP_ROUTE_MULTIPATH */ |
1470 |
++#else |
1471 |
++#define FIB_TABLE_HASHSZ 2 |
1472 |
++#endif |
1473 |
+ |
1474 |
+ extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh); |
1475 |
+ |
1476 |
+diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c |
1477 |
+index 7a90d02..9e40370 100644 |
1478 |
+--- a/kernel/time/tick-broadcast.c |
1479 |
++++ b/kernel/time/tick-broadcast.c |
1480 |
+@@ -66,7 +66,8 @@ static void tick_broadcast_start_periodic(struct clock_event_device *bc) |
1481 |
+ */ |
1482 |
+ int tick_check_broadcast_device(struct clock_event_device *dev) |
1483 |
+ { |
1484 |
+- if ((tick_broadcast_device.evtdev && |
1485 |
++ if ((dev->features & CLOCK_EVT_FEAT_DUMMY) || |
1486 |
++ (tick_broadcast_device.evtdev && |
1487 |
+ tick_broadcast_device.evtdev->rating >= dev->rating) || |
1488 |
+ (dev->features & CLOCK_EVT_FEAT_C3STOP)) |
1489 |
+ return 0; |
1490 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
1491 |
+index 86fd417..b2ca34a 100644 |
1492 |
+--- a/kernel/trace/ftrace.c |
1493 |
++++ b/kernel/trace/ftrace.c |
1494 |
+@@ -2709,8 +2709,8 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, |
1495 |
+ continue; |
1496 |
+ } |
1497 |
+ |
1498 |
+- hlist_del(&entry->node); |
1499 |
+- call_rcu(&entry->rcu, ftrace_free_entry_rcu); |
1500 |
++ hlist_del_rcu(&entry->node); |
1501 |
++ call_rcu_sched(&entry->rcu, ftrace_free_entry_rcu); |
1502 |
+ } |
1503 |
+ } |
1504 |
+ __disable_ftrace_function_probe(); |
1505 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
1506 |
+index 672a749..97bf540 100644 |
1507 |
+--- a/kernel/trace/trace.c |
1508 |
++++ b/kernel/trace/trace.c |
1509 |
+@@ -649,7 +649,7 @@ __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) |
1510 |
+ void |
1511 |
+ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) |
1512 |
+ { |
1513 |
+- struct ring_buffer *buf = tr->buffer; |
1514 |
++ struct ring_buffer *buf; |
1515 |
+ |
1516 |
+ if (trace_stop_count) |
1517 |
+ return; |
1518 |
+@@ -661,6 +661,7 @@ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) |
1519 |
+ } |
1520 |
+ arch_spin_lock(&ftrace_max_lock); |
1521 |
+ |
1522 |
++ buf = tr->buffer; |
1523 |
+ tr->buffer = max_tr.buffer; |
1524 |
+ max_tr.buffer = buf; |
1525 |
+ |
1526 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
1527 |
+index 037f077..2c56a53 100644 |
1528 |
+--- a/mm/hugetlb.c |
1529 |
++++ b/mm/hugetlb.c |
1530 |
+@@ -2006,8 +2006,12 @@ int hugetlb_report_node_meminfo(int nid, char *buf) |
1531 |
+ /* Return the number pages of memory we physically have, in PAGE_SIZE units. */ |
1532 |
+ unsigned long hugetlb_total_pages(void) |
1533 |
+ { |
1534 |
+- struct hstate *h = &default_hstate; |
1535 |
+- return h->nr_huge_pages * pages_per_huge_page(h); |
1536 |
++ struct hstate *h; |
1537 |
++ unsigned long nr_total_pages = 0; |
1538 |
++ |
1539 |
++ for_each_hstate(h) |
1540 |
++ nr_total_pages += h->nr_huge_pages * pages_per_huge_page(h); |
1541 |
++ return nr_total_pages; |
1542 |
+ } |
1543 |
+ |
1544 |
+ static int hugetlb_acct_memory(struct hstate *h, long delta) |
1545 |
+diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c |
1546 |
+index 222312e..81c16d3 100644 |
1547 |
+--- a/net/core/rtnetlink.c |
1548 |
++++ b/net/core/rtnetlink.c |
1549 |
+@@ -2011,7 +2011,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
1550 |
+ struct rtattr *attr = (void *)nlh + NLMSG_ALIGN(min_len); |
1551 |
+ |
1552 |
+ while (RTA_OK(attr, attrlen)) { |
1553 |
+- unsigned flavor = attr->rta_type; |
1554 |
++ unsigned int flavor = attr->rta_type & NLA_TYPE_MASK; |
1555 |
+ if (flavor) { |
1556 |
+ if (flavor > rta_max[sz_idx]) |
1557 |
+ return -EINVAL; |
1558 |
+diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c |
1559 |
+index 5ff2a51..210b710 100644 |
1560 |
+--- a/net/ipv4/inet_fragment.c |
1561 |
++++ b/net/ipv4/inet_fragment.c |
1562 |
+@@ -21,6 +21,7 @@ |
1563 |
+ #include <linux/rtnetlink.h> |
1564 |
+ #include <linux/slab.h> |
1565 |
+ |
1566 |
++#include <net/sock.h> |
1567 |
+ #include <net/inet_frag.h> |
1568 |
+ |
1569 |
+ static void inet_frag_secret_rebuild(unsigned long dummy) |
1570 |
+@@ -271,6 +272,7 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, |
1571 |
+ { |
1572 |
+ struct inet_frag_queue *q; |
1573 |
+ struct hlist_node *n; |
1574 |
++ int depth = 0; |
1575 |
+ |
1576 |
+ hlist_for_each_entry(q, n, &f->hash[hash], list) { |
1577 |
+ if (q->net == nf && f->match(q, key)) { |
1578 |
+@@ -278,9 +280,25 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, |
1579 |
+ read_unlock(&f->lock); |
1580 |
+ return q; |
1581 |
+ } |
1582 |
++ depth++; |
1583 |
+ } |
1584 |
+ read_unlock(&f->lock); |
1585 |
+ |
1586 |
+- return inet_frag_create(nf, f, key); |
1587 |
++ if (depth <= INETFRAGS_MAXDEPTH) |
1588 |
++ return inet_frag_create(nf, f, key); |
1589 |
++ else |
1590 |
++ return ERR_PTR(-ENOBUFS); |
1591 |
+ } |
1592 |
+ EXPORT_SYMBOL(inet_frag_find); |
1593 |
++ |
1594 |
++void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q, |
1595 |
++ const char *prefix) |
1596 |
++{ |
1597 |
++ static const char msg[] = "inet_frag_find: Fragment hash bucket" |
1598 |
++ " list length grew over limit " __stringify(INETFRAGS_MAXDEPTH) |
1599 |
++ ". Dropping fragment.\n"; |
1600 |
++ |
1601 |
++ if (PTR_ERR(q) == -ENOBUFS) |
1602 |
++ LIMIT_NETDEBUG(KERN_WARNING "%s%s", prefix, msg); |
1603 |
++} |
1604 |
++EXPORT_SYMBOL(inet_frag_maybe_warn_overflow); |
1605 |
+diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c |
1606 |
+index 0ad6035..da38472 100644 |
1607 |
+--- a/net/ipv4/ip_fragment.c |
1608 |
++++ b/net/ipv4/ip_fragment.c |
1609 |
+@@ -20,6 +20,8 @@ |
1610 |
+ * Patrick McHardy : LRU queue of frag heads for evictor. |
1611 |
+ */ |
1612 |
+ |
1613 |
++#define pr_fmt(fmt) "IPv4: " fmt |
1614 |
++ |
1615 |
+ #include <linux/compiler.h> |
1616 |
+ #include <linux/module.h> |
1617 |
+ #include <linux/types.h> |
1618 |
+@@ -292,14 +294,12 @@ static inline struct ipq *ip_find(struct net *net, struct iphdr *iph, u32 user) |
1619 |
+ hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol); |
1620 |
+ |
1621 |
+ q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash); |
1622 |
+- if (q == NULL) |
1623 |
+- goto out_nomem; |
1624 |
++ if (IS_ERR_OR_NULL(q)) { |
1625 |
++ inet_frag_maybe_warn_overflow(q, pr_fmt()); |
1626 |
++ return NULL; |
1627 |
++ } |
1628 |
+ |
1629 |
+ return container_of(q, struct ipq, q); |
1630 |
+- |
1631 |
+-out_nomem: |
1632 |
+- LIMIT_NETDEBUG(KERN_ERR "ip_frag_create: no memory left !\n"); |
1633 |
+- return NULL; |
1634 |
+ } |
1635 |
+ |
1636 |
+ /* Is the fragment too far ahead to be part of ipq? */ |
1637 |
+diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c |
1638 |
+index 42dd1a9..40eb4fc 100644 |
1639 |
+--- a/net/ipv4/ip_options.c |
1640 |
++++ b/net/ipv4/ip_options.c |
1641 |
+@@ -358,7 +358,6 @@ int ip_options_compile(struct net *net, |
1642 |
+ } |
1643 |
+ switch (optptr[3]&0xF) { |
1644 |
+ case IPOPT_TS_TSONLY: |
1645 |
+- opt->ts = optptr - iph; |
1646 |
+ if (skb) |
1647 |
+ timeptr = &optptr[optptr[2]-1]; |
1648 |
+ opt->ts_needtime = 1; |
1649 |
+@@ -369,7 +368,6 @@ int ip_options_compile(struct net *net, |
1650 |
+ pp_ptr = optptr + 2; |
1651 |
+ goto error; |
1652 |
+ } |
1653 |
+- opt->ts = optptr - iph; |
1654 |
+ if (rt) { |
1655 |
+ memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4); |
1656 |
+ timeptr = &optptr[optptr[2]+3]; |
1657 |
+@@ -383,7 +381,6 @@ int ip_options_compile(struct net *net, |
1658 |
+ pp_ptr = optptr + 2; |
1659 |
+ goto error; |
1660 |
+ } |
1661 |
+- opt->ts = optptr - iph; |
1662 |
+ { |
1663 |
+ __be32 addr; |
1664 |
+ memcpy(&addr, &optptr[optptr[2]-1], 4); |
1665 |
+@@ -416,12 +413,12 @@ int ip_options_compile(struct net *net, |
1666 |
+ pp_ptr = optptr + 3; |
1667 |
+ goto error; |
1668 |
+ } |
1669 |
+- opt->ts = optptr - iph; |
1670 |
+ if (skb) { |
1671 |
+ optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4); |
1672 |
+ opt->is_changed = 1; |
1673 |
+ } |
1674 |
+ } |
1675 |
++ opt->ts = optptr - iph; |
1676 |
+ break; |
1677 |
+ case IPOPT_RA: |
1678 |
+ if (optlen < 4) { |
1679 |
+diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c |
1680 |
+index 0857272..afc7530 100644 |
1681 |
+--- a/net/ipv6/netfilter/nf_conntrack_reasm.c |
1682 |
++++ b/net/ipv6/netfilter/nf_conntrack_reasm.c |
1683 |
+@@ -14,6 +14,8 @@ |
1684 |
+ * 2 of the License, or (at your option) any later version. |
1685 |
+ */ |
1686 |
+ |
1687 |
++#define pr_fmt(fmt) "IPv6-nf: " fmt |
1688 |
++ |
1689 |
+ #include <linux/errno.h> |
1690 |
+ #include <linux/types.h> |
1691 |
+ #include <linux/string.h> |
1692 |
+@@ -176,14 +178,12 @@ fq_find(__be32 id, u32 user, struct in6_addr *src, struct in6_addr *dst) |
1693 |
+ |
1694 |
+ q = inet_frag_find(&nf_init_frags, &nf_frags, &arg, hash); |
1695 |
+ local_bh_enable(); |
1696 |
+- if (q == NULL) |
1697 |
+- goto oom; |
1698 |
++ if (IS_ERR_OR_NULL(q)) { |
1699 |
++ inet_frag_maybe_warn_overflow(q, pr_fmt()); |
1700 |
++ return NULL; |
1701 |
++ } |
1702 |
+ |
1703 |
+ return container_of(q, struct nf_ct_frag6_queue, q); |
1704 |
+- |
1705 |
+-oom: |
1706 |
+- pr_debug("Can't alloc new queue\n"); |
1707 |
+- return NULL; |
1708 |
+ } |
1709 |
+ |
1710 |
+ |
1711 |
+diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c |
1712 |
+index 7b954e2..43f8fc9 100644 |
1713 |
+--- a/net/ipv6/reassembly.c |
1714 |
++++ b/net/ipv6/reassembly.c |
1715 |
+@@ -26,6 +26,9 @@ |
1716 |
+ * YOSHIFUJI,H. @USAGI Always remove fragment header to |
1717 |
+ * calculate ICV correctly. |
1718 |
+ */ |
1719 |
++ |
1720 |
++#define pr_fmt(fmt) "IPv6: " fmt |
1721 |
++ |
1722 |
+ #include <linux/errno.h> |
1723 |
+ #include <linux/types.h> |
1724 |
+ #include <linux/string.h> |
1725 |
+@@ -239,9 +242,10 @@ fq_find(struct net *net, __be32 id, const struct in6_addr *src, const struct in6 |
1726 |
+ hash = inet6_hash_frag(id, src, dst, ip6_frags.rnd); |
1727 |
+ |
1728 |
+ q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash); |
1729 |
+- if (q == NULL) |
1730 |
++ if (IS_ERR_OR_NULL(q)) { |
1731 |
++ inet_frag_maybe_warn_overflow(q, pr_fmt()); |
1732 |
+ return NULL; |
1733 |
+- |
1734 |
++ } |
1735 |
+ return container_of(q, struct frag_queue, q); |
1736 |
+ } |
1737 |
+ |
1738 |
+diff --git a/net/sctp/associola.c b/net/sctp/associola.c |
1739 |
+index 17a6e65..6c8c8da 100644 |
1740 |
+--- a/net/sctp/associola.c |
1741 |
++++ b/net/sctp/associola.c |
1742 |
+@@ -1043,7 +1043,7 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc, |
1743 |
+ transports) { |
1744 |
+ |
1745 |
+ if (transport == active) |
1746 |
+- break; |
1747 |
++ continue; |
1748 |
+ list_for_each_entry(chunk, &transport->transmitted, |
1749 |
+ transmitted_list) { |
1750 |
+ if (key == chunk->subh.data_hdr->tsn) { |
1751 |
+diff --git a/security/keys/compat.c b/security/keys/compat.c |
1752 |
+index 338b510..10a6e4c 100644 |
1753 |
+--- a/security/keys/compat.c |
1754 |
++++ b/security/keys/compat.c |
1755 |
+@@ -40,12 +40,12 @@ long compat_keyctl_instantiate_key_iov( |
1756 |
+ ARRAY_SIZE(iovstack), |
1757 |
+ iovstack, &iov); |
1758 |
+ if (ret < 0) |
1759 |
+- return ret; |
1760 |
++ goto err; |
1761 |
+ if (ret == 0) |
1762 |
+ goto no_payload_free; |
1763 |
+ |
1764 |
+ ret = keyctl_instantiate_key_common(id, iov, ioc, ret, ringid); |
1765 |
+- |
1766 |
++err: |
1767 |
+ if (iov != iovstack) |
1768 |
+ kfree(iov); |
1769 |
+ return ret; |
1770 |
+diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c |
1771 |
+index eca5191..9f9cc3a 100644 |
1772 |
+--- a/security/keys/keyctl.c |
1773 |
++++ b/security/keys/keyctl.c |
1774 |
+@@ -1067,12 +1067,12 @@ long keyctl_instantiate_key_iov(key_serial_t id, |
1775 |
+ ret = rw_copy_check_uvector(WRITE, _payload_iov, ioc, |
1776 |
+ ARRAY_SIZE(iovstack), iovstack, &iov); |
1777 |
+ if (ret < 0) |
1778 |
+- return ret; |
1779 |
++ goto err; |
1780 |
+ if (ret == 0) |
1781 |
+ goto no_payload_free; |
1782 |
+ |
1783 |
+ ret = keyctl_instantiate_key_common(id, iov, ioc, ret, ringid); |
1784 |
+- |
1785 |
++err: |
1786 |
+ if (iov != iovstack) |
1787 |
+ kfree(iov); |
1788 |
+ return ret; |
1789 |
+diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
1790 |
+index 39e1a6a..7b747af 100644 |
1791 |
+--- a/sound/pci/hda/hda_codec.c |
1792 |
++++ b/sound/pci/hda/hda_codec.c |
1793 |
+@@ -2625,7 +2625,7 @@ static unsigned int convert_to_spdif_status(unsigned short val) |
1794 |
+ if (val & AC_DIG1_PROFESSIONAL) |
1795 |
+ sbits |= IEC958_AES0_PROFESSIONAL; |
1796 |
+ if (sbits & IEC958_AES0_PROFESSIONAL) { |
1797 |
+- if (sbits & AC_DIG1_EMPHASIS) |
1798 |
++ if (val & AC_DIG1_EMPHASIS) |
1799 |
+ sbits |= IEC958_AES0_PRO_EMPHASIS_5015; |
1800 |
+ } else { |
1801 |
+ if (val & AC_DIG1_EMPHASIS) |
1802 |
+diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
1803 |
+index 4d68f90..0957e1c 100644 |
1804 |
+--- a/sound/usb/mixer.c |
1805 |
++++ b/sound/usb/mixer.c |
1806 |
+@@ -711,8 +711,9 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ |
1807 |
+ case UAC2_CLOCK_SELECTOR: { |
1808 |
+ struct uac_selector_unit_descriptor *d = p1; |
1809 |
+ /* call recursively to retrieve the channel info */ |
1810 |
+- if (check_input_term(state, d->baSourceID[0], term) < 0) |
1811 |
+- return -ENODEV; |
1812 |
++ err = check_input_term(state, d->baSourceID[0], term); |
1813 |
++ if (err < 0) |
1814 |
++ return err; |
1815 |
+ term->type = d->bDescriptorSubtype << 16; /* virtual type */ |
1816 |
+ term->id = id; |
1817 |
+ term->name = uac_selector_unit_iSelector(d); |
1818 |
+@@ -1262,8 +1263,9 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void |
1819 |
+ return err; |
1820 |
+ |
1821 |
+ /* determine the input source type and name */ |
1822 |
+- if (check_input_term(state, hdr->bSourceID, &iterm) < 0) |
1823 |
+- return -EINVAL; |
1824 |
++ err = check_input_term(state, hdr->bSourceID, &iterm); |
1825 |
++ if (err < 0) |
1826 |
++ return err; |
1827 |
+ |
1828 |
+ master_bits = snd_usb_combine_bytes(bmaControls, csize); |
1829 |
+ /* master configuration quirks */ |
1830 |
+@@ -2024,7 +2026,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) |
1831 |
+ state.oterm.type = le16_to_cpu(desc->wTerminalType); |
1832 |
+ state.oterm.name = desc->iTerminal; |
1833 |
+ err = parse_audio_unit(&state, desc->bSourceID); |
1834 |
+- if (err < 0) |
1835 |
++ if (err < 0 && err != -EINVAL) |
1836 |
+ return err; |
1837 |
+ } else { /* UAC_VERSION_2 */ |
1838 |
+ struct uac2_output_terminal_descriptor *desc = p; |
1839 |
+@@ -2036,12 +2038,12 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) |
1840 |
+ state.oterm.type = le16_to_cpu(desc->wTerminalType); |
1841 |
+ state.oterm.name = desc->iTerminal; |
1842 |
+ err = parse_audio_unit(&state, desc->bSourceID); |
1843 |
+- if (err < 0) |
1844 |
++ if (err < 0 && err != -EINVAL) |
1845 |
+ return err; |
1846 |
+ |
1847 |
+ /* for UAC2, use the same approach to also add the clock selectors */ |
1848 |
+ err = parse_audio_unit(&state, desc->bCSourceID); |
1849 |
+- if (err < 0) |
1850 |
++ if (err < 0 && err != -EINVAL) |
1851 |
+ return err; |
1852 |
+ } |
1853 |
+ } |
1854 |
|
1855 |
Modified: genpatches-2.6/trunk/3.2/0000_README |
1856 |
=================================================================== |
1857 |
--- genpatches-2.6/trunk/3.2/0000_README 2013-03-30 11:08:52 UTC (rev 2326) |
1858 |
+++ genpatches-2.6/trunk/3.2/0000_README 2013-03-31 21:28:05 UTC (rev 2327) |
1859 |
@@ -204,6 +204,10 @@ |
1860 |
From: http://www.kernel.org |
1861 |
Desc: Linux 3.2.41 |
1862 |
|
1863 |
+Patch: 1041_linux-3.2.42.patch |
1864 |
+From: http://www.kernel.org |
1865 |
+Desc: Linux 3.2.42 |
1866 |
+ |
1867 |
Patch: 2300_per-pci-device-msi-irq-listing.patch |
1868 |
From: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=da8d1c8ba4dcb16d60be54b233deca9a7cac98dc |
1869 |
Desc: Add a per-pci-device subdirectory in sysfs |
1870 |
|
1871 |
Added: genpatches-2.6/trunk/3.2/1041_linux-3.2.42.patch |
1872 |
=================================================================== |
1873 |
--- genpatches-2.6/trunk/3.2/1041_linux-3.2.42.patch (rev 0) |
1874 |
+++ genpatches-2.6/trunk/3.2/1041_linux-3.2.42.patch 2013-03-31 21:28:05 UTC (rev 2327) |
1875 |
@@ -0,0 +1,3602 @@ |
1876 |
+diff --git a/Makefile b/Makefile |
1877 |
+index 95e6220..d44f009 100644 |
1878 |
+--- a/Makefile |
1879 |
++++ b/Makefile |
1880 |
+@@ -1,6 +1,6 @@ |
1881 |
+ VERSION = 3 |
1882 |
+ PATCHLEVEL = 2 |
1883 |
+-SUBLEVEL = 41 |
1884 |
++SUBLEVEL = 42 |
1885 |
+ EXTRAVERSION = |
1886 |
+ NAME = Saber-toothed Squirrel |
1887 |
+ |
1888 |
+diff --git a/arch/arm/include/asm/signal.h b/arch/arm/include/asm/signal.h |
1889 |
+index 43ba0fb..559ee24 100644 |
1890 |
+--- a/arch/arm/include/asm/signal.h |
1891 |
++++ b/arch/arm/include/asm/signal.h |
1892 |
+@@ -127,6 +127,7 @@ struct sigaction { |
1893 |
+ __sigrestore_t sa_restorer; |
1894 |
+ sigset_t sa_mask; /* mask last for extensibility */ |
1895 |
+ }; |
1896 |
++#define __ARCH_HAS_SA_RESTORER |
1897 |
+ |
1898 |
+ struct k_sigaction { |
1899 |
+ struct sigaction sa; |
1900 |
+diff --git a/arch/avr32/include/asm/signal.h b/arch/avr32/include/asm/signal.h |
1901 |
+index 8790dfc..e6952a0 100644 |
1902 |
+--- a/arch/avr32/include/asm/signal.h |
1903 |
++++ b/arch/avr32/include/asm/signal.h |
1904 |
+@@ -128,6 +128,7 @@ struct sigaction { |
1905 |
+ __sigrestore_t sa_restorer; |
1906 |
+ sigset_t sa_mask; /* mask last for extensibility */ |
1907 |
+ }; |
1908 |
++#define __ARCH_HAS_SA_RESTORER |
1909 |
+ |
1910 |
+ struct k_sigaction { |
1911 |
+ struct sigaction sa; |
1912 |
+diff --git a/arch/cris/include/asm/signal.h b/arch/cris/include/asm/signal.h |
1913 |
+index ea6af9a..057fea2 100644 |
1914 |
+--- a/arch/cris/include/asm/signal.h |
1915 |
++++ b/arch/cris/include/asm/signal.h |
1916 |
+@@ -122,6 +122,7 @@ struct sigaction { |
1917 |
+ void (*sa_restorer)(void); |
1918 |
+ sigset_t sa_mask; /* mask last for extensibility */ |
1919 |
+ }; |
1920 |
++#define __ARCH_HAS_SA_RESTORER |
1921 |
+ |
1922 |
+ struct k_sigaction { |
1923 |
+ struct sigaction sa; |
1924 |
+diff --git a/arch/h8300/include/asm/signal.h b/arch/h8300/include/asm/signal.h |
1925 |
+index fd8b66e..8695707 100644 |
1926 |
+--- a/arch/h8300/include/asm/signal.h |
1927 |
++++ b/arch/h8300/include/asm/signal.h |
1928 |
+@@ -121,6 +121,7 @@ struct sigaction { |
1929 |
+ void (*sa_restorer)(void); |
1930 |
+ sigset_t sa_mask; /* mask last for extensibility */ |
1931 |
+ }; |
1932 |
++#define __ARCH_HAS_SA_RESTORER |
1933 |
+ |
1934 |
+ struct k_sigaction { |
1935 |
+ struct sigaction sa; |
1936 |
+diff --git a/arch/m32r/include/asm/signal.h b/arch/m32r/include/asm/signal.h |
1937 |
+index b2eeb0d..802d561 100644 |
1938 |
+--- a/arch/m32r/include/asm/signal.h |
1939 |
++++ b/arch/m32r/include/asm/signal.h |
1940 |
+@@ -123,6 +123,7 @@ struct sigaction { |
1941 |
+ __sigrestore_t sa_restorer; |
1942 |
+ sigset_t sa_mask; /* mask last for extensibility */ |
1943 |
+ }; |
1944 |
++#define __ARCH_HAS_SA_RESTORER |
1945 |
+ |
1946 |
+ struct k_sigaction { |
1947 |
+ struct sigaction sa; |
1948 |
+diff --git a/arch/m68k/include/asm/signal.h b/arch/m68k/include/asm/signal.h |
1949 |
+index 93fe83e..a20ae63 100644 |
1950 |
+--- a/arch/m68k/include/asm/signal.h |
1951 |
++++ b/arch/m68k/include/asm/signal.h |
1952 |
+@@ -119,6 +119,7 @@ struct sigaction { |
1953 |
+ __sigrestore_t sa_restorer; |
1954 |
+ sigset_t sa_mask; /* mask last for extensibility */ |
1955 |
+ }; |
1956 |
++#define __ARCH_HAS_SA_RESTORER |
1957 |
+ |
1958 |
+ struct k_sigaction { |
1959 |
+ struct sigaction sa; |
1960 |
+diff --git a/arch/mn10300/include/asm/signal.h b/arch/mn10300/include/asm/signal.h |
1961 |
+index 1865d72..eecaa76 100644 |
1962 |
+--- a/arch/mn10300/include/asm/signal.h |
1963 |
++++ b/arch/mn10300/include/asm/signal.h |
1964 |
+@@ -131,6 +131,7 @@ struct sigaction { |
1965 |
+ __sigrestore_t sa_restorer; |
1966 |
+ sigset_t sa_mask; /* mask last for extensibility */ |
1967 |
+ }; |
1968 |
++#define __ARCH_HAS_SA_RESTORER |
1969 |
+ |
1970 |
+ struct k_sigaction { |
1971 |
+ struct sigaction sa; |
1972 |
+diff --git a/arch/powerpc/include/asm/signal.h b/arch/powerpc/include/asm/signal.h |
1973 |
+index 3eb13be..ec63a0a 100644 |
1974 |
+--- a/arch/powerpc/include/asm/signal.h |
1975 |
++++ b/arch/powerpc/include/asm/signal.h |
1976 |
+@@ -109,6 +109,7 @@ struct sigaction { |
1977 |
+ __sigrestore_t sa_restorer; |
1978 |
+ sigset_t sa_mask; /* mask last for extensibility */ |
1979 |
+ }; |
1980 |
++#define __ARCH_HAS_SA_RESTORER |
1981 |
+ |
1982 |
+ struct k_sigaction { |
1983 |
+ struct sigaction sa; |
1984 |
+diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c |
1985 |
+index edae5bb..b92b756 100644 |
1986 |
+--- a/arch/powerpc/kernel/cputable.c |
1987 |
++++ b/arch/powerpc/kernel/cputable.c |
1988 |
+@@ -268,7 +268,7 @@ static struct cpu_spec __initdata cpu_specs[] = { |
1989 |
+ .cpu_features = CPU_FTRS_PPC970, |
1990 |
+ .cpu_user_features = COMMON_USER_POWER4 | |
1991 |
+ PPC_FEATURE_HAS_ALTIVEC_COMP, |
1992 |
+- .mmu_features = MMU_FTR_HPTE_TABLE, |
1993 |
++ .mmu_features = MMU_FTRS_PPC970, |
1994 |
+ .icache_bsize = 128, |
1995 |
+ .dcache_bsize = 128, |
1996 |
+ .num_pmcs = 8, |
1997 |
+diff --git a/arch/s390/include/asm/signal.h b/arch/s390/include/asm/signal.h |
1998 |
+index cdf5cb2..c872626 100644 |
1999 |
+--- a/arch/s390/include/asm/signal.h |
2000 |
++++ b/arch/s390/include/asm/signal.h |
2001 |
+@@ -131,6 +131,7 @@ struct sigaction { |
2002 |
+ void (*sa_restorer)(void); |
2003 |
+ sigset_t sa_mask; /* mask last for extensibility */ |
2004 |
+ }; |
2005 |
++#define __ARCH_HAS_SA_RESTORER |
2006 |
+ |
2007 |
+ struct k_sigaction { |
2008 |
+ struct sigaction sa; |
2009 |
+diff --git a/arch/s390/include/asm/tlbflush.h b/arch/s390/include/asm/tlbflush.h |
2010 |
+index 1d8648c..8743029 100644 |
2011 |
+--- a/arch/s390/include/asm/tlbflush.h |
2012 |
++++ b/arch/s390/include/asm/tlbflush.h |
2013 |
+@@ -74,8 +74,6 @@ static inline void __tlb_flush_idte(unsigned long asce) |
2014 |
+ |
2015 |
+ static inline void __tlb_flush_mm(struct mm_struct * mm) |
2016 |
+ { |
2017 |
+- if (unlikely(cpumask_empty(mm_cpumask(mm)))) |
2018 |
+- return; |
2019 |
+ /* |
2020 |
+ * If the machine has IDTE we prefer to do a per mm flush |
2021 |
+ * on all cpus instead of doing a local flush if the mm |
2022 |
+diff --git a/arch/sparc/include/asm/signal.h b/arch/sparc/include/asm/signal.h |
2023 |
+index e49b828..4929431 100644 |
2024 |
+--- a/arch/sparc/include/asm/signal.h |
2025 |
++++ b/arch/sparc/include/asm/signal.h |
2026 |
+@@ -191,6 +191,7 @@ struct __old_sigaction { |
2027 |
+ unsigned long sa_flags; |
2028 |
+ void (*sa_restorer)(void); /* not used by Linux/SPARC yet */ |
2029 |
+ }; |
2030 |
++#define __ARCH_HAS_SA_RESTORER |
2031 |
+ |
2032 |
+ typedef struct sigaltstack { |
2033 |
+ void __user *ss_sp; |
2034 |
+diff --git a/arch/x86/include/asm/signal.h b/arch/x86/include/asm/signal.h |
2035 |
+index 598457c..6cbc795 100644 |
2036 |
+--- a/arch/x86/include/asm/signal.h |
2037 |
++++ b/arch/x86/include/asm/signal.h |
2038 |
+@@ -125,6 +125,8 @@ typedef unsigned long sigset_t; |
2039 |
+ extern void do_notify_resume(struct pt_regs *, void *, __u32); |
2040 |
+ # endif /* __KERNEL__ */ |
2041 |
+ |
2042 |
++#define __ARCH_HAS_SA_RESTORER |
2043 |
++ |
2044 |
+ #ifdef __i386__ |
2045 |
+ # ifdef __KERNEL__ |
2046 |
+ struct old_sigaction { |
2047 |
+diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c |
2048 |
+index 73da6b6..2d4e76b 100644 |
2049 |
+--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c |
2050 |
++++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c |
2051 |
+@@ -736,3 +736,13 @@ void intel_ds_init(void) |
2052 |
+ } |
2053 |
+ } |
2054 |
+ } |
2055 |
++ |
2056 |
++void perf_restore_debug_store(void) |
2057 |
++{ |
2058 |
++ struct debug_store *ds = __this_cpu_read(cpu_hw_events.ds); |
2059 |
++ |
2060 |
++ if (!x86_pmu.bts && !x86_pmu.pebs) |
2061 |
++ return; |
2062 |
++ |
2063 |
++ wrmsrl(MSR_IA32_DS_AREA, (unsigned long)ds); |
2064 |
++} |
2065 |
+diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c |
2066 |
+index b7c2849..554b7b5 100644 |
2067 |
+--- a/arch/x86/lib/usercopy_64.c |
2068 |
++++ b/arch/x86/lib/usercopy_64.c |
2069 |
+@@ -169,10 +169,10 @@ copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest) |
2070 |
+ char c; |
2071 |
+ unsigned zero_len; |
2072 |
+ |
2073 |
+- for (; len; --len) { |
2074 |
++ for (; len; --len, to++) { |
2075 |
+ if (__get_user_nocheck(c, from++, sizeof(char))) |
2076 |
+ break; |
2077 |
+- if (__put_user_nocheck(c, to++, sizeof(char))) |
2078 |
++ if (__put_user_nocheck(c, to, sizeof(char))) |
2079 |
+ break; |
2080 |
+ } |
2081 |
+ |
2082 |
+diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c |
2083 |
+index f10c0af..43c9f6a 100644 |
2084 |
+--- a/arch/x86/power/cpu.c |
2085 |
++++ b/arch/x86/power/cpu.c |
2086 |
+@@ -11,6 +11,7 @@ |
2087 |
+ #include <linux/suspend.h> |
2088 |
+ #include <linux/export.h> |
2089 |
+ #include <linux/smp.h> |
2090 |
++#include <linux/perf_event.h> |
2091 |
+ |
2092 |
+ #include <asm/pgtable.h> |
2093 |
+ #include <asm/proto.h> |
2094 |
+@@ -225,6 +226,7 @@ static void __restore_processor_state(struct saved_context *ctxt) |
2095 |
+ |
2096 |
+ do_fpu_end(); |
2097 |
+ mtrr_bp_restore(); |
2098 |
++ perf_restore_debug_store(); |
2099 |
+ } |
2100 |
+ |
2101 |
+ /* Needed by apm.c */ |
2102 |
+diff --git a/arch/xtensa/include/asm/signal.h b/arch/xtensa/include/asm/signal.h |
2103 |
+index 633ba73..75edf8a 100644 |
2104 |
+--- a/arch/xtensa/include/asm/signal.h |
2105 |
++++ b/arch/xtensa/include/asm/signal.h |
2106 |
+@@ -133,6 +133,7 @@ struct sigaction { |
2107 |
+ void (*sa_restorer)(void); |
2108 |
+ sigset_t sa_mask; /* mask last for extensibility */ |
2109 |
+ }; |
2110 |
++#define __ARCH_HAS_SA_RESTORER |
2111 |
+ |
2112 |
+ struct k_sigaction { |
2113 |
+ struct sigaction sa; |
2114 |
+diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig |
2115 |
+index efba163..bf4d6e2 100644 |
2116 |
+--- a/drivers/firmware/Kconfig |
2117 |
++++ b/drivers/firmware/Kconfig |
2118 |
+@@ -53,6 +53,24 @@ config EFI_VARS |
2119 |
+ Subsequent efibootmgr releases may be found at: |
2120 |
+ <http://linux.dell.com/efibootmgr> |
2121 |
+ |
2122 |
++config EFI_VARS_PSTORE |
2123 |
++ bool "Register efivars backend for pstore" |
2124 |
++ depends on EFI_VARS && PSTORE |
2125 |
++ default y |
2126 |
++ help |
2127 |
++ Say Y here to enable use efivars as a backend to pstore. This |
2128 |
++ will allow writing console messages, crash dumps, or anything |
2129 |
++ else supported by pstore to EFI variables. |
2130 |
++ |
2131 |
++config EFI_VARS_PSTORE_DEFAULT_DISABLE |
2132 |
++ bool "Disable using efivars as a pstore backend by default" |
2133 |
++ depends on EFI_VARS_PSTORE |
2134 |
++ default n |
2135 |
++ help |
2136 |
++ Saying Y here will disable the use of efivars as a storage |
2137 |
++ backend for pstore by default. This setting can be overridden |
2138 |
++ using the efivars module's pstore_disable parameter. |
2139 |
++ |
2140 |
+ config EFI_PCDP |
2141 |
+ bool "Console device selection via EFI PCDP or HCDP table" |
2142 |
+ depends on ACPI && EFI && IA64 |
2143 |
+diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c |
2144 |
+index 81346ae..b15c0aa 100644 |
2145 |
+--- a/drivers/firmware/efivars.c |
2146 |
++++ b/drivers/firmware/efivars.c |
2147 |
+@@ -92,6 +92,11 @@ MODULE_VERSION(EFIVARS_VERSION); |
2148 |
+ |
2149 |
+ #define DUMP_NAME_LEN 52 |
2150 |
+ |
2151 |
++static bool efivars_pstore_disable = |
2152 |
++ IS_ENABLED(CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE); |
2153 |
++ |
2154 |
++module_param_named(pstore_disable, efivars_pstore_disable, bool, 0644); |
2155 |
++ |
2156 |
+ /* |
2157 |
+ * The maximum size of VariableName + Data = 1024 |
2158 |
+ * Therefore, it's reasonable to save that much |
2159 |
+@@ -122,6 +127,8 @@ struct efivar_attribute { |
2160 |
+ ssize_t (*store)(struct efivar_entry *entry, const char *buf, size_t count); |
2161 |
+ }; |
2162 |
+ |
2163 |
++static struct efivars __efivars; |
2164 |
++ |
2165 |
+ #define PSTORE_EFI_ATTRIBUTES \ |
2166 |
+ (EFI_VARIABLE_NON_VOLATILE | \ |
2167 |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | \ |
2168 |
+@@ -146,6 +153,14 @@ efivar_create_sysfs_entry(struct efivars *efivars, |
2169 |
+ efi_char16_t *variable_name, |
2170 |
+ efi_guid_t *vendor_guid); |
2171 |
+ |
2172 |
++/* |
2173 |
++ * Prototype for workqueue functions updating sysfs entry |
2174 |
++ */ |
2175 |
++ |
2176 |
++static void efivar_update_sysfs_entries(struct work_struct *); |
2177 |
++static DECLARE_WORK(efivar_work, efivar_update_sysfs_entries); |
2178 |
++static bool efivar_wq_enabled = true; |
2179 |
++ |
2180 |
+ /* Return the number of unicode characters in data */ |
2181 |
+ static unsigned long |
2182 |
+ utf16_strnlen(efi_char16_t *s, size_t maxlength) |
2183 |
+@@ -659,8 +674,6 @@ static struct kobj_type efivar_ktype = { |
2184 |
+ .default_attrs = def_attrs, |
2185 |
+ }; |
2186 |
+ |
2187 |
+-static struct pstore_info efi_pstore_info; |
2188 |
+- |
2189 |
+ static inline void |
2190 |
+ efivar_unregister(struct efivar_entry *var) |
2191 |
+ { |
2192 |
+@@ -697,7 +710,7 @@ static int efi_status_to_err(efi_status_t status) |
2193 |
+ return err; |
2194 |
+ } |
2195 |
+ |
2196 |
+-#ifdef CONFIG_PSTORE |
2197 |
++#ifdef CONFIG_EFI_VARS_PSTORE |
2198 |
+ |
2199 |
+ static int efi_pstore_open(struct pstore_info *psi) |
2200 |
+ { |
2201 |
+@@ -774,19 +787,21 @@ static int efi_pstore_write(enum pstore_type_id type, u64 *id, |
2202 |
+ |
2203 |
+ spin_lock_irqsave(&efivars->lock, flags); |
2204 |
+ |
2205 |
+- /* |
2206 |
+- * Check if there is a space enough to log. |
2207 |
+- * size: a size of logging data |
2208 |
+- * DUMP_NAME_LEN * 2: a maximum size of variable name |
2209 |
+- */ |
2210 |
++ if (size) { |
2211 |
++ /* |
2212 |
++ * Check if there is a space enough to log. |
2213 |
++ * size: a size of logging data |
2214 |
++ * DUMP_NAME_LEN * 2: a maximum size of variable name |
2215 |
++ */ |
2216 |
+ |
2217 |
+- status = check_var_size_locked(efivars, PSTORE_EFI_ATTRIBUTES, |
2218 |
+- size + DUMP_NAME_LEN * 2); |
2219 |
++ status = check_var_size_locked(efivars, PSTORE_EFI_ATTRIBUTES, |
2220 |
++ size + DUMP_NAME_LEN * 2); |
2221 |
+ |
2222 |
+- if (status) { |
2223 |
+- spin_unlock_irqrestore(&efivars->lock, flags); |
2224 |
+- *id = part; |
2225 |
+- return -ENOSPC; |
2226 |
++ if (status) { |
2227 |
++ spin_unlock_irqrestore(&efivars->lock, flags); |
2228 |
++ *id = part; |
2229 |
++ return -ENOSPC; |
2230 |
++ } |
2231 |
+ } |
2232 |
+ |
2233 |
+ for (i = 0; i < DUMP_NAME_LEN; i++) |
2234 |
+@@ -830,11 +845,8 @@ static int efi_pstore_write(enum pstore_type_id type, u64 *id, |
2235 |
+ if (found) |
2236 |
+ efivar_unregister(found); |
2237 |
+ |
2238 |
+- if (size) |
2239 |
+- ret = efivar_create_sysfs_entry(efivars, |
2240 |
+- utf16_strsize(efi_name, |
2241 |
+- DUMP_NAME_LEN * 2), |
2242 |
+- efi_name, &vendor); |
2243 |
++ if (efivar_wq_enabled) |
2244 |
++ schedule_work(&efivar_work); |
2245 |
+ |
2246 |
+ *id = part; |
2247 |
+ return ret; |
2248 |
+@@ -847,36 +859,6 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, |
2249 |
+ |
2250 |
+ return 0; |
2251 |
+ } |
2252 |
+-#else |
2253 |
+-static int efi_pstore_open(struct pstore_info *psi) |
2254 |
+-{ |
2255 |
+- return 0; |
2256 |
+-} |
2257 |
+- |
2258 |
+-static int efi_pstore_close(struct pstore_info *psi) |
2259 |
+-{ |
2260 |
+- return 0; |
2261 |
+-} |
2262 |
+- |
2263 |
+-static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, |
2264 |
+- struct timespec *timespec, |
2265 |
+- char **buf, struct pstore_info *psi) |
2266 |
+-{ |
2267 |
+- return -1; |
2268 |
+-} |
2269 |
+- |
2270 |
+-static int efi_pstore_write(enum pstore_type_id type, u64 *id, |
2271 |
+- unsigned int part, size_t size, struct pstore_info *psi) |
2272 |
+-{ |
2273 |
+- return 0; |
2274 |
+-} |
2275 |
+- |
2276 |
+-static int efi_pstore_erase(enum pstore_type_id type, u64 id, |
2277 |
+- struct pstore_info *psi) |
2278 |
+-{ |
2279 |
+- return 0; |
2280 |
+-} |
2281 |
+-#endif |
2282 |
+ |
2283 |
+ static struct pstore_info efi_pstore_info = { |
2284 |
+ .owner = THIS_MODULE, |
2285 |
+@@ -888,6 +870,24 @@ static struct pstore_info efi_pstore_info = { |
2286 |
+ .erase = efi_pstore_erase, |
2287 |
+ }; |
2288 |
+ |
2289 |
++static void efivar_pstore_register(struct efivars *efivars) |
2290 |
++{ |
2291 |
++ efivars->efi_pstore_info = efi_pstore_info; |
2292 |
++ efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL); |
2293 |
++ if (efivars->efi_pstore_info.buf) { |
2294 |
++ efivars->efi_pstore_info.bufsize = 1024; |
2295 |
++ efivars->efi_pstore_info.data = efivars; |
2296 |
++ spin_lock_init(&efivars->efi_pstore_info.buf_lock); |
2297 |
++ pstore_register(&efivars->efi_pstore_info); |
2298 |
++ } |
2299 |
++} |
2300 |
++#else |
2301 |
++static void efivar_pstore_register(struct efivars *efivars) |
2302 |
++{ |
2303 |
++ return; |
2304 |
++} |
2305 |
++#endif |
2306 |
++ |
2307 |
+ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, |
2308 |
+ struct bin_attribute *bin_attr, |
2309 |
+ char *buf, loff_t pos, size_t count) |
2310 |
+@@ -1025,6 +1025,103 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj, |
2311 |
+ return count; |
2312 |
+ } |
2313 |
+ |
2314 |
++static bool variable_is_present(efi_char16_t *variable_name, efi_guid_t *vendor) |
2315 |
++{ |
2316 |
++ struct efivar_entry *entry, *n; |
2317 |
++ struct efivars *efivars = &__efivars; |
2318 |
++ unsigned long strsize1, strsize2; |
2319 |
++ bool found = false; |
2320 |
++ |
2321 |
++ strsize1 = utf16_strsize(variable_name, 1024); |
2322 |
++ list_for_each_entry_safe(entry, n, &efivars->list, list) { |
2323 |
++ strsize2 = utf16_strsize(entry->var.VariableName, 1024); |
2324 |
++ if (strsize1 == strsize2 && |
2325 |
++ !memcmp(variable_name, &(entry->var.VariableName), |
2326 |
++ strsize2) && |
2327 |
++ !efi_guidcmp(entry->var.VendorGuid, |
2328 |
++ *vendor)) { |
2329 |
++ found = true; |
2330 |
++ break; |
2331 |
++ } |
2332 |
++ } |
2333 |
++ return found; |
2334 |
++} |
2335 |
++ |
2336 |
++/* |
2337 |
++ * Returns the size of variable_name, in bytes, including the |
2338 |
++ * terminating NULL character, or variable_name_size if no NULL |
2339 |
++ * character is found among the first variable_name_size bytes. |
2340 |
++ */ |
2341 |
++static unsigned long var_name_strnsize(efi_char16_t *variable_name, |
2342 |
++ unsigned long variable_name_size) |
2343 |
++{ |
2344 |
++ unsigned long len; |
2345 |
++ efi_char16_t c; |
2346 |
++ |
2347 |
++ /* |
2348 |
++ * The variable name is, by definition, a NULL-terminated |
2349 |
++ * string, so make absolutely sure that variable_name_size is |
2350 |
++ * the value we expect it to be. If not, return the real size. |
2351 |
++ */ |
2352 |
++ for (len = 2; len <= variable_name_size; len += sizeof(c)) { |
2353 |
++ c = variable_name[(len / sizeof(c)) - 1]; |
2354 |
++ if (!c) |
2355 |
++ break; |
2356 |
++ } |
2357 |
++ |
2358 |
++ return min(len, variable_name_size); |
2359 |
++} |
2360 |
++ |
2361 |
++static void efivar_update_sysfs_entries(struct work_struct *work) |
2362 |
++{ |
2363 |
++ struct efivars *efivars = &__efivars; |
2364 |
++ efi_guid_t vendor; |
2365 |
++ efi_char16_t *variable_name; |
2366 |
++ unsigned long variable_name_size = 1024; |
2367 |
++ efi_status_t status = EFI_NOT_FOUND; |
2368 |
++ bool found; |
2369 |
++ |
2370 |
++ /* Add new sysfs entries */ |
2371 |
++ while (1) { |
2372 |
++ variable_name = kzalloc(variable_name_size, GFP_KERNEL); |
2373 |
++ if (!variable_name) { |
2374 |
++ pr_err("efivars: Memory allocation failed.\n"); |
2375 |
++ return; |
2376 |
++ } |
2377 |
++ |
2378 |
++ spin_lock_irq(&efivars->lock); |
2379 |
++ found = false; |
2380 |
++ while (1) { |
2381 |
++ variable_name_size = 1024; |
2382 |
++ status = efivars->ops->get_next_variable( |
2383 |
++ &variable_name_size, |
2384 |
++ variable_name, |
2385 |
++ &vendor); |
2386 |
++ if (status != EFI_SUCCESS) { |
2387 |
++ break; |
2388 |
++ } else { |
2389 |
++ if (!variable_is_present(variable_name, |
2390 |
++ &vendor)) { |
2391 |
++ found = true; |
2392 |
++ break; |
2393 |
++ } |
2394 |
++ } |
2395 |
++ } |
2396 |
++ spin_unlock_irq(&efivars->lock); |
2397 |
++ |
2398 |
++ if (!found) { |
2399 |
++ kfree(variable_name); |
2400 |
++ break; |
2401 |
++ } else { |
2402 |
++ variable_name_size = var_name_strnsize(variable_name, |
2403 |
++ variable_name_size); |
2404 |
++ efivar_create_sysfs_entry(efivars, |
2405 |
++ variable_name_size, |
2406 |
++ variable_name, &vendor); |
2407 |
++ } |
2408 |
++ } |
2409 |
++} |
2410 |
++ |
2411 |
+ /* |
2412 |
+ * Let's not leave out systab information that snuck into |
2413 |
+ * the efivars driver |
2414 |
+@@ -1212,6 +1309,35 @@ void unregister_efivars(struct efivars *efivars) |
2415 |
+ } |
2416 |
+ EXPORT_SYMBOL_GPL(unregister_efivars); |
2417 |
+ |
2418 |
++/* |
2419 |
++ * Print a warning when duplicate EFI variables are encountered and |
2420 |
++ * disable the sysfs workqueue since the firmware is buggy. |
2421 |
++ */ |
2422 |
++static void dup_variable_bug(efi_char16_t *s16, efi_guid_t *vendor_guid, |
2423 |
++ unsigned long len16) |
2424 |
++{ |
2425 |
++ size_t i, len8 = len16 / sizeof(efi_char16_t); |
2426 |
++ char *s8; |
2427 |
++ |
2428 |
++ /* |
2429 |
++ * Disable the workqueue since the algorithm it uses for |
2430 |
++ * detecting new variables won't work with this buggy |
2431 |
++ * implementation of GetNextVariableName(). |
2432 |
++ */ |
2433 |
++ efivar_wq_enabled = false; |
2434 |
++ |
2435 |
++ s8 = kzalloc(len8, GFP_KERNEL); |
2436 |
++ if (!s8) |
2437 |
++ return; |
2438 |
++ |
2439 |
++ for (i = 0; i < len8; i++) |
2440 |
++ s8[i] = s16[i]; |
2441 |
++ |
2442 |
++ printk(KERN_WARNING "efivars: duplicate variable: %s-%pUl\n", |
2443 |
++ s8, vendor_guid); |
2444 |
++ kfree(s8); |
2445 |
++} |
2446 |
++ |
2447 |
+ int register_efivars(struct efivars *efivars, |
2448 |
+ const struct efivar_operations *ops, |
2449 |
+ struct kobject *parent_kobj) |
2450 |
+@@ -1252,6 +1378,24 @@ int register_efivars(struct efivars *efivars, |
2451 |
+ &vendor_guid); |
2452 |
+ switch (status) { |
2453 |
+ case EFI_SUCCESS: |
2454 |
++ variable_name_size = var_name_strnsize(variable_name, |
2455 |
++ variable_name_size); |
2456 |
++ |
2457 |
++ /* |
2458 |
++ * Some firmware implementations return the |
2459 |
++ * same variable name on multiple calls to |
2460 |
++ * get_next_variable(). Terminate the loop |
2461 |
++ * immediately as there is no guarantee that |
2462 |
++ * we'll ever see a different variable name, |
2463 |
++ * and may end up looping here forever. |
2464 |
++ */ |
2465 |
++ if (variable_is_present(variable_name, &vendor_guid)) { |
2466 |
++ dup_variable_bug(variable_name, &vendor_guid, |
2467 |
++ variable_name_size); |
2468 |
++ status = EFI_NOT_FOUND; |
2469 |
++ break; |
2470 |
++ } |
2471 |
++ |
2472 |
+ efivar_create_sysfs_entry(efivars, |
2473 |
+ variable_name_size, |
2474 |
+ variable_name, |
2475 |
+@@ -1271,15 +1415,8 @@ int register_efivars(struct efivars *efivars, |
2476 |
+ if (error) |
2477 |
+ unregister_efivars(efivars); |
2478 |
+ |
2479 |
+- efivars->efi_pstore_info = efi_pstore_info; |
2480 |
+- |
2481 |
+- efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL); |
2482 |
+- if (efivars->efi_pstore_info.buf) { |
2483 |
+- efivars->efi_pstore_info.bufsize = 1024; |
2484 |
+- efivars->efi_pstore_info.data = efivars; |
2485 |
+- spin_lock_init(&efivars->efi_pstore_info.buf_lock); |
2486 |
+- pstore_register(&efivars->efi_pstore_info); |
2487 |
+- } |
2488 |
++ if (!efivars_pstore_disable) |
2489 |
++ efivar_pstore_register(efivars); |
2490 |
+ |
2491 |
+ out: |
2492 |
+ kfree(variable_name); |
2493 |
+@@ -1288,7 +1425,6 @@ out: |
2494 |
+ } |
2495 |
+ EXPORT_SYMBOL_GPL(register_efivars); |
2496 |
+ |
2497 |
+-static struct efivars __efivars; |
2498 |
+ static struct efivar_operations ops; |
2499 |
+ |
2500 |
+ /* |
2501 |
+@@ -1346,6 +1482,8 @@ err_put: |
2502 |
+ static void __exit |
2503 |
+ efivars_exit(void) |
2504 |
+ { |
2505 |
++ cancel_work_sync(&efivar_work); |
2506 |
++ |
2507 |
+ if (efi_enabled(EFI_RUNTIME_SERVICES)) { |
2508 |
+ unregister_efivars(&__efivars); |
2509 |
+ kobject_put(efi_kobj); |
2510 |
+diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
2511 |
+index 9080eb7..7211f67 100644 |
2512 |
+--- a/drivers/gpu/drm/drm_edid.c |
2513 |
++++ b/drivers/gpu/drm/drm_edid.c |
2514 |
+@@ -852,7 +852,7 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, |
2515 |
+ unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | pt->vblank_lo; |
2516 |
+ unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) << 2 | pt->hsync_offset_lo; |
2517 |
+ unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) << 4 | pt->hsync_pulse_width_lo; |
2518 |
+- unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) >> 2 | pt->vsync_offset_pulse_width_lo >> 4; |
2519 |
++ unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) << 2 | pt->vsync_offset_pulse_width_lo >> 4; |
2520 |
+ unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 4 | (pt->vsync_offset_pulse_width_lo & 0xf); |
2521 |
+ |
2522 |
+ /* ignore tiny modes */ |
2523 |
+@@ -933,6 +933,7 @@ set_size: |
2524 |
+ } |
2525 |
+ |
2526 |
+ mode->type = DRM_MODE_TYPE_DRIVER; |
2527 |
++ mode->vrefresh = drm_mode_vrefresh(mode); |
2528 |
+ drm_mode_set_name(mode); |
2529 |
+ |
2530 |
+ return mode; |
2531 |
+diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c |
2532 |
+index 5620192..9b4e5c6 100644 |
2533 |
+--- a/drivers/gpu/drm/i915/i915_debugfs.c |
2534 |
++++ b/drivers/gpu/drm/i915/i915_debugfs.c |
2535 |
+@@ -122,7 +122,7 @@ static const char *cache_level_str(int type) |
2536 |
+ static void |
2537 |
+ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) |
2538 |
+ { |
2539 |
+- seq_printf(m, "%p: %s%s %8zd %04x %04x %d %d%s%s%s", |
2540 |
++ seq_printf(m, "%pK: %s%s %8zd %04x %04x %d %d%s%s%s", |
2541 |
+ &obj->base, |
2542 |
+ get_pin_flag(obj), |
2543 |
+ get_tiling_flag(obj), |
2544 |
+diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
2545 |
+index 878b989..b1bb734 100644 |
2546 |
+--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
2547 |
++++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
2548 |
+@@ -907,15 +907,20 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, |
2549 |
+ int count) |
2550 |
+ { |
2551 |
+ int i; |
2552 |
++ int relocs_total = 0; |
2553 |
++ int relocs_max = INT_MAX / sizeof(struct drm_i915_gem_relocation_entry); |
2554 |
+ |
2555 |
+ for (i = 0; i < count; i++) { |
2556 |
+ char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr; |
2557 |
+ int length; /* limited by fault_in_pages_readable() */ |
2558 |
+ |
2559 |
+- /* First check for malicious input causing overflow */ |
2560 |
+- if (exec[i].relocation_count > |
2561 |
+- INT_MAX / sizeof(struct drm_i915_gem_relocation_entry)) |
2562 |
++ /* First check for malicious input causing overflow in |
2563 |
++ * the worst case where we need to allocate the entire |
2564 |
++ * relocation tree as a single array. |
2565 |
++ */ |
2566 |
++ if (exec[i].relocation_count > relocs_max - relocs_total) |
2567 |
+ return -EINVAL; |
2568 |
++ relocs_total += exec[i].relocation_count; |
2569 |
+ |
2570 |
+ length = exec[i].relocation_count * |
2571 |
+ sizeof(struct drm_i915_gem_relocation_entry); |
2572 |
+diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
2573 |
+index 4591582..17961df 100644 |
2574 |
+--- a/drivers/gpu/drm/i915/intel_display.c |
2575 |
++++ b/drivers/gpu/drm/i915/intel_display.c |
2576 |
+@@ -8059,7 +8059,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv) |
2577 |
+ I915_WRITE(GEN6_RC_SLEEP, 0); |
2578 |
+ I915_WRITE(GEN6_RC1e_THRESHOLD, 1000); |
2579 |
+ I915_WRITE(GEN6_RC6_THRESHOLD, 50000); |
2580 |
+- I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); |
2581 |
++ I915_WRITE(GEN6_RC6p_THRESHOLD, 150000); |
2582 |
+ I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ |
2583 |
+ |
2584 |
+ if (intel_enable_rc6(dev_priv->dev)) |
2585 |
+diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c |
2586 |
+index 289140b..cffb007 100644 |
2587 |
+--- a/drivers/gpu/drm/i915/intel_opregion.c |
2588 |
++++ b/drivers/gpu/drm/i915/intel_opregion.c |
2589 |
+@@ -419,6 +419,25 @@ blind_set: |
2590 |
+ goto end; |
2591 |
+ } |
2592 |
+ |
2593 |
++static void intel_setup_cadls(struct drm_device *dev) |
2594 |
++{ |
2595 |
++ struct drm_i915_private *dev_priv = dev->dev_private; |
2596 |
++ struct intel_opregion *opregion = &dev_priv->opregion; |
2597 |
++ int i = 0; |
2598 |
++ u32 disp_id; |
2599 |
++ |
2600 |
++ /* Initialize the CADL field by duplicating the DIDL values. |
2601 |
++ * Technically, this is not always correct as display outputs may exist, |
2602 |
++ * but not active. This initialization is necessary for some Clevo |
2603 |
++ * laptops that check this field before processing the brightness and |
2604 |
++ * display switching hotkeys. Just like DIDL, CADL is NULL-terminated if |
2605 |
++ * there are less than eight devices. */ |
2606 |
++ do { |
2607 |
++ disp_id = ioread32(&opregion->acpi->didl[i]); |
2608 |
++ iowrite32(disp_id, &opregion->acpi->cadl[i]); |
2609 |
++ } while (++i < 8 && disp_id != 0); |
2610 |
++} |
2611 |
++ |
2612 |
+ void intel_opregion_init(struct drm_device *dev) |
2613 |
+ { |
2614 |
+ struct drm_i915_private *dev_priv = dev->dev_private; |
2615 |
+@@ -428,8 +447,10 @@ void intel_opregion_init(struct drm_device *dev) |
2616 |
+ return; |
2617 |
+ |
2618 |
+ if (opregion->acpi) { |
2619 |
+- if (drm_core_check_feature(dev, DRIVER_MODESET)) |
2620 |
++ if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
2621 |
+ intel_didl_outputs(dev); |
2622 |
++ intel_setup_cadls(dev); |
2623 |
++ } |
2624 |
+ |
2625 |
+ /* Notify BIOS we are ready to handle ACPI video ext notifs. |
2626 |
+ * Right now, all the events are handled by the ACPI video module. |
2627 |
+diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c |
2628 |
+index 17e1a9b..441de38 100644 |
2629 |
+--- a/drivers/gpu/drm/radeon/radeon_benchmark.c |
2630 |
++++ b/drivers/gpu/drm/radeon/radeon_benchmark.c |
2631 |
+@@ -139,13 +139,15 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size, |
2632 |
+ sdomain, ddomain, "dma"); |
2633 |
+ } |
2634 |
+ |
2635 |
+- time = radeon_benchmark_do_move(rdev, size, saddr, daddr, |
2636 |
+- RADEON_BENCHMARK_COPY_BLIT, n); |
2637 |
+- if (time < 0) |
2638 |
+- goto out_cleanup; |
2639 |
+- if (time > 0) |
2640 |
+- radeon_benchmark_log_results(n, size, time, |
2641 |
+- sdomain, ddomain, "blit"); |
2642 |
++ if (rdev->asic->copy_blit) { |
2643 |
++ time = radeon_benchmark_do_move(rdev, size, saddr, daddr, |
2644 |
++ RADEON_BENCHMARK_COPY_BLIT, n); |
2645 |
++ if (time < 0) |
2646 |
++ goto out_cleanup; |
2647 |
++ if (time > 0) |
2648 |
++ radeon_benchmark_log_results(n, size, time, |
2649 |
++ sdomain, ddomain, "blit"); |
2650 |
++ } |
2651 |
+ |
2652 |
+ out_cleanup: |
2653 |
+ if (sobj) { |
2654 |
+diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c |
2655 |
+index 3d7885a..3056ea4 100644 |
2656 |
+--- a/drivers/i2c/busses/i2c-tegra.c |
2657 |
++++ b/drivers/i2c/busses/i2c-tegra.c |
2658 |
+@@ -341,7 +341,11 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) |
2659 |
+ u32 val; |
2660 |
+ int err = 0; |
2661 |
+ |
2662 |
+- clk_enable(i2c_dev->clk); |
2663 |
++ err = clk_enable(i2c_dev->clk); |
2664 |
++ if (err < 0) { |
2665 |
++ dev_err(i2c_dev->dev, "Clock enable failed %d\n", err); |
2666 |
++ return err; |
2667 |
++ } |
2668 |
+ |
2669 |
+ tegra_periph_reset_assert(i2c_dev->clk); |
2670 |
+ udelay(2); |
2671 |
+@@ -536,7 +540,12 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], |
2672 |
+ if (i2c_dev->is_suspended) |
2673 |
+ return -EBUSY; |
2674 |
+ |
2675 |
+- clk_enable(i2c_dev->clk); |
2676 |
++ ret = clk_enable(i2c_dev->clk); |
2677 |
++ if (ret < 0) { |
2678 |
++ dev_err(i2c_dev->dev, "Clock enable failed %d\n", ret); |
2679 |
++ return ret; |
2680 |
++ } |
2681 |
++ |
2682 |
+ for (i = 0; i < num; i++) { |
2683 |
+ int stop = (i == (num - 1)) ? 1 : 0; |
2684 |
+ ret = tegra_i2c_xfer_msg(i2c_dev, &msgs[i], stop); |
2685 |
+diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c |
2686 |
+index da4d299..2c9dd2c 100644 |
2687 |
+--- a/drivers/md/dm-thin.c |
2688 |
++++ b/drivers/md/dm-thin.c |
2689 |
+@@ -2212,7 +2212,7 @@ static struct target_type pool_target = { |
2690 |
+ .name = "thin-pool", |
2691 |
+ .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | |
2692 |
+ DM_TARGET_IMMUTABLE, |
2693 |
+- .version = {1, 0, 1}, |
2694 |
++ .version = {1, 0, 2}, |
2695 |
+ .module = THIS_MODULE, |
2696 |
+ .ctr = pool_ctr, |
2697 |
+ .dtr = pool_dtr, |
2698 |
+@@ -2428,7 +2428,7 @@ static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits) |
2699 |
+ |
2700 |
+ static struct target_type thin_target = { |
2701 |
+ .name = "thin", |
2702 |
+- .version = {1, 0, 1}, |
2703 |
++ .version = {1, 0, 2}, |
2704 |
+ .module = THIS_MODULE, |
2705 |
+ .ctr = thin_ctr, |
2706 |
+ .dtr = thin_dtr, |
2707 |
+diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c |
2708 |
+index e6cdfde..1de0f5f 100644 |
2709 |
+--- a/drivers/md/persistent-data/dm-btree-remove.c |
2710 |
++++ b/drivers/md/persistent-data/dm-btree-remove.c |
2711 |
+@@ -139,15 +139,8 @@ struct child { |
2712 |
+ struct btree_node *n; |
2713 |
+ }; |
2714 |
+ |
2715 |
+-static struct dm_btree_value_type le64_type = { |
2716 |
+- .context = NULL, |
2717 |
+- .size = sizeof(__le64), |
2718 |
+- .inc = NULL, |
2719 |
+- .dec = NULL, |
2720 |
+- .equal = NULL |
2721 |
+-}; |
2722 |
+- |
2723 |
+-static int init_child(struct dm_btree_info *info, struct btree_node *parent, |
2724 |
++static int init_child(struct dm_btree_info *info, struct dm_btree_value_type *vt, |
2725 |
++ struct btree_node *parent, |
2726 |
+ unsigned index, struct child *result) |
2727 |
+ { |
2728 |
+ int r, inc; |
2729 |
+@@ -164,7 +157,7 @@ static int init_child(struct dm_btree_info *info, struct btree_node *parent, |
2730 |
+ result->n = dm_block_data(result->block); |
2731 |
+ |
2732 |
+ if (inc) |
2733 |
+- inc_children(info->tm, result->n, &le64_type); |
2734 |
++ inc_children(info->tm, result->n, vt); |
2735 |
+ |
2736 |
+ *((__le64 *) value_ptr(parent, index, sizeof(__le64))) = |
2737 |
+ cpu_to_le64(dm_block_location(result->block)); |
2738 |
+@@ -236,7 +229,7 @@ static void __rebalance2(struct dm_btree_info *info, struct btree_node *parent, |
2739 |
+ } |
2740 |
+ |
2741 |
+ static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, |
2742 |
+- unsigned left_index) |
2743 |
++ struct dm_btree_value_type *vt, unsigned left_index) |
2744 |
+ { |
2745 |
+ int r; |
2746 |
+ struct btree_node *parent; |
2747 |
+@@ -244,11 +237,11 @@ static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, |
2748 |
+ |
2749 |
+ parent = dm_block_data(shadow_current(s)); |
2750 |
+ |
2751 |
+- r = init_child(info, parent, left_index, &left); |
2752 |
++ r = init_child(info, vt, parent, left_index, &left); |
2753 |
+ if (r) |
2754 |
+ return r; |
2755 |
+ |
2756 |
+- r = init_child(info, parent, left_index + 1, &right); |
2757 |
++ r = init_child(info, vt, parent, left_index + 1, &right); |
2758 |
+ if (r) { |
2759 |
+ exit_child(info, &left); |
2760 |
+ return r; |
2761 |
+@@ -368,7 +361,7 @@ static void __rebalance3(struct dm_btree_info *info, struct btree_node *parent, |
2762 |
+ } |
2763 |
+ |
2764 |
+ static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, |
2765 |
+- unsigned left_index) |
2766 |
++ struct dm_btree_value_type *vt, unsigned left_index) |
2767 |
+ { |
2768 |
+ int r; |
2769 |
+ struct btree_node *parent = dm_block_data(shadow_current(s)); |
2770 |
+@@ -377,17 +370,17 @@ static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, |
2771 |
+ /* |
2772 |
+ * FIXME: fill out an array? |
2773 |
+ */ |
2774 |
+- r = init_child(info, parent, left_index, &left); |
2775 |
++ r = init_child(info, vt, parent, left_index, &left); |
2776 |
+ if (r) |
2777 |
+ return r; |
2778 |
+ |
2779 |
+- r = init_child(info, parent, left_index + 1, ¢er); |
2780 |
++ r = init_child(info, vt, parent, left_index + 1, ¢er); |
2781 |
+ if (r) { |
2782 |
+ exit_child(info, &left); |
2783 |
+ return r; |
2784 |
+ } |
2785 |
+ |
2786 |
+- r = init_child(info, parent, left_index + 2, &right); |
2787 |
++ r = init_child(info, vt, parent, left_index + 2, &right); |
2788 |
+ if (r) { |
2789 |
+ exit_child(info, &left); |
2790 |
+ exit_child(info, ¢er); |
2791 |
+@@ -434,7 +427,8 @@ static int get_nr_entries(struct dm_transaction_manager *tm, |
2792 |
+ } |
2793 |
+ |
2794 |
+ static int rebalance_children(struct shadow_spine *s, |
2795 |
+- struct dm_btree_info *info, uint64_t key) |
2796 |
++ struct dm_btree_info *info, |
2797 |
++ struct dm_btree_value_type *vt, uint64_t key) |
2798 |
+ { |
2799 |
+ int i, r, has_left_sibling, has_right_sibling; |
2800 |
+ uint32_t child_entries; |
2801 |
+@@ -472,13 +466,13 @@ static int rebalance_children(struct shadow_spine *s, |
2802 |
+ has_right_sibling = i < (le32_to_cpu(n->header.nr_entries) - 1); |
2803 |
+ |
2804 |
+ if (!has_left_sibling) |
2805 |
+- r = rebalance2(s, info, i); |
2806 |
++ r = rebalance2(s, info, vt, i); |
2807 |
+ |
2808 |
+ else if (!has_right_sibling) |
2809 |
+- r = rebalance2(s, info, i - 1); |
2810 |
++ r = rebalance2(s, info, vt, i - 1); |
2811 |
+ |
2812 |
+ else |
2813 |
+- r = rebalance3(s, info, i - 1); |
2814 |
++ r = rebalance3(s, info, vt, i - 1); |
2815 |
+ |
2816 |
+ return r; |
2817 |
+ } |
2818 |
+@@ -529,7 +523,7 @@ static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info, |
2819 |
+ if (le32_to_cpu(n->header.flags) & LEAF_NODE) |
2820 |
+ return do_leaf(n, key, index); |
2821 |
+ |
2822 |
+- r = rebalance_children(s, info, key); |
2823 |
++ r = rebalance_children(s, info, vt, key); |
2824 |
+ if (r) |
2825 |
+ break; |
2826 |
+ |
2827 |
+@@ -550,6 +544,14 @@ static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info, |
2828 |
+ return r; |
2829 |
+ } |
2830 |
+ |
2831 |
++static struct dm_btree_value_type le64_type = { |
2832 |
++ .context = NULL, |
2833 |
++ .size = sizeof(__le64), |
2834 |
++ .inc = NULL, |
2835 |
++ .dec = NULL, |
2836 |
++ .equal = NULL |
2837 |
++}; |
2838 |
++ |
2839 |
+ int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, |
2840 |
+ uint64_t *keys, dm_block_t *new_root) |
2841 |
+ { |
2842 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
2843 |
+index 202ae34..63e3c47 100644 |
2844 |
+--- a/drivers/net/bonding/bond_main.c |
2845 |
++++ b/drivers/net/bonding/bond_main.c |
2846 |
+@@ -1715,6 +1715,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) |
2847 |
+ |
2848 |
+ bond_compute_features(bond); |
2849 |
+ |
2850 |
++ bond_update_speed_duplex(new_slave); |
2851 |
++ |
2852 |
+ read_lock(&bond->lock); |
2853 |
+ |
2854 |
+ new_slave->last_arp_rx = jiffies; |
2855 |
+@@ -1758,8 +1760,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) |
2856 |
+ new_slave->link = BOND_LINK_DOWN; |
2857 |
+ } |
2858 |
+ |
2859 |
+- bond_update_speed_duplex(new_slave); |
2860 |
+- |
2861 |
+ if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { |
2862 |
+ /* if there is a primary slave, remember it */ |
2863 |
+ if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { |
2864 |
+@@ -2437,8 +2437,6 @@ static void bond_miimon_commit(struct bonding *bond) |
2865 |
+ bond_set_backup_slave(slave); |
2866 |
+ } |
2867 |
+ |
2868 |
+- bond_update_speed_duplex(slave); |
2869 |
+- |
2870 |
+ pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n", |
2871 |
+ bond->dev->name, slave->dev->name, |
2872 |
+ slave->speed, slave->duplex ? "full" : "half"); |
2873 |
+diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c |
2874 |
+index a6611f1..5d5a05f 100644 |
2875 |
+--- a/drivers/net/ethernet/sfc/efx.c |
2876 |
++++ b/drivers/net/ethernet/sfc/efx.c |
2877 |
+@@ -650,25 +650,30 @@ static void efx_fini_channels(struct efx_nic *efx) |
2878 |
+ struct efx_channel *channel; |
2879 |
+ struct efx_tx_queue *tx_queue; |
2880 |
+ struct efx_rx_queue *rx_queue; |
2881 |
++ struct pci_dev *dev = efx->pci_dev; |
2882 |
+ int rc; |
2883 |
+ |
2884 |
+ EFX_ASSERT_RESET_SERIALISED(efx); |
2885 |
+ BUG_ON(efx->port_enabled); |
2886 |
+ |
2887 |
+- rc = efx_nic_flush_queues(efx); |
2888 |
+- if (rc && EFX_WORKAROUND_7803(efx)) { |
2889 |
+- /* Schedule a reset to recover from the flush failure. The |
2890 |
+- * descriptor caches reference memory we're about to free, |
2891 |
+- * but falcon_reconfigure_mac_wrapper() won't reconnect |
2892 |
+- * the MACs because of the pending reset. */ |
2893 |
+- netif_err(efx, drv, efx->net_dev, |
2894 |
+- "Resetting to recover from flush failure\n"); |
2895 |
+- efx_schedule_reset(efx, RESET_TYPE_ALL); |
2896 |
+- } else if (rc) { |
2897 |
+- netif_err(efx, drv, efx->net_dev, "failed to flush queues\n"); |
2898 |
+- } else { |
2899 |
+- netif_dbg(efx, drv, efx->net_dev, |
2900 |
+- "successfully flushed all queues\n"); |
2901 |
++ /* Only perform flush if dma is enabled */ |
2902 |
++ if (dev->is_busmaster) { |
2903 |
++ rc = efx_nic_flush_queues(efx); |
2904 |
++ |
2905 |
++ if (rc && EFX_WORKAROUND_7803(efx)) { |
2906 |
++ /* Schedule a reset to recover from the flush failure. The |
2907 |
++ * descriptor caches reference memory we're about to free, |
2908 |
++ * but falcon_reconfigure_mac_wrapper() won't reconnect |
2909 |
++ * the MACs because of the pending reset. */ |
2910 |
++ netif_err(efx, drv, efx->net_dev, |
2911 |
++ "Resetting to recover from flush failure\n"); |
2912 |
++ efx_schedule_reset(efx, RESET_TYPE_ALL); |
2913 |
++ } else if (rc) { |
2914 |
++ netif_err(efx, drv, efx->net_dev, "failed to flush queues\n"); |
2915 |
++ } else { |
2916 |
++ netif_dbg(efx, drv, efx->net_dev, |
2917 |
++ "successfully flushed all queues\n"); |
2918 |
++ } |
2919 |
+ } |
2920 |
+ |
2921 |
+ efx_for_each_channel(channel, efx) { |
2922 |
+@@ -714,6 +719,7 @@ efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) |
2923 |
+ unsigned i; |
2924 |
+ int rc; |
2925 |
+ |
2926 |
++ efx_device_detach_sync(efx); |
2927 |
+ efx_stop_all(efx); |
2928 |
+ efx_fini_channels(efx); |
2929 |
+ |
2930 |
+@@ -757,6 +763,7 @@ out: |
2931 |
+ |
2932 |
+ efx_init_channels(efx); |
2933 |
+ efx_start_all(efx); |
2934 |
++ netif_device_attach(efx->net_dev); |
2935 |
+ return rc; |
2936 |
+ |
2937 |
+ rollback: |
2938 |
+@@ -1525,8 +1532,12 @@ static void efx_stop_all(struct efx_nic *efx) |
2939 |
+ /* Flush efx_mac_work(), refill_workqueue, monitor_work */ |
2940 |
+ efx_flush_all(efx); |
2941 |
+ |
2942 |
+- /* Stop the kernel transmit interface late, so the watchdog |
2943 |
+- * timer isn't ticking over the flush */ |
2944 |
++ /* Stop the kernel transmit interface. This is only valid if |
2945 |
++ * the device is stopped or detached; otherwise the watchdog |
2946 |
++ * may fire immediately. |
2947 |
++ */ |
2948 |
++ WARN_ON(netif_running(efx->net_dev) && |
2949 |
++ netif_device_present(efx->net_dev)); |
2950 |
+ if (efx_dev_registered(efx)) { |
2951 |
+ netif_tx_stop_all_queues(efx->net_dev); |
2952 |
+ netif_tx_lock_bh(efx->net_dev); |
2953 |
+@@ -1827,10 +1838,11 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu) |
2954 |
+ if (new_mtu > EFX_MAX_MTU) |
2955 |
+ return -EINVAL; |
2956 |
+ |
2957 |
+- efx_stop_all(efx); |
2958 |
+- |
2959 |
+ netif_dbg(efx, drv, efx->net_dev, "changing MTU to %d\n", new_mtu); |
2960 |
+ |
2961 |
++ efx_device_detach_sync(efx); |
2962 |
++ efx_stop_all(efx); |
2963 |
++ |
2964 |
+ efx_fini_channels(efx); |
2965 |
+ |
2966 |
+ mutex_lock(&efx->mac_lock); |
2967 |
+@@ -1843,6 +1855,7 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu) |
2968 |
+ efx_init_channels(efx); |
2969 |
+ |
2970 |
+ efx_start_all(efx); |
2971 |
++ netif_device_attach(efx->net_dev); |
2972 |
+ return rc; |
2973 |
+ } |
2974 |
+ |
2975 |
+@@ -2132,7 +2145,7 @@ int efx_reset(struct efx_nic *efx, enum reset_type method) |
2976 |
+ netif_info(efx, drv, efx->net_dev, "resetting (%s)\n", |
2977 |
+ RESET_TYPE(method)); |
2978 |
+ |
2979 |
+- netif_device_detach(efx->net_dev); |
2980 |
++ efx_device_detach_sync(efx); |
2981 |
+ efx_reset_down(efx, method); |
2982 |
+ |
2983 |
+ rc = efx->type->reset(efx, method); |
2984 |
+@@ -2580,7 +2593,7 @@ static int efx_pm_freeze(struct device *dev) |
2985 |
+ |
2986 |
+ efx->state = STATE_FINI; |
2987 |
+ |
2988 |
+- netif_device_detach(efx->net_dev); |
2989 |
++ efx_device_detach_sync(efx); |
2990 |
+ |
2991 |
+ efx_stop_all(efx); |
2992 |
+ efx_fini_channels(efx); |
2993 |
+diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h |
2994 |
+index 1355245..9668d29 100644 |
2995 |
+--- a/drivers/net/ethernet/sfc/efx.h |
2996 |
++++ b/drivers/net/ethernet/sfc/efx.h |
2997 |
+@@ -149,4 +149,17 @@ extern void efx_link_status_changed(struct efx_nic *efx); |
2998 |
+ extern void efx_link_set_advertising(struct efx_nic *efx, u32); |
2999 |
+ extern void efx_link_set_wanted_fc(struct efx_nic *efx, u8); |
3000 |
+ |
3001 |
++static inline void efx_device_detach_sync(struct efx_nic *efx) |
3002 |
++{ |
3003 |
++ struct net_device *dev = efx->net_dev; |
3004 |
++ |
3005 |
++ /* Lock/freeze all TX queues so that we can be sure the |
3006 |
++ * TX scheduler is stopped when we're done and before |
3007 |
++ * netif_device_present() becomes false. |
3008 |
++ */ |
3009 |
++ netif_tx_lock_bh(dev); |
3010 |
++ netif_device_detach(dev); |
3011 |
++ netif_tx_unlock_bh(dev); |
3012 |
++} |
3013 |
++ |
3014 |
+ #endif /* EFX_EFX_H */ |
3015 |
+diff --git a/drivers/net/ethernet/sfc/falcon.c b/drivers/net/ethernet/sfc/falcon.c |
3016 |
+index 97b606b..26cd6c0 100644 |
3017 |
+--- a/drivers/net/ethernet/sfc/falcon.c |
3018 |
++++ b/drivers/net/ethernet/sfc/falcon.c |
3019 |
+@@ -1762,6 +1762,7 @@ const struct efx_nic_type falcon_a1_nic_type = { |
3020 |
+ .remove_port = falcon_remove_port, |
3021 |
+ .handle_global_event = falcon_handle_global_event, |
3022 |
+ .prepare_flush = falcon_prepare_flush, |
3023 |
++ .finish_flush = efx_port_dummy_op_void, |
3024 |
+ .update_stats = falcon_update_nic_stats, |
3025 |
+ .start_stats = falcon_start_nic_stats, |
3026 |
+ .stop_stats = falcon_stop_nic_stats, |
3027 |
+@@ -1804,6 +1805,7 @@ const struct efx_nic_type falcon_b0_nic_type = { |
3028 |
+ .remove_port = falcon_remove_port, |
3029 |
+ .handle_global_event = falcon_handle_global_event, |
3030 |
+ .prepare_flush = falcon_prepare_flush, |
3031 |
++ .finish_flush = efx_port_dummy_op_void, |
3032 |
+ .update_stats = falcon_update_nic_stats, |
3033 |
+ .start_stats = falcon_start_nic_stats, |
3034 |
+ .stop_stats = falcon_stop_nic_stats, |
3035 |
+diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c |
3036 |
+index 81a4253..c1000ce 100644 |
3037 |
+--- a/drivers/net/ethernet/sfc/mcdi.c |
3038 |
++++ b/drivers/net/ethernet/sfc/mcdi.c |
3039 |
+@@ -30,7 +30,7 @@ |
3040 |
+ #define REBOOT_FLAG_PORT0 0x3f8 |
3041 |
+ #define REBOOT_FLAG_PORT1 0x3fc |
3042 |
+ |
3043 |
+-#define MCDI_RPC_TIMEOUT 10 /*seconds */ |
3044 |
++#define MCDI_RPC_TIMEOUT (10 * HZ) |
3045 |
+ |
3046 |
+ #define MCDI_PDU(efx) \ |
3047 |
+ (efx_port_num(efx) ? CMD_PDU_PORT1 : CMD_PDU_PORT0) |
3048 |
+@@ -120,7 +120,7 @@ static void efx_mcdi_copyout(struct efx_nic *efx, u8 *outbuf, size_t outlen) |
3049 |
+ static int efx_mcdi_poll(struct efx_nic *efx) |
3050 |
+ { |
3051 |
+ struct efx_mcdi_iface *mcdi = efx_mcdi(efx); |
3052 |
+- unsigned int time, finish; |
3053 |
++ unsigned long time, finish; |
3054 |
+ unsigned int respseq, respcmd, error; |
3055 |
+ unsigned int pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); |
3056 |
+ unsigned int rc, spins; |
3057 |
+@@ -136,7 +136,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) |
3058 |
+ * and poll once a jiffy (approximately) |
3059 |
+ */ |
3060 |
+ spins = TICK_USEC; |
3061 |
+- finish = get_seconds() + MCDI_RPC_TIMEOUT; |
3062 |
++ finish = jiffies + MCDI_RPC_TIMEOUT; |
3063 |
+ |
3064 |
+ while (1) { |
3065 |
+ if (spins != 0) { |
3066 |
+@@ -146,7 +146,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) |
3067 |
+ schedule_timeout_uninterruptible(1); |
3068 |
+ } |
3069 |
+ |
3070 |
+- time = get_seconds(); |
3071 |
++ time = jiffies; |
3072 |
+ |
3073 |
+ rmb(); |
3074 |
+ efx_readd(efx, ®, pdu); |
3075 |
+@@ -158,7 +158,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) |
3076 |
+ EFX_DWORD_FIELD(reg, MCDI_HEADER_RESPONSE)) |
3077 |
+ break; |
3078 |
+ |
3079 |
+- if (time >= finish) |
3080 |
++ if (time_after(time, finish)) |
3081 |
+ return -ETIMEDOUT; |
3082 |
+ } |
3083 |
+ |
3084 |
+@@ -250,7 +250,7 @@ static int efx_mcdi_await_completion(struct efx_nic *efx) |
3085 |
+ if (wait_event_timeout( |
3086 |
+ mcdi->wq, |
3087 |
+ atomic_read(&mcdi->state) == MCDI_STATE_COMPLETED, |
3088 |
+- msecs_to_jiffies(MCDI_RPC_TIMEOUT * 1000)) == 0) |
3089 |
++ MCDI_RPC_TIMEOUT) == 0) |
3090 |
+ return -ETIMEDOUT; |
3091 |
+ |
3092 |
+ /* Check if efx_mcdi_set_mode() switched us back to polled completions. |
3093 |
+@@ -666,9 +666,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, |
3094 |
+ u16 *fw_subtype_list) |
3095 |
+ { |
3096 |
+ uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LEN]; |
3097 |
+- size_t outlen; |
3098 |
++ size_t outlen, offset, i; |
3099 |
+ int port_num = efx_port_num(efx); |
3100 |
+- int offset; |
3101 |
+ int rc; |
3102 |
+ |
3103 |
+ BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_IN_LEN != 0); |
3104 |
+@@ -688,10 +687,16 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, |
3105 |
+ : MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST; |
3106 |
+ if (mac_address) |
3107 |
+ memcpy(mac_address, outbuf + offset, ETH_ALEN); |
3108 |
+- if (fw_subtype_list) |
3109 |
+- memcpy(fw_subtype_list, |
3110 |
+- outbuf + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST, |
3111 |
+- MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_LEN); |
3112 |
++ if (fw_subtype_list) { |
3113 |
++ offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST; |
3114 |
++ for (i = 0; |
3115 |
++ i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_LEN / 2; |
3116 |
++ i++) { |
3117 |
++ fw_subtype_list[i] = |
3118 |
++ le16_to_cpup((__le16 *)(outbuf + offset)); |
3119 |
++ offset += 2; |
3120 |
++ } |
3121 |
++ } |
3122 |
+ |
3123 |
+ return 0; |
3124 |
+ |
3125 |
+diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h |
3126 |
+index aced2a7..b61eea0 100644 |
3127 |
+--- a/drivers/net/ethernet/sfc/mcdi.h |
3128 |
++++ b/drivers/net/ethernet/sfc/mcdi.h |
3129 |
+@@ -126,5 +126,6 @@ extern int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx, |
3130 |
+ extern int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out); |
3131 |
+ extern int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id); |
3132 |
+ extern int efx_mcdi_wol_filter_reset(struct efx_nic *efx); |
3133 |
++extern int efx_mcdi_set_mac(struct efx_nic *efx); |
3134 |
+ |
3135 |
+ #endif /* EFX_MCDI_H */ |
3136 |
+diff --git a/drivers/net/ethernet/sfc/mcdi_mac.c b/drivers/net/ethernet/sfc/mcdi_mac.c |
3137 |
+index 50c2077..da269d7 100644 |
3138 |
+--- a/drivers/net/ethernet/sfc/mcdi_mac.c |
3139 |
++++ b/drivers/net/ethernet/sfc/mcdi_mac.c |
3140 |
+@@ -13,7 +13,7 @@ |
3141 |
+ #include "mcdi.h" |
3142 |
+ #include "mcdi_pcol.h" |
3143 |
+ |
3144 |
+-static int efx_mcdi_set_mac(struct efx_nic *efx) |
3145 |
++int efx_mcdi_set_mac(struct efx_nic *efx) |
3146 |
+ { |
3147 |
+ u32 reject, fcntl; |
3148 |
+ u8 cmdbytes[MC_CMD_SET_MAC_IN_LEN]; |
3149 |
+@@ -45,6 +45,8 @@ static int efx_mcdi_set_mac(struct efx_nic *efx) |
3150 |
+ } |
3151 |
+ if (efx->wanted_fc & EFX_FC_AUTO) |
3152 |
+ fcntl = MC_CMD_FCNTL_AUTO; |
3153 |
++ if (efx->fc_disable) |
3154 |
++ fcntl = MC_CMD_FCNTL_OFF; |
3155 |
+ |
3156 |
+ MCDI_SET_DWORD(cmdbytes, SET_MAC_IN_FCNTL, fcntl); |
3157 |
+ |
3158 |
+diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h |
3159 |
+index b8e251a..8bcb8fd 100644 |
3160 |
+--- a/drivers/net/ethernet/sfc/net_driver.h |
3161 |
++++ b/drivers/net/ethernet/sfc/net_driver.h |
3162 |
+@@ -213,6 +213,7 @@ struct efx_tx_queue { |
3163 |
+ * If both this and page are %NULL, the buffer slot is currently free. |
3164 |
+ * @page: The associated page buffer, if any. |
3165 |
+ * If both this and skb are %NULL, the buffer slot is currently free. |
3166 |
++ * @page_offset: Offset within page. Valid iff @flags & %EFX_RX_BUF_PAGE. |
3167 |
+ * @len: Buffer length, in bytes. |
3168 |
+ * @is_page: Indicates if @page is valid. If false, @skb is valid. |
3169 |
+ */ |
3170 |
+@@ -222,7 +223,8 @@ struct efx_rx_buffer { |
3171 |
+ struct sk_buff *skb; |
3172 |
+ struct page *page; |
3173 |
+ } u; |
3174 |
+- unsigned int len; |
3175 |
++ u16 page_offset; |
3176 |
++ u16 len; |
3177 |
+ bool is_page; |
3178 |
+ }; |
3179 |
+ |
3180 |
+@@ -689,6 +691,9 @@ struct efx_filter_state; |
3181 |
+ * @promiscuous: Promiscuous flag. Protected by netif_tx_lock. |
3182 |
+ * @multicast_hash: Multicast hash table |
3183 |
+ * @wanted_fc: Wanted flow control flags |
3184 |
++ * @fc_disable: When non-zero flow control is disabled. Typically used to |
3185 |
++ * ensure that network back pressure doesn't delay dma queue flushes. |
3186 |
++ * Serialised by the rtnl lock. |
3187 |
+ * @mac_work: Work item for changing MAC promiscuity and multicast hash |
3188 |
+ * @loopback_mode: Loopback status |
3189 |
+ * @loopback_modes: Supported loopback mode bitmask |
3190 |
+@@ -782,6 +787,7 @@ struct efx_nic { |
3191 |
+ bool promiscuous; |
3192 |
+ union efx_multicast_hash multicast_hash; |
3193 |
+ u8 wanted_fc; |
3194 |
++ unsigned fc_disable; |
3195 |
+ |
3196 |
+ atomic_t rx_reset; |
3197 |
+ enum efx_loopback_mode loopback_mode; |
3198 |
+@@ -835,6 +841,7 @@ static inline unsigned int efx_port_num(struct efx_nic *efx) |
3199 |
+ * @remove_port: Free resources allocated by probe_port() |
3200 |
+ * @handle_global_event: Handle a "global" event (may be %NULL) |
3201 |
+ * @prepare_flush: Prepare the hardware for flushing the DMA queues |
3202 |
++ * @finish_flush: Clean up after flushing the DMA queues |
3203 |
+ * @update_stats: Update statistics not provided by event handling |
3204 |
+ * @start_stats: Start the regular fetching of statistics |
3205 |
+ * @stop_stats: Stop the regular fetching of statistics |
3206 |
+@@ -880,6 +887,7 @@ struct efx_nic_type { |
3207 |
+ void (*remove_port)(struct efx_nic *efx); |
3208 |
+ bool (*handle_global_event)(struct efx_channel *channel, efx_qword_t *); |
3209 |
+ void (*prepare_flush)(struct efx_nic *efx); |
3210 |
++ void (*finish_flush)(struct efx_nic *efx); |
3211 |
+ void (*update_stats)(struct efx_nic *efx); |
3212 |
+ void (*start_stats)(struct efx_nic *efx); |
3213 |
+ void (*stop_stats)(struct efx_nic *efx); |
3214 |
+diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c |
3215 |
+index 3edfbaf..2e9ca10 100644 |
3216 |
+--- a/drivers/net/ethernet/sfc/nic.c |
3217 |
++++ b/drivers/net/ethernet/sfc/nic.c |
3218 |
+@@ -371,7 +371,8 @@ efx_may_push_tx_desc(struct efx_tx_queue *tx_queue, unsigned int write_count) |
3219 |
+ return false; |
3220 |
+ |
3221 |
+ tx_queue->empty_read_count = 0; |
3222 |
+- return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0; |
3223 |
++ return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0 |
3224 |
++ && tx_queue->write_count - write_count == 1; |
3225 |
+ } |
3226 |
+ |
3227 |
+ /* For each entry inserted into the software descriptor ring, create a |
3228 |
+@@ -1261,13 +1262,27 @@ int efx_nic_flush_queues(struct efx_nic *efx) |
3229 |
+ } |
3230 |
+ efx_for_each_possible_channel_tx_queue(tx_queue, channel) { |
3231 |
+ if (tx_queue->initialised && |
3232 |
+- tx_queue->flushed != FLUSH_DONE) |
3233 |
+- ++tx_pending; |
3234 |
++ tx_queue->flushed != FLUSH_DONE) { |
3235 |
++ efx_oword_t txd_ptr_tbl; |
3236 |
++ |
3237 |
++ efx_reado_table(efx, &txd_ptr_tbl, |
3238 |
++ FR_BZ_TX_DESC_PTR_TBL, |
3239 |
++ tx_queue->queue); |
3240 |
++ if (EFX_OWORD_FIELD(txd_ptr_tbl, |
3241 |
++ FRF_AZ_TX_DESCQ_FLUSH) || |
3242 |
++ EFX_OWORD_FIELD(txd_ptr_tbl, |
3243 |
++ FRF_AZ_TX_DESCQ_EN)) |
3244 |
++ ++tx_pending; |
3245 |
++ else |
3246 |
++ tx_queue->flushed = FLUSH_DONE; |
3247 |
++ } |
3248 |
+ } |
3249 |
+ } |
3250 |
+ |
3251 |
+- if (rx_pending == 0 && tx_pending == 0) |
3252 |
++ if (rx_pending == 0 && tx_pending == 0) { |
3253 |
++ efx->type->finish_flush(efx); |
3254 |
+ return 0; |
3255 |
++ } |
3256 |
+ |
3257 |
+ msleep(EFX_FLUSH_INTERVAL); |
3258 |
+ efx_poll_flush_events(efx); |
3259 |
+@@ -1293,6 +1308,7 @@ int efx_nic_flush_queues(struct efx_nic *efx) |
3260 |
+ } |
3261 |
+ } |
3262 |
+ |
3263 |
++ efx->type->finish_flush(efx); |
3264 |
+ return -ETIMEDOUT; |
3265 |
+ } |
3266 |
+ |
3267 |
+diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h |
3268 |
+index 66ece48..58302a2 100644 |
3269 |
+--- a/drivers/net/ethernet/sfc/nic.h |
3270 |
++++ b/drivers/net/ethernet/sfc/nic.h |
3271 |
+@@ -210,6 +210,8 @@ extern void falcon_irq_ack_a1(struct efx_nic *efx); |
3272 |
+ |
3273 |
+ /* Global Resources */ |
3274 |
+ extern int efx_nic_flush_queues(struct efx_nic *efx); |
3275 |
++extern void siena_prepare_flush(struct efx_nic *efx); |
3276 |
++extern void siena_finish_flush(struct efx_nic *efx); |
3277 |
+ extern void falcon_start_nic_stats(struct efx_nic *efx); |
3278 |
+ extern void falcon_stop_nic_stats(struct efx_nic *efx); |
3279 |
+ extern void falcon_setup_xaui(struct efx_nic *efx); |
3280 |
+diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c |
3281 |
+index 5ef4cc0..9ce8665 100644 |
3282 |
+--- a/drivers/net/ethernet/sfc/rx.c |
3283 |
++++ b/drivers/net/ethernet/sfc/rx.c |
3284 |
+@@ -95,11 +95,7 @@ static unsigned int rx_refill_limit = 95; |
3285 |
+ static inline unsigned int efx_rx_buf_offset(struct efx_nic *efx, |
3286 |
+ struct efx_rx_buffer *buf) |
3287 |
+ { |
3288 |
+- /* Offset is always within one page, so we don't need to consider |
3289 |
+- * the page order. |
3290 |
+- */ |
3291 |
+- return (((__force unsigned long) buf->dma_addr & (PAGE_SIZE - 1)) + |
3292 |
+- efx->type->rx_buffer_hash_size); |
3293 |
++ return buf->page_offset + efx->type->rx_buffer_hash_size; |
3294 |
+ } |
3295 |
+ static inline unsigned int efx_rx_buf_size(struct efx_nic *efx) |
3296 |
+ { |
3297 |
+@@ -194,6 +190,7 @@ static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue) |
3298 |
+ struct efx_rx_buffer *rx_buf; |
3299 |
+ struct page *page; |
3300 |
+ void *page_addr; |
3301 |
++ unsigned int page_offset; |
3302 |
+ struct efx_rx_page_state *state; |
3303 |
+ dma_addr_t dma_addr; |
3304 |
+ unsigned index, count; |
3305 |
+@@ -220,12 +217,14 @@ static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue) |
3306 |
+ |
3307 |
+ page_addr += sizeof(struct efx_rx_page_state); |
3308 |
+ dma_addr += sizeof(struct efx_rx_page_state); |
3309 |
++ page_offset = sizeof(struct efx_rx_page_state); |
3310 |
+ |
3311 |
+ split: |
3312 |
+ index = rx_queue->added_count & rx_queue->ptr_mask; |
3313 |
+ rx_buf = efx_rx_buffer(rx_queue, index); |
3314 |
+ rx_buf->dma_addr = dma_addr + EFX_PAGE_IP_ALIGN; |
3315 |
+ rx_buf->u.page = page; |
3316 |
++ rx_buf->page_offset = page_offset + EFX_PAGE_IP_ALIGN; |
3317 |
+ rx_buf->len = efx->rx_buffer_len - EFX_PAGE_IP_ALIGN; |
3318 |
+ rx_buf->is_page = true; |
3319 |
+ ++rx_queue->added_count; |
3320 |
+@@ -237,6 +236,7 @@ static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue) |
3321 |
+ get_page(page); |
3322 |
+ dma_addr += (PAGE_SIZE >> 1); |
3323 |
+ page_addr += (PAGE_SIZE >> 1); |
3324 |
++ page_offset += (PAGE_SIZE >> 1); |
3325 |
+ ++count; |
3326 |
+ goto split; |
3327 |
+ } |
3328 |
+@@ -246,7 +246,8 @@ static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue) |
3329 |
+ } |
3330 |
+ |
3331 |
+ static void efx_unmap_rx_buffer(struct efx_nic *efx, |
3332 |
+- struct efx_rx_buffer *rx_buf) |
3333 |
++ struct efx_rx_buffer *rx_buf, |
3334 |
++ unsigned int used_len) |
3335 |
+ { |
3336 |
+ if (rx_buf->is_page && rx_buf->u.page) { |
3337 |
+ struct efx_rx_page_state *state; |
3338 |
+@@ -257,6 +258,10 @@ static void efx_unmap_rx_buffer(struct efx_nic *efx, |
3339 |
+ state->dma_addr, |
3340 |
+ efx_rx_buf_size(efx), |
3341 |
+ PCI_DMA_FROMDEVICE); |
3342 |
++ } else if (used_len) { |
3343 |
++ dma_sync_single_for_cpu(&efx->pci_dev->dev, |
3344 |
++ rx_buf->dma_addr, used_len, |
3345 |
++ DMA_FROM_DEVICE); |
3346 |
+ } |
3347 |
+ } else if (!rx_buf->is_page && rx_buf->u.skb) { |
3348 |
+ pci_unmap_single(efx->pci_dev, rx_buf->dma_addr, |
3349 |
+@@ -279,7 +284,7 @@ static void efx_free_rx_buffer(struct efx_nic *efx, |
3350 |
+ static void efx_fini_rx_buffer(struct efx_rx_queue *rx_queue, |
3351 |
+ struct efx_rx_buffer *rx_buf) |
3352 |
+ { |
3353 |
+- efx_unmap_rx_buffer(rx_queue->efx, rx_buf); |
3354 |
++ efx_unmap_rx_buffer(rx_queue->efx, rx_buf, 0); |
3355 |
+ efx_free_rx_buffer(rx_queue->efx, rx_buf); |
3356 |
+ } |
3357 |
+ |
3358 |
+@@ -550,10 +555,10 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, |
3359 |
+ goto out; |
3360 |
+ } |
3361 |
+ |
3362 |
+- /* Release card resources - assumes all RX buffers consumed in-order |
3363 |
+- * per RX queue |
3364 |
++ /* Release and/or sync DMA mapping - assumes all RX buffers |
3365 |
++ * consumed in-order per RX queue |
3366 |
+ */ |
3367 |
+- efx_unmap_rx_buffer(efx, rx_buf); |
3368 |
++ efx_unmap_rx_buffer(efx, rx_buf, len); |
3369 |
+ |
3370 |
+ /* Prefetch nice and early so data will (hopefully) be in cache by |
3371 |
+ * the time we look at it. |
3372 |
+diff --git a/drivers/net/ethernet/sfc/selftest.c b/drivers/net/ethernet/sfc/selftest.c |
3373 |
+index 822f6c2..4907885 100644 |
3374 |
+--- a/drivers/net/ethernet/sfc/selftest.c |
3375 |
++++ b/drivers/net/ethernet/sfc/selftest.c |
3376 |
+@@ -698,7 +698,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, |
3377 |
+ /* Detach the device so the kernel doesn't transmit during the |
3378 |
+ * loopback test and the watchdog timeout doesn't fire. |
3379 |
+ */ |
3380 |
+- netif_device_detach(efx->net_dev); |
3381 |
++ efx_device_detach_sync(efx); |
3382 |
+ |
3383 |
+ mutex_lock(&efx->mac_lock); |
3384 |
+ if (efx->loopback_modes) { |
3385 |
+diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c |
3386 |
+index cc2549c..c58b973 100644 |
3387 |
+--- a/drivers/net/ethernet/sfc/siena.c |
3388 |
++++ b/drivers/net/ethernet/sfc/siena.c |
3389 |
+@@ -137,6 +137,18 @@ static void siena_remove_port(struct efx_nic *efx) |
3390 |
+ efx_nic_free_buffer(efx, &efx->stats_buffer); |
3391 |
+ } |
3392 |
+ |
3393 |
++void siena_prepare_flush(struct efx_nic *efx) |
3394 |
++{ |
3395 |
++ if (efx->fc_disable++ == 0) |
3396 |
++ efx_mcdi_set_mac(efx); |
3397 |
++} |
3398 |
++ |
3399 |
++void siena_finish_flush(struct efx_nic *efx) |
3400 |
++{ |
3401 |
++ if (--efx->fc_disable == 0) |
3402 |
++ efx_mcdi_set_mac(efx); |
3403 |
++} |
3404 |
++ |
3405 |
+ static const struct efx_nic_register_test siena_register_tests[] = { |
3406 |
+ { FR_AZ_ADR_REGION, |
3407 |
+ EFX_OWORD32(0x0003FFFF, 0x0003FFFF, 0x0003FFFF, 0x0003FFFF) }, |
3408 |
+@@ -624,7 +636,8 @@ const struct efx_nic_type siena_a0_nic_type = { |
3409 |
+ .reset = siena_reset_hw, |
3410 |
+ .probe_port = siena_probe_port, |
3411 |
+ .remove_port = siena_remove_port, |
3412 |
+- .prepare_flush = efx_port_dummy_op_void, |
3413 |
++ .prepare_flush = siena_prepare_flush, |
3414 |
++ .finish_flush = siena_finish_flush, |
3415 |
+ .update_stats = siena_update_nic_stats, |
3416 |
+ .start_stats = siena_start_nic_stats, |
3417 |
+ .stop_stats = siena_stop_nic_stats, |
3418 |
+diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c |
3419 |
+index 97f342e..544ac06 100644 |
3420 |
+--- a/drivers/net/macvlan.c |
3421 |
++++ b/drivers/net/macvlan.c |
3422 |
+@@ -585,6 +585,7 @@ void macvlan_common_setup(struct net_device *dev) |
3423 |
+ ether_setup(dev); |
3424 |
+ |
3425 |
+ dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); |
3426 |
++ dev->priv_flags |= IFF_UNICAST_FLT; |
3427 |
+ dev->netdev_ops = &macvlan_netdev_ops; |
3428 |
+ dev->destructor = free_netdev; |
3429 |
+ dev->header_ops = &macvlan_hard_header_ops, |
3430 |
+diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c |
3431 |
+index 01b104e..bff6908 100644 |
3432 |
+--- a/drivers/net/netconsole.c |
3433 |
++++ b/drivers/net/netconsole.c |
3434 |
+@@ -630,6 +630,7 @@ static int netconsole_netdev_event(struct notifier_block *this, |
3435 |
+ goto done; |
3436 |
+ |
3437 |
+ spin_lock_irqsave(&target_list_lock, flags); |
3438 |
++restart: |
3439 |
+ list_for_each_entry(nt, &target_list, list) { |
3440 |
+ netconsole_target_get(nt); |
3441 |
+ if (nt->np.dev == dev) { |
3442 |
+@@ -642,20 +643,17 @@ static int netconsole_netdev_event(struct notifier_block *this, |
3443 |
+ case NETDEV_UNREGISTER: |
3444 |
+ /* |
3445 |
+ * rtnl_lock already held |
3446 |
++ * we might sleep in __netpoll_cleanup() |
3447 |
+ */ |
3448 |
+- if (nt->np.dev) { |
3449 |
+- spin_unlock_irqrestore( |
3450 |
+- &target_list_lock, |
3451 |
+- flags); |
3452 |
+- __netpoll_cleanup(&nt->np); |
3453 |
+- spin_lock_irqsave(&target_list_lock, |
3454 |
+- flags); |
3455 |
+- dev_put(nt->np.dev); |
3456 |
+- nt->np.dev = NULL; |
3457 |
+- } |
3458 |
++ spin_unlock_irqrestore(&target_list_lock, flags); |
3459 |
++ __netpoll_cleanup(&nt->np); |
3460 |
++ spin_lock_irqsave(&target_list_lock, flags); |
3461 |
++ dev_put(nt->np.dev); |
3462 |
++ nt->np.dev = NULL; |
3463 |
+ nt->enabled = 0; |
3464 |
+ stopped = true; |
3465 |
+- break; |
3466 |
++ netconsole_target_put(nt); |
3467 |
++ goto restart; |
3468 |
+ } |
3469 |
+ } |
3470 |
+ netconsole_target_put(nt); |
3471 |
+diff --git a/drivers/net/tun.c b/drivers/net/tun.c |
3472 |
+index a12c9bf..f4c5de6 100644 |
3473 |
+--- a/drivers/net/tun.c |
3474 |
++++ b/drivers/net/tun.c |
3475 |
+@@ -417,6 +417,8 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) |
3476 |
+ * for indefinite time. */ |
3477 |
+ skb_orphan(skb); |
3478 |
+ |
3479 |
++ nf_reset(skb); |
3480 |
++ |
3481 |
+ /* Enqueue packet */ |
3482 |
+ skb_queue_tail(&tun->socket.sk->sk_receive_queue, skb); |
3483 |
+ |
3484 |
+diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c |
3485 |
+index 62b4c29..d48dfb7 100644 |
3486 |
+--- a/drivers/net/wireless/mwifiex/join.c |
3487 |
++++ b/drivers/net/wireless/mwifiex/join.c |
3488 |
+@@ -1062,10 +1062,9 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, |
3489 |
+ adhoc_join->bss_descriptor.bssid, |
3490 |
+ adhoc_join->bss_descriptor.ssid); |
3491 |
+ |
3492 |
+- for (i = 0; bss_desc->supported_rates[i] && |
3493 |
+- i < MWIFIEX_SUPPORTED_RATES; |
3494 |
+- i++) |
3495 |
+- ; |
3496 |
++ for (i = 0; i < MWIFIEX_SUPPORTED_RATES && |
3497 |
++ bss_desc->supported_rates[i]; i++) |
3498 |
++ ; |
3499 |
+ rates_size = i; |
3500 |
+ |
3501 |
+ /* Copy Data Rates from the Rates recorded in scan response */ |
3502 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c |
3503 |
+index 814c05d..d3920da 100644 |
3504 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c |
3505 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c |
3506 |
+@@ -1557,74 +1557,57 @@ void rtl92cu_card_disable(struct ieee80211_hw *hw) |
3507 |
+ |
3508 |
+ void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) |
3509 |
+ { |
3510 |
+- /* dummy routine needed for callback from rtl_op_configure_filter() */ |
3511 |
+-} |
3512 |
+- |
3513 |
+-/*========================================================================== */ |
3514 |
+- |
3515 |
+-static void _rtl92cu_set_check_bssid(struct ieee80211_hw *hw, |
3516 |
+- enum nl80211_iftype type) |
3517 |
+-{ |
3518 |
+ struct rtl_priv *rtlpriv = rtl_priv(hw); |
3519 |
+- u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR); |
3520 |
+ struct rtl_hal *rtlhal = rtl_hal(rtlpriv); |
3521 |
+- struct rtl_phy *rtlphy = &(rtlpriv->phy); |
3522 |
+- u8 filterout_non_associated_bssid = false; |
3523 |
++ u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR); |
3524 |
+ |
3525 |
+- switch (type) { |
3526 |
+- case NL80211_IFTYPE_ADHOC: |
3527 |
+- case NL80211_IFTYPE_STATION: |
3528 |
+- filterout_non_associated_bssid = true; |
3529 |
+- break; |
3530 |
+- case NL80211_IFTYPE_UNSPECIFIED: |
3531 |
+- case NL80211_IFTYPE_AP: |
3532 |
+- default: |
3533 |
+- break; |
3534 |
+- } |
3535 |
+- if (filterout_non_associated_bssid) { |
3536 |
++ if (rtlpriv->psc.rfpwr_state != ERFON) |
3537 |
++ return; |
3538 |
++ |
3539 |
++ if (check_bssid) { |
3540 |
++ u8 tmp; |
3541 |
+ if (IS_NORMAL_CHIP(rtlhal->version)) { |
3542 |
+- switch (rtlphy->current_io_type) { |
3543 |
+- case IO_CMD_RESUME_DM_BY_SCAN: |
3544 |
+- reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
3545 |
+- rtlpriv->cfg->ops->set_hw_reg(hw, |
3546 |
+- HW_VAR_RCR, (u8 *)(®_rcr)); |
3547 |
+- /* enable update TSF */ |
3548 |
+- _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(4)); |
3549 |
+- break; |
3550 |
+- case IO_CMD_PAUSE_DM_BY_SCAN: |
3551 |
+- reg_rcr &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
3552 |
+- rtlpriv->cfg->ops->set_hw_reg(hw, |
3553 |
+- HW_VAR_RCR, (u8 *)(®_rcr)); |
3554 |
+- /* disable update TSF */ |
3555 |
+- _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0); |
3556 |
+- break; |
3557 |
+- } |
3558 |
++ reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
3559 |
++ tmp = BIT(4); |
3560 |
+ } else { |
3561 |
+- reg_rcr |= (RCR_CBSSID); |
3562 |
+- rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, |
3563 |
+- (u8 *)(®_rcr)); |
3564 |
+- _rtl92cu_set_bcn_ctrl_reg(hw, 0, (BIT(4)|BIT(5))); |
3565 |
++ reg_rcr |= RCR_CBSSID; |
3566 |
++ tmp = BIT(4) | BIT(5); |
3567 |
+ } |
3568 |
+- } else if (filterout_non_associated_bssid == false) { |
3569 |
++ rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, |
3570 |
++ (u8 *) (®_rcr)); |
3571 |
++ _rtl92cu_set_bcn_ctrl_reg(hw, 0, tmp); |
3572 |
++ } else { |
3573 |
++ u8 tmp; |
3574 |
+ if (IS_NORMAL_CHIP(rtlhal->version)) { |
3575 |
+- reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); |
3576 |
+- rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, |
3577 |
+- (u8 *)(®_rcr)); |
3578 |
+- _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0); |
3579 |
++ reg_rcr &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
3580 |
++ tmp = BIT(4); |
3581 |
+ } else { |
3582 |
+- reg_rcr &= (~RCR_CBSSID); |
3583 |
+- rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, |
3584 |
+- (u8 *)(®_rcr)); |
3585 |
+- _rtl92cu_set_bcn_ctrl_reg(hw, (BIT(4)|BIT(5)), 0); |
3586 |
++ reg_rcr &= ~RCR_CBSSID; |
3587 |
++ tmp = BIT(4) | BIT(5); |
3588 |
+ } |
3589 |
++ reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); |
3590 |
++ rtlpriv->cfg->ops->set_hw_reg(hw, |
3591 |
++ HW_VAR_RCR, (u8 *) (®_rcr)); |
3592 |
++ _rtl92cu_set_bcn_ctrl_reg(hw, tmp, 0); |
3593 |
+ } |
3594 |
+ } |
3595 |
+ |
3596 |
++/*========================================================================== */ |
3597 |
++ |
3598 |
+ int rtl92cu_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) |
3599 |
+ { |
3600 |
++ struct rtl_priv *rtlpriv = rtl_priv(hw); |
3601 |
++ |
3602 |
+ if (_rtl92cu_set_media_status(hw, type)) |
3603 |
+ return -EOPNOTSUPP; |
3604 |
+- _rtl92cu_set_check_bssid(hw, type); |
3605 |
++ |
3606 |
++ if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { |
3607 |
++ if (type != NL80211_IFTYPE_AP) |
3608 |
++ rtl92cu_set_check_bssid(hw, true); |
3609 |
++ } else { |
3610 |
++ rtl92cu_set_check_bssid(hw, false); |
3611 |
++ } |
3612 |
++ |
3613 |
+ return 0; |
3614 |
+ } |
3615 |
+ |
3616 |
+@@ -2238,8 +2221,6 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, |
3617 |
+ (shortgi_rate << 4) | (shortgi_rate); |
3618 |
+ } |
3619 |
+ rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); |
3620 |
+- RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, ("%x\n", rtl_read_dword(rtlpriv, |
3621 |
+- REG_ARFR0))); |
3622 |
+ } |
3623 |
+ |
3624 |
+ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) |
3625 |
+diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c |
3626 |
+index e18604b..d19b879 100644 |
3627 |
+--- a/drivers/tty/pty.c |
3628 |
++++ b/drivers/tty/pty.c |
3629 |
+@@ -49,7 +49,6 @@ static void pty_close(struct tty_struct *tty, struct file *filp) |
3630 |
+ tty->packet = 0; |
3631 |
+ if (!tty->link) |
3632 |
+ return; |
3633 |
+- tty->link->packet = 0; |
3634 |
+ set_bit(TTY_OTHER_CLOSED, &tty->link->flags); |
3635 |
+ wake_up_interruptible(&tty->link->read_wait); |
3636 |
+ wake_up_interruptible(&tty->link->write_wait); |
3637 |
+diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c |
3638 |
+index ad0f8f5..2dc4d9b 100644 |
3639 |
+--- a/drivers/tty/serial/sunsu.c |
3640 |
++++ b/drivers/tty/serial/sunsu.c |
3641 |
+@@ -968,6 +968,7 @@ static struct uart_ops sunsu_pops = { |
3642 |
+ #define UART_NR 4 |
3643 |
+ |
3644 |
+ static struct uart_sunsu_port sunsu_ports[UART_NR]; |
3645 |
++static int nr_inst; /* Number of already registered ports */ |
3646 |
+ |
3647 |
+ #ifdef CONFIG_SERIO |
3648 |
+ |
3649 |
+@@ -1337,13 +1338,8 @@ static int __init sunsu_console_setup(struct console *co, char *options) |
3650 |
+ printk("Console: ttyS%d (SU)\n", |
3651 |
+ (sunsu_reg.minor - 64) + co->index); |
3652 |
+ |
3653 |
+- /* |
3654 |
+- * Check whether an invalid uart number has been specified, and |
3655 |
+- * if so, search for the first available port that does have |
3656 |
+- * console support. |
3657 |
+- */ |
3658 |
+- if (co->index >= UART_NR) |
3659 |
+- co->index = 0; |
3660 |
++ if (co->index > nr_inst) |
3661 |
++ return -ENODEV; |
3662 |
+ port = &sunsu_ports[co->index].port; |
3663 |
+ |
3664 |
+ /* |
3665 |
+@@ -1408,7 +1404,6 @@ static enum su_type __devinit su_get_type(struct device_node *dp) |
3666 |
+ |
3667 |
+ static int __devinit su_probe(struct platform_device *op) |
3668 |
+ { |
3669 |
+- static int inst; |
3670 |
+ struct device_node *dp = op->dev.of_node; |
3671 |
+ struct uart_sunsu_port *up; |
3672 |
+ struct resource *rp; |
3673 |
+@@ -1418,16 +1413,16 @@ static int __devinit su_probe(struct platform_device *op) |
3674 |
+ |
3675 |
+ type = su_get_type(dp); |
3676 |
+ if (type == SU_PORT_PORT) { |
3677 |
+- if (inst >= UART_NR) |
3678 |
++ if (nr_inst >= UART_NR) |
3679 |
+ return -EINVAL; |
3680 |
+- up = &sunsu_ports[inst]; |
3681 |
++ up = &sunsu_ports[nr_inst]; |
3682 |
+ } else { |
3683 |
+ up = kzalloc(sizeof(*up), GFP_KERNEL); |
3684 |
+ if (!up) |
3685 |
+ return -ENOMEM; |
3686 |
+ } |
3687 |
+ |
3688 |
+- up->port.line = inst; |
3689 |
++ up->port.line = nr_inst; |
3690 |
+ |
3691 |
+ spin_lock_init(&up->port.lock); |
3692 |
+ |
3693 |
+@@ -1461,6 +1456,8 @@ static int __devinit su_probe(struct platform_device *op) |
3694 |
+ } |
3695 |
+ dev_set_drvdata(&op->dev, up); |
3696 |
+ |
3697 |
++ nr_inst++; |
3698 |
++ |
3699 |
+ return 0; |
3700 |
+ } |
3701 |
+ |
3702 |
+@@ -1488,7 +1485,7 @@ static int __devinit su_probe(struct platform_device *op) |
3703 |
+ |
3704 |
+ dev_set_drvdata(&op->dev, up); |
3705 |
+ |
3706 |
+- inst++; |
3707 |
++ nr_inst++; |
3708 |
+ |
3709 |
+ return 0; |
3710 |
+ |
3711 |
+diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c |
3712 |
+index 61d08dd..76be3ba 100644 |
3713 |
+--- a/drivers/usb/core/hcd-pci.c |
3714 |
++++ b/drivers/usb/core/hcd-pci.c |
3715 |
+@@ -173,6 +173,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) |
3716 |
+ struct hc_driver *driver; |
3717 |
+ struct usb_hcd *hcd; |
3718 |
+ int retval; |
3719 |
++ int hcd_irq = 0; |
3720 |
+ |
3721 |
+ if (usb_disabled()) |
3722 |
+ return -ENODEV; |
3723 |
+@@ -187,15 +188,19 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) |
3724 |
+ return -ENODEV; |
3725 |
+ dev->current_state = PCI_D0; |
3726 |
+ |
3727 |
+- /* The xHCI driver supports MSI and MSI-X, |
3728 |
+- * so don't fail if the BIOS doesn't provide a legacy IRQ. |
3729 |
++ /* |
3730 |
++ * The xHCI driver has its own irq management |
3731 |
++ * make sure irq setup is not touched for xhci in generic hcd code |
3732 |
+ */ |
3733 |
+- if (!dev->irq && (driver->flags & HCD_MASK) != HCD_USB3) { |
3734 |
+- dev_err(&dev->dev, |
3735 |
+- "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", |
3736 |
+- pci_name(dev)); |
3737 |
+- retval = -ENODEV; |
3738 |
+- goto disable_pci; |
3739 |
++ if ((driver->flags & HCD_MASK) != HCD_USB3) { |
3740 |
++ if (!dev->irq) { |
3741 |
++ dev_err(&dev->dev, |
3742 |
++ "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", |
3743 |
++ pci_name(dev)); |
3744 |
++ retval = -ENODEV; |
3745 |
++ goto disable_pci; |
3746 |
++ } |
3747 |
++ hcd_irq = dev->irq; |
3748 |
+ } |
3749 |
+ |
3750 |
+ hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev)); |
3751 |
+@@ -245,7 +250,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) |
3752 |
+ |
3753 |
+ pci_set_master(dev); |
3754 |
+ |
3755 |
+- retval = usb_add_hcd(hcd, dev->irq, IRQF_SHARED); |
3756 |
++ retval = usb_add_hcd(hcd, hcd_irq, IRQF_SHARED); |
3757 |
+ if (retval != 0) |
3758 |
+ goto unmap_registers; |
3759 |
+ set_hs_companion(dev, hcd); |
3760 |
+diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c |
3761 |
+index 901924a..d433fdf 100644 |
3762 |
+--- a/drivers/usb/gadget/udc-core.c |
3763 |
++++ b/drivers/usb/gadget/udc-core.c |
3764 |
+@@ -213,7 +213,7 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) |
3765 |
+ udc->driver->disconnect(udc->gadget); |
3766 |
+ usb_gadget_disconnect(udc->gadget); |
3767 |
+ udc->driver->unbind(udc->gadget); |
3768 |
+- usb_gadget_udc_stop(udc->gadget, udc->driver); |
3769 |
++ usb_gadget_udc_stop(udc->gadget, NULL); |
3770 |
+ } else { |
3771 |
+ usb_gadget_stop(udc->gadget, udc->driver); |
3772 |
+ } |
3773 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
3774 |
+index 53c8be1..2c0350f 100644 |
3775 |
+--- a/drivers/usb/host/xhci.c |
3776 |
++++ b/drivers/usb/host/xhci.c |
3777 |
+@@ -342,7 +342,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) |
3778 |
+ * generate interrupts. Don't even try to enable MSI. |
3779 |
+ */ |
3780 |
+ if (xhci->quirks & XHCI_BROKEN_MSI) |
3781 |
+- return 0; |
3782 |
++ goto legacy_irq; |
3783 |
+ |
3784 |
+ /* unregister the legacy interrupt */ |
3785 |
+ if (hcd->irq) |
3786 |
+@@ -363,6 +363,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) |
3787 |
+ return -EINVAL; |
3788 |
+ } |
3789 |
+ |
3790 |
++ legacy_irq: |
3791 |
+ /* fall back to legacy interrupt*/ |
3792 |
+ ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, |
3793 |
+ hcd->irq_descr, hcd); |
3794 |
+diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
3795 |
+index cc368c2..c519a31 100644 |
3796 |
+--- a/drivers/usb/host/xhci.h |
3797 |
++++ b/drivers/usb/host/xhci.h |
3798 |
+@@ -206,8 +206,8 @@ struct xhci_op_regs { |
3799 |
+ /* bits 12:31 are reserved (and should be preserved on writes). */ |
3800 |
+ |
3801 |
+ /* IMAN - Interrupt Management Register */ |
3802 |
+-#define IMAN_IP (1 << 1) |
3803 |
+-#define IMAN_IE (1 << 0) |
3804 |
++#define IMAN_IE (1 << 1) |
3805 |
++#define IMAN_IP (1 << 0) |
3806 |
+ |
3807 |
+ /* USBSTS - USB status - status bitmasks */ |
3808 |
+ /* HC not running - set to 1 when run/stop bit is cleared. */ |
3809 |
+diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c |
3810 |
+index 1a49ca9..e664bac 100644 |
3811 |
+--- a/drivers/usb/serial/garmin_gps.c |
3812 |
++++ b/drivers/usb/serial/garmin_gps.c |
3813 |
+@@ -973,10 +973,7 @@ static void garmin_close(struct usb_serial_port *port) |
3814 |
+ if (!serial) |
3815 |
+ return; |
3816 |
+ |
3817 |
+- mutex_lock(&port->serial->disc_mutex); |
3818 |
+- |
3819 |
+- if (!port->serial->disconnected) |
3820 |
+- garmin_clear(garmin_data_p); |
3821 |
++ garmin_clear(garmin_data_p); |
3822 |
+ |
3823 |
+ /* shutdown our urbs */ |
3824 |
+ usb_kill_urb(port->read_urb); |
3825 |
+@@ -985,8 +982,6 @@ static void garmin_close(struct usb_serial_port *port) |
3826 |
+ /* keep reset state so we know that we must start a new session */ |
3827 |
+ if (garmin_data_p->state != STATE_RESET) |
3828 |
+ garmin_data_p->state = STATE_DISCONNECTED; |
3829 |
+- |
3830 |
+- mutex_unlock(&port->serial->disc_mutex); |
3831 |
+ } |
3832 |
+ |
3833 |
+ |
3834 |
+diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c |
3835 |
+index 3de751d..1f145bf 100644 |
3836 |
+--- a/drivers/usb/serial/io_ti.c |
3837 |
++++ b/drivers/usb/serial/io_ti.c |
3838 |
+@@ -2796,6 +2796,7 @@ static struct usb_serial_driver edgeport_2port_device = { |
3839 |
+ .set_termios = edge_set_termios, |
3840 |
+ .tiocmget = edge_tiocmget, |
3841 |
+ .tiocmset = edge_tiocmset, |
3842 |
++ .get_icount = edge_get_icount, |
3843 |
+ .write = edge_write, |
3844 |
+ .write_room = edge_write_room, |
3845 |
+ .chars_in_buffer = edge_chars_in_buffer, |
3846 |
+diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c |
3847 |
+index dc1ce62..2482d5e 100644 |
3848 |
+--- a/drivers/usb/serial/usb-serial.c |
3849 |
++++ b/drivers/usb/serial/usb-serial.c |
3850 |
+@@ -168,6 +168,7 @@ static void destroy_serial(struct kref *kref) |
3851 |
+ } |
3852 |
+ } |
3853 |
+ |
3854 |
++ usb_put_intf(serial->interface); |
3855 |
+ usb_put_dev(serial->dev); |
3856 |
+ kfree(serial); |
3857 |
+ } |
3858 |
+@@ -624,7 +625,7 @@ static struct usb_serial *create_serial(struct usb_device *dev, |
3859 |
+ } |
3860 |
+ serial->dev = usb_get_dev(dev); |
3861 |
+ serial->type = driver; |
3862 |
+- serial->interface = interface; |
3863 |
++ serial->interface = usb_get_intf(interface); |
3864 |
+ kref_init(&serial->kref); |
3865 |
+ mutex_init(&serial->disc_mutex); |
3866 |
+ serial->minor = SERIAL_TTY_NO_MINOR; |
3867 |
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
3868 |
+index fa8a1b2..7b8d564 100644 |
3869 |
+--- a/drivers/usb/storage/unusual_devs.h |
3870 |
++++ b/drivers/usb/storage/unusual_devs.h |
3871 |
+@@ -488,6 +488,13 @@ UNUSUAL_DEV( 0x04e8, 0x5122, 0x0000, 0x9999, |
3872 |
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
3873 |
+ US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), |
3874 |
+ |
3875 |
++/* Added by Dmitry Artamonow <mad_soft@×××××.ru> */ |
3876 |
++UNUSUAL_DEV( 0x04e8, 0x5136, 0x0000, 0x9999, |
3877 |
++ "Samsung", |
3878 |
++ "YP-Z3", |
3879 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
3880 |
++ US_FL_MAX_SECTORS_64), |
3881 |
++ |
3882 |
+ /* Entry and supporting patch by Theodore Kilgore <kilgota@××××××.edu>. |
3883 |
+ * Device uses standards-violating 32-byte Bulk Command Block Wrappers and |
3884 |
+ * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. |
3885 |
+diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c |
3886 |
+index b76071e..5c58128 100644 |
3887 |
+--- a/drivers/vhost/net.c |
3888 |
++++ b/drivers/vhost/net.c |
3889 |
+@@ -234,7 +234,8 @@ static void handle_tx(struct vhost_net *net) |
3890 |
+ msg.msg_controllen = 0; |
3891 |
+ ubufs = NULL; |
3892 |
+ } else { |
3893 |
+- struct ubuf_info *ubuf = &vq->ubuf_info[head]; |
3894 |
++ struct ubuf_info *ubuf; |
3895 |
++ ubuf = vq->ubuf_info + vq->upend_idx; |
3896 |
+ |
3897 |
+ vq->heads[vq->upend_idx].len = len; |
3898 |
+ ubuf->callback = vhost_zerocopy_callback; |
3899 |
+diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c |
3900 |
+index cfd1ce3..1d36db1 100644 |
3901 |
+--- a/fs/cifs/asn1.c |
3902 |
++++ b/fs/cifs/asn1.c |
3903 |
+@@ -614,53 +614,10 @@ decode_negTokenInit(unsigned char *security_blob, int length, |
3904 |
+ } |
3905 |
+ } |
3906 |
+ |
3907 |
+- /* mechlistMIC */ |
3908 |
+- if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { |
3909 |
+- /* Check if we have reached the end of the blob, but with |
3910 |
+- no mechListMic (e.g. NTLMSSP instead of KRB5) */ |
3911 |
+- if (ctx.error == ASN1_ERR_DEC_EMPTY) |
3912 |
+- goto decode_negtoken_exit; |
3913 |
+- cFYI(1, "Error decoding last part negTokenInit exit3"); |
3914 |
+- return 0; |
3915 |
+- } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { |
3916 |
+- /* tag = 3 indicating mechListMIC */ |
3917 |
+- cFYI(1, "Exit 4 cls = %d con = %d tag = %d end = %p (%d)", |
3918 |
+- cls, con, tag, end, *end); |
3919 |
+- return 0; |
3920 |
+- } |
3921 |
+- |
3922 |
+- /* sequence */ |
3923 |
+- if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { |
3924 |
+- cFYI(1, "Error decoding last part negTokenInit exit5"); |
3925 |
+- return 0; |
3926 |
+- } else if ((cls != ASN1_UNI) || (con != ASN1_CON) |
3927 |
+- || (tag != ASN1_SEQ)) { |
3928 |
+- cFYI(1, "cls = %d con = %d tag = %d end = %p (%d)", |
3929 |
+- cls, con, tag, end, *end); |
3930 |
+- } |
3931 |
+- |
3932 |
+- /* sequence of */ |
3933 |
+- if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { |
3934 |
+- cFYI(1, "Error decoding last part negTokenInit exit 7"); |
3935 |
+- return 0; |
3936 |
+- } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { |
3937 |
+- cFYI(1, "Exit 8 cls = %d con = %d tag = %d end = %p (%d)", |
3938 |
+- cls, con, tag, end, *end); |
3939 |
+- return 0; |
3940 |
+- } |
3941 |
+- |
3942 |
+- /* general string */ |
3943 |
+- if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { |
3944 |
+- cFYI(1, "Error decoding last part negTokenInit exit9"); |
3945 |
+- return 0; |
3946 |
+- } else if ((cls != ASN1_UNI) || (con != ASN1_PRI) |
3947 |
+- || (tag != ASN1_GENSTR)) { |
3948 |
+- cFYI(1, "Exit10 cls = %d con = %d tag = %d end = %p (%d)", |
3949 |
+- cls, con, tag, end, *end); |
3950 |
+- return 0; |
3951 |
+- } |
3952 |
+- cFYI(1, "Need to call asn1_octets_decode() function for %s", |
3953 |
+- ctx.pointer); /* is this UTF-8 or ASCII? */ |
3954 |
+-decode_negtoken_exit: |
3955 |
++ /* |
3956 |
++ * We currently ignore anything at the end of the SPNEGO blob after |
3957 |
++ * the mechTypes have been parsed, since none of that info is |
3958 |
++ * used at the moment. |
3959 |
++ */ |
3960 |
+ return 1; |
3961 |
+ } |
3962 |
+diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c |
3963 |
+index b3a2a40..25bb97f 100644 |
3964 |
+--- a/fs/cifs/cifsfs.c |
3965 |
++++ b/fs/cifs/cifsfs.c |
3966 |
+@@ -90,6 +90,30 @@ extern mempool_t *cifs_sm_req_poolp; |
3967 |
+ extern mempool_t *cifs_req_poolp; |
3968 |
+ extern mempool_t *cifs_mid_poolp; |
3969 |
+ |
3970 |
++/* |
3971 |
++ * Bumps refcount for cifs super block. |
3972 |
++ * Note that it should be only called if a referece to VFS super block is |
3973 |
++ * already held, e.g. in open-type syscalls context. Otherwise it can race with |
3974 |
++ * atomic_dec_and_test in deactivate_locked_super. |
3975 |
++ */ |
3976 |
++void |
3977 |
++cifs_sb_active(struct super_block *sb) |
3978 |
++{ |
3979 |
++ struct cifs_sb_info *server = CIFS_SB(sb); |
3980 |
++ |
3981 |
++ if (atomic_inc_return(&server->active) == 1) |
3982 |
++ atomic_inc(&sb->s_active); |
3983 |
++} |
3984 |
++ |
3985 |
++void |
3986 |
++cifs_sb_deactive(struct super_block *sb) |
3987 |
++{ |
3988 |
++ struct cifs_sb_info *server = CIFS_SB(sb); |
3989 |
++ |
3990 |
++ if (atomic_dec_and_test(&server->active)) |
3991 |
++ deactivate_super(sb); |
3992 |
++} |
3993 |
++ |
3994 |
+ static int |
3995 |
+ cifs_read_super(struct super_block *sb) |
3996 |
+ { |
3997 |
+diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h |
3998 |
+index 30ff560..c91ea81 100644 |
3999 |
+--- a/fs/cifs/cifsfs.h |
4000 |
++++ b/fs/cifs/cifsfs.h |
4001 |
+@@ -41,6 +41,10 @@ extern struct file_system_type cifs_fs_type; |
4002 |
+ extern const struct address_space_operations cifs_addr_ops; |
4003 |
+ extern const struct address_space_operations cifs_addr_ops_smallbuf; |
4004 |
+ |
4005 |
++/* Functions related to super block operations */ |
4006 |
++extern void cifs_sb_active(struct super_block *sb); |
4007 |
++extern void cifs_sb_deactive(struct super_block *sb); |
4008 |
++ |
4009 |
+ /* Functions related to inodes */ |
4010 |
+ extern const struct inode_operations cifs_dir_inode_ops; |
4011 |
+ extern struct inode *cifs_root_iget(struct super_block *); |
4012 |
+diff --git a/fs/cifs/file.c b/fs/cifs/file.c |
4013 |
+index 51574d4..c55808e 100644 |
4014 |
+--- a/fs/cifs/file.c |
4015 |
++++ b/fs/cifs/file.c |
4016 |
+@@ -265,6 +265,8 @@ cifs_new_fileinfo(__u16 fileHandle, struct file *file, |
4017 |
+ mutex_init(&pCifsFile->fh_mutex); |
4018 |
+ INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break); |
4019 |
+ |
4020 |
++ cifs_sb_active(inode->i_sb); |
4021 |
++ |
4022 |
+ spin_lock(&cifs_file_list_lock); |
4023 |
+ list_add(&pCifsFile->tlist, &(tlink_tcon(tlink)->openFileList)); |
4024 |
+ /* if readable file instance put first in list*/ |
4025 |
+@@ -293,7 +295,8 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) |
4026 |
+ struct inode *inode = cifs_file->dentry->d_inode; |
4027 |
+ struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink); |
4028 |
+ struct cifsInodeInfo *cifsi = CIFS_I(inode); |
4029 |
+- struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
4030 |
++ struct super_block *sb = inode->i_sb; |
4031 |
++ struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
4032 |
+ struct cifsLockInfo *li, *tmp; |
4033 |
+ |
4034 |
+ spin_lock(&cifs_file_list_lock); |
4035 |
+@@ -345,6 +348,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) |
4036 |
+ |
4037 |
+ cifs_put_tlink(cifs_file->tlink); |
4038 |
+ dput(cifs_file->dentry); |
4039 |
++ cifs_sb_deactive(sb); |
4040 |
+ kfree(cifs_file); |
4041 |
+ } |
4042 |
+ |
4043 |
+diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c |
4044 |
+index 484ffee..2845a1f 100644 |
4045 |
+--- a/fs/ext4/balloc.c |
4046 |
++++ b/fs/ext4/balloc.c |
4047 |
+@@ -571,7 +571,7 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb) |
4048 |
+ brelse(bitmap_bh); |
4049 |
+ printk(KERN_DEBUG "ext4_count_free_clusters: stored = %llu" |
4050 |
+ ", computed = %llu, %llu\n", |
4051 |
+- EXT4_B2C(EXT4_SB(sb), ext4_free_blocks_count(es)), |
4052 |
++ EXT4_NUM_B2C(EXT4_SB(sb), ext4_free_blocks_count(es)), |
4053 |
+ desc_count, bitmap_count); |
4054 |
+ return bitmap_count; |
4055 |
+ #else |
4056 |
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
4057 |
+index 8cb184c..60b6ca5 100644 |
4058 |
+--- a/fs/ext4/ext4.h |
4059 |
++++ b/fs/ext4/ext4.h |
4060 |
+@@ -309,9 +309,9 @@ struct ext4_group_desc |
4061 |
+ */ |
4062 |
+ |
4063 |
+ struct flex_groups { |
4064 |
+- atomic_t free_inodes; |
4065 |
+- atomic_t free_clusters; |
4066 |
+- atomic_t used_dirs; |
4067 |
++ atomic64_t free_clusters; |
4068 |
++ atomic_t free_inodes; |
4069 |
++ atomic_t used_dirs; |
4070 |
+ }; |
4071 |
+ |
4072 |
+ #define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ |
4073 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
4074 |
+index b48e0dc..ce0bc25 100644 |
4075 |
+--- a/fs/ext4/extents.c |
4076 |
++++ b/fs/ext4/extents.c |
4077 |
+@@ -2960,6 +2960,7 @@ static int ext4_split_extent(handle_t *handle, |
4078 |
+ int err = 0; |
4079 |
+ int uninitialized; |
4080 |
+ int split_flag1, flags1; |
4081 |
++ int allocated = map->m_len; |
4082 |
+ |
4083 |
+ depth = ext_depth(inode); |
4084 |
+ ex = path[depth].p_ext; |
4085 |
+@@ -2979,6 +2980,8 @@ static int ext4_split_extent(handle_t *handle, |
4086 |
+ map->m_lblk + map->m_len, split_flag1, flags1); |
4087 |
+ if (err) |
4088 |
+ goto out; |
4089 |
++ } else { |
4090 |
++ allocated = ee_len - (map->m_lblk - ee_block); |
4091 |
+ } |
4092 |
+ |
4093 |
+ ext4_ext_drop_refs(path); |
4094 |
+@@ -3001,7 +3004,7 @@ static int ext4_split_extent(handle_t *handle, |
4095 |
+ |
4096 |
+ ext4_ext_show_leaf(inode, path); |
4097 |
+ out: |
4098 |
+- return err ? err : map->m_len; |
4099 |
++ return err ? err : allocated; |
4100 |
+ } |
4101 |
+ |
4102 |
+ #define EXT4_EXT_ZERO_LEN 7 |
4103 |
+@@ -3663,6 +3666,7 @@ out: |
4104 |
+ allocated - map->m_len); |
4105 |
+ allocated = map->m_len; |
4106 |
+ } |
4107 |
++ map->m_len = allocated; |
4108 |
+ |
4109 |
+ /* |
4110 |
+ * If we have done fallocate with the offset that is already |
4111 |
+diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c |
4112 |
+index 6266799..6d1f577 100644 |
4113 |
+--- a/fs/ext4/ialloc.c |
4114 |
++++ b/fs/ext4/ialloc.c |
4115 |
+@@ -294,8 +294,8 @@ error_return: |
4116 |
+ } |
4117 |
+ |
4118 |
+ struct orlov_stats { |
4119 |
++ __u64 free_clusters; |
4120 |
+ __u32 free_inodes; |
4121 |
+- __u32 free_clusters; |
4122 |
+ __u32 used_dirs; |
4123 |
+ }; |
4124 |
+ |
4125 |
+@@ -312,7 +312,7 @@ static void get_orlov_stats(struct super_block *sb, ext4_group_t g, |
4126 |
+ |
4127 |
+ if (flex_size > 1) { |
4128 |
+ stats->free_inodes = atomic_read(&flex_group[g].free_inodes); |
4129 |
+- stats->free_clusters = atomic_read(&flex_group[g].free_clusters); |
4130 |
++ stats->free_clusters = atomic64_read(&flex_group[g].free_clusters); |
4131 |
+ stats->used_dirs = atomic_read(&flex_group[g].used_dirs); |
4132 |
+ return; |
4133 |
+ } |
4134 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
4135 |
+index 4b2bb75..3270ffd 100644 |
4136 |
+--- a/fs/ext4/inode.c |
4137 |
++++ b/fs/ext4/inode.c |
4138 |
+@@ -142,7 +142,8 @@ void ext4_evict_inode(struct inode *inode) |
4139 |
+ * don't use page cache. |
4140 |
+ */ |
4141 |
+ if (ext4_should_journal_data(inode) && |
4142 |
+- (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) { |
4143 |
++ (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) && |
4144 |
++ inode->i_ino != EXT4_JOURNAL_INO) { |
4145 |
+ journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; |
4146 |
+ tid_t commit_tid = EXT4_I(inode)->i_datasync_tid; |
4147 |
+ |
4148 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
4149 |
+index 553ff71..7b18563 100644 |
4150 |
+--- a/fs/ext4/mballoc.c |
4151 |
++++ b/fs/ext4/mballoc.c |
4152 |
+@@ -2866,8 +2866,8 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, |
4153 |
+ if (sbi->s_log_groups_per_flex) { |
4154 |
+ ext4_group_t flex_group = ext4_flex_group(sbi, |
4155 |
+ ac->ac_b_ex.fe_group); |
4156 |
+- atomic_sub(ac->ac_b_ex.fe_len, |
4157 |
+- &sbi->s_flex_groups[flex_group].free_clusters); |
4158 |
++ atomic64_sub(ac->ac_b_ex.fe_len, |
4159 |
++ &sbi->s_flex_groups[flex_group].free_clusters); |
4160 |
+ } |
4161 |
+ |
4162 |
+ err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh); |
4163 |
+@@ -3485,7 +3485,7 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) |
4164 |
+ win = offs; |
4165 |
+ |
4166 |
+ ac->ac_b_ex.fe_logical = ac->ac_o_ex.fe_logical - |
4167 |
+- EXT4_B2C(sbi, win); |
4168 |
++ EXT4_NUM_B2C(sbi, win); |
4169 |
+ BUG_ON(ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical); |
4170 |
+ BUG_ON(ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len); |
4171 |
+ } |
4172 |
+@@ -4634,7 +4634,7 @@ do_more: |
4173 |
+ EXT4_BLOCKS_PER_GROUP(sb); |
4174 |
+ count -= overflow; |
4175 |
+ } |
4176 |
+- count_clusters = EXT4_B2C(sbi, count); |
4177 |
++ count_clusters = EXT4_NUM_B2C(sbi, count); |
4178 |
+ bitmap_bh = ext4_read_block_bitmap(sb, block_group); |
4179 |
+ if (!bitmap_bh) { |
4180 |
+ err = -EIO; |
4181 |
+@@ -4724,8 +4724,8 @@ do_more: |
4182 |
+ |
4183 |
+ if (sbi->s_log_groups_per_flex) { |
4184 |
+ ext4_group_t flex_group = ext4_flex_group(sbi, block_group); |
4185 |
+- atomic_add(count_clusters, |
4186 |
+- &sbi->s_flex_groups[flex_group].free_clusters); |
4187 |
++ atomic64_add(count_clusters, |
4188 |
++ &sbi->s_flex_groups[flex_group].free_clusters); |
4189 |
+ } |
4190 |
+ |
4191 |
+ ext4_mb_unload_buddy(&e4b); |
4192 |
+@@ -4865,12 +4865,12 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb, |
4193 |
+ desc->bg_checksum = ext4_group_desc_csum(sbi, block_group, desc); |
4194 |
+ ext4_unlock_group(sb, block_group); |
4195 |
+ percpu_counter_add(&sbi->s_freeclusters_counter, |
4196 |
+- EXT4_B2C(sbi, blocks_freed)); |
4197 |
++ EXT4_NUM_B2C(sbi, blocks_freed)); |
4198 |
+ |
4199 |
+ if (sbi->s_log_groups_per_flex) { |
4200 |
+ ext4_group_t flex_group = ext4_flex_group(sbi, block_group); |
4201 |
+- atomic_add(EXT4_B2C(sbi, blocks_freed), |
4202 |
+- &sbi->s_flex_groups[flex_group].free_clusters); |
4203 |
++ atomic64_add(EXT4_NUM_B2C(sbi, blocks_freed), |
4204 |
++ &sbi->s_flex_groups[flex_group].free_clusters); |
4205 |
+ } |
4206 |
+ |
4207 |
+ ext4_mb_unload_buddy(&e4b); |
4208 |
+diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c |
4209 |
+index 33129c0..6e67b97 100644 |
4210 |
+--- a/fs/ext4/resize.c |
4211 |
++++ b/fs/ext4/resize.c |
4212 |
+@@ -938,7 +938,7 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) |
4213 |
+ |
4214 |
+ /* Update the free space counts */ |
4215 |
+ percpu_counter_add(&sbi->s_freeclusters_counter, |
4216 |
+- EXT4_B2C(sbi, input->free_blocks_count)); |
4217 |
++ EXT4_NUM_B2C(sbi, input->free_blocks_count)); |
4218 |
+ percpu_counter_add(&sbi->s_freeinodes_counter, |
4219 |
+ EXT4_INODES_PER_GROUP(sb)); |
4220 |
+ |
4221 |
+@@ -946,8 +946,8 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) |
4222 |
+ sbi->s_log_groups_per_flex) { |
4223 |
+ ext4_group_t flex_group; |
4224 |
+ flex_group = ext4_flex_group(sbi, input->group); |
4225 |
+- atomic_add(EXT4_B2C(sbi, input->free_blocks_count), |
4226 |
+- &sbi->s_flex_groups[flex_group].free_clusters); |
4227 |
++ atomic64_add(EXT4_NUM_B2C(sbi, input->free_blocks_count), |
4228 |
++ &sbi->s_flex_groups[flex_group].free_clusters); |
4229 |
+ atomic_add(EXT4_INODES_PER_GROUP(sb), |
4230 |
+ &sbi->s_flex_groups[flex_group].free_inodes); |
4231 |
+ } |
4232 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
4233 |
+index 24ac7a2..cc386b2 100644 |
4234 |
+--- a/fs/ext4/super.c |
4235 |
++++ b/fs/ext4/super.c |
4236 |
+@@ -2047,8 +2047,8 @@ static int ext4_fill_flex_info(struct super_block *sb) |
4237 |
+ flex_group = ext4_flex_group(sbi, i); |
4238 |
+ atomic_add(ext4_free_inodes_count(sb, gdp), |
4239 |
+ &sbi->s_flex_groups[flex_group].free_inodes); |
4240 |
+- atomic_add(ext4_free_group_clusters(sb, gdp), |
4241 |
+- &sbi->s_flex_groups[flex_group].free_clusters); |
4242 |
++ atomic64_add(ext4_free_group_clusters(sb, gdp), |
4243 |
++ &sbi->s_flex_groups[flex_group].free_clusters); |
4244 |
+ atomic_add(ext4_used_dirs_count(sb, gdp), |
4245 |
+ &sbi->s_flex_groups[flex_group].used_dirs); |
4246 |
+ } |
4247 |
+diff --git a/fs/isofs/export.c b/fs/isofs/export.c |
4248 |
+index 516eb21..fd88add 100644 |
4249 |
+--- a/fs/isofs/export.c |
4250 |
++++ b/fs/isofs/export.c |
4251 |
+@@ -135,6 +135,7 @@ isofs_export_encode_fh(struct dentry *dentry, |
4252 |
+ len = 3; |
4253 |
+ fh32[0] = ei->i_iget5_block; |
4254 |
+ fh16[2] = (__u16)ei->i_iget5_offset; /* fh16 [sic] */ |
4255 |
++ fh16[3] = 0; /* avoid leaking uninitialized data */ |
4256 |
+ fh32[2] = inode->i_generation; |
4257 |
+ if (connectable && !S_ISDIR(inode->i_mode)) { |
4258 |
+ struct inode *parent; |
4259 |
+diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c |
4260 |
+index d7dd774..6ac5bb1 100644 |
4261 |
+--- a/fs/jbd2/transaction.c |
4262 |
++++ b/fs/jbd2/transaction.c |
4263 |
+@@ -1016,9 +1016,12 @@ out: |
4264 |
+ void jbd2_journal_set_triggers(struct buffer_head *bh, |
4265 |
+ struct jbd2_buffer_trigger_type *type) |
4266 |
+ { |
4267 |
+- struct journal_head *jh = bh2jh(bh); |
4268 |
++ struct journal_head *jh = jbd2_journal_grab_journal_head(bh); |
4269 |
+ |
4270 |
++ if (WARN_ON(!jh)) |
4271 |
++ return; |
4272 |
+ jh->b_triggers = type; |
4273 |
++ jbd2_journal_put_journal_head(jh); |
4274 |
+ } |
4275 |
+ |
4276 |
+ void jbd2_buffer_frozen_trigger(struct journal_head *jh, void *mapped_data, |
4277 |
+@@ -1070,17 +1073,18 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) |
4278 |
+ { |
4279 |
+ transaction_t *transaction = handle->h_transaction; |
4280 |
+ journal_t *journal = transaction->t_journal; |
4281 |
+- struct journal_head *jh = bh2jh(bh); |
4282 |
++ struct journal_head *jh; |
4283 |
+ int ret = 0; |
4284 |
+ |
4285 |
+- jbd_debug(5, "journal_head %p\n", jh); |
4286 |
+- JBUFFER_TRACE(jh, "entry"); |
4287 |
+ if (is_handle_aborted(handle)) |
4288 |
+ goto out; |
4289 |
+- if (!buffer_jbd(bh)) { |
4290 |
++ jh = jbd2_journal_grab_journal_head(bh); |
4291 |
++ if (!jh) { |
4292 |
+ ret = -EUCLEAN; |
4293 |
+ goto out; |
4294 |
+ } |
4295 |
++ jbd_debug(5, "journal_head %p\n", jh); |
4296 |
++ JBUFFER_TRACE(jh, "entry"); |
4297 |
+ |
4298 |
+ jbd_lock_bh_state(bh); |
4299 |
+ |
4300 |
+@@ -1171,6 +1175,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) |
4301 |
+ spin_unlock(&journal->j_list_lock); |
4302 |
+ out_unlock_bh: |
4303 |
+ jbd_unlock_bh_state(bh); |
4304 |
++ jbd2_journal_put_journal_head(jh); |
4305 |
+ out: |
4306 |
+ JBUFFER_TRACE(jh, "exit"); |
4307 |
+ WARN_ON(ret); /* All errors are bugs, so dump the stack */ |
4308 |
+diff --git a/fs/proc/inode.c b/fs/proc/inode.c |
4309 |
+index 7737c54..00f08b3 100644 |
4310 |
+--- a/fs/proc/inode.c |
4311 |
++++ b/fs/proc/inode.c |
4312 |
+@@ -427,12 +427,10 @@ static const struct file_operations proc_reg_file_ops_no_compat = { |
4313 |
+ |
4314 |
+ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) |
4315 |
+ { |
4316 |
+- struct inode * inode; |
4317 |
++ struct inode *inode = new_inode_pseudo(sb); |
4318 |
+ |
4319 |
+- inode = iget_locked(sb, de->low_ino); |
4320 |
+- if (!inode) |
4321 |
+- return NULL; |
4322 |
+- if (inode->i_state & I_NEW) { |
4323 |
++ if (inode) { |
4324 |
++ inode->i_ino = de->low_ino; |
4325 |
+ inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
4326 |
+ PROC_I(inode)->fd = 0; |
4327 |
+ PROC_I(inode)->pde = de; |
4328 |
+@@ -461,9 +459,7 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) |
4329 |
+ inode->i_fop = de->proc_fops; |
4330 |
+ } |
4331 |
+ } |
4332 |
+- unlock_new_inode(inode); |
4333 |
+- } else |
4334 |
+- pde_put(de); |
4335 |
++ } |
4336 |
+ return inode; |
4337 |
+ } |
4338 |
+ |
4339 |
+diff --git a/fs/udf/namei.c b/fs/udf/namei.c |
4340 |
+index 4639e13..71c97fb 100644 |
4341 |
+--- a/fs/udf/namei.c |
4342 |
++++ b/fs/udf/namei.c |
4343 |
+@@ -1293,6 +1293,7 @@ static int udf_encode_fh(struct dentry *de, __u32 *fh, int *lenp, |
4344 |
+ *lenp = 3; |
4345 |
+ fid->udf.block = location.logicalBlockNum; |
4346 |
+ fid->udf.partref = location.partitionReferenceNum; |
4347 |
++ fid->udf.parent_partref = 0; |
4348 |
+ fid->udf.generation = inode->i_generation; |
4349 |
+ |
4350 |
+ if (connectable && !S_ISDIR(inode->i_mode)) { |
4351 |
+diff --git a/include/asm-generic/signal.h b/include/asm-generic/signal.h |
4352 |
+index 555c0ae..743f7a5 100644 |
4353 |
+--- a/include/asm-generic/signal.h |
4354 |
++++ b/include/asm-generic/signal.h |
4355 |
+@@ -99,6 +99,10 @@ typedef unsigned long old_sigset_t; |
4356 |
+ |
4357 |
+ #include <asm-generic/signal-defs.h> |
4358 |
+ |
4359 |
++#ifdef SA_RESTORER |
4360 |
++#define __ARCH_HAS_SA_RESTORER |
4361 |
++#endif |
4362 |
++ |
4363 |
+ struct sigaction { |
4364 |
+ __sighandler_t sa_handler; |
4365 |
+ unsigned long sa_flags; |
4366 |
+diff --git a/include/linux/efi.h b/include/linux/efi.h |
4367 |
+index ce95a4b..8469f3f 100644 |
4368 |
+--- a/include/linux/efi.h |
4369 |
++++ b/include/linux/efi.h |
4370 |
+@@ -484,7 +484,8 @@ struct efivars { |
4371 |
+ * 1) ->list - adds, removals, reads, writes |
4372 |
+ * 2) ops.[gs]et_variable() calls. |
4373 |
+ * It must not be held when creating sysfs entries or calling kmalloc. |
4374 |
+- * ops.get_next_variable() is only called from register_efivars(), |
4375 |
++ * ops.get_next_variable() is only called from register_efivars() |
4376 |
++ * or efivar_update_sysfs_entries(), |
4377 |
+ * which is protected by the BKL, so that path is safe. |
4378 |
+ */ |
4379 |
+ spinlock_t lock; |
4380 |
+diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h |
4381 |
+index b669be6..9b9b2aa 100644 |
4382 |
+--- a/include/linux/perf_event.h |
4383 |
++++ b/include/linux/perf_event.h |
4384 |
+@@ -1186,6 +1186,12 @@ static inline void perf_event_disable(struct perf_event *event) { } |
4385 |
+ static inline void perf_event_task_tick(void) { } |
4386 |
+ #endif |
4387 |
+ |
4388 |
++#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL) |
4389 |
++extern void perf_restore_debug_store(void); |
4390 |
++#else |
4391 |
++static inline void perf_restore_debug_store(void) { } |
4392 |
++#endif |
4393 |
++ |
4394 |
+ #define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x)) |
4395 |
+ |
4396 |
+ /* |
4397 |
+diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h |
4398 |
+index 53dc7e7..da65890 100644 |
4399 |
+--- a/include/linux/skbuff.h |
4400 |
++++ b/include/linux/skbuff.h |
4401 |
+@@ -455,7 +455,7 @@ struct sk_buff { |
4402 |
+ union { |
4403 |
+ __u32 mark; |
4404 |
+ __u32 dropcount; |
4405 |
+- __u32 avail_size; |
4406 |
++ __u32 reserved_tailroom; |
4407 |
+ }; |
4408 |
+ |
4409 |
+ __u16 vlan_tci; |
4410 |
+@@ -1332,7 +1332,10 @@ static inline int skb_tailroom(const struct sk_buff *skb) |
4411 |
+ */ |
4412 |
+ static inline int skb_availroom(const struct sk_buff *skb) |
4413 |
+ { |
4414 |
+- return skb_is_nonlinear(skb) ? 0 : skb->avail_size - skb->len; |
4415 |
++ if (skb_is_nonlinear(skb)) |
4416 |
++ return 0; |
4417 |
++ |
4418 |
++ return skb->end - skb->tail - skb->reserved_tailroom; |
4419 |
+ } |
4420 |
+ |
4421 |
+ /** |
4422 |
+diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h |
4423 |
+index 16ff29a..b289bd2 100644 |
4424 |
+--- a/include/net/inet_frag.h |
4425 |
++++ b/include/net/inet_frag.h |
4426 |
+@@ -33,6 +33,13 @@ struct inet_frag_queue { |
4427 |
+ |
4428 |
+ #define INETFRAGS_HASHSZ 64 |
4429 |
+ |
4430 |
++/* averaged: |
4431 |
++ * max_depth = default ipfrag_high_thresh / INETFRAGS_HASHSZ / |
4432 |
++ * rounded up (SKB_TRUELEN(0) + sizeof(struct ipq or |
4433 |
++ * struct frag_queue)) |
4434 |
++ */ |
4435 |
++#define INETFRAGS_MAXDEPTH 128 |
4436 |
++ |
4437 |
+ struct inet_frags { |
4438 |
+ struct hlist_head hash[INETFRAGS_HASHSZ]; |
4439 |
+ rwlock_t lock; |
4440 |
+@@ -64,6 +71,8 @@ int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f); |
4441 |
+ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, |
4442 |
+ struct inet_frags *f, void *key, unsigned int hash) |
4443 |
+ __releases(&f->lock); |
4444 |
++void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q, |
4445 |
++ const char *prefix); |
4446 |
+ |
4447 |
+ static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) |
4448 |
+ { |
4449 |
+diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h |
4450 |
+index 10422ef..2124004 100644 |
4451 |
+--- a/include/net/ip_fib.h |
4452 |
++++ b/include/net/ip_fib.h |
4453 |
+@@ -129,18 +129,16 @@ struct fib_result_nl { |
4454 |
+ }; |
4455 |
+ |
4456 |
+ #ifdef CONFIG_IP_ROUTE_MULTIPATH |
4457 |
+- |
4458 |
+ #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) |
4459 |
+- |
4460 |
+-#define FIB_TABLE_HASHSZ 2 |
4461 |
+- |
4462 |
+ #else /* CONFIG_IP_ROUTE_MULTIPATH */ |
4463 |
+- |
4464 |
+ #define FIB_RES_NH(res) ((res).fi->fib_nh[0]) |
4465 |
++#endif /* CONFIG_IP_ROUTE_MULTIPATH */ |
4466 |
+ |
4467 |
++#ifdef CONFIG_IP_MULTIPLE_TABLES |
4468 |
+ #define FIB_TABLE_HASHSZ 256 |
4469 |
+- |
4470 |
+-#endif /* CONFIG_IP_ROUTE_MULTIPATH */ |
4471 |
++#else |
4472 |
++#define FIB_TABLE_HASHSZ 2 |
4473 |
++#endif |
4474 |
+ |
4475 |
+ extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh); |
4476 |
+ |
4477 |
+diff --git a/kernel/signal.c b/kernel/signal.c |
4478 |
+index 71e1816..ea76d30 100644 |
4479 |
+--- a/kernel/signal.c |
4480 |
++++ b/kernel/signal.c |
4481 |
+@@ -481,7 +481,7 @@ flush_signal_handlers(struct task_struct *t, int force_default) |
4482 |
+ if (force_default || ka->sa.sa_handler != SIG_IGN) |
4483 |
+ ka->sa.sa_handler = SIG_DFL; |
4484 |
+ ka->sa.sa_flags = 0; |
4485 |
+-#ifdef SA_RESTORER |
4486 |
++#ifdef __ARCH_HAS_SA_RESTORER |
4487 |
+ ka->sa.sa_restorer = NULL; |
4488 |
+ #endif |
4489 |
+ sigemptyset(&ka->sa.sa_mask); |
4490 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
4491 |
+index 6c880e8..0943d2a 100644 |
4492 |
+--- a/kernel/trace/ftrace.c |
4493 |
++++ b/kernel/trace/ftrace.c |
4494 |
+@@ -2725,8 +2725,8 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, |
4495 |
+ continue; |
4496 |
+ } |
4497 |
+ |
4498 |
+- hlist_del(&entry->node); |
4499 |
+- call_rcu(&entry->rcu, ftrace_free_entry_rcu); |
4500 |
++ hlist_del_rcu(&entry->node); |
4501 |
++ call_rcu_sched(&entry->rcu, ftrace_free_entry_rcu); |
4502 |
+ } |
4503 |
+ } |
4504 |
+ __disable_ftrace_function_probe(); |
4505 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
4506 |
+index 5638104..17edb14 100644 |
4507 |
+--- a/kernel/trace/trace.c |
4508 |
++++ b/kernel/trace/trace.c |
4509 |
+@@ -652,7 +652,7 @@ __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) |
4510 |
+ void |
4511 |
+ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) |
4512 |
+ { |
4513 |
+- struct ring_buffer *buf = tr->buffer; |
4514 |
++ struct ring_buffer *buf; |
4515 |
+ |
4516 |
+ if (trace_stop_count) |
4517 |
+ return; |
4518 |
+@@ -664,6 +664,7 @@ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) |
4519 |
+ } |
4520 |
+ arch_spin_lock(&ftrace_max_lock); |
4521 |
+ |
4522 |
++ buf = tr->buffer; |
4523 |
+ tr->buffer = max_tr.buffer; |
4524 |
+ max_tr.buffer = buf; |
4525 |
+ |
4526 |
+@@ -2635,11 +2636,25 @@ static int set_tracer_option(struct tracer *trace, char *cmp, int neg) |
4527 |
+ return -EINVAL; |
4528 |
+ } |
4529 |
+ |
4530 |
+-static void set_tracer_flags(unsigned int mask, int enabled) |
4531 |
++/* Some tracers require overwrite to stay enabled */ |
4532 |
++int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set) |
4533 |
++{ |
4534 |
++ if (tracer->enabled && (mask & TRACE_ITER_OVERWRITE) && !set) |
4535 |
++ return -1; |
4536 |
++ |
4537 |
++ return 0; |
4538 |
++} |
4539 |
++ |
4540 |
++int set_tracer_flag(unsigned int mask, int enabled) |
4541 |
+ { |
4542 |
+ /* do nothing if flag is already set */ |
4543 |
+ if (!!(trace_flags & mask) == !!enabled) |
4544 |
+- return; |
4545 |
++ return 0; |
4546 |
++ |
4547 |
++ /* Give the tracer a chance to approve the change */ |
4548 |
++ if (current_trace->flag_changed) |
4549 |
++ if (current_trace->flag_changed(current_trace, mask, !!enabled)) |
4550 |
++ return -EINVAL; |
4551 |
+ |
4552 |
+ if (enabled) |
4553 |
+ trace_flags |= mask; |
4554 |
+@@ -2649,8 +2664,14 @@ static void set_tracer_flags(unsigned int mask, int enabled) |
4555 |
+ if (mask == TRACE_ITER_RECORD_CMD) |
4556 |
+ trace_event_enable_cmd_record(enabled); |
4557 |
+ |
4558 |
+- if (mask == TRACE_ITER_OVERWRITE) |
4559 |
++ if (mask == TRACE_ITER_OVERWRITE) { |
4560 |
+ ring_buffer_change_overwrite(global_trace.buffer, enabled); |
4561 |
++#ifdef CONFIG_TRACER_MAX_TRACE |
4562 |
++ ring_buffer_change_overwrite(max_tr.buffer, enabled); |
4563 |
++#endif |
4564 |
++ } |
4565 |
++ |
4566 |
++ return 0; |
4567 |
+ } |
4568 |
+ |
4569 |
+ static ssize_t |
4570 |
+@@ -2660,7 +2681,7 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf, |
4571 |
+ char buf[64]; |
4572 |
+ char *cmp; |
4573 |
+ int neg = 0; |
4574 |
+- int ret; |
4575 |
++ int ret = 0; |
4576 |
+ int i; |
4577 |
+ |
4578 |
+ if (cnt >= sizeof(buf)) |
4579 |
+@@ -2677,21 +2698,23 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf, |
4580 |
+ cmp += 2; |
4581 |
+ } |
4582 |
+ |
4583 |
++ mutex_lock(&trace_types_lock); |
4584 |
++ |
4585 |
+ for (i = 0; trace_options[i]; i++) { |
4586 |
+ if (strcmp(cmp, trace_options[i]) == 0) { |
4587 |
+- set_tracer_flags(1 << i, !neg); |
4588 |
++ ret = set_tracer_flag(1 << i, !neg); |
4589 |
+ break; |
4590 |
+ } |
4591 |
+ } |
4592 |
+ |
4593 |
+ /* If no option could be set, test the specific tracer options */ |
4594 |
+- if (!trace_options[i]) { |
4595 |
+- mutex_lock(&trace_types_lock); |
4596 |
++ if (!trace_options[i]) |
4597 |
+ ret = set_tracer_option(current_trace, cmp, neg); |
4598 |
+- mutex_unlock(&trace_types_lock); |
4599 |
+- if (ret) |
4600 |
+- return ret; |
4601 |
+- } |
4602 |
++ |
4603 |
++ mutex_unlock(&trace_types_lock); |
4604 |
++ |
4605 |
++ if (ret) |
4606 |
++ return ret; |
4607 |
+ |
4608 |
+ *ppos += cnt; |
4609 |
+ |
4610 |
+@@ -3015,6 +3038,9 @@ static int tracing_set_tracer(const char *buf) |
4611 |
+ goto out; |
4612 |
+ |
4613 |
+ trace_branch_disable(); |
4614 |
++ |
4615 |
++ current_trace->enabled = false; |
4616 |
++ |
4617 |
+ if (current_trace && current_trace->reset) |
4618 |
+ current_trace->reset(tr); |
4619 |
+ if (current_trace && current_trace->use_max_tr) { |
4620 |
+@@ -3044,6 +3070,7 @@ static int tracing_set_tracer(const char *buf) |
4621 |
+ goto out; |
4622 |
+ } |
4623 |
+ |
4624 |
++ current_trace->enabled = true; |
4625 |
+ trace_branch_enable(tr); |
4626 |
+ out: |
4627 |
+ mutex_unlock(&trace_types_lock); |
4628 |
+@@ -4378,7 +4405,13 @@ trace_options_core_write(struct file *filp, const char __user *ubuf, size_t cnt, |
4629 |
+ |
4630 |
+ if (val != 0 && val != 1) |
4631 |
+ return -EINVAL; |
4632 |
+- set_tracer_flags(1 << index, val); |
4633 |
++ |
4634 |
++ mutex_lock(&trace_types_lock); |
4635 |
++ ret = set_tracer_flag(1 << index, val); |
4636 |
++ mutex_unlock(&trace_types_lock); |
4637 |
++ |
4638 |
++ if (ret < 0) |
4639 |
++ return ret; |
4640 |
+ |
4641 |
+ *ppos += cnt; |
4642 |
+ |
4643 |
+diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h |
4644 |
+index 092e1f8..c3c3f6b 100644 |
4645 |
+--- a/kernel/trace/trace.h |
4646 |
++++ b/kernel/trace/trace.h |
4647 |
+@@ -271,10 +271,14 @@ struct tracer { |
4648 |
+ enum print_line_t (*print_line)(struct trace_iterator *iter); |
4649 |
+ /* If you handled the flag setting, return 0 */ |
4650 |
+ int (*set_flag)(u32 old_flags, u32 bit, int set); |
4651 |
++ /* Return 0 if OK with change, else return non-zero */ |
4652 |
++ int (*flag_changed)(struct tracer *tracer, |
4653 |
++ u32 mask, int set); |
4654 |
+ struct tracer *next; |
4655 |
+ struct tracer_flags *flags; |
4656 |
+ int print_max; |
4657 |
+ int use_max_tr; |
4658 |
++ bool enabled; |
4659 |
+ }; |
4660 |
+ |
4661 |
+ |
4662 |
+@@ -815,6 +819,9 @@ extern struct list_head ftrace_events; |
4663 |
+ extern const char *__start___trace_bprintk_fmt[]; |
4664 |
+ extern const char *__stop___trace_bprintk_fmt[]; |
4665 |
+ |
4666 |
++int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set); |
4667 |
++int set_tracer_flag(unsigned int mask, int enabled); |
4668 |
++ |
4669 |
+ #undef FTRACE_ENTRY |
4670 |
+ #define FTRACE_ENTRY(call, struct_name, id, tstruct, print) \ |
4671 |
+ extern struct ftrace_event_call \ |
4672 |
+diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c |
4673 |
+index 20dad0d..1626e1a 100644 |
4674 |
+--- a/kernel/trace/trace_irqsoff.c |
4675 |
++++ b/kernel/trace/trace_irqsoff.c |
4676 |
+@@ -32,7 +32,7 @@ enum { |
4677 |
+ |
4678 |
+ static int trace_type __read_mostly; |
4679 |
+ |
4680 |
+-static int save_lat_flag; |
4681 |
++static int save_flags; |
4682 |
+ |
4683 |
+ static void stop_irqsoff_tracer(struct trace_array *tr, int graph); |
4684 |
+ static int start_irqsoff_tracer(struct trace_array *tr, int graph); |
4685 |
+@@ -546,8 +546,11 @@ static void stop_irqsoff_tracer(struct trace_array *tr, int graph) |
4686 |
+ |
4687 |
+ static void __irqsoff_tracer_init(struct trace_array *tr) |
4688 |
+ { |
4689 |
+- save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT; |
4690 |
+- trace_flags |= TRACE_ITER_LATENCY_FMT; |
4691 |
++ save_flags = trace_flags; |
4692 |
++ |
4693 |
++ /* non overwrite screws up the latency tracers */ |
4694 |
++ set_tracer_flag(TRACE_ITER_OVERWRITE, 1); |
4695 |
++ set_tracer_flag(TRACE_ITER_LATENCY_FMT, 1); |
4696 |
+ |
4697 |
+ tracing_max_latency = 0; |
4698 |
+ irqsoff_trace = tr; |
4699 |
+@@ -561,10 +564,13 @@ static void __irqsoff_tracer_init(struct trace_array *tr) |
4700 |
+ |
4701 |
+ static void irqsoff_tracer_reset(struct trace_array *tr) |
4702 |
+ { |
4703 |
++ int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT; |
4704 |
++ int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE; |
4705 |
++ |
4706 |
+ stop_irqsoff_tracer(tr, is_graph()); |
4707 |
+ |
4708 |
+- if (!save_lat_flag) |
4709 |
+- trace_flags &= ~TRACE_ITER_LATENCY_FMT; |
4710 |
++ set_tracer_flag(TRACE_ITER_LATENCY_FMT, lat_flag); |
4711 |
++ set_tracer_flag(TRACE_ITER_OVERWRITE, overwrite_flag); |
4712 |
+ } |
4713 |
+ |
4714 |
+ static void irqsoff_tracer_start(struct trace_array *tr) |
4715 |
+@@ -597,6 +603,7 @@ static struct tracer irqsoff_tracer __read_mostly = |
4716 |
+ .print_line = irqsoff_print_line, |
4717 |
+ .flags = &tracer_flags, |
4718 |
+ .set_flag = irqsoff_set_flag, |
4719 |
++ .flag_changed = trace_keep_overwrite, |
4720 |
+ #ifdef CONFIG_FTRACE_SELFTEST |
4721 |
+ .selftest = trace_selftest_startup_irqsoff, |
4722 |
+ #endif |
4723 |
+@@ -630,6 +637,7 @@ static struct tracer preemptoff_tracer __read_mostly = |
4724 |
+ .print_line = irqsoff_print_line, |
4725 |
+ .flags = &tracer_flags, |
4726 |
+ .set_flag = irqsoff_set_flag, |
4727 |
++ .flag_changed = trace_keep_overwrite, |
4728 |
+ #ifdef CONFIG_FTRACE_SELFTEST |
4729 |
+ .selftest = trace_selftest_startup_preemptoff, |
4730 |
+ #endif |
4731 |
+@@ -665,6 +673,7 @@ static struct tracer preemptirqsoff_tracer __read_mostly = |
4732 |
+ .print_line = irqsoff_print_line, |
4733 |
+ .flags = &tracer_flags, |
4734 |
+ .set_flag = irqsoff_set_flag, |
4735 |
++ .flag_changed = trace_keep_overwrite, |
4736 |
+ #ifdef CONFIG_FTRACE_SELFTEST |
4737 |
+ .selftest = trace_selftest_startup_preemptirqsoff, |
4738 |
+ #endif |
4739 |
+diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c |
4740 |
+index e4a70c0..6857e0c 100644 |
4741 |
+--- a/kernel/trace/trace_sched_wakeup.c |
4742 |
++++ b/kernel/trace/trace_sched_wakeup.c |
4743 |
+@@ -36,7 +36,7 @@ static void __wakeup_reset(struct trace_array *tr); |
4744 |
+ static int wakeup_graph_entry(struct ftrace_graph_ent *trace); |
4745 |
+ static void wakeup_graph_return(struct ftrace_graph_ret *trace); |
4746 |
+ |
4747 |
+-static int save_lat_flag; |
4748 |
++static int save_flags; |
4749 |
+ |
4750 |
+ #define TRACE_DISPLAY_GRAPH 1 |
4751 |
+ |
4752 |
+@@ -528,8 +528,11 @@ static void stop_wakeup_tracer(struct trace_array *tr) |
4753 |
+ |
4754 |
+ static int __wakeup_tracer_init(struct trace_array *tr) |
4755 |
+ { |
4756 |
+- save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT; |
4757 |
+- trace_flags |= TRACE_ITER_LATENCY_FMT; |
4758 |
++ save_flags = trace_flags; |
4759 |
++ |
4760 |
++ /* non overwrite screws up the latency tracers */ |
4761 |
++ set_tracer_flag(TRACE_ITER_OVERWRITE, 1); |
4762 |
++ set_tracer_flag(TRACE_ITER_LATENCY_FMT, 1); |
4763 |
+ |
4764 |
+ tracing_max_latency = 0; |
4765 |
+ wakeup_trace = tr; |
4766 |
+@@ -551,12 +554,15 @@ static int wakeup_rt_tracer_init(struct trace_array *tr) |
4767 |
+ |
4768 |
+ static void wakeup_tracer_reset(struct trace_array *tr) |
4769 |
+ { |
4770 |
++ int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT; |
4771 |
++ int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE; |
4772 |
++ |
4773 |
+ stop_wakeup_tracer(tr); |
4774 |
+ /* make sure we put back any tasks we are tracing */ |
4775 |
+ wakeup_reset(tr); |
4776 |
+ |
4777 |
+- if (!save_lat_flag) |
4778 |
+- trace_flags &= ~TRACE_ITER_LATENCY_FMT; |
4779 |
++ set_tracer_flag(TRACE_ITER_LATENCY_FMT, lat_flag); |
4780 |
++ set_tracer_flag(TRACE_ITER_OVERWRITE, overwrite_flag); |
4781 |
+ } |
4782 |
+ |
4783 |
+ static void wakeup_tracer_start(struct trace_array *tr) |
4784 |
+@@ -582,6 +588,7 @@ static struct tracer wakeup_tracer __read_mostly = |
4785 |
+ .print_line = wakeup_print_line, |
4786 |
+ .flags = &tracer_flags, |
4787 |
+ .set_flag = wakeup_set_flag, |
4788 |
++ .flag_changed = trace_keep_overwrite, |
4789 |
+ #ifdef CONFIG_FTRACE_SELFTEST |
4790 |
+ .selftest = trace_selftest_startup_wakeup, |
4791 |
+ #endif |
4792 |
+@@ -603,6 +610,7 @@ static struct tracer wakeup_rt_tracer __read_mostly = |
4793 |
+ .print_line = wakeup_print_line, |
4794 |
+ .flags = &tracer_flags, |
4795 |
+ .set_flag = wakeup_set_flag, |
4796 |
++ .flag_changed = trace_keep_overwrite, |
4797 |
+ #ifdef CONFIG_FTRACE_SELFTEST |
4798 |
+ .selftest = trace_selftest_startup_wakeup, |
4799 |
+ #endif |
4800 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
4801 |
+index d6c0fdf..4c7d42a 100644 |
4802 |
+--- a/mm/hugetlb.c |
4803 |
++++ b/mm/hugetlb.c |
4804 |
+@@ -2092,8 +2092,12 @@ int hugetlb_report_node_meminfo(int nid, char *buf) |
4805 |
+ /* Return the number pages of memory we physically have, in PAGE_SIZE units. */ |
4806 |
+ unsigned long hugetlb_total_pages(void) |
4807 |
+ { |
4808 |
+- struct hstate *h = &default_hstate; |
4809 |
+- return h->nr_huge_pages * pages_per_huge_page(h); |
4810 |
++ struct hstate *h; |
4811 |
++ unsigned long nr_total_pages = 0; |
4812 |
++ |
4813 |
++ for_each_hstate(h) |
4814 |
++ nr_total_pages += h->nr_huge_pages * pages_per_huge_page(h); |
4815 |
++ return nr_total_pages; |
4816 |
+ } |
4817 |
+ |
4818 |
+ static int hugetlb_acct_memory(struct hstate *h, long delta) |
4819 |
+diff --git a/net/core/dev.c b/net/core/dev.c |
4820 |
+index 2aac4ec..b23bbbf 100644 |
4821 |
+--- a/net/core/dev.c |
4822 |
++++ b/net/core/dev.c |
4823 |
+@@ -3299,6 +3299,7 @@ ncls: |
4824 |
+ } |
4825 |
+ switch (rx_handler(&skb)) { |
4826 |
+ case RX_HANDLER_CONSUMED: |
4827 |
++ ret = NET_RX_SUCCESS; |
4828 |
+ goto out; |
4829 |
+ case RX_HANDLER_ANOTHER: |
4830 |
+ goto another_round; |
4831 |
+diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c |
4832 |
+index 5229c7f..3b5e680 100644 |
4833 |
+--- a/net/core/rtnetlink.c |
4834 |
++++ b/net/core/rtnetlink.c |
4835 |
+@@ -973,6 +973,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, |
4836 |
+ * report anything. |
4837 |
+ */ |
4838 |
+ ivi.spoofchk = -1; |
4839 |
++ memset(ivi.mac, 0, sizeof(ivi.mac)); |
4840 |
+ if (dev->netdev_ops->ndo_get_vf_config(dev, i, &ivi)) |
4841 |
+ break; |
4842 |
+ vf_mac.vf = |
4843 |
+@@ -2041,7 +2042,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
4844 |
+ struct rtattr *attr = (void *)nlh + NLMSG_ALIGN(min_len); |
4845 |
+ |
4846 |
+ while (RTA_OK(attr, attrlen)) { |
4847 |
+- unsigned flavor = attr->rta_type; |
4848 |
++ unsigned int flavor = attr->rta_type & NLA_TYPE_MASK; |
4849 |
+ if (flavor) { |
4850 |
+ if (flavor > rta_max[sz_idx]) |
4851 |
+ return -EINVAL; |
4852 |
+diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c |
4853 |
+index d860530..2f9517d 100644 |
4854 |
+--- a/net/dcb/dcbnl.c |
4855 |
++++ b/net/dcb/dcbnl.c |
4856 |
+@@ -336,6 +336,7 @@ static int dcbnl_getperm_hwaddr(struct net_device *netdev, struct nlattr **tb, |
4857 |
+ dcb->dcb_family = AF_UNSPEC; |
4858 |
+ dcb->cmd = DCB_CMD_GPERM_HWADDR; |
4859 |
+ |
4860 |
++ memset(perm_addr, 0, sizeof(perm_addr)); |
4861 |
+ netdev->dcbnl_ops->getpermhwaddr(netdev, perm_addr); |
4862 |
+ |
4863 |
+ ret = nla_put(dcbnl_skb, DCB_ATTR_PERM_HWADDR, sizeof(perm_addr), |
4864 |
+@@ -1238,6 +1239,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) |
4865 |
+ |
4866 |
+ if (ops->ieee_getets) { |
4867 |
+ struct ieee_ets ets; |
4868 |
++ memset(&ets, 0, sizeof(ets)); |
4869 |
+ err = ops->ieee_getets(netdev, &ets); |
4870 |
+ if (!err) |
4871 |
+ NLA_PUT(skb, DCB_ATTR_IEEE_ETS, sizeof(ets), &ets); |
4872 |
+@@ -1245,6 +1247,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) |
4873 |
+ |
4874 |
+ if (ops->ieee_getpfc) { |
4875 |
+ struct ieee_pfc pfc; |
4876 |
++ memset(&pfc, 0, sizeof(pfc)); |
4877 |
+ err = ops->ieee_getpfc(netdev, &pfc); |
4878 |
+ if (!err) |
4879 |
+ NLA_PUT(skb, DCB_ATTR_IEEE_PFC, sizeof(pfc), &pfc); |
4880 |
+@@ -1277,6 +1280,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) |
4881 |
+ /* get peer info if available */ |
4882 |
+ if (ops->ieee_peer_getets) { |
4883 |
+ struct ieee_ets ets; |
4884 |
++ memset(&ets, 0, sizeof(ets)); |
4885 |
+ err = ops->ieee_peer_getets(netdev, &ets); |
4886 |
+ if (!err) |
4887 |
+ NLA_PUT(skb, DCB_ATTR_IEEE_PEER_ETS, sizeof(ets), &ets); |
4888 |
+@@ -1284,6 +1288,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) |
4889 |
+ |
4890 |
+ if (ops->ieee_peer_getpfc) { |
4891 |
+ struct ieee_pfc pfc; |
4892 |
++ memset(&pfc, 0, sizeof(pfc)); |
4893 |
+ err = ops->ieee_peer_getpfc(netdev, &pfc); |
4894 |
+ if (!err) |
4895 |
+ NLA_PUT(skb, DCB_ATTR_IEEE_PEER_PFC, sizeof(pfc), &pfc); |
4896 |
+@@ -1463,6 +1468,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev) |
4897 |
+ /* peer info if available */ |
4898 |
+ if (ops->cee_peer_getpg) { |
4899 |
+ struct cee_pg pg; |
4900 |
++ memset(&pg, 0, sizeof(pg)); |
4901 |
+ err = ops->cee_peer_getpg(netdev, &pg); |
4902 |
+ if (!err) |
4903 |
+ NLA_PUT(skb, DCB_ATTR_CEE_PEER_PG, sizeof(pg), &pg); |
4904 |
+@@ -1470,6 +1476,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev) |
4905 |
+ |
4906 |
+ if (ops->cee_peer_getpfc) { |
4907 |
+ struct cee_pfc pfc; |
4908 |
++ memset(&pfc, 0, sizeof(pfc)); |
4909 |
+ err = ops->cee_peer_getpfc(netdev, &pfc); |
4910 |
+ if (!err) |
4911 |
+ NLA_PUT(skb, DCB_ATTR_CEE_PEER_PFC, sizeof(pfc), &pfc); |
4912 |
+diff --git a/net/ieee802154/6lowpan.h b/net/ieee802154/6lowpan.h |
4913 |
+index 5d8cf80..8b0866f 100644 |
4914 |
+--- a/net/ieee802154/6lowpan.h |
4915 |
++++ b/net/ieee802154/6lowpan.h |
4916 |
+@@ -87,7 +87,7 @@ |
4917 |
+ (memcmp(addr1, addr2, length >> 3) == 0) |
4918 |
+ |
4919 |
+ /* local link, i.e. FE80::/10 */ |
4920 |
+-#define is_addr_link_local(a) (((a)->s6_addr16[0]) == 0x80FE) |
4921 |
++#define is_addr_link_local(a) (((a)->s6_addr16[0]) == htons(0xFE80)) |
4922 |
+ |
4923 |
+ /* |
4924 |
+ * check whether we can compress the IID to 16 bits, |
4925 |
+diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c |
4926 |
+index 5ff2a51..210b710 100644 |
4927 |
+--- a/net/ipv4/inet_fragment.c |
4928 |
++++ b/net/ipv4/inet_fragment.c |
4929 |
+@@ -21,6 +21,7 @@ |
4930 |
+ #include <linux/rtnetlink.h> |
4931 |
+ #include <linux/slab.h> |
4932 |
+ |
4933 |
++#include <net/sock.h> |
4934 |
+ #include <net/inet_frag.h> |
4935 |
+ |
4936 |
+ static void inet_frag_secret_rebuild(unsigned long dummy) |
4937 |
+@@ -271,6 +272,7 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, |
4938 |
+ { |
4939 |
+ struct inet_frag_queue *q; |
4940 |
+ struct hlist_node *n; |
4941 |
++ int depth = 0; |
4942 |
+ |
4943 |
+ hlist_for_each_entry(q, n, &f->hash[hash], list) { |
4944 |
+ if (q->net == nf && f->match(q, key)) { |
4945 |
+@@ -278,9 +280,25 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, |
4946 |
+ read_unlock(&f->lock); |
4947 |
+ return q; |
4948 |
+ } |
4949 |
++ depth++; |
4950 |
+ } |
4951 |
+ read_unlock(&f->lock); |
4952 |
+ |
4953 |
+- return inet_frag_create(nf, f, key); |
4954 |
++ if (depth <= INETFRAGS_MAXDEPTH) |
4955 |
++ return inet_frag_create(nf, f, key); |
4956 |
++ else |
4957 |
++ return ERR_PTR(-ENOBUFS); |
4958 |
+ } |
4959 |
+ EXPORT_SYMBOL(inet_frag_find); |
4960 |
++ |
4961 |
++void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q, |
4962 |
++ const char *prefix) |
4963 |
++{ |
4964 |
++ static const char msg[] = "inet_frag_find: Fragment hash bucket" |
4965 |
++ " list length grew over limit " __stringify(INETFRAGS_MAXDEPTH) |
4966 |
++ ". Dropping fragment.\n"; |
4967 |
++ |
4968 |
++ if (PTR_ERR(q) == -ENOBUFS) |
4969 |
++ LIMIT_NETDEBUG(KERN_WARNING "%s%s", prefix, msg); |
4970 |
++} |
4971 |
++EXPORT_SYMBOL(inet_frag_maybe_warn_overflow); |
4972 |
+diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c |
4973 |
+index a4e7131..b2cfe83 100644 |
4974 |
+--- a/net/ipv4/ip_fragment.c |
4975 |
++++ b/net/ipv4/ip_fragment.c |
4976 |
+@@ -20,6 +20,8 @@ |
4977 |
+ * Patrick McHardy : LRU queue of frag heads for evictor. |
4978 |
+ */ |
4979 |
+ |
4980 |
++#define pr_fmt(fmt) "IPv4: " fmt |
4981 |
++ |
4982 |
+ #include <linux/compiler.h> |
4983 |
+ #include <linux/module.h> |
4984 |
+ #include <linux/types.h> |
4985 |
+@@ -293,14 +295,12 @@ static inline struct ipq *ip_find(struct net *net, struct iphdr *iph, u32 user) |
4986 |
+ hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol); |
4987 |
+ |
4988 |
+ q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash); |
4989 |
+- if (q == NULL) |
4990 |
+- goto out_nomem; |
4991 |
++ if (IS_ERR_OR_NULL(q)) { |
4992 |
++ inet_frag_maybe_warn_overflow(q, pr_fmt()); |
4993 |
++ return NULL; |
4994 |
++ } |
4995 |
+ |
4996 |
+ return container_of(q, struct ipq, q); |
4997 |
+- |
4998 |
+-out_nomem: |
4999 |
+- LIMIT_NETDEBUG(KERN_ERR "ip_frag_create: no memory left !\n"); |
5000 |
+- return NULL; |
5001 |
+ } |
5002 |
+ |
5003 |
+ /* Is the fragment too far ahead to be part of ipq? */ |
5004 |
+diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c |
5005 |
+index 42dd1a9..40eb4fc 100644 |
5006 |
+--- a/net/ipv4/ip_options.c |
5007 |
++++ b/net/ipv4/ip_options.c |
5008 |
+@@ -358,7 +358,6 @@ int ip_options_compile(struct net *net, |
5009 |
+ } |
5010 |
+ switch (optptr[3]&0xF) { |
5011 |
+ case IPOPT_TS_TSONLY: |
5012 |
+- opt->ts = optptr - iph; |
5013 |
+ if (skb) |
5014 |
+ timeptr = &optptr[optptr[2]-1]; |
5015 |
+ opt->ts_needtime = 1; |
5016 |
+@@ -369,7 +368,6 @@ int ip_options_compile(struct net *net, |
5017 |
+ pp_ptr = optptr + 2; |
5018 |
+ goto error; |
5019 |
+ } |
5020 |
+- opt->ts = optptr - iph; |
5021 |
+ if (rt) { |
5022 |
+ memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4); |
5023 |
+ timeptr = &optptr[optptr[2]+3]; |
5024 |
+@@ -383,7 +381,6 @@ int ip_options_compile(struct net *net, |
5025 |
+ pp_ptr = optptr + 2; |
5026 |
+ goto error; |
5027 |
+ } |
5028 |
+- opt->ts = optptr - iph; |
5029 |
+ { |
5030 |
+ __be32 addr; |
5031 |
+ memcpy(&addr, &optptr[optptr[2]-1], 4); |
5032 |
+@@ -416,12 +413,12 @@ int ip_options_compile(struct net *net, |
5033 |
+ pp_ptr = optptr + 3; |
5034 |
+ goto error; |
5035 |
+ } |
5036 |
+- opt->ts = optptr - iph; |
5037 |
+ if (skb) { |
5038 |
+ optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4); |
5039 |
+ opt->is_changed = 1; |
5040 |
+ } |
5041 |
+ } |
5042 |
++ opt->ts = optptr - iph; |
5043 |
+ break; |
5044 |
+ case IPOPT_RA: |
5045 |
+ if (optlen < 4) { |
5046 |
+diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c |
5047 |
+index 52edbb8..fe381c2 100644 |
5048 |
+--- a/net/ipv4/tcp.c |
5049 |
++++ b/net/ipv4/tcp.c |
5050 |
+@@ -704,7 +704,7 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp) |
5051 |
+ * Make sure that we have exactly size bytes |
5052 |
+ * available to the caller, no more, no less. |
5053 |
+ */ |
5054 |
+- skb->avail_size = size; |
5055 |
++ skb->reserved_tailroom = skb->end - skb->tail - size; |
5056 |
+ return skb; |
5057 |
+ } |
5058 |
+ __kfree_skb(skb); |
5059 |
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
5060 |
+index e865ed1..1b1f7af 100644 |
5061 |
+--- a/net/ipv4/tcp_input.c |
5062 |
++++ b/net/ipv4/tcp_input.c |
5063 |
+@@ -5494,6 +5494,9 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, |
5064 |
+ if (tcp_checksum_complete_user(sk, skb)) |
5065 |
+ goto csum_error; |
5066 |
+ |
5067 |
++ if ((int)skb->truesize > sk->sk_forward_alloc) |
5068 |
++ goto step5; |
5069 |
++ |
5070 |
+ /* Predicted packet is in window by definition. |
5071 |
+ * seq == rcv_nxt and rcv_wup <= rcv_nxt. |
5072 |
+ * Hence, check seq<=rcv_wup reduces to: |
5073 |
+@@ -5505,9 +5508,6 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, |
5074 |
+ |
5075 |
+ tcp_rcv_rtt_measure_ts(sk, skb); |
5076 |
+ |
5077 |
+- if ((int)skb->truesize > sk->sk_forward_alloc) |
5078 |
+- goto step5; |
5079 |
+- |
5080 |
+ NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPHPHITS); |
5081 |
+ |
5082 |
+ /* Bulk data transfer: receiver */ |
5083 |
+diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c |
5084 |
+index 921cbac..9bb7400 100644 |
5085 |
+--- a/net/ipv4/tcp_output.c |
5086 |
++++ b/net/ipv4/tcp_output.c |
5087 |
+@@ -1096,7 +1096,6 @@ static void __pskb_trim_head(struct sk_buff *skb, int len) |
5088 |
+ eat = min_t(int, len, skb_headlen(skb)); |
5089 |
+ if (eat) { |
5090 |
+ __skb_pull(skb, eat); |
5091 |
+- skb->avail_size -= eat; |
5092 |
+ len -= eat; |
5093 |
+ if (!len) |
5094 |
+ return; |
5095 |
+diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c |
5096 |
+index a46c64e..f8d24dd 100644 |
5097 |
+--- a/net/ipv6/ip6_input.c |
5098 |
++++ b/net/ipv6/ip6_input.c |
5099 |
+@@ -265,7 +265,8 @@ int ip6_mc_input(struct sk_buff *skb) |
5100 |
+ * IPv6 multicast router mode is now supported ;) |
5101 |
+ */ |
5102 |
+ if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding && |
5103 |
+- !(ipv6_addr_type(&hdr->daddr) & IPV6_ADDR_LINKLOCAL) && |
5104 |
++ !(ipv6_addr_type(&hdr->daddr) & |
5105 |
++ (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL)) && |
5106 |
+ likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) { |
5107 |
+ /* |
5108 |
+ * Okay, we try to forward - split and duplicate |
5109 |
+diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c |
5110 |
+index 38f00b0..52e2f65 100644 |
5111 |
+--- a/net/ipv6/netfilter/nf_conntrack_reasm.c |
5112 |
++++ b/net/ipv6/netfilter/nf_conntrack_reasm.c |
5113 |
+@@ -14,6 +14,8 @@ |
5114 |
+ * 2 of the License, or (at your option) any later version. |
5115 |
+ */ |
5116 |
+ |
5117 |
++#define pr_fmt(fmt) "IPv6-nf: " fmt |
5118 |
++ |
5119 |
+ #include <linux/errno.h> |
5120 |
+ #include <linux/types.h> |
5121 |
+ #include <linux/string.h> |
5122 |
+@@ -176,13 +178,12 @@ fq_find(__be32 id, u32 user, struct in6_addr *src, struct in6_addr *dst) |
5123 |
+ |
5124 |
+ q = inet_frag_find(&nf_init_frags, &nf_frags, &arg, hash); |
5125 |
+ local_bh_enable(); |
5126 |
+- if (q == NULL) |
5127 |
+- goto oom; |
5128 |
++ if (IS_ERR_OR_NULL(q)) { |
5129 |
++ inet_frag_maybe_warn_overflow(q, pr_fmt()); |
5130 |
++ return NULL; |
5131 |
++ } |
5132 |
+ |
5133 |
+ return container_of(q, struct nf_ct_frag6_queue, q); |
5134 |
+- |
5135 |
+-oom: |
5136 |
+- return NULL; |
5137 |
+ } |
5138 |
+ |
5139 |
+ |
5140 |
+diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c |
5141 |
+index dfb164e..2b0a4ca 100644 |
5142 |
+--- a/net/ipv6/reassembly.c |
5143 |
++++ b/net/ipv6/reassembly.c |
5144 |
+@@ -26,6 +26,9 @@ |
5145 |
+ * YOSHIFUJI,H. @USAGI Always remove fragment header to |
5146 |
+ * calculate ICV correctly. |
5147 |
+ */ |
5148 |
++ |
5149 |
++#define pr_fmt(fmt) "IPv6: " fmt |
5150 |
++ |
5151 |
+ #include <linux/errno.h> |
5152 |
+ #include <linux/types.h> |
5153 |
+ #include <linux/string.h> |
5154 |
+@@ -240,9 +243,10 @@ fq_find(struct net *net, __be32 id, const struct in6_addr *src, const struct in6 |
5155 |
+ hash = inet6_hash_frag(id, src, dst, ip6_frags.rnd); |
5156 |
+ |
5157 |
+ q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash); |
5158 |
+- if (q == NULL) |
5159 |
++ if (IS_ERR_OR_NULL(q)) { |
5160 |
++ inet_frag_maybe_warn_overflow(q, pr_fmt()); |
5161 |
+ return NULL; |
5162 |
+- |
5163 |
++ } |
5164 |
+ return container_of(q, struct frag_queue, q); |
5165 |
+ } |
5166 |
+ |
5167 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
5168 |
+index 791c1fa..18ea73c 100644 |
5169 |
+--- a/net/ipv6/route.c |
5170 |
++++ b/net/ipv6/route.c |
5171 |
+@@ -1920,7 +1920,8 @@ void rt6_purge_dflt_routers(struct net *net) |
5172 |
+ restart: |
5173 |
+ read_lock_bh(&table->tb6_lock); |
5174 |
+ for (rt = table->tb6_root.leaf; rt; rt = rt->dst.rt6_next) { |
5175 |
+- if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) { |
5176 |
++ if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF) && |
5177 |
++ (!rt->rt6i_idev || rt->rt6i_idev->cnf.accept_ra != 2)) { |
5178 |
+ dst_hold(&rt->dst); |
5179 |
+ read_unlock_bh(&table->tb6_lock); |
5180 |
+ ip6_del_rt(rt); |
5181 |
+diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c |
5182 |
+index b1bd16f..6f60175 100644 |
5183 |
+--- a/net/l2tp/l2tp_ppp.c |
5184 |
++++ b/net/l2tp/l2tp_ppp.c |
5185 |
+@@ -360,6 +360,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh |
5186 |
+ l2tp_xmit_skb(session, skb, session->hdr_len); |
5187 |
+ |
5188 |
+ sock_put(ps->tunnel_sock); |
5189 |
++ sock_put(sk); |
5190 |
+ |
5191 |
+ return error; |
5192 |
+ |
5193 |
+diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c |
5194 |
+index d463f5a..23267b3 100644 |
5195 |
+--- a/net/netlabel/netlabel_unlabeled.c |
5196 |
++++ b/net/netlabel/netlabel_unlabeled.c |
5197 |
+@@ -1189,8 +1189,6 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb, |
5198 |
+ struct netlbl_unlhsh_walk_arg cb_arg; |
5199 |
+ u32 skip_bkt = cb->args[0]; |
5200 |
+ u32 skip_chain = cb->args[1]; |
5201 |
+- u32 skip_addr4 = cb->args[2]; |
5202 |
+- u32 skip_addr6 = cb->args[3]; |
5203 |
+ u32 iter_bkt; |
5204 |
+ u32 iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0; |
5205 |
+ struct netlbl_unlhsh_iface *iface; |
5206 |
+@@ -1215,7 +1213,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb, |
5207 |
+ continue; |
5208 |
+ netlbl_af4list_foreach_rcu(addr4, |
5209 |
+ &iface->addr4_list) { |
5210 |
+- if (iter_addr4++ < skip_addr4) |
5211 |
++ if (iter_addr4++ < cb->args[2]) |
5212 |
+ continue; |
5213 |
+ if (netlbl_unlabel_staticlist_gen( |
5214 |
+ NLBL_UNLABEL_C_STATICLIST, |
5215 |
+@@ -1231,7 +1229,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb, |
5216 |
+ #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
5217 |
+ netlbl_af6list_foreach_rcu(addr6, |
5218 |
+ &iface->addr6_list) { |
5219 |
+- if (iter_addr6++ < skip_addr6) |
5220 |
++ if (iter_addr6++ < cb->args[3]) |
5221 |
+ continue; |
5222 |
+ if (netlbl_unlabel_staticlist_gen( |
5223 |
+ NLBL_UNLABEL_C_STATICLIST, |
5224 |
+@@ -1250,10 +1248,10 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb, |
5225 |
+ |
5226 |
+ unlabel_staticlist_return: |
5227 |
+ rcu_read_unlock(); |
5228 |
+- cb->args[0] = skip_bkt; |
5229 |
+- cb->args[1] = skip_chain; |
5230 |
+- cb->args[2] = skip_addr4; |
5231 |
+- cb->args[3] = skip_addr6; |
5232 |
++ cb->args[0] = iter_bkt; |
5233 |
++ cb->args[1] = iter_chain; |
5234 |
++ cb->args[2] = iter_addr4; |
5235 |
++ cb->args[3] = iter_addr6; |
5236 |
+ return skb->len; |
5237 |
+ } |
5238 |
+ |
5239 |
+@@ -1273,12 +1271,9 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb, |
5240 |
+ { |
5241 |
+ struct netlbl_unlhsh_walk_arg cb_arg; |
5242 |
+ struct netlbl_unlhsh_iface *iface; |
5243 |
+- u32 skip_addr4 = cb->args[0]; |
5244 |
+- u32 skip_addr6 = cb->args[1]; |
5245 |
+- u32 iter_addr4 = 0; |
5246 |
++ u32 iter_addr4 = 0, iter_addr6 = 0; |
5247 |
+ struct netlbl_af4list *addr4; |
5248 |
+ #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
5249 |
+- u32 iter_addr6 = 0; |
5250 |
+ struct netlbl_af6list *addr6; |
5251 |
+ #endif |
5252 |
+ |
5253 |
+@@ -1292,7 +1287,7 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb, |
5254 |
+ goto unlabel_staticlistdef_return; |
5255 |
+ |
5256 |
+ netlbl_af4list_foreach_rcu(addr4, &iface->addr4_list) { |
5257 |
+- if (iter_addr4++ < skip_addr4) |
5258 |
++ if (iter_addr4++ < cb->args[0]) |
5259 |
+ continue; |
5260 |
+ if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF, |
5261 |
+ iface, |
5262 |
+@@ -1305,7 +1300,7 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb, |
5263 |
+ } |
5264 |
+ #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
5265 |
+ netlbl_af6list_foreach_rcu(addr6, &iface->addr6_list) { |
5266 |
+- if (iter_addr6++ < skip_addr6) |
5267 |
++ if (iter_addr6++ < cb->args[1]) |
5268 |
+ continue; |
5269 |
+ if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF, |
5270 |
+ iface, |
5271 |
+@@ -1320,8 +1315,8 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb, |
5272 |
+ |
5273 |
+ unlabel_staticlistdef_return: |
5274 |
+ rcu_read_unlock(); |
5275 |
+- cb->args[0] = skip_addr4; |
5276 |
+- cb->args[1] = skip_addr6; |
5277 |
++ cb->args[0] = iter_addr4; |
5278 |
++ cb->args[1] = iter_addr6; |
5279 |
+ return skb->len; |
5280 |
+ } |
5281 |
+ |
5282 |
+diff --git a/net/rds/message.c b/net/rds/message.c |
5283 |
+index f0a4658..aff589c 100644 |
5284 |
+--- a/net/rds/message.c |
5285 |
++++ b/net/rds/message.c |
5286 |
+@@ -197,6 +197,9 @@ struct rds_message *rds_message_alloc(unsigned int extra_len, gfp_t gfp) |
5287 |
+ { |
5288 |
+ struct rds_message *rm; |
5289 |
+ |
5290 |
++ if (extra_len > KMALLOC_MAX_SIZE - sizeof(struct rds_message)) |
5291 |
++ return NULL; |
5292 |
++ |
5293 |
+ rm = kzalloc(sizeof(struct rds_message) + extra_len, gfp); |
5294 |
+ if (!rm) |
5295 |
+ goto out; |
5296 |
+diff --git a/net/sctp/associola.c b/net/sctp/associola.c |
5297 |
+index acd2edb..3c04692 100644 |
5298 |
+--- a/net/sctp/associola.c |
5299 |
++++ b/net/sctp/associola.c |
5300 |
+@@ -1050,7 +1050,7 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc, |
5301 |
+ transports) { |
5302 |
+ |
5303 |
+ if (transport == active) |
5304 |
+- break; |
5305 |
++ continue; |
5306 |
+ list_for_each_entry(chunk, &transport->transmitted, |
5307 |
+ transmitted_list) { |
5308 |
+ if (key == chunk->subh.data_hdr->tsn) { |
5309 |
+diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c |
5310 |
+index 891f5db..cb1c430 100644 |
5311 |
+--- a/net/sctp/sm_statefuns.c |
5312 |
++++ b/net/sctp/sm_statefuns.c |
5313 |
+@@ -2044,7 +2044,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(const struct sctp_endpoint *ep, |
5314 |
+ } |
5315 |
+ |
5316 |
+ /* Delete the tempory new association. */ |
5317 |
+- sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc)); |
5318 |
++ sctp_add_cmd_sf(commands, SCTP_CMD_SET_ASOC, SCTP_ASOC(new_asoc)); |
5319 |
+ sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL()); |
5320 |
+ |
5321 |
+ /* Restore association pointer to provide SCTP command interpeter |
5322 |
+diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c |
5323 |
+index 48665ec..8ab2951 100644 |
5324 |
+--- a/security/selinux/xfrm.c |
5325 |
++++ b/security/selinux/xfrm.c |
5326 |
+@@ -310,7 +310,7 @@ int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, |
5327 |
+ |
5328 |
+ if (old_ctx) { |
5329 |
+ new_ctx = kmalloc(sizeof(*old_ctx) + old_ctx->ctx_len, |
5330 |
+- GFP_KERNEL); |
5331 |
++ GFP_ATOMIC); |
5332 |
+ if (!new_ctx) |
5333 |
+ return -ENOMEM; |
5334 |
+ |
5335 |
+diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
5336 |
+index b0187e7..7747d26 100644 |
5337 |
+--- a/sound/pci/hda/hda_codec.c |
5338 |
++++ b/sound/pci/hda/hda_codec.c |
5339 |
+@@ -2771,7 +2771,7 @@ static unsigned int convert_to_spdif_status(unsigned short val) |
5340 |
+ if (val & AC_DIG1_PROFESSIONAL) |
5341 |
+ sbits |= IEC958_AES0_PROFESSIONAL; |
5342 |
+ if (sbits & IEC958_AES0_PROFESSIONAL) { |
5343 |
+- if (sbits & AC_DIG1_EMPHASIS) |
5344 |
++ if (val & AC_DIG1_EMPHASIS) |
5345 |
+ sbits |= IEC958_AES0_PRO_EMPHASIS_5015; |
5346 |
+ } else { |
5347 |
+ if (val & AC_DIG1_EMPHASIS) |
5348 |
+diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c |
5349 |
+index c9269ce..984b5b1 100644 |
5350 |
+--- a/sound/pci/hda/patch_conexant.c |
5351 |
++++ b/sound/pci/hda/patch_conexant.c |
5352 |
+@@ -1236,7 +1236,7 @@ static int patch_cxt5045(struct hda_codec *codec) |
5353 |
+ } |
5354 |
+ |
5355 |
+ if (spec->beep_amp) |
5356 |
+- snd_hda_attach_beep_device(codec, spec->beep_amp); |
5357 |
++ snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
5358 |
+ |
5359 |
+ return 0; |
5360 |
+ } |
5361 |
+@@ -2027,7 +2027,7 @@ static int patch_cxt5051(struct hda_codec *codec) |
5362 |
+ } |
5363 |
+ |
5364 |
+ if (spec->beep_amp) |
5365 |
+- snd_hda_attach_beep_device(codec, spec->beep_amp); |
5366 |
++ snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
5367 |
+ |
5368 |
+ conexant_init_jacks(codec); |
5369 |
+ if (spec->auto_mic & AUTO_MIC_PORTB) |
5370 |
+@@ -3225,7 +3225,7 @@ static int patch_cxt5066(struct hda_codec *codec) |
5371 |
+ } |
5372 |
+ |
5373 |
+ if (spec->beep_amp) |
5374 |
+- snd_hda_attach_beep_device(codec, spec->beep_amp); |
5375 |
++ snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
5376 |
+ |
5377 |
+ return 0; |
5378 |
+ } |
5379 |
+@@ -4556,7 +4556,7 @@ static int patch_conexant_auto(struct hda_codec *codec) |
5380 |
+ spec->capture_stream = &cx_auto_pcm_analog_capture; |
5381 |
+ codec->patch_ops = cx_auto_patch_ops; |
5382 |
+ if (spec->beep_amp) |
5383 |
+- snd_hda_attach_beep_device(codec, spec->beep_amp); |
5384 |
++ snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
5385 |
+ return 0; |
5386 |
+ } |
5387 |
+ |
5388 |
+diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
5389 |
+index 9121dee..f4540bf 100644 |
5390 |
+--- a/sound/usb/mixer.c |
5391 |
++++ b/sound/usb/mixer.c |
5392 |
+@@ -711,8 +711,9 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ |
5393 |
+ case UAC2_CLOCK_SELECTOR: { |
5394 |
+ struct uac_selector_unit_descriptor *d = p1; |
5395 |
+ /* call recursively to retrieve the channel info */ |
5396 |
+- if (check_input_term(state, d->baSourceID[0], term) < 0) |
5397 |
+- return -ENODEV; |
5398 |
++ err = check_input_term(state, d->baSourceID[0], term); |
5399 |
++ if (err < 0) |
5400 |
++ return err; |
5401 |
+ term->type = d->bDescriptorSubtype << 16; /* virtual type */ |
5402 |
+ term->id = id; |
5403 |
+ term->name = uac_selector_unit_iSelector(d); |
5404 |
+@@ -1263,8 +1264,9 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void |
5405 |
+ return err; |
5406 |
+ |
5407 |
+ /* determine the input source type and name */ |
5408 |
+- if (check_input_term(state, hdr->bSourceID, &iterm) < 0) |
5409 |
+- return -EINVAL; |
5410 |
++ err = check_input_term(state, hdr->bSourceID, &iterm); |
5411 |
++ if (err < 0) |
5412 |
++ return err; |
5413 |
+ |
5414 |
+ master_bits = snd_usb_combine_bytes(bmaControls, csize); |
5415 |
+ /* master configuration quirks */ |
5416 |
+@@ -2018,7 +2020,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) |
5417 |
+ state.oterm.type = le16_to_cpu(desc->wTerminalType); |
5418 |
+ state.oterm.name = desc->iTerminal; |
5419 |
+ err = parse_audio_unit(&state, desc->bSourceID); |
5420 |
+- if (err < 0) |
5421 |
++ if (err < 0 && err != -EINVAL) |
5422 |
+ return err; |
5423 |
+ } else { /* UAC_VERSION_2 */ |
5424 |
+ struct uac2_output_terminal_descriptor *desc = p; |
5425 |
+@@ -2030,12 +2032,12 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) |
5426 |
+ state.oterm.type = le16_to_cpu(desc->wTerminalType); |
5427 |
+ state.oterm.name = desc->iTerminal; |
5428 |
+ err = parse_audio_unit(&state, desc->bSourceID); |
5429 |
+- if (err < 0) |
5430 |
++ if (err < 0 && err != -EINVAL) |
5431 |
+ return err; |
5432 |
+ |
5433 |
+ /* for UAC2, use the same approach to also add the clock selectors */ |
5434 |
+ err = parse_audio_unit(&state, desc->bCSourceID); |
5435 |
+- if (err < 0) |
5436 |
++ if (err < 0 && err != -EINVAL) |
5437 |
+ return err; |
5438 |
+ } |
5439 |
+ } |
5440 |
+diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c |
5441 |
+index 0961d88..5e19410 100644 |
5442 |
+--- a/tools/hv/hv_kvp_daemon.c |
5443 |
++++ b/tools/hv/hv_kvp_daemon.c |
5444 |
+@@ -393,13 +393,19 @@ int main(void) |
5445 |
+ len = recvfrom(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0, |
5446 |
+ addr_p, &addr_l); |
5447 |
+ |
5448 |
+- if (len < 0 || addr.nl_pid) { |
5449 |
++ if (len < 0) { |
5450 |
+ syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s", |
5451 |
+ addr.nl_pid, errno, strerror(errno)); |
5452 |
+ close(fd); |
5453 |
+ return -1; |
5454 |
+ } |
5455 |
+ |
5456 |
++ if (addr.nl_pid) { |
5457 |
++ syslog(LOG_WARNING, "Received packet from untrusted pid:%u", |
5458 |
++ addr.nl_pid); |
5459 |
++ continue; |
5460 |
++ } |
5461 |
++ |
5462 |
+ incoming_msg = (struct nlmsghdr *)kvp_recv_buffer; |
5463 |
+ incoming_cn_msg = (struct cn_msg *)NLMSG_DATA(incoming_msg); |
5464 |
+ |
5465 |
+diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c |
5466 |
+index bf54c48..6c164dc 100644 |
5467 |
+--- a/tools/perf/util/trace-event-parse.c |
5468 |
++++ b/tools/perf/util/trace-event-parse.c |
5469 |
+@@ -1582,8 +1582,6 @@ process_symbols(struct event *event, struct print_arg *arg, char **tok) |
5470 |
+ field = malloc_or_die(sizeof(*field)); |
5471 |
+ |
5472 |
+ type = process_arg(event, field, &token); |
5473 |
+- while (type == EVENT_OP) |
5474 |
+- type = process_op(event, field, &token); |
5475 |
+ if (test_type_token(type, token, EVENT_DELIM, ",")) |
5476 |
+ goto out_free; |
5477 |
+ |
5478 |
|
5479 |
Modified: genpatches-2.6/trunk/3.4/0000_README |
5480 |
=================================================================== |
5481 |
--- genpatches-2.6/trunk/3.4/0000_README 2013-03-30 11:08:52 UTC (rev 2326) |
5482 |
+++ genpatches-2.6/trunk/3.4/0000_README 2013-03-31 21:28:05 UTC (rev 2327) |
5483 |
@@ -187,6 +187,10 @@ |
5484 |
From: http://www.kernel.org |
5485 |
Desc: Linux 3.4.37 |
5486 |
|
5487 |
+Patch: 1037_linux-3.4.38.patch |
5488 |
+From: http://www.kernel.org |
5489 |
+Desc: Linux 3.4.38 |
5490 |
+ |
5491 |
Patch: 1700_correct-bnx2-firware-ver-mips.patch |
5492 |
From: https://bugs.gentoo.org/show_bug.cgi?id=424609 |
5493 |
Desc: Correct firmware version for bnx2 on mips |
5494 |
|
5495 |
Added: genpatches-2.6/trunk/3.4/1037_linux-3.4.38.patch |
5496 |
=================================================================== |
5497 |
--- genpatches-2.6/trunk/3.4/1037_linux-3.4.38.patch (rev 0) |
5498 |
+++ genpatches-2.6/trunk/3.4/1037_linux-3.4.38.patch 2013-03-31 21:28:05 UTC (rev 2327) |
5499 |
@@ -0,0 +1,2688 @@ |
5500 |
+diff --git a/Makefile b/Makefile |
5501 |
+index a9e4d61..255e00b 100644 |
5502 |
+--- a/Makefile |
5503 |
++++ b/Makefile |
5504 |
+@@ -1,6 +1,6 @@ |
5505 |
+ VERSION = 3 |
5506 |
+ PATCHLEVEL = 4 |
5507 |
+-SUBLEVEL = 37 |
5508 |
++SUBLEVEL = 38 |
5509 |
+ EXTRAVERSION = |
5510 |
+ NAME = Saber-toothed Squirrel |
5511 |
+ |
5512 |
+diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c |
5513 |
+index 0d0326f..d70b9a5 100644 |
5514 |
+--- a/arch/x86/lib/usercopy_64.c |
5515 |
++++ b/arch/x86/lib/usercopy_64.c |
5516 |
+@@ -120,10 +120,10 @@ copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest) |
5517 |
+ char c; |
5518 |
+ unsigned zero_len; |
5519 |
+ |
5520 |
+- for (; len; --len) { |
5521 |
++ for (; len; --len, to++) { |
5522 |
+ if (__get_user_nocheck(c, from++, sizeof(char))) |
5523 |
+ break; |
5524 |
+- if (__put_user_nocheck(c, to++, sizeof(char))) |
5525 |
++ if (__put_user_nocheck(c, to, sizeof(char))) |
5526 |
+ break; |
5527 |
+ } |
5528 |
+ |
5529 |
+diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
5530 |
+index 384edc6..8b77fd3 100644 |
5531 |
+--- a/drivers/gpu/drm/drm_edid.c |
5532 |
++++ b/drivers/gpu/drm/drm_edid.c |
5533 |
+@@ -836,7 +836,7 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, |
5534 |
+ unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | pt->vblank_lo; |
5535 |
+ unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) << 2 | pt->hsync_offset_lo; |
5536 |
+ unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) << 4 | pt->hsync_pulse_width_lo; |
5537 |
+- unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) >> 2 | pt->vsync_offset_pulse_width_lo >> 4; |
5538 |
++ unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) << 2 | pt->vsync_offset_pulse_width_lo >> 4; |
5539 |
+ unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 4 | (pt->vsync_offset_pulse_width_lo & 0xf); |
5540 |
+ |
5541 |
+ /* ignore tiny modes */ |
5542 |
+@@ -917,6 +917,7 @@ set_size: |
5543 |
+ } |
5544 |
+ |
5545 |
+ mode->type = DRM_MODE_TYPE_DRIVER; |
5546 |
++ mode->vrefresh = drm_mode_vrefresh(mode); |
5547 |
+ drm_mode_set_name(mode); |
5548 |
+ |
5549 |
+ return mode; |
5550 |
+diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c |
5551 |
+index e6162a1..34791fb 100644 |
5552 |
+--- a/drivers/gpu/drm/i915/i915_debugfs.c |
5553 |
++++ b/drivers/gpu/drm/i915/i915_debugfs.c |
5554 |
+@@ -122,7 +122,7 @@ static const char *cache_level_str(int type) |
5555 |
+ static void |
5556 |
+ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) |
5557 |
+ { |
5558 |
+- seq_printf(m, "%p: %s%s %8zdKiB %04x %04x %d %d%s%s%s", |
5559 |
++ seq_printf(m, "%pK: %s%s %8zdKiB %04x %04x %d %d%s%s%s", |
5560 |
+ &obj->base, |
5561 |
+ get_pin_flag(obj), |
5562 |
+ get_tiling_flag(obj), |
5563 |
+diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
5564 |
+index d4417e3..e97ed61 100644 |
5565 |
+--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
5566 |
++++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
5567 |
+@@ -957,15 +957,20 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, |
5568 |
+ int count) |
5569 |
+ { |
5570 |
+ int i; |
5571 |
++ int relocs_total = 0; |
5572 |
++ int relocs_max = INT_MAX / sizeof(struct drm_i915_gem_relocation_entry); |
5573 |
+ |
5574 |
+ for (i = 0; i < count; i++) { |
5575 |
+ char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr; |
5576 |
+ int length; /* limited by fault_in_pages_readable() */ |
5577 |
+ |
5578 |
+- /* First check for malicious input causing overflow */ |
5579 |
+- if (exec[i].relocation_count > |
5580 |
+- INT_MAX / sizeof(struct drm_i915_gem_relocation_entry)) |
5581 |
++ /* First check for malicious input causing overflow in |
5582 |
++ * the worst case where we need to allocate the entire |
5583 |
++ * relocation tree as a single array. |
5584 |
++ */ |
5585 |
++ if (exec[i].relocation_count > relocs_max - relocs_total) |
5586 |
+ return -EINVAL; |
5587 |
++ relocs_total += exec[i].relocation_count; |
5588 |
+ |
5589 |
+ length = exec[i].relocation_count * |
5590 |
+ sizeof(struct drm_i915_gem_relocation_entry); |
5591 |
+diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c |
5592 |
+index 289140b..cffb007 100644 |
5593 |
+--- a/drivers/gpu/drm/i915/intel_opregion.c |
5594 |
++++ b/drivers/gpu/drm/i915/intel_opregion.c |
5595 |
+@@ -419,6 +419,25 @@ blind_set: |
5596 |
+ goto end; |
5597 |
+ } |
5598 |
+ |
5599 |
++static void intel_setup_cadls(struct drm_device *dev) |
5600 |
++{ |
5601 |
++ struct drm_i915_private *dev_priv = dev->dev_private; |
5602 |
++ struct intel_opregion *opregion = &dev_priv->opregion; |
5603 |
++ int i = 0; |
5604 |
++ u32 disp_id; |
5605 |
++ |
5606 |
++ /* Initialize the CADL field by duplicating the DIDL values. |
5607 |
++ * Technically, this is not always correct as display outputs may exist, |
5608 |
++ * but not active. This initialization is necessary for some Clevo |
5609 |
++ * laptops that check this field before processing the brightness and |
5610 |
++ * display switching hotkeys. Just like DIDL, CADL is NULL-terminated if |
5611 |
++ * there are less than eight devices. */ |
5612 |
++ do { |
5613 |
++ disp_id = ioread32(&opregion->acpi->didl[i]); |
5614 |
++ iowrite32(disp_id, &opregion->acpi->cadl[i]); |
5615 |
++ } while (++i < 8 && disp_id != 0); |
5616 |
++} |
5617 |
++ |
5618 |
+ void intel_opregion_init(struct drm_device *dev) |
5619 |
+ { |
5620 |
+ struct drm_i915_private *dev_priv = dev->dev_private; |
5621 |
+@@ -428,8 +447,10 @@ void intel_opregion_init(struct drm_device *dev) |
5622 |
+ return; |
5623 |
+ |
5624 |
+ if (opregion->acpi) { |
5625 |
+- if (drm_core_check_feature(dev, DRIVER_MODESET)) |
5626 |
++ if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
5627 |
+ intel_didl_outputs(dev); |
5628 |
++ intel_setup_cadls(dev); |
5629 |
++ } |
5630 |
+ |
5631 |
+ /* Notify BIOS we are ready to handle ACPI video ext notifs. |
5632 |
+ * Right now, all the events are handled by the ACPI video module. |
5633 |
+diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c |
5634 |
+index 9934c9d..7dffc57 100644 |
5635 |
+--- a/drivers/gpu/drm/radeon/ni.c |
5636 |
++++ b/drivers/gpu/drm/radeon/ni.c |
5637 |
+@@ -663,13 +663,19 @@ static void cayman_gpu_init(struct radeon_device *rdev) |
5638 |
+ (rdev->pdev->device == 0x9907) || |
5639 |
+ (rdev->pdev->device == 0x9908) || |
5640 |
+ (rdev->pdev->device == 0x9909) || |
5641 |
++ (rdev->pdev->device == 0x990B) || |
5642 |
++ (rdev->pdev->device == 0x990C) || |
5643 |
++ (rdev->pdev->device == 0x990F) || |
5644 |
+ (rdev->pdev->device == 0x9910) || |
5645 |
+- (rdev->pdev->device == 0x9917)) { |
5646 |
++ (rdev->pdev->device == 0x9917) || |
5647 |
++ (rdev->pdev->device == 0x9999)) { |
5648 |
+ rdev->config.cayman.max_simds_per_se = 6; |
5649 |
+ rdev->config.cayman.max_backends_per_se = 2; |
5650 |
+ } else if ((rdev->pdev->device == 0x9903) || |
5651 |
+ (rdev->pdev->device == 0x9904) || |
5652 |
+ (rdev->pdev->device == 0x990A) || |
5653 |
++ (rdev->pdev->device == 0x990D) || |
5654 |
++ (rdev->pdev->device == 0x990E) || |
5655 |
+ (rdev->pdev->device == 0x9913) || |
5656 |
+ (rdev->pdev->device == 0x9918)) { |
5657 |
+ rdev->config.cayman.max_simds_per_se = 4; |
5658 |
+@@ -678,6 +684,9 @@ static void cayman_gpu_init(struct radeon_device *rdev) |
5659 |
+ (rdev->pdev->device == 0x9990) || |
5660 |
+ (rdev->pdev->device == 0x9991) || |
5661 |
+ (rdev->pdev->device == 0x9994) || |
5662 |
++ (rdev->pdev->device == 0x9995) || |
5663 |
++ (rdev->pdev->device == 0x9996) || |
5664 |
++ (rdev->pdev->device == 0x999A) || |
5665 |
+ (rdev->pdev->device == 0x99A0)) { |
5666 |
+ rdev->config.cayman.max_simds_per_se = 3; |
5667 |
+ rdev->config.cayman.max_backends_per_se = 1; |
5668 |
+diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c |
5669 |
+index fef7b72..89a0eec 100644 |
5670 |
+--- a/drivers/gpu/drm/radeon/radeon_benchmark.c |
5671 |
++++ b/drivers/gpu/drm/radeon/radeon_benchmark.c |
5672 |
+@@ -141,13 +141,15 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size, |
5673 |
+ sdomain, ddomain, "dma"); |
5674 |
+ } |
5675 |
+ |
5676 |
+- time = radeon_benchmark_do_move(rdev, size, saddr, daddr, |
5677 |
+- RADEON_BENCHMARK_COPY_BLIT, n); |
5678 |
+- if (time < 0) |
5679 |
+- goto out_cleanup; |
5680 |
+- if (time > 0) |
5681 |
+- radeon_benchmark_log_results(n, size, time, |
5682 |
+- sdomain, ddomain, "blit"); |
5683 |
++ if (rdev->asic->copy.blit) { |
5684 |
++ time = radeon_benchmark_do_move(rdev, size, saddr, daddr, |
5685 |
++ RADEON_BENCHMARK_COPY_BLIT, n); |
5686 |
++ if (time < 0) |
5687 |
++ goto out_cleanup; |
5688 |
++ if (time > 0) |
5689 |
++ radeon_benchmark_log_results(n, size, time, |
5690 |
++ sdomain, ddomain, "blit"); |
5691 |
++ } |
5692 |
+ |
5693 |
+ out_cleanup: |
5694 |
+ if (sobj) { |
5695 |
+diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c |
5696 |
+index 014504d..3767853 100644 |
5697 |
+--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c |
5698 |
++++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c |
5699 |
+@@ -755,9 +755,13 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_ |
5700 |
+ if (++priv->tx_outstanding == ipoib_sendq_size) { |
5701 |
+ ipoib_dbg(priv, "TX ring 0x%x full, stopping kernel net queue\n", |
5702 |
+ tx->qp->qp_num); |
5703 |
+- if (ib_req_notify_cq(priv->send_cq, IB_CQ_NEXT_COMP)) |
5704 |
+- ipoib_warn(priv, "request notify on send CQ failed\n"); |
5705 |
+ netif_stop_queue(dev); |
5706 |
++ rc = ib_req_notify_cq(priv->send_cq, |
5707 |
++ IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS); |
5708 |
++ if (rc < 0) |
5709 |
++ ipoib_warn(priv, "request notify on send CQ failed\n"); |
5710 |
++ else if (rc) |
5711 |
++ ipoib_send_comp_handler(priv->send_cq, dev); |
5712 |
+ } |
5713 |
+ } |
5714 |
+ } |
5715 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
5716 |
+index 6df52c9..dadf337 100644 |
5717 |
+--- a/drivers/net/bonding/bond_main.c |
5718 |
++++ b/drivers/net/bonding/bond_main.c |
5719 |
+@@ -1737,6 +1737,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) |
5720 |
+ |
5721 |
+ bond_compute_features(bond); |
5722 |
+ |
5723 |
++ bond_update_speed_duplex(new_slave); |
5724 |
++ |
5725 |
+ read_lock(&bond->lock); |
5726 |
+ |
5727 |
+ new_slave->last_arp_rx = jiffies; |
5728 |
+@@ -1780,8 +1782,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) |
5729 |
+ new_slave->link = BOND_LINK_DOWN; |
5730 |
+ } |
5731 |
+ |
5732 |
+- bond_update_speed_duplex(new_slave); |
5733 |
+- |
5734 |
+ if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { |
5735 |
+ /* if there is a primary slave, remember it */ |
5736 |
+ if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { |
5737 |
+@@ -2462,8 +2462,6 @@ static void bond_miimon_commit(struct bonding *bond) |
5738 |
+ bond_set_backup_slave(slave); |
5739 |
+ } |
5740 |
+ |
5741 |
+- bond_update_speed_duplex(slave); |
5742 |
+- |
5743 |
+ pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n", |
5744 |
+ bond->dev->name, slave->dev->name, |
5745 |
+ slave->speed, slave->duplex ? "full" : "half"); |
5746 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h |
5747 |
+index 2b46e1e..5905caa 100644 |
5748 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h |
5749 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h |
5750 |
+@@ -439,8 +439,9 @@ struct bnx2x_fw_port_stats_old { |
5751 |
+ |
5752 |
+ #define UPDATE_QSTAT(s, t) \ |
5753 |
+ do { \ |
5754 |
+- qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi); \ |
5755 |
+ qstats->t##_lo = qstats_old->t##_lo + le32_to_cpu(s.lo); \ |
5756 |
++ qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi) \ |
5757 |
++ + ((qstats->t##_lo < qstats_old->t##_lo) ? 1 : 0); \ |
5758 |
+ } while (0) |
5759 |
+ |
5760 |
+ #define UPDATE_QSTAT_OLD(f) \ |
5761 |
+diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c |
5762 |
+index e143d8c..15ed91f 100644 |
5763 |
+--- a/drivers/net/ethernet/broadcom/tg3.c |
5764 |
++++ b/drivers/net/ethernet/broadcom/tg3.c |
5765 |
+@@ -3946,6 +3946,14 @@ static void tg3_phy_copper_begin(struct tg3 *tp) |
5766 |
+ tp->link_config.active_speed = tp->link_config.speed; |
5767 |
+ tp->link_config.active_duplex = tp->link_config.duplex; |
5768 |
+ |
5769 |
++ if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714) { |
5770 |
++ /* With autoneg disabled, 5715 only links up when the |
5771 |
++ * advertisement register has the configured speed |
5772 |
++ * enabled. |
5773 |
++ */ |
5774 |
++ tg3_writephy(tp, MII_ADVERTISE, ADVERTISE_ALL); |
5775 |
++ } |
5776 |
++ |
5777 |
+ bmcr = 0; |
5778 |
+ switch (tp->link_config.speed) { |
5779 |
+ default: |
5780 |
+diff --git a/drivers/net/ethernet/sfc/bitfield.h b/drivers/net/ethernet/sfc/bitfield.h |
5781 |
+index b26a954..5400a33 100644 |
5782 |
+--- a/drivers/net/ethernet/sfc/bitfield.h |
5783 |
++++ b/drivers/net/ethernet/sfc/bitfield.h |
5784 |
+@@ -120,10 +120,10 @@ typedef union efx_oword { |
5785 |
+ * [0,high-low), with garbage in bits [high-low+1,...). |
5786 |
+ */ |
5787 |
+ #define EFX_EXTRACT_NATIVE(native_element, min, max, low, high) \ |
5788 |
+- (((low > max) || (high < min)) ? 0 : \ |
5789 |
+- ((low > min) ? \ |
5790 |
+- ((native_element) >> (low - min)) : \ |
5791 |
+- ((native_element) << (min - low)))) |
5792 |
++ ((low) > (max) || (high) < (min) ? 0 : \ |
5793 |
++ (low) > (min) ? \ |
5794 |
++ (native_element) >> ((low) - (min)) : \ |
5795 |
++ (native_element) << ((min) - (low))) |
5796 |
+ |
5797 |
+ /* |
5798 |
+ * Extract bit field portion [low,high) from the 64-bit little-endian |
5799 |
+@@ -142,27 +142,27 @@ typedef union efx_oword { |
5800 |
+ #define EFX_EXTRACT_OWORD64(oword, low, high) \ |
5801 |
+ ((EFX_EXTRACT64((oword).u64[0], 0, 63, low, high) | \ |
5802 |
+ EFX_EXTRACT64((oword).u64[1], 64, 127, low, high)) & \ |
5803 |
+- EFX_MASK64(high + 1 - low)) |
5804 |
++ EFX_MASK64((high) + 1 - (low))) |
5805 |
+ |
5806 |
+ #define EFX_EXTRACT_QWORD64(qword, low, high) \ |
5807 |
+ (EFX_EXTRACT64((qword).u64[0], 0, 63, low, high) & \ |
5808 |
+- EFX_MASK64(high + 1 - low)) |
5809 |
++ EFX_MASK64((high) + 1 - (low))) |
5810 |
+ |
5811 |
+ #define EFX_EXTRACT_OWORD32(oword, low, high) \ |
5812 |
+ ((EFX_EXTRACT32((oword).u32[0], 0, 31, low, high) | \ |
5813 |
+ EFX_EXTRACT32((oword).u32[1], 32, 63, low, high) | \ |
5814 |
+ EFX_EXTRACT32((oword).u32[2], 64, 95, low, high) | \ |
5815 |
+ EFX_EXTRACT32((oword).u32[3], 96, 127, low, high)) & \ |
5816 |
+- EFX_MASK32(high + 1 - low)) |
5817 |
++ EFX_MASK32((high) + 1 - (low))) |
5818 |
+ |
5819 |
+ #define EFX_EXTRACT_QWORD32(qword, low, high) \ |
5820 |
+ ((EFX_EXTRACT32((qword).u32[0], 0, 31, low, high) | \ |
5821 |
+ EFX_EXTRACT32((qword).u32[1], 32, 63, low, high)) & \ |
5822 |
+- EFX_MASK32(high + 1 - low)) |
5823 |
++ EFX_MASK32((high) + 1 - (low))) |
5824 |
+ |
5825 |
+ #define EFX_EXTRACT_DWORD(dword, low, high) \ |
5826 |
+ (EFX_EXTRACT32((dword).u32[0], 0, 31, low, high) & \ |
5827 |
+- EFX_MASK32(high + 1 - low)) |
5828 |
++ EFX_MASK32((high) + 1 - (low))) |
5829 |
+ |
5830 |
+ #define EFX_OWORD_FIELD64(oword, field) \ |
5831 |
+ EFX_EXTRACT_OWORD64(oword, EFX_LOW_BIT(field), \ |
5832 |
+@@ -442,10 +442,10 @@ typedef union efx_oword { |
5833 |
+ cpu_to_le32(EFX_INSERT_NATIVE(min, max, low, high, value)) |
5834 |
+ |
5835 |
+ #define EFX_INPLACE_MASK64(min, max, low, high) \ |
5836 |
+- EFX_INSERT64(min, max, low, high, EFX_MASK64(high + 1 - low)) |
5837 |
++ EFX_INSERT64(min, max, low, high, EFX_MASK64((high) + 1 - (low))) |
5838 |
+ |
5839 |
+ #define EFX_INPLACE_MASK32(min, max, low, high) \ |
5840 |
+- EFX_INSERT32(min, max, low, high, EFX_MASK32(high + 1 - low)) |
5841 |
++ EFX_INSERT32(min, max, low, high, EFX_MASK32((high) + 1 - (low))) |
5842 |
+ |
5843 |
+ #define EFX_SET_OWORD64(oword, low, high, value) do { \ |
5844 |
+ (oword).u64[0] = (((oword).u64[0] \ |
5845 |
+diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c |
5846 |
+index 954b885..a87f351 100644 |
5847 |
+--- a/drivers/net/ethernet/sfc/efx.c |
5848 |
++++ b/drivers/net/ethernet/sfc/efx.c |
5849 |
+@@ -656,25 +656,30 @@ static void efx_stop_datapath(struct efx_nic *efx) |
5850 |
+ struct efx_channel *channel; |
5851 |
+ struct efx_tx_queue *tx_queue; |
5852 |
+ struct efx_rx_queue *rx_queue; |
5853 |
++ struct pci_dev *dev = efx->pci_dev; |
5854 |
+ int rc; |
5855 |
+ |
5856 |
+ EFX_ASSERT_RESET_SERIALISED(efx); |
5857 |
+ BUG_ON(efx->port_enabled); |
5858 |
+ |
5859 |
+- rc = efx_nic_flush_queues(efx); |
5860 |
+- if (rc && EFX_WORKAROUND_7803(efx)) { |
5861 |
+- /* Schedule a reset to recover from the flush failure. The |
5862 |
+- * descriptor caches reference memory we're about to free, |
5863 |
+- * but falcon_reconfigure_mac_wrapper() won't reconnect |
5864 |
+- * the MACs because of the pending reset. */ |
5865 |
+- netif_err(efx, drv, efx->net_dev, |
5866 |
+- "Resetting to recover from flush failure\n"); |
5867 |
+- efx_schedule_reset(efx, RESET_TYPE_ALL); |
5868 |
+- } else if (rc) { |
5869 |
+- netif_err(efx, drv, efx->net_dev, "failed to flush queues\n"); |
5870 |
+- } else { |
5871 |
+- netif_dbg(efx, drv, efx->net_dev, |
5872 |
+- "successfully flushed all queues\n"); |
5873 |
++ /* Only perform flush if dma is enabled */ |
5874 |
++ if (dev->is_busmaster) { |
5875 |
++ rc = efx_nic_flush_queues(efx); |
5876 |
++ |
5877 |
++ if (rc && EFX_WORKAROUND_7803(efx)) { |
5878 |
++ /* Schedule a reset to recover from the flush failure. The |
5879 |
++ * descriptor caches reference memory we're about to free, |
5880 |
++ * but falcon_reconfigure_mac_wrapper() won't reconnect |
5881 |
++ * the MACs because of the pending reset. */ |
5882 |
++ netif_err(efx, drv, efx->net_dev, |
5883 |
++ "Resetting to recover from flush failure\n"); |
5884 |
++ efx_schedule_reset(efx, RESET_TYPE_ALL); |
5885 |
++ } else if (rc) { |
5886 |
++ netif_err(efx, drv, efx->net_dev, "failed to flush queues\n"); |
5887 |
++ } else { |
5888 |
++ netif_dbg(efx, drv, efx->net_dev, |
5889 |
++ "successfully flushed all queues\n"); |
5890 |
++ } |
5891 |
+ } |
5892 |
+ |
5893 |
+ efx_for_each_channel(channel, efx) { |
5894 |
+@@ -749,6 +754,7 @@ efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) |
5895 |
+ tx_queue->txd.entries); |
5896 |
+ } |
5897 |
+ |
5898 |
++ efx_device_detach_sync(efx); |
5899 |
+ efx_stop_all(efx); |
5900 |
+ efx_stop_interrupts(efx, true); |
5901 |
+ |
5902 |
+@@ -802,6 +808,7 @@ out: |
5903 |
+ |
5904 |
+ efx_start_interrupts(efx, true); |
5905 |
+ efx_start_all(efx); |
5906 |
++ netif_device_attach(efx->net_dev); |
5907 |
+ return rc; |
5908 |
+ |
5909 |
+ rollback: |
5910 |
+@@ -1596,8 +1603,12 @@ static void efx_stop_all(struct efx_nic *efx) |
5911 |
+ /* Flush efx_mac_work(), refill_workqueue, monitor_work */ |
5912 |
+ efx_flush_all(efx); |
5913 |
+ |
5914 |
+- /* Stop the kernel transmit interface late, so the watchdog |
5915 |
+- * timer isn't ticking over the flush */ |
5916 |
++ /* Stop the kernel transmit interface. This is only valid if |
5917 |
++ * the device is stopped or detached; otherwise the watchdog |
5918 |
++ * may fire immediately. |
5919 |
++ */ |
5920 |
++ WARN_ON(netif_running(efx->net_dev) && |
5921 |
++ netif_device_present(efx->net_dev)); |
5922 |
+ netif_tx_disable(efx->net_dev); |
5923 |
+ |
5924 |
+ efx_stop_datapath(efx); |
5925 |
+@@ -1916,10 +1927,11 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu) |
5926 |
+ if (new_mtu > EFX_MAX_MTU) |
5927 |
+ return -EINVAL; |
5928 |
+ |
5929 |
+- efx_stop_all(efx); |
5930 |
+- |
5931 |
+ netif_dbg(efx, drv, efx->net_dev, "changing MTU to %d\n", new_mtu); |
5932 |
+ |
5933 |
++ efx_device_detach_sync(efx); |
5934 |
++ efx_stop_all(efx); |
5935 |
++ |
5936 |
+ mutex_lock(&efx->mac_lock); |
5937 |
+ /* Reconfigure the MAC before enabling the dma queues so that |
5938 |
+ * the RX buffers don't overflow */ |
5939 |
+@@ -1928,6 +1940,7 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu) |
5940 |
+ mutex_unlock(&efx->mac_lock); |
5941 |
+ |
5942 |
+ efx_start_all(efx); |
5943 |
++ netif_device_attach(efx->net_dev); |
5944 |
+ return 0; |
5945 |
+ } |
5946 |
+ |
5947 |
+@@ -2219,7 +2232,7 @@ int efx_reset(struct efx_nic *efx, enum reset_type method) |
5948 |
+ netif_info(efx, drv, efx->net_dev, "resetting (%s)\n", |
5949 |
+ RESET_TYPE(method)); |
5950 |
+ |
5951 |
+- netif_device_detach(efx->net_dev); |
5952 |
++ efx_device_detach_sync(efx); |
5953 |
+ efx_reset_down(efx, method); |
5954 |
+ |
5955 |
+ rc = efx->type->reset(efx, method); |
5956 |
+@@ -2713,7 +2726,7 @@ static int efx_pm_freeze(struct device *dev) |
5957 |
+ |
5958 |
+ efx->state = STATE_FINI; |
5959 |
+ |
5960 |
+- netif_device_detach(efx->net_dev); |
5961 |
++ efx_device_detach_sync(efx); |
5962 |
+ |
5963 |
+ efx_stop_all(efx); |
5964 |
+ efx_stop_interrupts(efx, false); |
5965 |
+diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h |
5966 |
+index 70755c9..7db0e5b 100644 |
5967 |
+--- a/drivers/net/ethernet/sfc/efx.h |
5968 |
++++ b/drivers/net/ethernet/sfc/efx.h |
5969 |
+@@ -162,4 +162,17 @@ extern void efx_link_status_changed(struct efx_nic *efx); |
5970 |
+ extern void efx_link_set_advertising(struct efx_nic *efx, u32); |
5971 |
+ extern void efx_link_set_wanted_fc(struct efx_nic *efx, u8); |
5972 |
+ |
5973 |
++static inline void efx_device_detach_sync(struct efx_nic *efx) |
5974 |
++{ |
5975 |
++ struct net_device *dev = efx->net_dev; |
5976 |
++ |
5977 |
++ /* Lock/freeze all TX queues so that we can be sure the |
5978 |
++ * TX scheduler is stopped when we're done and before |
5979 |
++ * netif_device_present() becomes false. |
5980 |
++ */ |
5981 |
++ netif_tx_lock_bh(dev); |
5982 |
++ netif_device_detach(dev); |
5983 |
++ netif_tx_unlock_bh(dev); |
5984 |
++} |
5985 |
++ |
5986 |
+ #endif /* EFX_EFX_H */ |
5987 |
+diff --git a/drivers/net/ethernet/sfc/falcon.c b/drivers/net/ethernet/sfc/falcon.c |
5988 |
+index 3a1ca2b..49bcd19 100644 |
5989 |
+--- a/drivers/net/ethernet/sfc/falcon.c |
5990 |
++++ b/drivers/net/ethernet/sfc/falcon.c |
5991 |
+@@ -25,9 +25,12 @@ |
5992 |
+ #include "io.h" |
5993 |
+ #include "phy.h" |
5994 |
+ #include "workarounds.h" |
5995 |
++#include "selftest.h" |
5996 |
+ |
5997 |
+ /* Hardware control for SFC4000 (aka Falcon). */ |
5998 |
+ |
5999 |
++static int falcon_reset_hw(struct efx_nic *efx, enum reset_type method); |
6000 |
++ |
6001 |
+ static const unsigned int |
6002 |
+ /* "Large" EEPROM device: Atmel AT25640 or similar |
6003 |
+ * 8 KB, 16-bit address, 32 B write block */ |
6004 |
+@@ -1034,10 +1037,34 @@ static const struct efx_nic_register_test falcon_b0_register_tests[] = { |
6005 |
+ EFX_OWORD32(0x0003FF0F, 0x00000000, 0x00000000, 0x00000000) }, |
6006 |
+ }; |
6007 |
+ |
6008 |
+-static int falcon_b0_test_registers(struct efx_nic *efx) |
6009 |
++static int |
6010 |
++falcon_b0_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) |
6011 |
+ { |
6012 |
+- return efx_nic_test_registers(efx, falcon_b0_register_tests, |
6013 |
+- ARRAY_SIZE(falcon_b0_register_tests)); |
6014 |
++ enum reset_type reset_method = RESET_TYPE_INVISIBLE; |
6015 |
++ int rc, rc2; |
6016 |
++ |
6017 |
++ mutex_lock(&efx->mac_lock); |
6018 |
++ if (efx->loopback_modes) { |
6019 |
++ /* We need the 312 clock from the PHY to test the XMAC |
6020 |
++ * registers, so move into XGMII loopback if available */ |
6021 |
++ if (efx->loopback_modes & (1 << LOOPBACK_XGMII)) |
6022 |
++ efx->loopback_mode = LOOPBACK_XGMII; |
6023 |
++ else |
6024 |
++ efx->loopback_mode = __ffs(efx->loopback_modes); |
6025 |
++ } |
6026 |
++ __efx_reconfigure_port(efx); |
6027 |
++ mutex_unlock(&efx->mac_lock); |
6028 |
++ |
6029 |
++ efx_reset_down(efx, reset_method); |
6030 |
++ |
6031 |
++ tests->registers = |
6032 |
++ efx_nic_test_registers(efx, falcon_b0_register_tests, |
6033 |
++ ARRAY_SIZE(falcon_b0_register_tests)) |
6034 |
++ ? -1 : 1; |
6035 |
++ |
6036 |
++ rc = falcon_reset_hw(efx, reset_method); |
6037 |
++ rc2 = efx_reset_up(efx, reset_method, rc == 0); |
6038 |
++ return rc ? rc : rc2; |
6039 |
+ } |
6040 |
+ |
6041 |
+ /************************************************************************** |
6042 |
+@@ -1765,6 +1792,7 @@ const struct efx_nic_type falcon_a1_nic_type = { |
6043 |
+ .remove_port = falcon_remove_port, |
6044 |
+ .handle_global_event = falcon_handle_global_event, |
6045 |
+ .prepare_flush = falcon_prepare_flush, |
6046 |
++ .finish_flush = efx_port_dummy_op_void, |
6047 |
+ .update_stats = falcon_update_nic_stats, |
6048 |
+ .start_stats = falcon_start_nic_stats, |
6049 |
+ .stop_stats = falcon_stop_nic_stats, |
6050 |
+@@ -1807,6 +1835,7 @@ const struct efx_nic_type falcon_b0_nic_type = { |
6051 |
+ .remove_port = falcon_remove_port, |
6052 |
+ .handle_global_event = falcon_handle_global_event, |
6053 |
+ .prepare_flush = falcon_prepare_flush, |
6054 |
++ .finish_flush = efx_port_dummy_op_void, |
6055 |
+ .update_stats = falcon_update_nic_stats, |
6056 |
+ .start_stats = falcon_start_nic_stats, |
6057 |
+ .stop_stats = falcon_stop_nic_stats, |
6058 |
+@@ -1818,7 +1847,7 @@ const struct efx_nic_type falcon_b0_nic_type = { |
6059 |
+ .get_wol = falcon_get_wol, |
6060 |
+ .set_wol = falcon_set_wol, |
6061 |
+ .resume_wol = efx_port_dummy_op_void, |
6062 |
+- .test_registers = falcon_b0_test_registers, |
6063 |
++ .test_chip = falcon_b0_test_chip, |
6064 |
+ .test_nvram = falcon_test_nvram, |
6065 |
+ |
6066 |
+ .revision = EFX_REV_FALCON_B0, |
6067 |
+diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c |
6068 |
+index 17b6463..eb85217 100644 |
6069 |
+--- a/drivers/net/ethernet/sfc/mcdi.c |
6070 |
++++ b/drivers/net/ethernet/sfc/mcdi.c |
6071 |
+@@ -22,7 +22,7 @@ |
6072 |
+ ************************************************************************** |
6073 |
+ */ |
6074 |
+ |
6075 |
+-#define MCDI_RPC_TIMEOUT 10 /*seconds */ |
6076 |
++#define MCDI_RPC_TIMEOUT (10 * HZ) |
6077 |
+ |
6078 |
+ #define MCDI_PDU(efx) \ |
6079 |
+ (efx_port_num(efx) ? MC_SMEM_P1_PDU_OFST : MC_SMEM_P0_PDU_OFST) |
6080 |
+@@ -120,7 +120,7 @@ static void efx_mcdi_copyout(struct efx_nic *efx, u8 *outbuf, size_t outlen) |
6081 |
+ static int efx_mcdi_poll(struct efx_nic *efx) |
6082 |
+ { |
6083 |
+ struct efx_mcdi_iface *mcdi = efx_mcdi(efx); |
6084 |
+- unsigned int time, finish; |
6085 |
++ unsigned long time, finish; |
6086 |
+ unsigned int respseq, respcmd, error; |
6087 |
+ unsigned int pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); |
6088 |
+ unsigned int rc, spins; |
6089 |
+@@ -136,7 +136,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) |
6090 |
+ * and poll once a jiffy (approximately) |
6091 |
+ */ |
6092 |
+ spins = TICK_USEC; |
6093 |
+- finish = get_seconds() + MCDI_RPC_TIMEOUT; |
6094 |
++ finish = jiffies + MCDI_RPC_TIMEOUT; |
6095 |
+ |
6096 |
+ while (1) { |
6097 |
+ if (spins != 0) { |
6098 |
+@@ -146,7 +146,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) |
6099 |
+ schedule_timeout_uninterruptible(1); |
6100 |
+ } |
6101 |
+ |
6102 |
+- time = get_seconds(); |
6103 |
++ time = jiffies; |
6104 |
+ |
6105 |
+ rmb(); |
6106 |
+ efx_readd(efx, ®, pdu); |
6107 |
+@@ -158,7 +158,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) |
6108 |
+ EFX_DWORD_FIELD(reg, MCDI_HEADER_RESPONSE)) |
6109 |
+ break; |
6110 |
+ |
6111 |
+- if (time >= finish) |
6112 |
++ if (time_after(time, finish)) |
6113 |
+ return -ETIMEDOUT; |
6114 |
+ } |
6115 |
+ |
6116 |
+@@ -250,7 +250,7 @@ static int efx_mcdi_await_completion(struct efx_nic *efx) |
6117 |
+ if (wait_event_timeout( |
6118 |
+ mcdi->wq, |
6119 |
+ atomic_read(&mcdi->state) == MCDI_STATE_COMPLETED, |
6120 |
+- msecs_to_jiffies(MCDI_RPC_TIMEOUT * 1000)) == 0) |
6121 |
++ MCDI_RPC_TIMEOUT) == 0) |
6122 |
+ return -ETIMEDOUT; |
6123 |
+ |
6124 |
+ /* Check if efx_mcdi_set_mode() switched us back to polled completions. |
6125 |
+@@ -641,9 +641,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, |
6126 |
+ u16 *fw_subtype_list, u32 *capabilities) |
6127 |
+ { |
6128 |
+ uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMIN]; |
6129 |
+- size_t outlen; |
6130 |
++ size_t outlen, offset, i; |
6131 |
+ int port_num = efx_port_num(efx); |
6132 |
+- int offset; |
6133 |
+ int rc; |
6134 |
+ |
6135 |
+ BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_IN_LEN != 0); |
6136 |
+@@ -663,11 +662,16 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, |
6137 |
+ : MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST; |
6138 |
+ if (mac_address) |
6139 |
+ memcpy(mac_address, outbuf + offset, ETH_ALEN); |
6140 |
+- if (fw_subtype_list) |
6141 |
+- memcpy(fw_subtype_list, |
6142 |
+- outbuf + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST, |
6143 |
+- MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM * |
6144 |
+- sizeof(fw_subtype_list[0])); |
6145 |
++ if (fw_subtype_list) { |
6146 |
++ offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST; |
6147 |
++ for (i = 0; |
6148 |
++ i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM; |
6149 |
++ i++) { |
6150 |
++ fw_subtype_list[i] = |
6151 |
++ le16_to_cpup((__le16 *)(outbuf + offset)); |
6152 |
++ offset += 2; |
6153 |
++ } |
6154 |
++ } |
6155 |
+ if (capabilities) { |
6156 |
+ if (port_num) |
6157 |
+ *capabilities = MCDI_DWORD(outbuf, |
6158 |
+@@ -1164,6 +1168,9 @@ int efx_mcdi_flush_rxqs(struct efx_nic *efx) |
6159 |
+ __le32 *qid; |
6160 |
+ int rc, count; |
6161 |
+ |
6162 |
++ BUILD_BUG_ON(EFX_MAX_CHANNELS > |
6163 |
++ MC_CMD_FLUSH_RX_QUEUES_IN_QID_OFST_MAXNUM); |
6164 |
++ |
6165 |
+ qid = kmalloc(EFX_MAX_CHANNELS * sizeof(*qid), GFP_KERNEL); |
6166 |
+ if (qid == NULL) |
6167 |
+ return -ENOMEM; |
6168 |
+diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h |
6169 |
+index 0bdf3e3..96f43d2 100644 |
6170 |
+--- a/drivers/net/ethernet/sfc/mcdi.h |
6171 |
++++ b/drivers/net/ethernet/sfc/mcdi.h |
6172 |
+@@ -107,11 +107,13 @@ extern void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev); |
6173 |
+ #define MCDI_EVENT_FIELD(_ev, _field) \ |
6174 |
+ EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field) |
6175 |
+ #define MCDI_ARRAY_FIELD(_buf, _field1, _type, _index, _field2) \ |
6176 |
+- EFX_DWORD_FIELD( \ |
6177 |
++ EFX_EXTRACT_DWORD( \ |
6178 |
+ *((efx_dword_t *) \ |
6179 |
+ (MCDI_ARRAY_PTR(_buf, _field1, _type, _index) + \ |
6180 |
+ (MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _OFST & ~3))), \ |
6181 |
+- MC_CMD_ ## _type ## _TYPEDEF_ ## _field2) |
6182 |
++ MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _LBN & 0x1f, \ |
6183 |
++ (MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _LBN & 0x1f) + \ |
6184 |
++ MC_CMD_ ## _type ## _TYPEDEF_ ## _field2 ## _WIDTH - 1) |
6185 |
+ |
6186 |
+ extern void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len); |
6187 |
+ extern int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, |
6188 |
+diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h |
6189 |
+index f0385e1..b71ef14 100644 |
6190 |
+--- a/drivers/net/ethernet/sfc/net_driver.h |
6191 |
++++ b/drivers/net/ethernet/sfc/net_driver.h |
6192 |
+@@ -68,6 +68,8 @@ |
6193 |
+ #define EFX_TXQ_TYPES 4 |
6194 |
+ #define EFX_MAX_TX_QUEUES (EFX_TXQ_TYPES * EFX_MAX_CHANNELS) |
6195 |
+ |
6196 |
++struct efx_self_tests; |
6197 |
++ |
6198 |
+ /** |
6199 |
+ * struct efx_special_buffer - An Efx special buffer |
6200 |
+ * @addr: CPU base address of the buffer |
6201 |
+@@ -194,6 +196,7 @@ struct efx_tx_queue { |
6202 |
+ /* Members shared between paths and sometimes updated */ |
6203 |
+ unsigned int empty_read_count ____cacheline_aligned_in_smp; |
6204 |
+ #define EFX_EMPTY_COUNT_VALID 0x80000000 |
6205 |
++ atomic_t flush_outstanding; |
6206 |
+ }; |
6207 |
+ |
6208 |
+ /** |
6209 |
+@@ -203,6 +206,7 @@ struct efx_tx_queue { |
6210 |
+ * Will be %NULL if the buffer slot is currently free. |
6211 |
+ * @page: The associated page buffer. Valif iff @flags & %EFX_RX_BUF_PAGE. |
6212 |
+ * Will be %NULL if the buffer slot is currently free. |
6213 |
++ * @page_offset: Offset within page. Valid iff @flags & %EFX_RX_BUF_PAGE. |
6214 |
+ * @len: Buffer length, in bytes. |
6215 |
+ * @flags: Flags for buffer and packet state. |
6216 |
+ */ |
6217 |
+@@ -212,7 +216,8 @@ struct efx_rx_buffer { |
6218 |
+ struct sk_buff *skb; |
6219 |
+ struct page *page; |
6220 |
+ } u; |
6221 |
+- unsigned int len; |
6222 |
++ u16 page_offset; |
6223 |
++ u16 len; |
6224 |
+ u16 flags; |
6225 |
+ }; |
6226 |
+ #define EFX_RX_BUF_PAGE 0x0001 |
6227 |
+@@ -887,6 +892,7 @@ static inline unsigned int efx_port_num(struct efx_nic *efx) |
6228 |
+ * @remove_port: Free resources allocated by probe_port() |
6229 |
+ * @handle_global_event: Handle a "global" event (may be %NULL) |
6230 |
+ * @prepare_flush: Prepare the hardware for flushing the DMA queues |
6231 |
++ * @finish_flush: Clean up after flushing the DMA queues |
6232 |
+ * @update_stats: Update statistics not provided by event handling |
6233 |
+ * @start_stats: Start the regular fetching of statistics |
6234 |
+ * @stop_stats: Stop the regular fetching of statistics |
6235 |
+@@ -899,7 +905,8 @@ static inline unsigned int efx_port_num(struct efx_nic *efx) |
6236 |
+ * @get_wol: Get WoL configuration from driver state |
6237 |
+ * @set_wol: Push WoL configuration to the NIC |
6238 |
+ * @resume_wol: Synchronise WoL state between driver and MC (e.g. after resume) |
6239 |
+- * @test_registers: Test read/write functionality of control registers |
6240 |
++ * @test_chip: Test registers. Should use efx_nic_test_registers(), and is |
6241 |
++ * expected to reset the NIC. |
6242 |
+ * @test_nvram: Test validity of NVRAM contents |
6243 |
+ * @revision: Hardware architecture revision |
6244 |
+ * @mem_map_size: Memory BAR mapped size |
6245 |
+@@ -933,6 +940,7 @@ struct efx_nic_type { |
6246 |
+ void (*remove_port)(struct efx_nic *efx); |
6247 |
+ bool (*handle_global_event)(struct efx_channel *channel, efx_qword_t *); |
6248 |
+ void (*prepare_flush)(struct efx_nic *efx); |
6249 |
++ void (*finish_flush)(struct efx_nic *efx); |
6250 |
+ void (*update_stats)(struct efx_nic *efx); |
6251 |
+ void (*start_stats)(struct efx_nic *efx); |
6252 |
+ void (*stop_stats)(struct efx_nic *efx); |
6253 |
+@@ -944,7 +952,7 @@ struct efx_nic_type { |
6254 |
+ void (*get_wol)(struct efx_nic *efx, struct ethtool_wolinfo *wol); |
6255 |
+ int (*set_wol)(struct efx_nic *efx, u32 type); |
6256 |
+ void (*resume_wol)(struct efx_nic *efx); |
6257 |
+- int (*test_registers)(struct efx_nic *efx); |
6258 |
++ int (*test_chip)(struct efx_nic *efx, struct efx_self_tests *tests); |
6259 |
+ int (*test_nvram)(struct efx_nic *efx); |
6260 |
+ |
6261 |
+ int revision; |
6262 |
+diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c |
6263 |
+index 4a9a5be..578e52a6 100644 |
6264 |
+--- a/drivers/net/ethernet/sfc/nic.c |
6265 |
++++ b/drivers/net/ethernet/sfc/nic.c |
6266 |
+@@ -73,6 +73,8 @@ |
6267 |
+ _EFX_CHANNEL_MAGIC(_EFX_CHANNEL_MAGIC_TX_DRAIN, \ |
6268 |
+ (_tx_queue)->queue) |
6269 |
+ |
6270 |
++static void efx_magic_event(struct efx_channel *channel, u32 magic); |
6271 |
++ |
6272 |
+ /************************************************************************** |
6273 |
+ * |
6274 |
+ * Solarstorm hardware access |
6275 |
+@@ -124,9 +126,6 @@ int efx_nic_test_registers(struct efx_nic *efx, |
6276 |
+ unsigned address = 0, i, j; |
6277 |
+ efx_oword_t mask, imask, original, reg, buf; |
6278 |
+ |
6279 |
+- /* Falcon should be in loopback to isolate the XMAC from the PHY */ |
6280 |
+- WARN_ON(!LOOPBACK_INTERNAL(efx)); |
6281 |
+- |
6282 |
+ for (i = 0; i < n_regs; ++i) { |
6283 |
+ address = regs[i].address; |
6284 |
+ mask = imask = regs[i].mask; |
6285 |
+@@ -380,7 +379,8 @@ efx_may_push_tx_desc(struct efx_tx_queue *tx_queue, unsigned int write_count) |
6286 |
+ return false; |
6287 |
+ |
6288 |
+ tx_queue->empty_read_count = 0; |
6289 |
+- return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0; |
6290 |
++ return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0 |
6291 |
++ && tx_queue->write_count - write_count == 1; |
6292 |
+ } |
6293 |
+ |
6294 |
+ /* For each entry inserted into the software descriptor ring, create a |
6295 |
+@@ -495,6 +495,9 @@ static void efx_flush_tx_queue(struct efx_tx_queue *tx_queue) |
6296 |
+ struct efx_nic *efx = tx_queue->efx; |
6297 |
+ efx_oword_t tx_flush_descq; |
6298 |
+ |
6299 |
++ WARN_ON(atomic_read(&tx_queue->flush_outstanding)); |
6300 |
++ atomic_set(&tx_queue->flush_outstanding, 1); |
6301 |
++ |
6302 |
+ EFX_POPULATE_OWORD_2(tx_flush_descq, |
6303 |
+ FRF_AZ_TX_FLUSH_DESCQ_CMD, 1, |
6304 |
+ FRF_AZ_TX_FLUSH_DESCQ, tx_queue->queue); |
6305 |
+@@ -670,6 +673,47 @@ static bool efx_flush_wake(struct efx_nic *efx) |
6306 |
+ && atomic_read(&efx->rxq_flush_pending) > 0)); |
6307 |
+ } |
6308 |
+ |
6309 |
++static bool efx_check_tx_flush_complete(struct efx_nic *efx) |
6310 |
++{ |
6311 |
++ bool i = true; |
6312 |
++ efx_oword_t txd_ptr_tbl; |
6313 |
++ struct efx_channel *channel; |
6314 |
++ struct efx_tx_queue *tx_queue; |
6315 |
++ |
6316 |
++ efx_for_each_channel(channel, efx) { |
6317 |
++ efx_for_each_channel_tx_queue(tx_queue, channel) { |
6318 |
++ efx_reado_table(efx, &txd_ptr_tbl, |
6319 |
++ FR_BZ_TX_DESC_PTR_TBL, tx_queue->queue); |
6320 |
++ if (EFX_OWORD_FIELD(txd_ptr_tbl, |
6321 |
++ FRF_AZ_TX_DESCQ_FLUSH) || |
6322 |
++ EFX_OWORD_FIELD(txd_ptr_tbl, |
6323 |
++ FRF_AZ_TX_DESCQ_EN)) { |
6324 |
++ netif_dbg(efx, hw, efx->net_dev, |
6325 |
++ "flush did not complete on TXQ %d\n", |
6326 |
++ tx_queue->queue); |
6327 |
++ i = false; |
6328 |
++ } else if (atomic_cmpxchg(&tx_queue->flush_outstanding, |
6329 |
++ 1, 0)) { |
6330 |
++ /* The flush is complete, but we didn't |
6331 |
++ * receive a flush completion event |
6332 |
++ */ |
6333 |
++ netif_dbg(efx, hw, efx->net_dev, |
6334 |
++ "flush complete on TXQ %d, so drain " |
6335 |
++ "the queue\n", tx_queue->queue); |
6336 |
++ /* Don't need to increment drain_pending as it |
6337 |
++ * has already been incremented for the queues |
6338 |
++ * which did not drain |
6339 |
++ */ |
6340 |
++ efx_magic_event(channel, |
6341 |
++ EFX_CHANNEL_MAGIC_TX_DRAIN( |
6342 |
++ tx_queue)); |
6343 |
++ } |
6344 |
++ } |
6345 |
++ } |
6346 |
++ |
6347 |
++ return i; |
6348 |
++} |
6349 |
++ |
6350 |
+ /* Flush all the transmit queues, and continue flushing receive queues until |
6351 |
+ * they're all flushed. Wait for the DRAIN events to be recieved so that there |
6352 |
+ * are no more RX and TX events left on any channel. */ |
6353 |
+@@ -681,7 +725,6 @@ int efx_nic_flush_queues(struct efx_nic *efx) |
6354 |
+ struct efx_tx_queue *tx_queue; |
6355 |
+ int rc = 0; |
6356 |
+ |
6357 |
+- efx->fc_disable++; |
6358 |
+ efx->type->prepare_flush(efx); |
6359 |
+ |
6360 |
+ efx_for_each_channel(channel, efx) { |
6361 |
+@@ -731,7 +774,8 @@ int efx_nic_flush_queues(struct efx_nic *efx) |
6362 |
+ timeout); |
6363 |
+ } |
6364 |
+ |
6365 |
+- if (atomic_read(&efx->drain_pending)) { |
6366 |
++ if (atomic_read(&efx->drain_pending) && |
6367 |
++ !efx_check_tx_flush_complete(efx)) { |
6368 |
+ netif_err(efx, hw, efx->net_dev, "failed to flush %d queues " |
6369 |
+ "(rx %d+%d)\n", atomic_read(&efx->drain_pending), |
6370 |
+ atomic_read(&efx->rxq_flush_outstanding), |
6371 |
+@@ -743,7 +787,7 @@ int efx_nic_flush_queues(struct efx_nic *efx) |
6372 |
+ atomic_set(&efx->rxq_flush_outstanding, 0); |
6373 |
+ } |
6374 |
+ |
6375 |
+- efx->fc_disable--; |
6376 |
++ efx->type->finish_flush(efx); |
6377 |
+ |
6378 |
+ return rc; |
6379 |
+ } |
6380 |
+@@ -1018,9 +1062,10 @@ efx_handle_tx_flush_done(struct efx_nic *efx, efx_qword_t *event) |
6381 |
+ if (qid < EFX_TXQ_TYPES * efx->n_tx_channels) { |
6382 |
+ tx_queue = efx_get_tx_queue(efx, qid / EFX_TXQ_TYPES, |
6383 |
+ qid % EFX_TXQ_TYPES); |
6384 |
+- |
6385 |
+- efx_magic_event(tx_queue->channel, |
6386 |
+- EFX_CHANNEL_MAGIC_TX_DRAIN(tx_queue)); |
6387 |
++ if (atomic_cmpxchg(&tx_queue->flush_outstanding, 1, 0)) { |
6388 |
++ efx_magic_event(tx_queue->channel, |
6389 |
++ EFX_CHANNEL_MAGIC_TX_DRAIN(tx_queue)); |
6390 |
++ } |
6391 |
+ } |
6392 |
+ } |
6393 |
+ |
6394 |
+diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h |
6395 |
+index f48ccf6..bbdfcd6 100644 |
6396 |
+--- a/drivers/net/ethernet/sfc/nic.h |
6397 |
++++ b/drivers/net/ethernet/sfc/nic.h |
6398 |
+@@ -316,6 +316,8 @@ static inline int efx_nic_irq_test_irq_cpu(struct efx_nic *efx) |
6399 |
+ |
6400 |
+ /* Global Resources */ |
6401 |
+ extern int efx_nic_flush_queues(struct efx_nic *efx); |
6402 |
++extern void siena_prepare_flush(struct efx_nic *efx); |
6403 |
++extern void siena_finish_flush(struct efx_nic *efx); |
6404 |
+ extern void falcon_start_nic_stats(struct efx_nic *efx); |
6405 |
+ extern void falcon_stop_nic_stats(struct efx_nic *efx); |
6406 |
+ extern void falcon_setup_xaui(struct efx_nic *efx); |
6407 |
+diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c |
6408 |
+index 763fa2f..7b3c068 100644 |
6409 |
+--- a/drivers/net/ethernet/sfc/rx.c |
6410 |
++++ b/drivers/net/ethernet/sfc/rx.c |
6411 |
+@@ -95,11 +95,7 @@ static unsigned int rx_refill_limit = 95; |
6412 |
+ static inline unsigned int efx_rx_buf_offset(struct efx_nic *efx, |
6413 |
+ struct efx_rx_buffer *buf) |
6414 |
+ { |
6415 |
+- /* Offset is always within one page, so we don't need to consider |
6416 |
+- * the page order. |
6417 |
+- */ |
6418 |
+- return ((unsigned int) buf->dma_addr & (PAGE_SIZE - 1)) + |
6419 |
+- efx->type->rx_buffer_hash_size; |
6420 |
++ return buf->page_offset + efx->type->rx_buffer_hash_size; |
6421 |
+ } |
6422 |
+ static inline unsigned int efx_rx_buf_size(struct efx_nic *efx) |
6423 |
+ { |
6424 |
+@@ -193,6 +189,7 @@ static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue) |
6425 |
+ struct efx_rx_buffer *rx_buf; |
6426 |
+ struct page *page; |
6427 |
+ void *page_addr; |
6428 |
++ unsigned int page_offset; |
6429 |
+ struct efx_rx_page_state *state; |
6430 |
+ dma_addr_t dma_addr; |
6431 |
+ unsigned index, count; |
6432 |
+@@ -219,12 +216,14 @@ static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue) |
6433 |
+ |
6434 |
+ page_addr += sizeof(struct efx_rx_page_state); |
6435 |
+ dma_addr += sizeof(struct efx_rx_page_state); |
6436 |
++ page_offset = sizeof(struct efx_rx_page_state); |
6437 |
+ |
6438 |
+ split: |
6439 |
+ index = rx_queue->added_count & rx_queue->ptr_mask; |
6440 |
+ rx_buf = efx_rx_buffer(rx_queue, index); |
6441 |
+ rx_buf->dma_addr = dma_addr + EFX_PAGE_IP_ALIGN; |
6442 |
+ rx_buf->u.page = page; |
6443 |
++ rx_buf->page_offset = page_offset + EFX_PAGE_IP_ALIGN; |
6444 |
+ rx_buf->len = efx->rx_buffer_len - EFX_PAGE_IP_ALIGN; |
6445 |
+ rx_buf->flags = EFX_RX_BUF_PAGE; |
6446 |
+ ++rx_queue->added_count; |
6447 |
+@@ -236,6 +235,7 @@ static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue) |
6448 |
+ get_page(page); |
6449 |
+ dma_addr += (PAGE_SIZE >> 1); |
6450 |
+ page_addr += (PAGE_SIZE >> 1); |
6451 |
++ page_offset += (PAGE_SIZE >> 1); |
6452 |
+ ++count; |
6453 |
+ goto split; |
6454 |
+ } |
6455 |
+@@ -245,7 +245,8 @@ static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue) |
6456 |
+ } |
6457 |
+ |
6458 |
+ static void efx_unmap_rx_buffer(struct efx_nic *efx, |
6459 |
+- struct efx_rx_buffer *rx_buf) |
6460 |
++ struct efx_rx_buffer *rx_buf, |
6461 |
++ unsigned int used_len) |
6462 |
+ { |
6463 |
+ if ((rx_buf->flags & EFX_RX_BUF_PAGE) && rx_buf->u.page) { |
6464 |
+ struct efx_rx_page_state *state; |
6465 |
+@@ -256,6 +257,10 @@ static void efx_unmap_rx_buffer(struct efx_nic *efx, |
6466 |
+ state->dma_addr, |
6467 |
+ efx_rx_buf_size(efx), |
6468 |
+ PCI_DMA_FROMDEVICE); |
6469 |
++ } else if (used_len) { |
6470 |
++ dma_sync_single_for_cpu(&efx->pci_dev->dev, |
6471 |
++ rx_buf->dma_addr, used_len, |
6472 |
++ DMA_FROM_DEVICE); |
6473 |
+ } |
6474 |
+ } else if (!(rx_buf->flags & EFX_RX_BUF_PAGE) && rx_buf->u.skb) { |
6475 |
+ pci_unmap_single(efx->pci_dev, rx_buf->dma_addr, |
6476 |
+@@ -278,7 +283,7 @@ static void efx_free_rx_buffer(struct efx_nic *efx, |
6477 |
+ static void efx_fini_rx_buffer(struct efx_rx_queue *rx_queue, |
6478 |
+ struct efx_rx_buffer *rx_buf) |
6479 |
+ { |
6480 |
+- efx_unmap_rx_buffer(rx_queue->efx, rx_buf); |
6481 |
++ efx_unmap_rx_buffer(rx_queue->efx, rx_buf, 0); |
6482 |
+ efx_free_rx_buffer(rx_queue->efx, rx_buf); |
6483 |
+ } |
6484 |
+ |
6485 |
+@@ -544,10 +549,10 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, |
6486 |
+ goto out; |
6487 |
+ } |
6488 |
+ |
6489 |
+- /* Release card resources - assumes all RX buffers consumed in-order |
6490 |
+- * per RX queue |
6491 |
++ /* Release and/or sync DMA mapping - assumes all RX buffers |
6492 |
++ * consumed in-order per RX queue |
6493 |
+ */ |
6494 |
+- efx_unmap_rx_buffer(efx, rx_buf); |
6495 |
++ efx_unmap_rx_buffer(efx, rx_buf, len); |
6496 |
+ |
6497 |
+ /* Prefetch nice and early so data will (hopefully) be in cache by |
6498 |
+ * the time we look at it. |
6499 |
+diff --git a/drivers/net/ethernet/sfc/selftest.c b/drivers/net/ethernet/sfc/selftest.c |
6500 |
+index de4c006..4a51ea3 100644 |
6501 |
+--- a/drivers/net/ethernet/sfc/selftest.c |
6502 |
++++ b/drivers/net/ethernet/sfc/selftest.c |
6503 |
+@@ -120,19 +120,6 @@ static int efx_test_nvram(struct efx_nic *efx, struct efx_self_tests *tests) |
6504 |
+ return rc; |
6505 |
+ } |
6506 |
+ |
6507 |
+-static int efx_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) |
6508 |
+-{ |
6509 |
+- int rc = 0; |
6510 |
+- |
6511 |
+- /* Test register access */ |
6512 |
+- if (efx->type->test_registers) { |
6513 |
+- rc = efx->type->test_registers(efx); |
6514 |
+- tests->registers = rc ? -1 : 1; |
6515 |
+- } |
6516 |
+- |
6517 |
+- return rc; |
6518 |
+-} |
6519 |
+- |
6520 |
+ /************************************************************************** |
6521 |
+ * |
6522 |
+ * Interrupt and event queue testing |
6523 |
+@@ -699,8 +686,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, |
6524 |
+ { |
6525 |
+ enum efx_loopback_mode loopback_mode = efx->loopback_mode; |
6526 |
+ int phy_mode = efx->phy_mode; |
6527 |
+- enum reset_type reset_method = RESET_TYPE_INVISIBLE; |
6528 |
+- int rc_test = 0, rc_reset = 0, rc; |
6529 |
++ int rc_test = 0, rc_reset, rc; |
6530 |
+ |
6531 |
+ efx_selftest_async_cancel(efx); |
6532 |
+ |
6533 |
+@@ -735,46 +721,28 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, |
6534 |
+ /* Detach the device so the kernel doesn't transmit during the |
6535 |
+ * loopback test and the watchdog timeout doesn't fire. |
6536 |
+ */ |
6537 |
+- netif_device_detach(efx->net_dev); |
6538 |
++ efx_device_detach_sync(efx); |
6539 |
++ |
6540 |
++ if (efx->type->test_chip) { |
6541 |
++ rc_reset = efx->type->test_chip(efx, tests); |
6542 |
++ if (rc_reset) { |
6543 |
++ netif_err(efx, hw, efx->net_dev, |
6544 |
++ "Unable to recover from chip test\n"); |
6545 |
++ efx_schedule_reset(efx, RESET_TYPE_DISABLE); |
6546 |
++ return rc_reset; |
6547 |
++ } |
6548 |
+ |
6549 |
+- mutex_lock(&efx->mac_lock); |
6550 |
+- if (efx->loopback_modes) { |
6551 |
+- /* We need the 312 clock from the PHY to test the XMAC |
6552 |
+- * registers, so move into XGMII loopback if available */ |
6553 |
+- if (efx->loopback_modes & (1 << LOOPBACK_XGMII)) |
6554 |
+- efx->loopback_mode = LOOPBACK_XGMII; |
6555 |
+- else |
6556 |
+- efx->loopback_mode = __ffs(efx->loopback_modes); |
6557 |
++ if ((tests->registers < 0) && !rc_test) |
6558 |
++ rc_test = -EIO; |
6559 |
+ } |
6560 |
+ |
6561 |
+- __efx_reconfigure_port(efx); |
6562 |
+- mutex_unlock(&efx->mac_lock); |
6563 |
+- |
6564 |
+- /* free up all consumers of SRAM (including all the queues) */ |
6565 |
+- efx_reset_down(efx, reset_method); |
6566 |
+- |
6567 |
+- rc = efx_test_chip(efx, tests); |
6568 |
+- if (rc && !rc_test) |
6569 |
+- rc_test = rc; |
6570 |
+- |
6571 |
+- /* reset the chip to recover from the register test */ |
6572 |
+- rc_reset = efx->type->reset(efx, reset_method); |
6573 |
+- |
6574 |
+ /* Ensure that the phy is powered and out of loopback |
6575 |
+ * for the bist and loopback tests */ |
6576 |
++ mutex_lock(&efx->mac_lock); |
6577 |
+ efx->phy_mode &= ~PHY_MODE_LOW_POWER; |
6578 |
+ efx->loopback_mode = LOOPBACK_NONE; |
6579 |
+- |
6580 |
+- rc = efx_reset_up(efx, reset_method, rc_reset == 0); |
6581 |
+- if (rc && !rc_reset) |
6582 |
+- rc_reset = rc; |
6583 |
+- |
6584 |
+- if (rc_reset) { |
6585 |
+- netif_err(efx, drv, efx->net_dev, |
6586 |
+- "Unable to recover from chip test\n"); |
6587 |
+- efx_schedule_reset(efx, RESET_TYPE_DISABLE); |
6588 |
+- return rc_reset; |
6589 |
+- } |
6590 |
++ __efx_reconfigure_port(efx); |
6591 |
++ mutex_unlock(&efx->mac_lock); |
6592 |
+ |
6593 |
+ rc = efx_test_phy(efx, tests, flags); |
6594 |
+ if (rc && !rc_test) |
6595 |
+diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c |
6596 |
+index 9f8d7ce..b09ff79 100644 |
6597 |
+--- a/drivers/net/ethernet/sfc/siena.c |
6598 |
++++ b/drivers/net/ethernet/sfc/siena.c |
6599 |
+@@ -25,10 +25,12 @@ |
6600 |
+ #include "workarounds.h" |
6601 |
+ #include "mcdi.h" |
6602 |
+ #include "mcdi_pcol.h" |
6603 |
++#include "selftest.h" |
6604 |
+ |
6605 |
+ /* Hardware control for SFC9000 family including SFL9021 (aka Siena). */ |
6606 |
+ |
6607 |
+ static void siena_init_wol(struct efx_nic *efx); |
6608 |
++static int siena_reset_hw(struct efx_nic *efx, enum reset_type method); |
6609 |
+ |
6610 |
+ |
6611 |
+ static void siena_push_irq_moderation(struct efx_channel *channel) |
6612 |
+@@ -125,6 +127,18 @@ static void siena_remove_port(struct efx_nic *efx) |
6613 |
+ efx_nic_free_buffer(efx, &efx->stats_buffer); |
6614 |
+ } |
6615 |
+ |
6616 |
++void siena_prepare_flush(struct efx_nic *efx) |
6617 |
++{ |
6618 |
++ if (efx->fc_disable++ == 0) |
6619 |
++ efx_mcdi_set_mac(efx); |
6620 |
++} |
6621 |
++ |
6622 |
++void siena_finish_flush(struct efx_nic *efx) |
6623 |
++{ |
6624 |
++ if (--efx->fc_disable == 0) |
6625 |
++ efx_mcdi_set_mac(efx); |
6626 |
++} |
6627 |
++ |
6628 |
+ static const struct efx_nic_register_test siena_register_tests[] = { |
6629 |
+ { FR_AZ_ADR_REGION, |
6630 |
+ EFX_OWORD32(0x0003FFFF, 0x0003FFFF, 0x0003FFFF, 0x0003FFFF) }, |
6631 |
+@@ -154,10 +168,29 @@ static const struct efx_nic_register_test siena_register_tests[] = { |
6632 |
+ EFX_OWORD32(0xFFFFFFFF, 0xFFFFFFFF, 0x00000007, 0x00000000) }, |
6633 |
+ }; |
6634 |
+ |
6635 |
+-static int siena_test_registers(struct efx_nic *efx) |
6636 |
++static int siena_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) |
6637 |
+ { |
6638 |
+- return efx_nic_test_registers(efx, siena_register_tests, |
6639 |
+- ARRAY_SIZE(siena_register_tests)); |
6640 |
++ enum reset_type reset_method = RESET_TYPE_ALL; |
6641 |
++ int rc, rc2; |
6642 |
++ |
6643 |
++ efx_reset_down(efx, reset_method); |
6644 |
++ |
6645 |
++ /* Reset the chip immediately so that it is completely |
6646 |
++ * quiescent regardless of what any VF driver does. |
6647 |
++ */ |
6648 |
++ rc = siena_reset_hw(efx, reset_method); |
6649 |
++ if (rc) |
6650 |
++ goto out; |
6651 |
++ |
6652 |
++ tests->registers = |
6653 |
++ efx_nic_test_registers(efx, siena_register_tests, |
6654 |
++ ARRAY_SIZE(siena_register_tests)) |
6655 |
++ ? -1 : 1; |
6656 |
++ |
6657 |
++ rc = siena_reset_hw(efx, reset_method); |
6658 |
++out: |
6659 |
++ rc2 = efx_reset_up(efx, reset_method, rc == 0); |
6660 |
++ return rc ? rc : rc2; |
6661 |
+ } |
6662 |
+ |
6663 |
+ /************************************************************************** |
6664 |
+@@ -637,7 +670,8 @@ const struct efx_nic_type siena_a0_nic_type = { |
6665 |
+ .reset = siena_reset_hw, |
6666 |
+ .probe_port = siena_probe_port, |
6667 |
+ .remove_port = siena_remove_port, |
6668 |
+- .prepare_flush = efx_port_dummy_op_void, |
6669 |
++ .prepare_flush = siena_prepare_flush, |
6670 |
++ .finish_flush = siena_finish_flush, |
6671 |
+ .update_stats = siena_update_nic_stats, |
6672 |
+ .start_stats = siena_start_nic_stats, |
6673 |
+ .stop_stats = siena_stop_nic_stats, |
6674 |
+@@ -649,7 +683,7 @@ const struct efx_nic_type siena_a0_nic_type = { |
6675 |
+ .get_wol = siena_get_wol, |
6676 |
+ .set_wol = siena_set_wol, |
6677 |
+ .resume_wol = siena_init_wol, |
6678 |
+- .test_registers = siena_test_registers, |
6679 |
++ .test_chip = siena_test_chip, |
6680 |
+ .test_nvram = efx_mcdi_nvram_test_all, |
6681 |
+ |
6682 |
+ .revision = EFX_REV_SIENA_A0, |
6683 |
+diff --git a/drivers/net/ethernet/sfc/siena_sriov.c b/drivers/net/ethernet/sfc/siena_sriov.c |
6684 |
+index 9cb3b84..4ad8082 100644 |
6685 |
+--- a/drivers/net/ethernet/sfc/siena_sriov.c |
6686 |
++++ b/drivers/net/ethernet/sfc/siena_sriov.c |
6687 |
+@@ -21,6 +21,9 @@ |
6688 |
+ /* Number of longs required to track all the VIs in a VF */ |
6689 |
+ #define VI_MASK_LENGTH BITS_TO_LONGS(1 << EFX_VI_SCALE_MAX) |
6690 |
+ |
6691 |
++/* Maximum number of RX queues supported */ |
6692 |
++#define VF_MAX_RX_QUEUES 63 |
6693 |
++ |
6694 |
+ /** |
6695 |
+ * enum efx_vf_tx_filter_mode - TX MAC filtering behaviour |
6696 |
+ * @VF_TX_FILTER_OFF: Disabled |
6697 |
+@@ -578,6 +581,7 @@ static int efx_vfdi_init_rxq(struct efx_vf *vf) |
6698 |
+ efx_oword_t reg; |
6699 |
+ |
6700 |
+ if (bad_vf_index(efx, vf_evq) || bad_vf_index(efx, vf_rxq) || |
6701 |
++ vf_rxq >= VF_MAX_RX_QUEUES || |
6702 |
+ bad_buf_count(buf_count, EFX_MAX_DMAQ_SIZE)) { |
6703 |
+ if (net_ratelimit()) |
6704 |
+ netif_err(efx, hw, efx->net_dev, |
6705 |
+@@ -683,13 +687,15 @@ static int efx_vfdi_fini_all_queues(struct efx_vf *vf) |
6706 |
+ __le32 *rxqs; |
6707 |
+ int rc; |
6708 |
+ |
6709 |
++ BUILD_BUG_ON(VF_MAX_RX_QUEUES > |
6710 |
++ MC_CMD_FLUSH_RX_QUEUES_IN_QID_OFST_MAXNUM); |
6711 |
++ |
6712 |
+ rxqs = kmalloc(count * sizeof(*rxqs), GFP_KERNEL); |
6713 |
+ if (rxqs == NULL) |
6714 |
+ return VFDI_RC_ENOMEM; |
6715 |
+ |
6716 |
+ rtnl_lock(); |
6717 |
+- if (efx->fc_disable++ == 0) |
6718 |
+- efx_mcdi_set_mac(efx); |
6719 |
++ siena_prepare_flush(efx); |
6720 |
+ rtnl_unlock(); |
6721 |
+ |
6722 |
+ /* Flush all the initialized queues */ |
6723 |
+@@ -726,8 +732,7 @@ static int efx_vfdi_fini_all_queues(struct efx_vf *vf) |
6724 |
+ } |
6725 |
+ |
6726 |
+ rtnl_lock(); |
6727 |
+- if (--efx->fc_disable == 0) |
6728 |
+- efx_mcdi_set_mac(efx); |
6729 |
++ siena_finish_flush(efx); |
6730 |
+ rtnl_unlock(); |
6731 |
+ |
6732 |
+ /* Irrespective of success/failure, fini the queues */ |
6733 |
+diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c |
6734 |
+index 63ffbdf..dfffe8d 100644 |
6735 |
+--- a/drivers/net/netconsole.c |
6736 |
++++ b/drivers/net/netconsole.c |
6737 |
+@@ -626,6 +626,7 @@ static int netconsole_netdev_event(struct notifier_block *this, |
6738 |
+ goto done; |
6739 |
+ |
6740 |
+ spin_lock_irqsave(&target_list_lock, flags); |
6741 |
++restart: |
6742 |
+ list_for_each_entry(nt, &target_list, list) { |
6743 |
+ netconsole_target_get(nt); |
6744 |
+ if (nt->np.dev == dev) { |
6745 |
+@@ -637,21 +638,18 @@ static int netconsole_netdev_event(struct notifier_block *this, |
6746 |
+ case NETDEV_JOIN: |
6747 |
+ case NETDEV_UNREGISTER: |
6748 |
+ /* |
6749 |
++ * we might sleep in __netpoll_cleanup() |
6750 |
+ * rtnl_lock already held |
6751 |
+ */ |
6752 |
+- if (nt->np.dev) { |
6753 |
+- spin_unlock_irqrestore( |
6754 |
+- &target_list_lock, |
6755 |
+- flags); |
6756 |
+- __netpoll_cleanup(&nt->np); |
6757 |
+- spin_lock_irqsave(&target_list_lock, |
6758 |
+- flags); |
6759 |
+- dev_put(nt->np.dev); |
6760 |
+- nt->np.dev = NULL; |
6761 |
+- } |
6762 |
++ spin_unlock_irqrestore(&target_list_lock, flags); |
6763 |
++ __netpoll_cleanup(&nt->np); |
6764 |
++ spin_lock_irqsave(&target_list_lock, flags); |
6765 |
++ dev_put(nt->np.dev); |
6766 |
++ nt->np.dev = NULL; |
6767 |
+ nt->enabled = 0; |
6768 |
+ stopped = true; |
6769 |
+- break; |
6770 |
++ netconsole_target_put(nt); |
6771 |
++ goto restart; |
6772 |
+ } |
6773 |
+ } |
6774 |
+ netconsole_target_put(nt); |
6775 |
+diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c |
6776 |
+index 8f9382b..b968b35 100644 |
6777 |
+--- a/drivers/net/wireless/mwifiex/join.c |
6778 |
++++ b/drivers/net/wireless/mwifiex/join.c |
6779 |
+@@ -1049,10 +1049,9 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, |
6780 |
+ adhoc_join->bss_descriptor.bssid, |
6781 |
+ adhoc_join->bss_descriptor.ssid); |
6782 |
+ |
6783 |
+- for (i = 0; bss_desc->supported_rates[i] && |
6784 |
+- i < MWIFIEX_SUPPORTED_RATES; |
6785 |
+- i++) |
6786 |
+- ; |
6787 |
++ for (i = 0; i < MWIFIEX_SUPPORTED_RATES && |
6788 |
++ bss_desc->supported_rates[i]; i++) |
6789 |
++ ; |
6790 |
+ rates_size = i; |
6791 |
+ |
6792 |
+ /* Copy Data Rates from the Rates recorded in scan response */ |
6793 |
+diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c |
6794 |
+index 12b1ff5..8f2c88e 100644 |
6795 |
+--- a/drivers/net/wireless/rt2x00/rt2x00dev.c |
6796 |
++++ b/drivers/net/wireless/rt2x00/rt2x00dev.c |
6797 |
+@@ -1157,7 +1157,9 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) |
6798 |
+ rt2x00dev->hw->wiphy->interface_modes |= |
6799 |
+ BIT(NL80211_IFTYPE_ADHOC) | |
6800 |
+ BIT(NL80211_IFTYPE_AP) | |
6801 |
++#ifdef CONFIG_MAC80211_MESH |
6802 |
+ BIT(NL80211_IFTYPE_MESH_POINT) | |
6803 |
++#endif |
6804 |
+ BIT(NL80211_IFTYPE_WDS); |
6805 |
+ |
6806 |
+ /* |
6807 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c |
6808 |
+index 0c74d4f..91d2e28 100644 |
6809 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c |
6810 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c |
6811 |
+@@ -1377,74 +1377,57 @@ void rtl92cu_card_disable(struct ieee80211_hw *hw) |
6812 |
+ |
6813 |
+ void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) |
6814 |
+ { |
6815 |
+- /* dummy routine needed for callback from rtl_op_configure_filter() */ |
6816 |
+-} |
6817 |
+- |
6818 |
+-/*========================================================================== */ |
6819 |
+- |
6820 |
+-static void _rtl92cu_set_check_bssid(struct ieee80211_hw *hw, |
6821 |
+- enum nl80211_iftype type) |
6822 |
+-{ |
6823 |
+ struct rtl_priv *rtlpriv = rtl_priv(hw); |
6824 |
+- u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR); |
6825 |
+ struct rtl_hal *rtlhal = rtl_hal(rtlpriv); |
6826 |
+- struct rtl_phy *rtlphy = &(rtlpriv->phy); |
6827 |
+- u8 filterout_non_associated_bssid = false; |
6828 |
++ u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR); |
6829 |
+ |
6830 |
+- switch (type) { |
6831 |
+- case NL80211_IFTYPE_ADHOC: |
6832 |
+- case NL80211_IFTYPE_STATION: |
6833 |
+- filterout_non_associated_bssid = true; |
6834 |
+- break; |
6835 |
+- case NL80211_IFTYPE_UNSPECIFIED: |
6836 |
+- case NL80211_IFTYPE_AP: |
6837 |
+- default: |
6838 |
+- break; |
6839 |
+- } |
6840 |
+- if (filterout_non_associated_bssid) { |
6841 |
++ if (rtlpriv->psc.rfpwr_state != ERFON) |
6842 |
++ return; |
6843 |
++ |
6844 |
++ if (check_bssid) { |
6845 |
++ u8 tmp; |
6846 |
+ if (IS_NORMAL_CHIP(rtlhal->version)) { |
6847 |
+- switch (rtlphy->current_io_type) { |
6848 |
+- case IO_CMD_RESUME_DM_BY_SCAN: |
6849 |
+- reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
6850 |
+- rtlpriv->cfg->ops->set_hw_reg(hw, |
6851 |
+- HW_VAR_RCR, (u8 *)(®_rcr)); |
6852 |
+- /* enable update TSF */ |
6853 |
+- _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(4)); |
6854 |
+- break; |
6855 |
+- case IO_CMD_PAUSE_DM_BY_SCAN: |
6856 |
+- reg_rcr &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
6857 |
+- rtlpriv->cfg->ops->set_hw_reg(hw, |
6858 |
+- HW_VAR_RCR, (u8 *)(®_rcr)); |
6859 |
+- /* disable update TSF */ |
6860 |
+- _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0); |
6861 |
+- break; |
6862 |
+- } |
6863 |
++ reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
6864 |
++ tmp = BIT(4); |
6865 |
+ } else { |
6866 |
+- reg_rcr |= (RCR_CBSSID); |
6867 |
+- rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, |
6868 |
+- (u8 *)(®_rcr)); |
6869 |
+- _rtl92cu_set_bcn_ctrl_reg(hw, 0, (BIT(4)|BIT(5))); |
6870 |
++ reg_rcr |= RCR_CBSSID; |
6871 |
++ tmp = BIT(4) | BIT(5); |
6872 |
+ } |
6873 |
+- } else if (filterout_non_associated_bssid == false) { |
6874 |
++ rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, |
6875 |
++ (u8 *) (®_rcr)); |
6876 |
++ _rtl92cu_set_bcn_ctrl_reg(hw, 0, tmp); |
6877 |
++ } else { |
6878 |
++ u8 tmp; |
6879 |
+ if (IS_NORMAL_CHIP(rtlhal->version)) { |
6880 |
+- reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); |
6881 |
+- rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, |
6882 |
+- (u8 *)(®_rcr)); |
6883 |
+- _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0); |
6884 |
++ reg_rcr &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
6885 |
++ tmp = BIT(4); |
6886 |
+ } else { |
6887 |
+- reg_rcr &= (~RCR_CBSSID); |
6888 |
+- rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, |
6889 |
+- (u8 *)(®_rcr)); |
6890 |
+- _rtl92cu_set_bcn_ctrl_reg(hw, (BIT(4)|BIT(5)), 0); |
6891 |
++ reg_rcr &= ~RCR_CBSSID; |
6892 |
++ tmp = BIT(4) | BIT(5); |
6893 |
+ } |
6894 |
++ reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); |
6895 |
++ rtlpriv->cfg->ops->set_hw_reg(hw, |
6896 |
++ HW_VAR_RCR, (u8 *) (®_rcr)); |
6897 |
++ _rtl92cu_set_bcn_ctrl_reg(hw, tmp, 0); |
6898 |
+ } |
6899 |
+ } |
6900 |
+ |
6901 |
++/*========================================================================== */ |
6902 |
++ |
6903 |
+ int rtl92cu_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) |
6904 |
+ { |
6905 |
++ struct rtl_priv *rtlpriv = rtl_priv(hw); |
6906 |
++ |
6907 |
+ if (_rtl92cu_set_media_status(hw, type)) |
6908 |
+ return -EOPNOTSUPP; |
6909 |
+- _rtl92cu_set_check_bssid(hw, type); |
6910 |
++ |
6911 |
++ if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { |
6912 |
++ if (type != NL80211_IFTYPE_AP) |
6913 |
++ rtl92cu_set_check_bssid(hw, true); |
6914 |
++ } else { |
6915 |
++ rtl92cu_set_check_bssid(hw, false); |
6916 |
++ } |
6917 |
++ |
6918 |
+ return 0; |
6919 |
+ } |
6920 |
+ |
6921 |
+@@ -2059,8 +2042,6 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, |
6922 |
+ (shortgi_rate << 4) | (shortgi_rate); |
6923 |
+ } |
6924 |
+ rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); |
6925 |
+- RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n", |
6926 |
+- rtl_read_dword(rtlpriv, REG_ARFR0)); |
6927 |
+ } |
6928 |
+ |
6929 |
+ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) |
6930 |
+diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c |
6931 |
+index 110c777..12da810 100644 |
6932 |
+--- a/drivers/platform/x86/asus-laptop.c |
6933 |
++++ b/drivers/platform/x86/asus-laptop.c |
6934 |
+@@ -860,8 +860,10 @@ static ssize_t show_infos(struct device *dev, |
6935 |
+ /* |
6936 |
+ * The HWRS method return informations about the hardware. |
6937 |
+ * 0x80 bit is for WLAN, 0x100 for Bluetooth. |
6938 |
++ * 0x40 for WWAN, 0x10 for WIMAX. |
6939 |
+ * The significance of others is yet to be found. |
6940 |
+- * If we don't find the method, we assume the device are present. |
6941 |
++ * We don't currently use this for device detection, and it |
6942 |
++ * takes several seconds to run on some systems. |
6943 |
+ */ |
6944 |
+ rv = acpi_evaluate_integer(asus->handle, "HWRS", NULL, &temp); |
6945 |
+ if (!ACPI_FAILURE(rv)) |
6946 |
+@@ -1682,7 +1684,7 @@ static int asus_laptop_get_info(struct asus_laptop *asus) |
6947 |
+ { |
6948 |
+ struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
6949 |
+ union acpi_object *model = NULL; |
6950 |
+- unsigned long long bsts_result, hwrs_result; |
6951 |
++ unsigned long long bsts_result; |
6952 |
+ char *string = NULL; |
6953 |
+ acpi_status status; |
6954 |
+ |
6955 |
+@@ -1744,17 +1746,6 @@ static int asus_laptop_get_info(struct asus_laptop *asus) |
6956 |
+ if (*string) |
6957 |
+ pr_notice(" %s model detected\n", string); |
6958 |
+ |
6959 |
+- /* |
6960 |
+- * The HWRS method return informations about the hardware. |
6961 |
+- * 0x80 bit is for WLAN, 0x100 for Bluetooth, |
6962 |
+- * 0x40 for WWAN, 0x10 for WIMAX. |
6963 |
+- * The significance of others is yet to be found. |
6964 |
+- */ |
6965 |
+- status = |
6966 |
+- acpi_evaluate_integer(asus->handle, "HWRS", NULL, &hwrs_result); |
6967 |
+- if (!ACPI_FAILURE(status)) |
6968 |
+- pr_notice(" HWRS returned %x", (int)hwrs_result); |
6969 |
+- |
6970 |
+ if (!acpi_check_handle(asus->handle, METHOD_WL_STATUS, NULL)) |
6971 |
+ asus->have_rsts = true; |
6972 |
+ |
6973 |
+diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c |
6974 |
+index db0cf7c..a0fc7b9 100644 |
6975 |
+--- a/drivers/target/iscsi/iscsi_target_auth.c |
6976 |
++++ b/drivers/target/iscsi/iscsi_target_auth.c |
6977 |
+@@ -166,6 +166,7 @@ static int chap_server_compute_md5( |
6978 |
+ { |
6979 |
+ char *endptr; |
6980 |
+ unsigned long id; |
6981 |
++ unsigned char id_as_uchar; |
6982 |
+ unsigned char digest[MD5_SIGNATURE_SIZE]; |
6983 |
+ unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; |
6984 |
+ unsigned char identifier[10], *challenge = NULL; |
6985 |
+@@ -355,7 +356,9 @@ static int chap_server_compute_md5( |
6986 |
+ goto out; |
6987 |
+ } |
6988 |
+ |
6989 |
+- sg_init_one(&sg, &id, 1); |
6990 |
++ /* To handle both endiannesses */ |
6991 |
++ id_as_uchar = id; |
6992 |
++ sg_init_one(&sg, &id_as_uchar, 1); |
6993 |
+ ret = crypto_hash_update(&desc, &sg, 1); |
6994 |
+ if (ret < 0) { |
6995 |
+ pr_err("crypto_hash_update() failed for id\n"); |
6996 |
+diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c |
6997 |
+index 675303b..76fa1fa 100644 |
6998 |
+--- a/drivers/tty/serial/sunsu.c |
6999 |
++++ b/drivers/tty/serial/sunsu.c |
7000 |
+@@ -968,6 +968,7 @@ static struct uart_ops sunsu_pops = { |
7001 |
+ #define UART_NR 4 |
7002 |
+ |
7003 |
+ static struct uart_sunsu_port sunsu_ports[UART_NR]; |
7004 |
++static int nr_inst; /* Number of already registered ports */ |
7005 |
+ |
7006 |
+ #ifdef CONFIG_SERIO |
7007 |
+ |
7008 |
+@@ -1337,13 +1338,8 @@ static int __init sunsu_console_setup(struct console *co, char *options) |
7009 |
+ printk("Console: ttyS%d (SU)\n", |
7010 |
+ (sunsu_reg.minor - 64) + co->index); |
7011 |
+ |
7012 |
+- /* |
7013 |
+- * Check whether an invalid uart number has been specified, and |
7014 |
+- * if so, search for the first available port that does have |
7015 |
+- * console support. |
7016 |
+- */ |
7017 |
+- if (co->index >= UART_NR) |
7018 |
+- co->index = 0; |
7019 |
++ if (co->index > nr_inst) |
7020 |
++ return -ENODEV; |
7021 |
+ port = &sunsu_ports[co->index].port; |
7022 |
+ |
7023 |
+ /* |
7024 |
+@@ -1408,7 +1404,6 @@ static enum su_type __devinit su_get_type(struct device_node *dp) |
7025 |
+ |
7026 |
+ static int __devinit su_probe(struct platform_device *op) |
7027 |
+ { |
7028 |
+- static int inst; |
7029 |
+ struct device_node *dp = op->dev.of_node; |
7030 |
+ struct uart_sunsu_port *up; |
7031 |
+ struct resource *rp; |
7032 |
+@@ -1418,16 +1413,16 @@ static int __devinit su_probe(struct platform_device *op) |
7033 |
+ |
7034 |
+ type = su_get_type(dp); |
7035 |
+ if (type == SU_PORT_PORT) { |
7036 |
+- if (inst >= UART_NR) |
7037 |
++ if (nr_inst >= UART_NR) |
7038 |
+ return -EINVAL; |
7039 |
+- up = &sunsu_ports[inst]; |
7040 |
++ up = &sunsu_ports[nr_inst]; |
7041 |
+ } else { |
7042 |
+ up = kzalloc(sizeof(*up), GFP_KERNEL); |
7043 |
+ if (!up) |
7044 |
+ return -ENOMEM; |
7045 |
+ } |
7046 |
+ |
7047 |
+- up->port.line = inst; |
7048 |
++ up->port.line = nr_inst; |
7049 |
+ |
7050 |
+ spin_lock_init(&up->port.lock); |
7051 |
+ |
7052 |
+@@ -1461,6 +1456,8 @@ static int __devinit su_probe(struct platform_device *op) |
7053 |
+ } |
7054 |
+ dev_set_drvdata(&op->dev, up); |
7055 |
+ |
7056 |
++ nr_inst++; |
7057 |
++ |
7058 |
+ return 0; |
7059 |
+ } |
7060 |
+ |
7061 |
+@@ -1488,7 +1485,7 @@ static int __devinit su_probe(struct platform_device *op) |
7062 |
+ |
7063 |
+ dev_set_drvdata(&op->dev, up); |
7064 |
+ |
7065 |
+- inst++; |
7066 |
++ nr_inst++; |
7067 |
+ |
7068 |
+ return 0; |
7069 |
+ |
7070 |
+diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
7071 |
+index 3a7a950..e411f18 100644 |
7072 |
+--- a/drivers/usb/class/cdc-acm.c |
7073 |
++++ b/drivers/usb/class/cdc-acm.c |
7074 |
+@@ -601,7 +601,6 @@ static void acm_port_destruct(struct tty_port *port) |
7075 |
+ |
7076 |
+ dev_dbg(&acm->control->dev, "%s\n", __func__); |
7077 |
+ |
7078 |
+- tty_unregister_device(acm_tty_driver, acm->minor); |
7079 |
+ acm_release_minor(acm); |
7080 |
+ usb_put_intf(acm->control); |
7081 |
+ kfree(acm->country_codes); |
7082 |
+@@ -1418,6 +1417,8 @@ static void acm_disconnect(struct usb_interface *intf) |
7083 |
+ |
7084 |
+ stop_data_traffic(acm); |
7085 |
+ |
7086 |
++ tty_unregister_device(acm_tty_driver, acm->minor); |
7087 |
++ |
7088 |
+ usb_free_urb(acm->ctrlurb); |
7089 |
+ for (i = 0; i < ACM_NW; i++) |
7090 |
+ usb_free_urb(acm->wb[i].urb); |
7091 |
+diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c |
7092 |
+index 622b4a4..2b487d4 100644 |
7093 |
+--- a/drivers/usb/core/hcd-pci.c |
7094 |
++++ b/drivers/usb/core/hcd-pci.c |
7095 |
+@@ -173,6 +173,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) |
7096 |
+ struct hc_driver *driver; |
7097 |
+ struct usb_hcd *hcd; |
7098 |
+ int retval; |
7099 |
++ int hcd_irq = 0; |
7100 |
+ |
7101 |
+ if (usb_disabled()) |
7102 |
+ return -ENODEV; |
7103 |
+@@ -187,15 +188,19 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) |
7104 |
+ return -ENODEV; |
7105 |
+ dev->current_state = PCI_D0; |
7106 |
+ |
7107 |
+- /* The xHCI driver supports MSI and MSI-X, |
7108 |
+- * so don't fail if the BIOS doesn't provide a legacy IRQ. |
7109 |
++ /* |
7110 |
++ * The xHCI driver has its own irq management |
7111 |
++ * make sure irq setup is not touched for xhci in generic hcd code |
7112 |
+ */ |
7113 |
+- if (!dev->irq && (driver->flags & HCD_MASK) != HCD_USB3) { |
7114 |
+- dev_err(&dev->dev, |
7115 |
+- "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", |
7116 |
+- pci_name(dev)); |
7117 |
+- retval = -ENODEV; |
7118 |
+- goto disable_pci; |
7119 |
++ if ((driver->flags & HCD_MASK) != HCD_USB3) { |
7120 |
++ if (!dev->irq) { |
7121 |
++ dev_err(&dev->dev, |
7122 |
++ "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", |
7123 |
++ pci_name(dev)); |
7124 |
++ retval = -ENODEV; |
7125 |
++ goto disable_pci; |
7126 |
++ } |
7127 |
++ hcd_irq = dev->irq; |
7128 |
+ } |
7129 |
+ |
7130 |
+ hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev)); |
7131 |
+@@ -245,7 +250,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) |
7132 |
+ |
7133 |
+ pci_set_master(dev); |
7134 |
+ |
7135 |
+- retval = usb_add_hcd(hcd, dev->irq, IRQF_SHARED); |
7136 |
++ retval = usb_add_hcd(hcd, hcd_irq, IRQF_SHARED); |
7137 |
+ if (retval != 0) |
7138 |
+ goto unmap_registers; |
7139 |
+ set_hs_companion(dev, hcd); |
7140 |
+diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c |
7141 |
+index e305689..7261e8f 100644 |
7142 |
+--- a/drivers/usb/host/ehci-q.c |
7143 |
++++ b/drivers/usb/host/ehci-q.c |
7144 |
+@@ -135,7 +135,7 @@ qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh) |
7145 |
+ * qtd is updated in qh_completions(). Update the QH |
7146 |
+ * overlay here. |
7147 |
+ */ |
7148 |
+- if (qh->hw->hw_token & ACTIVE_BIT(ehci)) { |
7149 |
++ if (cpu_to_hc32(ehci, qtd->qtd_dma) == qh->hw->hw_current) { |
7150 |
+ qh->hw->hw_qtd_next = qtd->hw_next; |
7151 |
+ qtd = NULL; |
7152 |
+ } |
7153 |
+@@ -459,19 +459,11 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) |
7154 |
+ else if (last_status == -EINPROGRESS && !urb->unlinked) |
7155 |
+ continue; |
7156 |
+ |
7157 |
+- /* |
7158 |
+- * If this was the active qtd when the qh was unlinked |
7159 |
+- * and the overlay's token is active, then the overlay |
7160 |
+- * hasn't been written back to the qtd yet so use its |
7161 |
+- * token instead of the qtd's. After the qtd is |
7162 |
+- * processed and removed, the overlay won't be valid |
7163 |
+- * any more. |
7164 |
+- */ |
7165 |
+- if (state == QH_STATE_IDLE && |
7166 |
+- qh->qtd_list.next == &qtd->qtd_list && |
7167 |
+- (hw->hw_token & ACTIVE_BIT(ehci))) { |
7168 |
++ /* qh unlinked; token in overlay may be most current */ |
7169 |
++ if (state == QH_STATE_IDLE |
7170 |
++ && cpu_to_hc32(ehci, qtd->qtd_dma) |
7171 |
++ == hw->hw_current) { |
7172 |
+ token = hc32_to_cpu(ehci, hw->hw_token); |
7173 |
+- hw->hw_token &= ~ACTIVE_BIT(ehci); |
7174 |
+ |
7175 |
+ /* An unlink may leave an incomplete |
7176 |
+ * async transaction in the TT buffer. |
7177 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
7178 |
+index b04134a..ec2c89f 100644 |
7179 |
+--- a/drivers/usb/host/xhci.c |
7180 |
++++ b/drivers/usb/host/xhci.c |
7181 |
+@@ -350,7 +350,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) |
7182 |
+ * generate interrupts. Don't even try to enable MSI. |
7183 |
+ */ |
7184 |
+ if (xhci->quirks & XHCI_BROKEN_MSI) |
7185 |
+- return 0; |
7186 |
++ goto legacy_irq; |
7187 |
+ |
7188 |
+ /* unregister the legacy interrupt */ |
7189 |
+ if (hcd->irq) |
7190 |
+@@ -371,6 +371,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) |
7191 |
+ return -EINVAL; |
7192 |
+ } |
7193 |
+ |
7194 |
++ legacy_irq: |
7195 |
+ /* fall back to legacy interrupt*/ |
7196 |
+ ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, |
7197 |
+ hcd->irq_descr, hcd); |
7198 |
+diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
7199 |
+index 5361fd8..81d839f 100644 |
7200 |
+--- a/drivers/usb/host/xhci.h |
7201 |
++++ b/drivers/usb/host/xhci.h |
7202 |
+@@ -206,8 +206,8 @@ struct xhci_op_regs { |
7203 |
+ /* bits 12:31 are reserved (and should be preserved on writes). */ |
7204 |
+ |
7205 |
+ /* IMAN - Interrupt Management Register */ |
7206 |
+-#define IMAN_IP (1 << 1) |
7207 |
+-#define IMAN_IE (1 << 0) |
7208 |
++#define IMAN_IE (1 << 1) |
7209 |
++#define IMAN_IP (1 << 0) |
7210 |
+ |
7211 |
+ /* USBSTS - USB status - status bitmasks */ |
7212 |
+ /* HC not running - set to 1 when run/stop bit is cleared. */ |
7213 |
+diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c |
7214 |
+index e8eb634..ba5b527 100644 |
7215 |
+--- a/drivers/usb/serial/garmin_gps.c |
7216 |
++++ b/drivers/usb/serial/garmin_gps.c |
7217 |
+@@ -971,10 +971,7 @@ static void garmin_close(struct usb_serial_port *port) |
7218 |
+ if (!serial) |
7219 |
+ return; |
7220 |
+ |
7221 |
+- mutex_lock(&port->serial->disc_mutex); |
7222 |
+- |
7223 |
+- if (!port->serial->disconnected) |
7224 |
+- garmin_clear(garmin_data_p); |
7225 |
++ garmin_clear(garmin_data_p); |
7226 |
+ |
7227 |
+ /* shutdown our urbs */ |
7228 |
+ usb_kill_urb(port->read_urb); |
7229 |
+@@ -983,8 +980,6 @@ static void garmin_close(struct usb_serial_port *port) |
7230 |
+ /* keep reset state so we know that we must start a new session */ |
7231 |
+ if (garmin_data_p->state != STATE_RESET) |
7232 |
+ garmin_data_p->state = STATE_DISCONNECTED; |
7233 |
+- |
7234 |
+- mutex_unlock(&port->serial->disc_mutex); |
7235 |
+ } |
7236 |
+ |
7237 |
+ |
7238 |
+diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c |
7239 |
+index 40a95a7..7e8bb8f 100644 |
7240 |
+--- a/drivers/usb/serial/io_ti.c |
7241 |
++++ b/drivers/usb/serial/io_ti.c |
7242 |
+@@ -2770,6 +2770,7 @@ static struct usb_serial_driver edgeport_2port_device = { |
7243 |
+ .set_termios = edge_set_termios, |
7244 |
+ .tiocmget = edge_tiocmget, |
7245 |
+ .tiocmset = edge_tiocmset, |
7246 |
++ .get_icount = edge_get_icount, |
7247 |
+ .write = edge_write, |
7248 |
+ .write_room = edge_write_room, |
7249 |
+ .chars_in_buffer = edge_chars_in_buffer, |
7250 |
+diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c |
7251 |
+index e4b199c..810695b 100644 |
7252 |
+--- a/drivers/usb/serial/usb-serial.c |
7253 |
++++ b/drivers/usb/serial/usb-serial.c |
7254 |
+@@ -168,6 +168,7 @@ static void destroy_serial(struct kref *kref) |
7255 |
+ } |
7256 |
+ } |
7257 |
+ |
7258 |
++ usb_put_intf(serial->interface); |
7259 |
+ usb_put_dev(serial->dev); |
7260 |
+ kfree(serial); |
7261 |
+ } |
7262 |
+@@ -625,7 +626,7 @@ static struct usb_serial *create_serial(struct usb_device *dev, |
7263 |
+ } |
7264 |
+ serial->dev = usb_get_dev(dev); |
7265 |
+ serial->type = driver; |
7266 |
+- serial->interface = interface; |
7267 |
++ serial->interface = usb_get_intf(interface); |
7268 |
+ kref_init(&serial->kref); |
7269 |
+ mutex_init(&serial->disc_mutex); |
7270 |
+ serial->minor = SERIAL_TTY_NO_MINOR; |
7271 |
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
7272 |
+index 5ffa116..8ee632c 100644 |
7273 |
+--- a/drivers/usb/storage/unusual_devs.h |
7274 |
++++ b/drivers/usb/storage/unusual_devs.h |
7275 |
+@@ -488,6 +488,13 @@ UNUSUAL_DEV( 0x04e8, 0x5122, 0x0000, 0x9999, |
7276 |
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
7277 |
+ US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), |
7278 |
+ |
7279 |
++/* Added by Dmitry Artamonow <mad_soft@×××××.ru> */ |
7280 |
++UNUSUAL_DEV( 0x04e8, 0x5136, 0x0000, 0x9999, |
7281 |
++ "Samsung", |
7282 |
++ "YP-Z3", |
7283 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
7284 |
++ US_FL_MAX_SECTORS_64), |
7285 |
++ |
7286 |
+ /* Entry and supporting patch by Theodore Kilgore <kilgota@××××××.edu>. |
7287 |
+ * Device uses standards-violating 32-byte Bulk Command Block Wrappers and |
7288 |
+ * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. |
7289 |
+diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c |
7290 |
+index 4134e53..50a3cb5 100644 |
7291 |
+--- a/drivers/vhost/net.c |
7292 |
++++ b/drivers/vhost/net.c |
7293 |
+@@ -235,7 +235,8 @@ static void handle_tx(struct vhost_net *net) |
7294 |
+ msg.msg_controllen = 0; |
7295 |
+ ubufs = NULL; |
7296 |
+ } else { |
7297 |
+- struct ubuf_info *ubuf = &vq->ubuf_info[head]; |
7298 |
++ struct ubuf_info *ubuf; |
7299 |
++ ubuf = vq->ubuf_info + vq->upend_idx; |
7300 |
+ |
7301 |
+ vq->heads[vq->upend_idx].len = len; |
7302 |
+ ubuf->callback = vhost_zerocopy_callback; |
7303 |
+diff --git a/fs/binfmt_em86.c b/fs/binfmt_em86.c |
7304 |
+index 2790c7e..575796a 100644 |
7305 |
+--- a/fs/binfmt_em86.c |
7306 |
++++ b/fs/binfmt_em86.c |
7307 |
+@@ -42,7 +42,6 @@ static int load_em86(struct linux_binprm *bprm,struct pt_regs *regs) |
7308 |
+ return -ENOEXEC; |
7309 |
+ } |
7310 |
+ |
7311 |
+- bprm->recursion_depth++; /* Well, the bang-shell is implicit... */ |
7312 |
+ allow_write_access(bprm->file); |
7313 |
+ fput(bprm->file); |
7314 |
+ bprm->file = NULL; |
7315 |
+diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c |
7316 |
+index e172439..87fa90d 100644 |
7317 |
+--- a/fs/binfmt_misc.c |
7318 |
++++ b/fs/binfmt_misc.c |
7319 |
+@@ -117,10 +117,6 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs) |
7320 |
+ if (!enabled) |
7321 |
+ goto _ret; |
7322 |
+ |
7323 |
+- retval = -ENOEXEC; |
7324 |
+- if (bprm->recursion_depth > BINPRM_MAX_RECURSION) |
7325 |
+- goto _ret; |
7326 |
+- |
7327 |
+ /* to keep locking time low, we copy the interpreter string */ |
7328 |
+ read_lock(&entries_lock); |
7329 |
+ fmt = check_file(bprm); |
7330 |
+@@ -200,8 +196,6 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs) |
7331 |
+ if (retval < 0) |
7332 |
+ goto _error; |
7333 |
+ |
7334 |
+- bprm->recursion_depth++; |
7335 |
+- |
7336 |
+ retval = search_binary_handler (bprm, regs); |
7337 |
+ if (retval < 0) |
7338 |
+ goto _error; |
7339 |
+diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c |
7340 |
+index df49d48..8ae4be1 100644 |
7341 |
+--- a/fs/binfmt_script.c |
7342 |
++++ b/fs/binfmt_script.c |
7343 |
+@@ -22,15 +22,13 @@ static int load_script(struct linux_binprm *bprm,struct pt_regs *regs) |
7344 |
+ char interp[BINPRM_BUF_SIZE]; |
7345 |
+ int retval; |
7346 |
+ |
7347 |
+- if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!') || |
7348 |
+- (bprm->recursion_depth > BINPRM_MAX_RECURSION)) |
7349 |
++ if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!')) |
7350 |
+ return -ENOEXEC; |
7351 |
+ /* |
7352 |
+ * This section does the #! interpretation. |
7353 |
+ * Sorta complicated, but hopefully it will work. -TYT |
7354 |
+ */ |
7355 |
+ |
7356 |
+- bprm->recursion_depth++; |
7357 |
+ allow_write_access(bprm->file); |
7358 |
+ fput(bprm->file); |
7359 |
+ bprm->file = NULL; |
7360 |
+diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c |
7361 |
+index cfd1ce3..1d36db1 100644 |
7362 |
+--- a/fs/cifs/asn1.c |
7363 |
++++ b/fs/cifs/asn1.c |
7364 |
+@@ -614,53 +614,10 @@ decode_negTokenInit(unsigned char *security_blob, int length, |
7365 |
+ } |
7366 |
+ } |
7367 |
+ |
7368 |
+- /* mechlistMIC */ |
7369 |
+- if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { |
7370 |
+- /* Check if we have reached the end of the blob, but with |
7371 |
+- no mechListMic (e.g. NTLMSSP instead of KRB5) */ |
7372 |
+- if (ctx.error == ASN1_ERR_DEC_EMPTY) |
7373 |
+- goto decode_negtoken_exit; |
7374 |
+- cFYI(1, "Error decoding last part negTokenInit exit3"); |
7375 |
+- return 0; |
7376 |
+- } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { |
7377 |
+- /* tag = 3 indicating mechListMIC */ |
7378 |
+- cFYI(1, "Exit 4 cls = %d con = %d tag = %d end = %p (%d)", |
7379 |
+- cls, con, tag, end, *end); |
7380 |
+- return 0; |
7381 |
+- } |
7382 |
+- |
7383 |
+- /* sequence */ |
7384 |
+- if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { |
7385 |
+- cFYI(1, "Error decoding last part negTokenInit exit5"); |
7386 |
+- return 0; |
7387 |
+- } else if ((cls != ASN1_UNI) || (con != ASN1_CON) |
7388 |
+- || (tag != ASN1_SEQ)) { |
7389 |
+- cFYI(1, "cls = %d con = %d tag = %d end = %p (%d)", |
7390 |
+- cls, con, tag, end, *end); |
7391 |
+- } |
7392 |
+- |
7393 |
+- /* sequence of */ |
7394 |
+- if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { |
7395 |
+- cFYI(1, "Error decoding last part negTokenInit exit 7"); |
7396 |
+- return 0; |
7397 |
+- } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { |
7398 |
+- cFYI(1, "Exit 8 cls = %d con = %d tag = %d end = %p (%d)", |
7399 |
+- cls, con, tag, end, *end); |
7400 |
+- return 0; |
7401 |
+- } |
7402 |
+- |
7403 |
+- /* general string */ |
7404 |
+- if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { |
7405 |
+- cFYI(1, "Error decoding last part negTokenInit exit9"); |
7406 |
+- return 0; |
7407 |
+- } else if ((cls != ASN1_UNI) || (con != ASN1_PRI) |
7408 |
+- || (tag != ASN1_GENSTR)) { |
7409 |
+- cFYI(1, "Exit10 cls = %d con = %d tag = %d end = %p (%d)", |
7410 |
+- cls, con, tag, end, *end); |
7411 |
+- return 0; |
7412 |
+- } |
7413 |
+- cFYI(1, "Need to call asn1_octets_decode() function for %s", |
7414 |
+- ctx.pointer); /* is this UTF-8 or ASCII? */ |
7415 |
+-decode_negtoken_exit: |
7416 |
++ /* |
7417 |
++ * We currently ignore anything at the end of the SPNEGO blob after |
7418 |
++ * the mechTypes have been parsed, since none of that info is |
7419 |
++ * used at the moment. |
7420 |
++ */ |
7421 |
+ return 1; |
7422 |
+ } |
7423 |
+diff --git a/fs/exec.c b/fs/exec.c |
7424 |
+index 51d8629..e3a7e36d 100644 |
7425 |
+--- a/fs/exec.c |
7426 |
++++ b/fs/exec.c |
7427 |
+@@ -1389,6 +1389,10 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) |
7428 |
+ struct linux_binfmt *fmt; |
7429 |
+ pid_t old_pid, old_vpid; |
7430 |
+ |
7431 |
++ /* This allows 4 levels of binfmt rewrites before failing hard. */ |
7432 |
++ if (depth > 5) |
7433 |
++ return -ELOOP; |
7434 |
++ |
7435 |
+ retval = security_bprm_check(bprm); |
7436 |
+ if (retval) |
7437 |
+ return retval; |
7438 |
+@@ -1413,12 +1417,8 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) |
7439 |
+ if (!try_module_get(fmt->module)) |
7440 |
+ continue; |
7441 |
+ read_unlock(&binfmt_lock); |
7442 |
++ bprm->recursion_depth = depth + 1; |
7443 |
+ retval = fn(bprm, regs); |
7444 |
+- /* |
7445 |
+- * Restore the depth counter to its starting value |
7446 |
+- * in this call, so we don't have to rely on every |
7447 |
+- * load_binary function to restore it on return. |
7448 |
+- */ |
7449 |
+ bprm->recursion_depth = depth; |
7450 |
+ if (retval >= 0) { |
7451 |
+ if (depth == 0) { |
7452 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
7453 |
+index 852d4c2..0efff1e 100644 |
7454 |
+--- a/fs/ext4/extents.c |
7455 |
++++ b/fs/ext4/extents.c |
7456 |
+@@ -2959,6 +2959,7 @@ static int ext4_split_extent(handle_t *handle, |
7457 |
+ int err = 0; |
7458 |
+ int uninitialized; |
7459 |
+ int split_flag1, flags1; |
7460 |
++ int allocated = map->m_len; |
7461 |
+ |
7462 |
+ depth = ext_depth(inode); |
7463 |
+ ex = path[depth].p_ext; |
7464 |
+@@ -2978,6 +2979,8 @@ static int ext4_split_extent(handle_t *handle, |
7465 |
+ map->m_lblk + map->m_len, split_flag1, flags1); |
7466 |
+ if (err) |
7467 |
+ goto out; |
7468 |
++ } else { |
7469 |
++ allocated = ee_len - (map->m_lblk - ee_block); |
7470 |
+ } |
7471 |
+ |
7472 |
+ ext4_ext_drop_refs(path); |
7473 |
+@@ -3000,7 +3003,7 @@ static int ext4_split_extent(handle_t *handle, |
7474 |
+ |
7475 |
+ ext4_ext_show_leaf(inode, path); |
7476 |
+ out: |
7477 |
+- return err ? err : map->m_len; |
7478 |
++ return err ? err : allocated; |
7479 |
+ } |
7480 |
+ |
7481 |
+ #define EXT4_EXT_ZERO_LEN 7 |
7482 |
+@@ -3668,6 +3671,7 @@ out: |
7483 |
+ allocated - map->m_len); |
7484 |
+ allocated = map->m_len; |
7485 |
+ } |
7486 |
++ map->m_len = allocated; |
7487 |
+ |
7488 |
+ /* |
7489 |
+ * If we have done fallocate with the offset that is already |
7490 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
7491 |
+index a0d7e26..2857e5b 100644 |
7492 |
+--- a/fs/ext4/inode.c |
7493 |
++++ b/fs/ext4/inode.c |
7494 |
+@@ -144,7 +144,8 @@ void ext4_evict_inode(struct inode *inode) |
7495 |
+ * don't use page cache. |
7496 |
+ */ |
7497 |
+ if (ext4_should_journal_data(inode) && |
7498 |
+- (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) { |
7499 |
++ (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) && |
7500 |
++ inode->i_ino != EXT4_JOURNAL_INO) { |
7501 |
+ journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; |
7502 |
+ tid_t commit_tid = EXT4_I(inode)->i_datasync_tid; |
7503 |
+ |
7504 |
+diff --git a/fs/isofs/export.c b/fs/isofs/export.c |
7505 |
+index 516eb21..fd88add 100644 |
7506 |
+--- a/fs/isofs/export.c |
7507 |
++++ b/fs/isofs/export.c |
7508 |
+@@ -135,6 +135,7 @@ isofs_export_encode_fh(struct dentry *dentry, |
7509 |
+ len = 3; |
7510 |
+ fh32[0] = ei->i_iget5_block; |
7511 |
+ fh16[2] = (__u16)ei->i_iget5_offset; /* fh16 [sic] */ |
7512 |
++ fh16[3] = 0; /* avoid leaking uninitialized data */ |
7513 |
+ fh32[2] = inode->i_generation; |
7514 |
+ if (connectable && !S_ISDIR(inode->i_mode)) { |
7515 |
+ struct inode *parent; |
7516 |
+diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c |
7517 |
+index de8b4cb..6075ac03 100644 |
7518 |
+--- a/fs/jbd2/transaction.c |
7519 |
++++ b/fs/jbd2/transaction.c |
7520 |
+@@ -1047,9 +1047,12 @@ out: |
7521 |
+ void jbd2_journal_set_triggers(struct buffer_head *bh, |
7522 |
+ struct jbd2_buffer_trigger_type *type) |
7523 |
+ { |
7524 |
+- struct journal_head *jh = bh2jh(bh); |
7525 |
++ struct journal_head *jh = jbd2_journal_grab_journal_head(bh); |
7526 |
+ |
7527 |
++ if (WARN_ON(!jh)) |
7528 |
++ return; |
7529 |
+ jh->b_triggers = type; |
7530 |
++ jbd2_journal_put_journal_head(jh); |
7531 |
+ } |
7532 |
+ |
7533 |
+ void jbd2_buffer_frozen_trigger(struct journal_head *jh, void *mapped_data, |
7534 |
+@@ -1101,17 +1104,18 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) |
7535 |
+ { |
7536 |
+ transaction_t *transaction = handle->h_transaction; |
7537 |
+ journal_t *journal = transaction->t_journal; |
7538 |
+- struct journal_head *jh = bh2jh(bh); |
7539 |
++ struct journal_head *jh; |
7540 |
+ int ret = 0; |
7541 |
+ |
7542 |
+- jbd_debug(5, "journal_head %p\n", jh); |
7543 |
+- JBUFFER_TRACE(jh, "entry"); |
7544 |
+ if (is_handle_aborted(handle)) |
7545 |
+ goto out; |
7546 |
+- if (!buffer_jbd(bh)) { |
7547 |
++ jh = jbd2_journal_grab_journal_head(bh); |
7548 |
++ if (!jh) { |
7549 |
+ ret = -EUCLEAN; |
7550 |
+ goto out; |
7551 |
+ } |
7552 |
++ jbd_debug(5, "journal_head %p\n", jh); |
7553 |
++ JBUFFER_TRACE(jh, "entry"); |
7554 |
+ |
7555 |
+ jbd_lock_bh_state(bh); |
7556 |
+ |
7557 |
+@@ -1202,6 +1206,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) |
7558 |
+ spin_unlock(&journal->j_list_lock); |
7559 |
+ out_unlock_bh: |
7560 |
+ jbd_unlock_bh_state(bh); |
7561 |
++ jbd2_journal_put_journal_head(jh); |
7562 |
+ out: |
7563 |
+ JBUFFER_TRACE(jh, "exit"); |
7564 |
+ WARN_ON(ret); /* All errors are bugs, so dump the stack */ |
7565 |
+diff --git a/fs/udf/namei.c b/fs/udf/namei.c |
7566 |
+index 38de8f2..78bff11 100644 |
7567 |
+--- a/fs/udf/namei.c |
7568 |
++++ b/fs/udf/namei.c |
7569 |
+@@ -1280,6 +1280,7 @@ static int udf_encode_fh(struct dentry *de, __u32 *fh, int *lenp, |
7570 |
+ *lenp = 3; |
7571 |
+ fid->udf.block = location.logicalBlockNum; |
7572 |
+ fid->udf.partref = location.partitionReferenceNum; |
7573 |
++ fid->udf.parent_partref = 0; |
7574 |
+ fid->udf.generation = inode->i_generation; |
7575 |
+ |
7576 |
+ if (connectable && !S_ISDIR(inode->i_mode)) { |
7577 |
+diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h |
7578 |
+index 42ad69a..9e8e08e 100644 |
7579 |
+--- a/fs/udf/udf_sb.h |
7580 |
++++ b/fs/udf/udf_sb.h |
7581 |
+@@ -82,7 +82,7 @@ struct udf_virtual_data { |
7582 |
+ struct udf_bitmap { |
7583 |
+ __u32 s_extLength; |
7584 |
+ __u32 s_extPosition; |
7585 |
+- __u16 s_nr_groups; |
7586 |
++ int s_nr_groups; |
7587 |
+ struct buffer_head **s_block_bitmap; |
7588 |
+ }; |
7589 |
+ |
7590 |
+diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h |
7591 |
+index 7207a99..d9928c1 100644 |
7592 |
+--- a/include/drm/drm_pciids.h |
7593 |
++++ b/include/drm/drm_pciids.h |
7594 |
+@@ -572,7 +572,11 @@ |
7595 |
+ {0x1002, 0x9908, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7596 |
+ {0x1002, 0x9909, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7597 |
+ {0x1002, 0x990A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7598 |
+- {0x1002, 0x990F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7599 |
++ {0x1002, 0x990B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7600 |
++ {0x1002, 0x990C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7601 |
++ {0x1002, 0x990D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7602 |
++ {0x1002, 0x990E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7603 |
++ {0x1002, 0x990F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7604 |
+ {0x1002, 0x9910, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7605 |
+ {0x1002, 0x9913, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7606 |
+ {0x1002, 0x9917, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7607 |
+@@ -583,6 +587,13 @@ |
7608 |
+ {0x1002, 0x9992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7609 |
+ {0x1002, 0x9993, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7610 |
+ {0x1002, 0x9994, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7611 |
++ {0x1002, 0x9995, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7612 |
++ {0x1002, 0x9996, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7613 |
++ {0x1002, 0x9997, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7614 |
++ {0x1002, 0x9998, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7615 |
++ {0x1002, 0x9999, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7616 |
++ {0x1002, 0x999A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7617 |
++ {0x1002, 0x999B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7618 |
+ {0x1002, 0x99A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7619 |
+ {0x1002, 0x99A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7620 |
+ {0x1002, 0x99A4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
7621 |
+diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h |
7622 |
+index eb53e15..5bab59b 100644 |
7623 |
+--- a/include/linux/binfmts.h |
7624 |
++++ b/include/linux/binfmts.h |
7625 |
+@@ -68,8 +68,6 @@ struct linux_binprm { |
7626 |
+ #define BINPRM_FLAGS_EXECFD_BIT 1 |
7627 |
+ #define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT) |
7628 |
+ |
7629 |
+-#define BINPRM_MAX_RECURSION 4 |
7630 |
+- |
7631 |
+ /* Function parameter for binfmt->coredump */ |
7632 |
+ struct coredump_params { |
7633 |
+ long signr; |
7634 |
+diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h |
7635 |
+index c1bae8d..4aea870 100644 |
7636 |
+--- a/include/linux/skbuff.h |
7637 |
++++ b/include/linux/skbuff.h |
7638 |
+@@ -479,7 +479,7 @@ struct sk_buff { |
7639 |
+ union { |
7640 |
+ __u32 mark; |
7641 |
+ __u32 dropcount; |
7642 |
+- __u32 avail_size; |
7643 |
++ __u32 reserved_tailroom; |
7644 |
+ }; |
7645 |
+ |
7646 |
+ sk_buff_data_t transport_header; |
7647 |
+@@ -1373,7 +1373,10 @@ static inline int skb_tailroom(const struct sk_buff *skb) |
7648 |
+ */ |
7649 |
+ static inline int skb_availroom(const struct sk_buff *skb) |
7650 |
+ { |
7651 |
+- return skb_is_nonlinear(skb) ? 0 : skb->avail_size - skb->len; |
7652 |
++ if (skb_is_nonlinear(skb)) |
7653 |
++ return 0; |
7654 |
++ |
7655 |
++ return skb->end - skb->tail - skb->reserved_tailroom; |
7656 |
+ } |
7657 |
+ |
7658 |
+ /** |
7659 |
+diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h |
7660 |
+index 16ff29a..b289bd2 100644 |
7661 |
+--- a/include/net/inet_frag.h |
7662 |
++++ b/include/net/inet_frag.h |
7663 |
+@@ -33,6 +33,13 @@ struct inet_frag_queue { |
7664 |
+ |
7665 |
+ #define INETFRAGS_HASHSZ 64 |
7666 |
+ |
7667 |
++/* averaged: |
7668 |
++ * max_depth = default ipfrag_high_thresh / INETFRAGS_HASHSZ / |
7669 |
++ * rounded up (SKB_TRUELEN(0) + sizeof(struct ipq or |
7670 |
++ * struct frag_queue)) |
7671 |
++ */ |
7672 |
++#define INETFRAGS_MAXDEPTH 128 |
7673 |
++ |
7674 |
+ struct inet_frags { |
7675 |
+ struct hlist_head hash[INETFRAGS_HASHSZ]; |
7676 |
+ rwlock_t lock; |
7677 |
+@@ -64,6 +71,8 @@ int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f); |
7678 |
+ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, |
7679 |
+ struct inet_frags *f, void *key, unsigned int hash) |
7680 |
+ __releases(&f->lock); |
7681 |
++void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q, |
7682 |
++ const char *prefix); |
7683 |
+ |
7684 |
+ static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) |
7685 |
+ { |
7686 |
+diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h |
7687 |
+index 10422ef..2124004 100644 |
7688 |
+--- a/include/net/ip_fib.h |
7689 |
++++ b/include/net/ip_fib.h |
7690 |
+@@ -129,18 +129,16 @@ struct fib_result_nl { |
7691 |
+ }; |
7692 |
+ |
7693 |
+ #ifdef CONFIG_IP_ROUTE_MULTIPATH |
7694 |
+- |
7695 |
+ #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) |
7696 |
+- |
7697 |
+-#define FIB_TABLE_HASHSZ 2 |
7698 |
+- |
7699 |
+ #else /* CONFIG_IP_ROUTE_MULTIPATH */ |
7700 |
+- |
7701 |
+ #define FIB_RES_NH(res) ((res).fi->fib_nh[0]) |
7702 |
++#endif /* CONFIG_IP_ROUTE_MULTIPATH */ |
7703 |
+ |
7704 |
++#ifdef CONFIG_IP_MULTIPLE_TABLES |
7705 |
+ #define FIB_TABLE_HASHSZ 256 |
7706 |
+- |
7707 |
+-#endif /* CONFIG_IP_ROUTE_MULTIPATH */ |
7708 |
++#else |
7709 |
++#define FIB_TABLE_HASHSZ 2 |
7710 |
++#endif |
7711 |
+ |
7712 |
+ extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh); |
7713 |
+ |
7714 |
+diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c |
7715 |
+index f113755..a13987a 100644 |
7716 |
+--- a/kernel/time/tick-broadcast.c |
7717 |
++++ b/kernel/time/tick-broadcast.c |
7718 |
+@@ -66,7 +66,8 @@ static void tick_broadcast_start_periodic(struct clock_event_device *bc) |
7719 |
+ */ |
7720 |
+ int tick_check_broadcast_device(struct clock_event_device *dev) |
7721 |
+ { |
7722 |
+- if ((tick_broadcast_device.evtdev && |
7723 |
++ if ((dev->features & CLOCK_EVT_FEAT_DUMMY) || |
7724 |
++ (tick_broadcast_device.evtdev && |
7725 |
+ tick_broadcast_device.evtdev->rating >= dev->rating) || |
7726 |
+ (dev->features & CLOCK_EVT_FEAT_C3STOP)) |
7727 |
+ return 0; |
7728 |
+diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c |
7729 |
+index e603477..01d8e62 100644 |
7730 |
+--- a/kernel/time/tick-sched.c |
7731 |
++++ b/kernel/time/tick-sched.c |
7732 |
+@@ -496,12 +496,17 @@ void tick_nohz_idle_enter(void) |
7733 |
+ */ |
7734 |
+ void tick_nohz_irq_exit(void) |
7735 |
+ { |
7736 |
++ unsigned long flags; |
7737 |
+ struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); |
7738 |
+ |
7739 |
+ if (!ts->inidle) |
7740 |
+ return; |
7741 |
+ |
7742 |
++ local_irq_save(flags); |
7743 |
++ |
7744 |
+ tick_nohz_stop_sched_tick(ts); |
7745 |
++ |
7746 |
++ local_irq_restore(flags); |
7747 |
+ } |
7748 |
+ |
7749 |
+ /** |
7750 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
7751 |
+index 4a86e64..62f3751 100644 |
7752 |
+--- a/kernel/trace/ftrace.c |
7753 |
++++ b/kernel/trace/ftrace.c |
7754 |
+@@ -3034,8 +3034,8 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, |
7755 |
+ continue; |
7756 |
+ } |
7757 |
+ |
7758 |
+- hlist_del(&entry->node); |
7759 |
+- call_rcu(&entry->rcu, ftrace_free_entry_rcu); |
7760 |
++ hlist_del_rcu(&entry->node); |
7761 |
++ call_rcu_sched(&entry->rcu, ftrace_free_entry_rcu); |
7762 |
+ } |
7763 |
+ } |
7764 |
+ __disable_ftrace_function_probe(); |
7765 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
7766 |
+index 55e4d4c..681a759 100644 |
7767 |
+--- a/kernel/trace/trace.c |
7768 |
++++ b/kernel/trace/trace.c |
7769 |
+@@ -708,7 +708,7 @@ __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) |
7770 |
+ void |
7771 |
+ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) |
7772 |
+ { |
7773 |
+- struct ring_buffer *buf = tr->buffer; |
7774 |
++ struct ring_buffer *buf; |
7775 |
+ |
7776 |
+ if (trace_stop_count) |
7777 |
+ return; |
7778 |
+@@ -720,6 +720,7 @@ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) |
7779 |
+ } |
7780 |
+ arch_spin_lock(&ftrace_max_lock); |
7781 |
+ |
7782 |
++ buf = tr->buffer; |
7783 |
+ tr->buffer = max_tr.buffer; |
7784 |
+ max_tr.buffer = buf; |
7785 |
+ |
7786 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
7787 |
+index c384e09..e427969 100644 |
7788 |
+--- a/mm/hugetlb.c |
7789 |
++++ b/mm/hugetlb.c |
7790 |
+@@ -2096,8 +2096,12 @@ int hugetlb_report_node_meminfo(int nid, char *buf) |
7791 |
+ /* Return the number pages of memory we physically have, in PAGE_SIZE units. */ |
7792 |
+ unsigned long hugetlb_total_pages(void) |
7793 |
+ { |
7794 |
+- struct hstate *h = &default_hstate; |
7795 |
+- return h->nr_huge_pages * pages_per_huge_page(h); |
7796 |
++ struct hstate *h; |
7797 |
++ unsigned long nr_total_pages = 0; |
7798 |
++ |
7799 |
++ for_each_hstate(h) |
7800 |
++ nr_total_pages += h->nr_huge_pages * pages_per_huge_page(h); |
7801 |
++ return nr_total_pages; |
7802 |
+ } |
7803 |
+ |
7804 |
+ static int hugetlb_acct_memory(struct hstate *h, long delta) |
7805 |
+diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c |
7806 |
+index da7b3a5..3db960c 100644 |
7807 |
+--- a/net/core/rtnetlink.c |
7808 |
++++ b/net/core/rtnetlink.c |
7809 |
+@@ -2050,7 +2050,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
7810 |
+ struct rtattr *attr = (void *)nlh + NLMSG_ALIGN(min_len); |
7811 |
+ |
7812 |
+ while (RTA_OK(attr, attrlen)) { |
7813 |
+- unsigned flavor = attr->rta_type; |
7814 |
++ unsigned int flavor = attr->rta_type & NLA_TYPE_MASK; |
7815 |
+ if (flavor) { |
7816 |
+ if (flavor > rta_max[sz_idx]) |
7817 |
+ return -EINVAL; |
7818 |
+diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c |
7819 |
+index 5ff2a51..210b710 100644 |
7820 |
+--- a/net/ipv4/inet_fragment.c |
7821 |
++++ b/net/ipv4/inet_fragment.c |
7822 |
+@@ -21,6 +21,7 @@ |
7823 |
+ #include <linux/rtnetlink.h> |
7824 |
+ #include <linux/slab.h> |
7825 |
+ |
7826 |
++#include <net/sock.h> |
7827 |
+ #include <net/inet_frag.h> |
7828 |
+ |
7829 |
+ static void inet_frag_secret_rebuild(unsigned long dummy) |
7830 |
+@@ -271,6 +272,7 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, |
7831 |
+ { |
7832 |
+ struct inet_frag_queue *q; |
7833 |
+ struct hlist_node *n; |
7834 |
++ int depth = 0; |
7835 |
+ |
7836 |
+ hlist_for_each_entry(q, n, &f->hash[hash], list) { |
7837 |
+ if (q->net == nf && f->match(q, key)) { |
7838 |
+@@ -278,9 +280,25 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, |
7839 |
+ read_unlock(&f->lock); |
7840 |
+ return q; |
7841 |
+ } |
7842 |
++ depth++; |
7843 |
+ } |
7844 |
+ read_unlock(&f->lock); |
7845 |
+ |
7846 |
+- return inet_frag_create(nf, f, key); |
7847 |
++ if (depth <= INETFRAGS_MAXDEPTH) |
7848 |
++ return inet_frag_create(nf, f, key); |
7849 |
++ else |
7850 |
++ return ERR_PTR(-ENOBUFS); |
7851 |
+ } |
7852 |
+ EXPORT_SYMBOL(inet_frag_find); |
7853 |
++ |
7854 |
++void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q, |
7855 |
++ const char *prefix) |
7856 |
++{ |
7857 |
++ static const char msg[] = "inet_frag_find: Fragment hash bucket" |
7858 |
++ " list length grew over limit " __stringify(INETFRAGS_MAXDEPTH) |
7859 |
++ ". Dropping fragment.\n"; |
7860 |
++ |
7861 |
++ if (PTR_ERR(q) == -ENOBUFS) |
7862 |
++ LIMIT_NETDEBUG(KERN_WARNING "%s%s", prefix, msg); |
7863 |
++} |
7864 |
++EXPORT_SYMBOL(inet_frag_maybe_warn_overflow); |
7865 |
+diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c |
7866 |
+index b7bf6e3..8e28871 100644 |
7867 |
+--- a/net/ipv4/ip_fragment.c |
7868 |
++++ b/net/ipv4/ip_fragment.c |
7869 |
+@@ -295,14 +295,11 @@ static inline struct ipq *ip_find(struct net *net, struct iphdr *iph, u32 user) |
7870 |
+ hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol); |
7871 |
+ |
7872 |
+ q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash); |
7873 |
+- if (q == NULL) |
7874 |
+- goto out_nomem; |
7875 |
+- |
7876 |
++ if (IS_ERR_OR_NULL(q)) { |
7877 |
++ inet_frag_maybe_warn_overflow(q, pr_fmt()); |
7878 |
++ return NULL; |
7879 |
++ } |
7880 |
+ return container_of(q, struct ipq, q); |
7881 |
+- |
7882 |
+-out_nomem: |
7883 |
+- LIMIT_NETDEBUG(KERN_ERR pr_fmt("ip_frag_create: no memory left !\n")); |
7884 |
+- return NULL; |
7885 |
+ } |
7886 |
+ |
7887 |
+ /* Is the fragment too far ahead to be part of ipq? */ |
7888 |
+diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c |
7889 |
+index a0d0d9d..b69a370 100644 |
7890 |
+--- a/net/ipv4/ip_options.c |
7891 |
++++ b/net/ipv4/ip_options.c |
7892 |
+@@ -360,7 +360,6 @@ int ip_options_compile(struct net *net, |
7893 |
+ } |
7894 |
+ switch (optptr[3]&0xF) { |
7895 |
+ case IPOPT_TS_TSONLY: |
7896 |
+- opt->ts = optptr - iph; |
7897 |
+ if (skb) |
7898 |
+ timeptr = &optptr[optptr[2]-1]; |
7899 |
+ opt->ts_needtime = 1; |
7900 |
+@@ -371,7 +370,6 @@ int ip_options_compile(struct net *net, |
7901 |
+ pp_ptr = optptr + 2; |
7902 |
+ goto error; |
7903 |
+ } |
7904 |
+- opt->ts = optptr - iph; |
7905 |
+ if (rt) { |
7906 |
+ memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4); |
7907 |
+ timeptr = &optptr[optptr[2]+3]; |
7908 |
+@@ -385,7 +383,6 @@ int ip_options_compile(struct net *net, |
7909 |
+ pp_ptr = optptr + 2; |
7910 |
+ goto error; |
7911 |
+ } |
7912 |
+- opt->ts = optptr - iph; |
7913 |
+ { |
7914 |
+ __be32 addr; |
7915 |
+ memcpy(&addr, &optptr[optptr[2]-1], 4); |
7916 |
+@@ -418,12 +415,12 @@ int ip_options_compile(struct net *net, |
7917 |
+ pp_ptr = optptr + 3; |
7918 |
+ goto error; |
7919 |
+ } |
7920 |
+- opt->ts = optptr - iph; |
7921 |
+ if (skb) { |
7922 |
+ optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4); |
7923 |
+ opt->is_changed = 1; |
7924 |
+ } |
7925 |
+ } |
7926 |
++ opt->ts = optptr - iph; |
7927 |
+ break; |
7928 |
+ case IPOPT_RA: |
7929 |
+ if (optlen < 4) { |
7930 |
+diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c |
7931 |
+index 01870bd..dcb19f5 100644 |
7932 |
+--- a/net/ipv4/tcp.c |
7933 |
++++ b/net/ipv4/tcp.c |
7934 |
+@@ -704,7 +704,7 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp) |
7935 |
+ * Make sure that we have exactly size bytes |
7936 |
+ * available to the caller, no more, no less. |
7937 |
+ */ |
7938 |
+- skb->avail_size = size; |
7939 |
++ skb->reserved_tailroom = skb->end - skb->tail - size; |
7940 |
+ return skb; |
7941 |
+ } |
7942 |
+ __kfree_skb(skb); |
7943 |
+diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c |
7944 |
+index 2d27e1a..952f7dd 100644 |
7945 |
+--- a/net/ipv4/tcp_output.c |
7946 |
++++ b/net/ipv4/tcp_output.c |
7947 |
+@@ -1096,7 +1096,6 @@ static void __pskb_trim_head(struct sk_buff *skb, int len) |
7948 |
+ eat = min_t(int, len, skb_headlen(skb)); |
7949 |
+ if (eat) { |
7950 |
+ __skb_pull(skb, eat); |
7951 |
+- skb->avail_size -= eat; |
7952 |
+ len -= eat; |
7953 |
+ if (!len) |
7954 |
+ return; |
7955 |
+diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c |
7956 |
+index 38f00b0..52e2f65 100644 |
7957 |
+--- a/net/ipv6/netfilter/nf_conntrack_reasm.c |
7958 |
++++ b/net/ipv6/netfilter/nf_conntrack_reasm.c |
7959 |
+@@ -14,6 +14,8 @@ |
7960 |
+ * 2 of the License, or (at your option) any later version. |
7961 |
+ */ |
7962 |
+ |
7963 |
++#define pr_fmt(fmt) "IPv6-nf: " fmt |
7964 |
++ |
7965 |
+ #include <linux/errno.h> |
7966 |
+ #include <linux/types.h> |
7967 |
+ #include <linux/string.h> |
7968 |
+@@ -176,13 +178,12 @@ fq_find(__be32 id, u32 user, struct in6_addr *src, struct in6_addr *dst) |
7969 |
+ |
7970 |
+ q = inet_frag_find(&nf_init_frags, &nf_frags, &arg, hash); |
7971 |
+ local_bh_enable(); |
7972 |
+- if (q == NULL) |
7973 |
+- goto oom; |
7974 |
++ if (IS_ERR_OR_NULL(q)) { |
7975 |
++ inet_frag_maybe_warn_overflow(q, pr_fmt()); |
7976 |
++ return NULL; |
7977 |
++ } |
7978 |
+ |
7979 |
+ return container_of(q, struct nf_ct_frag6_queue, q); |
7980 |
+- |
7981 |
+-oom: |
7982 |
+- return NULL; |
7983 |
+ } |
7984 |
+ |
7985 |
+ |
7986 |
+diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c |
7987 |
+index 9447bd6..5ff412f 100644 |
7988 |
+--- a/net/ipv6/reassembly.c |
7989 |
++++ b/net/ipv6/reassembly.c |
7990 |
+@@ -26,6 +26,9 @@ |
7991 |
+ * YOSHIFUJI,H. @USAGI Always remove fragment header to |
7992 |
+ * calculate ICV correctly. |
7993 |
+ */ |
7994 |
++ |
7995 |
++#define pr_fmt(fmt) "IPv6: " fmt |
7996 |
++ |
7997 |
+ #include <linux/errno.h> |
7998 |
+ #include <linux/types.h> |
7999 |
+ #include <linux/string.h> |
8000 |
+@@ -240,9 +243,10 @@ fq_find(struct net *net, __be32 id, const struct in6_addr *src, const struct in6 |
8001 |
+ hash = inet6_hash_frag(id, src, dst, ip6_frags.rnd); |
8002 |
+ |
8003 |
+ q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash); |
8004 |
+- if (q == NULL) |
8005 |
++ if (IS_ERR_OR_NULL(q)) { |
8006 |
++ inet_frag_maybe_warn_overflow(q, pr_fmt()); |
8007 |
+ return NULL; |
8008 |
+- |
8009 |
++ } |
8010 |
+ return container_of(q, struct frag_queue, q); |
8011 |
+ } |
8012 |
+ |
8013 |
+diff --git a/net/sctp/associola.c b/net/sctp/associola.c |
8014 |
+index acd2edb..3c04692 100644 |
8015 |
+--- a/net/sctp/associola.c |
8016 |
++++ b/net/sctp/associola.c |
8017 |
+@@ -1050,7 +1050,7 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc, |
8018 |
+ transports) { |
8019 |
+ |
8020 |
+ if (transport == active) |
8021 |
+- break; |
8022 |
++ continue; |
8023 |
+ list_for_each_entry(chunk, &transport->transmitted, |
8024 |
+ transmitted_list) { |
8025 |
+ if (key == chunk->subh.data_hdr->tsn) { |
8026 |
+diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c |
8027 |
+index 891f5db..cb1c430 100644 |
8028 |
+--- a/net/sctp/sm_statefuns.c |
8029 |
++++ b/net/sctp/sm_statefuns.c |
8030 |
+@@ -2044,7 +2044,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(const struct sctp_endpoint *ep, |
8031 |
+ } |
8032 |
+ |
8033 |
+ /* Delete the tempory new association. */ |
8034 |
+- sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc)); |
8035 |
++ sctp_add_cmd_sf(commands, SCTP_CMD_SET_ASOC, SCTP_ASOC(new_asoc)); |
8036 |
+ sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL()); |
8037 |
+ |
8038 |
+ /* Restore association pointer to provide SCTP command interpeter |
8039 |
+diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c |
8040 |
+index fb767c6..dfc8c22 100644 |
8041 |
+--- a/security/keys/keyctl.c |
8042 |
++++ b/security/keys/keyctl.c |
8043 |
+@@ -1081,12 +1081,12 @@ long keyctl_instantiate_key_iov(key_serial_t id, |
8044 |
+ ret = rw_copy_check_uvector(WRITE, _payload_iov, ioc, |
8045 |
+ ARRAY_SIZE(iovstack), iovstack, &iov, 1); |
8046 |
+ if (ret < 0) |
8047 |
+- return ret; |
8048 |
++ goto err; |
8049 |
+ if (ret == 0) |
8050 |
+ goto no_payload_free; |
8051 |
+ |
8052 |
+ ret = keyctl_instantiate_key_common(id, iov, ioc, ret, ringid); |
8053 |
+- |
8054 |
++err: |
8055 |
+ if (iov != iovstack) |
8056 |
+ kfree(iov); |
8057 |
+ return ret; |
8058 |
+diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
8059 |
+index cec7479..28e070a 100644 |
8060 |
+--- a/sound/pci/hda/hda_codec.c |
8061 |
++++ b/sound/pci/hda/hda_codec.c |
8062 |
+@@ -2910,7 +2910,7 @@ static unsigned int convert_to_spdif_status(unsigned short val) |
8063 |
+ if (val & AC_DIG1_PROFESSIONAL) |
8064 |
+ sbits |= IEC958_AES0_PROFESSIONAL; |
8065 |
+ if (sbits & IEC958_AES0_PROFESSIONAL) { |
8066 |
+- if (sbits & AC_DIG1_EMPHASIS) |
8067 |
++ if (val & AC_DIG1_EMPHASIS) |
8068 |
+ sbits |= IEC958_AES0_PRO_EMPHASIS_5015; |
8069 |
+ } else { |
8070 |
+ if (val & AC_DIG1_EMPHASIS) |
8071 |
+diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c |
8072 |
+index 3897027..033c4c5 100644 |
8073 |
+--- a/sound/pci/hda/patch_conexant.c |
8074 |
++++ b/sound/pci/hda/patch_conexant.c |
8075 |
+@@ -1177,7 +1177,7 @@ static int patch_cxt5045(struct hda_codec *codec) |
8076 |
+ } |
8077 |
+ |
8078 |
+ if (spec->beep_amp) |
8079 |
+- snd_hda_attach_beep_device(codec, spec->beep_amp); |
8080 |
++ snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
8081 |
+ |
8082 |
+ return 0; |
8083 |
+ } |
8084 |
+@@ -1960,7 +1960,7 @@ static int patch_cxt5051(struct hda_codec *codec) |
8085 |
+ } |
8086 |
+ |
8087 |
+ if (spec->beep_amp) |
8088 |
+- snd_hda_attach_beep_device(codec, spec->beep_amp); |
8089 |
++ snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
8090 |
+ |
8091 |
+ return 0; |
8092 |
+ } |
8093 |
+@@ -3151,7 +3151,7 @@ static int patch_cxt5066(struct hda_codec *codec) |
8094 |
+ } |
8095 |
+ |
8096 |
+ if (spec->beep_amp) |
8097 |
+- snd_hda_attach_beep_device(codec, spec->beep_amp); |
8098 |
++ snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
8099 |
+ |
8100 |
+ return 0; |
8101 |
+ } |
8102 |
+@@ -4501,7 +4501,7 @@ static int patch_conexant_auto(struct hda_codec *codec) |
8103 |
+ spec->capture_stream = &cx_auto_pcm_analog_capture; |
8104 |
+ codec->patch_ops = cx_auto_patch_ops; |
8105 |
+ if (spec->beep_amp) |
8106 |
+- snd_hda_attach_beep_device(codec, spec->beep_amp); |
8107 |
++ snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
8108 |
+ |
8109 |
+ /* Some laptops with Conexant chips show stalls in S3 resume, |
8110 |
+ * which falls into the single-cmd mode. |
8111 |
+diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
8112 |
+index 15b0712..f008fc7 100644 |
8113 |
+--- a/sound/usb/mixer.c |
8114 |
++++ b/sound/usb/mixer.c |
8115 |
+@@ -711,8 +711,9 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ |
8116 |
+ case UAC2_CLOCK_SELECTOR: { |
8117 |
+ struct uac_selector_unit_descriptor *d = p1; |
8118 |
+ /* call recursively to retrieve the channel info */ |
8119 |
+- if (check_input_term(state, d->baSourceID[0], term) < 0) |
8120 |
+- return -ENODEV; |
8121 |
++ err = check_input_term(state, d->baSourceID[0], term); |
8122 |
++ if (err < 0) |
8123 |
++ return err; |
8124 |
+ term->type = d->bDescriptorSubtype << 16; /* virtual type */ |
8125 |
+ term->id = id; |
8126 |
+ term->name = uac_selector_unit_iSelector(d); |
8127 |
+@@ -1263,8 +1264,9 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void |
8128 |
+ return err; |
8129 |
+ |
8130 |
+ /* determine the input source type and name */ |
8131 |
+- if (check_input_term(state, hdr->bSourceID, &iterm) < 0) |
8132 |
+- return -EINVAL; |
8133 |
++ err = check_input_term(state, hdr->bSourceID, &iterm); |
8134 |
++ if (err < 0) |
8135 |
++ return err; |
8136 |
+ |
8137 |
+ master_bits = snd_usb_combine_bytes(bmaControls, csize); |
8138 |
+ /* master configuration quirks */ |
8139 |
+@@ -2025,7 +2027,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) |
8140 |
+ state.oterm.type = le16_to_cpu(desc->wTerminalType); |
8141 |
+ state.oterm.name = desc->iTerminal; |
8142 |
+ err = parse_audio_unit(&state, desc->bSourceID); |
8143 |
+- if (err < 0) |
8144 |
++ if (err < 0 && err != -EINVAL) |
8145 |
+ return err; |
8146 |
+ } else { /* UAC_VERSION_2 */ |
8147 |
+ struct uac2_output_terminal_descriptor *desc = p; |
8148 |
+@@ -2037,12 +2039,12 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) |
8149 |
+ state.oterm.type = le16_to_cpu(desc->wTerminalType); |
8150 |
+ state.oterm.name = desc->iTerminal; |
8151 |
+ err = parse_audio_unit(&state, desc->bSourceID); |
8152 |
+- if (err < 0) |
8153 |
++ if (err < 0 && err != -EINVAL) |
8154 |
+ return err; |
8155 |
+ |
8156 |
+ /* for UAC2, use the same approach to also add the clock selectors */ |
8157 |
+ err = parse_audio_unit(&state, desc->bCSourceID); |
8158 |
+- if (err < 0) |
8159 |
++ if (err < 0 && err != -EINVAL) |
8160 |
+ return err; |
8161 |
+ } |
8162 |
+ } |
8163 |
+diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c |
8164 |
+index 2984ffb..60a8e29 100644 |
8165 |
+--- a/tools/hv/hv_kvp_daemon.c |
8166 |
++++ b/tools/hv/hv_kvp_daemon.c |
8167 |
+@@ -727,13 +727,19 @@ int main(void) |
8168 |
+ len = recvfrom(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0, |
8169 |
+ addr_p, &addr_l); |
8170 |
+ |
8171 |
+- if (len < 0 || addr.nl_pid) { |
8172 |
++ if (len < 0) { |
8173 |
+ syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s", |
8174 |
+ addr.nl_pid, errno, strerror(errno)); |
8175 |
+ close(fd); |
8176 |
+ return -1; |
8177 |
+ } |
8178 |
+ |
8179 |
++ if (addr.nl_pid) { |
8180 |
++ syslog(LOG_WARNING, "Received packet from untrusted pid:%u", |
8181 |
++ addr.nl_pid); |
8182 |
++ continue; |
8183 |
++ } |
8184 |
++ |
8185 |
+ incoming_msg = (struct nlmsghdr *)kvp_recv_buffer; |
8186 |
+ incoming_cn_msg = (struct cn_msg *)NLMSG_DATA(incoming_msg); |
8187 |
+ hv_msg = (struct hv_kvp_msg *)incoming_cn_msg->data; |