1 |
commit: 669d62c0b5295eac7d831830ed78a075fd60571a |
2 |
Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Feb 7 14:17:13 2021 +0000 |
4 |
Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Feb 7 14:17:26 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=669d62c0 |
7 |
|
8 |
Linux patch 4.14.220 |
9 |
|
10 |
Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1219_linux-4.14.220.patch | 529 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 533 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 9392fc6..c5aa598 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -919,6 +919,10 @@ Patch: 1218_linux-4.14.219.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.14.219 |
23 |
|
24 |
+Patch: 1219_linux-4.14.220.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.14.220 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1219_linux-4.14.220.patch b/1219_linux-4.14.220.patch |
33 |
new file mode 100644 |
34 |
index 0000000..60bfe26 |
35 |
--- /dev/null |
36 |
+++ b/1219_linux-4.14.220.patch |
37 |
@@ -0,0 +1,529 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index f7f11304776b5..088dc5383dcf2 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 4 |
45 |
+ PATCHLEVEL = 14 |
46 |
+-SUBLEVEL = 219 |
47 |
++SUBLEVEL = 220 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Petit Gorille |
50 |
+ |
51 |
+diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h |
52 |
+index 30df295f6d94c..18f9a9b7280bd 100644 |
53 |
+--- a/arch/x86/include/asm/msr.h |
54 |
++++ b/arch/x86/include/asm/msr.h |
55 |
+@@ -88,7 +88,7 @@ static inline void do_trace_rdpmc(unsigned int msr, u64 val, int failed) {} |
56 |
+ * think of extending them - you will be slapped with a stinking trout or a frozen |
57 |
+ * shark will reach you, wherever you are! You've been warned. |
58 |
+ */ |
59 |
+-static inline unsigned long long notrace __rdmsr(unsigned int msr) |
60 |
++static __always_inline unsigned long long __rdmsr(unsigned int msr) |
61 |
+ { |
62 |
+ DECLARE_ARGS(val, low, high); |
63 |
+ |
64 |
+@@ -100,7 +100,7 @@ static inline unsigned long long notrace __rdmsr(unsigned int msr) |
65 |
+ return EAX_EDX_VAL(val, low, high); |
66 |
+ } |
67 |
+ |
68 |
+-static inline void notrace __wrmsr(unsigned int msr, u32 low, u32 high) |
69 |
++static __always_inline void __wrmsr(unsigned int msr, u32 low, u32 high) |
70 |
+ { |
71 |
+ asm volatile("1: wrmsr\n" |
72 |
+ "2:\n" |
73 |
+diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c |
74 |
+index 551b71a24b857..3bdab6eb33bf3 100644 |
75 |
+--- a/drivers/acpi/thermal.c |
76 |
++++ b/drivers/acpi/thermal.c |
77 |
+@@ -188,6 +188,8 @@ struct acpi_thermal { |
78 |
+ int tz_enabled; |
79 |
+ int kelvin_offset; |
80 |
+ struct work_struct thermal_check_work; |
81 |
++ struct mutex thermal_check_lock; |
82 |
++ refcount_t thermal_check_count; |
83 |
+ }; |
84 |
+ |
85 |
+ /* -------------------------------------------------------------------------- |
86 |
+@@ -513,17 +515,6 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) |
87 |
+ return 0; |
88 |
+ } |
89 |
+ |
90 |
+-static void acpi_thermal_check(void *data) |
91 |
+-{ |
92 |
+- struct acpi_thermal *tz = data; |
93 |
+- |
94 |
+- if (!tz->tz_enabled) |
95 |
+- return; |
96 |
+- |
97 |
+- thermal_zone_device_update(tz->thermal_zone, |
98 |
+- THERMAL_EVENT_UNSPECIFIED); |
99 |
+-} |
100 |
+- |
101 |
+ /* sys I/F for generic thermal sysfs support */ |
102 |
+ |
103 |
+ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) |
104 |
+@@ -557,6 +548,8 @@ static int thermal_get_mode(struct thermal_zone_device *thermal, |
105 |
+ return 0; |
106 |
+ } |
107 |
+ |
108 |
++static void acpi_thermal_check_fn(struct work_struct *work); |
109 |
++ |
110 |
+ static int thermal_set_mode(struct thermal_zone_device *thermal, |
111 |
+ enum thermal_device_mode mode) |
112 |
+ { |
113 |
+@@ -582,7 +575,7 @@ static int thermal_set_mode(struct thermal_zone_device *thermal, |
114 |
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
115 |
+ "%s kernel ACPI thermal control\n", |
116 |
+ tz->tz_enabled ? "Enable" : "Disable")); |
117 |
+- acpi_thermal_check(tz); |
118 |
++ acpi_thermal_check_fn(&tz->thermal_check_work); |
119 |
+ } |
120 |
+ return 0; |
121 |
+ } |
122 |
+@@ -951,6 +944,12 @@ static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz) |
123 |
+ Driver Interface |
124 |
+ -------------------------------------------------------------------------- */ |
125 |
+ |
126 |
++static void acpi_queue_thermal_check(struct acpi_thermal *tz) |
127 |
++{ |
128 |
++ if (!work_pending(&tz->thermal_check_work)) |
129 |
++ queue_work(acpi_thermal_pm_queue, &tz->thermal_check_work); |
130 |
++} |
131 |
++ |
132 |
+ static void acpi_thermal_notify(struct acpi_device *device, u32 event) |
133 |
+ { |
134 |
+ struct acpi_thermal *tz = acpi_driver_data(device); |
135 |
+@@ -961,17 +960,17 @@ static void acpi_thermal_notify(struct acpi_device *device, u32 event) |
136 |
+ |
137 |
+ switch (event) { |
138 |
+ case ACPI_THERMAL_NOTIFY_TEMPERATURE: |
139 |
+- acpi_thermal_check(tz); |
140 |
++ acpi_queue_thermal_check(tz); |
141 |
+ break; |
142 |
+ case ACPI_THERMAL_NOTIFY_THRESHOLDS: |
143 |
+ acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_THRESHOLDS); |
144 |
+- acpi_thermal_check(tz); |
145 |
++ acpi_queue_thermal_check(tz); |
146 |
+ acpi_bus_generate_netlink_event(device->pnp.device_class, |
147 |
+ dev_name(&device->dev), event, 0); |
148 |
+ break; |
149 |
+ case ACPI_THERMAL_NOTIFY_DEVICES: |
150 |
+ acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_DEVICES); |
151 |
+- acpi_thermal_check(tz); |
152 |
++ acpi_queue_thermal_check(tz); |
153 |
+ acpi_bus_generate_netlink_event(device->pnp.device_class, |
154 |
+ dev_name(&device->dev), event, 0); |
155 |
+ break; |
156 |
+@@ -1071,7 +1070,27 @@ static void acpi_thermal_check_fn(struct work_struct *work) |
157 |
+ { |
158 |
+ struct acpi_thermal *tz = container_of(work, struct acpi_thermal, |
159 |
+ thermal_check_work); |
160 |
+- acpi_thermal_check(tz); |
161 |
++ |
162 |
++ if (!tz->tz_enabled) |
163 |
++ return; |
164 |
++ /* |
165 |
++ * In general, it is not sufficient to check the pending bit, because |
166 |
++ * subsequent instances of this function may be queued after one of them |
167 |
++ * has started running (e.g. if _TMP sleeps). Avoid bailing out if just |
168 |
++ * one of them is running, though, because it may have done the actual |
169 |
++ * check some time ago, so allow at least one of them to block on the |
170 |
++ * mutex while another one is running the update. |
171 |
++ */ |
172 |
++ if (!refcount_dec_not_one(&tz->thermal_check_count)) |
173 |
++ return; |
174 |
++ |
175 |
++ mutex_lock(&tz->thermal_check_lock); |
176 |
++ |
177 |
++ thermal_zone_device_update(tz->thermal_zone, THERMAL_EVENT_UNSPECIFIED); |
178 |
++ |
179 |
++ refcount_inc(&tz->thermal_check_count); |
180 |
++ |
181 |
++ mutex_unlock(&tz->thermal_check_lock); |
182 |
+ } |
183 |
+ |
184 |
+ static int acpi_thermal_add(struct acpi_device *device) |
185 |
+@@ -1103,6 +1122,8 @@ static int acpi_thermal_add(struct acpi_device *device) |
186 |
+ if (result) |
187 |
+ goto free_memory; |
188 |
+ |
189 |
++ refcount_set(&tz->thermal_check_count, 3); |
190 |
++ mutex_init(&tz->thermal_check_lock); |
191 |
+ INIT_WORK(&tz->thermal_check_work, acpi_thermal_check_fn); |
192 |
+ |
193 |
+ pr_info(PREFIX "%s [%s] (%ld C)\n", acpi_device_name(device), |
194 |
+@@ -1168,7 +1189,7 @@ static int acpi_thermal_resume(struct device *dev) |
195 |
+ tz->state.active |= tz->trips.active[i].flags.enabled; |
196 |
+ } |
197 |
+ |
198 |
+- queue_work(acpi_thermal_pm_queue, &tz->thermal_check_work); |
199 |
++ acpi_queue_thermal_check(tz); |
200 |
+ |
201 |
+ return AE_OK; |
202 |
+ } |
203 |
+diff --git a/drivers/base/core.c b/drivers/base/core.c |
204 |
+index a11652d77c7f2..92415a748ad2e 100644 |
205 |
+--- a/drivers/base/core.c |
206 |
++++ b/drivers/base/core.c |
207 |
+@@ -96,6 +96,16 @@ void device_links_read_unlock(int not_used) |
208 |
+ } |
209 |
+ #endif /* !CONFIG_SRCU */ |
210 |
+ |
211 |
++static bool device_is_ancestor(struct device *dev, struct device *target) |
212 |
++{ |
213 |
++ while (target->parent) { |
214 |
++ target = target->parent; |
215 |
++ if (dev == target) |
216 |
++ return true; |
217 |
++ } |
218 |
++ return false; |
219 |
++} |
220 |
++ |
221 |
+ /** |
222 |
+ * device_is_dependent - Check if one device depends on another one |
223 |
+ * @dev: Device to check dependencies for. |
224 |
+@@ -109,7 +119,12 @@ static int device_is_dependent(struct device *dev, void *target) |
225 |
+ struct device_link *link; |
226 |
+ int ret; |
227 |
+ |
228 |
+- if (WARN_ON(dev == target)) |
229 |
++ /* |
230 |
++ * The "ancestors" check is needed to catch the case when the target |
231 |
++ * device has not been completely initialized yet and it is still |
232 |
++ * missing from the list of children of its parent device. |
233 |
++ */ |
234 |
++ if (dev == target || device_is_ancestor(dev, target)) |
235 |
+ return 1; |
236 |
+ |
237 |
+ ret = device_for_each_child(dev, target, device_is_dependent); |
238 |
+@@ -117,7 +132,7 @@ static int device_is_dependent(struct device *dev, void *target) |
239 |
+ return ret; |
240 |
+ |
241 |
+ list_for_each_entry(link, &dev->links.consumers, s_node) { |
242 |
+- if (WARN_ON(link->consumer == target)) |
243 |
++ if (link->consumer == target) |
244 |
+ return 1; |
245 |
+ |
246 |
+ ret = device_is_dependent(link->consumer, target); |
247 |
+diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c |
248 |
+index 9f355673f630c..91c8405e515fa 100644 |
249 |
+--- a/drivers/net/dsa/bcm_sf2.c |
250 |
++++ b/drivers/net/dsa/bcm_sf2.c |
251 |
+@@ -540,15 +540,19 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) |
252 |
+ /* Find our integrated MDIO bus node */ |
253 |
+ dn = of_find_compatible_node(NULL, NULL, "brcm,unimac-mdio"); |
254 |
+ priv->master_mii_bus = of_mdio_find_bus(dn); |
255 |
+- if (!priv->master_mii_bus) |
256 |
++ if (!priv->master_mii_bus) { |
257 |
++ of_node_put(dn); |
258 |
+ return -EPROBE_DEFER; |
259 |
++ } |
260 |
+ |
261 |
+ get_device(&priv->master_mii_bus->dev); |
262 |
+ priv->master_mii_dn = dn; |
263 |
+ |
264 |
+ priv->slave_mii_bus = devm_mdiobus_alloc(ds->dev); |
265 |
+- if (!priv->slave_mii_bus) |
266 |
++ if (!priv->slave_mii_bus) { |
267 |
++ of_node_put(dn); |
268 |
+ return -ENOMEM; |
269 |
++ } |
270 |
+ |
271 |
+ priv->slave_mii_bus->priv = priv; |
272 |
+ priv->slave_mii_bus->name = "sf2 slave mii"; |
273 |
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
274 |
+index 058b4d0c5a710..ec2dce057395a 100644 |
275 |
+--- a/drivers/net/ethernet/ibm/ibmvnic.c |
276 |
++++ b/drivers/net/ethernet/ibm/ibmvnic.c |
277 |
+@@ -3682,6 +3682,12 @@ static void ibmvnic_tasklet(void *data) |
278 |
+ while (!done) { |
279 |
+ /* Pull all the valid messages off the CRQ */ |
280 |
+ while ((crq = ibmvnic_next_crq(adapter)) != NULL) { |
281 |
++ /* This barrier makes sure ibmvnic_next_crq()'s |
282 |
++ * crq->generic.first & IBMVNIC_CRQ_CMD_RSP is loaded |
283 |
++ * before ibmvnic_handle_crq()'s |
284 |
++ * switch(gen_crq->first) and switch(gen_crq->cmd). |
285 |
++ */ |
286 |
++ dma_rmb(); |
287 |
+ ibmvnic_handle_crq(crq, adapter); |
288 |
+ crq->generic.first = 0; |
289 |
+ } |
290 |
+diff --git a/drivers/phy/motorola/phy-cpcap-usb.c b/drivers/phy/motorola/phy-cpcap-usb.c |
291 |
+index 593c77dbde2eb..106f53f333242 100644 |
292 |
+--- a/drivers/phy/motorola/phy-cpcap-usb.c |
293 |
++++ b/drivers/phy/motorola/phy-cpcap-usb.c |
294 |
+@@ -623,35 +623,42 @@ static int cpcap_usb_phy_probe(struct platform_device *pdev) |
295 |
+ generic_phy = devm_phy_create(ddata->dev, NULL, &ops); |
296 |
+ if (IS_ERR(generic_phy)) { |
297 |
+ error = PTR_ERR(generic_phy); |
298 |
+- return PTR_ERR(generic_phy); |
299 |
++ goto out_reg_disable; |
300 |
+ } |
301 |
+ |
302 |
+ phy_set_drvdata(generic_phy, ddata); |
303 |
+ |
304 |
+ phy_provider = devm_of_phy_provider_register(ddata->dev, |
305 |
+ of_phy_simple_xlate); |
306 |
+- if (IS_ERR(phy_provider)) |
307 |
+- return PTR_ERR(phy_provider); |
308 |
++ if (IS_ERR(phy_provider)) { |
309 |
++ error = PTR_ERR(phy_provider); |
310 |
++ goto out_reg_disable; |
311 |
++ } |
312 |
+ |
313 |
+ error = cpcap_usb_init_optional_pins(ddata); |
314 |
+ if (error) |
315 |
+- return error; |
316 |
++ goto out_reg_disable; |
317 |
+ |
318 |
+ cpcap_usb_init_optional_gpios(ddata); |
319 |
+ |
320 |
+ error = cpcap_usb_init_iio(ddata); |
321 |
+ if (error) |
322 |
+- return error; |
323 |
++ goto out_reg_disable; |
324 |
+ |
325 |
+ error = cpcap_usb_init_interrupts(pdev, ddata); |
326 |
+ if (error) |
327 |
+- return error; |
328 |
++ goto out_reg_disable; |
329 |
+ |
330 |
+ usb_add_phy_dev(&ddata->phy); |
331 |
+ atomic_set(&ddata->active, 1); |
332 |
+ schedule_delayed_work(&ddata->detect_work, msecs_to_jiffies(1)); |
333 |
+ |
334 |
+ return 0; |
335 |
++ |
336 |
++out_reg_disable: |
337 |
++ regulator_disable(ddata->vusb); |
338 |
++ |
339 |
++ return error; |
340 |
+ } |
341 |
+ |
342 |
+ static int cpcap_usb_phy_remove(struct platform_device *pdev) |
343 |
+diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c |
344 |
+index dbacd9830d3df..460014ded14de 100644 |
345 |
+--- a/drivers/scsi/ibmvscsi/ibmvfc.c |
346 |
++++ b/drivers/scsi/ibmvscsi/ibmvfc.c |
347 |
+@@ -2891,8 +2891,10 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev) |
348 |
+ unsigned long flags = 0; |
349 |
+ |
350 |
+ spin_lock_irqsave(shost->host_lock, flags); |
351 |
+- if (sdev->type == TYPE_DISK) |
352 |
++ if (sdev->type == TYPE_DISK) { |
353 |
+ sdev->allow_restart = 1; |
354 |
++ blk_queue_rq_timeout(sdev->request_queue, 120 * HZ); |
355 |
++ } |
356 |
+ spin_unlock_irqrestore(shost->host_lock, flags); |
357 |
+ return 0; |
358 |
+ } |
359 |
+diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c |
360 |
+index 6ba257cbc6d94..384458d1f73c3 100644 |
361 |
+--- a/drivers/scsi/libfc/fc_exch.c |
362 |
++++ b/drivers/scsi/libfc/fc_exch.c |
363 |
+@@ -1631,8 +1631,13 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) |
364 |
+ rc = fc_exch_done_locked(ep); |
365 |
+ WARN_ON(fc_seq_exch(sp) != ep); |
366 |
+ spin_unlock_bh(&ep->ex_lock); |
367 |
+- if (!rc) |
368 |
++ if (!rc) { |
369 |
+ fc_exch_delete(ep); |
370 |
++ } else { |
371 |
++ FC_EXCH_DBG(ep, "ep is completed already," |
372 |
++ "hence skip calling the resp\n"); |
373 |
++ goto skip_resp; |
374 |
++ } |
375 |
+ } |
376 |
+ |
377 |
+ /* |
378 |
+@@ -1651,6 +1656,7 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) |
379 |
+ if (!fc_invoke_resp(ep, sp, fp)) |
380 |
+ fc_frame_free(fp); |
381 |
+ |
382 |
++skip_resp: |
383 |
+ fc_exch_release(ep); |
384 |
+ return; |
385 |
+ rel: |
386 |
+@@ -1907,10 +1913,16 @@ static void fc_exch_reset(struct fc_exch *ep) |
387 |
+ |
388 |
+ fc_exch_hold(ep); |
389 |
+ |
390 |
+- if (!rc) |
391 |
++ if (!rc) { |
392 |
+ fc_exch_delete(ep); |
393 |
++ } else { |
394 |
++ FC_EXCH_DBG(ep, "ep is completed already," |
395 |
++ "hence skip calling the resp\n"); |
396 |
++ goto skip_resp; |
397 |
++ } |
398 |
+ |
399 |
+ fc_invoke_resp(ep, sp, ERR_PTR(-FC_EX_CLOSED)); |
400 |
++skip_resp: |
401 |
+ fc_seq_set_resp(sp, NULL, ep->arg); |
402 |
+ fc_exch_release(ep); |
403 |
+ } |
404 |
+diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c |
405 |
+index 456ce9f19569f..a0e35028ebdac 100644 |
406 |
+--- a/drivers/scsi/scsi_transport_srp.c |
407 |
++++ b/drivers/scsi/scsi_transport_srp.c |
408 |
+@@ -555,7 +555,14 @@ int srp_reconnect_rport(struct srp_rport *rport) |
409 |
+ res = mutex_lock_interruptible(&rport->mutex); |
410 |
+ if (res) |
411 |
+ goto out; |
412 |
+- scsi_target_block(&shost->shost_gendev); |
413 |
++ if (rport->state != SRP_RPORT_FAIL_FAST) |
414 |
++ /* |
415 |
++ * sdev state must be SDEV_TRANSPORT_OFFLINE, transition |
416 |
++ * to SDEV_BLOCK is illegal. Calling scsi_target_unblock() |
417 |
++ * later is ok though, scsi_internal_device_unblock_nowait() |
418 |
++ * treats SDEV_TRANSPORT_OFFLINE like SDEV_BLOCK. |
419 |
++ */ |
420 |
++ scsi_target_block(&shost->shost_gendev); |
421 |
+ res = rport->state != SRP_RPORT_LOST ? i->f->reconnect(rport) : -ENODEV; |
422 |
+ pr_debug("%s (state %d): transport.reconnect() returned %d\n", |
423 |
+ dev_name(&shost->shost_gendev), rport->state, res); |
424 |
+diff --git a/include/linux/kthread.h b/include/linux/kthread.h |
425 |
+index 4e26609c77d41..eb305353f20fa 100644 |
426 |
+--- a/include/linux/kthread.h |
427 |
++++ b/include/linux/kthread.h |
428 |
+@@ -31,6 +31,9 @@ struct task_struct *kthread_create_on_cpu(int (*threadfn)(void *data), |
429 |
+ unsigned int cpu, |
430 |
+ const char *namefmt); |
431 |
+ |
432 |
++void kthread_set_per_cpu(struct task_struct *k, int cpu); |
433 |
++bool kthread_is_per_cpu(struct task_struct *k); |
434 |
++ |
435 |
+ /** |
436 |
+ * kthread_run - create and wake a thread. |
437 |
+ * @threadfn: the function to run until signal_pending(current). |
438 |
+diff --git a/kernel/kthread.c b/kernel/kthread.c |
439 |
+index bd58765d75e76..fd6f9322312aa 100644 |
440 |
+--- a/kernel/kthread.c |
441 |
++++ b/kernel/kthread.c |
442 |
+@@ -433,11 +433,36 @@ struct task_struct *kthread_create_on_cpu(int (*threadfn)(void *data), |
443 |
+ return p; |
444 |
+ kthread_bind(p, cpu); |
445 |
+ /* CPU hotplug need to bind once again when unparking the thread. */ |
446 |
+- set_bit(KTHREAD_IS_PER_CPU, &to_kthread(p)->flags); |
447 |
+ to_kthread(p)->cpu = cpu; |
448 |
+ return p; |
449 |
+ } |
450 |
+ |
451 |
++void kthread_set_per_cpu(struct task_struct *k, int cpu) |
452 |
++{ |
453 |
++ struct kthread *kthread = to_kthread(k); |
454 |
++ if (!kthread) |
455 |
++ return; |
456 |
++ |
457 |
++ WARN_ON_ONCE(!(k->flags & PF_NO_SETAFFINITY)); |
458 |
++ |
459 |
++ if (cpu < 0) { |
460 |
++ clear_bit(KTHREAD_IS_PER_CPU, &kthread->flags); |
461 |
++ return; |
462 |
++ } |
463 |
++ |
464 |
++ kthread->cpu = cpu; |
465 |
++ set_bit(KTHREAD_IS_PER_CPU, &kthread->flags); |
466 |
++} |
467 |
++ |
468 |
++bool kthread_is_per_cpu(struct task_struct *k) |
469 |
++{ |
470 |
++ struct kthread *kthread = to_kthread(k); |
471 |
++ if (!kthread) |
472 |
++ return false; |
473 |
++ |
474 |
++ return test_bit(KTHREAD_IS_PER_CPU, &kthread->flags); |
475 |
++} |
476 |
++ |
477 |
+ /** |
478 |
+ * kthread_unpark - unpark a thread created by kthread_create(). |
479 |
+ * @k: thread created by kthread_create(). |
480 |
+diff --git a/kernel/smpboot.c b/kernel/smpboot.c |
481 |
+index 5043e7433f4b1..eeb7f8e9cce37 100644 |
482 |
+--- a/kernel/smpboot.c |
483 |
++++ b/kernel/smpboot.c |
484 |
+@@ -187,6 +187,7 @@ __smpboot_create_thread(struct smp_hotplug_thread *ht, unsigned int cpu) |
485 |
+ kfree(td); |
486 |
+ return PTR_ERR(tsk); |
487 |
+ } |
488 |
++ kthread_set_per_cpu(tsk, cpu); |
489 |
+ /* |
490 |
+ * Park the thread so that it could start right on the CPU |
491 |
+ * when it is available. |
492 |
+diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c |
493 |
+index 7f980bd7426ea..9990db258f9d1 100644 |
494 |
+--- a/net/core/gen_estimator.c |
495 |
++++ b/net/core/gen_estimator.c |
496 |
+@@ -84,11 +84,11 @@ static void est_timer(unsigned long arg) |
497 |
+ u64 rate, brate; |
498 |
+ |
499 |
+ est_fetch_counters(est, &b); |
500 |
+- brate = (b.bytes - est->last_bytes) << (10 - est->ewma_log - est->intvl_log); |
501 |
+- brate -= (est->avbps >> est->ewma_log); |
502 |
++ brate = (b.bytes - est->last_bytes) << (10 - est->intvl_log); |
503 |
++ brate = (brate >> est->ewma_log) - (est->avbps >> est->ewma_log); |
504 |
+ |
505 |
+- rate = (u64)(b.packets - est->last_packets) << (10 - est->ewma_log - est->intvl_log); |
506 |
+- rate -= (est->avpps >> est->ewma_log); |
507 |
++ rate = (u64)(b.packets - est->last_packets) << (10 - est->intvl_log); |
508 |
++ rate = (rate >> est->ewma_log) - (est->avpps >> est->ewma_log); |
509 |
+ |
510 |
+ write_seqcount_begin(&est->seq); |
511 |
+ est->avbps += brate; |
512 |
+@@ -147,6 +147,9 @@ int gen_new_estimator(struct gnet_stats_basic_packed *bstats, |
513 |
+ if (parm->interval < -2 || parm->interval > 3) |
514 |
+ return -EINVAL; |
515 |
+ |
516 |
++ if (parm->ewma_log == 0 || parm->ewma_log >= 31) |
517 |
++ return -EINVAL; |
518 |
++ |
519 |
+ est = kzalloc(sizeof(*est), GFP_KERNEL); |
520 |
+ if (!est) |
521 |
+ return -ENOBUFS; |
522 |
+diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
523 |
+index 04ae9de55d74b..48c6aa337c925 100644 |
524 |
+--- a/net/mac80211/rx.c |
525 |
++++ b/net/mac80211/rx.c |
526 |
+@@ -3823,6 +3823,8 @@ void ieee80211_check_fast_rx(struct sta_info *sta) |
527 |
+ |
528 |
+ rcu_read_lock(); |
529 |
+ key = rcu_dereference(sta->ptk[sta->ptk_idx]); |
530 |
++ if (!key) |
531 |
++ key = rcu_dereference(sdata->default_unicast_key); |
532 |
+ if (key) { |
533 |
+ switch (key->conf.cipher) { |
534 |
+ case WLAN_CIPHER_SUITE_TKIP: |
535 |
+diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c |
536 |
+index 296e95f72eb15..acdcc7d98da06 100644 |
537 |
+--- a/net/sched/sch_api.c |
538 |
++++ b/net/sched/sch_api.c |
539 |
+@@ -397,7 +397,8 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, |
540 |
+ { |
541 |
+ struct qdisc_rate_table *rtab; |
542 |
+ |
543 |
+- if (tab == NULL || r->rate == 0 || r->cell_log == 0 || |
544 |
++ if (tab == NULL || r->rate == 0 || |
545 |
++ r->cell_log == 0 || r->cell_log >= 32 || |
546 |
+ nla_len(tab) != TC_RTAB_SIZE) |
547 |
+ return NULL; |
548 |
+ |
549 |
+diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c |
550 |
+index d089c711355a9..fa269622a974e 100644 |
551 |
+--- a/tools/objtool/elf.c |
552 |
++++ b/tools/objtool/elf.c |
553 |
+@@ -226,8 +226,11 @@ static int read_symbols(struct elf *elf) |
554 |
+ |
555 |
+ symtab = find_section_by_name(elf, ".symtab"); |
556 |
+ if (!symtab) { |
557 |
+- WARN("missing symbol table"); |
558 |
+- return -1; |
559 |
++ /* |
560 |
++ * A missing symbol table is actually possible if it's an empty |
561 |
++ * .o file. This can happen for thunk_64.o. |
562 |
++ */ |
563 |
++ return 0; |
564 |
+ } |
565 |
+ |
566 |
+ symbols_nr = symtab->sh.sh_size / symtab->sh.sh_entsize; |