1 |
commit: 18edaadd120cb4beedb86702060d00c4d91a8d73 |
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 11:07:32 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=18edaadd |
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 | 806 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 810 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..e5a8812 |
35 |
--- /dev/null |
36 |
+++ b/1272_linux-4.9.273.patch |
37 |
@@ -0,0 +1,806 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 426b4c2bf0e72..78a317e69e7fa 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,6 +1,6 @@ |
43 |
+ VERSION = 4 |
44 |
+ PATCHLEVEL = 4 |
45 |
+-SUBLEVEL = 272 |
46 |
++SUBLEVEL = 273 |
47 |
+ EXTRAVERSION = |
48 |
+ NAME = Blurry Fish Butt |
49 |
+ |
50 |
+diff --git a/arch/mips/lib/mips-atomic.c b/arch/mips/lib/mips-atomic.c |
51 |
+index 272af8ac24252..fd50aa7b178a6 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 |
+@@ -62,7 +62,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 |
+@@ -79,7 +79,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 |
+@@ -89,7 +89,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 |
+@@ -107,7 +107,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/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c |
157 |
+index 48ecffecc0eda..2e083a71c2215 100644 |
158 |
+--- a/drivers/i2c/busses/i2c-mpc.c |
159 |
++++ b/drivers/i2c/busses/i2c-mpc.c |
160 |
+@@ -23,6 +23,7 @@ |
161 |
+ |
162 |
+ #include <linux/clk.h> |
163 |
+ #include <linux/io.h> |
164 |
++#include <linux/iopoll.h> |
165 |
+ #include <linux/fsl_devices.h> |
166 |
+ #include <linux/i2c.h> |
167 |
+ #include <linux/interrupt.h> |
168 |
+@@ -49,6 +50,7 @@ |
169 |
+ #define CCR_MTX 0x10 |
170 |
+ #define CCR_TXAK 0x08 |
171 |
+ #define CCR_RSTA 0x04 |
172 |
++#define CCR_RSVD 0x02 |
173 |
+ |
174 |
+ #define CSR_MCF 0x80 |
175 |
+ #define CSR_MAAS 0x40 |
176 |
+@@ -70,6 +72,7 @@ struct mpc_i2c { |
177 |
+ u8 fdr, dfsrr; |
178 |
+ #endif |
179 |
+ struct clk *clk_per; |
180 |
++ bool has_errata_A004447; |
181 |
+ }; |
182 |
+ |
183 |
+ struct mpc_i2c_divider { |
184 |
+@@ -178,6 +181,75 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) |
185 |
+ return 0; |
186 |
+ } |
187 |
+ |
188 |
++static int i2c_mpc_wait_sr(struct mpc_i2c *i2c, int mask) |
189 |
++{ |
190 |
++ void __iomem *addr = i2c->base + MPC_I2C_SR; |
191 |
++ u8 val; |
192 |
++ |
193 |
++ return readb_poll_timeout(addr, val, val & mask, 0, 100); |
194 |
++} |
195 |
++ |
196 |
++/* |
197 |
++ * Workaround for Erratum A004447. From the P2040CE Rev Q |
198 |
++ * |
199 |
++ * 1. Set up the frequency divider and sampling rate. |
200 |
++ * 2. I2CCR - a0h |
201 |
++ * 3. Poll for I2CSR[MBB] to get set. |
202 |
++ * 4. If I2CSR[MAL] is set (an indication that SDA is stuck low), then go to |
203 |
++ * step 5. If MAL is not set, then go to step 13. |
204 |
++ * 5. I2CCR - 00h |
205 |
++ * 6. I2CCR - 22h |
206 |
++ * 7. I2CCR - a2h |
207 |
++ * 8. Poll for I2CSR[MBB] to get set. |
208 |
++ * 9. Issue read to I2CDR. |
209 |
++ * 10. Poll for I2CSR[MIF] to be set. |
210 |
++ * 11. I2CCR - 82h |
211 |
++ * 12. Workaround complete. Skip the next steps. |
212 |
++ * 13. Issue read to I2CDR. |
213 |
++ * 14. Poll for I2CSR[MIF] to be set. |
214 |
++ * 15. I2CCR - 80h |
215 |
++ */ |
216 |
++static void mpc_i2c_fixup_A004447(struct mpc_i2c *i2c) |
217 |
++{ |
218 |
++ int ret; |
219 |
++ u32 val; |
220 |
++ |
221 |
++ writeccr(i2c, CCR_MEN | CCR_MSTA); |
222 |
++ ret = i2c_mpc_wait_sr(i2c, CSR_MBB); |
223 |
++ if (ret) { |
224 |
++ dev_err(i2c->dev, "timeout waiting for CSR_MBB\n"); |
225 |
++ return; |
226 |
++ } |
227 |
++ |
228 |
++ val = readb(i2c->base + MPC_I2C_SR); |
229 |
++ |
230 |
++ if (val & CSR_MAL) { |
231 |
++ writeccr(i2c, 0x00); |
232 |
++ writeccr(i2c, CCR_MSTA | CCR_RSVD); |
233 |
++ writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSVD); |
234 |
++ ret = i2c_mpc_wait_sr(i2c, CSR_MBB); |
235 |
++ if (ret) { |
236 |
++ dev_err(i2c->dev, "timeout waiting for CSR_MBB\n"); |
237 |
++ return; |
238 |
++ } |
239 |
++ val = readb(i2c->base + MPC_I2C_DR); |
240 |
++ ret = i2c_mpc_wait_sr(i2c, CSR_MIF); |
241 |
++ if (ret) { |
242 |
++ dev_err(i2c->dev, "timeout waiting for CSR_MIF\n"); |
243 |
++ return; |
244 |
++ } |
245 |
++ writeccr(i2c, CCR_MEN | CCR_RSVD); |
246 |
++ } else { |
247 |
++ val = readb(i2c->base + MPC_I2C_DR); |
248 |
++ ret = i2c_mpc_wait_sr(i2c, CSR_MIF); |
249 |
++ if (ret) { |
250 |
++ dev_err(i2c->dev, "timeout waiting for CSR_MIF\n"); |
251 |
++ return; |
252 |
++ } |
253 |
++ writeccr(i2c, CCR_MEN); |
254 |
++ } |
255 |
++} |
256 |
++ |
257 |
+ #if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x) |
258 |
+ static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = { |
259 |
+ {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23}, |
260 |
+@@ -581,7 +653,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) |
261 |
+ if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) { |
262 |
+ writeb(status & ~CSR_MAL, |
263 |
+ i2c->base + MPC_I2C_SR); |
264 |
+- mpc_i2c_fixup(i2c); |
265 |
++ i2c_recover_bus(&i2c->adap); |
266 |
+ } |
267 |
+ return -EIO; |
268 |
+ } |
269 |
+@@ -617,7 +689,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) |
270 |
+ if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) { |
271 |
+ writeb(status & ~CSR_MAL, |
272 |
+ i2c->base + MPC_I2C_SR); |
273 |
+- mpc_i2c_fixup(i2c); |
274 |
++ i2c_recover_bus(&i2c->adap); |
275 |
+ } |
276 |
+ return -EIO; |
277 |
+ } |
278 |
+@@ -632,6 +704,18 @@ static u32 mpc_functionality(struct i2c_adapter *adap) |
279 |
+ | I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_PROC_CALL; |
280 |
+ } |
281 |
+ |
282 |
++static int fsl_i2c_bus_recovery(struct i2c_adapter *adap) |
283 |
++{ |
284 |
++ struct mpc_i2c *i2c = i2c_get_adapdata(adap); |
285 |
++ |
286 |
++ if (i2c->has_errata_A004447) |
287 |
++ mpc_i2c_fixup_A004447(i2c); |
288 |
++ else |
289 |
++ mpc_i2c_fixup(i2c); |
290 |
++ |
291 |
++ return 0; |
292 |
++} |
293 |
++ |
294 |
+ static const struct i2c_algorithm mpc_algo = { |
295 |
+ .master_xfer = mpc_xfer, |
296 |
+ .functionality = mpc_functionality, |
297 |
+@@ -643,6 +727,10 @@ static struct i2c_adapter mpc_ops = { |
298 |
+ .timeout = HZ, |
299 |
+ }; |
300 |
+ |
301 |
++static struct i2c_bus_recovery_info fsl_i2c_recovery_info = { |
302 |
++ .recover_bus = fsl_i2c_bus_recovery, |
303 |
++}; |
304 |
++ |
305 |
+ static const struct of_device_id mpc_i2c_of_match[]; |
306 |
+ static int fsl_i2c_probe(struct platform_device *op) |
307 |
+ { |
308 |
+@@ -727,6 +815,8 @@ static int fsl_i2c_probe(struct platform_device *op) |
309 |
+ dev_info(i2c->dev, "timeout %u us\n", mpc_ops.timeout * 1000000 / HZ); |
310 |
+ |
311 |
+ platform_set_drvdata(op, i2c); |
312 |
++ if (of_property_read_bool(op->dev.of_node, "fsl,i2c-erratum-a004447")) |
313 |
++ i2c->has_errata_A004447 = true; |
314 |
+ |
315 |
+ i2c->adap = mpc_ops; |
316 |
+ of_address_to_resource(op->dev.of_node, 0, &res); |
317 |
+@@ -735,6 +825,7 @@ static int fsl_i2c_probe(struct platform_device *op) |
318 |
+ i2c_set_adapdata(&i2c->adap, i2c); |
319 |
+ i2c->adap.dev.parent = &op->dev; |
320 |
+ i2c->adap.dev.of_node = of_node_get(op->dev.of_node); |
321 |
++ i2c->adap.bus_recovery_info = &fsl_i2c_recovery_info; |
322 |
+ |
323 |
+ result = i2c_add_adapter(&i2c->adap); |
324 |
+ if (result < 0) { |
325 |
+diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c |
326 |
+index 8e2944784e000..59eec2014b82c 100644 |
327 |
+--- a/drivers/isdn/hardware/mISDN/netjet.c |
328 |
++++ b/drivers/isdn/hardware/mISDN/netjet.c |
329 |
+@@ -1114,7 +1114,6 @@ nj_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
330 |
+ card->typ = NETJET_S_TJ300; |
331 |
+ |
332 |
+ card->base = pci_resource_start(pdev, 0); |
333 |
+- card->irq = pdev->irq; |
334 |
+ pci_set_drvdata(pdev, card); |
335 |
+ err = setup_instance(card); |
336 |
+ if (err) |
337 |
+diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c |
338 |
+index 7f2a032c354c2..841a5de58c7c8 100644 |
339 |
+--- a/drivers/net/appletalk/cops.c |
340 |
++++ b/drivers/net/appletalk/cops.c |
341 |
+@@ -324,6 +324,8 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr) |
342 |
+ break; |
343 |
+ } |
344 |
+ |
345 |
++ dev->base_addr = ioaddr; |
346 |
++ |
347 |
+ /* Reserve any actual interrupt. */ |
348 |
+ if (dev->irq) { |
349 |
+ retval = request_irq(dev->irq, cops_interrupt, 0, dev->name, dev); |
350 |
+@@ -331,8 +333,6 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr) |
351 |
+ goto err_out; |
352 |
+ } |
353 |
+ |
354 |
+- dev->base_addr = ioaddr; |
355 |
+- |
356 |
+ lp = netdev_priv(dev); |
357 |
+ spin_lock_init(&lp->lock); |
358 |
+ |
359 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
360 |
+index a33e8a3b5f0a0..d6363ae220526 100644 |
361 |
+--- a/drivers/net/bonding/bond_main.c |
362 |
++++ b/drivers/net/bonding/bond_main.c |
363 |
+@@ -1267,6 +1267,7 @@ static struct slave *bond_alloc_slave(struct bonding *bond, |
364 |
+ |
365 |
+ slave->bond = bond; |
366 |
+ slave->dev = slave_dev; |
367 |
++ INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); |
368 |
+ |
369 |
+ if (bond_kobj_init(slave)) |
370 |
+ return NULL; |
371 |
+@@ -1279,7 +1280,6 @@ static struct slave *bond_alloc_slave(struct bonding *bond, |
372 |
+ return NULL; |
373 |
+ } |
374 |
+ } |
375 |
+- INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); |
376 |
+ |
377 |
+ return slave; |
378 |
+ } |
379 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
380 |
+index 55a7774e8ef5c..92c965cb36330 100644 |
381 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
382 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
383 |
+@@ -1245,8 +1245,10 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, |
384 |
+ goto failed; |
385 |
+ |
386 |
+ /* SR-IOV capability was enabled but there are no VFs*/ |
387 |
+- if (iov->total == 0) |
388 |
++ if (iov->total == 0) { |
389 |
++ err = -EINVAL; |
390 |
+ goto failed; |
391 |
++ } |
392 |
+ |
393 |
+ iov->nr_virtfn = min_t(u16, iov->total, num_vfs_param); |
394 |
+ |
395 |
+diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c |
396 |
+index 78803e7de360a..d1cdb8540e12f 100644 |
397 |
+--- a/drivers/net/ethernet/cadence/macb.c |
398 |
++++ b/drivers/net/ethernet/cadence/macb.c |
399 |
+@@ -1955,6 +1955,9 @@ static struct net_device_stats *gem_get_stats(struct macb *bp) |
400 |
+ struct gem_stats *hwstat = &bp->hw_stats.gem; |
401 |
+ struct net_device_stats *nstat = &bp->stats; |
402 |
+ |
403 |
++ if (!netif_running(bp->dev)) |
404 |
++ return nstat; |
405 |
++ |
406 |
+ gem_update_stats(bp); |
407 |
+ |
408 |
+ nstat->rx_errors = (hwstat->rx_frame_check_sequence_errors + |
409 |
+diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c |
410 |
+index f2cb77c3b1992..192950a112c93 100644 |
411 |
+--- a/drivers/net/ethernet/qlogic/qla3xxx.c |
412 |
++++ b/drivers/net/ethernet/qlogic/qla3xxx.c |
413 |
+@@ -115,7 +115,7 @@ static int ql_sem_spinlock(struct ql3_adapter *qdev, |
414 |
+ value = readl(&port_regs->CommonRegs.semaphoreReg); |
415 |
+ if ((value & (sem_mask >> 16)) == sem_bits) |
416 |
+ return 0; |
417 |
+- ssleep(1); |
418 |
++ mdelay(1000); |
419 |
+ } while (--seconds); |
420 |
+ return -1; |
421 |
+ } |
422 |
+diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c |
423 |
+index ccefba7af9605..5ea86fd57ae6c 100644 |
424 |
+--- a/drivers/net/phy/mdio_bus.c |
425 |
++++ b/drivers/net/phy/mdio_bus.c |
426 |
+@@ -308,7 +308,8 @@ void mdiobus_unregister(struct mii_bus *bus) |
427 |
+ { |
428 |
+ int i; |
429 |
+ |
430 |
+- BUG_ON(bus->state != MDIOBUS_REGISTERED); |
431 |
++ if (WARN_ON_ONCE(bus->state != MDIOBUS_REGISTERED)) |
432 |
++ return; |
433 |
+ bus->state = MDIOBUS_UNREGISTERED; |
434 |
+ |
435 |
+ for (i = 0; i < PHY_MAX_ADDR; i++) { |
436 |
+diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c |
437 |
+index 82ac1cd818ac1..fb4b6034f6444 100644 |
438 |
+--- a/drivers/scsi/hosts.c |
439 |
++++ b/drivers/scsi/hosts.c |
440 |
+@@ -355,7 +355,7 @@ static void scsi_host_dev_release(struct device *dev) |
441 |
+ |
442 |
+ kfree(shost->shost_data); |
443 |
+ |
444 |
+- if (parent) |
445 |
++ if (shost->shost_state != SHOST_CREATED) |
446 |
+ put_device(parent); |
447 |
+ kfree(shost); |
448 |
+ } |
449 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
450 |
+index 1d9f19e5e0f81..0a8a5841e1b89 100644 |
451 |
+--- a/drivers/scsi/qla2xxx/qla_target.c |
452 |
++++ b/drivers/scsi/qla2xxx/qla_target.c |
453 |
+@@ -1042,6 +1042,7 @@ void qlt_stop_phase2(struct qla_tgt *tgt) |
454 |
+ "Waiting for %d IRQ commands to complete (tgt %p)", |
455 |
+ tgt->irq_cmd_count, tgt); |
456 |
+ |
457 |
++ mutex_lock(&tgt->ha->optrom_mutex); |
458 |
+ mutex_lock(&vha->vha_tgt.tgt_mutex); |
459 |
+ spin_lock_irqsave(&ha->hardware_lock, flags); |
460 |
+ while (tgt->irq_cmd_count != 0) { |
461 |
+@@ -1053,6 +1054,7 @@ void qlt_stop_phase2(struct qla_tgt *tgt) |
462 |
+ tgt->tgt_stopped = 1; |
463 |
+ spin_unlock_irqrestore(&ha->hardware_lock, flags); |
464 |
+ mutex_unlock(&vha->vha_tgt.tgt_mutex); |
465 |
++ mutex_unlock(&tgt->ha->optrom_mutex); |
466 |
+ |
467 |
+ ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00c, "Stop of tgt %p finished", |
468 |
+ tgt); |
469 |
+diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c |
470 |
+index 3f2a5d6c437b8..d25cf084afe74 100644 |
471 |
+--- a/drivers/scsi/vmw_pvscsi.c |
472 |
++++ b/drivers/scsi/vmw_pvscsi.c |
473 |
+@@ -558,7 +558,13 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter, |
474 |
+ case BTSTAT_SUCCESS: |
475 |
+ case BTSTAT_LINKED_COMMAND_COMPLETED: |
476 |
+ case BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG: |
477 |
+- /* If everything went fine, let's move on.. */ |
478 |
++ /* |
479 |
++ * Commands like INQUIRY may transfer less data than |
480 |
++ * requested by the initiator via bufflen. Set residual |
481 |
++ * count to make upper layer aware of the actual amount |
482 |
++ * of data returned. |
483 |
++ */ |
484 |
++ scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen); |
485 |
+ cmd->result = (DID_OK << 16); |
486 |
+ break; |
487 |
+ |
488 |
+diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c |
489 |
+index f13e9e9fb834a..ca631fea59e06 100644 |
490 |
+--- a/drivers/usb/dwc3/ep0.c |
491 |
++++ b/drivers/usb/dwc3/ep0.c |
492 |
+@@ -331,6 +331,9 @@ static struct dwc3_ep *dwc3_wIndex_to_dep(struct dwc3 *dwc, __le16 wIndex_le) |
493 |
+ epnum |= 1; |
494 |
+ |
495 |
+ dep = dwc->eps[epnum]; |
496 |
++ if (dep == NULL) |
497 |
++ return NULL; |
498 |
++ |
499 |
+ if (dep->flags & DWC3_EP_ENABLED) |
500 |
+ return dep; |
501 |
+ |
502 |
+diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c |
503 |
+index cad35a502d3f7..9411c5f953da8 100644 |
504 |
+--- a/drivers/usb/gadget/function/f_eem.c |
505 |
++++ b/drivers/usb/gadget/function/f_eem.c |
506 |
+@@ -498,7 +498,7 @@ static int eem_unwrap(struct gether *port, |
507 |
+ skb2 = skb_clone(skb, GFP_ATOMIC); |
508 |
+ if (unlikely(!skb2)) { |
509 |
+ DBG(cdev, "unable to unframe EEM packet\n"); |
510 |
+- continue; |
511 |
++ goto next; |
512 |
+ } |
513 |
+ skb_trim(skb2, len - ETH_FCS_LEN); |
514 |
+ |
515 |
+@@ -509,7 +509,7 @@ static int eem_unwrap(struct gether *port, |
516 |
+ if (unlikely(!skb3)) { |
517 |
+ DBG(cdev, "unable to realign EEM packet\n"); |
518 |
+ dev_kfree_skb_any(skb2); |
519 |
+- continue; |
520 |
++ goto next; |
521 |
+ } |
522 |
+ dev_kfree_skb_any(skb2); |
523 |
+ skb_queue_tail(list, skb3); |
524 |
+diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c |
525 |
+index 16908737bff1c..93086efef5a89 100644 |
526 |
+--- a/drivers/usb/gadget/function/f_ncm.c |
527 |
++++ b/drivers/usb/gadget/function/f_ncm.c |
528 |
+@@ -514,7 +514,7 @@ static void ncm_do_notify(struct f_ncm *ncm) |
529 |
+ data[0] = cpu_to_le32(ncm_bitrate(cdev->gadget)); |
530 |
+ data[1] = data[0]; |
531 |
+ |
532 |
+- DBG(cdev, "notify speed %d\n", ncm_bitrate(cdev->gadget)); |
533 |
++ DBG(cdev, "notify speed %u\n", ncm_bitrate(cdev->gadget)); |
534 |
+ ncm->notify_state = NCM_NOTIFY_CONNECT; |
535 |
+ break; |
536 |
+ } |
537 |
+diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
538 |
+index 3d02399ad49ec..f8b8bdc0dc6fb 100644 |
539 |
+--- a/drivers/usb/serial/ftdi_sio.c |
540 |
++++ b/drivers/usb/serial/ftdi_sio.c |
541 |
+@@ -606,6 +606,7 @@ static const struct usb_device_id id_table_combined[] = { |
542 |
+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
543 |
+ { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLX_PLUS_PID) }, |
544 |
+ { USB_DEVICE(FTDI_VID, FTDI_NT_ORION_IO_PID) }, |
545 |
++ { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONMX_PID) }, |
546 |
+ { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) }, |
547 |
+ { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) }, |
548 |
+ { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) }, |
549 |
+diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
550 |
+index b5f28a7952282..54ded2bc9eb6c 100644 |
551 |
+--- a/drivers/usb/serial/ftdi_sio_ids.h |
552 |
++++ b/drivers/usb/serial/ftdi_sio_ids.h |
553 |
+@@ -580,6 +580,7 @@ |
554 |
+ #define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */ |
555 |
+ #define FTDI_NT_ORIONLX_PLUS_PID 0x7c91 /* OrionLX+ Substation Automation Platform */ |
556 |
+ #define FTDI_NT_ORION_IO_PID 0x7c92 /* Orion I/O */ |
557 |
++#define FTDI_NT_ORIONMX_PID 0x7c93 /* OrionMX */ |
558 |
+ |
559 |
+ /* |
560 |
+ * Synapse Wireless product ids (FTDI_VID) |
561 |
+diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c |
562 |
+index 76564b3bebb9b..cc0bf59bd08db 100644 |
563 |
+--- a/drivers/usb/serial/omninet.c |
564 |
++++ b/drivers/usb/serial/omninet.c |
565 |
+@@ -27,6 +27,7 @@ |
566 |
+ |
567 |
+ #define ZYXEL_VENDOR_ID 0x0586 |
568 |
+ #define ZYXEL_OMNINET_ID 0x1000 |
569 |
++#define ZYXEL_OMNI_56K_PLUS_ID 0x1500 |
570 |
+ /* This one seems to be a re-branded ZyXEL device */ |
571 |
+ #define BT_IGNITIONPRO_ID 0x2000 |
572 |
+ |
573 |
+@@ -44,6 +45,7 @@ static int omninet_port_remove(struct usb_serial_port *port); |
574 |
+ |
575 |
+ static const struct usb_device_id id_table[] = { |
576 |
+ { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) }, |
577 |
++ { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNI_56K_PLUS_ID) }, |
578 |
+ { USB_DEVICE(ZYXEL_VENDOR_ID, BT_IGNITIONPRO_ID) }, |
579 |
+ { } /* Terminating entry */ |
580 |
+ }; |
581 |
+diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c |
582 |
+index 82f28192694f4..e548a6094d224 100644 |
583 |
+--- a/drivers/usb/serial/quatech2.c |
584 |
++++ b/drivers/usb/serial/quatech2.c |
585 |
+@@ -419,7 +419,7 @@ static void qt2_close(struct usb_serial_port *port) |
586 |
+ |
587 |
+ /* flush the port transmit buffer */ |
588 |
+ i = usb_control_msg(serial->dev, |
589 |
+- usb_rcvctrlpipe(serial->dev, 0), |
590 |
++ usb_sndctrlpipe(serial->dev, 0), |
591 |
+ QT2_FLUSH_DEVICE, 0x40, 1, |
592 |
+ port_priv->device_port, NULL, 0, QT2_USB_TIMEOUT); |
593 |
+ |
594 |
+@@ -429,7 +429,7 @@ static void qt2_close(struct usb_serial_port *port) |
595 |
+ |
596 |
+ /* flush the port receive buffer */ |
597 |
+ i = usb_control_msg(serial->dev, |
598 |
+- usb_rcvctrlpipe(serial->dev, 0), |
599 |
++ usb_sndctrlpipe(serial->dev, 0), |
600 |
+ QT2_FLUSH_DEVICE, 0x40, 0, |
601 |
+ port_priv->device_port, NULL, 0, QT2_USB_TIMEOUT); |
602 |
+ |
603 |
+@@ -701,7 +701,7 @@ static int qt2_attach(struct usb_serial *serial) |
604 |
+ int status; |
605 |
+ |
606 |
+ /* power on unit */ |
607 |
+- status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
608 |
++ status = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
609 |
+ 0xc2, 0x40, 0x8000, 0, NULL, 0, |
610 |
+ QT2_USB_TIMEOUT); |
611 |
+ if (status < 0) { |
612 |
+diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
613 |
+index 73b547f88bfca..2426dc56426fb 100644 |
614 |
+--- a/fs/btrfs/file.c |
615 |
++++ b/fs/btrfs/file.c |
616 |
+@@ -1089,7 +1089,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, |
617 |
+ int del_nr = 0; |
618 |
+ int del_slot = 0; |
619 |
+ int recow; |
620 |
+- int ret; |
621 |
++ int ret = 0; |
622 |
+ u64 ino = btrfs_ino(inode); |
623 |
+ |
624 |
+ path = btrfs_alloc_path(); |
625 |
+@@ -1284,7 +1284,7 @@ again: |
626 |
+ } |
627 |
+ out: |
628 |
+ btrfs_free_path(path); |
629 |
+- return 0; |
630 |
++ return ret; |
631 |
+ } |
632 |
+ |
633 |
+ /* |
634 |
+diff --git a/fs/nfs/client.c b/fs/nfs/client.c |
635 |
+index d6d5d2a48e838..ba2cd0bd3894f 100644 |
636 |
+--- a/fs/nfs/client.c |
637 |
++++ b/fs/nfs/client.c |
638 |
+@@ -377,7 +377,7 @@ nfs_get_client(const struct nfs_client_initdata *cl_init, |
639 |
+ |
640 |
+ if (cl_init->hostname == NULL) { |
641 |
+ WARN_ON(1); |
642 |
+- return NULL; |
643 |
++ return ERR_PTR(-EINVAL); |
644 |
+ } |
645 |
+ |
646 |
+ dprintk("--> nfs_get_client(%s,v%u)\n", |
647 |
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
648 |
+index 92ca753723b5e..e10bada12361b 100644 |
649 |
+--- a/fs/nfs/nfs4proc.c |
650 |
++++ b/fs/nfs/nfs4proc.c |
651 |
+@@ -4887,6 +4887,14 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen |
652 |
+ do { |
653 |
+ err = __nfs4_proc_set_acl(inode, buf, buflen); |
654 |
+ trace_nfs4_set_acl(inode, err); |
655 |
++ if (err == -NFS4ERR_BADOWNER || err == -NFS4ERR_BADNAME) { |
656 |
++ /* |
657 |
++ * no need to retry since the kernel |
658 |
++ * isn't involved in encoding the ACEs. |
659 |
++ */ |
660 |
++ err = -EINVAL; |
661 |
++ break; |
662 |
++ } |
663 |
+ err = nfs4_handle_exception(NFS_SERVER(inode), err, |
664 |
+ &exception); |
665 |
+ } while (exception.retry); |
666 |
+diff --git a/fs/proc/base.c b/fs/proc/base.c |
667 |
+index 2166f24af37e4..b1ff8eb618021 100644 |
668 |
+--- a/fs/proc/base.c |
669 |
++++ b/fs/proc/base.c |
670 |
+@@ -2384,6 +2384,13 @@ out: |
671 |
+ } |
672 |
+ |
673 |
+ #ifdef CONFIG_SECURITY |
674 |
++static int proc_pid_attr_open(struct inode *inode, struct file *file) |
675 |
++{ |
676 |
++ file->private_data = NULL; |
677 |
++ __mem_open(inode, file, PTRACE_MODE_READ_FSCREDS); |
678 |
++ return 0; |
679 |
++} |
680 |
++ |
681 |
+ static ssize_t proc_pid_attr_read(struct file * file, char __user * buf, |
682 |
+ size_t count, loff_t *ppos) |
683 |
+ { |
684 |
+@@ -2414,7 +2421,7 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, |
685 |
+ struct task_struct *task = get_proc_task(inode); |
686 |
+ |
687 |
+ /* A task may only write when it was the opener. */ |
688 |
+- if (file->f_cred != current_real_cred()) |
689 |
++ if (file->private_data != current->mm) |
690 |
+ return -EPERM; |
691 |
+ |
692 |
+ length = -ESRCH; |
693 |
+@@ -2455,9 +2462,11 @@ out_no_task: |
694 |
+ } |
695 |
+ |
696 |
+ static const struct file_operations proc_pid_attr_operations = { |
697 |
++ .open = proc_pid_attr_open, |
698 |
+ .read = proc_pid_attr_read, |
699 |
+ .write = proc_pid_attr_write, |
700 |
+ .llseek = generic_file_llseek, |
701 |
++ .release = mem_release, |
702 |
+ }; |
703 |
+ |
704 |
+ static const struct pid_entry attr_dir_stuff[] = { |
705 |
+diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h |
706 |
+index 19291f86d16c1..1e62865821d99 100644 |
707 |
+--- a/include/linux/kvm_host.h |
708 |
++++ b/include/linux/kvm_host.h |
709 |
+@@ -25,6 +25,7 @@ |
710 |
+ #include <linux/irqflags.h> |
711 |
+ #include <linux/context_tracking.h> |
712 |
+ #include <linux/irqbypass.h> |
713 |
++#include <linux/nospec.h> |
714 |
+ #include <asm/signal.h> |
715 |
+ |
716 |
+ #include <linux/kvm.h> |
717 |
+@@ -952,7 +953,15 @@ __gfn_to_memslot(struct kvm_memslots *slots, gfn_t gfn) |
718 |
+ static inline unsigned long |
719 |
+ __gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn) |
720 |
+ { |
721 |
+- return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE; |
722 |
++ /* |
723 |
++ * The index was checked originally in search_memslots. To avoid |
724 |
++ * that a malicious guest builds a Spectre gadget out of e.g. page |
725 |
++ * table walks, do not let the processor speculate loads outside |
726 |
++ * the guest's registered memslots. |
727 |
++ */ |
728 |
++ unsigned long offset = gfn - slot->base_gfn; |
729 |
++ offset = array_index_nospec(offset, slot->npages); |
730 |
++ return slot->userspace_addr + offset * PAGE_SIZE; |
731 |
+ } |
732 |
+ |
733 |
+ static inline int memslot_id(struct kvm *kvm, gfn_t gfn) |
734 |
+diff --git a/kernel/cgroup.c b/kernel/cgroup.c |
735 |
+index 7a7c535f8a2f8..1f5e7dcbfd405 100644 |
736 |
+--- a/kernel/cgroup.c |
737 |
++++ b/kernel/cgroup.c |
738 |
+@@ -3310,6 +3310,10 @@ static int cgroup_rename(struct kernfs_node *kn, struct kernfs_node *new_parent, |
739 |
+ struct cgroup *cgrp = kn->priv; |
740 |
+ int ret; |
741 |
+ |
742 |
++ /* do not accept '\n' to prevent making /proc/<pid>/cgroup unparsable */ |
743 |
++ if (strchr(new_name_str, '\n')) |
744 |
++ return -EINVAL; |
745 |
++ |
746 |
+ if (kernfs_type(kn) != KERNFS_DIR) |
747 |
+ return -ENOTDIR; |
748 |
+ if (kn->parent != new_parent) |
749 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
750 |
+index d399748ea86b5..ee75563b724fd 100644 |
751 |
+--- a/kernel/events/core.c |
752 |
++++ b/kernel/events/core.c |
753 |
+@@ -3497,7 +3497,9 @@ find_get_context(struct pmu *pmu, struct task_struct *task, |
754 |
+ cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu); |
755 |
+ ctx = &cpuctx->ctx; |
756 |
+ get_ctx(ctx); |
757 |
++ raw_spin_lock_irqsave(&ctx->lock, flags); |
758 |
+ ++ctx->pin_count; |
759 |
++ raw_spin_unlock_irqrestore(&ctx->lock, flags); |
760 |
+ |
761 |
+ return ctx; |
762 |
+ } |
763 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
764 |
+index 93c2abe278715..e591da4449f03 100644 |
765 |
+--- a/kernel/trace/ftrace.c |
766 |
++++ b/kernel/trace/ftrace.c |
767 |
+@@ -1943,12 +1943,18 @@ static int ftrace_hash_ipmodify_update(struct ftrace_ops *ops, |
768 |
+ |
769 |
+ static void print_ip_ins(const char *fmt, unsigned char *p) |
770 |
+ { |
771 |
++ char ins[MCOUNT_INSN_SIZE]; |
772 |
+ int i; |
773 |
+ |
774 |
++ if (probe_kernel_read(ins, p, MCOUNT_INSN_SIZE)) { |
775 |
++ printk(KERN_CONT "%s[FAULT] %px\n", fmt, p); |
776 |
++ return; |
777 |
++ } |
778 |
++ |
779 |
+ printk(KERN_CONT "%s", fmt); |
780 |
+ |
781 |
+ for (i = 0; i < MCOUNT_INSN_SIZE; i++) |
782 |
+- printk(KERN_CONT "%s%02x", i ? ":" : "", p[i]); |
783 |
++ printk(KERN_CONT "%s%02x", i ? ":" : "", ins[i]); |
784 |
+ } |
785 |
+ |
786 |
+ static struct ftrace_ops * |
787 |
+diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c |
788 |
+index cc37a219e11ea..c20c41801845f 100644 |
789 |
+--- a/net/netlink/af_netlink.c |
790 |
++++ b/net/netlink/af_netlink.c |
791 |
+@@ -436,11 +436,13 @@ void netlink_table_ungrab(void) |
792 |
+ static inline void |
793 |
+ netlink_lock_table(void) |
794 |
+ { |
795 |
++ unsigned long flags; |
796 |
++ |
797 |
+ /* read_lock() synchronizes us to netlink_table_grab */ |
798 |
+ |
799 |
+- read_lock(&nl_table_lock); |
800 |
++ read_lock_irqsave(&nl_table_lock, flags); |
801 |
+ atomic_inc(&nl_table_users); |
802 |
+- read_unlock(&nl_table_lock); |
803 |
++ read_unlock_irqrestore(&nl_table_lock, flags); |
804 |
+ } |
805 |
+ |
806 |
+ static inline void |
807 |
+diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c |
808 |
+index 92a3cfae4de87..2fba626a01253 100644 |
809 |
+--- a/net/nfc/rawsock.c |
810 |
++++ b/net/nfc/rawsock.c |
811 |
+@@ -345,7 +345,7 @@ static int rawsock_create(struct net *net, struct socket *sock, |
812 |
+ return -ESOCKTNOSUPPORT; |
813 |
+ |
814 |
+ if (sock->type == SOCK_RAW) { |
815 |
+- if (!capable(CAP_NET_RAW)) |
816 |
++ if (!ns_capable(net->user_ns, CAP_NET_RAW)) |
817 |
+ return -EPERM; |
818 |
+ sock->ops = &rawsock_raw_ops; |
819 |
+ } else { |
820 |
+diff --git a/sound/soc/codecs/sti-sas.c b/sound/soc/codecs/sti-sas.c |
821 |
+index 160d61a66204b..71a1fde5a7ef2 100644 |
822 |
+--- a/sound/soc/codecs/sti-sas.c |
823 |
++++ b/sound/soc/codecs/sti-sas.c |
824 |
+@@ -542,6 +542,7 @@ static const struct of_device_id sti_sas_dev_match[] = { |
825 |
+ }, |
826 |
+ {}, |
827 |
+ }; |
828 |
++MODULE_DEVICE_TABLE(of, sti_sas_dev_match); |
829 |
+ |
830 |
+ static int sti_sas_driver_probe(struct platform_device *pdev) |
831 |
+ { |
832 |
+diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c |
833 |
+index 5b392662d100b..1029225ee4171 100644 |
834 |
+--- a/tools/perf/util/session.c |
835 |
++++ b/tools/perf/util/session.c |
836 |
+@@ -1255,6 +1255,7 @@ int perf_session__peek_event(struct perf_session *session, off_t file_offset, |
837 |
+ if (event->header.size < hdr_sz || event->header.size > buf_sz) |
838 |
+ return -1; |
839 |
+ |
840 |
++ buf += hdr_sz; |
841 |
+ rest = event->header.size - hdr_sz; |
842 |
+ |
843 |
+ if (readn(fd, buf, rest) != (ssize_t)rest) |