1 |
commit: 32e524bfc5634ea321d71f76ff12f103adc368bb |
2 |
Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jun 17 11:07:15 2021 +0000 |
4 |
Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jun 17 14:22:50 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=32e524bf |
7 |
|
8 |
Linux patch 4.9.273 |
9 |
|
10 |
Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1272_linux-4.9.273.patch | 1101 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1105 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 1400163..84582f1 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -1131,6 +1131,10 @@ Patch: 1271_linux-4.9.272.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.9.272 |
23 |
|
24 |
+Patch: 1272_linux-4.9.273.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.9.273 |
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/1272_linux-4.9.273.patch b/1272_linux-4.9.273.patch |
33 |
new file mode 100644 |
34 |
index 0000000..a903337 |
35 |
--- /dev/null |
36 |
+++ b/1272_linux-4.9.273.patch |
37 |
@@ -0,0 +1,1101 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 39aa8b66fc6ff..e43823c3337f3 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,6 +1,6 @@ |
43 |
+ VERSION = 4 |
44 |
+ PATCHLEVEL = 9 |
45 |
+-SUBLEVEL = 272 |
46 |
++SUBLEVEL = 273 |
47 |
+ EXTRAVERSION = |
48 |
+ NAME = Roaring Lionus |
49 |
+ |
50 |
+diff --git a/arch/mips/lib/mips-atomic.c b/arch/mips/lib/mips-atomic.c |
51 |
+index 5530070e0d05d..57497a26e79cb 100644 |
52 |
+--- a/arch/mips/lib/mips-atomic.c |
53 |
++++ b/arch/mips/lib/mips-atomic.c |
54 |
+@@ -37,7 +37,7 @@ |
55 |
+ */ |
56 |
+ notrace void arch_local_irq_disable(void) |
57 |
+ { |
58 |
+- preempt_disable(); |
59 |
++ preempt_disable_notrace(); |
60 |
+ |
61 |
+ __asm__ __volatile__( |
62 |
+ " .set push \n" |
63 |
+@@ -53,7 +53,7 @@ notrace void arch_local_irq_disable(void) |
64 |
+ : /* no inputs */ |
65 |
+ : "memory"); |
66 |
+ |
67 |
+- preempt_enable(); |
68 |
++ preempt_enable_notrace(); |
69 |
+ } |
70 |
+ EXPORT_SYMBOL(arch_local_irq_disable); |
71 |
+ |
72 |
+@@ -61,7 +61,7 @@ notrace unsigned long arch_local_irq_save(void) |
73 |
+ { |
74 |
+ unsigned long flags; |
75 |
+ |
76 |
+- preempt_disable(); |
77 |
++ preempt_disable_notrace(); |
78 |
+ |
79 |
+ __asm__ __volatile__( |
80 |
+ " .set push \n" |
81 |
+@@ -78,7 +78,7 @@ notrace unsigned long arch_local_irq_save(void) |
82 |
+ : /* no inputs */ |
83 |
+ : "memory"); |
84 |
+ |
85 |
+- preempt_enable(); |
86 |
++ preempt_enable_notrace(); |
87 |
+ |
88 |
+ return flags; |
89 |
+ } |
90 |
+@@ -88,7 +88,7 @@ notrace void arch_local_irq_restore(unsigned long flags) |
91 |
+ { |
92 |
+ unsigned long __tmp1; |
93 |
+ |
94 |
+- preempt_disable(); |
95 |
++ preempt_disable_notrace(); |
96 |
+ |
97 |
+ __asm__ __volatile__( |
98 |
+ " .set push \n" |
99 |
+@@ -106,7 +106,7 @@ notrace void arch_local_irq_restore(unsigned long flags) |
100 |
+ : "0" (flags) |
101 |
+ : "memory"); |
102 |
+ |
103 |
+- preempt_enable(); |
104 |
++ preempt_enable_notrace(); |
105 |
+ } |
106 |
+ EXPORT_SYMBOL(arch_local_irq_restore); |
107 |
+ |
108 |
+diff --git a/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi |
109 |
+index af12ead88c5f0..404f570ebe238 100644 |
110 |
+--- a/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi |
111 |
++++ b/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi |
112 |
+@@ -122,7 +122,15 @@ |
113 |
+ }; |
114 |
+ |
115 |
+ /include/ "pq3-i2c-0.dtsi" |
116 |
++ i2c@3000 { |
117 |
++ fsl,i2c-erratum-a004447; |
118 |
++ }; |
119 |
++ |
120 |
+ /include/ "pq3-i2c-1.dtsi" |
121 |
++ i2c@3100 { |
122 |
++ fsl,i2c-erratum-a004447; |
123 |
++ }; |
124 |
++ |
125 |
+ /include/ "pq3-duart-0.dtsi" |
126 |
+ /include/ "pq3-espi-0.dtsi" |
127 |
+ spi0: spi@7000 { |
128 |
+diff --git a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi |
129 |
+index 51e975d7631aa..8921f17fca42e 100644 |
130 |
+--- a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi |
131 |
++++ b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi |
132 |
+@@ -389,7 +389,23 @@ |
133 |
+ }; |
134 |
+ |
135 |
+ /include/ "qoriq-i2c-0.dtsi" |
136 |
++ i2c@118000 { |
137 |
++ fsl,i2c-erratum-a004447; |
138 |
++ }; |
139 |
++ |
140 |
++ i2c@118100 { |
141 |
++ fsl,i2c-erratum-a004447; |
142 |
++ }; |
143 |
++ |
144 |
+ /include/ "qoriq-i2c-1.dtsi" |
145 |
++ i2c@119000 { |
146 |
++ fsl,i2c-erratum-a004447; |
147 |
++ }; |
148 |
++ |
149 |
++ i2c@119100 { |
150 |
++ fsl,i2c-erratum-a004447; |
151 |
++ }; |
152 |
++ |
153 |
+ /include/ "qoriq-duart-0.dtsi" |
154 |
+ /include/ "qoriq-duart-1.dtsi" |
155 |
+ /include/ "qoriq-gpio-0.dtsi" |
156 |
+diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c |
157 |
+index 56b2dd9a5b687..315d51ac14b8d 100644 |
158 |
+--- a/drivers/gpu/drm/drm_auth.c |
159 |
++++ b/drivers/gpu/drm/drm_auth.c |
160 |
+@@ -244,9 +244,10 @@ int drm_master_open(struct drm_file *file_priv) |
161 |
+ void drm_master_release(struct drm_file *file_priv) |
162 |
+ { |
163 |
+ struct drm_device *dev = file_priv->minor->dev; |
164 |
+- struct drm_master *master = file_priv->master; |
165 |
++ struct drm_master *master; |
166 |
+ |
167 |
+ mutex_lock(&dev->master_mutex); |
168 |
++ master = file_priv->master; |
169 |
+ if (file_priv->magic) |
170 |
+ idr_remove(&file_priv->master->magic_map, file_priv->magic); |
171 |
+ |
172 |
+diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c |
173 |
+index 565a49a0c5641..90e4f839eb1cb 100644 |
174 |
+--- a/drivers/i2c/busses/i2c-mpc.c |
175 |
++++ b/drivers/i2c/busses/i2c-mpc.c |
176 |
+@@ -23,6 +23,7 @@ |
177 |
+ |
178 |
+ #include <linux/clk.h> |
179 |
+ #include <linux/io.h> |
180 |
++#include <linux/iopoll.h> |
181 |
+ #include <linux/fsl_devices.h> |
182 |
+ #include <linux/i2c.h> |
183 |
+ #include <linux/interrupt.h> |
184 |
+@@ -49,6 +50,7 @@ |
185 |
+ #define CCR_MTX 0x10 |
186 |
+ #define CCR_TXAK 0x08 |
187 |
+ #define CCR_RSTA 0x04 |
188 |
++#define CCR_RSVD 0x02 |
189 |
+ |
190 |
+ #define CSR_MCF 0x80 |
191 |
+ #define CSR_MAAS 0x40 |
192 |
+@@ -70,6 +72,7 @@ struct mpc_i2c { |
193 |
+ u8 fdr, dfsrr; |
194 |
+ #endif |
195 |
+ struct clk *clk_per; |
196 |
++ bool has_errata_A004447; |
197 |
+ }; |
198 |
+ |
199 |
+ struct mpc_i2c_divider { |
200 |
+@@ -178,6 +181,75 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) |
201 |
+ return 0; |
202 |
+ } |
203 |
+ |
204 |
++static int i2c_mpc_wait_sr(struct mpc_i2c *i2c, int mask) |
205 |
++{ |
206 |
++ void __iomem *addr = i2c->base + MPC_I2C_SR; |
207 |
++ u8 val; |
208 |
++ |
209 |
++ return readb_poll_timeout(addr, val, val & mask, 0, 100); |
210 |
++} |
211 |
++ |
212 |
++/* |
213 |
++ * Workaround for Erratum A004447. From the P2040CE Rev Q |
214 |
++ * |
215 |
++ * 1. Set up the frequency divider and sampling rate. |
216 |
++ * 2. I2CCR - a0h |
217 |
++ * 3. Poll for I2CSR[MBB] to get set. |
218 |
++ * 4. If I2CSR[MAL] is set (an indication that SDA is stuck low), then go to |
219 |
++ * step 5. If MAL is not set, then go to step 13. |
220 |
++ * 5. I2CCR - 00h |
221 |
++ * 6. I2CCR - 22h |
222 |
++ * 7. I2CCR - a2h |
223 |
++ * 8. Poll for I2CSR[MBB] to get set. |
224 |
++ * 9. Issue read to I2CDR. |
225 |
++ * 10. Poll for I2CSR[MIF] to be set. |
226 |
++ * 11. I2CCR - 82h |
227 |
++ * 12. Workaround complete. Skip the next steps. |
228 |
++ * 13. Issue read to I2CDR. |
229 |
++ * 14. Poll for I2CSR[MIF] to be set. |
230 |
++ * 15. I2CCR - 80h |
231 |
++ */ |
232 |
++static void mpc_i2c_fixup_A004447(struct mpc_i2c *i2c) |
233 |
++{ |
234 |
++ int ret; |
235 |
++ u32 val; |
236 |
++ |
237 |
++ writeccr(i2c, CCR_MEN | CCR_MSTA); |
238 |
++ ret = i2c_mpc_wait_sr(i2c, CSR_MBB); |
239 |
++ if (ret) { |
240 |
++ dev_err(i2c->dev, "timeout waiting for CSR_MBB\n"); |
241 |
++ return; |
242 |
++ } |
243 |
++ |
244 |
++ val = readb(i2c->base + MPC_I2C_SR); |
245 |
++ |
246 |
++ if (val & CSR_MAL) { |
247 |
++ writeccr(i2c, 0x00); |
248 |
++ writeccr(i2c, CCR_MSTA | CCR_RSVD); |
249 |
++ writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSVD); |
250 |
++ ret = i2c_mpc_wait_sr(i2c, CSR_MBB); |
251 |
++ if (ret) { |
252 |
++ dev_err(i2c->dev, "timeout waiting for CSR_MBB\n"); |
253 |
++ return; |
254 |
++ } |
255 |
++ val = readb(i2c->base + MPC_I2C_DR); |
256 |
++ ret = i2c_mpc_wait_sr(i2c, CSR_MIF); |
257 |
++ if (ret) { |
258 |
++ dev_err(i2c->dev, "timeout waiting for CSR_MIF\n"); |
259 |
++ return; |
260 |
++ } |
261 |
++ writeccr(i2c, CCR_MEN | CCR_RSVD); |
262 |
++ } else { |
263 |
++ val = readb(i2c->base + MPC_I2C_DR); |
264 |
++ ret = i2c_mpc_wait_sr(i2c, CSR_MIF); |
265 |
++ if (ret) { |
266 |
++ dev_err(i2c->dev, "timeout waiting for CSR_MIF\n"); |
267 |
++ return; |
268 |
++ } |
269 |
++ writeccr(i2c, CCR_MEN); |
270 |
++ } |
271 |
++} |
272 |
++ |
273 |
+ #if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x) |
274 |
+ static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = { |
275 |
+ {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23}, |
276 |
+@@ -581,7 +653,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) |
277 |
+ if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) { |
278 |
+ writeb(status & ~CSR_MAL, |
279 |
+ i2c->base + MPC_I2C_SR); |
280 |
+- mpc_i2c_fixup(i2c); |
281 |
++ i2c_recover_bus(&i2c->adap); |
282 |
+ } |
283 |
+ return -EIO; |
284 |
+ } |
285 |
+@@ -617,7 +689,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) |
286 |
+ if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) { |
287 |
+ writeb(status & ~CSR_MAL, |
288 |
+ i2c->base + MPC_I2C_SR); |
289 |
+- mpc_i2c_fixup(i2c); |
290 |
++ i2c_recover_bus(&i2c->adap); |
291 |
+ } |
292 |
+ return -EIO; |
293 |
+ } |
294 |
+@@ -632,6 +704,18 @@ static u32 mpc_functionality(struct i2c_adapter *adap) |
295 |
+ | I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_PROC_CALL; |
296 |
+ } |
297 |
+ |
298 |
++static int fsl_i2c_bus_recovery(struct i2c_adapter *adap) |
299 |
++{ |
300 |
++ struct mpc_i2c *i2c = i2c_get_adapdata(adap); |
301 |
++ |
302 |
++ if (i2c->has_errata_A004447) |
303 |
++ mpc_i2c_fixup_A004447(i2c); |
304 |
++ else |
305 |
++ mpc_i2c_fixup(i2c); |
306 |
++ |
307 |
++ return 0; |
308 |
++} |
309 |
++ |
310 |
+ static const struct i2c_algorithm mpc_algo = { |
311 |
+ .master_xfer = mpc_xfer, |
312 |
+ .functionality = mpc_functionality, |
313 |
+@@ -643,6 +727,10 @@ static struct i2c_adapter mpc_ops = { |
314 |
+ .timeout = HZ, |
315 |
+ }; |
316 |
+ |
317 |
++static struct i2c_bus_recovery_info fsl_i2c_recovery_info = { |
318 |
++ .recover_bus = fsl_i2c_bus_recovery, |
319 |
++}; |
320 |
++ |
321 |
+ static const struct of_device_id mpc_i2c_of_match[]; |
322 |
+ static int fsl_i2c_probe(struct platform_device *op) |
323 |
+ { |
324 |
+@@ -727,6 +815,8 @@ static int fsl_i2c_probe(struct platform_device *op) |
325 |
+ dev_info(i2c->dev, "timeout %u us\n", mpc_ops.timeout * 1000000 / HZ); |
326 |
+ |
327 |
+ platform_set_drvdata(op, i2c); |
328 |
++ if (of_property_read_bool(op->dev.of_node, "fsl,i2c-erratum-a004447")) |
329 |
++ i2c->has_errata_A004447 = true; |
330 |
+ |
331 |
+ i2c->adap = mpc_ops; |
332 |
+ of_address_to_resource(op->dev.of_node, 0, &res); |
333 |
+@@ -735,6 +825,7 @@ static int fsl_i2c_probe(struct platform_device *op) |
334 |
+ i2c_set_adapdata(&i2c->adap, i2c); |
335 |
+ i2c->adap.dev.parent = &op->dev; |
336 |
+ i2c->adap.dev.of_node = of_node_get(op->dev.of_node); |
337 |
++ i2c->adap.bus_recovery_info = &fsl_i2c_recovery_info; |
338 |
+ |
339 |
+ result = i2c_add_adapter(&i2c->adap); |
340 |
+ if (result < 0) |
341 |
+diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c |
342 |
+index afde4edef9ae8..6dea4c180c494 100644 |
343 |
+--- a/drivers/isdn/hardware/mISDN/netjet.c |
344 |
++++ b/drivers/isdn/hardware/mISDN/netjet.c |
345 |
+@@ -1114,7 +1114,6 @@ nj_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
346 |
+ card->typ = NETJET_S_TJ300; |
347 |
+ |
348 |
+ card->base = pci_resource_start(pdev, 0); |
349 |
+- card->irq = pdev->irq; |
350 |
+ pci_set_drvdata(pdev, card); |
351 |
+ err = setup_instance(card); |
352 |
+ if (err) |
353 |
+diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c |
354 |
+index 1b2e9217ec789..d520ce32ddbfc 100644 |
355 |
+--- a/drivers/net/appletalk/cops.c |
356 |
++++ b/drivers/net/appletalk/cops.c |
357 |
+@@ -324,6 +324,8 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr) |
358 |
+ break; |
359 |
+ } |
360 |
+ |
361 |
++ dev->base_addr = ioaddr; |
362 |
++ |
363 |
+ /* Reserve any actual interrupt. */ |
364 |
+ if (dev->irq) { |
365 |
+ retval = request_irq(dev->irq, cops_interrupt, 0, dev->name, dev); |
366 |
+@@ -331,8 +333,6 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr) |
367 |
+ goto err_out; |
368 |
+ } |
369 |
+ |
370 |
+- dev->base_addr = ioaddr; |
371 |
+- |
372 |
+ lp = netdev_priv(dev); |
373 |
+ spin_lock_init(&lp->lock); |
374 |
+ |
375 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
376 |
+index 16437aa35bc4c..2b721ed392adb 100644 |
377 |
+--- a/drivers/net/bonding/bond_main.c |
378 |
++++ b/drivers/net/bonding/bond_main.c |
379 |
+@@ -1280,6 +1280,7 @@ static struct slave *bond_alloc_slave(struct bonding *bond, |
380 |
+ |
381 |
+ slave->bond = bond; |
382 |
+ slave->dev = slave_dev; |
383 |
++ INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); |
384 |
+ |
385 |
+ if (bond_kobj_init(slave)) |
386 |
+ return NULL; |
387 |
+@@ -1292,7 +1293,6 @@ static struct slave *bond_alloc_slave(struct bonding *bond, |
388 |
+ return NULL; |
389 |
+ } |
390 |
+ } |
391 |
+- INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); |
392 |
+ |
393 |
+ return slave; |
394 |
+ } |
395 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
396 |
+index e8a09d0afe1c9..545b59ff5d7e7 100644 |
397 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
398 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
399 |
+@@ -1240,8 +1240,10 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, |
400 |
+ goto failed; |
401 |
+ |
402 |
+ /* SR-IOV capability was enabled but there are no VFs*/ |
403 |
+- if (iov->total == 0) |
404 |
++ if (iov->total == 0) { |
405 |
++ err = -EINVAL; |
406 |
+ goto failed; |
407 |
++ } |
408 |
+ |
409 |
+ iov->nr_virtfn = min_t(u16, iov->total, num_vfs_param); |
410 |
+ |
411 |
+diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c |
412 |
+index f20718b730e5b..69fa47351a329 100644 |
413 |
+--- a/drivers/net/ethernet/cadence/macb.c |
414 |
++++ b/drivers/net/ethernet/cadence/macb.c |
415 |
+@@ -2031,6 +2031,9 @@ static struct net_device_stats *gem_get_stats(struct macb *bp) |
416 |
+ struct gem_stats *hwstat = &bp->hw_stats.gem; |
417 |
+ struct net_device_stats *nstat = &bp->stats; |
418 |
+ |
419 |
++ if (!netif_running(bp->dev)) |
420 |
++ return nstat; |
421 |
++ |
422 |
+ gem_update_stats(bp); |
423 |
+ |
424 |
+ nstat->rx_errors = (hwstat->rx_frame_check_sequence_errors + |
425 |
+diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c |
426 |
+index f2cb77c3b1992..192950a112c93 100644 |
427 |
+--- a/drivers/net/ethernet/qlogic/qla3xxx.c |
428 |
++++ b/drivers/net/ethernet/qlogic/qla3xxx.c |
429 |
+@@ -115,7 +115,7 @@ static int ql_sem_spinlock(struct ql3_adapter *qdev, |
430 |
+ value = readl(&port_regs->CommonRegs.semaphoreReg); |
431 |
+ if ((value & (sem_mask >> 16)) == sem_bits) |
432 |
+ return 0; |
433 |
+- ssleep(1); |
434 |
++ mdelay(1000); |
435 |
+ } while (--seconds); |
436 |
+ return -1; |
437 |
+ } |
438 |
+diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c |
439 |
+index a9bbdcec0bad7..8cc7563ab103b 100644 |
440 |
+--- a/drivers/net/phy/mdio_bus.c |
441 |
++++ b/drivers/net/phy/mdio_bus.c |
442 |
+@@ -362,7 +362,8 @@ void mdiobus_unregister(struct mii_bus *bus) |
443 |
+ struct mdio_device *mdiodev; |
444 |
+ int i; |
445 |
+ |
446 |
+- BUG_ON(bus->state != MDIOBUS_REGISTERED); |
447 |
++ if (WARN_ON_ONCE(bus->state != MDIOBUS_REGISTERED)) |
448 |
++ return; |
449 |
+ bus->state = MDIOBUS_UNREGISTERED; |
450 |
+ |
451 |
+ for (i = 0; i < PHY_MAX_ADDR; i++) { |
452 |
+diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c |
453 |
+index 258a3f9a25197..dc09f10d5d4b8 100644 |
454 |
+--- a/drivers/scsi/hosts.c |
455 |
++++ b/drivers/scsi/hosts.c |
456 |
+@@ -368,7 +368,7 @@ static void scsi_host_dev_release(struct device *dev) |
457 |
+ |
458 |
+ ida_simple_remove(&host_index_ida, shost->host_no); |
459 |
+ |
460 |
+- if (parent) |
461 |
++ if (shost->shost_state != SHOST_CREATED) |
462 |
+ put_device(parent); |
463 |
+ kfree(shost); |
464 |
+ } |
465 |
+@@ -421,8 +421,10 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) |
466 |
+ mutex_init(&shost->scan_mutex); |
467 |
+ |
468 |
+ index = ida_simple_get(&host_index_ida, 0, 0, GFP_KERNEL); |
469 |
+- if (index < 0) |
470 |
+- goto fail_kfree; |
471 |
++ if (index < 0) { |
472 |
++ kfree(shost); |
473 |
++ return NULL; |
474 |
++ } |
475 |
+ shost->host_no = index; |
476 |
+ |
477 |
+ shost->dma_channel = 0xff; |
478 |
+@@ -509,7 +511,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) |
479 |
+ shost_printk(KERN_WARNING, shost, |
480 |
+ "error handler thread failed to spawn, error = %ld\n", |
481 |
+ PTR_ERR(shost->ehandler)); |
482 |
+- goto fail_index_remove; |
483 |
++ goto fail; |
484 |
+ } |
485 |
+ |
486 |
+ shost->tmf_work_q = alloc_workqueue("scsi_tmf_%d", |
487 |
+@@ -518,17 +520,18 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) |
488 |
+ if (!shost->tmf_work_q) { |
489 |
+ shost_printk(KERN_WARNING, shost, |
490 |
+ "failed to create tmf workq\n"); |
491 |
+- goto fail_kthread; |
492 |
++ goto fail; |
493 |
+ } |
494 |
+ scsi_proc_hostdir_add(shost->hostt); |
495 |
+ return shost; |
496 |
++ fail: |
497 |
++ /* |
498 |
++ * Host state is still SHOST_CREATED and that is enough to release |
499 |
++ * ->shost_gendev. scsi_host_dev_release() will free |
500 |
++ * dev_name(&shost->shost_dev). |
501 |
++ */ |
502 |
++ put_device(&shost->shost_gendev); |
503 |
+ |
504 |
+- fail_kthread: |
505 |
+- kthread_stop(shost->ehandler); |
506 |
+- fail_index_remove: |
507 |
+- ida_simple_remove(&host_index_ida, shost->host_no); |
508 |
+- fail_kfree: |
509 |
+- kfree(shost); |
510 |
+ return NULL; |
511 |
+ } |
512 |
+ EXPORT_SYMBOL(scsi_host_alloc); |
513 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
514 |
+index b889caa556a0b..6ef7a094ee515 100644 |
515 |
+--- a/drivers/scsi/qla2xxx/qla_target.c |
516 |
++++ b/drivers/scsi/qla2xxx/qla_target.c |
517 |
+@@ -1224,6 +1224,7 @@ void qlt_stop_phase2(struct qla_tgt *tgt) |
518 |
+ "Waiting for %d IRQ commands to complete (tgt %p)", |
519 |
+ tgt->irq_cmd_count, tgt); |
520 |
+ |
521 |
++ mutex_lock(&tgt->ha->optrom_mutex); |
522 |
+ mutex_lock(&vha->vha_tgt.tgt_mutex); |
523 |
+ spin_lock_irqsave(&ha->hardware_lock, flags); |
524 |
+ while ((tgt->irq_cmd_count != 0) || (tgt->atio_irq_cmd_count != 0)) { |
525 |
+@@ -1235,6 +1236,7 @@ void qlt_stop_phase2(struct qla_tgt *tgt) |
526 |
+ tgt->tgt_stopped = 1; |
527 |
+ spin_unlock_irqrestore(&ha->hardware_lock, flags); |
528 |
+ mutex_unlock(&vha->vha_tgt.tgt_mutex); |
529 |
++ mutex_unlock(&tgt->ha->optrom_mutex); |
530 |
+ |
531 |
+ ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00c, "Stop of tgt %p finished", |
532 |
+ tgt); |
533 |
+diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c |
534 |
+index df6fabcce4f78..4d2172c115c6e 100644 |
535 |
+--- a/drivers/scsi/vmw_pvscsi.c |
536 |
++++ b/drivers/scsi/vmw_pvscsi.c |
537 |
+@@ -577,7 +577,13 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter, |
538 |
+ case BTSTAT_SUCCESS: |
539 |
+ case BTSTAT_LINKED_COMMAND_COMPLETED: |
540 |
+ case BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG: |
541 |
+- /* If everything went fine, let's move on.. */ |
542 |
++ /* |
543 |
++ * Commands like INQUIRY may transfer less data than |
544 |
++ * requested by the initiator via bufflen. Set residual |
545 |
++ * count to make upper layer aware of the actual amount |
546 |
++ * of data returned. |
547 |
++ */ |
548 |
++ scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen); |
549 |
+ cmd->result = (DID_OK << 16); |
550 |
+ break; |
551 |
+ |
552 |
+diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c |
553 |
+index 2331469f943d2..bd08b53ff81d2 100644 |
554 |
+--- a/drivers/usb/dwc3/ep0.c |
555 |
++++ b/drivers/usb/dwc3/ep0.c |
556 |
+@@ -328,6 +328,9 @@ static struct dwc3_ep *dwc3_wIndex_to_dep(struct dwc3 *dwc, __le16 wIndex_le) |
557 |
+ epnum |= 1; |
558 |
+ |
559 |
+ dep = dwc->eps[epnum]; |
560 |
++ if (dep == NULL) |
561 |
++ return NULL; |
562 |
++ |
563 |
+ if (dep->flags & DWC3_EP_ENABLED) |
564 |
+ return dep; |
565 |
+ |
566 |
+diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c |
567 |
+index 9b9d31eb6037f..2695a4db38292 100644 |
568 |
+--- a/drivers/usb/gadget/config.c |
569 |
++++ b/drivers/usb/gadget/config.c |
570 |
+@@ -168,6 +168,14 @@ int usb_assign_descriptors(struct usb_function *f, |
571 |
+ { |
572 |
+ struct usb_gadget *g = f->config->cdev->gadget; |
573 |
+ |
574 |
++ /* super-speed-plus descriptor falls back to super-speed one, |
575 |
++ * if such a descriptor was provided, thus avoiding a NULL |
576 |
++ * pointer dereference if a 5gbps capable gadget is used with |
577 |
++ * a 10gbps capable config (device port + cable + host port) |
578 |
++ */ |
579 |
++ if (!ssp) |
580 |
++ ssp = ss; |
581 |
++ |
582 |
+ if (fs) { |
583 |
+ f->fs_descriptors = usb_copy_descriptors(fs); |
584 |
+ if (!f->fs_descriptors) |
585 |
+diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c |
586 |
+index 8e3e443827854..5bd80cb3635ce 100644 |
587 |
+--- a/drivers/usb/gadget/function/f_ecm.c |
588 |
++++ b/drivers/usb/gadget/function/f_ecm.c |
589 |
+@@ -793,7 +793,7 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f) |
590 |
+ fs_ecm_notify_desc.bEndpointAddress; |
591 |
+ |
592 |
+ status = usb_assign_descriptors(f, ecm_fs_function, ecm_hs_function, |
593 |
+- ecm_ss_function, NULL); |
594 |
++ ecm_ss_function, ecm_ss_function); |
595 |
+ if (status) |
596 |
+ goto fail; |
597 |
+ |
598 |
+diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c |
599 |
+index 007ec6e4a5d42..5abc27f12a418 100644 |
600 |
+--- a/drivers/usb/gadget/function/f_eem.c |
601 |
++++ b/drivers/usb/gadget/function/f_eem.c |
602 |
+@@ -309,7 +309,7 @@ static int eem_bind(struct usb_configuration *c, struct usb_function *f) |
603 |
+ eem_ss_out_desc.bEndpointAddress = eem_fs_out_desc.bEndpointAddress; |
604 |
+ |
605 |
+ status = usb_assign_descriptors(f, eem_fs_function, eem_hs_function, |
606 |
+- eem_ss_function, NULL); |
607 |
++ eem_ss_function, eem_ss_function); |
608 |
+ if (status) |
609 |
+ goto fail; |
610 |
+ |
611 |
+@@ -502,7 +502,7 @@ static int eem_unwrap(struct gether *port, |
612 |
+ skb2 = skb_clone(skb, GFP_ATOMIC); |
613 |
+ if (unlikely(!skb2)) { |
614 |
+ DBG(cdev, "unable to unframe EEM packet\n"); |
615 |
+- continue; |
616 |
++ goto next; |
617 |
+ } |
618 |
+ skb_trim(skb2, len - ETH_FCS_LEN); |
619 |
+ |
620 |
+@@ -513,7 +513,7 @@ static int eem_unwrap(struct gether *port, |
621 |
+ if (unlikely(!skb3)) { |
622 |
+ DBG(cdev, "unable to realign EEM packet\n"); |
623 |
+ dev_kfree_skb_any(skb2); |
624 |
+- continue; |
625 |
++ goto next; |
626 |
+ } |
627 |
+ dev_kfree_skb_any(skb2); |
628 |
+ skb_queue_tail(list, skb3); |
629 |
+diff --git a/drivers/usb/gadget/function/f_loopback.c b/drivers/usb/gadget/function/f_loopback.c |
630 |
+index e70093835e14a..8c1810d655983 100644 |
631 |
+--- a/drivers/usb/gadget/function/f_loopback.c |
632 |
++++ b/drivers/usb/gadget/function/f_loopback.c |
633 |
+@@ -211,7 +211,7 @@ autoconf_fail: |
634 |
+ ss_loop_sink_desc.bEndpointAddress = fs_loop_sink_desc.bEndpointAddress; |
635 |
+ |
636 |
+ ret = usb_assign_descriptors(f, fs_loopback_descs, hs_loopback_descs, |
637 |
+- ss_loopback_descs, NULL); |
638 |
++ ss_loopback_descs, ss_loopback_descs); |
639 |
+ if (ret) |
640 |
+ return ret; |
641 |
+ |
642 |
+diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c |
643 |
+index 4395ea07c1bb4..8300ca14b2a58 100644 |
644 |
+--- a/drivers/usb/gadget/function/f_ncm.c |
645 |
++++ b/drivers/usb/gadget/function/f_ncm.c |
646 |
+@@ -588,7 +588,7 @@ static void ncm_do_notify(struct f_ncm *ncm) |
647 |
+ data[0] = cpu_to_le32(ncm_bitrate(cdev->gadget)); |
648 |
+ data[1] = data[0]; |
649 |
+ |
650 |
+- DBG(cdev, "notify speed %d\n", ncm_bitrate(cdev->gadget)); |
651 |
++ DBG(cdev, "notify speed %u\n", ncm_bitrate(cdev->gadget)); |
652 |
+ ncm->notify_state = NCM_NOTIFY_CONNECT; |
653 |
+ break; |
654 |
+ } |
655 |
+diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c |
656 |
+index b3d036d06553c..c347fe13d45dd 100644 |
657 |
+--- a/drivers/usb/gadget/function/f_printer.c |
658 |
++++ b/drivers/usb/gadget/function/f_printer.c |
659 |
+@@ -1057,7 +1057,8 @@ autoconf_fail: |
660 |
+ ss_ep_out_desc.bEndpointAddress = fs_ep_out_desc.bEndpointAddress; |
661 |
+ |
662 |
+ ret = usb_assign_descriptors(f, fs_printer_function, |
663 |
+- hs_printer_function, ss_printer_function, NULL); |
664 |
++ hs_printer_function, ss_printer_function, |
665 |
++ ss_printer_function); |
666 |
+ if (ret) |
667 |
+ return ret; |
668 |
+ |
669 |
+diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c |
670 |
+index 2f310973155a5..d48b14a3dfa62 100644 |
671 |
+--- a/drivers/usb/gadget/function/f_rndis.c |
672 |
++++ b/drivers/usb/gadget/function/f_rndis.c |
673 |
+@@ -789,7 +789,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) |
674 |
+ ss_notify_desc.bEndpointAddress = fs_notify_desc.bEndpointAddress; |
675 |
+ |
676 |
+ status = usb_assign_descriptors(f, eth_fs_function, eth_hs_function, |
677 |
+- eth_ss_function, NULL); |
678 |
++ eth_ss_function, eth_ss_function); |
679 |
+ if (status) |
680 |
+ goto fail; |
681 |
+ |
682 |
+diff --git a/drivers/usb/gadget/function/f_serial.c b/drivers/usb/gadget/function/f_serial.c |
683 |
+index cb00ada21d9c2..e1efb69c80bad 100644 |
684 |
+--- a/drivers/usb/gadget/function/f_serial.c |
685 |
++++ b/drivers/usb/gadget/function/f_serial.c |
686 |
+@@ -236,7 +236,7 @@ static int gser_bind(struct usb_configuration *c, struct usb_function *f) |
687 |
+ gser_ss_out_desc.bEndpointAddress = gser_fs_out_desc.bEndpointAddress; |
688 |
+ |
689 |
+ status = usb_assign_descriptors(f, gser_fs_function, gser_hs_function, |
690 |
+- gser_ss_function, NULL); |
691 |
++ gser_ss_function, gser_ss_function); |
692 |
+ if (status) |
693 |
+ goto fail; |
694 |
+ dev_dbg(&cdev->gadget->dev, "generic ttyGS%d: %s speed IN/%s OUT/%s\n", |
695 |
+diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c |
696 |
+index 6e9d958004a0d..1c5745f7abea1 100644 |
697 |
+--- a/drivers/usb/gadget/function/f_sourcesink.c |
698 |
++++ b/drivers/usb/gadget/function/f_sourcesink.c |
699 |
+@@ -435,7 +435,8 @@ no_iso: |
700 |
+ ss_iso_sink_desc.bEndpointAddress = fs_iso_sink_desc.bEndpointAddress; |
701 |
+ |
702 |
+ ret = usb_assign_descriptors(f, fs_source_sink_descs, |
703 |
+- hs_source_sink_descs, ss_source_sink_descs, NULL); |
704 |
++ hs_source_sink_descs, ss_source_sink_descs, |
705 |
++ ss_source_sink_descs); |
706 |
+ if (ret) |
707 |
+ return ret; |
708 |
+ |
709 |
+diff --git a/drivers/usb/gadget/function/f_subset.c b/drivers/usb/gadget/function/f_subset.c |
710 |
+index 434b983f3b4c2..055bd0706cdd0 100644 |
711 |
+--- a/drivers/usb/gadget/function/f_subset.c |
712 |
++++ b/drivers/usb/gadget/function/f_subset.c |
713 |
+@@ -362,7 +362,7 @@ geth_bind(struct usb_configuration *c, struct usb_function *f) |
714 |
+ fs_subset_out_desc.bEndpointAddress; |
715 |
+ |
716 |
+ status = usb_assign_descriptors(f, fs_eth_function, hs_eth_function, |
717 |
+- ss_eth_function, NULL); |
718 |
++ ss_eth_function, ss_eth_function); |
719 |
+ if (status) |
720 |
+ goto fail; |
721 |
+ |
722 |
+diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c |
723 |
+index 7e8e262b36297..821f470c6a2f9 100644 |
724 |
+--- a/drivers/usb/gadget/function/f_tcm.c |
725 |
++++ b/drivers/usb/gadget/function/f_tcm.c |
726 |
+@@ -2071,7 +2071,8 @@ static int tcm_bind(struct usb_configuration *c, struct usb_function *f) |
727 |
+ uasp_fs_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress; |
728 |
+ |
729 |
+ ret = usb_assign_descriptors(f, uasp_fs_function_desc, |
730 |
+- uasp_hs_function_desc, uasp_ss_function_desc, NULL); |
731 |
++ uasp_hs_function_desc, uasp_ss_function_desc, |
732 |
++ uasp_ss_function_desc); |
733 |
+ if (ret) |
734 |
+ goto ep_fail; |
735 |
+ |
736 |
+diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
737 |
+index 276e9790442d9..8f4bd9fa82449 100644 |
738 |
+--- a/drivers/usb/serial/ftdi_sio.c |
739 |
++++ b/drivers/usb/serial/ftdi_sio.c |
740 |
+@@ -606,6 +606,7 @@ static const struct usb_device_id id_table_combined[] = { |
741 |
+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
742 |
+ { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLX_PLUS_PID) }, |
743 |
+ { USB_DEVICE(FTDI_VID, FTDI_NT_ORION_IO_PID) }, |
744 |
++ { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONMX_PID) }, |
745 |
+ { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) }, |
746 |
+ { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) }, |
747 |
+ { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) }, |
748 |
+diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
749 |
+index b5f28a7952282..54ded2bc9eb6c 100644 |
750 |
+--- a/drivers/usb/serial/ftdi_sio_ids.h |
751 |
++++ b/drivers/usb/serial/ftdi_sio_ids.h |
752 |
+@@ -580,6 +580,7 @@ |
753 |
+ #define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */ |
754 |
+ #define FTDI_NT_ORIONLX_PLUS_PID 0x7c91 /* OrionLX+ Substation Automation Platform */ |
755 |
+ #define FTDI_NT_ORION_IO_PID 0x7c92 /* Orion I/O */ |
756 |
++#define FTDI_NT_ORIONMX_PID 0x7c93 /* OrionMX */ |
757 |
+ |
758 |
+ /* |
759 |
+ * Synapse Wireless product ids (FTDI_VID) |
760 |
+diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c |
761 |
+index 76564b3bebb9b..cc0bf59bd08db 100644 |
762 |
+--- a/drivers/usb/serial/omninet.c |
763 |
++++ b/drivers/usb/serial/omninet.c |
764 |
+@@ -27,6 +27,7 @@ |
765 |
+ |
766 |
+ #define ZYXEL_VENDOR_ID 0x0586 |
767 |
+ #define ZYXEL_OMNINET_ID 0x1000 |
768 |
++#define ZYXEL_OMNI_56K_PLUS_ID 0x1500 |
769 |
+ /* This one seems to be a re-branded ZyXEL device */ |
770 |
+ #define BT_IGNITIONPRO_ID 0x2000 |
771 |
+ |
772 |
+@@ -44,6 +45,7 @@ static int omninet_port_remove(struct usb_serial_port *port); |
773 |
+ |
774 |
+ static const struct usb_device_id id_table[] = { |
775 |
+ { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) }, |
776 |
++ { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNI_56K_PLUS_ID) }, |
777 |
+ { USB_DEVICE(ZYXEL_VENDOR_ID, BT_IGNITIONPRO_ID) }, |
778 |
+ { } /* Terminating entry */ |
779 |
+ }; |
780 |
+diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c |
781 |
+index 19952ccd028a9..ba69acaa7a30f 100644 |
782 |
+--- a/drivers/usb/serial/quatech2.c |
783 |
++++ b/drivers/usb/serial/quatech2.c |
784 |
+@@ -419,7 +419,7 @@ static void qt2_close(struct usb_serial_port *port) |
785 |
+ |
786 |
+ /* flush the port transmit buffer */ |
787 |
+ i = usb_control_msg(serial->dev, |
788 |
+- usb_rcvctrlpipe(serial->dev, 0), |
789 |
++ usb_sndctrlpipe(serial->dev, 0), |
790 |
+ QT2_FLUSH_DEVICE, 0x40, 1, |
791 |
+ port_priv->device_port, NULL, 0, QT2_USB_TIMEOUT); |
792 |
+ |
793 |
+@@ -429,7 +429,7 @@ static void qt2_close(struct usb_serial_port *port) |
794 |
+ |
795 |
+ /* flush the port receive buffer */ |
796 |
+ i = usb_control_msg(serial->dev, |
797 |
+- usb_rcvctrlpipe(serial->dev, 0), |
798 |
++ usb_sndctrlpipe(serial->dev, 0), |
799 |
+ QT2_FLUSH_DEVICE, 0x40, 0, |
800 |
+ port_priv->device_port, NULL, 0, QT2_USB_TIMEOUT); |
801 |
+ |
802 |
+@@ -701,7 +701,7 @@ static int qt2_attach(struct usb_serial *serial) |
803 |
+ int status; |
804 |
+ |
805 |
+ /* power on unit */ |
806 |
+- status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
807 |
++ status = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
808 |
+ 0xc2, 0x40, 0x8000, 0, NULL, 0, |
809 |
+ QT2_USB_TIMEOUT); |
810 |
+ if (status < 0) { |
811 |
+diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
812 |
+index 03661b744eaf0..79454ea77153d 100644 |
813 |
+--- a/fs/btrfs/file.c |
814 |
++++ b/fs/btrfs/file.c |
815 |
+@@ -1089,7 +1089,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, |
816 |
+ int del_nr = 0; |
817 |
+ int del_slot = 0; |
818 |
+ int recow; |
819 |
+- int ret; |
820 |
++ int ret = 0; |
821 |
+ u64 ino = btrfs_ino(inode); |
822 |
+ |
823 |
+ path = btrfs_alloc_path(); |
824 |
+@@ -1309,7 +1309,7 @@ again: |
825 |
+ } |
826 |
+ out: |
827 |
+ btrfs_free_path(path); |
828 |
+- return 0; |
829 |
++ return ret; |
830 |
+ } |
831 |
+ |
832 |
+ /* |
833 |
+diff --git a/fs/nfs/client.c b/fs/nfs/client.c |
834 |
+index 28d8a57a9908c..d322ed5cbc1ca 100644 |
835 |
+--- a/fs/nfs/client.c |
836 |
++++ b/fs/nfs/client.c |
837 |
+@@ -379,7 +379,7 @@ nfs_get_client(const struct nfs_client_initdata *cl_init, |
838 |
+ |
839 |
+ if (cl_init->hostname == NULL) { |
840 |
+ WARN_ON(1); |
841 |
+- return NULL; |
842 |
++ return ERR_PTR(-EINVAL); |
843 |
+ } |
844 |
+ |
845 |
+ dprintk("--> nfs_get_client(%s,v%u)\n", |
846 |
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
847 |
+index 94130588ebf52..2ea772f596e3c 100644 |
848 |
+--- a/fs/nfs/nfs4proc.c |
849 |
++++ b/fs/nfs/nfs4proc.c |
850 |
+@@ -5183,6 +5183,14 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen |
851 |
+ do { |
852 |
+ err = __nfs4_proc_set_acl(inode, buf, buflen); |
853 |
+ trace_nfs4_set_acl(inode, err); |
854 |
++ if (err == -NFS4ERR_BADOWNER || err == -NFS4ERR_BADNAME) { |
855 |
++ /* |
856 |
++ * no need to retry since the kernel |
857 |
++ * isn't involved in encoding the ACEs. |
858 |
++ */ |
859 |
++ err = -EINVAL; |
860 |
++ break; |
861 |
++ } |
862 |
+ err = nfs4_handle_exception(NFS_SERVER(inode), err, |
863 |
+ &exception); |
864 |
+ } while (exception.retry); |
865 |
+diff --git a/fs/proc/base.c b/fs/proc/base.c |
866 |
+index 294fb8ee2ff46..0368ff9335cb5 100644 |
867 |
+--- a/fs/proc/base.c |
868 |
++++ b/fs/proc/base.c |
869 |
+@@ -2493,6 +2493,13 @@ out: |
870 |
+ } |
871 |
+ |
872 |
+ #ifdef CONFIG_SECURITY |
873 |
++static int proc_pid_attr_open(struct inode *inode, struct file *file) |
874 |
++{ |
875 |
++ file->private_data = NULL; |
876 |
++ __mem_open(inode, file, PTRACE_MODE_READ_FSCREDS); |
877 |
++ return 0; |
878 |
++} |
879 |
++ |
880 |
+ static ssize_t proc_pid_attr_read(struct file * file, char __user * buf, |
881 |
+ size_t count, loff_t *ppos) |
882 |
+ { |
883 |
+@@ -2523,7 +2530,7 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, |
884 |
+ struct task_struct *task = get_proc_task(inode); |
885 |
+ |
886 |
+ /* A task may only write when it was the opener. */ |
887 |
+- if (file->f_cred != current_real_cred()) |
888 |
++ if (file->private_data != current->mm) |
889 |
+ return -EPERM; |
890 |
+ |
891 |
+ length = -ESRCH; |
892 |
+@@ -2561,9 +2568,11 @@ out_no_task: |
893 |
+ } |
894 |
+ |
895 |
+ static const struct file_operations proc_pid_attr_operations = { |
896 |
++ .open = proc_pid_attr_open, |
897 |
+ .read = proc_pid_attr_read, |
898 |
+ .write = proc_pid_attr_write, |
899 |
+ .llseek = generic_file_llseek, |
900 |
++ .release = mem_release, |
901 |
+ }; |
902 |
+ |
903 |
+ static const struct pid_entry attr_dir_stuff[] = { |
904 |
+diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h |
905 |
+index bb4af1bfcaf43..05aa860daa5cd 100644 |
906 |
+--- a/include/linux/kvm_host.h |
907 |
++++ b/include/linux/kvm_host.h |
908 |
+@@ -26,6 +26,7 @@ |
909 |
+ #include <linux/context_tracking.h> |
910 |
+ #include <linux/irqbypass.h> |
911 |
+ #include <linux/swait.h> |
912 |
++#include <linux/nospec.h> |
913 |
+ #include <asm/signal.h> |
914 |
+ |
915 |
+ #include <linux/kvm.h> |
916 |
+@@ -932,7 +933,15 @@ __gfn_to_memslot(struct kvm_memslots *slots, gfn_t gfn) |
917 |
+ static inline unsigned long |
918 |
+ __gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn) |
919 |
+ { |
920 |
+- return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE; |
921 |
++ /* |
922 |
++ * The index was checked originally in search_memslots. To avoid |
923 |
++ * that a malicious guest builds a Spectre gadget out of e.g. page |
924 |
++ * table walks, do not let the processor speculate loads outside |
925 |
++ * the guest's registered memslots. |
926 |
++ */ |
927 |
++ unsigned long offset = gfn - slot->base_gfn; |
928 |
++ offset = array_index_nospec(offset, slot->npages); |
929 |
++ return slot->userspace_addr + offset * PAGE_SIZE; |
930 |
+ } |
931 |
+ |
932 |
+ static inline int memslot_id(struct kvm *kvm, gfn_t gfn) |
933 |
+diff --git a/kernel/cgroup.c b/kernel/cgroup.c |
934 |
+index 684d02f343b4c..3378c44e147e6 100644 |
935 |
+--- a/kernel/cgroup.c |
936 |
++++ b/kernel/cgroup.c |
937 |
+@@ -3598,6 +3598,10 @@ static int cgroup_rename(struct kernfs_node *kn, struct kernfs_node *new_parent, |
938 |
+ struct cgroup *cgrp = kn->priv; |
939 |
+ int ret; |
940 |
+ |
941 |
++ /* do not accept '\n' to prevent making /proc/<pid>/cgroup unparsable */ |
942 |
++ if (strchr(new_name_str, '\n')) |
943 |
++ return -EINVAL; |
944 |
++ |
945 |
+ if (kernfs_type(kn) != KERNFS_DIR) |
946 |
+ return -ENOTDIR; |
947 |
+ if (kn->parent != new_parent) |
948 |
+@@ -5636,8 +5640,6 @@ int __init cgroup_init_early(void) |
949 |
+ return 0; |
950 |
+ } |
951 |
+ |
952 |
+-static u16 cgroup_disable_mask __initdata; |
953 |
+- |
954 |
+ /** |
955 |
+ * cgroup_init - cgroup initialization |
956 |
+ * |
957 |
+@@ -5695,12 +5697,8 @@ int __init cgroup_init(void) |
958 |
+ * disabled flag and cftype registration needs kmalloc, |
959 |
+ * both of which aren't available during early_init. |
960 |
+ */ |
961 |
+- if (cgroup_disable_mask & (1 << ssid)) { |
962 |
+- static_branch_disable(cgroup_subsys_enabled_key[ssid]); |
963 |
+- printk(KERN_INFO "Disabling %s control group subsystem\n", |
964 |
+- ss->name); |
965 |
++ if (!cgroup_ssid_enabled(ssid)) |
966 |
+ continue; |
967 |
+- } |
968 |
+ |
969 |
+ if (cgroup_ssid_no_v1(ssid)) |
970 |
+ printk(KERN_INFO "Disabling %s control group subsystem in v1 mounts\n", |
971 |
+@@ -6143,7 +6141,10 @@ static int __init cgroup_disable(char *str) |
972 |
+ if (strcmp(token, ss->name) && |
973 |
+ strcmp(token, ss->legacy_name)) |
974 |
+ continue; |
975 |
+- cgroup_disable_mask |= 1 << i; |
976 |
++ |
977 |
++ static_branch_disable(cgroup_subsys_enabled_key[i]); |
978 |
++ pr_info("Disabling %s control group subsystem\n", |
979 |
++ ss->name); |
980 |
+ } |
981 |
+ } |
982 |
+ return 1; |
983 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
984 |
+index 9d4a71deac992..7615a97a3511d 100644 |
985 |
+--- a/kernel/events/core.c |
986 |
++++ b/kernel/events/core.c |
987 |
+@@ -3782,7 +3782,9 @@ find_get_context(struct pmu *pmu, struct task_struct *task, |
988 |
+ cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu); |
989 |
+ ctx = &cpuctx->ctx; |
990 |
+ get_ctx(ctx); |
991 |
++ raw_spin_lock_irqsave(&ctx->lock, flags); |
992 |
+ ++ctx->pin_count; |
993 |
++ raw_spin_unlock_irqrestore(&ctx->lock, flags); |
994 |
+ |
995 |
+ return ctx; |
996 |
+ } |
997 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
998 |
+index a6851f8b9b245..84f2caf6a6991 100644 |
999 |
+--- a/kernel/trace/ftrace.c |
1000 |
++++ b/kernel/trace/ftrace.c |
1001 |
+@@ -1961,12 +1961,18 @@ static int ftrace_hash_ipmodify_update(struct ftrace_ops *ops, |
1002 |
+ |
1003 |
+ static void print_ip_ins(const char *fmt, const unsigned char *p) |
1004 |
+ { |
1005 |
++ char ins[MCOUNT_INSN_SIZE]; |
1006 |
+ int i; |
1007 |
+ |
1008 |
++ if (probe_kernel_read(ins, p, MCOUNT_INSN_SIZE)) { |
1009 |
++ printk(KERN_CONT "%s[FAULT] %px\n", fmt, p); |
1010 |
++ return; |
1011 |
++ } |
1012 |
++ |
1013 |
+ printk(KERN_CONT "%s", fmt); |
1014 |
+ |
1015 |
+ for (i = 0; i < MCOUNT_INSN_SIZE; i++) |
1016 |
+- printk(KERN_CONT "%s%02x", i ? ":" : "", p[i]); |
1017 |
++ printk(KERN_CONT "%s%02x", i ? ":" : "", ins[i]); |
1018 |
+ } |
1019 |
+ |
1020 |
+ enum ftrace_bug_type ftrace_bug_type; |
1021 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
1022 |
+index 55b7b4cf0080d..cdf614943aa3d 100644 |
1023 |
+--- a/kernel/trace/trace.c |
1024 |
++++ b/kernel/trace/trace.c |
1025 |
+@@ -2083,7 +2083,7 @@ trace_event_buffer_lock_reserve(struct ring_buffer **current_rb, |
1026 |
+ (entry = this_cpu_read(trace_buffered_event))) { |
1027 |
+ /* Try to use the per cpu buffer first */ |
1028 |
+ val = this_cpu_inc_return(trace_buffered_event_cnt); |
1029 |
+- if ((len < (PAGE_SIZE - sizeof(*entry))) && val == 1) { |
1030 |
++ if ((len < (PAGE_SIZE - sizeof(*entry) - sizeof(entry->array[0]))) && val == 1) { |
1031 |
+ trace_event_setup(entry, type, flags, pc); |
1032 |
+ entry->array[0] = len; |
1033 |
+ return entry; |
1034 |
+diff --git a/kernel/workqueue.c b/kernel/workqueue.c |
1035 |
+index 3231088afd73d..a410d5827a73f 100644 |
1036 |
+--- a/kernel/workqueue.c |
1037 |
++++ b/kernel/workqueue.c |
1038 |
+@@ -49,6 +49,7 @@ |
1039 |
+ #include <linux/moduleparam.h> |
1040 |
+ #include <linux/uaccess.h> |
1041 |
+ #include <linux/nmi.h> |
1042 |
++#include <linux/kvm_para.h> |
1043 |
+ |
1044 |
+ #include "workqueue_internal.h" |
1045 |
+ |
1046 |
+@@ -5387,6 +5388,7 @@ static void wq_watchdog_timer_fn(unsigned long data) |
1047 |
+ { |
1048 |
+ unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ; |
1049 |
+ bool lockup_detected = false; |
1050 |
++ unsigned long now = jiffies; |
1051 |
+ struct worker_pool *pool; |
1052 |
+ int pi; |
1053 |
+ |
1054 |
+@@ -5401,6 +5403,12 @@ static void wq_watchdog_timer_fn(unsigned long data) |
1055 |
+ if (list_empty(&pool->worklist)) |
1056 |
+ continue; |
1057 |
+ |
1058 |
++ /* |
1059 |
++ * If a virtual machine is stopped by the host it can look to |
1060 |
++ * the watchdog like a stall. |
1061 |
++ */ |
1062 |
++ kvm_check_and_clear_guest_paused(); |
1063 |
++ |
1064 |
+ /* get the latest of pool and touched timestamps */ |
1065 |
+ pool_ts = READ_ONCE(pool->watchdog_ts); |
1066 |
+ touched = READ_ONCE(wq_watchdog_touched); |
1067 |
+@@ -5419,12 +5427,12 @@ static void wq_watchdog_timer_fn(unsigned long data) |
1068 |
+ } |
1069 |
+ |
1070 |
+ /* did we stall? */ |
1071 |
+- if (time_after(jiffies, ts + thresh)) { |
1072 |
++ if (time_after(now, ts + thresh)) { |
1073 |
+ lockup_detected = true; |
1074 |
+ pr_emerg("BUG: workqueue lockup - pool"); |
1075 |
+ pr_cont_pool_info(pool); |
1076 |
+ pr_cont(" stuck for %us!\n", |
1077 |
+- jiffies_to_msecs(jiffies - pool_ts) / 1000); |
1078 |
++ jiffies_to_msecs(now - pool_ts) / 1000); |
1079 |
+ } |
1080 |
+ } |
1081 |
+ |
1082 |
+diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c |
1083 |
+index 205865292ba34..541410f1c3b74 100644 |
1084 |
+--- a/net/netlink/af_netlink.c |
1085 |
++++ b/net/netlink/af_netlink.c |
1086 |
+@@ -436,11 +436,13 @@ void netlink_table_ungrab(void) |
1087 |
+ static inline void |
1088 |
+ netlink_lock_table(void) |
1089 |
+ { |
1090 |
++ unsigned long flags; |
1091 |
++ |
1092 |
+ /* read_lock() synchronizes us to netlink_table_grab */ |
1093 |
+ |
1094 |
+- read_lock(&nl_table_lock); |
1095 |
++ read_lock_irqsave(&nl_table_lock, flags); |
1096 |
+ atomic_inc(&nl_table_users); |
1097 |
+- read_unlock(&nl_table_lock); |
1098 |
++ read_unlock_irqrestore(&nl_table_lock, flags); |
1099 |
+ } |
1100 |
+ |
1101 |
+ static inline void |
1102 |
+diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c |
1103 |
+index 92a3cfae4de87..2fba626a01253 100644 |
1104 |
+--- a/net/nfc/rawsock.c |
1105 |
++++ b/net/nfc/rawsock.c |
1106 |
+@@ -345,7 +345,7 @@ static int rawsock_create(struct net *net, struct socket *sock, |
1107 |
+ return -ESOCKTNOSUPPORT; |
1108 |
+ |
1109 |
+ if (sock->type == SOCK_RAW) { |
1110 |
+- if (!capable(CAP_NET_RAW)) |
1111 |
++ if (!ns_capable(net->user_ns, CAP_NET_RAW)) |
1112 |
+ return -EPERM; |
1113 |
+ sock->ops = &rawsock_raw_ops; |
1114 |
+ } else { |
1115 |
+diff --git a/sound/soc/codecs/sti-sas.c b/sound/soc/codecs/sti-sas.c |
1116 |
+index d6e00c77edcd7..7cf76661c3cc9 100644 |
1117 |
+--- a/sound/soc/codecs/sti-sas.c |
1118 |
++++ b/sound/soc/codecs/sti-sas.c |
1119 |
+@@ -542,6 +542,7 @@ static const struct of_device_id sti_sas_dev_match[] = { |
1120 |
+ }, |
1121 |
+ {}, |
1122 |
+ }; |
1123 |
++MODULE_DEVICE_TABLE(of, sti_sas_dev_match); |
1124 |
+ |
1125 |
+ static int sti_sas_driver_probe(struct platform_device *pdev) |
1126 |
+ { |
1127 |
+diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c |
1128 |
+index 89808ab008ad2..9187d8119a75c 100644 |
1129 |
+--- a/tools/perf/util/session.c |
1130 |
++++ b/tools/perf/util/session.c |
1131 |
+@@ -1427,6 +1427,7 @@ int perf_session__peek_event(struct perf_session *session, off_t file_offset, |
1132 |
+ if (event->header.size < hdr_sz || event->header.size > buf_sz) |
1133 |
+ return -1; |
1134 |
+ |
1135 |
++ buf += hdr_sz; |
1136 |
+ rest = event->header.size - hdr_sz; |
1137 |
+ |
1138 |
+ if (readn(fd, buf, rest) != (ssize_t)rest) |