Contents of /trunk/kernel-alx/patches-5.4/0225-5.4.126-all-fixes.patch
Parent Directory | Revision Log
Revision 3637 -
(show annotations)
(download)
Mon Oct 24 12:40:44 2022 UTC (23 months ago) by niro
File size: 78892 byte(s)
Mon Oct 24 12:40:44 2022 UTC (23 months ago) by niro
File size: 78892 byte(s)
-add missing
1 | diff --git a/Makefile b/Makefile |
2 | index 43e7b07eea80e..184d9e029130c 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 5 |
8 | PATCHLEVEL = 4 |
9 | -SUBLEVEL = 125 |
10 | +SUBLEVEL = 126 |
11 | EXTRAVERSION = |
12 | NAME = Kleptomaniac Octopus |
13 | |
14 | diff --git a/arch/mips/lib/mips-atomic.c b/arch/mips/lib/mips-atomic.c |
15 | index 5530070e0d05d..57497a26e79cb 100644 |
16 | --- a/arch/mips/lib/mips-atomic.c |
17 | +++ b/arch/mips/lib/mips-atomic.c |
18 | @@ -37,7 +37,7 @@ |
19 | */ |
20 | notrace void arch_local_irq_disable(void) |
21 | { |
22 | - preempt_disable(); |
23 | + preempt_disable_notrace(); |
24 | |
25 | __asm__ __volatile__( |
26 | " .set push \n" |
27 | @@ -53,7 +53,7 @@ notrace void arch_local_irq_disable(void) |
28 | : /* no inputs */ |
29 | : "memory"); |
30 | |
31 | - preempt_enable(); |
32 | + preempt_enable_notrace(); |
33 | } |
34 | EXPORT_SYMBOL(arch_local_irq_disable); |
35 | |
36 | @@ -61,7 +61,7 @@ notrace unsigned long arch_local_irq_save(void) |
37 | { |
38 | unsigned long flags; |
39 | |
40 | - preempt_disable(); |
41 | + preempt_disable_notrace(); |
42 | |
43 | __asm__ __volatile__( |
44 | " .set push \n" |
45 | @@ -78,7 +78,7 @@ notrace unsigned long arch_local_irq_save(void) |
46 | : /* no inputs */ |
47 | : "memory"); |
48 | |
49 | - preempt_enable(); |
50 | + preempt_enable_notrace(); |
51 | |
52 | return flags; |
53 | } |
54 | @@ -88,7 +88,7 @@ notrace void arch_local_irq_restore(unsigned long flags) |
55 | { |
56 | unsigned long __tmp1; |
57 | |
58 | - preempt_disable(); |
59 | + preempt_disable_notrace(); |
60 | |
61 | __asm__ __volatile__( |
62 | " .set push \n" |
63 | @@ -106,7 +106,7 @@ notrace void arch_local_irq_restore(unsigned long flags) |
64 | : "0" (flags) |
65 | : "memory"); |
66 | |
67 | - preempt_enable(); |
68 | + preempt_enable_notrace(); |
69 | } |
70 | EXPORT_SYMBOL(arch_local_irq_restore); |
71 | |
72 | diff --git a/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi |
73 | index 1b4aafc1f6a27..9716a0484ecf0 100644 |
74 | --- a/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi |
75 | +++ b/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi |
76 | @@ -122,7 +122,15 @@ |
77 | }; |
78 | |
79 | /include/ "pq3-i2c-0.dtsi" |
80 | + i2c@3000 { |
81 | + fsl,i2c-erratum-a004447; |
82 | + }; |
83 | + |
84 | /include/ "pq3-i2c-1.dtsi" |
85 | + i2c@3100 { |
86 | + fsl,i2c-erratum-a004447; |
87 | + }; |
88 | + |
89 | /include/ "pq3-duart-0.dtsi" |
90 | /include/ "pq3-espi-0.dtsi" |
91 | spi0: spi@7000 { |
92 | diff --git a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi |
93 | index 872e4485dc3f0..ddc018d42252f 100644 |
94 | --- a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi |
95 | +++ b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi |
96 | @@ -371,7 +371,23 @@ |
97 | }; |
98 | |
99 | /include/ "qoriq-i2c-0.dtsi" |
100 | + i2c@118000 { |
101 | + fsl,i2c-erratum-a004447; |
102 | + }; |
103 | + |
104 | + i2c@118100 { |
105 | + fsl,i2c-erratum-a004447; |
106 | + }; |
107 | + |
108 | /include/ "qoriq-i2c-1.dtsi" |
109 | + i2c@119000 { |
110 | + fsl,i2c-erratum-a004447; |
111 | + }; |
112 | + |
113 | + i2c@119100 { |
114 | + fsl,i2c-erratum-a004447; |
115 | + }; |
116 | + |
117 | /include/ "qoriq-duart-0.dtsi" |
118 | /include/ "qoriq-duart-1.dtsi" |
119 | /include/ "qoriq-gpio-0.dtsi" |
120 | diff --git a/arch/x86/boot/setup.ld b/arch/x86/boot/setup.ld |
121 | index 0149e41d42c27..5fac3de579445 100644 |
122 | --- a/arch/x86/boot/setup.ld |
123 | +++ b/arch/x86/boot/setup.ld |
124 | @@ -20,7 +20,7 @@ SECTIONS |
125 | .initdata : { *(.initdata) } |
126 | __end_init = .; |
127 | |
128 | - .text : { *(.text) } |
129 | + .text : { *(.text .text.*) } |
130 | .text32 : { *(.text32) } |
131 | |
132 | . = ALIGN(16); |
133 | diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h |
134 | index 7c741a0c5f808..5fed9c4d23600 100644 |
135 | --- a/arch/x86/kvm/trace.h |
136 | +++ b/arch/x86/kvm/trace.h |
137 | @@ -1483,16 +1483,16 @@ TRACE_EVENT(kvm_nested_vmenter_failed, |
138 | TP_ARGS(msg, err), |
139 | |
140 | TP_STRUCT__entry( |
141 | - __field(const char *, msg) |
142 | + __string(msg, msg) |
143 | __field(u32, err) |
144 | ), |
145 | |
146 | TP_fast_assign( |
147 | - __entry->msg = msg; |
148 | + __assign_str(msg, msg); |
149 | __entry->err = err; |
150 | ), |
151 | |
152 | - TP_printk("%s%s", __entry->msg, !__entry->err ? "" : |
153 | + TP_printk("%s%s", __get_str(msg), !__entry->err ? "" : |
154 | __print_symbolic(__entry->err, VMX_VMENTER_INSTRUCTION_ERRORS)) |
155 | ); |
156 | |
157 | diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c |
158 | index cc9acd986c68f..4f785a783e01c 100644 |
159 | --- a/drivers/gpu/drm/drm_auth.c |
160 | +++ b/drivers/gpu/drm/drm_auth.c |
161 | @@ -268,9 +268,10 @@ int drm_master_open(struct drm_file *file_priv) |
162 | void drm_master_release(struct drm_file *file_priv) |
163 | { |
164 | struct drm_device *dev = file_priv->minor->dev; |
165 | - struct drm_master *master = file_priv->master; |
166 | + struct drm_master *master; |
167 | |
168 | mutex_lock(&dev->master_mutex); |
169 | + master = file_priv->master; |
170 | if (file_priv->magic) |
171 | idr_remove(&file_priv->master->magic_map, file_priv->magic); |
172 | |
173 | diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c |
174 | index fcd728d7cf722..127f8a5352019 100644 |
175 | --- a/drivers/gpu/drm/drm_ioctl.c |
176 | +++ b/drivers/gpu/drm/drm_ioctl.c |
177 | @@ -118,17 +118,18 @@ int drm_getunique(struct drm_device *dev, void *data, |
178 | struct drm_file *file_priv) |
179 | { |
180 | struct drm_unique *u = data; |
181 | - struct drm_master *master = file_priv->master; |
182 | + struct drm_master *master; |
183 | |
184 | - mutex_lock(&master->dev->master_mutex); |
185 | + mutex_lock(&dev->master_mutex); |
186 | + master = file_priv->master; |
187 | if (u->unique_len >= master->unique_len) { |
188 | if (copy_to_user(u->unique, master->unique, master->unique_len)) { |
189 | - mutex_unlock(&master->dev->master_mutex); |
190 | + mutex_unlock(&dev->master_mutex); |
191 | return -EFAULT; |
192 | } |
193 | } |
194 | u->unique_len = master->unique_len; |
195 | - mutex_unlock(&master->dev->master_mutex); |
196 | + mutex_unlock(&dev->master_mutex); |
197 | |
198 | return 0; |
199 | } |
200 | diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c |
201 | index d94f05c8b8b79..af349661fd769 100644 |
202 | --- a/drivers/i2c/busses/i2c-mpc.c |
203 | +++ b/drivers/i2c/busses/i2c-mpc.c |
204 | @@ -23,6 +23,7 @@ |
205 | |
206 | #include <linux/clk.h> |
207 | #include <linux/io.h> |
208 | +#include <linux/iopoll.h> |
209 | #include <linux/fsl_devices.h> |
210 | #include <linux/i2c.h> |
211 | #include <linux/interrupt.h> |
212 | @@ -49,6 +50,7 @@ |
213 | #define CCR_MTX 0x10 |
214 | #define CCR_TXAK 0x08 |
215 | #define CCR_RSTA 0x04 |
216 | +#define CCR_RSVD 0x02 |
217 | |
218 | #define CSR_MCF 0x80 |
219 | #define CSR_MAAS 0x40 |
220 | @@ -70,6 +72,7 @@ struct mpc_i2c { |
221 | u8 fdr, dfsrr; |
222 | #endif |
223 | struct clk *clk_per; |
224 | + bool has_errata_A004447; |
225 | }; |
226 | |
227 | struct mpc_i2c_divider { |
228 | @@ -176,6 +179,75 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) |
229 | return 0; |
230 | } |
231 | |
232 | +static int i2c_mpc_wait_sr(struct mpc_i2c *i2c, int mask) |
233 | +{ |
234 | + void __iomem *addr = i2c->base + MPC_I2C_SR; |
235 | + u8 val; |
236 | + |
237 | + return readb_poll_timeout(addr, val, val & mask, 0, 100); |
238 | +} |
239 | + |
240 | +/* |
241 | + * Workaround for Erratum A004447. From the P2040CE Rev Q |
242 | + * |
243 | + * 1. Set up the frequency divider and sampling rate. |
244 | + * 2. I2CCR - a0h |
245 | + * 3. Poll for I2CSR[MBB] to get set. |
246 | + * 4. If I2CSR[MAL] is set (an indication that SDA is stuck low), then go to |
247 | + * step 5. If MAL is not set, then go to step 13. |
248 | + * 5. I2CCR - 00h |
249 | + * 6. I2CCR - 22h |
250 | + * 7. I2CCR - a2h |
251 | + * 8. Poll for I2CSR[MBB] to get set. |
252 | + * 9. Issue read to I2CDR. |
253 | + * 10. Poll for I2CSR[MIF] to be set. |
254 | + * 11. I2CCR - 82h |
255 | + * 12. Workaround complete. Skip the next steps. |
256 | + * 13. Issue read to I2CDR. |
257 | + * 14. Poll for I2CSR[MIF] to be set. |
258 | + * 15. I2CCR - 80h |
259 | + */ |
260 | +static void mpc_i2c_fixup_A004447(struct mpc_i2c *i2c) |
261 | +{ |
262 | + int ret; |
263 | + u32 val; |
264 | + |
265 | + writeccr(i2c, CCR_MEN | CCR_MSTA); |
266 | + ret = i2c_mpc_wait_sr(i2c, CSR_MBB); |
267 | + if (ret) { |
268 | + dev_err(i2c->dev, "timeout waiting for CSR_MBB\n"); |
269 | + return; |
270 | + } |
271 | + |
272 | + val = readb(i2c->base + MPC_I2C_SR); |
273 | + |
274 | + if (val & CSR_MAL) { |
275 | + writeccr(i2c, 0x00); |
276 | + writeccr(i2c, CCR_MSTA | CCR_RSVD); |
277 | + writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSVD); |
278 | + ret = i2c_mpc_wait_sr(i2c, CSR_MBB); |
279 | + if (ret) { |
280 | + dev_err(i2c->dev, "timeout waiting for CSR_MBB\n"); |
281 | + return; |
282 | + } |
283 | + val = readb(i2c->base + MPC_I2C_DR); |
284 | + ret = i2c_mpc_wait_sr(i2c, CSR_MIF); |
285 | + if (ret) { |
286 | + dev_err(i2c->dev, "timeout waiting for CSR_MIF\n"); |
287 | + return; |
288 | + } |
289 | + writeccr(i2c, CCR_MEN | CCR_RSVD); |
290 | + } else { |
291 | + val = readb(i2c->base + MPC_I2C_DR); |
292 | + ret = i2c_mpc_wait_sr(i2c, CSR_MIF); |
293 | + if (ret) { |
294 | + dev_err(i2c->dev, "timeout waiting for CSR_MIF\n"); |
295 | + return; |
296 | + } |
297 | + writeccr(i2c, CCR_MEN); |
298 | + } |
299 | +} |
300 | + |
301 | #if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x) |
302 | static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = { |
303 | {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23}, |
304 | @@ -586,7 +658,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) |
305 | if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) { |
306 | writeb(status & ~CSR_MAL, |
307 | i2c->base + MPC_I2C_SR); |
308 | - mpc_i2c_fixup(i2c); |
309 | + i2c_recover_bus(&i2c->adap); |
310 | } |
311 | return -EIO; |
312 | } |
313 | @@ -622,7 +694,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) |
314 | if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) { |
315 | writeb(status & ~CSR_MAL, |
316 | i2c->base + MPC_I2C_SR); |
317 | - mpc_i2c_fixup(i2c); |
318 | + i2c_recover_bus(&i2c->adap); |
319 | } |
320 | return -EIO; |
321 | } |
322 | @@ -637,6 +709,18 @@ static u32 mpc_functionality(struct i2c_adapter *adap) |
323 | | I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_PROC_CALL; |
324 | } |
325 | |
326 | +static int fsl_i2c_bus_recovery(struct i2c_adapter *adap) |
327 | +{ |
328 | + struct mpc_i2c *i2c = i2c_get_adapdata(adap); |
329 | + |
330 | + if (i2c->has_errata_A004447) |
331 | + mpc_i2c_fixup_A004447(i2c); |
332 | + else |
333 | + mpc_i2c_fixup(i2c); |
334 | + |
335 | + return 0; |
336 | +} |
337 | + |
338 | static const struct i2c_algorithm mpc_algo = { |
339 | .master_xfer = mpc_xfer, |
340 | .functionality = mpc_functionality, |
341 | @@ -648,6 +732,10 @@ static struct i2c_adapter mpc_ops = { |
342 | .timeout = HZ, |
343 | }; |
344 | |
345 | +static struct i2c_bus_recovery_info fsl_i2c_recovery_info = { |
346 | + .recover_bus = fsl_i2c_bus_recovery, |
347 | +}; |
348 | + |
349 | static const struct of_device_id mpc_i2c_of_match[]; |
350 | static int fsl_i2c_probe(struct platform_device *op) |
351 | { |
352 | @@ -732,6 +820,8 @@ static int fsl_i2c_probe(struct platform_device *op) |
353 | dev_info(i2c->dev, "timeout %u us\n", mpc_ops.timeout * 1000000 / HZ); |
354 | |
355 | platform_set_drvdata(op, i2c); |
356 | + if (of_property_read_bool(op->dev.of_node, "fsl,i2c-erratum-a004447")) |
357 | + i2c->has_errata_A004447 = true; |
358 | |
359 | i2c->adap = mpc_ops; |
360 | of_address_to_resource(op->dev.of_node, 0, &res); |
361 | @@ -740,6 +830,7 @@ static int fsl_i2c_probe(struct platform_device *op) |
362 | i2c_set_adapdata(&i2c->adap, i2c); |
363 | i2c->adap.dev.parent = &op->dev; |
364 | i2c->adap.dev.of_node = of_node_get(op->dev.of_node); |
365 | + i2c->adap.bus_recovery_info = &fsl_i2c_recovery_info; |
366 | |
367 | result = i2c_add_adapter(&i2c->adap); |
368 | if (result < 0) |
369 | diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c |
370 | index b8274c6fc43e7..48864269f042a 100644 |
371 | --- a/drivers/infiniband/hw/mlx4/main.c |
372 | +++ b/drivers/infiniband/hw/mlx4/main.c |
373 | @@ -577,12 +577,9 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, |
374 | props->cq_caps.max_cq_moderation_count = MLX4_MAX_CQ_COUNT; |
375 | props->cq_caps.max_cq_moderation_period = MLX4_MAX_CQ_PERIOD; |
376 | |
377 | - if (!mlx4_is_slave(dev->dev)) |
378 | - err = mlx4_get_internal_clock_params(dev->dev, &clock_params); |
379 | - |
380 | if (uhw->outlen >= resp.response_length + sizeof(resp.hca_core_clock_offset)) { |
381 | resp.response_length += sizeof(resp.hca_core_clock_offset); |
382 | - if (!err && !mlx4_is_slave(dev->dev)) { |
383 | + if (!mlx4_get_internal_clock_params(dev->dev, &clock_params)) { |
384 | resp.comp_mask |= MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET; |
385 | resp.hca_core_clock_offset = clock_params.offset % PAGE_SIZE; |
386 | } |
387 | diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c |
388 | index 73d5b8dc74d86..23ce0126b268e 100644 |
389 | --- a/drivers/infiniband/hw/mlx5/cq.c |
390 | +++ b/drivers/infiniband/hw/mlx5/cq.c |
391 | @@ -829,15 +829,14 @@ static void destroy_cq_user(struct mlx5_ib_cq *cq, struct ib_udata *udata) |
392 | ib_umem_release(cq->buf.umem); |
393 | } |
394 | |
395 | -static void init_cq_frag_buf(struct mlx5_ib_cq *cq, |
396 | - struct mlx5_ib_cq_buf *buf) |
397 | +static void init_cq_frag_buf(struct mlx5_ib_cq_buf *buf) |
398 | { |
399 | int i; |
400 | void *cqe; |
401 | struct mlx5_cqe64 *cqe64; |
402 | |
403 | for (i = 0; i < buf->nent; i++) { |
404 | - cqe = get_cqe(cq, i); |
405 | + cqe = mlx5_frag_buf_get_wqe(&buf->fbc, i); |
406 | cqe64 = buf->cqe_size == 64 ? cqe : cqe + 64; |
407 | cqe64->op_own = MLX5_CQE_INVALID << 4; |
408 | } |
409 | @@ -863,7 +862,7 @@ static int create_cq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, |
410 | if (err) |
411 | goto err_db; |
412 | |
413 | - init_cq_frag_buf(cq, &cq->buf); |
414 | + init_cq_frag_buf(&cq->buf); |
415 | |
416 | *inlen = MLX5_ST_SZ_BYTES(create_cq_in) + |
417 | MLX5_FLD_SZ_BYTES(create_cq_in, pas[0]) * |
418 | @@ -1163,7 +1162,7 @@ static int resize_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, |
419 | if (err) |
420 | goto ex; |
421 | |
422 | - init_cq_frag_buf(cq, cq->resize_buf); |
423 | + init_cq_frag_buf(cq->resize_buf); |
424 | |
425 | return 0; |
426 | |
427 | diff --git a/drivers/infiniband/ulp/ipoib/ipoib_netlink.c b/drivers/infiniband/ulp/ipoib/ipoib_netlink.c |
428 | index d5a90a66b45cf..5b05cf3837da1 100644 |
429 | --- a/drivers/infiniband/ulp/ipoib/ipoib_netlink.c |
430 | +++ b/drivers/infiniband/ulp/ipoib/ipoib_netlink.c |
431 | @@ -163,6 +163,7 @@ static size_t ipoib_get_size(const struct net_device *dev) |
432 | |
433 | static struct rtnl_link_ops ipoib_link_ops __read_mostly = { |
434 | .kind = "ipoib", |
435 | + .netns_refund = true, |
436 | .maxtype = IFLA_IPOIB_MAX, |
437 | .policy = ipoib_policy, |
438 | .priv_size = sizeof(struct ipoib_dev_priv), |
439 | diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c |
440 | index 61caa7e50b9ab..9e6aab04f9d61 100644 |
441 | --- a/drivers/isdn/hardware/mISDN/netjet.c |
442 | +++ b/drivers/isdn/hardware/mISDN/netjet.c |
443 | @@ -1100,7 +1100,6 @@ nj_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
444 | card->typ = NETJET_S_TJ300; |
445 | |
446 | card->base = pci_resource_start(pdev, 0); |
447 | - card->irq = pdev->irq; |
448 | pci_set_drvdata(pdev, card); |
449 | err = setup_instance(card); |
450 | if (err) |
451 | diff --git a/drivers/md/dm-verity-verify-sig.c b/drivers/md/dm-verity-verify-sig.c |
452 | index 614e43db93aa8..919154ae4cae6 100644 |
453 | --- a/drivers/md/dm-verity-verify-sig.c |
454 | +++ b/drivers/md/dm-verity-verify-sig.c |
455 | @@ -15,7 +15,7 @@ |
456 | #define DM_VERITY_VERIFY_ERR(s) DM_VERITY_ROOT_HASH_VERIFICATION " " s |
457 | |
458 | static bool require_signatures; |
459 | -module_param(require_signatures, bool, false); |
460 | +module_param(require_signatures, bool, 0444); |
461 | MODULE_PARM_DESC(require_signatures, |
462 | "Verify the roothash of dm-verity hash tree"); |
463 | |
464 | diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c |
465 | index b3c63d2f16aa0..5c89c2eff891d 100644 |
466 | --- a/drivers/net/appletalk/cops.c |
467 | +++ b/drivers/net/appletalk/cops.c |
468 | @@ -325,6 +325,8 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr) |
469 | break; |
470 | } |
471 | |
472 | + dev->base_addr = ioaddr; |
473 | + |
474 | /* Reserve any actual interrupt. */ |
475 | if (dev->irq) { |
476 | retval = request_irq(dev->irq, cops_interrupt, 0, dev->name, dev); |
477 | @@ -332,8 +334,6 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr) |
478 | goto err_out; |
479 | } |
480 | |
481 | - dev->base_addr = ioaddr; |
482 | - |
483 | lp = netdev_priv(dev); |
484 | spin_lock_init(&lp->lock); |
485 | |
486 | diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
487 | index 2bc4cb9e30954..e21643377162b 100644 |
488 | --- a/drivers/net/bonding/bond_main.c |
489 | +++ b/drivers/net/bonding/bond_main.c |
490 | @@ -1335,6 +1335,7 @@ static struct slave *bond_alloc_slave(struct bonding *bond, |
491 | |
492 | slave->bond = bond; |
493 | slave->dev = slave_dev; |
494 | + INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); |
495 | |
496 | if (bond_kobj_init(slave)) |
497 | return NULL; |
498 | @@ -1347,7 +1348,6 @@ static struct slave *bond_alloc_slave(struct bonding *bond, |
499 | return NULL; |
500 | } |
501 | } |
502 | - INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); |
503 | |
504 | return slave; |
505 | } |
506 | diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c |
507 | index 49ab1346dc3f7..0370e71ed6e0d 100644 |
508 | --- a/drivers/net/dsa/microchip/ksz9477.c |
509 | +++ b/drivers/net/dsa/microchip/ksz9477.c |
510 | @@ -1520,6 +1520,7 @@ static const struct ksz_chip_data ksz9477_switch_chips[] = { |
511 | .num_statics = 16, |
512 | .cpu_ports = 0x7F, /* can be configured as cpu port */ |
513 | .port_cnt = 7, /* total physical port count */ |
514 | + .phy_errata_9477 = true, |
515 | }, |
516 | }; |
517 | |
518 | diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
519 | index 5097a44686b39..cf39623b828b7 100644 |
520 | --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
521 | +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
522 | @@ -1245,8 +1245,10 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, |
523 | goto failed; |
524 | |
525 | /* SR-IOV capability was enabled but there are no VFs*/ |
526 | - if (iov->total == 0) |
527 | + if (iov->total == 0) { |
528 | + err = -EINVAL; |
529 | goto failed; |
530 | + } |
531 | |
532 | iov->nr_virtfn = min_t(u16, iov->total, num_vfs_param); |
533 | |
534 | diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c |
535 | index 377668465535f..ebd0853a6f313 100644 |
536 | --- a/drivers/net/ethernet/cadence/macb_main.c |
537 | +++ b/drivers/net/ethernet/cadence/macb_main.c |
538 | @@ -2536,6 +2536,9 @@ static struct net_device_stats *gem_get_stats(struct macb *bp) |
539 | struct gem_stats *hwstat = &bp->hw_stats.gem; |
540 | struct net_device_stats *nstat = &bp->dev->stats; |
541 | |
542 | + if (!netif_running(bp->dev)) |
543 | + return nstat; |
544 | + |
545 | gem_update_stats(bp); |
546 | |
547 | nstat->rx_errors = (hwstat->rx_frame_check_sequence_errors + |
548 | diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c |
549 | index f6cfec81ccc3b..dc4ac1a2b6b67 100644 |
550 | --- a/drivers/net/ethernet/mellanox/mlx4/fw.c |
551 | +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c |
552 | @@ -823,6 +823,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) |
553 | #define QUERY_DEV_CAP_MAD_DEMUX_OFFSET 0xb0 |
554 | #define QUERY_DEV_CAP_DMFS_HIGH_RATE_QPN_BASE_OFFSET 0xa8 |
555 | #define QUERY_DEV_CAP_DMFS_HIGH_RATE_QPN_RANGE_OFFSET 0xac |
556 | +#define QUERY_DEV_CAP_MAP_CLOCK_TO_USER 0xc1 |
557 | #define QUERY_DEV_CAP_QP_RATE_LIMIT_NUM_OFFSET 0xcc |
558 | #define QUERY_DEV_CAP_QP_RATE_LIMIT_MAX_OFFSET 0xd0 |
559 | #define QUERY_DEV_CAP_QP_RATE_LIMIT_MIN_OFFSET 0xd2 |
560 | @@ -841,6 +842,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) |
561 | |
562 | if (mlx4_is_mfunc(dev)) |
563 | disable_unsupported_roce_caps(outbox); |
564 | + MLX4_GET(field, outbox, QUERY_DEV_CAP_MAP_CLOCK_TO_USER); |
565 | + dev_cap->map_clock_to_user = field & 0x80; |
566 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_QP_OFFSET); |
567 | dev_cap->reserved_qps = 1 << (field & 0xf); |
568 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_QP_OFFSET); |
569 | diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.h b/drivers/net/ethernet/mellanox/mlx4/fw.h |
570 | index 8f020f26ebf5f..cf64e54eecb05 100644 |
571 | --- a/drivers/net/ethernet/mellanox/mlx4/fw.h |
572 | +++ b/drivers/net/ethernet/mellanox/mlx4/fw.h |
573 | @@ -131,6 +131,7 @@ struct mlx4_dev_cap { |
574 | u32 health_buffer_addrs; |
575 | struct mlx4_port_cap port_cap[MLX4_MAX_PORTS + 1]; |
576 | bool wol_port[MLX4_MAX_PORTS + 1]; |
577 | + bool map_clock_to_user; |
578 | }; |
579 | |
580 | struct mlx4_func_cap { |
581 | diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c |
582 | index 942646fb2256c..cb4664a040ab5 100644 |
583 | --- a/drivers/net/ethernet/mellanox/mlx4/main.c |
584 | +++ b/drivers/net/ethernet/mellanox/mlx4/main.c |
585 | @@ -498,6 +498,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) |
586 | } |
587 | } |
588 | |
589 | + dev->caps.map_clock_to_user = dev_cap->map_clock_to_user; |
590 | dev->caps.uar_page_size = PAGE_SIZE; |
591 | dev->caps.num_uars = dev_cap->uar_size / PAGE_SIZE; |
592 | dev->caps.local_ca_ack_delay = dev_cap->local_ca_ack_delay; |
593 | @@ -1948,6 +1949,11 @@ int mlx4_get_internal_clock_params(struct mlx4_dev *dev, |
594 | if (mlx4_is_slave(dev)) |
595 | return -EOPNOTSUPP; |
596 | |
597 | + if (!dev->caps.map_clock_to_user) { |
598 | + mlx4_dbg(dev, "Map clock to user is not supported.\n"); |
599 | + return -EOPNOTSUPP; |
600 | + } |
601 | + |
602 | if (!params) |
603 | return -EINVAL; |
604 | |
605 | diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c |
606 | index 986f26578d344..5dc36c51636c4 100644 |
607 | --- a/drivers/net/ethernet/qlogic/qla3xxx.c |
608 | +++ b/drivers/net/ethernet/qlogic/qla3xxx.c |
609 | @@ -115,7 +115,7 @@ static int ql_sem_spinlock(struct ql3_adapter *qdev, |
610 | value = readl(&port_regs->CommonRegs.semaphoreReg); |
611 | if ((value & (sem_mask >> 16)) == sem_bits) |
612 | return 0; |
613 | - ssleep(1); |
614 | + mdelay(1000); |
615 | } while (--seconds); |
616 | return -1; |
617 | } |
618 | diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c |
619 | index 229e480179ff1..5bf06eac04ba3 100644 |
620 | --- a/drivers/net/phy/mdio_bus.c |
621 | +++ b/drivers/net/phy/mdio_bus.c |
622 | @@ -453,7 +453,8 @@ void mdiobus_unregister(struct mii_bus *bus) |
623 | struct mdio_device *mdiodev; |
624 | int i; |
625 | |
626 | - BUG_ON(bus->state != MDIOBUS_REGISTERED); |
627 | + if (WARN_ON_ONCE(bus->state != MDIOBUS_REGISTERED)) |
628 | + return; |
629 | bus->state = MDIOBUS_UNREGISTERED; |
630 | |
631 | for (i = 0; i < PHY_MAX_ADDR; i++) { |
632 | diff --git a/drivers/nvme/host/Kconfig b/drivers/nvme/host/Kconfig |
633 | index 7b3f6555e67ba..cf0ae71c489ea 100644 |
634 | --- a/drivers/nvme/host/Kconfig |
635 | +++ b/drivers/nvme/host/Kconfig |
636 | @@ -62,7 +62,8 @@ config NVME_FC |
637 | config NVME_TCP |
638 | tristate "NVM Express over Fabrics TCP host driver" |
639 | depends on INET |
640 | - depends on BLK_DEV_NVME |
641 | + depends on BLOCK |
642 | + select NVME_CORE |
643 | select NVME_FABRICS |
644 | select CRYPTO |
645 | select CRYPTO_CRC32C |
646 | diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c |
647 | index 3bb71f177dfda..d884187d77068 100644 |
648 | --- a/drivers/nvme/host/fabrics.c |
649 | +++ b/drivers/nvme/host/fabrics.c |
650 | @@ -336,6 +336,11 @@ static void nvmf_log_connect_error(struct nvme_ctrl *ctrl, |
651 | cmd->connect.recfmt); |
652 | break; |
653 | |
654 | + case NVME_SC_HOST_PATH_ERROR: |
655 | + dev_err(ctrl->device, |
656 | + "Connect command failed: host path error\n"); |
657 | + break; |
658 | + |
659 | default: |
660 | dev_err(ctrl->device, |
661 | "Connect command failed, error wo/DNR bit: %d\n", |
662 | diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
663 | index a31b6ae92a84e..7fd793d8536cd 100644 |
664 | --- a/drivers/regulator/core.c |
665 | +++ b/drivers/regulator/core.c |
666 | @@ -1381,6 +1381,12 @@ static int set_machine_constraints(struct regulator_dev *rdev) |
667 | * and we have control then make sure it is enabled. |
668 | */ |
669 | if (rdev->constraints->always_on || rdev->constraints->boot_on) { |
670 | + /* If we want to enable this regulator, make sure that we know |
671 | + * the supplying regulator. |
672 | + */ |
673 | + if (rdev->supply_name && !rdev->supply) |
674 | + return -EPROBE_DEFER; |
675 | + |
676 | if (rdev->supply) { |
677 | ret = regulator_enable(rdev->supply); |
678 | if (ret < 0) { |
679 | diff --git a/drivers/regulator/max77620-regulator.c b/drivers/regulator/max77620-regulator.c |
680 | index 8d9731e4052bf..5c439c850d090 100644 |
681 | --- a/drivers/regulator/max77620-regulator.c |
682 | +++ b/drivers/regulator/max77620-regulator.c |
683 | @@ -814,6 +814,13 @@ static int max77620_regulator_probe(struct platform_device *pdev) |
684 | config.dev = dev; |
685 | config.driver_data = pmic; |
686 | |
687 | + /* |
688 | + * Set of_node_reuse flag to prevent driver core from attempting to |
689 | + * claim any pinmux resources already claimed by the parent device. |
690 | + * Otherwise PMIC driver will fail to re-probe. |
691 | + */ |
692 | + device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); |
693 | + |
694 | for (id = 0; id < MAX77620_NUM_REGS; id++) { |
695 | struct regulator_dev *rdev; |
696 | struct regulator_desc *rdesc; |
697 | diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c |
698 | index 339a6bc0339b0..fd590d1cffc1f 100644 |
699 | --- a/drivers/s390/cio/vfio_ccw_drv.c |
700 | +++ b/drivers/s390/cio/vfio_ccw_drv.c |
701 | @@ -83,6 +83,7 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work) |
702 | struct vfio_ccw_private *private; |
703 | struct irb *irb; |
704 | bool is_final; |
705 | + bool cp_is_finished = false; |
706 | |
707 | private = container_of(work, struct vfio_ccw_private, io_work); |
708 | irb = &private->irb; |
709 | @@ -91,14 +92,21 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work) |
710 | (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)); |
711 | if (scsw_is_solicited(&irb->scsw)) { |
712 | cp_update_scsw(&private->cp, &irb->scsw); |
713 | - if (is_final && private->state == VFIO_CCW_STATE_CP_PENDING) |
714 | + if (is_final && private->state == VFIO_CCW_STATE_CP_PENDING) { |
715 | cp_free(&private->cp); |
716 | + cp_is_finished = true; |
717 | + } |
718 | } |
719 | mutex_lock(&private->io_mutex); |
720 | memcpy(private->io_region->irb_area, irb, sizeof(*irb)); |
721 | mutex_unlock(&private->io_mutex); |
722 | |
723 | - if (private->mdev && is_final) |
724 | + /* |
725 | + * Reset to IDLE only if processing of a channel program |
726 | + * has finished. Do not overwrite a possible processing |
727 | + * state if the final interrupt was for HSCH or CSCH. |
728 | + */ |
729 | + if (private->mdev && cp_is_finished) |
730 | private->state = VFIO_CCW_STATE_IDLE; |
731 | |
732 | if (private->io_trigger) |
733 | diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c |
734 | index 401743e2b4294..a0e7764148899 100644 |
735 | --- a/drivers/scsi/bnx2fc/bnx2fc_io.c |
736 | +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c |
737 | @@ -1219,6 +1219,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd) |
738 | was a result from the ABTS request rather than the CLEANUP |
739 | request */ |
740 | set_bit(BNX2FC_FLAG_IO_CLEANUP, &io_req->req_flags); |
741 | + rc = FAILED; |
742 | goto done; |
743 | } |
744 | |
745 | diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
746 | index 723f51c822af3..916447f3c6073 100644 |
747 | --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
748 | +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
749 | @@ -3274,14 +3274,14 @@ hisi_sas_v3_destroy_irqs(struct pci_dev *pdev, struct hisi_hba *hisi_hba) |
750 | { |
751 | int i; |
752 | |
753 | - free_irq(pci_irq_vector(pdev, 1), hisi_hba); |
754 | - free_irq(pci_irq_vector(pdev, 2), hisi_hba); |
755 | - free_irq(pci_irq_vector(pdev, 11), hisi_hba); |
756 | + devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 1), hisi_hba); |
757 | + devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 2), hisi_hba); |
758 | + devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 11), hisi_hba); |
759 | for (i = 0; i < hisi_hba->cq_nvecs; i++) { |
760 | struct hisi_sas_cq *cq = &hisi_hba->cq[i]; |
761 | int nr = hisi_sas_intr_conv ? 16 : 16 + i; |
762 | |
763 | - free_irq(pci_irq_vector(pdev, nr), cq); |
764 | + devm_free_irq(&pdev->dev, pci_irq_vector(pdev, nr), cq); |
765 | } |
766 | pci_free_irq_vectors(pdev); |
767 | } |
768 | diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c |
769 | index 55522b7162d3b..ff36432c8fbc2 100644 |
770 | --- a/drivers/scsi/hosts.c |
771 | +++ b/drivers/scsi/hosts.c |
772 | @@ -253,12 +253,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, |
773 | |
774 | device_enable_async_suspend(&shost->shost_dev); |
775 | |
776 | + get_device(&shost->shost_gendev); |
777 | error = device_add(&shost->shost_dev); |
778 | if (error) |
779 | goto out_del_gendev; |
780 | |
781 | - get_device(&shost->shost_gendev); |
782 | - |
783 | if (shost->transportt->host_size) { |
784 | shost->shost_data = kzalloc(shost->transportt->host_size, |
785 | GFP_KERNEL); |
786 | @@ -275,33 +274,36 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, |
787 | shost->work_q_name); |
788 | if (!shost->work_q) { |
789 | error = -EINVAL; |
790 | - goto out_free_shost_data; |
791 | + goto out_del_dev; |
792 | } |
793 | } |
794 | |
795 | error = scsi_sysfs_add_host(shost); |
796 | if (error) |
797 | - goto out_destroy_host; |
798 | + goto out_del_dev; |
799 | |
800 | scsi_proc_host_add(shost); |
801 | scsi_autopm_put_host(shost); |
802 | return error; |
803 | |
804 | - out_destroy_host: |
805 | - if (shost->work_q) |
806 | - destroy_workqueue(shost->work_q); |
807 | - out_free_shost_data: |
808 | - kfree(shost->shost_data); |
809 | + /* |
810 | + * Any host allocation in this function will be freed in |
811 | + * scsi_host_dev_release(). |
812 | + */ |
813 | out_del_dev: |
814 | device_del(&shost->shost_dev); |
815 | out_del_gendev: |
816 | + /* |
817 | + * Host state is SHOST_RUNNING so we have to explicitly release |
818 | + * ->shost_dev. |
819 | + */ |
820 | + put_device(&shost->shost_dev); |
821 | device_del(&shost->shost_gendev); |
822 | out_disable_runtime_pm: |
823 | device_disable_async_suspend(&shost->shost_gendev); |
824 | pm_runtime_disable(&shost->shost_gendev); |
825 | pm_runtime_set_suspended(&shost->shost_gendev); |
826 | pm_runtime_put_noidle(&shost->shost_gendev); |
827 | - scsi_mq_destroy_tags(shost); |
828 | fail: |
829 | return error; |
830 | } |
831 | @@ -342,7 +344,7 @@ static void scsi_host_dev_release(struct device *dev) |
832 | |
833 | ida_simple_remove(&host_index_ida, shost->host_no); |
834 | |
835 | - if (parent) |
836 | + if (shost->shost_state != SHOST_CREATED) |
837 | put_device(parent); |
838 | kfree(shost); |
839 | } |
840 | @@ -389,8 +391,10 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) |
841 | mutex_init(&shost->scan_mutex); |
842 | |
843 | index = ida_simple_get(&host_index_ida, 0, 0, GFP_KERNEL); |
844 | - if (index < 0) |
845 | - goto fail_kfree; |
846 | + if (index < 0) { |
847 | + kfree(shost); |
848 | + return NULL; |
849 | + } |
850 | shost->host_no = index; |
851 | |
852 | shost->dma_channel = 0xff; |
853 | @@ -482,7 +486,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) |
854 | shost_printk(KERN_WARNING, shost, |
855 | "error handler thread failed to spawn, error = %ld\n", |
856 | PTR_ERR(shost->ehandler)); |
857 | - goto fail_index_remove; |
858 | + goto fail; |
859 | } |
860 | |
861 | shost->tmf_work_q = alloc_workqueue("scsi_tmf_%d", |
862 | @@ -491,17 +495,18 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) |
863 | if (!shost->tmf_work_q) { |
864 | shost_printk(KERN_WARNING, shost, |
865 | "failed to create tmf workq\n"); |
866 | - goto fail_kthread; |
867 | + goto fail; |
868 | } |
869 | scsi_proc_hostdir_add(shost->hostt); |
870 | return shost; |
871 | + fail: |
872 | + /* |
873 | + * Host state is still SHOST_CREATED and that is enough to release |
874 | + * ->shost_gendev. scsi_host_dev_release() will free |
875 | + * dev_name(&shost->shost_dev). |
876 | + */ |
877 | + put_device(&shost->shost_gendev); |
878 | |
879 | - fail_kthread: |
880 | - kthread_stop(shost->ehandler); |
881 | - fail_index_remove: |
882 | - ida_simple_remove(&host_index_ida, shost->host_no); |
883 | - fail_kfree: |
884 | - kfree(shost); |
885 | return NULL; |
886 | } |
887 | EXPORT_SYMBOL(scsi_host_alloc); |
888 | diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
889 | index 509539ec58e93..57068e2faef54 100644 |
890 | --- a/drivers/scsi/qla2xxx/qla_target.c |
891 | +++ b/drivers/scsi/qla2xxx/qla_target.c |
892 | @@ -1559,10 +1559,12 @@ void qlt_stop_phase2(struct qla_tgt *tgt) |
893 | return; |
894 | } |
895 | |
896 | + mutex_lock(&tgt->ha->optrom_mutex); |
897 | mutex_lock(&vha->vha_tgt.tgt_mutex); |
898 | tgt->tgt_stop = 0; |
899 | tgt->tgt_stopped = 1; |
900 | mutex_unlock(&vha->vha_tgt.tgt_mutex); |
901 | + mutex_unlock(&tgt->ha->optrom_mutex); |
902 | |
903 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00c, "Stop of tgt %p finished\n", |
904 | tgt); |
905 | diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c |
906 | index 70008816c91f2..0ac342b1deb95 100644 |
907 | --- a/drivers/scsi/vmw_pvscsi.c |
908 | +++ b/drivers/scsi/vmw_pvscsi.c |
909 | @@ -574,7 +574,13 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter, |
910 | case BTSTAT_SUCCESS: |
911 | case BTSTAT_LINKED_COMMAND_COMPLETED: |
912 | case BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG: |
913 | - /* If everything went fine, let's move on.. */ |
914 | + /* |
915 | + * Commands like INQUIRY may transfer less data than |
916 | + * requested by the initiator via bufflen. Set residual |
917 | + * count to make upper layer aware of the actual amount |
918 | + * of data returned. |
919 | + */ |
920 | + scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen); |
921 | cmd->result = (DID_OK << 16); |
922 | break; |
923 | |
924 | diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c |
925 | index 56ee84e85bee2..c86c3ac6097dd 100644 |
926 | --- a/drivers/spi/spi-bcm2835.c |
927 | +++ b/drivers/spi/spi-bcm2835.c |
928 | @@ -68,7 +68,7 @@ |
929 | #define BCM2835_SPI_FIFO_SIZE 64 |
930 | #define BCM2835_SPI_FIFO_SIZE_3_4 48 |
931 | #define BCM2835_SPI_DMA_MIN_LENGTH 96 |
932 | -#define BCM2835_SPI_NUM_CS 3 /* raise as necessary */ |
933 | +#define BCM2835_SPI_NUM_CS 24 /* raise as necessary */ |
934 | #define BCM2835_SPI_MODE_BITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH \ |
935 | | SPI_NO_CS | SPI_3WIRE) |
936 | |
937 | @@ -1181,6 +1181,12 @@ static int bcm2835_spi_setup(struct spi_device *spi) |
938 | struct gpio_chip *chip; |
939 | u32 cs; |
940 | |
941 | + if (spi->chip_select >= BCM2835_SPI_NUM_CS) { |
942 | + dev_err(&spi->dev, "only %d chip-selects supported\n", |
943 | + BCM2835_SPI_NUM_CS - 1); |
944 | + return -EINVAL; |
945 | + } |
946 | + |
947 | /* |
948 | * Precalculate SPI slave's CS register value for ->prepare_message(): |
949 | * The driver always uses software-controlled GPIO chip select, hence |
950 | @@ -1274,7 +1280,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev) |
951 | ctlr->use_gpio_descriptors = true; |
952 | ctlr->mode_bits = BCM2835_SPI_MODE_BITS; |
953 | ctlr->bits_per_word_mask = SPI_BPW_MASK(8); |
954 | - ctlr->num_chipselect = BCM2835_SPI_NUM_CS; |
955 | + ctlr->num_chipselect = 3; |
956 | ctlr->setup = bcm2835_spi_setup; |
957 | ctlr->transfer_one = bcm2835_spi_transfer_one; |
958 | ctlr->handle_err = bcm2835_spi_handle_err; |
959 | diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c |
960 | index d84e22dd6f9f7..7d61a3b71ee5b 100644 |
961 | --- a/drivers/spi/spi-bitbang.c |
962 | +++ b/drivers/spi/spi-bitbang.c |
963 | @@ -181,6 +181,8 @@ int spi_bitbang_setup(struct spi_device *spi) |
964 | { |
965 | struct spi_bitbang_cs *cs = spi->controller_state; |
966 | struct spi_bitbang *bitbang; |
967 | + bool initial_setup = false; |
968 | + int retval; |
969 | |
970 | bitbang = spi_master_get_devdata(spi->master); |
971 | |
972 | @@ -189,22 +191,30 @@ int spi_bitbang_setup(struct spi_device *spi) |
973 | if (!cs) |
974 | return -ENOMEM; |
975 | spi->controller_state = cs; |
976 | + initial_setup = true; |
977 | } |
978 | |
979 | /* per-word shift register access, in hardware or bitbanging */ |
980 | cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)]; |
981 | - if (!cs->txrx_word) |
982 | - return -EINVAL; |
983 | + if (!cs->txrx_word) { |
984 | + retval = -EINVAL; |
985 | + goto err_free; |
986 | + } |
987 | |
988 | if (bitbang->setup_transfer) { |
989 | - int retval = bitbang->setup_transfer(spi, NULL); |
990 | + retval = bitbang->setup_transfer(spi, NULL); |
991 | if (retval < 0) |
992 | - return retval; |
993 | + goto err_free; |
994 | } |
995 | |
996 | dev_dbg(&spi->dev, "%s, %u nsec/bit\n", __func__, 2 * cs->nsecs); |
997 | |
998 | return 0; |
999 | + |
1000 | +err_free: |
1001 | + if (initial_setup) |
1002 | + kfree(cs); |
1003 | + return retval; |
1004 | } |
1005 | EXPORT_SYMBOL_GPL(spi_bitbang_setup); |
1006 | |
1007 | diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c |
1008 | index 18a93a2854d80..02b999d48ca19 100644 |
1009 | --- a/drivers/spi/spi-fsl-spi.c |
1010 | +++ b/drivers/spi/spi-fsl-spi.c |
1011 | @@ -442,6 +442,7 @@ static int fsl_spi_setup(struct spi_device *spi) |
1012 | { |
1013 | struct mpc8xxx_spi *mpc8xxx_spi; |
1014 | struct fsl_spi_reg *reg_base; |
1015 | + bool initial_setup = false; |
1016 | int retval; |
1017 | u32 hw_mode; |
1018 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); |
1019 | @@ -454,6 +455,7 @@ static int fsl_spi_setup(struct spi_device *spi) |
1020 | if (!cs) |
1021 | return -ENOMEM; |
1022 | spi_set_ctldata(spi, cs); |
1023 | + initial_setup = true; |
1024 | } |
1025 | mpc8xxx_spi = spi_master_get_devdata(spi->master); |
1026 | |
1027 | @@ -477,6 +479,8 @@ static int fsl_spi_setup(struct spi_device *spi) |
1028 | retval = fsl_spi_setup_transfer(spi, NULL); |
1029 | if (retval < 0) { |
1030 | cs->hw_mode = hw_mode; /* Restore settings */ |
1031 | + if (initial_setup) |
1032 | + kfree(cs); |
1033 | return retval; |
1034 | } |
1035 | |
1036 | diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c |
1037 | index ce8dbdbce312d..85ee907e28f9a 100644 |
1038 | --- a/drivers/spi/spi-omap-uwire.c |
1039 | +++ b/drivers/spi/spi-omap-uwire.c |
1040 | @@ -424,15 +424,22 @@ done: |
1041 | static int uwire_setup(struct spi_device *spi) |
1042 | { |
1043 | struct uwire_state *ust = spi->controller_state; |
1044 | + bool initial_setup = false; |
1045 | + int status; |
1046 | |
1047 | if (ust == NULL) { |
1048 | ust = kzalloc(sizeof(*ust), GFP_KERNEL); |
1049 | if (ust == NULL) |
1050 | return -ENOMEM; |
1051 | spi->controller_state = ust; |
1052 | + initial_setup = true; |
1053 | } |
1054 | |
1055 | - return uwire_setup_transfer(spi, NULL); |
1056 | + status = uwire_setup_transfer(spi, NULL); |
1057 | + if (status && initial_setup) |
1058 | + kfree(ust); |
1059 | + |
1060 | + return status; |
1061 | } |
1062 | |
1063 | static void uwire_cleanup(struct spi_device *spi) |
1064 | diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c |
1065 | index 7646b4b56bed9..38f4be2092346 100644 |
1066 | --- a/drivers/spi/spi-omap2-mcspi.c |
1067 | +++ b/drivers/spi/spi-omap2-mcspi.c |
1068 | @@ -1043,8 +1043,25 @@ static void omap2_mcspi_release_dma(struct spi_master *master) |
1069 | } |
1070 | } |
1071 | |
1072 | +static void omap2_mcspi_cleanup(struct spi_device *spi) |
1073 | +{ |
1074 | + struct omap2_mcspi_cs *cs; |
1075 | + |
1076 | + if (spi->controller_state) { |
1077 | + /* Unlink controller state from context save list */ |
1078 | + cs = spi->controller_state; |
1079 | + list_del(&cs->node); |
1080 | + |
1081 | + kfree(cs); |
1082 | + } |
1083 | + |
1084 | + if (gpio_is_valid(spi->cs_gpio)) |
1085 | + gpio_free(spi->cs_gpio); |
1086 | +} |
1087 | + |
1088 | static int omap2_mcspi_setup(struct spi_device *spi) |
1089 | { |
1090 | + bool initial_setup = false; |
1091 | int ret; |
1092 | struct omap2_mcspi *mcspi = spi_master_get_devdata(spi->master); |
1093 | struct omap2_mcspi_regs *ctx = &mcspi->ctx; |
1094 | @@ -1062,6 +1079,7 @@ static int omap2_mcspi_setup(struct spi_device *spi) |
1095 | spi->controller_state = cs; |
1096 | /* Link this to context save list */ |
1097 | list_add_tail(&cs->node, &ctx->cs); |
1098 | + initial_setup = true; |
1099 | |
1100 | if (gpio_is_valid(spi->cs_gpio)) { |
1101 | ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev)); |
1102 | @@ -1077,33 +1095,22 @@ static int omap2_mcspi_setup(struct spi_device *spi) |
1103 | ret = pm_runtime_get_sync(mcspi->dev); |
1104 | if (ret < 0) { |
1105 | pm_runtime_put_noidle(mcspi->dev); |
1106 | + if (initial_setup) |
1107 | + omap2_mcspi_cleanup(spi); |
1108 | |
1109 | return ret; |
1110 | } |
1111 | |
1112 | ret = omap2_mcspi_setup_transfer(spi, NULL); |
1113 | + if (ret && initial_setup) |
1114 | + omap2_mcspi_cleanup(spi); |
1115 | + |
1116 | pm_runtime_mark_last_busy(mcspi->dev); |
1117 | pm_runtime_put_autosuspend(mcspi->dev); |
1118 | |
1119 | return ret; |
1120 | } |
1121 | |
1122 | -static void omap2_mcspi_cleanup(struct spi_device *spi) |
1123 | -{ |
1124 | - struct omap2_mcspi_cs *cs; |
1125 | - |
1126 | - if (spi->controller_state) { |
1127 | - /* Unlink controller state from context save list */ |
1128 | - cs = spi->controller_state; |
1129 | - list_del(&cs->node); |
1130 | - |
1131 | - kfree(cs); |
1132 | - } |
1133 | - |
1134 | - if (gpio_is_valid(spi->cs_gpio)) |
1135 | - gpio_free(spi->cs_gpio); |
1136 | -} |
1137 | - |
1138 | static irqreturn_t omap2_mcspi_irq_handler(int irq, void *data) |
1139 | { |
1140 | struct omap2_mcspi *mcspi = data; |
1141 | diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c |
1142 | index f5a10a94f156d..e32d51f27944e 100644 |
1143 | --- a/drivers/spi/spi-pxa2xx.c |
1144 | +++ b/drivers/spi/spi-pxa2xx.c |
1145 | @@ -1241,6 +1241,8 @@ static int setup_cs(struct spi_device *spi, struct chip_data *chip, |
1146 | chip->gpio_cs_inverted = spi->mode & SPI_CS_HIGH; |
1147 | |
1148 | err = gpiod_direction_output(gpiod, !chip->gpio_cs_inverted); |
1149 | + if (err) |
1150 | + gpiod_put(chip->gpiod_cs); |
1151 | } |
1152 | |
1153 | return err; |
1154 | @@ -1254,6 +1256,7 @@ static int setup(struct spi_device *spi) |
1155 | struct driver_data *drv_data = |
1156 | spi_controller_get_devdata(spi->controller); |
1157 | uint tx_thres, tx_hi_thres, rx_thres; |
1158 | + int err; |
1159 | |
1160 | switch (drv_data->ssp_type) { |
1161 | case QUARK_X1000_SSP: |
1162 | @@ -1400,7 +1403,11 @@ static int setup(struct spi_device *spi) |
1163 | if (drv_data->ssp_type == CE4100_SSP) |
1164 | return 0; |
1165 | |
1166 | - return setup_cs(spi, chip, chip_info); |
1167 | + err = setup_cs(spi, chip, chip_info); |
1168 | + if (err) |
1169 | + kfree(chip); |
1170 | + |
1171 | + return err; |
1172 | } |
1173 | |
1174 | static void cleanup(struct spi_device *spi) |
1175 | diff --git a/drivers/spi/spi-sprd.c b/drivers/spi/spi-sprd.c |
1176 | index c2bdf19ccdd26..44dc7b5b45ad3 100644 |
1177 | --- a/drivers/spi/spi-sprd.c |
1178 | +++ b/drivers/spi/spi-sprd.c |
1179 | @@ -1066,6 +1066,7 @@ static const struct of_device_id sprd_spi_of_match[] = { |
1180 | { .compatible = "sprd,sc9860-spi", }, |
1181 | { /* sentinel */ } |
1182 | }; |
1183 | +MODULE_DEVICE_TABLE(of, sprd_spi_of_match); |
1184 | |
1185 | static struct platform_driver sprd_spi_driver = { |
1186 | .driver = { |
1187 | diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
1188 | index 7592d4de20c9e..f8f3434d5ab1e 100644 |
1189 | --- a/drivers/spi/spi.c |
1190 | +++ b/drivers/spi/spi.c |
1191 | @@ -47,10 +47,6 @@ static void spidev_release(struct device *dev) |
1192 | { |
1193 | struct spi_device *spi = to_spi_device(dev); |
1194 | |
1195 | - /* spi controllers may cleanup for released devices */ |
1196 | - if (spi->controller->cleanup) |
1197 | - spi->controller->cleanup(spi); |
1198 | - |
1199 | spi_controller_put(spi->controller); |
1200 | kfree(spi->driver_override); |
1201 | kfree(spi); |
1202 | @@ -549,6 +545,12 @@ static int spi_dev_check(struct device *dev, void *data) |
1203 | return 0; |
1204 | } |
1205 | |
1206 | +static void spi_cleanup(struct spi_device *spi) |
1207 | +{ |
1208 | + if (spi->controller->cleanup) |
1209 | + spi->controller->cleanup(spi); |
1210 | +} |
1211 | + |
1212 | /** |
1213 | * spi_add_device - Add spi_device allocated with spi_alloc_device |
1214 | * @spi: spi_device to register |
1215 | @@ -613,11 +615,13 @@ int spi_add_device(struct spi_device *spi) |
1216 | |
1217 | /* Device may be bound to an active driver when this returns */ |
1218 | status = device_add(&spi->dev); |
1219 | - if (status < 0) |
1220 | + if (status < 0) { |
1221 | dev_err(dev, "can't add %s, status %d\n", |
1222 | dev_name(&spi->dev), status); |
1223 | - else |
1224 | + spi_cleanup(spi); |
1225 | + } else { |
1226 | dev_dbg(dev, "registered child %s\n", dev_name(&spi->dev)); |
1227 | + } |
1228 | |
1229 | done: |
1230 | mutex_unlock(&spi_add_lock); |
1231 | @@ -710,7 +714,9 @@ void spi_unregister_device(struct spi_device *spi) |
1232 | } |
1233 | if (ACPI_COMPANION(&spi->dev)) |
1234 | acpi_device_clear_enumerated(ACPI_COMPANION(&spi->dev)); |
1235 | - device_unregister(&spi->dev); |
1236 | + device_del(&spi->dev); |
1237 | + spi_cleanup(spi); |
1238 | + put_device(&spi->dev); |
1239 | } |
1240 | EXPORT_SYMBOL_GPL(spi_unregister_device); |
1241 | |
1242 | diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c |
1243 | index f819abb756dc1..b7f0e2c5383da 100644 |
1244 | --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c |
1245 | +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c |
1246 | @@ -2406,7 +2406,7 @@ void rtw_cfg80211_indicate_sta_assoc(struct adapter *padapter, u8 *pmgmt_frame, |
1247 | DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); |
1248 | |
1249 | { |
1250 | - struct station_info sinfo; |
1251 | + struct station_info sinfo = {}; |
1252 | u8 ie_offset; |
1253 | if (GetFrameSubType(pmgmt_frame) == WIFI_ASSOCREQ) |
1254 | ie_offset = _ASOCREQ_IE_OFFSET_; |
1255 | diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c |
1256 | index c0c39cf303871..f32f00c495713 100644 |
1257 | --- a/drivers/usb/cdns3/gadget.c |
1258 | +++ b/drivers/usb/cdns3/gadget.c |
1259 | @@ -2706,8 +2706,10 @@ static int __cdns3_gadget_init(struct cdns3 *cdns) |
1260 | pm_runtime_get_sync(cdns->dev); |
1261 | |
1262 | ret = cdns3_gadget_start(cdns); |
1263 | - if (ret) |
1264 | + if (ret) { |
1265 | + pm_runtime_put_sync(cdns->dev); |
1266 | return ret; |
1267 | + } |
1268 | |
1269 | /* |
1270 | * Because interrupt line can be shared with other components in |
1271 | diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c |
1272 | index 4de8e5f091cb9..03b444f753aa2 100644 |
1273 | --- a/drivers/usb/dwc3/ep0.c |
1274 | +++ b/drivers/usb/dwc3/ep0.c |
1275 | @@ -292,6 +292,9 @@ static struct dwc3_ep *dwc3_wIndex_to_dep(struct dwc3 *dwc, __le16 wIndex_le) |
1276 | epnum |= 1; |
1277 | |
1278 | dep = dwc->eps[epnum]; |
1279 | + if (dep == NULL) |
1280 | + return NULL; |
1281 | + |
1282 | if (dep->flags & DWC3_EP_ENABLED) |
1283 | return dep; |
1284 | |
1285 | diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c |
1286 | index 8bb25773b61e9..05507606b2b42 100644 |
1287 | --- a/drivers/usb/gadget/config.c |
1288 | +++ b/drivers/usb/gadget/config.c |
1289 | @@ -164,6 +164,14 @@ int usb_assign_descriptors(struct usb_function *f, |
1290 | { |
1291 | struct usb_gadget *g = f->config->cdev->gadget; |
1292 | |
1293 | + /* super-speed-plus descriptor falls back to super-speed one, |
1294 | + * if such a descriptor was provided, thus avoiding a NULL |
1295 | + * pointer dereference if a 5gbps capable gadget is used with |
1296 | + * a 10gbps capable config (device port + cable + host port) |
1297 | + */ |
1298 | + if (!ssp) |
1299 | + ssp = ss; |
1300 | + |
1301 | if (fs) { |
1302 | f->fs_descriptors = usb_copy_descriptors(fs); |
1303 | if (!f->fs_descriptors) |
1304 | diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c |
1305 | index 7f5cf488b2b1e..ffe2486fce71c 100644 |
1306 | --- a/drivers/usb/gadget/function/f_ecm.c |
1307 | +++ b/drivers/usb/gadget/function/f_ecm.c |
1308 | @@ -791,7 +791,7 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f) |
1309 | fs_ecm_notify_desc.bEndpointAddress; |
1310 | |
1311 | status = usb_assign_descriptors(f, ecm_fs_function, ecm_hs_function, |
1312 | - ecm_ss_function, NULL); |
1313 | + ecm_ss_function, ecm_ss_function); |
1314 | if (status) |
1315 | goto fail; |
1316 | |
1317 | diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c |
1318 | index b81a91d504bde..801090de1f7b3 100644 |
1319 | --- a/drivers/usb/gadget/function/f_eem.c |
1320 | +++ b/drivers/usb/gadget/function/f_eem.c |
1321 | @@ -304,7 +304,7 @@ static int eem_bind(struct usb_configuration *c, struct usb_function *f) |
1322 | eem_ss_out_desc.bEndpointAddress = eem_fs_out_desc.bEndpointAddress; |
1323 | |
1324 | status = usb_assign_descriptors(f, eem_fs_function, eem_hs_function, |
1325 | - eem_ss_function, NULL); |
1326 | + eem_ss_function, eem_ss_function); |
1327 | if (status) |
1328 | goto fail; |
1329 | |
1330 | @@ -497,7 +497,7 @@ static int eem_unwrap(struct gether *port, |
1331 | skb2 = skb_clone(skb, GFP_ATOMIC); |
1332 | if (unlikely(!skb2)) { |
1333 | DBG(cdev, "unable to unframe EEM packet\n"); |
1334 | - continue; |
1335 | + goto next; |
1336 | } |
1337 | skb_trim(skb2, len - ETH_FCS_LEN); |
1338 | |
1339 | @@ -507,7 +507,7 @@ static int eem_unwrap(struct gether *port, |
1340 | GFP_ATOMIC); |
1341 | if (unlikely(!skb3)) { |
1342 | dev_kfree_skb_any(skb2); |
1343 | - continue; |
1344 | + goto next; |
1345 | } |
1346 | dev_kfree_skb_any(skb2); |
1347 | skb_queue_tail(list, skb3); |
1348 | diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
1349 | index aa56a080235c7..3126f5b08bd4f 100644 |
1350 | --- a/drivers/usb/gadget/function/f_fs.c |
1351 | +++ b/drivers/usb/gadget/function/f_fs.c |
1352 | @@ -3585,6 +3585,9 @@ static void ffs_func_unbind(struct usb_configuration *c, |
1353 | ffs->func = NULL; |
1354 | } |
1355 | |
1356 | + /* Drain any pending AIO completions */ |
1357 | + drain_workqueue(ffs->io_completion_wq); |
1358 | + |
1359 | if (!--opts->refcnt) |
1360 | functionfs_unbind(ffs); |
1361 | |
1362 | diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c |
1363 | index f3816a5c861ee..0586229ac83de 100644 |
1364 | --- a/drivers/usb/gadget/function/f_hid.c |
1365 | +++ b/drivers/usb/gadget/function/f_hid.c |
1366 | @@ -808,7 +808,8 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f) |
1367 | hidg_fs_out_ep_desc.bEndpointAddress; |
1368 | |
1369 | status = usb_assign_descriptors(f, hidg_fs_descriptors, |
1370 | - hidg_hs_descriptors, hidg_ss_descriptors, NULL); |
1371 | + hidg_hs_descriptors, hidg_ss_descriptors, |
1372 | + hidg_ss_descriptors); |
1373 | if (status) |
1374 | goto fail; |
1375 | |
1376 | diff --git a/drivers/usb/gadget/function/f_loopback.c b/drivers/usb/gadget/function/f_loopback.c |
1377 | index 1803646b36780..90215a81c178b 100644 |
1378 | --- a/drivers/usb/gadget/function/f_loopback.c |
1379 | +++ b/drivers/usb/gadget/function/f_loopback.c |
1380 | @@ -207,7 +207,7 @@ autoconf_fail: |
1381 | ss_loop_sink_desc.bEndpointAddress = fs_loop_sink_desc.bEndpointAddress; |
1382 | |
1383 | ret = usb_assign_descriptors(f, fs_loopback_descs, hs_loopback_descs, |
1384 | - ss_loopback_descs, NULL); |
1385 | + ss_loopback_descs, ss_loopback_descs); |
1386 | if (ret) |
1387 | return ret; |
1388 | |
1389 | diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c |
1390 | index 92a7c3a839454..9b19d6935df99 100644 |
1391 | --- a/drivers/usb/gadget/function/f_ncm.c |
1392 | +++ b/drivers/usb/gadget/function/f_ncm.c |
1393 | @@ -583,7 +583,7 @@ static void ncm_do_notify(struct f_ncm *ncm) |
1394 | data[0] = cpu_to_le32(ncm_bitrate(cdev->gadget)); |
1395 | data[1] = data[0]; |
1396 | |
1397 | - DBG(cdev, "notify speed %d\n", ncm_bitrate(cdev->gadget)); |
1398 | + DBG(cdev, "notify speed %u\n", ncm_bitrate(cdev->gadget)); |
1399 | ncm->notify_state = NCM_NOTIFY_CONNECT; |
1400 | break; |
1401 | } |
1402 | @@ -1101,11 +1101,11 @@ static struct sk_buff *ncm_wrap_ntb(struct gether *port, |
1403 | ncm->ndp_dgram_count = 1; |
1404 | |
1405 | /* Note: we skip opts->next_ndp_index */ |
1406 | - } |
1407 | |
1408 | - /* Delay the timer. */ |
1409 | - hrtimer_start(&ncm->task_timer, TX_TIMEOUT_NSECS, |
1410 | - HRTIMER_MODE_REL_SOFT); |
1411 | + /* Start the timer. */ |
1412 | + hrtimer_start(&ncm->task_timer, TX_TIMEOUT_NSECS, |
1413 | + HRTIMER_MODE_REL_SOFT); |
1414 | + } |
1415 | |
1416 | /* Add the datagram position entries */ |
1417 | ntb_ndp = skb_put_zero(ncm->skb_tx_ndp, dgram_idx_len); |
1418 | diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c |
1419 | index 0f47cd398d60a..2a1868b2d24cf 100644 |
1420 | --- a/drivers/usb/gadget/function/f_printer.c |
1421 | +++ b/drivers/usb/gadget/function/f_printer.c |
1422 | @@ -1063,7 +1063,8 @@ autoconf_fail: |
1423 | ss_ep_out_desc.bEndpointAddress = fs_ep_out_desc.bEndpointAddress; |
1424 | |
1425 | ret = usb_assign_descriptors(f, fs_printer_function, |
1426 | - hs_printer_function, ss_printer_function, NULL); |
1427 | + hs_printer_function, ss_printer_function, |
1428 | + ss_printer_function); |
1429 | if (ret) |
1430 | return ret; |
1431 | |
1432 | diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c |
1433 | index cc1ff5b7b60c4..f20c55d42f219 100644 |
1434 | --- a/drivers/usb/gadget/function/f_rndis.c |
1435 | +++ b/drivers/usb/gadget/function/f_rndis.c |
1436 | @@ -789,7 +789,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) |
1437 | ss_notify_desc.bEndpointAddress = fs_notify_desc.bEndpointAddress; |
1438 | |
1439 | status = usb_assign_descriptors(f, eth_fs_function, eth_hs_function, |
1440 | - eth_ss_function, NULL); |
1441 | + eth_ss_function, eth_ss_function); |
1442 | if (status) |
1443 | goto fail; |
1444 | |
1445 | diff --git a/drivers/usb/gadget/function/f_serial.c b/drivers/usb/gadget/function/f_serial.c |
1446 | index c860f30a0ea2b..6db973d0c252e 100644 |
1447 | --- a/drivers/usb/gadget/function/f_serial.c |
1448 | +++ b/drivers/usb/gadget/function/f_serial.c |
1449 | @@ -233,7 +233,7 @@ static int gser_bind(struct usb_configuration *c, struct usb_function *f) |
1450 | gser_ss_out_desc.bEndpointAddress = gser_fs_out_desc.bEndpointAddress; |
1451 | |
1452 | status = usb_assign_descriptors(f, gser_fs_function, gser_hs_function, |
1453 | - gser_ss_function, NULL); |
1454 | + gser_ss_function, gser_ss_function); |
1455 | if (status) |
1456 | goto fail; |
1457 | dev_dbg(&cdev->gadget->dev, "generic ttyGS%d: %s speed IN/%s OUT/%s\n", |
1458 | diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c |
1459 | index ed68a4860b7d8..282737e4609ce 100644 |
1460 | --- a/drivers/usb/gadget/function/f_sourcesink.c |
1461 | +++ b/drivers/usb/gadget/function/f_sourcesink.c |
1462 | @@ -431,7 +431,8 @@ no_iso: |
1463 | ss_iso_sink_desc.bEndpointAddress = fs_iso_sink_desc.bEndpointAddress; |
1464 | |
1465 | ret = usb_assign_descriptors(f, fs_source_sink_descs, |
1466 | - hs_source_sink_descs, ss_source_sink_descs, NULL); |
1467 | + hs_source_sink_descs, ss_source_sink_descs, |
1468 | + ss_source_sink_descs); |
1469 | if (ret) |
1470 | return ret; |
1471 | |
1472 | diff --git a/drivers/usb/gadget/function/f_subset.c b/drivers/usb/gadget/function/f_subset.c |
1473 | index 4d945254905d9..51c1cae162d9b 100644 |
1474 | --- a/drivers/usb/gadget/function/f_subset.c |
1475 | +++ b/drivers/usb/gadget/function/f_subset.c |
1476 | @@ -358,7 +358,7 @@ geth_bind(struct usb_configuration *c, struct usb_function *f) |
1477 | fs_subset_out_desc.bEndpointAddress; |
1478 | |
1479 | status = usb_assign_descriptors(f, fs_eth_function, hs_eth_function, |
1480 | - ss_eth_function, NULL); |
1481 | + ss_eth_function, ss_eth_function); |
1482 | if (status) |
1483 | goto fail; |
1484 | |
1485 | diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c |
1486 | index f6d203fec4955..41a10bcc2efcc 100644 |
1487 | --- a/drivers/usb/gadget/function/f_tcm.c |
1488 | +++ b/drivers/usb/gadget/function/f_tcm.c |
1489 | @@ -2056,7 +2056,8 @@ static int tcm_bind(struct usb_configuration *c, struct usb_function *f) |
1490 | uasp_fs_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress; |
1491 | |
1492 | ret = usb_assign_descriptors(f, uasp_fs_function_desc, |
1493 | - uasp_hs_function_desc, uasp_ss_function_desc, NULL); |
1494 | + uasp_hs_function_desc, uasp_ss_function_desc, |
1495 | + uasp_ss_function_desc); |
1496 | if (ret) |
1497 | goto ep_fail; |
1498 | |
1499 | diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c |
1500 | index 70ef603f7bb9b..18c79bc540337 100644 |
1501 | --- a/drivers/usb/musb/musb_core.c |
1502 | +++ b/drivers/usb/musb/musb_core.c |
1503 | @@ -1871,9 +1871,8 @@ static void musb_pm_runtime_check_session(struct musb *musb) |
1504 | schedule_delayed_work(&musb->irq_work, |
1505 | msecs_to_jiffies(1000)); |
1506 | musb->quirk_retries--; |
1507 | - break; |
1508 | } |
1509 | - fallthrough; |
1510 | + break; |
1511 | case MUSB_QUIRK_B_INVALID_VBUS_91: |
1512 | if (musb->quirk_retries && !musb->flush_irq_work) { |
1513 | musb_dbg(musb, |
1514 | diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
1515 | index caf27a0d51f03..db03212d620ad 100644 |
1516 | --- a/drivers/usb/serial/cp210x.c |
1517 | +++ b/drivers/usb/serial/cp210x.c |
1518 | @@ -507,6 +507,12 @@ struct cp210x_single_port_config { |
1519 | #define CP210X_2NCONFIG_GPIO_RSTLATCH_IDX 587 |
1520 | #define CP210X_2NCONFIG_GPIO_CONTROL_IDX 600 |
1521 | |
1522 | +/* CP2102N QFN20 port configuration values */ |
1523 | +#define CP2102N_QFN20_GPIO2_TXLED_MODE BIT(2) |
1524 | +#define CP2102N_QFN20_GPIO3_RXLED_MODE BIT(3) |
1525 | +#define CP2102N_QFN20_GPIO1_RS485_MODE BIT(4) |
1526 | +#define CP2102N_QFN20_GPIO0_CLK_MODE BIT(6) |
1527 | + |
1528 | /* CP210X_VENDOR_SPECIFIC, CP210X_WRITE_LATCH call writes these 0x2 bytes. */ |
1529 | struct cp210x_gpio_write { |
1530 | u8 mask; |
1531 | @@ -1691,7 +1697,19 @@ static int cp2102n_gpioconf_init(struct usb_serial *serial) |
1532 | priv->gpio_pushpull = (gpio_pushpull >> 3) & 0x0f; |
1533 | |
1534 | /* 0 indicates GPIO mode, 1 is alternate function */ |
1535 | - priv->gpio_altfunc = (gpio_ctrl >> 2) & 0x0f; |
1536 | + if (priv->partnum == CP210X_PARTNUM_CP2102N_QFN20) { |
1537 | + /* QFN20 is special... */ |
1538 | + if (gpio_ctrl & CP2102N_QFN20_GPIO0_CLK_MODE) /* GPIO 0 */ |
1539 | + priv->gpio_altfunc |= BIT(0); |
1540 | + if (gpio_ctrl & CP2102N_QFN20_GPIO1_RS485_MODE) /* GPIO 1 */ |
1541 | + priv->gpio_altfunc |= BIT(1); |
1542 | + if (gpio_ctrl & CP2102N_QFN20_GPIO2_TXLED_MODE) /* GPIO 2 */ |
1543 | + priv->gpio_altfunc |= BIT(2); |
1544 | + if (gpio_ctrl & CP2102N_QFN20_GPIO3_RXLED_MODE) /* GPIO 3 */ |
1545 | + priv->gpio_altfunc |= BIT(3); |
1546 | + } else { |
1547 | + priv->gpio_altfunc = (gpio_ctrl >> 2) & 0x0f; |
1548 | + } |
1549 | |
1550 | if (priv->partnum == CP210X_PARTNUM_CP2102N_QFN28) { |
1551 | /* |
1552 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
1553 | index 7c0181ae44e9c..6bd1a2f6cbd0a 100644 |
1554 | --- a/drivers/usb/serial/ftdi_sio.c |
1555 | +++ b/drivers/usb/serial/ftdi_sio.c |
1556 | @@ -611,6 +611,7 @@ static const struct usb_device_id id_table_combined[] = { |
1557 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
1558 | { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLX_PLUS_PID) }, |
1559 | { USB_DEVICE(FTDI_VID, FTDI_NT_ORION_IO_PID) }, |
1560 | + { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONMX_PID) }, |
1561 | { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) }, |
1562 | { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) }, |
1563 | { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) }, |
1564 | diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
1565 | index d854e04a4286e..add602bebd820 100644 |
1566 | --- a/drivers/usb/serial/ftdi_sio_ids.h |
1567 | +++ b/drivers/usb/serial/ftdi_sio_ids.h |
1568 | @@ -581,6 +581,7 @@ |
1569 | #define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */ |
1570 | #define FTDI_NT_ORIONLX_PLUS_PID 0x7c91 /* OrionLX+ Substation Automation Platform */ |
1571 | #define FTDI_NT_ORION_IO_PID 0x7c92 /* Orion I/O */ |
1572 | +#define FTDI_NT_ORIONMX_PID 0x7c93 /* OrionMX */ |
1573 | |
1574 | /* |
1575 | * Synapse Wireless product ids (FTDI_VID) |
1576 | diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c |
1577 | index 5b6e982a9376b..ff02eff704162 100644 |
1578 | --- a/drivers/usb/serial/omninet.c |
1579 | +++ b/drivers/usb/serial/omninet.c |
1580 | @@ -26,6 +26,7 @@ |
1581 | |
1582 | #define ZYXEL_VENDOR_ID 0x0586 |
1583 | #define ZYXEL_OMNINET_ID 0x1000 |
1584 | +#define ZYXEL_OMNI_56K_PLUS_ID 0x1500 |
1585 | /* This one seems to be a re-branded ZyXEL device */ |
1586 | #define BT_IGNITIONPRO_ID 0x2000 |
1587 | |
1588 | @@ -40,6 +41,7 @@ static int omninet_port_remove(struct usb_serial_port *port); |
1589 | |
1590 | static const struct usb_device_id id_table[] = { |
1591 | { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) }, |
1592 | + { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNI_56K_PLUS_ID) }, |
1593 | { USB_DEVICE(ZYXEL_VENDOR_ID, BT_IGNITIONPRO_ID) }, |
1594 | { } /* Terminating entry */ |
1595 | }; |
1596 | diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c |
1597 | index f93b81a297d67..d172e8642d4ac 100644 |
1598 | --- a/drivers/usb/serial/quatech2.c |
1599 | +++ b/drivers/usb/serial/quatech2.c |
1600 | @@ -416,7 +416,7 @@ static void qt2_close(struct usb_serial_port *port) |
1601 | |
1602 | /* flush the port transmit buffer */ |
1603 | i = usb_control_msg(serial->dev, |
1604 | - usb_rcvctrlpipe(serial->dev, 0), |
1605 | + usb_sndctrlpipe(serial->dev, 0), |
1606 | QT2_FLUSH_DEVICE, 0x40, 1, |
1607 | port_priv->device_port, NULL, 0, QT2_USB_TIMEOUT); |
1608 | |
1609 | @@ -426,7 +426,7 @@ static void qt2_close(struct usb_serial_port *port) |
1610 | |
1611 | /* flush the port receive buffer */ |
1612 | i = usb_control_msg(serial->dev, |
1613 | - usb_rcvctrlpipe(serial->dev, 0), |
1614 | + usb_sndctrlpipe(serial->dev, 0), |
1615 | QT2_FLUSH_DEVICE, 0x40, 0, |
1616 | port_priv->device_port, NULL, 0, QT2_USB_TIMEOUT); |
1617 | |
1618 | @@ -670,7 +670,7 @@ static int qt2_attach(struct usb_serial *serial) |
1619 | int status; |
1620 | |
1621 | /* power on unit */ |
1622 | - status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
1623 | + status = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
1624 | 0xc2, 0x40, 0x8000, 0, NULL, 0, |
1625 | QT2_USB_TIMEOUT); |
1626 | if (status < 0) { |
1627 | diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c |
1628 | index 57907f26f6819..2e60cee5f82b8 100644 |
1629 | --- a/drivers/usb/typec/mux.c |
1630 | +++ b/drivers/usb/typec/mux.c |
1631 | @@ -243,7 +243,7 @@ find_mux: |
1632 | dev = class_find_device(&typec_mux_class, NULL, con->fwnode, |
1633 | mux_fwnode_match); |
1634 | |
1635 | - return dev ? to_typec_switch(dev) : ERR_PTR(-EPROBE_DEFER); |
1636 | + return dev ? to_typec_mux(dev) : ERR_PTR(-EPROBE_DEFER); |
1637 | } |
1638 | |
1639 | /** |
1640 | diff --git a/drivers/usb/typec/tcpm/wcove.c b/drivers/usb/typec/tcpm/wcove.c |
1641 | index 9b745f432c910..7e9c279bf49df 100644 |
1642 | --- a/drivers/usb/typec/tcpm/wcove.c |
1643 | +++ b/drivers/usb/typec/tcpm/wcove.c |
1644 | @@ -377,7 +377,7 @@ static int wcove_pd_transmit(struct tcpc_dev *tcpc, |
1645 | const u8 *data = (void *)msg; |
1646 | int i; |
1647 | |
1648 | - for (i = 0; i < pd_header_cnt(msg->header) * 4 + 2; i++) { |
1649 | + for (i = 0; i < pd_header_cnt_le(msg->header) * 4 + 2; i++) { |
1650 | ret = regmap_write(wcove->regmap, USBC_TX_DATA + i, |
1651 | data[i]); |
1652 | if (ret) |
1653 | diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c |
1654 | index 4d56408ac623d..f3934f2d3c443 100644 |
1655 | --- a/drivers/usb/typec/ucsi/ucsi.c |
1656 | +++ b/drivers/usb/typec/ucsi/ucsi.c |
1657 | @@ -977,6 +977,7 @@ err_unregister: |
1658 | } |
1659 | |
1660 | err_reset: |
1661 | + memset(&ucsi->cap, 0, sizeof(ucsi->cap)); |
1662 | ucsi_reset_ppm(ucsi); |
1663 | err: |
1664 | mutex_unlock(&ucsi->ppm_lock); |
1665 | diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
1666 | index cd65ef7c7c3f2..e6aa94a583e92 100644 |
1667 | --- a/fs/btrfs/disk-io.c |
1668 | +++ b/fs/btrfs/disk-io.c |
1669 | @@ -2463,6 +2463,24 @@ static int validate_super(struct btrfs_fs_info *fs_info, |
1670 | ret = -EINVAL; |
1671 | } |
1672 | |
1673 | + if (memcmp(fs_info->fs_devices->fsid, fs_info->super_copy->fsid, |
1674 | + BTRFS_FSID_SIZE)) { |
1675 | + btrfs_err(fs_info, |
1676 | + "superblock fsid doesn't match fsid of fs_devices: %pU != %pU", |
1677 | + fs_info->super_copy->fsid, fs_info->fs_devices->fsid); |
1678 | + ret = -EINVAL; |
1679 | + } |
1680 | + |
1681 | + if (btrfs_fs_incompat(fs_info, METADATA_UUID) && |
1682 | + memcmp(fs_info->fs_devices->metadata_uuid, |
1683 | + fs_info->super_copy->metadata_uuid, BTRFS_FSID_SIZE)) { |
1684 | + btrfs_err(fs_info, |
1685 | +"superblock metadata_uuid doesn't match metadata uuid of fs_devices: %pU != %pU", |
1686 | + fs_info->super_copy->metadata_uuid, |
1687 | + fs_info->fs_devices->metadata_uuid); |
1688 | + ret = -EINVAL; |
1689 | + } |
1690 | + |
1691 | if (memcmp(fs_info->fs_devices->metadata_uuid, sb->dev_item.fsid, |
1692 | BTRFS_FSID_SIZE) != 0) { |
1693 | btrfs_err(fs_info, |
1694 | @@ -2837,14 +2855,6 @@ int open_ctree(struct super_block *sb, |
1695 | |
1696 | disk_super = fs_info->super_copy; |
1697 | |
1698 | - ASSERT(!memcmp(fs_info->fs_devices->fsid, fs_info->super_copy->fsid, |
1699 | - BTRFS_FSID_SIZE)); |
1700 | - |
1701 | - if (btrfs_fs_incompat(fs_info, METADATA_UUID)) { |
1702 | - ASSERT(!memcmp(fs_info->fs_devices->metadata_uuid, |
1703 | - fs_info->super_copy->metadata_uuid, |
1704 | - BTRFS_FSID_SIZE)); |
1705 | - } |
1706 | |
1707 | features = btrfs_super_flags(disk_super); |
1708 | if (features & BTRFS_SUPER_FLAG_CHANGING_FSID_V2) { |
1709 | diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
1710 | index f8e5c47b95e40..f6308a7b761db 100644 |
1711 | --- a/fs/btrfs/file.c |
1712 | +++ b/fs/btrfs/file.c |
1713 | @@ -1163,7 +1163,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, |
1714 | int del_nr = 0; |
1715 | int del_slot = 0; |
1716 | int recow; |
1717 | - int ret; |
1718 | + int ret = 0; |
1719 | u64 ino = btrfs_ino(inode); |
1720 | |
1721 | path = btrfs_alloc_path(); |
1722 | @@ -1384,7 +1384,7 @@ again: |
1723 | } |
1724 | out: |
1725 | btrfs_free_path(path); |
1726 | - return 0; |
1727 | + return ret; |
1728 | } |
1729 | |
1730 | /* |
1731 | diff --git a/fs/nfs/client.c b/fs/nfs/client.c |
1732 | index a05f77f9c21ed..af838d1ed281c 100644 |
1733 | --- a/fs/nfs/client.c |
1734 | +++ b/fs/nfs/client.c |
1735 | @@ -399,7 +399,7 @@ struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_init) |
1736 | |
1737 | if (cl_init->hostname == NULL) { |
1738 | WARN_ON(1); |
1739 | - return NULL; |
1740 | + return ERR_PTR(-EINVAL); |
1741 | } |
1742 | |
1743 | /* see if the client already exists */ |
1744 | diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h |
1745 | index c4a98cbda6dd9..5708b5a636f19 100644 |
1746 | --- a/fs/nfs/nfs4_fs.h |
1747 | +++ b/fs/nfs/nfs4_fs.h |
1748 | @@ -203,6 +203,7 @@ struct nfs4_exception { |
1749 | struct inode *inode; |
1750 | nfs4_stateid *stateid; |
1751 | long timeout; |
1752 | + unsigned char task_is_privileged : 1; |
1753 | unsigned char delay : 1, |
1754 | recovering : 1, |
1755 | retry : 1; |
1756 | diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c |
1757 | index 914feab64702c..5a69dbd01a6cf 100644 |
1758 | --- a/fs/nfs/nfs4client.c |
1759 | +++ b/fs/nfs/nfs4client.c |
1760 | @@ -435,8 +435,8 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp, |
1761 | */ |
1762 | nfs_mark_client_ready(clp, -EPERM); |
1763 | } |
1764 | - nfs_put_client(clp); |
1765 | clear_bit(NFS_CS_TSM_POSSIBLE, &clp->cl_flags); |
1766 | + nfs_put_client(clp); |
1767 | return old; |
1768 | |
1769 | error: |
1770 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
1771 | index ff54ba3c82477..5ecaf7b6b0fa1 100644 |
1772 | --- a/fs/nfs/nfs4proc.c |
1773 | +++ b/fs/nfs/nfs4proc.c |
1774 | @@ -581,6 +581,8 @@ int nfs4_handle_exception(struct nfs_server *server, int errorcode, struct nfs4_ |
1775 | goto out_retry; |
1776 | } |
1777 | if (exception->recovering) { |
1778 | + if (exception->task_is_privileged) |
1779 | + return -EDEADLOCK; |
1780 | ret = nfs4_wait_clnt_recover(clp); |
1781 | if (test_bit(NFS_MIG_FAILED, &server->mig_status)) |
1782 | return -EIO; |
1783 | @@ -606,6 +608,8 @@ nfs4_async_handle_exception(struct rpc_task *task, struct nfs_server *server, |
1784 | goto out_retry; |
1785 | } |
1786 | if (exception->recovering) { |
1787 | + if (exception->task_is_privileged) |
1788 | + return -EDEADLOCK; |
1789 | rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL); |
1790 | if (test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) == 0) |
1791 | rpc_wake_up_queued_task(&clp->cl_rpcwaitq, task); |
1792 | @@ -5795,6 +5799,14 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen |
1793 | do { |
1794 | err = __nfs4_proc_set_acl(inode, buf, buflen); |
1795 | trace_nfs4_set_acl(inode, err); |
1796 | + if (err == -NFS4ERR_BADOWNER || err == -NFS4ERR_BADNAME) { |
1797 | + /* |
1798 | + * no need to retry since the kernel |
1799 | + * isn't involved in encoding the ACEs. |
1800 | + */ |
1801 | + err = -EINVAL; |
1802 | + break; |
1803 | + } |
1804 | err = nfs4_handle_exception(NFS_SERVER(inode), err, |
1805 | &exception); |
1806 | } while (exception.retry); |
1807 | @@ -6231,6 +6243,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata) |
1808 | struct nfs4_exception exception = { |
1809 | .inode = data->inode, |
1810 | .stateid = &data->stateid, |
1811 | + .task_is_privileged = data->args.seq_args.sa_privileged, |
1812 | }; |
1813 | |
1814 | if (!nfs4_sequence_done(task, &data->res.seq_res)) |
1815 | @@ -6349,7 +6362,6 @@ static int _nfs4_proc_delegreturn(struct inode *inode, const struct cred *cred, |
1816 | data = kzalloc(sizeof(*data), GFP_NOFS); |
1817 | if (data == NULL) |
1818 | return -ENOMEM; |
1819 | - nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1, 0); |
1820 | |
1821 | nfs4_state_protect(server->nfs_client, |
1822 | NFS_SP4_MACH_CRED_CLEANUP, |
1823 | @@ -6377,6 +6389,12 @@ static int _nfs4_proc_delegreturn(struct inode *inode, const struct cred *cred, |
1824 | } |
1825 | } |
1826 | |
1827 | + if (!data->inode) |
1828 | + nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1, |
1829 | + 1); |
1830 | + else |
1831 | + nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1, |
1832 | + 0); |
1833 | task_setup_data.callback_data = data; |
1834 | msg.rpc_argp = &data->args; |
1835 | msg.rpc_resp = &data->res; |
1836 | @@ -9332,15 +9350,20 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync) |
1837 | &task_setup_data.rpc_client, &msg); |
1838 | |
1839 | dprintk("--> %s\n", __func__); |
1840 | + lrp->inode = nfs_igrab_and_active(lrp->args.inode); |
1841 | if (!sync) { |
1842 | - lrp->inode = nfs_igrab_and_active(lrp->args.inode); |
1843 | if (!lrp->inode) { |
1844 | nfs4_layoutreturn_release(lrp); |
1845 | return -EAGAIN; |
1846 | } |
1847 | task_setup_data.flags |= RPC_TASK_ASYNC; |
1848 | } |
1849 | - nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1, 0); |
1850 | + if (!lrp->inode) |
1851 | + nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1, |
1852 | + 1); |
1853 | + else |
1854 | + nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1, |
1855 | + 0); |
1856 | task = rpc_run_task(&task_setup_data); |
1857 | if (IS_ERR(task)) |
1858 | return PTR_ERR(task); |
1859 | diff --git a/fs/proc/base.c b/fs/proc/base.c |
1860 | index 35114624fb036..75e786684a4e3 100644 |
1861 | --- a/fs/proc/base.c |
1862 | +++ b/fs/proc/base.c |
1863 | @@ -2527,6 +2527,13 @@ out: |
1864 | } |
1865 | |
1866 | #ifdef CONFIG_SECURITY |
1867 | +static int proc_pid_attr_open(struct inode *inode, struct file *file) |
1868 | +{ |
1869 | + file->private_data = NULL; |
1870 | + __mem_open(inode, file, PTRACE_MODE_READ_FSCREDS); |
1871 | + return 0; |
1872 | +} |
1873 | + |
1874 | static ssize_t proc_pid_attr_read(struct file * file, char __user * buf, |
1875 | size_t count, loff_t *ppos) |
1876 | { |
1877 | @@ -2557,7 +2564,7 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, |
1878 | int rv; |
1879 | |
1880 | /* A task may only write when it was the opener. */ |
1881 | - if (file->f_cred != current_real_cred()) |
1882 | + if (file->private_data != current->mm) |
1883 | return -EPERM; |
1884 | |
1885 | rcu_read_lock(); |
1886 | @@ -2607,9 +2614,11 @@ out: |
1887 | } |
1888 | |
1889 | static const struct file_operations proc_pid_attr_operations = { |
1890 | + .open = proc_pid_attr_open, |
1891 | .read = proc_pid_attr_read, |
1892 | .write = proc_pid_attr_write, |
1893 | .llseek = generic_file_llseek, |
1894 | + .release = mem_release, |
1895 | }; |
1896 | |
1897 | #define LSM_DIR_OPS(LSM) \ |
1898 | diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h |
1899 | index 8fe1912e3eeb9..1e037f894804b 100644 |
1900 | --- a/include/asm-generic/vmlinux.lds.h |
1901 | +++ b/include/asm-generic/vmlinux.lds.h |
1902 | @@ -882,6 +882,7 @@ |
1903 | #ifdef CONFIG_AMD_MEM_ENCRYPT |
1904 | #define PERCPU_DECRYPTED_SECTION \ |
1905 | . = ALIGN(PAGE_SIZE); \ |
1906 | + *(.data..decrypted) \ |
1907 | *(.data..percpu..decrypted) \ |
1908 | . = ALIGN(PAGE_SIZE); |
1909 | #else |
1910 | diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h |
1911 | index 0ec4ec428b9ba..a1ff6b76aa8cd 100644 |
1912 | --- a/include/linux/kvm_host.h |
1913 | +++ b/include/linux/kvm_host.h |
1914 | @@ -1045,7 +1045,15 @@ __gfn_to_memslot(struct kvm_memslots *slots, gfn_t gfn) |
1915 | static inline unsigned long |
1916 | __gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn) |
1917 | { |
1918 | - return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE; |
1919 | + /* |
1920 | + * The index was checked originally in search_memslots. To avoid |
1921 | + * that a malicious guest builds a Spectre gadget out of e.g. page |
1922 | + * table walks, do not let the processor speculate loads outside |
1923 | + * the guest's registered memslots. |
1924 | + */ |
1925 | + unsigned long offset = gfn - slot->base_gfn; |
1926 | + offset = array_index_nospec(offset, slot->npages); |
1927 | + return slot->userspace_addr + offset * PAGE_SIZE; |
1928 | } |
1929 | |
1930 | static inline int memslot_id(struct kvm *kvm, gfn_t gfn) |
1931 | diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h |
1932 | index 36e412c3d6570..35b4e324e17f2 100644 |
1933 | --- a/include/linux/mlx4/device.h |
1934 | +++ b/include/linux/mlx4/device.h |
1935 | @@ -632,6 +632,7 @@ struct mlx4_caps { |
1936 | bool wol_port[MLX4_MAX_PORTS + 1]; |
1937 | struct mlx4_rate_limit_caps rl_caps; |
1938 | u32 health_buffer_addrs; |
1939 | + bool map_clock_to_user; |
1940 | }; |
1941 | |
1942 | struct mlx4_buf_list { |
1943 | diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h |
1944 | index 6655ce32feff1..696230b536116 100644 |
1945 | --- a/include/linux/usb/pd.h |
1946 | +++ b/include/linux/usb/pd.h |
1947 | @@ -425,7 +425,7 @@ static inline unsigned int rdo_max_power(u32 rdo) |
1948 | #define PD_T_SENDER_RESPONSE 60 /* 24 - 30 ms, relaxed */ |
1949 | #define PD_T_SOURCE_ACTIVITY 45 |
1950 | #define PD_T_SINK_ACTIVITY 135 |
1951 | -#define PD_T_SINK_WAIT_CAP 240 |
1952 | +#define PD_T_SINK_WAIT_CAP 310 /* 310 - 620 ms */ |
1953 | #define PD_T_PS_TRANSITION 500 |
1954 | #define PD_T_SRC_TRANSITION 35 |
1955 | #define PD_T_DRP_SNK 40 |
1956 | diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c |
1957 | index 79682c23407c9..ae31b158baf73 100644 |
1958 | --- a/kernel/cgroup/cgroup-v1.c |
1959 | +++ b/kernel/cgroup/cgroup-v1.c |
1960 | @@ -821,6 +821,10 @@ static int cgroup1_rename(struct kernfs_node *kn, struct kernfs_node *new_parent |
1961 | struct cgroup *cgrp = kn->priv; |
1962 | int ret; |
1963 | |
1964 | + /* do not accept '\n' to prevent making /proc/<pid>/cgroup unparsable */ |
1965 | + if (strchr(new_name_str, '\n')) |
1966 | + return -EINVAL; |
1967 | + |
1968 | if (kernfs_type(kn) != KERNFS_DIR) |
1969 | return -ENOTDIR; |
1970 | if (kn->parent != new_parent) |
1971 | diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c |
1972 | index 37db8eba149ac..ede370ec245d9 100644 |
1973 | --- a/kernel/cgroup/cgroup.c |
1974 | +++ b/kernel/cgroup/cgroup.c |
1975 | @@ -5721,8 +5721,6 @@ int __init cgroup_init_early(void) |
1976 | return 0; |
1977 | } |
1978 | |
1979 | -static u16 cgroup_disable_mask __initdata; |
1980 | - |
1981 | /** |
1982 | * cgroup_init - cgroup initialization |
1983 | * |
1984 | @@ -5781,12 +5779,8 @@ int __init cgroup_init(void) |
1985 | * disabled flag and cftype registration needs kmalloc, |
1986 | * both of which aren't available during early_init. |
1987 | */ |
1988 | - if (cgroup_disable_mask & (1 << ssid)) { |
1989 | - static_branch_disable(cgroup_subsys_enabled_key[ssid]); |
1990 | - printk(KERN_INFO "Disabling %s control group subsystem\n", |
1991 | - ss->name); |
1992 | + if (!cgroup_ssid_enabled(ssid)) |
1993 | continue; |
1994 | - } |
1995 | |
1996 | if (cgroup1_ssid_disabled(ssid)) |
1997 | printk(KERN_INFO "Disabling %s control group subsystem in v1 mounts\n", |
1998 | @@ -6173,7 +6167,10 @@ static int __init cgroup_disable(char *str) |
1999 | if (strcmp(token, ss->name) && |
2000 | strcmp(token, ss->legacy_name)) |
2001 | continue; |
2002 | - cgroup_disable_mask |= 1 << i; |
2003 | + |
2004 | + static_branch_disable(cgroup_subsys_enabled_key[i]); |
2005 | + pr_info("Disabling %s control group subsystem\n", |
2006 | + ss->name); |
2007 | } |
2008 | } |
2009 | return 1; |
2010 | diff --git a/kernel/events/core.c b/kernel/events/core.c |
2011 | index ec1add9e7f3a3..2f848123cdae8 100644 |
2012 | --- a/kernel/events/core.c |
2013 | +++ b/kernel/events/core.c |
2014 | @@ -4249,7 +4249,9 @@ find_get_context(struct pmu *pmu, struct task_struct *task, |
2015 | cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu); |
2016 | ctx = &cpuctx->ctx; |
2017 | get_ctx(ctx); |
2018 | + raw_spin_lock_irqsave(&ctx->lock, flags); |
2019 | ++ctx->pin_count; |
2020 | + raw_spin_unlock_irqrestore(&ctx->lock, flags); |
2021 | |
2022 | return ctx; |
2023 | } |
2024 | diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
2025 | index 092aa5e47251a..d3f4113e87ded 100644 |
2026 | --- a/kernel/sched/fair.c |
2027 | +++ b/kernel/sched/fair.c |
2028 | @@ -7660,7 +7660,7 @@ static bool __update_blocked_fair(struct rq *rq, bool *done) |
2029 | /* Propagate pending load changes to the parent, if any: */ |
2030 | se = cfs_rq->tg->se[cpu]; |
2031 | if (se && !skip_blocked_update(se)) |
2032 | - update_load_avg(cfs_rq_of(se), se, 0); |
2033 | + update_load_avg(cfs_rq_of(se), se, UPDATE_TG); |
2034 | |
2035 | /* |
2036 | * There can be a lot of idle CPU cgroups. Don't let fully |
2037 | diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
2038 | index 74b5c36d7759a..2b55016d5164b 100644 |
2039 | --- a/kernel/trace/ftrace.c |
2040 | +++ b/kernel/trace/ftrace.c |
2041 | @@ -1953,12 +1953,18 @@ static int ftrace_hash_ipmodify_update(struct ftrace_ops *ops, |
2042 | |
2043 | static void print_ip_ins(const char *fmt, const unsigned char *p) |
2044 | { |
2045 | + char ins[MCOUNT_INSN_SIZE]; |
2046 | int i; |
2047 | |
2048 | + if (probe_kernel_read(ins, p, MCOUNT_INSN_SIZE)) { |
2049 | + printk(KERN_CONT "%s[FAULT] %px\n", fmt, p); |
2050 | + return; |
2051 | + } |
2052 | + |
2053 | printk(KERN_CONT "%s", fmt); |
2054 | |
2055 | for (i = 0; i < MCOUNT_INSN_SIZE; i++) |
2056 | - printk(KERN_CONT "%s%02x", i ? ":" : "", p[i]); |
2057 | + printk(KERN_CONT "%s%02x", i ? ":" : "", ins[i]); |
2058 | } |
2059 | |
2060 | enum ftrace_bug_type ftrace_bug_type; |
2061 | diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
2062 | index 5eaa46fe9ed63..1baa284a27533 100644 |
2063 | --- a/kernel/trace/trace.c |
2064 | +++ b/kernel/trace/trace.c |
2065 | @@ -2487,7 +2487,7 @@ trace_event_buffer_lock_reserve(struct ring_buffer **current_rb, |
2066 | (entry = this_cpu_read(trace_buffered_event))) { |
2067 | /* Try to use the per cpu buffer first */ |
2068 | val = this_cpu_inc_return(trace_buffered_event_cnt); |
2069 | - if ((len < (PAGE_SIZE - sizeof(*entry))) && val == 1) { |
2070 | + if ((len < (PAGE_SIZE - sizeof(*entry) - sizeof(entry->array[0]))) && val == 1) { |
2071 | trace_event_setup(entry, type, flags, pc); |
2072 | entry->array[0] = len; |
2073 | return entry; |
2074 | diff --git a/kernel/workqueue.c b/kernel/workqueue.c |
2075 | index 5d7092e32912e..8f41499d8257d 100644 |
2076 | --- a/kernel/workqueue.c |
2077 | +++ b/kernel/workqueue.c |
2078 | @@ -50,6 +50,7 @@ |
2079 | #include <linux/uaccess.h> |
2080 | #include <linux/sched/isolation.h> |
2081 | #include <linux/nmi.h> |
2082 | +#include <linux/kvm_para.h> |
2083 | |
2084 | #include "workqueue_internal.h" |
2085 | |
2086 | @@ -5734,6 +5735,7 @@ static void wq_watchdog_timer_fn(struct timer_list *unused) |
2087 | { |
2088 | unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ; |
2089 | bool lockup_detected = false; |
2090 | + unsigned long now = jiffies; |
2091 | struct worker_pool *pool; |
2092 | int pi; |
2093 | |
2094 | @@ -5748,6 +5750,12 @@ static void wq_watchdog_timer_fn(struct timer_list *unused) |
2095 | if (list_empty(&pool->worklist)) |
2096 | continue; |
2097 | |
2098 | + /* |
2099 | + * If a virtual machine is stopped by the host it can look to |
2100 | + * the watchdog like a stall. |
2101 | + */ |
2102 | + kvm_check_and_clear_guest_paused(); |
2103 | + |
2104 | /* get the latest of pool and touched timestamps */ |
2105 | pool_ts = READ_ONCE(pool->watchdog_ts); |
2106 | touched = READ_ONCE(wq_watchdog_touched); |
2107 | @@ -5766,12 +5774,12 @@ static void wq_watchdog_timer_fn(struct timer_list *unused) |
2108 | } |
2109 | |
2110 | /* did we stall? */ |
2111 | - if (time_after(jiffies, ts + thresh)) { |
2112 | + if (time_after(now, ts + thresh)) { |
2113 | lockup_detected = true; |
2114 | pr_emerg("BUG: workqueue lockup - pool"); |
2115 | pr_cont_pool_info(pool); |
2116 | pr_cont(" stuck for %us!\n", |
2117 | - jiffies_to_msecs(jiffies - pool_ts) / 1000); |
2118 | + jiffies_to_msecs(now - pool_ts) / 1000); |
2119 | } |
2120 | } |
2121 | |
2122 | diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c |
2123 | index c2a5174387fff..9d993b4cf1aff 100644 |
2124 | --- a/net/netlink/af_netlink.c |
2125 | +++ b/net/netlink/af_netlink.c |
2126 | @@ -452,11 +452,13 @@ void netlink_table_ungrab(void) |
2127 | static inline void |
2128 | netlink_lock_table(void) |
2129 | { |
2130 | + unsigned long flags; |
2131 | + |
2132 | /* read_lock() synchronizes us to netlink_table_grab */ |
2133 | |
2134 | - read_lock(&nl_table_lock); |
2135 | + read_lock_irqsave(&nl_table_lock, flags); |
2136 | atomic_inc(&nl_table_users); |
2137 | - read_unlock(&nl_table_lock); |
2138 | + read_unlock_irqrestore(&nl_table_lock, flags); |
2139 | } |
2140 | |
2141 | static inline void |
2142 | diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c |
2143 | index 23d5e56306a4c..8d649f4aee79c 100644 |
2144 | --- a/net/nfc/rawsock.c |
2145 | +++ b/net/nfc/rawsock.c |
2146 | @@ -333,7 +333,7 @@ static int rawsock_create(struct net *net, struct socket *sock, |
2147 | return -ESOCKTNOSUPPORT; |
2148 | |
2149 | if (sock->type == SOCK_RAW) { |
2150 | - if (!capable(CAP_NET_RAW)) |
2151 | + if (!ns_capable(net->user_ns, CAP_NET_RAW)) |
2152 | return -EPERM; |
2153 | sock->ops = &rawsock_raw_ops; |
2154 | } else { |
2155 | diff --git a/net/rds/connection.c b/net/rds/connection.c |
2156 | index ed7f2133acc2f..c85bd6340eaa7 100644 |
2157 | --- a/net/rds/connection.c |
2158 | +++ b/net/rds/connection.c |
2159 | @@ -240,12 +240,23 @@ static struct rds_connection *__rds_conn_create(struct net *net, |
2160 | if (loop_trans) { |
2161 | rds_trans_put(loop_trans); |
2162 | conn->c_loopback = 1; |
2163 | - if (is_outgoing && trans->t_prefer_loopback) { |
2164 | - /* "outgoing" connection - and the transport |
2165 | - * says it wants the connection handled by the |
2166 | - * loopback transport. This is what TCP does. |
2167 | - */ |
2168 | - trans = &rds_loop_transport; |
2169 | + if (trans->t_prefer_loopback) { |
2170 | + if (likely(is_outgoing)) { |
2171 | + /* "outgoing" connection to local address. |
2172 | + * Protocol says it wants the connection |
2173 | + * handled by the loopback transport. |
2174 | + * This is what TCP does. |
2175 | + */ |
2176 | + trans = &rds_loop_transport; |
2177 | + } else { |
2178 | + /* No transport currently in use |
2179 | + * should end up here, but if it |
2180 | + * does, reset/destroy the connection. |
2181 | + */ |
2182 | + kmem_cache_free(rds_conn_slab, conn); |
2183 | + conn = ERR_PTR(-EOPNOTSUPP); |
2184 | + goto out; |
2185 | + } |
2186 | } |
2187 | } |
2188 | |
2189 | diff --git a/net/rds/tcp.c b/net/rds/tcp.c |
2190 | index 66121bc6f34ef..1402e9166a7eb 100644 |
2191 | --- a/net/rds/tcp.c |
2192 | +++ b/net/rds/tcp.c |
2193 | @@ -323,8 +323,8 @@ out: |
2194 | } |
2195 | #endif |
2196 | |
2197 | -static int rds_tcp_laddr_check(struct net *net, const struct in6_addr *addr, |
2198 | - __u32 scope_id) |
2199 | +int rds_tcp_laddr_check(struct net *net, const struct in6_addr *addr, |
2200 | + __u32 scope_id) |
2201 | { |
2202 | struct net_device *dev = NULL; |
2203 | #if IS_ENABLED(CONFIG_IPV6) |
2204 | diff --git a/net/rds/tcp.h b/net/rds/tcp.h |
2205 | index 3c69361d21c73..4620549ecbebe 100644 |
2206 | --- a/net/rds/tcp.h |
2207 | +++ b/net/rds/tcp.h |
2208 | @@ -60,7 +60,8 @@ u32 rds_tcp_snd_una(struct rds_tcp_connection *tc); |
2209 | u64 rds_tcp_map_seq(struct rds_tcp_connection *tc, u32 seq); |
2210 | extern struct rds_transport rds_tcp_transport; |
2211 | void rds_tcp_accept_work(struct sock *sk); |
2212 | - |
2213 | +int rds_tcp_laddr_check(struct net *net, const struct in6_addr *addr, |
2214 | + __u32 scope_id); |
2215 | /* tcp_connect.c */ |
2216 | int rds_tcp_conn_path_connect(struct rds_conn_path *cp); |
2217 | void rds_tcp_conn_path_shutdown(struct rds_conn_path *conn); |
2218 | diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c |
2219 | index 810a3a49e9474..26a3e18e460d9 100644 |
2220 | --- a/net/rds/tcp_listen.c |
2221 | +++ b/net/rds/tcp_listen.c |
2222 | @@ -198,6 +198,12 @@ int rds_tcp_accept_one(struct socket *sock) |
2223 | } |
2224 | #endif |
2225 | |
2226 | + if (!rds_tcp_laddr_check(sock_net(sock->sk), peer_addr, dev_if)) { |
2227 | + /* local address connection is only allowed via loopback */ |
2228 | + ret = -EOPNOTSUPP; |
2229 | + goto out; |
2230 | + } |
2231 | + |
2232 | conn = rds_conn_create(sock_net(sock->sk), |
2233 | my_addr, peer_addr, |
2234 | &rds_tcp_transport, 0, GFP_KERNEL, dev_if); |
2235 | diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c |
2236 | index f031d2caa8b77..fa4cdbfd0b80d 100644 |
2237 | --- a/sound/soc/codecs/max98088.c |
2238 | +++ b/sound/soc/codecs/max98088.c |
2239 | @@ -41,6 +41,7 @@ struct max98088_priv { |
2240 | enum max98088_type devtype; |
2241 | struct max98088_pdata *pdata; |
2242 | struct clk *mclk; |
2243 | + unsigned char mclk_prescaler; |
2244 | unsigned int sysclk; |
2245 | struct max98088_cdata dai[2]; |
2246 | int eq_textcnt; |
2247 | @@ -998,13 +999,16 @@ static int max98088_dai1_hw_params(struct snd_pcm_substream *substream, |
2248 | /* Configure NI when operating as master */ |
2249 | if (snd_soc_component_read32(component, M98088_REG_14_DAI1_FORMAT) |
2250 | & M98088_DAI_MAS) { |
2251 | + unsigned long pclk; |
2252 | + |
2253 | if (max98088->sysclk == 0) { |
2254 | dev_err(component->dev, "Invalid system clock frequency\n"); |
2255 | return -EINVAL; |
2256 | } |
2257 | ni = 65536ULL * (rate < 50000 ? 96ULL : 48ULL) |
2258 | * (unsigned long long int)rate; |
2259 | - do_div(ni, (unsigned long long int)max98088->sysclk); |
2260 | + pclk = DIV_ROUND_CLOSEST(max98088->sysclk, max98088->mclk_prescaler); |
2261 | + ni = DIV_ROUND_CLOSEST_ULL(ni, pclk); |
2262 | snd_soc_component_write(component, M98088_REG_12_DAI1_CLKCFG_HI, |
2263 | (ni >> 8) & 0x7F); |
2264 | snd_soc_component_write(component, M98088_REG_13_DAI1_CLKCFG_LO, |
2265 | @@ -1065,13 +1069,16 @@ static int max98088_dai2_hw_params(struct snd_pcm_substream *substream, |
2266 | /* Configure NI when operating as master */ |
2267 | if (snd_soc_component_read32(component, M98088_REG_1C_DAI2_FORMAT) |
2268 | & M98088_DAI_MAS) { |
2269 | + unsigned long pclk; |
2270 | + |
2271 | if (max98088->sysclk == 0) { |
2272 | dev_err(component->dev, "Invalid system clock frequency\n"); |
2273 | return -EINVAL; |
2274 | } |
2275 | ni = 65536ULL * (rate < 50000 ? 96ULL : 48ULL) |
2276 | * (unsigned long long int)rate; |
2277 | - do_div(ni, (unsigned long long int)max98088->sysclk); |
2278 | + pclk = DIV_ROUND_CLOSEST(max98088->sysclk, max98088->mclk_prescaler); |
2279 | + ni = DIV_ROUND_CLOSEST_ULL(ni, pclk); |
2280 | snd_soc_component_write(component, M98088_REG_1A_DAI2_CLKCFG_HI, |
2281 | (ni >> 8) & 0x7F); |
2282 | snd_soc_component_write(component, M98088_REG_1B_DAI2_CLKCFG_LO, |
2283 | @@ -1113,8 +1120,10 @@ static int max98088_dai_set_sysclk(struct snd_soc_dai *dai, |
2284 | */ |
2285 | if ((freq >= 10000000) && (freq < 20000000)) { |
2286 | snd_soc_component_write(component, M98088_REG_10_SYS_CLK, 0x10); |
2287 | + max98088->mclk_prescaler = 1; |
2288 | } else if ((freq >= 20000000) && (freq < 30000000)) { |
2289 | snd_soc_component_write(component, M98088_REG_10_SYS_CLK, 0x20); |
2290 | + max98088->mclk_prescaler = 2; |
2291 | } else { |
2292 | dev_err(component->dev, "Invalid master clock frequency\n"); |
2293 | return -EINVAL; |
2294 | diff --git a/sound/soc/codecs/sti-sas.c b/sound/soc/codecs/sti-sas.c |
2295 | index ec9933b054ad3..423daac9d5a9f 100644 |
2296 | --- a/sound/soc/codecs/sti-sas.c |
2297 | +++ b/sound/soc/codecs/sti-sas.c |
2298 | @@ -411,6 +411,7 @@ static const struct of_device_id sti_sas_dev_match[] = { |
2299 | }, |
2300 | {}, |
2301 | }; |
2302 | +MODULE_DEVICE_TABLE(of, sti_sas_dev_match); |
2303 | |
2304 | static int sti_sas_driver_probe(struct platform_device *pdev) |
2305 | { |
2306 | diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c |
2307 | index 46a81d4f0b2de..c67b86e2d0c0a 100644 |
2308 | --- a/sound/soc/intel/boards/bytcr_rt5640.c |
2309 | +++ b/sound/soc/intel/boards/bytcr_rt5640.c |
2310 | @@ -568,6 +568,17 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { |
2311 | BYT_RT5640_SSP0_AIF1 | |
2312 | BYT_RT5640_MCLK_EN), |
2313 | }, |
2314 | + { /* Glavey TM800A550L */ |
2315 | + .matches = { |
2316 | + DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), |
2317 | + DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"), |
2318 | + /* Above strings are too generic, also match on BIOS version */ |
2319 | + DMI_MATCH(DMI_BIOS_VERSION, "ZY-8-BI-PX4S70VTR400-X423B-005-D"), |
2320 | + }, |
2321 | + .driver_data = (void *)(BYTCR_INPUT_DEFAULTS | |
2322 | + BYT_RT5640_SSP0_AIF1 | |
2323 | + BYT_RT5640_MCLK_EN), |
2324 | + }, |
2325 | { |
2326 | .matches = { |
2327 | DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), |
2328 | @@ -635,6 +646,20 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { |
2329 | BYT_RT5640_MONO_SPEAKER | |
2330 | BYT_RT5640_MCLK_EN), |
2331 | }, |
2332 | + { /* Lenovo Miix 3-830 */ |
2333 | + .matches = { |
2334 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
2335 | + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 3-830"), |
2336 | + }, |
2337 | + .driver_data = (void *)(BYT_RT5640_IN1_MAP | |
2338 | + BYT_RT5640_JD_SRC_JD2_IN4N | |
2339 | + BYT_RT5640_OVCD_TH_2000UA | |
2340 | + BYT_RT5640_OVCD_SF_0P75 | |
2341 | + BYT_RT5640_MONO_SPEAKER | |
2342 | + BYT_RT5640_DIFF_MIC | |
2343 | + BYT_RT5640_SSP0_AIF1 | |
2344 | + BYT_RT5640_MCLK_EN), |
2345 | + }, |
2346 | { /* Linx Linx7 tablet */ |
2347 | .matches = { |
2348 | DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LINX"), |
2349 | diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c |
2350 | index 56f3039fe2a71..8ff2c98e90322 100644 |
2351 | --- a/tools/perf/util/session.c |
2352 | +++ b/tools/perf/util/session.c |
2353 | @@ -1631,6 +1631,7 @@ int perf_session__peek_event(struct perf_session *session, off_t file_offset, |
2354 | if (event->header.size < hdr_sz || event->header.size > buf_sz) |
2355 | return -1; |
2356 | |
2357 | + buf += hdr_sz; |
2358 | rest = event->header.size - hdr_sz; |
2359 | |
2360 | if (readn(fd, buf, rest) != (ssize_t)rest) |