Contents of /trunk/kernel-alx-legacy/patches-4.9/0396-4.9.297-all-fixes.patch
Parent Directory | Revision Log
Revision 3698 -
(show annotations)
(download)
Mon Oct 24 14:08:12 2022 UTC (18 months, 1 week ago) by niro
File size: 29347 byte(s)
Mon Oct 24 14:08:12 2022 UTC (18 months, 1 week ago) by niro
File size: 29347 byte(s)
-linux-4.9.297
1 | diff --git a/Makefile b/Makefile |
2 | index 1ec880bcdb2d6..70a11157b2404 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,6 +1,6 @@ |
6 | VERSION = 4 |
7 | PATCHLEVEL = 9 |
8 | -SUBLEVEL = 296 |
9 | +SUBLEVEL = 297 |
10 | EXTRAVERSION = |
11 | NAME = Roaring Lionus |
12 | |
13 | diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h |
14 | index 88bbe364b6ae0..ae1b31d02784c 100644 |
15 | --- a/arch/arm64/include/asm/sysreg.h |
16 | +++ b/arch/arm64/include/asm/sysreg.h |
17 | @@ -20,6 +20,7 @@ |
18 | #ifndef __ASM_SYSREG_H |
19 | #define __ASM_SYSREG_H |
20 | |
21 | +#include <asm/compiler.h> |
22 | #include <linux/stringify.h> |
23 | |
24 | #include <asm/opcodes.h> |
25 | @@ -88,25 +89,81 @@ |
26 | |
27 | /* Common SCTLR_ELx flags. */ |
28 | #define SCTLR_ELx_EE (1 << 25) |
29 | +#define SCTLR_ELx_WXN (1 << 19) |
30 | #define SCTLR_ELx_I (1 << 12) |
31 | #define SCTLR_ELx_SA (1 << 3) |
32 | #define SCTLR_ELx_C (1 << 2) |
33 | #define SCTLR_ELx_A (1 << 1) |
34 | #define SCTLR_ELx_M 1 |
35 | |
36 | -#define SCTLR_EL2_RES1 ((1 << 4) | (1 << 5) | (1 << 11) | (1 << 16) | \ |
37 | - (1 << 16) | (1 << 18) | (1 << 22) | (1 << 23) | \ |
38 | - (1 << 28) | (1 << 29)) |
39 | - |
40 | #define SCTLR_ELx_FLAGS (SCTLR_ELx_M | SCTLR_ELx_A | SCTLR_ELx_C | \ |
41 | SCTLR_ELx_SA | SCTLR_ELx_I) |
42 | |
43 | +/* SCTLR_EL2 specific flags. */ |
44 | +#define SCTLR_EL2_RES1 ((1 << 4) | (1 << 5) | (1 << 11) | (1 << 16) | \ |
45 | + (1 << 18) | (1 << 22) | (1 << 23) | (1 << 28) | \ |
46 | + (1 << 29)) |
47 | +#define SCTLR_EL2_RES0 ((1 << 6) | (1 << 7) | (1 << 8) | (1 << 9) | \ |
48 | + (1 << 10) | (1 << 13) | (1 << 14) | (1 << 15) | \ |
49 | + (1 << 17) | (1 << 20) | (1 << 21) | (1 << 24) | \ |
50 | + (1 << 26) | (1 << 27) | (1 << 30) | (1 << 31)) |
51 | + |
52 | +#ifdef CONFIG_CPU_BIG_ENDIAN |
53 | +#define ENDIAN_SET_EL2 SCTLR_ELx_EE |
54 | +#define ENDIAN_CLEAR_EL2 0 |
55 | +#else |
56 | +#define ENDIAN_SET_EL2 0 |
57 | +#define ENDIAN_CLEAR_EL2 SCTLR_ELx_EE |
58 | +#endif |
59 | + |
60 | +/* SCTLR_EL2 value used for the hyp-stub */ |
61 | +#define SCTLR_EL2_SET (ENDIAN_SET_EL2 | SCTLR_EL2_RES1) |
62 | +#define SCTLR_EL2_CLEAR (SCTLR_ELx_M | SCTLR_ELx_A | SCTLR_ELx_C | \ |
63 | + SCTLR_ELx_SA | SCTLR_ELx_I | SCTLR_ELx_WXN | \ |
64 | + ENDIAN_CLEAR_EL2 | SCTLR_EL2_RES0) |
65 | + |
66 | +/* Check all the bits are accounted for */ |
67 | +#define SCTLR_EL2_BUILD_BUG_ON_MISSING_BITS BUILD_BUG_ON((SCTLR_EL2_SET ^ SCTLR_EL2_CLEAR) != ~0) |
68 | + |
69 | + |
70 | /* SCTLR_EL1 specific flags. */ |
71 | #define SCTLR_EL1_UCI (1 << 26) |
72 | +#define SCTLR_EL1_E0E (1 << 24) |
73 | #define SCTLR_EL1_SPAN (1 << 23) |
74 | +#define SCTLR_EL1_NTWE (1 << 18) |
75 | +#define SCTLR_EL1_NTWI (1 << 16) |
76 | #define SCTLR_EL1_UCT (1 << 15) |
77 | +#define SCTLR_EL1_DZE (1 << 14) |
78 | +#define SCTLR_EL1_UMA (1 << 9) |
79 | #define SCTLR_EL1_SED (1 << 8) |
80 | +#define SCTLR_EL1_ITD (1 << 7) |
81 | #define SCTLR_EL1_CP15BEN (1 << 5) |
82 | +#define SCTLR_EL1_SA0 (1 << 4) |
83 | + |
84 | +#define SCTLR_EL1_RES1 ((1 << 11) | (1 << 20) | (1 << 22) | (1 << 28) | \ |
85 | + (1 << 29)) |
86 | +#define SCTLR_EL1_RES0 ((1 << 6) | (1 << 10) | (1 << 13) | (1 << 17) | \ |
87 | + (1 << 21) | (1 << 27) | (1 << 30) | (1 << 31)) |
88 | + |
89 | +#ifdef CONFIG_CPU_BIG_ENDIAN |
90 | +#define ENDIAN_SET_EL1 (SCTLR_EL1_E0E | SCTLR_ELx_EE) |
91 | +#define ENDIAN_CLEAR_EL1 0 |
92 | +#else |
93 | +#define ENDIAN_SET_EL1 0 |
94 | +#define ENDIAN_CLEAR_EL1 (SCTLR_EL1_E0E | SCTLR_ELx_EE) |
95 | +#endif |
96 | + |
97 | +#define SCTLR_EL1_SET (SCTLR_ELx_M | SCTLR_ELx_C | SCTLR_ELx_SA |\ |
98 | + SCTLR_EL1_SA0 | SCTLR_EL1_SED | SCTLR_ELx_I |\ |
99 | + SCTLR_EL1_DZE | SCTLR_EL1_UCT | SCTLR_EL1_NTWI |\ |
100 | + SCTLR_EL1_NTWE | SCTLR_EL1_SPAN | ENDIAN_SET_EL1 |\ |
101 | + SCTLR_EL1_UCI | SCTLR_EL1_RES1) |
102 | +#define SCTLR_EL1_CLEAR (SCTLR_ELx_A | SCTLR_EL1_CP15BEN | SCTLR_EL1_ITD |\ |
103 | + SCTLR_EL1_UMA | SCTLR_ELx_WXN | ENDIAN_CLEAR_EL1 |\ |
104 | + SCTLR_EL1_RES0) |
105 | + |
106 | +/* Check all the bits are accounted for */ |
107 | +#define SCTLR_EL1_BUILD_BUG_ON_MISSING_BITS BUILD_BUG_ON((SCTLR_EL1_SET ^ SCTLR_EL1_CLEAR) != ~0) |
108 | |
109 | /* id_aa64isar0 */ |
110 | #define ID_AA64ISAR0_RDM_SHIFT 28 |
111 | @@ -244,6 +301,7 @@ |
112 | |
113 | #else |
114 | |
115 | +#include <linux/build_bug.h> |
116 | #include <linux/types.h> |
117 | |
118 | asm( |
119 | @@ -300,6 +358,9 @@ static inline void config_sctlr_el1(u32 clear, u32 set) |
120 | { |
121 | u32 val; |
122 | |
123 | + SCTLR_EL2_BUILD_BUG_ON_MISSING_BITS; |
124 | + SCTLR_EL1_BUILD_BUG_ON_MISSING_BITS; |
125 | + |
126 | val = read_sysreg(sctlr_el1); |
127 | val &= ~clear; |
128 | val |= set; |
129 | diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S |
130 | index 3875423836622..04f81675b6b3a 100644 |
131 | --- a/arch/arm64/kernel/head.S |
132 | +++ b/arch/arm64/kernel/head.S |
133 | @@ -489,21 +489,16 @@ ENTRY(el2_setup) |
134 | msr SPsel, #1 // We want to use SP_EL{1,2} |
135 | mrs x0, CurrentEL |
136 | cmp x0, #CurrentEL_EL2 |
137 | - b.ne 1f |
138 | - mrs x0, sctlr_el2 |
139 | -CPU_BE( orr x0, x0, #(1 << 25) ) // Set the EE bit for EL2 |
140 | -CPU_LE( bic x0, x0, #(1 << 25) ) // Clear the EE bit for EL2 |
141 | - msr sctlr_el2, x0 |
142 | - b 2f |
143 | -1: mrs x0, sctlr_el1 |
144 | -CPU_BE( orr x0, x0, #(3 << 24) ) // Set the EE and E0E bits for EL1 |
145 | -CPU_LE( bic x0, x0, #(3 << 24) ) // Clear the EE and E0E bits for EL1 |
146 | + b.eq 1f |
147 | + mov_q x0, (SCTLR_EL1_RES1 | ENDIAN_SET_EL1) |
148 | msr sctlr_el1, x0 |
149 | mov w0, #BOOT_CPU_MODE_EL1 // This cpu booted in EL1 |
150 | isb |
151 | ret |
152 | |
153 | -2: |
154 | +1: mov_q x0, (SCTLR_EL2_RES1 | ENDIAN_SET_EL2) |
155 | + msr sctlr_el2, x0 |
156 | + |
157 | #ifdef CONFIG_ARM64_VHE |
158 | /* |
159 | * Check for VHE being present. For the rest of the EL2 setup, |
160 | @@ -554,26 +549,6 @@ set_hcr: |
161 | msr vpidr_el2, x0 |
162 | msr vmpidr_el2, x1 |
163 | |
164 | - /* |
165 | - * When VHE is not in use, early init of EL2 and EL1 needs to be |
166 | - * done here. |
167 | - * When VHE _is_ in use, EL1 will not be used in the host and |
168 | - * requires no configuration, and all non-hyp-specific EL2 setup |
169 | - * will be done via the _EL1 system register aliases in __cpu_setup. |
170 | - */ |
171 | - cbnz x2, 1f |
172 | - |
173 | - /* sctlr_el1 */ |
174 | - mov x0, #0x0800 // Set/clear RES{1,0} bits |
175 | -CPU_BE( movk x0, #0x33d0, lsl #16 ) // Set EE and E0E on BE systems |
176 | -CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems |
177 | - msr sctlr_el1, x0 |
178 | - |
179 | - /* Coprocessor traps. */ |
180 | - mov x0, #0x33ff |
181 | - msr cptr_el2, x0 // Disable copro. traps to EL2 |
182 | -1: |
183 | - |
184 | #ifdef CONFIG_COMPAT |
185 | msr hstr_el2, xzr // Disable CP15 traps to EL2 |
186 | #endif |
187 | @@ -599,6 +574,20 @@ CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems |
188 | ret |
189 | |
190 | install_el2_stub: |
191 | + /* |
192 | + * When VHE is not in use, early init of EL2 and EL1 needs to be |
193 | + * done here. |
194 | + * When VHE _is_ in use, EL1 will not be used in the host and |
195 | + * requires no configuration, and all non-hyp-specific EL2 setup |
196 | + * will be done via the _EL1 system register aliases in __cpu_setup. |
197 | + */ |
198 | + mov_q x0, (SCTLR_EL1_RES1 | ENDIAN_SET_EL1) |
199 | + msr sctlr_el1, x0 |
200 | + |
201 | + /* Coprocessor traps. */ |
202 | + mov x0, #0x33ff |
203 | + msr cptr_el2, x0 // Disable copro. traps to EL2 |
204 | + |
205 | /* Hypervisor stub */ |
206 | adrp x0, __hyp_stub_vectors |
207 | add x0, x0, #:lo12:__hyp_stub_vectors |
208 | diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S |
209 | index 1b91b8c8999bc..266211a0ecd6d 100644 |
210 | --- a/arch/arm64/mm/proc.S |
211 | +++ b/arch/arm64/mm/proc.S |
212 | @@ -413,11 +413,7 @@ ENTRY(__cpu_setup) |
213 | /* |
214 | * Prepare SCTLR |
215 | */ |
216 | - adr x5, crval |
217 | - ldp w5, w6, [x5] |
218 | - mrs x0, sctlr_el1 |
219 | - bic x0, x0, x5 // clear bits |
220 | - orr x0, x0, x6 // set bits |
221 | + mov_q x0, SCTLR_EL1_SET |
222 | /* |
223 | * Set/prepare TCR and TTBR. We use 512GB (39-bit) address range for |
224 | * both user and kernel. |
225 | @@ -453,21 +449,3 @@ ENTRY(__cpu_setup) |
226 | msr tcr_el1, x10 |
227 | ret // return to head.S |
228 | ENDPROC(__cpu_setup) |
229 | - |
230 | - /* |
231 | - * We set the desired value explicitly, including those of the |
232 | - * reserved bits. The values of bits EE & E0E were set early in |
233 | - * el2_setup, which are left untouched below. |
234 | - * |
235 | - * n n T |
236 | - * U E WT T UD US IHBS |
237 | - * CE0 XWHW CZ ME TEEA S |
238 | - * .... .IEE .... NEAI TE.I ..AD DEN0 ACAM |
239 | - * 0011 0... 1101 ..0. ..0. 10.. .0.. .... < hardware reserved |
240 | - * .... .1.. .... 01.1 11.1 ..01 0.01 1101 < software settings |
241 | - */ |
242 | - .type crval, #object |
243 | -crval: |
244 | - .word 0xfcffffff // clear |
245 | - .word 0x34d5d91d // set |
246 | - .popsection |
247 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
248 | index 30c09b9ddbf0d..2069080191eeb 100644 |
249 | --- a/drivers/bluetooth/btusb.c |
250 | +++ b/drivers/bluetooth/btusb.c |
251 | @@ -2442,11 +2442,9 @@ static const struct qca_device_info qca_devices_table[] = { |
252 | { 0x00000302, 28, 4, 18 }, /* Rome 3.2 */ |
253 | }; |
254 | |
255 | -static int btusb_qca_send_vendor_req(struct hci_dev *hdev, u8 request, |
256 | +static int btusb_qca_send_vendor_req(struct usb_device *udev, u8 request, |
257 | void *data, u16 size) |
258 | { |
259 | - struct btusb_data *btdata = hci_get_drvdata(hdev); |
260 | - struct usb_device *udev = btdata->udev; |
261 | int pipe, err; |
262 | u8 *buf; |
263 | |
264 | @@ -2461,7 +2459,7 @@ static int btusb_qca_send_vendor_req(struct hci_dev *hdev, u8 request, |
265 | err = usb_control_msg(udev, pipe, request, USB_TYPE_VENDOR | USB_DIR_IN, |
266 | 0, 0, buf, size, USB_CTRL_SET_TIMEOUT); |
267 | if (err < 0) { |
268 | - BT_ERR("%s: Failed to access otp area (%d)", hdev->name, err); |
269 | + dev_err(&udev->dev, "Failed to access otp area (%d)", err); |
270 | goto done; |
271 | } |
272 | |
273 | @@ -2617,20 +2615,38 @@ static int btusb_setup_qca_load_nvm(struct hci_dev *hdev, |
274 | return err; |
275 | } |
276 | |
277 | +/* identify the ROM version and check whether patches are needed */ |
278 | +static bool btusb_qca_need_patch(struct usb_device *udev) |
279 | +{ |
280 | + struct qca_version ver; |
281 | + |
282 | + if (btusb_qca_send_vendor_req(udev, QCA_GET_TARGET_VERSION, &ver, |
283 | + sizeof(ver)) < 0) |
284 | + return false; |
285 | + /* only low ROM versions need patches */ |
286 | + return !(le32_to_cpu(ver.rom_version) & ~0xffffU); |
287 | +} |
288 | + |
289 | static int btusb_setup_qca(struct hci_dev *hdev) |
290 | { |
291 | + struct btusb_data *btdata = hci_get_drvdata(hdev); |
292 | + struct usb_device *udev = btdata->udev; |
293 | const struct qca_device_info *info = NULL; |
294 | struct qca_version ver; |
295 | u32 ver_rom; |
296 | u8 status; |
297 | int i, err; |
298 | |
299 | - err = btusb_qca_send_vendor_req(hdev, QCA_GET_TARGET_VERSION, &ver, |
300 | + err = btusb_qca_send_vendor_req(udev, QCA_GET_TARGET_VERSION, &ver, |
301 | sizeof(ver)); |
302 | if (err < 0) |
303 | return err; |
304 | |
305 | ver_rom = le32_to_cpu(ver.rom_version); |
306 | + /* Don't care about high ROM versions */ |
307 | + if (ver_rom & ~0xffffU) |
308 | + return 0; |
309 | + |
310 | for (i = 0; i < ARRAY_SIZE(qca_devices_table); i++) { |
311 | if (ver_rom == qca_devices_table[i].rom_version) |
312 | info = &qca_devices_table[i]; |
313 | @@ -2641,7 +2657,7 @@ static int btusb_setup_qca(struct hci_dev *hdev) |
314 | return -ENODEV; |
315 | } |
316 | |
317 | - err = btusb_qca_send_vendor_req(hdev, QCA_CHECK_STATUS, &status, |
318 | + err = btusb_qca_send_vendor_req(udev, QCA_CHECK_STATUS, &status, |
319 | sizeof(status)); |
320 | if (err < 0) |
321 | return err; |
322 | @@ -2787,7 +2803,8 @@ static int btusb_probe(struct usb_interface *intf, |
323 | |
324 | /* Old firmware would otherwise let ath3k driver load |
325 | * patch and sysconfig files */ |
326 | - if (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x0001) |
327 | + if (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x0001 && |
328 | + !btusb_qca_need_patch(udev)) |
329 | return -ENODEV; |
330 | } |
331 | |
332 | @@ -2937,6 +2954,7 @@ static int btusb_probe(struct usb_interface *intf, |
333 | } |
334 | |
335 | if (id->driver_info & BTUSB_ATH3012) { |
336 | + data->setup_on_usb = btusb_setup_qca; |
337 | hdev->set_bdaddr = btusb_set_bdaddr_ath3012; |
338 | set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); |
339 | set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); |
340 | diff --git a/drivers/isdn/mISDN/core.c b/drivers/isdn/mISDN/core.c |
341 | index faf505462a4f5..f5a06a6fb297f 100644 |
342 | --- a/drivers/isdn/mISDN/core.c |
343 | +++ b/drivers/isdn/mISDN/core.c |
344 | @@ -390,7 +390,7 @@ mISDNInit(void) |
345 | err = mISDN_inittimer(&debug); |
346 | if (err) |
347 | goto error2; |
348 | - err = l1_init(&debug); |
349 | + err = Isdnl1_Init(&debug); |
350 | if (err) |
351 | goto error3; |
352 | err = Isdnl2_Init(&debug); |
353 | @@ -404,7 +404,7 @@ mISDNInit(void) |
354 | error5: |
355 | Isdnl2_cleanup(); |
356 | error4: |
357 | - l1_cleanup(); |
358 | + Isdnl1_cleanup(); |
359 | error3: |
360 | mISDN_timer_cleanup(); |
361 | error2: |
362 | @@ -417,7 +417,7 @@ static void mISDN_cleanup(void) |
363 | { |
364 | misdn_sock_cleanup(); |
365 | Isdnl2_cleanup(); |
366 | - l1_cleanup(); |
367 | + Isdnl1_cleanup(); |
368 | mISDN_timer_cleanup(); |
369 | class_unregister(&mISDN_class); |
370 | |
371 | diff --git a/drivers/isdn/mISDN/core.h b/drivers/isdn/mISDN/core.h |
372 | index 52695bb81ee7a..3c039b6ade2e1 100644 |
373 | --- a/drivers/isdn/mISDN/core.h |
374 | +++ b/drivers/isdn/mISDN/core.h |
375 | @@ -69,8 +69,8 @@ struct Bprotocol *get_Bprotocol4id(u_int); |
376 | extern int mISDN_inittimer(u_int *); |
377 | extern void mISDN_timer_cleanup(void); |
378 | |
379 | -extern int l1_init(u_int *); |
380 | -extern void l1_cleanup(void); |
381 | +extern int Isdnl1_Init(u_int *); |
382 | +extern void Isdnl1_cleanup(void); |
383 | extern int Isdnl2_Init(u_int *); |
384 | extern void Isdnl2_cleanup(void); |
385 | |
386 | diff --git a/drivers/isdn/mISDN/layer1.c b/drivers/isdn/mISDN/layer1.c |
387 | index bebc57b72138e..94d7cc58da648 100644 |
388 | --- a/drivers/isdn/mISDN/layer1.c |
389 | +++ b/drivers/isdn/mISDN/layer1.c |
390 | @@ -407,7 +407,7 @@ create_l1(struct dchannel *dch, dchannel_l1callback *dcb) { |
391 | EXPORT_SYMBOL(create_l1); |
392 | |
393 | int |
394 | -l1_init(u_int *deb) |
395 | +Isdnl1_Init(u_int *deb) |
396 | { |
397 | debug = deb; |
398 | l1fsm_s.state_count = L1S_STATE_COUNT; |
399 | @@ -419,7 +419,7 @@ l1_init(u_int *deb) |
400 | } |
401 | |
402 | void |
403 | -l1_cleanup(void) |
404 | +Isdnl1_cleanup(void) |
405 | { |
406 | mISDN_FsmFree(&l1fsm_s); |
407 | } |
408 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
409 | index e7585f6c4665b..104f8eb828a04 100644 |
410 | --- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
411 | +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
412 | @@ -5429,6 +5429,27 @@ int i40e_open(struct net_device *netdev) |
413 | return 0; |
414 | } |
415 | |
416 | +/** |
417 | + * i40e_netif_set_realnum_tx_rx_queues - Update number of tx/rx queues |
418 | + * @vsi: vsi structure |
419 | + * |
420 | + * This updates netdev's number of tx/rx queues |
421 | + * |
422 | + * Returns status of setting tx/rx queues |
423 | + **/ |
424 | +static int i40e_netif_set_realnum_tx_rx_queues(struct i40e_vsi *vsi) |
425 | +{ |
426 | + int ret; |
427 | + |
428 | + ret = netif_set_real_num_rx_queues(vsi->netdev, |
429 | + vsi->num_queue_pairs); |
430 | + if (ret) |
431 | + return ret; |
432 | + |
433 | + return netif_set_real_num_tx_queues(vsi->netdev, |
434 | + vsi->num_queue_pairs); |
435 | +} |
436 | + |
437 | /** |
438 | * i40e_vsi_open - |
439 | * @vsi: the VSI to open |
440 | @@ -5463,13 +5484,7 @@ int i40e_vsi_open(struct i40e_vsi *vsi) |
441 | goto err_setup_rx; |
442 | |
443 | /* Notify the stack of the actual queue counts. */ |
444 | - err = netif_set_real_num_tx_queues(vsi->netdev, |
445 | - vsi->num_queue_pairs); |
446 | - if (err) |
447 | - goto err_set_queues; |
448 | - |
449 | - err = netif_set_real_num_rx_queues(vsi->netdev, |
450 | - vsi->num_queue_pairs); |
451 | + err = i40e_netif_set_realnum_tx_rx_queues(vsi); |
452 | if (err) |
453 | goto err_set_queues; |
454 | |
455 | @@ -9908,6 +9923,9 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type, |
456 | case I40E_VSI_VMDQ2: |
457 | case I40E_VSI_FCOE: |
458 | ret = i40e_config_netdev(vsi); |
459 | + if (ret) |
460 | + goto err_netdev; |
461 | + ret = i40e_netif_set_realnum_tx_rx_queues(vsi); |
462 | if (ret) |
463 | goto err_netdev; |
464 | ret = register_netdev(vsi->netdev); |
465 | diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c |
466 | index 0ee54fba0a237..92df7c2d5850e 100644 |
467 | --- a/drivers/net/ieee802154/atusb.c |
468 | +++ b/drivers/net/ieee802154/atusb.c |
469 | @@ -79,7 +79,9 @@ static int atusb_control_msg(struct atusb *atusb, unsigned int pipe, |
470 | |
471 | ret = usb_control_msg(usb_dev, pipe, request, requesttype, |
472 | value, index, data, size, timeout); |
473 | - if (ret < 0) { |
474 | + if (ret < size) { |
475 | + ret = ret < 0 ? ret : -ENODATA; |
476 | + |
477 | atusb->err = ret; |
478 | dev_err(&usb_dev->dev, |
479 | "atusb_control_msg: req 0x%02x val 0x%x idx 0x%x, error %d\n", |
480 | @@ -637,9 +639,9 @@ static int atusb_get_and_show_build(struct atusb *atusb) |
481 | if (!build) |
482 | return -ENOMEM; |
483 | |
484 | - ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0), |
485 | - ATUSB_BUILD, ATUSB_REQ_FROM_DEV, 0, 0, |
486 | - build, ATUSB_BUILD_SIZE, 1000); |
487 | + /* We cannot call atusb_control_msg() here, since this request may read various length data */ |
488 | + ret = usb_control_msg(atusb->usb_dev, usb_rcvctrlpipe(usb_dev, 0), ATUSB_BUILD, |
489 | + ATUSB_REQ_FROM_DEV, 0, 0, build, ATUSB_BUILD_SIZE, 1000); |
490 | if (ret >= 0) { |
491 | build[ret] = 0; |
492 | dev_info(&usb_dev->dev, "Firmware: build %s\n", build); |
493 | diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c |
494 | index dc5b8e69f8e86..9567bd00a8144 100644 |
495 | --- a/drivers/net/usb/rndis_host.c |
496 | +++ b/drivers/net/usb/rndis_host.c |
497 | @@ -619,6 +619,11 @@ static const struct usb_device_id products [] = { |
498 | USB_DEVICE_AND_INTERFACE_INFO(0x1630, 0x0042, |
499 | USB_CLASS_COMM, 2 /* ACM */, 0x0ff), |
500 | .driver_info = (unsigned long) &rndis_poll_status_info, |
501 | +}, { |
502 | + /* Hytera Communications DMR radios' "Radio to PC Network" */ |
503 | + USB_VENDOR_AND_INTERFACE_INFO(0x238b, |
504 | + USB_CLASS_COMM, 2 /* ACM */, 0x0ff), |
505 | + .driver_info = (unsigned long)&rndis_info, |
506 | }, { |
507 | /* RNDIS is MSFT's un-official variant of CDC ACM */ |
508 | USB_INTERFACE_INFO(USB_CLASS_COMM, 2 /* ACM */, 0x0ff), |
509 | diff --git a/drivers/power/reset/ltc2952-poweroff.c b/drivers/power/reset/ltc2952-poweroff.c |
510 | index 15fed9d8f871a..ec54cff108b3c 100644 |
511 | --- a/drivers/power/reset/ltc2952-poweroff.c |
512 | +++ b/drivers/power/reset/ltc2952-poweroff.c |
513 | @@ -169,8 +169,8 @@ static void ltc2952_poweroff_kill(void) |
514 | |
515 | static void ltc2952_poweroff_default(struct ltc2952_poweroff *data) |
516 | { |
517 | - data->wde_interval = ktime_set(0, 300L*1E6L); |
518 | - data->trigger_delay = ktime_set(2, 500L*1E6L); |
519 | + data->wde_interval = ktime_set(0, 300L * NSEC_PER_MSEC); |
520 | + data->trigger_delay = ktime_set(2, 500L * NSEC_PER_MSEC); |
521 | |
522 | hrtimer_init(&data->timer_trigger, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
523 | data->timer_trigger.function = ltc2952_poweroff_timer_trigger; |
524 | diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c |
525 | index 30e954bb6c81e..8d1a05d5eb4dd 100644 |
526 | --- a/drivers/scsi/libiscsi.c |
527 | +++ b/drivers/scsi/libiscsi.c |
528 | @@ -2991,6 +2991,8 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) |
529 | { |
530 | struct iscsi_conn *conn = cls_conn->dd_data; |
531 | struct iscsi_session *session = conn->session; |
532 | + char *tmp_persistent_address = conn->persistent_address; |
533 | + char *tmp_local_ipaddr = conn->local_ipaddr; |
534 | |
535 | del_timer_sync(&conn->transport_timer); |
536 | |
537 | @@ -3012,8 +3014,6 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) |
538 | spin_lock_bh(&session->frwd_lock); |
539 | free_pages((unsigned long) conn->data, |
540 | get_order(ISCSI_DEF_MAX_RECV_SEG_LEN)); |
541 | - kfree(conn->persistent_address); |
542 | - kfree(conn->local_ipaddr); |
543 | /* regular RX path uses back_lock */ |
544 | spin_lock_bh(&session->back_lock); |
545 | kfifo_in(&session->cmdpool.queue, (void*)&conn->login_task, |
546 | @@ -3025,6 +3025,8 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) |
547 | mutex_unlock(&session->eh_mutex); |
548 | |
549 | iscsi_destroy_conn(cls_conn); |
550 | + kfree(tmp_persistent_address); |
551 | + kfree(tmp_local_ipaddr); |
552 | } |
553 | EXPORT_SYMBOL_GPL(iscsi_conn_teardown); |
554 | |
555 | diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c |
556 | index d9a9058279671..37e3ba5dadf60 100644 |
557 | --- a/drivers/virtio/virtio_pci_common.c |
558 | +++ b/drivers/virtio/virtio_pci_common.c |
559 | @@ -547,6 +547,13 @@ static void virtio_pci_remove(struct pci_dev *pci_dev) |
560 | struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); |
561 | struct device *dev = get_device(&vp_dev->vdev.dev); |
562 | |
563 | + /* |
564 | + * Device is marked broken on surprise removal so that virtio upper |
565 | + * layers can abort any ongoing operation. |
566 | + */ |
567 | + if (!pci_device_is_present(pci_dev)) |
568 | + virtio_break_device(&vp_dev->vdev); |
569 | + |
570 | unregister_virtio_device(&vp_dev->vdev); |
571 | |
572 | if (vp_dev->ioaddr) |
573 | diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c |
574 | index 6c95812120ebd..5e28a5225e3fb 100644 |
575 | --- a/fs/xfs/xfs_ioctl.c |
576 | +++ b/fs/xfs/xfs_ioctl.c |
577 | @@ -712,7 +712,8 @@ xfs_ioc_space( |
578 | flags |= XFS_PREALLOC_CLEAR; |
579 | if (bf->l_start > XFS_ISIZE(ip)) { |
580 | error = xfs_alloc_file_space(ip, XFS_ISIZE(ip), |
581 | - bf->l_start - XFS_ISIZE(ip), 0); |
582 | + bf->l_start - XFS_ISIZE(ip), |
583 | + XFS_BMAPI_PREALLOC); |
584 | if (error) |
585 | goto out_unlock; |
586 | } |
587 | diff --git a/include/linux/bug.h b/include/linux/bug.h |
588 | index 0faae96302bda..eafb6213e582a 100644 |
589 | --- a/include/linux/bug.h |
590 | +++ b/include/linux/bug.h |
591 | @@ -3,6 +3,7 @@ |
592 | |
593 | #include <asm/bug.h> |
594 | #include <linux/compiler.h> |
595 | +#include <linux/build_bug.h> |
596 | |
597 | enum bug_trap_type { |
598 | BUG_TRAP_TYPE_NONE = 0, |
599 | @@ -13,80 +14,9 @@ enum bug_trap_type { |
600 | struct pt_regs; |
601 | |
602 | #ifdef __CHECKER__ |
603 | -#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) (0) |
604 | -#define BUILD_BUG_ON_NOT_POWER_OF_2(n) (0) |
605 | -#define BUILD_BUG_ON_ZERO(e) (0) |
606 | -#define BUILD_BUG_ON_NULL(e) ((void*)0) |
607 | -#define BUILD_BUG_ON_INVALID(e) (0) |
608 | -#define BUILD_BUG_ON_MSG(cond, msg) (0) |
609 | -#define BUILD_BUG_ON(condition) (0) |
610 | -#define BUILD_BUG() (0) |
611 | #define MAYBE_BUILD_BUG_ON(cond) (0) |
612 | #else /* __CHECKER__ */ |
613 | |
614 | -/* Force a compilation error if a constant expression is not a power of 2 */ |
615 | -#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \ |
616 | - BUILD_BUG_ON(((n) & ((n) - 1)) != 0) |
617 | -#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ |
618 | - BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) |
619 | - |
620 | -/* Force a compilation error if condition is true, but also produce a |
621 | - result (of value 0 and type size_t), so the expression can be used |
622 | - e.g. in a structure initializer (or where-ever else comma expressions |
623 | - aren't permitted). */ |
624 | -#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) |
625 | -#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) |
626 | - |
627 | -/* |
628 | - * BUILD_BUG_ON_INVALID() permits the compiler to check the validity of the |
629 | - * expression but avoids the generation of any code, even if that expression |
630 | - * has side-effects. |
631 | - */ |
632 | -#define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e)))) |
633 | - |
634 | -/** |
635 | - * BUILD_BUG_ON_MSG - break compile if a condition is true & emit supplied |
636 | - * error message. |
637 | - * @condition: the condition which the compiler should know is false. |
638 | - * |
639 | - * See BUILD_BUG_ON for description. |
640 | - */ |
641 | -#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) |
642 | - |
643 | -/** |
644 | - * BUILD_BUG_ON - break compile if a condition is true. |
645 | - * @condition: the condition which the compiler should know is false. |
646 | - * |
647 | - * If you have some code which relies on certain constants being equal, or |
648 | - * some other compile-time-evaluated condition, you should use BUILD_BUG_ON to |
649 | - * detect if someone changes it. |
650 | - * |
651 | - * The implementation uses gcc's reluctance to create a negative array, but gcc |
652 | - * (as of 4.4) only emits that error for obvious cases (e.g. not arguments to |
653 | - * inline functions). Luckily, in 4.3 they added the "error" function |
654 | - * attribute just for this type of case. Thus, we use a negative sized array |
655 | - * (should always create an error on gcc versions older than 4.4) and then call |
656 | - * an undefined function with the error attribute (should always create an |
657 | - * error on gcc 4.3 and later). If for some reason, neither creates a |
658 | - * compile-time error, we'll still have a link-time error, which is harder to |
659 | - * track down. |
660 | - */ |
661 | -#ifndef __OPTIMIZE__ |
662 | -#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) |
663 | -#else |
664 | -#define BUILD_BUG_ON(condition) \ |
665 | - BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) |
666 | -#endif |
667 | - |
668 | -/** |
669 | - * BUILD_BUG - break compile if used. |
670 | - * |
671 | - * If you have some code that you expect the compiler to eliminate at |
672 | - * build time, you should use BUILD_BUG to detect if it is |
673 | - * unexpectedly used. |
674 | - */ |
675 | -#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") |
676 | - |
677 | #define MAYBE_BUILD_BUG_ON(cond) \ |
678 | do { \ |
679 | if (__builtin_constant_p((cond))) \ |
680 | diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h |
681 | new file mode 100644 |
682 | index 0000000000000..b7d22d60008a9 |
683 | --- /dev/null |
684 | +++ b/include/linux/build_bug.h |
685 | @@ -0,0 +1,84 @@ |
686 | +#ifndef _LINUX_BUILD_BUG_H |
687 | +#define _LINUX_BUILD_BUG_H |
688 | + |
689 | +#include <linux/compiler.h> |
690 | + |
691 | +#ifdef __CHECKER__ |
692 | +#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) (0) |
693 | +#define BUILD_BUG_ON_NOT_POWER_OF_2(n) (0) |
694 | +#define BUILD_BUG_ON_ZERO(e) (0) |
695 | +#define BUILD_BUG_ON_NULL(e) ((void *)0) |
696 | +#define BUILD_BUG_ON_INVALID(e) (0) |
697 | +#define BUILD_BUG_ON_MSG(cond, msg) (0) |
698 | +#define BUILD_BUG_ON(condition) (0) |
699 | +#define BUILD_BUG() (0) |
700 | +#else /* __CHECKER__ */ |
701 | + |
702 | +/* Force a compilation error if a constant expression is not a power of 2 */ |
703 | +#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \ |
704 | + BUILD_BUG_ON(((n) & ((n) - 1)) != 0) |
705 | +#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ |
706 | + BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) |
707 | + |
708 | +/* |
709 | + * Force a compilation error if condition is true, but also produce a |
710 | + * result (of value 0 and type size_t), so the expression can be used |
711 | + * e.g. in a structure initializer (or where-ever else comma expressions |
712 | + * aren't permitted). |
713 | + */ |
714 | +#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); })) |
715 | +#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:(-!!(e)); })) |
716 | + |
717 | +/* |
718 | + * BUILD_BUG_ON_INVALID() permits the compiler to check the validity of the |
719 | + * expression but avoids the generation of any code, even if that expression |
720 | + * has side-effects. |
721 | + */ |
722 | +#define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e)))) |
723 | + |
724 | +/** |
725 | + * BUILD_BUG_ON_MSG - break compile if a condition is true & emit supplied |
726 | + * error message. |
727 | + * @condition: the condition which the compiler should know is false. |
728 | + * |
729 | + * See BUILD_BUG_ON for description. |
730 | + */ |
731 | +#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) |
732 | + |
733 | +/** |
734 | + * BUILD_BUG_ON - break compile if a condition is true. |
735 | + * @condition: the condition which the compiler should know is false. |
736 | + * |
737 | + * If you have some code which relies on certain constants being equal, or |
738 | + * some other compile-time-evaluated condition, you should use BUILD_BUG_ON to |
739 | + * detect if someone changes it. |
740 | + * |
741 | + * The implementation uses gcc's reluctance to create a negative array, but gcc |
742 | + * (as of 4.4) only emits that error for obvious cases (e.g. not arguments to |
743 | + * inline functions). Luckily, in 4.3 they added the "error" function |
744 | + * attribute just for this type of case. Thus, we use a negative sized array |
745 | + * (should always create an error on gcc versions older than 4.4) and then call |
746 | + * an undefined function with the error attribute (should always create an |
747 | + * error on gcc 4.3 and later). If for some reason, neither creates a |
748 | + * compile-time error, we'll still have a link-time error, which is harder to |
749 | + * track down. |
750 | + */ |
751 | +#ifndef __OPTIMIZE__ |
752 | +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) |
753 | +#else |
754 | +#define BUILD_BUG_ON(condition) \ |
755 | + BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) |
756 | +#endif |
757 | + |
758 | +/** |
759 | + * BUILD_BUG - break compile if used. |
760 | + * |
761 | + * If you have some code that you expect the compiler to eliminate at |
762 | + * build time, you should use BUILD_BUG to detect if it is |
763 | + * unexpectedly used. |
764 | + */ |
765 | +#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") |
766 | + |
767 | +#endif /* __CHECKER__ */ |
768 | + |
769 | +#endif /* _LINUX_BUILD_BUG_H */ |
770 | diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
771 | index e8bd8de856de9..01c646a1d9e76 100644 |
772 | --- a/kernel/trace/trace.c |
773 | +++ b/kernel/trace/trace.c |
774 | @@ -2354,7 +2354,7 @@ struct trace_buffer_struct { |
775 | char buffer[4][TRACE_BUF_SIZE]; |
776 | }; |
777 | |
778 | -static struct trace_buffer_struct *trace_percpu_buffer; |
779 | +static struct trace_buffer_struct __percpu *trace_percpu_buffer; |
780 | |
781 | /* |
782 | * Thise allows for lockless recording. If we're nested too deeply, then |
783 | @@ -2364,7 +2364,7 @@ static char *get_trace_buf(void) |
784 | { |
785 | struct trace_buffer_struct *buffer = this_cpu_ptr(trace_percpu_buffer); |
786 | |
787 | - if (!buffer || buffer->nesting >= 4) |
788 | + if (!trace_percpu_buffer || buffer->nesting >= 4) |
789 | return NULL; |
790 | |
791 | buffer->nesting++; |
792 | @@ -2383,7 +2383,7 @@ static void put_trace_buf(void) |
793 | |
794 | static int alloc_percpu_trace_buffer(void) |
795 | { |
796 | - struct trace_buffer_struct *buffers; |
797 | + struct trace_buffer_struct __percpu *buffers; |
798 | |
799 | buffers = alloc_percpu(struct trace_buffer_struct); |
800 | if (WARN(!buffers, "Could not allocate percpu trace_printk buffer")) |
801 | diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c |
802 | index 860ab2e6544cc..8770966a564b5 100644 |
803 | --- a/net/ipv4/udp.c |
804 | +++ b/net/ipv4/udp.c |
805 | @@ -2435,7 +2435,7 @@ int udp4_seq_show(struct seq_file *seq, void *v) |
806 | { |
807 | seq_setwidth(seq, 127); |
808 | if (v == SEQ_START_TOKEN) |
809 | - seq_puts(seq, " sl local_address rem_address st tx_queue " |
810 | + seq_puts(seq, " sl local_address rem_address st tx_queue " |
811 | "rx_queue tr tm->when retrnsmt uid timeout " |
812 | "inode ref pointer drops"); |
813 | else { |
814 | diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c |
815 | index f58d69216b616..ce5b55491942d 100644 |
816 | --- a/net/ipv6/ip6_vti.c |
817 | +++ b/net/ipv6/ip6_vti.c |
818 | @@ -773,6 +773,8 @@ vti6_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
819 | struct net *net = dev_net(dev); |
820 | struct vti6_net *ip6n = net_generic(net, vti6_net_id); |
821 | |
822 | + memset(&p1, 0, sizeof(p1)); |
823 | + |
824 | switch (cmd) { |
825 | case SIOCGETTUNNEL: |
826 | if (dev == ip6n->fb_tnl_dev) { |
827 | diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
828 | index 3217c98f2b5a2..56c58ff8ef748 100644 |
829 | --- a/net/mac80211/mlme.c |
830 | +++ b/net/mac80211/mlme.c |
831 | @@ -4450,7 +4450,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, |
832 | |
833 | if (new_sta) { |
834 | u32 rates = 0, basic_rates = 0; |
835 | - bool have_higher_than_11mbit; |
836 | + bool have_higher_than_11mbit = false; |
837 | int min_rate = INT_MAX, min_rate_index = -1; |
838 | struct ieee80211_chanctx_conf *chanctx_conf; |
839 | const struct cfg80211_bss_ies *ies; |
840 | diff --git a/net/phonet/pep.c b/net/phonet/pep.c |
841 | index 1e7945df39928..a734d47c5eb19 100644 |
842 | --- a/net/phonet/pep.c |
843 | +++ b/net/phonet/pep.c |
844 | @@ -878,6 +878,7 @@ static struct sock *pep_sock_accept(struct sock *sk, int flags, int *errp) |
845 | |
846 | err = pep_accept_conn(newsk, skb); |
847 | if (err) { |
848 | + __sock_put(sk); |
849 | sock_put(newsk); |
850 | newsk = NULL; |
851 | goto drop; |
852 | diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c |
853 | index ca0516e6f7435..fd48a1e327d6a 100644 |
854 | --- a/net/sched/sch_qfq.c |
855 | +++ b/net/sched/sch_qfq.c |
856 | @@ -1439,10 +1439,8 @@ static int qfq_init_qdisc(struct Qdisc *sch, struct nlattr *opt) |
857 | if (err < 0) |
858 | return err; |
859 | |
860 | - if (qdisc_dev(sch)->tx_queue_len + 1 > QFQ_MAX_AGG_CLASSES) |
861 | - max_classes = QFQ_MAX_AGG_CLASSES; |
862 | - else |
863 | - max_classes = qdisc_dev(sch)->tx_queue_len + 1; |
864 | + max_classes = min_t(u64, (u64)qdisc_dev(sch)->tx_queue_len + 1, |
865 | + QFQ_MAX_AGG_CLASSES); |
866 | /* max_cl_shift = floor(log_2(max_classes)) */ |
867 | max_cl_shift = __fls(max_classes); |
868 | q->max_agg_classes = 1<<max_cl_shift; |