Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.4 commit in: /
Date: Thu, 30 Mar 2017 18:16:51
Message-Id: 1490897798.d9a45c4f89a6625b8423a1e24753d7def3844932.mpagano@gentoo
1 commit: d9a45c4f89a6625b8423a1e24753d7def3844932
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Thu Mar 30 18:16:38 2017 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Thu Mar 30 18:16:38 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=d9a45c4f
7
8 Linux patch 4.4.58
9
10 0000_README | 4 +
11 1057_linux-4.4.58.patch | 2653 +++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 2657 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index e08ec98..62c89c5 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -271,6 +271,10 @@ Patch: 1056_linux-4.4.57.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.4.57
21
22 +Patch: 1057_linux-4.4.58.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.4.58
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1057_linux-4.4.58.patch b/1057_linux-4.4.58.patch
31 new file mode 100644
32 index 0000000..628aea1
33 --- /dev/null
34 +++ b/1057_linux-4.4.58.patch
35 @@ -0,0 +1,2653 @@
36 +diff --git a/Makefile b/Makefile
37 +index 841675e63a38..3efe2ea99e2d 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 4
42 + PATCHLEVEL = 4
43 +-SUBLEVEL = 57
44 ++SUBLEVEL = 58
45 + EXTRAVERSION =
46 + NAME = Blurry Fish Butt
47 +
48 +diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
49 +index 4dfca8fc49b3..1bc61ece2589 100644
50 +--- a/arch/arm/boot/dts/sama5d2.dtsi
51 ++++ b/arch/arm/boot/dts/sama5d2.dtsi
52 +@@ -856,6 +856,13 @@
53 + compatible = "atmel,at91sam9260-usart";
54 + reg = <0xf801c000 0x100>;
55 + interrupts = <24 IRQ_TYPE_LEVEL_HIGH 7>;
56 ++ dmas = <&dma0
57 ++ (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
58 ++ AT91_XDMAC_DT_PERID(35))>,
59 ++ <&dma0
60 ++ (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
61 ++ AT91_XDMAC_DT_PERID(36))>;
62 ++ dma-names = "tx", "rx";
63 + clocks = <&uart0_clk>;
64 + clock-names = "usart";
65 + status = "disabled";
66 +@@ -865,6 +872,13 @@
67 + compatible = "atmel,at91sam9260-usart";
68 + reg = <0xf8020000 0x100>;
69 + interrupts = <25 IRQ_TYPE_LEVEL_HIGH 7>;
70 ++ dmas = <&dma0
71 ++ (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
72 ++ AT91_XDMAC_DT_PERID(37))>,
73 ++ <&dma0
74 ++ (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
75 ++ AT91_XDMAC_DT_PERID(38))>;
76 ++ dma-names = "tx", "rx";
77 + clocks = <&uart1_clk>;
78 + clock-names = "usart";
79 + status = "disabled";
80 +@@ -874,6 +888,13 @@
81 + compatible = "atmel,at91sam9260-usart";
82 + reg = <0xf8024000 0x100>;
83 + interrupts = <26 IRQ_TYPE_LEVEL_HIGH 7>;
84 ++ dmas = <&dma0
85 ++ (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
86 ++ AT91_XDMAC_DT_PERID(39))>,
87 ++ <&dma0
88 ++ (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
89 ++ AT91_XDMAC_DT_PERID(40))>;
90 ++ dma-names = "tx", "rx";
91 + clocks = <&uart2_clk>;
92 + clock-names = "usart";
93 + status = "disabled";
94 +@@ -985,6 +1006,13 @@
95 + compatible = "atmel,at91sam9260-usart";
96 + reg = <0xfc008000 0x100>;
97 + interrupts = <27 IRQ_TYPE_LEVEL_HIGH 7>;
98 ++ dmas = <&dma0
99 ++ (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
100 ++ AT91_XDMAC_DT_PERID(41))>,
101 ++ <&dma0
102 ++ (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
103 ++ AT91_XDMAC_DT_PERID(42))>;
104 ++ dma-names = "tx", "rx";
105 + clocks = <&uart3_clk>;
106 + clock-names = "usart";
107 + status = "disabled";
108 +@@ -993,6 +1021,13 @@
109 + uart4: serial@fc00c000 {
110 + compatible = "atmel,at91sam9260-usart";
111 + reg = <0xfc00c000 0x100>;
112 ++ dmas = <&dma0
113 ++ (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
114 ++ AT91_XDMAC_DT_PERID(43))>,
115 ++ <&dma0
116 ++ (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
117 ++ AT91_XDMAC_DT_PERID(44))>;
118 ++ dma-names = "tx", "rx";
119 + interrupts = <28 IRQ_TYPE_LEVEL_HIGH 7>;
120 + clocks = <&uart4_clk>;
121 + clock-names = "usart";
122 +diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
123 +index 23726fb31741..d687f860a2da 100644
124 +--- a/arch/arm/mach-at91/pm.c
125 ++++ b/arch/arm/mach-at91/pm.c
126 +@@ -286,6 +286,22 @@ static void at91_ddr_standby(void)
127 + at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1);
128 + }
129 +
130 ++static void sama5d3_ddr_standby(void)
131 ++{
132 ++ u32 lpr0;
133 ++ u32 saved_lpr0;
134 ++
135 ++ saved_lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR);
136 ++ lpr0 = saved_lpr0 & ~AT91_DDRSDRC_LPCB;
137 ++ lpr0 |= AT91_DDRSDRC_LPCB_POWER_DOWN;
138 ++
139 ++ at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0);
140 ++
141 ++ cpu_do_idle();
142 ++
143 ++ at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0);
144 ++}
145 ++
146 + /* We manage both DDRAM/SDRAM controllers, we need more than one value to
147 + * remember.
148 + */
149 +@@ -320,7 +336,7 @@ static const struct of_device_id const ramc_ids[] __initconst = {
150 + { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby },
151 + { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby },
152 + { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby },
153 +- { .compatible = "atmel,sama5d3-ddramc", .data = at91_ddr_standby },
154 ++ { .compatible = "atmel,sama5d3-ddramc", .data = sama5d3_ddr_standby },
155 + { /*sentinel*/ }
156 + };
157 +
158 +diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
159 +index cfc4a966e2b9..83b5f7a323a9 100644
160 +--- a/arch/x86/kernel/cpu/mshyperv.c
161 ++++ b/arch/x86/kernel/cpu/mshyperv.c
162 +@@ -30,6 +30,7 @@
163 + #include <asm/apic.h>
164 + #include <asm/timer.h>
165 + #include <asm/reboot.h>
166 ++#include <asm/nmi.h>
167 +
168 + struct ms_hyperv_info ms_hyperv;
169 + EXPORT_SYMBOL_GPL(ms_hyperv);
170 +@@ -157,6 +158,26 @@ static unsigned char hv_get_nmi_reason(void)
171 + return 0;
172 + }
173 +
174 ++#ifdef CONFIG_X86_LOCAL_APIC
175 ++/*
176 ++ * Prior to WS2016 Debug-VM sends NMIs to all CPUs which makes
177 ++ * it dificult to process CHANNELMSG_UNLOAD in case of crash. Handle
178 ++ * unknown NMI on the first CPU which gets it.
179 ++ */
180 ++static int hv_nmi_unknown(unsigned int val, struct pt_regs *regs)
181 ++{
182 ++ static atomic_t nmi_cpu = ATOMIC_INIT(-1);
183 ++
184 ++ if (!unknown_nmi_panic)
185 ++ return NMI_DONE;
186 ++
187 ++ if (atomic_cmpxchg(&nmi_cpu, -1, raw_smp_processor_id()) != -1)
188 ++ return NMI_HANDLED;
189 ++
190 ++ return NMI_DONE;
191 ++}
192 ++#endif
193 ++
194 + static void __init ms_hyperv_init_platform(void)
195 + {
196 + /*
197 +@@ -182,6 +203,9 @@ static void __init ms_hyperv_init_platform(void)
198 + printk(KERN_INFO "HyperV: LAPIC Timer Frequency: %#x\n",
199 + lapic_timer_frequency);
200 + }
201 ++
202 ++ register_nmi_handler(NMI_UNKNOWN, hv_nmi_unknown, NMI_FLAG_FIRST,
203 ++ "hv_nmi_unknown");
204 + #endif
205 +
206 + if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
207 +diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
208 +index c6d6efed392a..7575f0798194 100644
209 +--- a/arch/x86/pci/xen.c
210 ++++ b/arch/x86/pci/xen.c
211 +@@ -231,23 +231,14 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
212 + return 1;
213 +
214 + for_each_pci_msi_entry(msidesc, dev) {
215 +- __pci_read_msi_msg(msidesc, &msg);
216 +- pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) |
217 +- ((msg.address_lo >> MSI_ADDR_DEST_ID_SHIFT) & 0xff);
218 +- if (msg.data != XEN_PIRQ_MSI_DATA ||
219 +- xen_irq_from_pirq(pirq) < 0) {
220 +- pirq = xen_allocate_pirq_msi(dev, msidesc);
221 +- if (pirq < 0) {
222 +- irq = -ENODEV;
223 +- goto error;
224 +- }
225 +- xen_msi_compose_msg(dev, pirq, &msg);
226 +- __pci_write_msi_msg(msidesc, &msg);
227 +- dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq);
228 +- } else {
229 +- dev_dbg(&dev->dev,
230 +- "xen: msi already bound to pirq=%d\n", pirq);
231 ++ pirq = xen_allocate_pirq_msi(dev, msidesc);
232 ++ if (pirq < 0) {
233 ++ irq = -ENODEV;
234 ++ goto error;
235 + }
236 ++ xen_msi_compose_msg(dev, pirq, &msg);
237 ++ __pci_write_msi_msg(msidesc, &msg);
238 ++ dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq);
239 + irq = xen_bind_pirq_msi_to_irq(dev, msidesc, pirq,
240 + (type == PCI_CAP_ID_MSI) ? nvec : 1,
241 + (type == PCI_CAP_ID_MSIX) ?
242 +diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
243 +index 0774799942e0..c6fee7437be4 100644
244 +--- a/block/scsi_ioctl.c
245 ++++ b/block/scsi_ioctl.c
246 +@@ -182,6 +182,9 @@ static void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter)
247 + __set_bit(WRITE_16, filter->write_ok);
248 + __set_bit(WRITE_LONG, filter->write_ok);
249 + __set_bit(WRITE_LONG_2, filter->write_ok);
250 ++ __set_bit(WRITE_SAME, filter->write_ok);
251 ++ __set_bit(WRITE_SAME_16, filter->write_ok);
252 ++ __set_bit(WRITE_SAME_32, filter->write_ok);
253 + __set_bit(ERASE, filter->write_ok);
254 + __set_bit(GPCMD_MODE_SELECT_10, filter->write_ok);
255 + __set_bit(MODE_SELECT, filter->write_ok);
256 +diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
257 +index 68a5ceaa04c8..8d8b3eeba725 100644
258 +--- a/crypto/algif_hash.c
259 ++++ b/crypto/algif_hash.c
260 +@@ -184,7 +184,7 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags)
261 + struct alg_sock *ask = alg_sk(sk);
262 + struct hash_ctx *ctx = ask->private;
263 + struct ahash_request *req = &ctx->req;
264 +- char state[crypto_ahash_statesize(crypto_ahash_reqtfm(req))];
265 ++ char state[crypto_ahash_statesize(crypto_ahash_reqtfm(req)) ? : 1];
266 + struct sock *sk2;
267 + struct alg_sock *ask2;
268 + struct hash_ctx *ctx2;
269 +diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
270 +index 96809cd99ace..2f24b578bcaf 100644
271 +--- a/drivers/acpi/blacklist.c
272 ++++ b/drivers/acpi/blacklist.c
273 +@@ -346,6 +346,34 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
274 + DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9343"),
275 + },
276 + },
277 ++ {
278 ++ .callback = dmi_enable_rev_override,
279 ++ .ident = "DELL Precision 5520",
280 ++ .matches = {
281 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
282 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Precision 5520"),
283 ++ },
284 ++ },
285 ++ {
286 ++ .callback = dmi_enable_rev_override,
287 ++ .ident = "DELL Precision 3520",
288 ++ .matches = {
289 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
290 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3520"),
291 ++ },
292 ++ },
293 ++ /*
294 ++ * Resolves a quirk with the Dell Latitude 3350 that
295 ++ * causes the ethernet adapter to not function.
296 ++ */
297 ++ {
298 ++ .callback = dmi_enable_rev_override,
299 ++ .ident = "DELL Latitude 3350",
300 ++ .matches = {
301 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
302 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Latitude 3350"),
303 ++ },
304 ++ },
305 + #endif
306 + {}
307 + };
308 +diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
309 +index 86fa9fdc8323..38b363f4316b 100644
310 +--- a/drivers/cpufreq/cpufreq.c
311 ++++ b/drivers/cpufreq/cpufreq.c
312 +@@ -1186,6 +1186,9 @@ static int cpufreq_online(unsigned int cpu)
313 + for_each_cpu(j, policy->related_cpus)
314 + per_cpu(cpufreq_cpu_data, j) = policy;
315 + write_unlock_irqrestore(&cpufreq_driver_lock, flags);
316 ++ } else {
317 ++ policy->min = policy->user_policy.min;
318 ++ policy->max = policy->user_policy.max;
319 + }
320 +
321 + if (cpufreq_driver->get && !cpufreq_driver->setpolicy) {
322 +diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
323 +index 0470fc843d4e..9b6854607d73 100644
324 +--- a/drivers/iio/adc/ti_am335x_adc.c
325 ++++ b/drivers/iio/adc/ti_am335x_adc.c
326 +@@ -151,7 +151,9 @@ static irqreturn_t tiadc_irq_h(int irq, void *private)
327 + {
328 + struct iio_dev *indio_dev = private;
329 + struct tiadc_device *adc_dev = iio_priv(indio_dev);
330 +- unsigned int status, config;
331 ++ unsigned int status, config, adc_fsm;
332 ++ unsigned short count = 0;
333 ++
334 + status = tiadc_readl(adc_dev, REG_IRQSTATUS);
335 +
336 + /*
337 +@@ -165,6 +167,15 @@ static irqreturn_t tiadc_irq_h(int irq, void *private)
338 + tiadc_writel(adc_dev, REG_CTRL, config);
339 + tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1OVRRUN
340 + | IRQENB_FIFO1UNDRFLW | IRQENB_FIFO1THRES);
341 ++
342 ++ /* wait for idle state.
343 ++ * ADC needs to finish the current conversion
344 ++ * before disabling the module
345 ++ */
346 ++ do {
347 ++ adc_fsm = tiadc_readl(adc_dev, REG_ADCFSM);
348 ++ } while (adc_fsm != 0x10 && count++ < 100);
349 ++
350 + tiadc_writel(adc_dev, REG_CTRL, (config | CNTRLREG_TSCSSENB));
351 + return IRQ_HANDLED;
352 + } else if (status & IRQENB_FIFO1THRES) {
353 +diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
354 +index 595511022795..0a86ef43e781 100644
355 +--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
356 ++++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
357 +@@ -51,8 +51,6 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
358 + st->report_state.report_id,
359 + st->report_state.index,
360 + HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM);
361 +-
362 +- poll_value = hid_sensor_read_poll_value(st);
363 + } else {
364 + int val;
365 +
366 +@@ -89,7 +87,9 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
367 + sensor_hub_get_feature(st->hsdev, st->power_state.report_id,
368 + st->power_state.index,
369 + sizeof(state_val), &state_val);
370 +- if (state && poll_value)
371 ++ if (state)
372 ++ poll_value = hid_sensor_read_poll_value(st);
373 ++ if (poll_value > 0)
374 + msleep_interruptible(poll_value * 2);
375 +
376 + return 0;
377 +diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
378 +index d96aa27dfcdc..db64adfbe1af 100644
379 +--- a/drivers/input/joystick/iforce/iforce-usb.c
380 ++++ b/drivers/input/joystick/iforce/iforce-usb.c
381 +@@ -141,6 +141,9 @@ static int iforce_usb_probe(struct usb_interface *intf,
382 +
383 + interface = intf->cur_altsetting;
384 +
385 ++ if (interface->desc.bNumEndpoints < 2)
386 ++ return -ENODEV;
387 ++
388 + epirq = &interface->endpoint[0].desc;
389 + epout = &interface->endpoint[1].desc;
390 +
391 +diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
392 +index 9365535ba7f1..50a7faa504f7 100644
393 +--- a/drivers/input/misc/cm109.c
394 ++++ b/drivers/input/misc/cm109.c
395 +@@ -675,6 +675,10 @@ static int cm109_usb_probe(struct usb_interface *intf,
396 + int error = -ENOMEM;
397 +
398 + interface = intf->cur_altsetting;
399 ++
400 ++ if (interface->desc.bNumEndpoints < 1)
401 ++ return -ENODEV;
402 ++
403 + endpoint = &interface->endpoint[0].desc;
404 +
405 + if (!usb_endpoint_is_int_in(endpoint))
406 +diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
407 +index 9c0ea36913b4..f4e8fbec6a94 100644
408 +--- a/drivers/input/misc/ims-pcu.c
409 ++++ b/drivers/input/misc/ims-pcu.c
410 +@@ -1667,6 +1667,10 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
411 + return -EINVAL;
412 +
413 + alt = pcu->ctrl_intf->cur_altsetting;
414 ++
415 ++ if (alt->desc.bNumEndpoints < 1)
416 ++ return -ENODEV;
417 ++
418 + pcu->ep_ctrl = &alt->endpoint[0].desc;
419 + pcu->max_ctrl_size = usb_endpoint_maxp(pcu->ep_ctrl);
420 +
421 +diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
422 +index 79c964c075f1..6e7ff9561d92 100644
423 +--- a/drivers/input/misc/yealink.c
424 ++++ b/drivers/input/misc/yealink.c
425 +@@ -875,6 +875,10 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
426 + int ret, pipe, i;
427 +
428 + interface = intf->cur_altsetting;
429 ++
430 ++ if (interface->desc.bNumEndpoints < 1)
431 ++ return -ENODEV;
432 ++
433 + endpoint = &interface->endpoint[0].desc;
434 + if (!usb_endpoint_is_int_in(endpoint))
435 + return -ENODEV;
436 +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
437 +index ed1935f300a7..da5458dfb1e3 100644
438 +--- a/drivers/input/mouse/elan_i2c_core.c
439 ++++ b/drivers/input/mouse/elan_i2c_core.c
440 +@@ -218,17 +218,19 @@ static int elan_query_product(struct elan_tp_data *data)
441 +
442 + static int elan_check_ASUS_special_fw(struct elan_tp_data *data)
443 + {
444 +- if (data->ic_type != 0x0E)
445 +- return false;
446 +-
447 +- switch (data->product_id) {
448 +- case 0x05 ... 0x07:
449 +- case 0x09:
450 +- case 0x13:
451 ++ if (data->ic_type == 0x0E) {
452 ++ switch (data->product_id) {
453 ++ case 0x05 ... 0x07:
454 ++ case 0x09:
455 ++ case 0x13:
456 ++ return true;
457 ++ }
458 ++ } else if (data->ic_type == 0x08 && data->product_id == 0x26) {
459 ++ /* ASUS EeeBook X205TA */
460 + return true;
461 +- default:
462 +- return false;
463 + }
464 ++
465 ++ return false;
466 + }
467 +
468 + static int __elan_initialize(struct elan_tp_data *data)
469 +diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
470 +index 0cdd95801a25..25eab453f2b2 100644
471 +--- a/drivers/input/serio/i8042-x86ia64io.h
472 ++++ b/drivers/input/serio/i8042-x86ia64io.h
473 +@@ -120,6 +120,13 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = {
474 + },
475 + },
476 + {
477 ++ /* Dell Embedded Box PC 3000 */
478 ++ .matches = {
479 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
480 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Embedded Box PC 3000"),
481 ++ },
482 ++ },
483 ++ {
484 + /* OQO Model 01 */
485 + .matches = {
486 + DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
487 +diff --git a/drivers/input/tablet/hanwang.c b/drivers/input/tablet/hanwang.c
488 +index cd852059b99e..df4bea96d7ed 100644
489 +--- a/drivers/input/tablet/hanwang.c
490 ++++ b/drivers/input/tablet/hanwang.c
491 +@@ -340,6 +340,9 @@ static int hanwang_probe(struct usb_interface *intf, const struct usb_device_id
492 + int error;
493 + int i;
494 +
495 ++ if (intf->cur_altsetting->desc.bNumEndpoints < 1)
496 ++ return -ENODEV;
497 ++
498 + hanwang = kzalloc(sizeof(struct hanwang), GFP_KERNEL);
499 + input_dev = input_allocate_device();
500 + if (!hanwang || !input_dev) {
501 +diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
502 +index d2ac7c2b5b82..2812f9236b7d 100644
503 +--- a/drivers/input/tablet/kbtab.c
504 ++++ b/drivers/input/tablet/kbtab.c
505 +@@ -122,6 +122,9 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
506 + struct input_dev *input_dev;
507 + int error = -ENOMEM;
508 +
509 ++ if (intf->cur_altsetting->desc.bNumEndpoints < 1)
510 ++ return -ENODEV;
511 ++
512 + kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL);
513 + input_dev = input_allocate_device();
514 + if (!kbtab || !input_dev)
515 +diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
516 +index 45b466e3bbe8..0146e2c74649 100644
517 +--- a/drivers/input/touchscreen/sur40.c
518 ++++ b/drivers/input/touchscreen/sur40.c
519 +@@ -500,6 +500,9 @@ static int sur40_probe(struct usb_interface *interface,
520 + if (iface_desc->desc.bInterfaceClass != 0xFF)
521 + return -ENODEV;
522 +
523 ++ if (iface_desc->desc.bNumEndpoints < 5)
524 ++ return -ENODEV;
525 ++
526 + /* Use endpoint #4 (0x86). */
527 + endpoint = &iface_desc->endpoint[4].desc;
528 + if (endpoint->bEndpointAddress != TOUCH_ENDPOINT)
529 +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
530 +index f0fc6f7b5d98..0628372f3591 100644
531 +--- a/drivers/iommu/intel-iommu.c
532 ++++ b/drivers/iommu/intel-iommu.c
533 +@@ -908,7 +908,7 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf
534 + * which we used for the IOMMU lookup. Strictly speaking
535 + * we could do this for all PCI devices; we only need to
536 + * get the BDF# from the scope table for ACPI matches. */
537 +- if (pdev->is_virtfn)
538 ++ if (pdev && pdev->is_virtfn)
539 + goto got_pdev;
540 +
541 + *bus = drhd->devices[i].bus;
542 +diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
543 +index 122af340a531..a92979e704e3 100644
544 +--- a/drivers/md/raid10.c
545 ++++ b/drivers/md/raid10.c
546 +@@ -1072,6 +1072,8 @@ static void __make_request(struct mddev *mddev, struct bio *bio)
547 + int max_sectors;
548 + int sectors;
549 +
550 ++ md_write_start(mddev, bio);
551 ++
552 + /*
553 + * Register the new request and wait if the reconstruction
554 + * thread has put up a bar for new requests.
555 +@@ -1455,8 +1457,6 @@ static void make_request(struct mddev *mddev, struct bio *bio)
556 + return;
557 + }
558 +
559 +- md_write_start(mddev, bio);
560 +-
561 + do {
562 +
563 + /*
564 +diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
565 +index 5cefca95734e..885f689ac870 100644
566 +--- a/drivers/media/usb/uvc/uvc_driver.c
567 ++++ b/drivers/media/usb/uvc/uvc_driver.c
568 +@@ -1595,6 +1595,114 @@ static const char *uvc_print_chain(struct uvc_video_chain *chain)
569 + return buffer;
570 + }
571 +
572 ++static struct uvc_video_chain *uvc_alloc_chain(struct uvc_device *dev)
573 ++{
574 ++ struct uvc_video_chain *chain;
575 ++
576 ++ chain = kzalloc(sizeof(*chain), GFP_KERNEL);
577 ++ if (chain == NULL)
578 ++ return NULL;
579 ++
580 ++ INIT_LIST_HEAD(&chain->entities);
581 ++ mutex_init(&chain->ctrl_mutex);
582 ++ chain->dev = dev;
583 ++ v4l2_prio_init(&chain->prio);
584 ++
585 ++ return chain;
586 ++}
587 ++
588 ++/*
589 ++ * Fallback heuristic for devices that don't connect units and terminals in a
590 ++ * valid chain.
591 ++ *
592 ++ * Some devices have invalid baSourceID references, causing uvc_scan_chain()
593 ++ * to fail, but if we just take the entities we can find and put them together
594 ++ * in the most sensible chain we can think of, turns out they do work anyway.
595 ++ * Note: This heuristic assumes there is a single chain.
596 ++ *
597 ++ * At the time of writing, devices known to have such a broken chain are
598 ++ * - Acer Integrated Camera (5986:055a)
599 ++ * - Realtek rtl157a7 (0bda:57a7)
600 ++ */
601 ++static int uvc_scan_fallback(struct uvc_device *dev)
602 ++{
603 ++ struct uvc_video_chain *chain;
604 ++ struct uvc_entity *iterm = NULL;
605 ++ struct uvc_entity *oterm = NULL;
606 ++ struct uvc_entity *entity;
607 ++ struct uvc_entity *prev;
608 ++
609 ++ /*
610 ++ * Start by locating the input and output terminals. We only support
611 ++ * devices with exactly one of each for now.
612 ++ */
613 ++ list_for_each_entry(entity, &dev->entities, list) {
614 ++ if (UVC_ENTITY_IS_ITERM(entity)) {
615 ++ if (iterm)
616 ++ return -EINVAL;
617 ++ iterm = entity;
618 ++ }
619 ++
620 ++ if (UVC_ENTITY_IS_OTERM(entity)) {
621 ++ if (oterm)
622 ++ return -EINVAL;
623 ++ oterm = entity;
624 ++ }
625 ++ }
626 ++
627 ++ if (iterm == NULL || oterm == NULL)
628 ++ return -EINVAL;
629 ++
630 ++ /* Allocate the chain and fill it. */
631 ++ chain = uvc_alloc_chain(dev);
632 ++ if (chain == NULL)
633 ++ return -ENOMEM;
634 ++
635 ++ if (uvc_scan_chain_entity(chain, oterm) < 0)
636 ++ goto error;
637 ++
638 ++ prev = oterm;
639 ++
640 ++ /*
641 ++ * Add all Processing and Extension Units with two pads. The order
642 ++ * doesn't matter much, use reverse list traversal to connect units in
643 ++ * UVC descriptor order as we build the chain from output to input. This
644 ++ * leads to units appearing in the order meant by the manufacturer for
645 ++ * the cameras known to require this heuristic.
646 ++ */
647 ++ list_for_each_entry_reverse(entity, &dev->entities, list) {
648 ++ if (entity->type != UVC_VC_PROCESSING_UNIT &&
649 ++ entity->type != UVC_VC_EXTENSION_UNIT)
650 ++ continue;
651 ++
652 ++ if (entity->num_pads != 2)
653 ++ continue;
654 ++
655 ++ if (uvc_scan_chain_entity(chain, entity) < 0)
656 ++ goto error;
657 ++
658 ++ prev->baSourceID[0] = entity->id;
659 ++ prev = entity;
660 ++ }
661 ++
662 ++ if (uvc_scan_chain_entity(chain, iterm) < 0)
663 ++ goto error;
664 ++
665 ++ prev->baSourceID[0] = iterm->id;
666 ++
667 ++ list_add_tail(&chain->list, &dev->chains);
668 ++
669 ++ uvc_trace(UVC_TRACE_PROBE,
670 ++ "Found a video chain by fallback heuristic (%s).\n",
671 ++ uvc_print_chain(chain));
672 ++
673 ++ return 0;
674 ++
675 ++error:
676 ++ kfree(chain);
677 ++ return -EINVAL;
678 ++}
679 ++
680 + /*
681 + * Scan the device for video chains and register video devices.
682 + *
683 +@@ -1617,15 +1725,10 @@ static int uvc_scan_device(struct uvc_device *dev)
684 + if (term->chain.next || term->chain.prev)
685 + continue;
686 +
687 +- chain = kzalloc(sizeof(*chain), GFP_KERNEL);
688 ++ chain = uvc_alloc_chain(dev);
689 + if (chain == NULL)
690 + return -ENOMEM;
691 +
692 +- INIT_LIST_HEAD(&chain->entities);
693 +- mutex_init(&chain->ctrl_mutex);
694 +- chain->dev = dev;
695 +- v4l2_prio_init(&chain->prio);
696 +-
697 + term->flags |= UVC_ENTITY_FLAG_DEFAULT;
698 +
699 + if (uvc_scan_chain(chain, term) < 0) {
700 +@@ -1639,6 +1742,9 @@ static int uvc_scan_device(struct uvc_device *dev)
701 + list_add_tail(&chain->list, &dev->chains);
702 + }
703 +
704 ++ if (list_empty(&dev->chains))
705 ++ uvc_scan_fallback(dev);
706 ++
707 + if (list_empty(&dev->chains)) {
708 + uvc_printk(KERN_INFO, "No valid video chain found.\n");
709 + return -1;
710 +diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
711 +index bda164089904..62d37d2ac557 100644
712 +--- a/drivers/mmc/host/sdhci.c
713 ++++ b/drivers/mmc/host/sdhci.c
714 +@@ -1274,7 +1274,9 @@ clock_set:
715 + return;
716 + }
717 + timeout--;
718 +- mdelay(1);
719 ++ spin_unlock_irq(&host->lock);
720 ++ usleep_range(900, 1100);
721 ++ spin_lock_irq(&host->lock);
722 + }
723 +
724 + clk |= SDHCI_CLOCK_CARD_EN;
725 +diff --git a/drivers/mmc/host/ushc.c b/drivers/mmc/host/ushc.c
726 +index d2c386f09d69..1d843357422e 100644
727 +--- a/drivers/mmc/host/ushc.c
728 ++++ b/drivers/mmc/host/ushc.c
729 +@@ -426,6 +426,9 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id
730 + struct ushc_data *ushc;
731 + int ret;
732 +
733 ++ if (intf->cur_altsetting->desc.bNumEndpoints < 1)
734 ++ return -ENODEV;
735 ++
736 + mmc = mmc_alloc_host(sizeof(struct ushc_data), &intf->dev);
737 + if (mmc == NULL)
738 + return -ENOMEM;
739 +diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-common.h b/drivers/net/ethernet/amd/xgbe/xgbe-common.h
740 +index b6fa89102526..66ba1e0ff37e 100644
741 +--- a/drivers/net/ethernet/amd/xgbe/xgbe-common.h
742 ++++ b/drivers/net/ethernet/amd/xgbe/xgbe-common.h
743 +@@ -913,8 +913,8 @@
744 + #define RX_PACKET_ATTRIBUTES_CSUM_DONE_WIDTH 1
745 + #define RX_PACKET_ATTRIBUTES_VLAN_CTAG_INDEX 1
746 + #define RX_PACKET_ATTRIBUTES_VLAN_CTAG_WIDTH 1
747 +-#define RX_PACKET_ATTRIBUTES_INCOMPLETE_INDEX 2
748 +-#define RX_PACKET_ATTRIBUTES_INCOMPLETE_WIDTH 1
749 ++#define RX_PACKET_ATTRIBUTES_LAST_INDEX 2
750 ++#define RX_PACKET_ATTRIBUTES_LAST_WIDTH 1
751 + #define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_INDEX 3
752 + #define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_WIDTH 1
753 + #define RX_PACKET_ATTRIBUTES_CONTEXT_INDEX 4
754 +@@ -923,6 +923,8 @@
755 + #define RX_PACKET_ATTRIBUTES_RX_TSTAMP_WIDTH 1
756 + #define RX_PACKET_ATTRIBUTES_RSS_HASH_INDEX 6
757 + #define RX_PACKET_ATTRIBUTES_RSS_HASH_WIDTH 1
758 ++#define RX_PACKET_ATTRIBUTES_FIRST_INDEX 7
759 ++#define RX_PACKET_ATTRIBUTES_FIRST_WIDTH 1
760 +
761 + #define RX_NORMAL_DESC0_OVT_INDEX 0
762 + #define RX_NORMAL_DESC0_OVT_WIDTH 16
763 +diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
764 +index f6a7161e3b85..5e6238e0b2bd 100644
765 +--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
766 ++++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
767 +@@ -1658,10 +1658,15 @@ static int xgbe_dev_read(struct xgbe_channel *channel)
768 +
769 + /* Get the header length */
770 + if (XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, FD)) {
771 ++ XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
772 ++ FIRST, 1);
773 + rdata->rx.hdr_len = XGMAC_GET_BITS_LE(rdesc->desc2,
774 + RX_NORMAL_DESC2, HL);
775 + if (rdata->rx.hdr_len)
776 + pdata->ext_stats.rx_split_header_packets++;
777 ++ } else {
778 ++ XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
779 ++ FIRST, 0);
780 + }
781 +
782 + /* Get the RSS hash */
783 +@@ -1684,19 +1689,16 @@ static int xgbe_dev_read(struct xgbe_channel *channel)
784 + }
785 + }
786 +
787 +- /* Get the packet length */
788 +- rdata->rx.len = XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, PL);
789 +-
790 +- if (!XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, LD)) {
791 +- /* Not all the data has been transferred for this packet */
792 +- XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
793 +- INCOMPLETE, 1);
794 ++ /* Not all the data has been transferred for this packet */
795 ++ if (!XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, LD))
796 + return 0;
797 +- }
798 +
799 + /* This is the last of the data for this packet */
800 + XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
801 +- INCOMPLETE, 0);
802 ++ LAST, 1);
803 ++
804 ++ /* Get the packet length */
805 ++ rdata->rx.len = XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, PL);
806 +
807 + /* Set checksum done indicator as appropriate */
808 + if (netdev->features & NETIF_F_RXCSUM)
809 +diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
810 +index 53ce1222b11d..865b7e0b133b 100644
811 +--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
812 ++++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
813 +@@ -1760,13 +1760,12 @@ static struct sk_buff *xgbe_create_skb(struct xgbe_prv_data *pdata,
814 + {
815 + struct sk_buff *skb;
816 + u8 *packet;
817 +- unsigned int copy_len;
818 +
819 + skb = napi_alloc_skb(napi, rdata->rx.hdr.dma_len);
820 + if (!skb)
821 + return NULL;
822 +
823 +- /* Start with the header buffer which may contain just the header
824 ++ /* Pull in the header buffer which may contain just the header
825 + * or the header plus data
826 + */
827 + dma_sync_single_range_for_cpu(pdata->dev, rdata->rx.hdr.dma_base,
828 +@@ -1775,30 +1774,49 @@ static struct sk_buff *xgbe_create_skb(struct xgbe_prv_data *pdata,
829 +
830 + packet = page_address(rdata->rx.hdr.pa.pages) +
831 + rdata->rx.hdr.pa.pages_offset;
832 +- copy_len = (rdata->rx.hdr_len) ? rdata->rx.hdr_len : len;
833 +- copy_len = min(rdata->rx.hdr.dma_len, copy_len);
834 +- skb_copy_to_linear_data(skb, packet, copy_len);
835 +- skb_put(skb, copy_len);
836 +-
837 +- len -= copy_len;
838 +- if (len) {
839 +- /* Add the remaining data as a frag */
840 +- dma_sync_single_range_for_cpu(pdata->dev,
841 +- rdata->rx.buf.dma_base,
842 +- rdata->rx.buf.dma_off,
843 +- rdata->rx.buf.dma_len,
844 +- DMA_FROM_DEVICE);
845 +-
846 +- skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
847 +- rdata->rx.buf.pa.pages,
848 +- rdata->rx.buf.pa.pages_offset,
849 +- len, rdata->rx.buf.dma_len);
850 +- rdata->rx.buf.pa.pages = NULL;
851 +- }
852 ++ skb_copy_to_linear_data(skb, packet, len);
853 ++ skb_put(skb, len);
854 +
855 + return skb;
856 + }
857 +
858 ++static unsigned int xgbe_rx_buf1_len(struct xgbe_ring_data *rdata,
859 ++ struct xgbe_packet_data *packet)
860 ++{
861 ++ /* Always zero if not the first descriptor */
862 ++ if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, FIRST))
863 ++ return 0;
864 ++
865 ++ /* First descriptor with split header, return header length */
866 ++ if (rdata->rx.hdr_len)
867 ++ return rdata->rx.hdr_len;
868 ++
869 ++ /* First descriptor but not the last descriptor and no split header,
870 ++ * so the full buffer was used
871 ++ */
872 ++ if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, LAST))
873 ++ return rdata->rx.hdr.dma_len;
874 ++
875 ++ /* First descriptor and last descriptor and no split header, so
876 ++ * calculate how much of the buffer was used
877 ++ */
878 ++ return min_t(unsigned int, rdata->rx.hdr.dma_len, rdata->rx.len);
879 ++}
880 ++
881 ++static unsigned int xgbe_rx_buf2_len(struct xgbe_ring_data *rdata,
882 ++ struct xgbe_packet_data *packet,
883 ++ unsigned int len)
884 ++{
885 ++ /* Always the full buffer if not the last descriptor */
886 ++ if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, LAST))
887 ++ return rdata->rx.buf.dma_len;
888 ++
889 ++ /* Last descriptor so calculate how much of the buffer was used
890 ++ * for the last bit of data
891 ++ */
892 ++ return rdata->rx.len - len;
893 ++}
894 ++
895 + static int xgbe_tx_poll(struct xgbe_channel *channel)
896 + {
897 + struct xgbe_prv_data *pdata = channel->pdata;
898 +@@ -1881,8 +1899,8 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
899 + struct napi_struct *napi;
900 + struct sk_buff *skb;
901 + struct skb_shared_hwtstamps *hwtstamps;
902 +- unsigned int incomplete, error, context_next, context;
903 +- unsigned int len, rdesc_len, max_len;
904 ++ unsigned int last, error, context_next, context;
905 ++ unsigned int len, buf1_len, buf2_len, max_len;
906 + unsigned int received = 0;
907 + int packet_count = 0;
908 +
909 +@@ -1892,7 +1910,7 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
910 + if (!ring)
911 + return 0;
912 +
913 +- incomplete = 0;
914 ++ last = 0;
915 + context_next = 0;
916 +
917 + napi = (pdata->per_channel_irq) ? &channel->napi : &pdata->napi;
918 +@@ -1926,9 +1944,8 @@ read_again:
919 + received++;
920 + ring->cur++;
921 +
922 +- incomplete = XGMAC_GET_BITS(packet->attributes,
923 +- RX_PACKET_ATTRIBUTES,
924 +- INCOMPLETE);
925 ++ last = XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
926 ++ LAST);
927 + context_next = XGMAC_GET_BITS(packet->attributes,
928 + RX_PACKET_ATTRIBUTES,
929 + CONTEXT_NEXT);
930 +@@ -1937,7 +1954,7 @@ read_again:
931 + CONTEXT);
932 +
933 + /* Earlier error, just drain the remaining data */
934 +- if ((incomplete || context_next) && error)
935 ++ if ((!last || context_next) && error)
936 + goto read_again;
937 +
938 + if (error || packet->errors) {
939 +@@ -1949,16 +1966,22 @@ read_again:
940 + }
941 +
942 + if (!context) {
943 +- /* Length is cumulative, get this descriptor's length */
944 +- rdesc_len = rdata->rx.len - len;
945 +- len += rdesc_len;
946 ++ /* Get the data length in the descriptor buffers */
947 ++ buf1_len = xgbe_rx_buf1_len(rdata, packet);
948 ++ len += buf1_len;
949 ++ buf2_len = xgbe_rx_buf2_len(rdata, packet, len);
950 ++ len += buf2_len;
951 +
952 +- if (rdesc_len && !skb) {
953 ++ if (!skb) {
954 + skb = xgbe_create_skb(pdata, napi, rdata,
955 +- rdesc_len);
956 +- if (!skb)
957 ++ buf1_len);
958 ++ if (!skb) {
959 + error = 1;
960 +- } else if (rdesc_len) {
961 ++ goto skip_data;
962 ++ }
963 ++ }
964 ++
965 ++ if (buf2_len) {
966 + dma_sync_single_range_for_cpu(pdata->dev,
967 + rdata->rx.buf.dma_base,
968 + rdata->rx.buf.dma_off,
969 +@@ -1968,13 +1991,14 @@ read_again:
970 + skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
971 + rdata->rx.buf.pa.pages,
972 + rdata->rx.buf.pa.pages_offset,
973 +- rdesc_len,
974 ++ buf2_len,
975 + rdata->rx.buf.dma_len);
976 + rdata->rx.buf.pa.pages = NULL;
977 + }
978 + }
979 +
980 +- if (incomplete || context_next)
981 ++skip_data:
982 ++ if (!last || context_next)
983 + goto read_again;
984 +
985 + if (!skb)
986 +@@ -2033,7 +2057,7 @@ next_packet:
987 + }
988 +
989 + /* Check if we need to save state before leaving */
990 +- if (received && (incomplete || context_next)) {
991 ++ if (received && (!last || context_next)) {
992 + rdata = XGBE_GET_DESC_DATA(ring, ring->cur);
993 + rdata->state_saved = 1;
994 + rdata->state.skb = skb;
995 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
996 +index 91627561c58d..f971d92f7b41 100644
997 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
998 ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
999 +@@ -3495,7 +3495,8 @@ static int bcmgenet_suspend(struct device *d)
1000 +
1001 + bcmgenet_netif_stop(dev);
1002 +
1003 +- phy_suspend(priv->phydev);
1004 ++ if (!device_may_wakeup(d))
1005 ++ phy_suspend(priv->phydev);
1006 +
1007 + netif_device_detach(dev);
1008 +
1009 +@@ -3592,7 +3593,8 @@ static int bcmgenet_resume(struct device *d)
1010 +
1011 + netif_device_attach(dev);
1012 +
1013 +- phy_resume(priv->phydev);
1014 ++ if (!device_may_wakeup(d))
1015 ++ phy_resume(priv->phydev);
1016 +
1017 + if (priv->eee.eee_enabled)
1018 + bcmgenet_eee_enable_set(dev, true);
1019 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
1020 +index 8bdfe53754ba..e96d1f95bb47 100644
1021 +--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
1022 ++++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
1023 +@@ -220,20 +220,6 @@ void bcmgenet_phy_power_set(struct net_device *dev, bool enable)
1024 + udelay(60);
1025 + }
1026 +
1027 +-static void bcmgenet_internal_phy_setup(struct net_device *dev)
1028 +-{
1029 +- struct bcmgenet_priv *priv = netdev_priv(dev);
1030 +- u32 reg;
1031 +-
1032 +- /* Power up PHY */
1033 +- bcmgenet_phy_power_set(dev, true);
1034 +- /* enable APD */
1035 +- reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
1036 +- reg |= EXT_PWR_DN_EN_LD;
1037 +- bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
1038 +- bcmgenet_mii_reset(dev);
1039 +-}
1040 +-
1041 + static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv)
1042 + {
1043 + u32 reg;
1044 +@@ -281,7 +267,6 @@ int bcmgenet_mii_config(struct net_device *dev)
1045 +
1046 + if (priv->internal_phy) {
1047 + phy_name = "internal PHY";
1048 +- bcmgenet_internal_phy_setup(dev);
1049 + } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
1050 + phy_name = "MoCA";
1051 + bcmgenet_moca_phy_setup(priv);
1052 +diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c
1053 +index 23ec28f43f6d..afaa98d1d4e4 100644
1054 +--- a/drivers/net/ethernet/intel/igb/e1000_phy.c
1055 ++++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
1056 +@@ -77,6 +77,10 @@ s32 igb_get_phy_id(struct e1000_hw *hw)
1057 + s32 ret_val = 0;
1058 + u16 phy_id;
1059 +
1060 ++ /* ensure PHY page selection to fix misconfigured i210 */
1061 ++ if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211))
1062 ++ phy->ops.write_reg(hw, I347AT4_PAGE_SELECT, 0);
1063 ++
1064 + ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id);
1065 + if (ret_val)
1066 + goto out;
1067 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
1068 +index cf0098596e85..e9408f5e2a1d 100644
1069 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
1070 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
1071 +@@ -197,6 +197,10 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe,
1072 + if (lro_num_seg > 1) {
1073 + mlx5e_lro_update_hdr(skb, cqe);
1074 + skb_shinfo(skb)->gso_size = DIV_ROUND_UP(cqe_bcnt, lro_num_seg);
1075 ++ /* Subtract one since we already counted this as one
1076 ++ * "regular" packet in mlx5e_complete_rx_cqe()
1077 ++ */
1078 ++ rq->stats.packets += lro_num_seg - 1;
1079 + rq->stats.lro_packets++;
1080 + rq->stats.lro_bytes += cqe_bcnt;
1081 + }
1082 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
1083 +index ba115ec7aa92..1e611980cf99 100644
1084 +--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
1085 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
1086 +@@ -85,7 +85,7 @@ static struct mlx5_profile profile[] = {
1087 + [2] = {
1088 + .mask = MLX5_PROF_MASK_QP_SIZE |
1089 + MLX5_PROF_MASK_MR_CACHE,
1090 +- .log_max_qp = 17,
1091 ++ .log_max_qp = 18,
1092 + .mr_cache[0] = {
1093 + .size = 500,
1094 + .limit = 250
1095 +diff --git a/drivers/parport/share.c b/drivers/parport/share.c
1096 +index 5ce5ef211bdb..754f21fd9768 100644
1097 +--- a/drivers/parport/share.c
1098 ++++ b/drivers/parport/share.c
1099 +@@ -936,8 +936,10 @@ parport_register_dev_model(struct parport *port, const char *name,
1100 + * pardevice fields. -arca
1101 + */
1102 + port->ops->init_state(par_dev, par_dev->state);
1103 +- port->proc_device = par_dev;
1104 +- parport_device_proc_register(par_dev);
1105 ++ if (!test_and_set_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags)) {
1106 ++ port->proc_device = par_dev;
1107 ++ parport_device_proc_register(par_dev);
1108 ++ }
1109 +
1110 + return par_dev;
1111 +
1112 +diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
1113 +index 31f31d460fc9..357527712539 100644
1114 +--- a/drivers/pci/iov.c
1115 ++++ b/drivers/pci/iov.c
1116 +@@ -303,13 +303,6 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
1117 + return rc;
1118 + }
1119 +
1120 +- pci_iov_set_numvfs(dev, nr_virtfn);
1121 +- iov->ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE;
1122 +- pci_cfg_access_lock(dev);
1123 +- pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
1124 +- msleep(100);
1125 +- pci_cfg_access_unlock(dev);
1126 +-
1127 + iov->initial_VFs = initial;
1128 + if (nr_virtfn < initial)
1129 + initial = nr_virtfn;
1130 +@@ -320,6 +313,13 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
1131 + goto err_pcibios;
1132 + }
1133 +
1134 ++ pci_iov_set_numvfs(dev, nr_virtfn);
1135 ++ iov->ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE;
1136 ++ pci_cfg_access_lock(dev);
1137 ++ pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
1138 ++ msleep(100);
1139 ++ pci_cfg_access_unlock(dev);
1140 ++
1141 + for (i = 0; i < initial; i++) {
1142 + rc = virtfn_add(dev, i, 0);
1143 + if (rc)
1144 +@@ -555,21 +555,61 @@ void pci_iov_release(struct pci_dev *dev)
1145 + }
1146 +
1147 + /**
1148 +- * pci_iov_resource_bar - get position of the SR-IOV BAR
1149 ++ * pci_iov_update_resource - update a VF BAR
1150 + * @dev: the PCI device
1151 + * @resno: the resource number
1152 + *
1153 +- * Returns position of the BAR encapsulated in the SR-IOV capability.
1154 ++ * Update a VF BAR in the SR-IOV capability of a PF.
1155 + */
1156 +-int pci_iov_resource_bar(struct pci_dev *dev, int resno)
1157 ++void pci_iov_update_resource(struct pci_dev *dev, int resno)
1158 + {
1159 +- if (resno < PCI_IOV_RESOURCES || resno > PCI_IOV_RESOURCE_END)
1160 +- return 0;
1161 ++ struct pci_sriov *iov = dev->is_physfn ? dev->sriov : NULL;
1162 ++ struct resource *res = dev->resource + resno;
1163 ++ int vf_bar = resno - PCI_IOV_RESOURCES;
1164 ++ struct pci_bus_region region;
1165 ++ u16 cmd;
1166 ++ u32 new;
1167 ++ int reg;
1168 ++
1169 ++ /*
1170 ++ * The generic pci_restore_bars() path calls this for all devices,
1171 ++ * including VFs and non-SR-IOV devices. If this is not a PF, we
1172 ++ * have nothing to do.
1173 ++ */
1174 ++ if (!iov)
1175 ++ return;
1176 ++
1177 ++ pci_read_config_word(dev, iov->pos + PCI_SRIOV_CTRL, &cmd);
1178 ++ if ((cmd & PCI_SRIOV_CTRL_VFE) && (cmd & PCI_SRIOV_CTRL_MSE)) {
1179 ++ dev_WARN(&dev->dev, "can't update enabled VF BAR%d %pR\n",
1180 ++ vf_bar, res);
1181 ++ return;
1182 ++ }
1183 ++
1184 ++ /*
1185 ++ * Ignore unimplemented BARs, unused resource slots for 64-bit
1186 ++ * BARs, and non-movable resources, e.g., those described via
1187 ++ * Enhanced Allocation.
1188 ++ */
1189 ++ if (!res->flags)
1190 ++ return;
1191 ++
1192 ++ if (res->flags & IORESOURCE_UNSET)
1193 ++ return;
1194 ++
1195 ++ if (res->flags & IORESOURCE_PCI_FIXED)
1196 ++ return;
1197 +
1198 +- BUG_ON(!dev->is_physfn);
1199 ++ pcibios_resource_to_bus(dev->bus, &region, res);
1200 ++ new = region.start;
1201 ++ new |= res->flags & ~PCI_BASE_ADDRESS_MEM_MASK;
1202 +
1203 +- return dev->sriov->pos + PCI_SRIOV_BAR +
1204 +- 4 * (resno - PCI_IOV_RESOURCES);
1205 ++ reg = iov->pos + PCI_SRIOV_BAR + 4 * vf_bar;
1206 ++ pci_write_config_dword(dev, reg, new);
1207 ++ if (res->flags & IORESOURCE_MEM_64) {
1208 ++ new = region.start >> 16 >> 16;
1209 ++ pci_write_config_dword(dev, reg + 4, new);
1210 ++ }
1211 + }
1212 +
1213 + resource_size_t __weak pcibios_iov_resource_alignment(struct pci_dev *dev,
1214 +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
1215 +index e311a9bf2c90..0e53488f8ec1 100644
1216 +--- a/drivers/pci/pci.c
1217 ++++ b/drivers/pci/pci.c
1218 +@@ -519,10 +519,6 @@ static void pci_restore_bars(struct pci_dev *dev)
1219 + {
1220 + int i;
1221 +
1222 +- /* Per SR-IOV spec 3.4.1.11, VF BARs are RO zero */
1223 +- if (dev->is_virtfn)
1224 +- return;
1225 +-
1226 + for (i = 0; i < PCI_BRIDGE_RESOURCES; i++)
1227 + pci_update_resource(dev, i);
1228 + }
1229 +@@ -4472,36 +4468,6 @@ int pci_select_bars(struct pci_dev *dev, unsigned long flags)
1230 + }
1231 + EXPORT_SYMBOL(pci_select_bars);
1232 +
1233 +-/**
1234 +- * pci_resource_bar - get position of the BAR associated with a resource
1235 +- * @dev: the PCI device
1236 +- * @resno: the resource number
1237 +- * @type: the BAR type to be filled in
1238 +- *
1239 +- * Returns BAR position in config space, or 0 if the BAR is invalid.
1240 +- */
1241 +-int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type)
1242 +-{
1243 +- int reg;
1244 +-
1245 +- if (resno < PCI_ROM_RESOURCE) {
1246 +- *type = pci_bar_unknown;
1247 +- return PCI_BASE_ADDRESS_0 + 4 * resno;
1248 +- } else if (resno == PCI_ROM_RESOURCE) {
1249 +- *type = pci_bar_mem32;
1250 +- return dev->rom_base_reg;
1251 +- } else if (resno < PCI_BRIDGE_RESOURCES) {
1252 +- /* device specific resource */
1253 +- *type = pci_bar_unknown;
1254 +- reg = pci_iov_resource_bar(dev, resno);
1255 +- if (reg)
1256 +- return reg;
1257 +- }
1258 +-
1259 +- dev_err(&dev->dev, "BAR %d: invalid resource\n", resno);
1260 +- return 0;
1261 +-}
1262 +-
1263 + /* Some architectures require additional programming to enable VGA */
1264 + static arch_set_vga_state_t arch_set_vga_state;
1265 +
1266 +diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
1267 +index d390fc1475ec..c43e448873ca 100644
1268 +--- a/drivers/pci/pci.h
1269 ++++ b/drivers/pci/pci.h
1270 +@@ -232,7 +232,6 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *pl,
1271 + int pci_setup_device(struct pci_dev *dev);
1272 + int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
1273 + struct resource *res, unsigned int reg);
1274 +-int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type);
1275 + void pci_configure_ari(struct pci_dev *dev);
1276 + void __pci_bus_size_bridges(struct pci_bus *bus,
1277 + struct list_head *realloc_head);
1278 +@@ -276,7 +275,7 @@ static inline void pci_restore_ats_state(struct pci_dev *dev)
1279 + #ifdef CONFIG_PCI_IOV
1280 + int pci_iov_init(struct pci_dev *dev);
1281 + void pci_iov_release(struct pci_dev *dev);
1282 +-int pci_iov_resource_bar(struct pci_dev *dev, int resno);
1283 ++void pci_iov_update_resource(struct pci_dev *dev, int resno);
1284 + resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno);
1285 + void pci_restore_iov_state(struct pci_dev *dev);
1286 + int pci_iov_bus_range(struct pci_bus *bus);
1287 +@@ -290,10 +289,6 @@ static inline void pci_iov_release(struct pci_dev *dev)
1288 +
1289 + {
1290 + }
1291 +-static inline int pci_iov_resource_bar(struct pci_dev *dev, int resno)
1292 +-{
1293 +- return 0;
1294 +-}
1295 + static inline void pci_restore_iov_state(struct pci_dev *dev)
1296 + {
1297 + }
1298 +diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
1299 +index 71d9a6d1bd56..b83df942794f 100644
1300 +--- a/drivers/pci/probe.c
1301 ++++ b/drivers/pci/probe.c
1302 +@@ -226,7 +226,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
1303 + mask64 = (u32)PCI_BASE_ADDRESS_MEM_MASK;
1304 + }
1305 + } else {
1306 +- res->flags |= (l & IORESOURCE_ROM_ENABLE);
1307 ++ if (l & PCI_ROM_ADDRESS_ENABLE)
1308 ++ res->flags |= IORESOURCE_ROM_ENABLE;
1309 + l64 = l & PCI_ROM_ADDRESS_MASK;
1310 + sz64 = sz & PCI_ROM_ADDRESS_MASK;
1311 + mask64 = (u32)PCI_ROM_ADDRESS_MASK;
1312 +diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
1313 +index eb0ad530dc43..3eea7fc5e1a2 100644
1314 +--- a/drivers/pci/rom.c
1315 ++++ b/drivers/pci/rom.c
1316 +@@ -31,6 +31,11 @@ int pci_enable_rom(struct pci_dev *pdev)
1317 + if (!res->flags)
1318 + return -1;
1319 +
1320 ++ /*
1321 ++ * Ideally pci_update_resource() would update the ROM BAR address,
1322 ++ * and we would only set the enable bit here. But apparently some
1323 ++ * devices have buggy ROM BARs that read as zero when disabled.
1324 ++ */
1325 + pcibios_resource_to_bus(pdev->bus, &region, res);
1326 + pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_addr);
1327 + rom_addr &= ~PCI_ROM_ADDRESS_MASK;
1328 +diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
1329 +index 604011e047d6..25062966cbfa 100644
1330 +--- a/drivers/pci/setup-res.c
1331 ++++ b/drivers/pci/setup-res.c
1332 +@@ -25,21 +25,18 @@
1333 + #include <linux/slab.h>
1334 + #include "pci.h"
1335 +
1336 +-
1337 +-void pci_update_resource(struct pci_dev *dev, int resno)
1338 ++static void pci_std_update_resource(struct pci_dev *dev, int resno)
1339 + {
1340 + struct pci_bus_region region;
1341 + bool disable;
1342 + u16 cmd;
1343 + u32 new, check, mask;
1344 + int reg;
1345 +- enum pci_bar_type type;
1346 + struct resource *res = dev->resource + resno;
1347 +
1348 +- if (dev->is_virtfn) {
1349 +- dev_warn(&dev->dev, "can't update VF BAR%d\n", resno);
1350 ++ /* Per SR-IOV spec 3.4.1.11, VF BARs are RO zero */
1351 ++ if (dev->is_virtfn)
1352 + return;
1353 +- }
1354 +
1355 + /*
1356 + * Ignore resources for unimplemented BARs and unused resource slots
1357 +@@ -60,21 +57,34 @@ void pci_update_resource(struct pci_dev *dev, int resno)
1358 + return;
1359 +
1360 + pcibios_resource_to_bus(dev->bus, &region, res);
1361 ++ new = region.start;
1362 +
1363 +- new = region.start | (res->flags & PCI_REGION_FLAG_MASK);
1364 +- if (res->flags & IORESOURCE_IO)
1365 ++ if (res->flags & IORESOURCE_IO) {
1366 + mask = (u32)PCI_BASE_ADDRESS_IO_MASK;
1367 +- else
1368 ++ new |= res->flags & ~PCI_BASE_ADDRESS_IO_MASK;
1369 ++ } else if (resno == PCI_ROM_RESOURCE) {
1370 ++ mask = (u32)PCI_ROM_ADDRESS_MASK;
1371 ++ } else {
1372 + mask = (u32)PCI_BASE_ADDRESS_MEM_MASK;
1373 ++ new |= res->flags & ~PCI_BASE_ADDRESS_MEM_MASK;
1374 ++ }
1375 +
1376 +- reg = pci_resource_bar(dev, resno, &type);
1377 +- if (!reg)
1378 +- return;
1379 +- if (type != pci_bar_unknown) {
1380 ++ if (resno < PCI_ROM_RESOURCE) {
1381 ++ reg = PCI_BASE_ADDRESS_0 + 4 * resno;
1382 ++ } else if (resno == PCI_ROM_RESOURCE) {
1383 ++
1384 ++ /*
1385 ++ * Apparently some Matrox devices have ROM BARs that read
1386 ++ * as zero when disabled, so don't update ROM BARs unless
1387 ++ * they're enabled. See https://lkml.org/lkml/2005/8/30/138.
1388 ++ */
1389 + if (!(res->flags & IORESOURCE_ROM_ENABLE))
1390 + return;
1391 ++
1392 ++ reg = dev->rom_base_reg;
1393 + new |= PCI_ROM_ADDRESS_ENABLE;
1394 +- }
1395 ++ } else
1396 ++ return;
1397 +
1398 + /*
1399 + * We can't update a 64-bit BAR atomically, so when possible,
1400 +@@ -110,6 +120,16 @@ void pci_update_resource(struct pci_dev *dev, int resno)
1401 + pci_write_config_word(dev, PCI_COMMAND, cmd);
1402 + }
1403 +
1404 ++void pci_update_resource(struct pci_dev *dev, int resno)
1405 ++{
1406 ++ if (resno <= PCI_ROM_RESOURCE)
1407 ++ pci_std_update_resource(dev, resno);
1408 ++#ifdef CONFIG_PCI_IOV
1409 ++ else if (resno >= PCI_IOV_RESOURCES && resno <= PCI_IOV_RESOURCE_END)
1410 ++ pci_iov_update_resource(dev, resno);
1411 ++#endif
1412 ++}
1413 ++
1414 + int pci_claim_resource(struct pci_dev *dev, int resource)
1415 + {
1416 + struct resource *res = &dev->resource[resource];
1417 +diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
1418 +index 24ec282e15d8..7c3b8d3516e3 100644
1419 +--- a/drivers/s390/crypto/ap_bus.c
1420 ++++ b/drivers/s390/crypto/ap_bus.c
1421 +@@ -1651,6 +1651,9 @@ static void ap_scan_bus(struct work_struct *unused)
1422 + ap_dev->queue_depth = queue_depth;
1423 + ap_dev->raw_hwtype = device_type;
1424 + ap_dev->device_type = device_type;
1425 ++ /* CEX6 toleration: map to CEX5 */
1426 ++ if (device_type == AP_DEVICE_TYPE_CEX6)
1427 ++ ap_dev->device_type = AP_DEVICE_TYPE_CEX5;
1428 + ap_dev->functions = device_functions;
1429 + spin_lock_init(&ap_dev->lock);
1430 + INIT_LIST_HEAD(&ap_dev->pendingq);
1431 +diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h
1432 +index 6adcbdf225d1..cc741e948170 100644
1433 +--- a/drivers/s390/crypto/ap_bus.h
1434 ++++ b/drivers/s390/crypto/ap_bus.h
1435 +@@ -105,6 +105,7 @@ static inline int ap_test_bit(unsigned int *ptr, unsigned int nr)
1436 + #define AP_DEVICE_TYPE_CEX3C 9
1437 + #define AP_DEVICE_TYPE_CEX4 10
1438 + #define AP_DEVICE_TYPE_CEX5 11
1439 ++#define AP_DEVICE_TYPE_CEX6 12
1440 +
1441 + /*
1442 + * Known function facilities
1443 +diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
1444 +index 5b24ffd93649..83ff1724ec79 100644
1445 +--- a/drivers/tty/serial/8250/8250_pci.c
1446 ++++ b/drivers/tty/serial/8250/8250_pci.c
1447 +@@ -57,6 +57,7 @@ struct serial_private {
1448 + unsigned int nr;
1449 + void __iomem *remapped_bar[PCI_NUM_BAR_RESOURCES];
1450 + struct pci_serial_quirk *quirk;
1451 ++ const struct pciserial_board *board;
1452 + int line[0];
1453 + };
1454 +
1455 +@@ -4058,6 +4059,7 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board)
1456 + }
1457 + }
1458 + priv->nr = i;
1459 ++ priv->board = board;
1460 + return priv;
1461 +
1462 + err_deinit:
1463 +@@ -4068,7 +4070,7 @@ err_out:
1464 + }
1465 + EXPORT_SYMBOL_GPL(pciserial_init_ports);
1466 +
1467 +-void pciserial_remove_ports(struct serial_private *priv)
1468 ++void pciserial_detach_ports(struct serial_private *priv)
1469 + {
1470 + struct pci_serial_quirk *quirk;
1471 + int i;
1472 +@@ -4088,7 +4090,11 @@ void pciserial_remove_ports(struct serial_private *priv)
1473 + quirk = find_quirk(priv->dev);
1474 + if (quirk->exit)
1475 + quirk->exit(priv->dev);
1476 ++}
1477 +
1478 ++void pciserial_remove_ports(struct serial_private *priv)
1479 ++{
1480 ++ pciserial_detach_ports(priv);
1481 + kfree(priv);
1482 + }
1483 + EXPORT_SYMBOL_GPL(pciserial_remove_ports);
1484 +@@ -5819,7 +5825,7 @@ static pci_ers_result_t serial8250_io_error_detected(struct pci_dev *dev,
1485 + return PCI_ERS_RESULT_DISCONNECT;
1486 +
1487 + if (priv)
1488 +- pciserial_suspend_ports(priv);
1489 ++ pciserial_detach_ports(priv);
1490 +
1491 + pci_disable_device(dev);
1492 +
1493 +@@ -5844,9 +5850,18 @@ static pci_ers_result_t serial8250_io_slot_reset(struct pci_dev *dev)
1494 + static void serial8250_io_resume(struct pci_dev *dev)
1495 + {
1496 + struct serial_private *priv = pci_get_drvdata(dev);
1497 ++ const struct pciserial_board *board;
1498 +
1499 +- if (priv)
1500 +- pciserial_resume_ports(priv);
1501 ++ if (!priv)
1502 ++ return;
1503 ++
1504 ++ board = priv->board;
1505 ++ kfree(priv);
1506 ++ priv = pciserial_init_ports(dev, board);
1507 ++
1508 ++ if (!IS_ERR(priv)) {
1509 ++ pci_set_drvdata(dev, priv);
1510 ++ }
1511 + }
1512 +
1513 + static const struct pci_error_handlers serial8250_err_handler = {
1514 +diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
1515 +index deaddb950c20..24337ac3323f 100644
1516 +--- a/drivers/usb/class/usbtmc.c
1517 ++++ b/drivers/usb/class/usbtmc.c
1518 +@@ -1105,7 +1105,7 @@ static int usbtmc_probe(struct usb_interface *intf,
1519 +
1520 + dev_dbg(&intf->dev, "%s called\n", __func__);
1521 +
1522 +- data = kmalloc(sizeof(*data), GFP_KERNEL);
1523 ++ data = kzalloc(sizeof(*data), GFP_KERNEL);
1524 + if (!data)
1525 + return -ENOMEM;
1526 +
1527 +@@ -1163,6 +1163,12 @@ static int usbtmc_probe(struct usb_interface *intf,
1528 + }
1529 + }
1530 +
1531 ++ if (!data->bulk_out || !data->bulk_in) {
1532 ++ dev_err(&intf->dev, "bulk endpoints not found\n");
1533 ++ retcode = -ENODEV;
1534 ++ goto err_put;
1535 ++ }
1536 ++
1537 + retcode = get_capabilities(data);
1538 + if (retcode)
1539 + dev_err(&intf->dev, "can't read capabilities\n");
1540 +@@ -1186,6 +1192,7 @@ static int usbtmc_probe(struct usb_interface *intf,
1541 + error_register:
1542 + sysfs_remove_group(&intf->dev.kobj, &capability_attr_grp);
1543 + sysfs_remove_group(&intf->dev.kobj, &data_attr_grp);
1544 ++err_put:
1545 + kref_put(&data->kref, usbtmc_delete);
1546 + return retcode;
1547 + }
1548 +diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
1549 +index ac30a051ad71..325cbc9c35d8 100644
1550 +--- a/drivers/usb/core/config.c
1551 ++++ b/drivers/usb/core/config.c
1552 +@@ -246,6 +246,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
1553 +
1554 + /*
1555 + * Adjust bInterval for quirked devices.
1556 ++ */
1557 ++ /*
1558 ++ * This quirk fixes bIntervals reported in ms.
1559 ++ */
1560 ++ if (to_usb_device(ddev)->quirks &
1561 ++ USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL) {
1562 ++ n = clamp(fls(d->bInterval) + 3, i, j);
1563 ++ i = j = n;
1564 ++ }
1565 ++ /*
1566 + * This quirk fixes bIntervals reported in
1567 + * linear microframes.
1568 + */
1569 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1570 +index f52d8abf6979..9e62c93af96e 100644
1571 +--- a/drivers/usb/core/hub.c
1572 ++++ b/drivers/usb/core/hub.c
1573 +@@ -4199,7 +4199,7 @@ static void hub_set_initial_usb2_lpm_policy(struct usb_device *udev)
1574 + struct usb_hub *hub = usb_hub_to_struct_hub(udev->parent);
1575 + int connect_type = USB_PORT_CONNECT_TYPE_UNKNOWN;
1576 +
1577 +- if (!udev->usb2_hw_lpm_capable)
1578 ++ if (!udev->usb2_hw_lpm_capable || !udev->bos)
1579 + return;
1580 +
1581 + if (hub)
1582 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1583 +index 24f9f98968a5..96b21b0dac1e 100644
1584 +--- a/drivers/usb/core/quirks.c
1585 ++++ b/drivers/usb/core/quirks.c
1586 +@@ -170,6 +170,14 @@ static const struct usb_device_id usb_quirk_list[] = {
1587 + /* M-Systems Flash Disk Pioneers */
1588 + { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
1589 +
1590 ++ /* Baum Vario Ultra */
1591 ++ { USB_DEVICE(0x0904, 0x6101), .driver_info =
1592 ++ USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
1593 ++ { USB_DEVICE(0x0904, 0x6102), .driver_info =
1594 ++ USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
1595 ++ { USB_DEVICE(0x0904, 0x6103), .driver_info =
1596 ++ USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
1597 ++
1598 + /* Keytouch QWERTY Panel keyboard */
1599 + { USB_DEVICE(0x0926, 0x3333), .driver_info =
1600 + USB_QUIRK_CONFIG_INTF_STRINGS },
1601 +diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c
1602 +index 2fa1e80a3ce7..67e474b13fca 100644
1603 +--- a/drivers/usb/gadget/function/f_acm.c
1604 ++++ b/drivers/usb/gadget/function/f_acm.c
1605 +@@ -535,13 +535,15 @@ static int acm_notify_serial_state(struct f_acm *acm)
1606 + {
1607 + struct usb_composite_dev *cdev = acm->port.func.config->cdev;
1608 + int status;
1609 ++ __le16 serial_state;
1610 +
1611 + spin_lock(&acm->lock);
1612 + if (acm->notify_req) {
1613 + dev_dbg(&cdev->gadget->dev, "acm ttyGS%d serial state %04x\n",
1614 + acm->port_num, acm->serial_state);
1615 ++ serial_state = cpu_to_le16(acm->serial_state);
1616 + status = acm_cdc_notify(acm, USB_CDC_NOTIFY_SERIAL_STATE,
1617 +- 0, &acm->serial_state, sizeof(acm->serial_state));
1618 ++ 0, &serial_state, sizeof(acm->serial_state));
1619 + } else {
1620 + acm->pending = true;
1621 + status = 0;
1622 +diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
1623 +index 29b41b5dee04..c7689d05356c 100644
1624 +--- a/drivers/usb/gadget/function/f_uvc.c
1625 ++++ b/drivers/usb/gadget/function/f_uvc.c
1626 +@@ -625,7 +625,7 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
1627 + uvc_ss_streaming_comp.bMaxBurst = opts->streaming_maxburst;
1628 + uvc_ss_streaming_comp.wBytesPerInterval =
1629 + cpu_to_le16(max_packet_size * max_packet_mult *
1630 +- opts->streaming_maxburst);
1631 ++ (opts->streaming_maxburst + 1));
1632 +
1633 + /* Allocate endpoints. */
1634 + ep = usb_ep_autoconfig(cdev->gadget, &uvc_control_ep);
1635 +diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
1636 +index 4e38683c653c..6d4e75785710 100644
1637 +--- a/drivers/usb/misc/idmouse.c
1638 ++++ b/drivers/usb/misc/idmouse.c
1639 +@@ -346,6 +346,9 @@ static int idmouse_probe(struct usb_interface *interface,
1640 + if (iface_desc->desc.bInterfaceClass != 0x0A)
1641 + return -ENODEV;
1642 +
1643 ++ if (iface_desc->desc.bNumEndpoints < 1)
1644 ++ return -ENODEV;
1645 ++
1646 + /* allocate memory for our device state and initialize it */
1647 + dev = kzalloc(sizeof(*dev), GFP_KERNEL);
1648 + if (dev == NULL)
1649 +diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c
1650 +index 86b4e4b2ab9a..383fa007348f 100644
1651 +--- a/drivers/usb/misc/lvstest.c
1652 ++++ b/drivers/usb/misc/lvstest.c
1653 +@@ -370,6 +370,10 @@ static int lvs_rh_probe(struct usb_interface *intf,
1654 +
1655 + hdev = interface_to_usbdev(intf);
1656 + desc = intf->cur_altsetting;
1657 ++
1658 ++ if (desc->desc.bNumEndpoints < 1)
1659 ++ return -ENODEV;
1660 ++
1661 + endpoint = &desc->endpoint[0].desc;
1662 +
1663 + /* valid only for SS root hub */
1664 +diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
1665 +index bbd029c9c725..442b6631162e 100644
1666 +--- a/drivers/usb/misc/uss720.c
1667 ++++ b/drivers/usb/misc/uss720.c
1668 +@@ -711,6 +711,11 @@ static int uss720_probe(struct usb_interface *intf,
1669 +
1670 + interface = intf->cur_altsetting;
1671 +
1672 ++ if (interface->desc.bNumEndpoints < 3) {
1673 ++ usb_put_dev(usbdev);
1674 ++ return -ENODEV;
1675 ++ }
1676 ++
1677 + /*
1678 + * Allocate parport interface
1679 + */
1680 +diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
1681 +index e499b862a946..88f26ac2a185 100644
1682 +--- a/drivers/usb/musb/musb_cppi41.c
1683 ++++ b/drivers/usb/musb/musb_cppi41.c
1684 +@@ -250,8 +250,27 @@ static void cppi41_dma_callback(void *private_data)
1685 + transferred < cppi41_channel->packet_sz)
1686 + cppi41_channel->prog_len = 0;
1687 +
1688 +- if (cppi41_channel->is_tx)
1689 +- empty = musb_is_tx_fifo_empty(hw_ep);
1690 ++ if (cppi41_channel->is_tx) {
1691 ++ u8 type;
1692 ++
1693 ++ if (is_host_active(musb))
1694 ++ type = hw_ep->out_qh->type;
1695 ++ else
1696 ++ type = hw_ep->ep_in.type;
1697 ++
1698 ++ if (type == USB_ENDPOINT_XFER_ISOC)
1699 ++ /*
1700 ++ * Don't use the early-TX-interrupt workaround below
1701 ++ * for Isoch transfter. Since Isoch are periodic
1702 ++ * transfer, by the time the next transfer is
1703 ++ * scheduled, the current one should be done already.
1704 ++ *
1705 ++ * This avoids audio playback underrun issue.
1706 ++ */
1707 ++ empty = true;
1708 ++ else
1709 ++ empty = musb_is_tx_fifo_empty(hw_ep);
1710 ++ }
1711 +
1712 + if (!cppi41_channel->is_tx || empty) {
1713 + cppi41_trans_done(cppi41_channel);
1714 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1715 +index 42cc72e54c05..af67a0de6b5d 100644
1716 +--- a/drivers/usb/serial/option.c
1717 ++++ b/drivers/usb/serial/option.c
1718 +@@ -233,6 +233,14 @@ static void option_instat_callback(struct urb *urb);
1719 + #define BANDRICH_PRODUCT_1012 0x1012
1720 +
1721 + #define QUALCOMM_VENDOR_ID 0x05C6
1722 ++/* These Quectel products use Qualcomm's vendor ID */
1723 ++#define QUECTEL_PRODUCT_UC20 0x9003
1724 ++#define QUECTEL_PRODUCT_UC15 0x9090
1725 ++
1726 ++#define QUECTEL_VENDOR_ID 0x2c7c
1727 ++/* These Quectel products use Quectel's vendor ID */
1728 ++#define QUECTEL_PRODUCT_EC21 0x0121
1729 ++#define QUECTEL_PRODUCT_EC25 0x0125
1730 +
1731 + #define CMOTECH_VENDOR_ID 0x16d8
1732 + #define CMOTECH_PRODUCT_6001 0x6001
1733 +@@ -1161,7 +1169,14 @@ static const struct usb_device_id option_ids[] = {
1734 + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
1735 + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */
1736 + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
1737 +- { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9003), /* Quectel UC20 */
1738 ++ /* Quectel products using Qualcomm vendor ID */
1739 ++ { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)},
1740 ++ { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20),
1741 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1742 ++ /* Quectel products using Quectel vendor ID */
1743 ++ { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
1744 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1745 ++ { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
1746 + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1747 + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
1748 + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
1749 +diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
1750 +index 696458db7e3c..38b3f0d8cd58 100644
1751 +--- a/drivers/usb/serial/qcserial.c
1752 ++++ b/drivers/usb/serial/qcserial.c
1753 +@@ -169,6 +169,8 @@ static const struct usb_device_id id_table[] = {
1754 + {DEVICE_SWI(0x413c, 0x81a9)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
1755 + {DEVICE_SWI(0x413c, 0x81b1)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */
1756 + {DEVICE_SWI(0x413c, 0x81b3)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
1757 ++ {DEVICE_SWI(0x413c, 0x81b5)}, /* Dell Wireless 5811e QDL */
1758 ++ {DEVICE_SWI(0x413c, 0x81b6)}, /* Dell Wireless 5811e QDL */
1759 +
1760 + /* Huawei devices */
1761 + {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
1762 +diff --git a/drivers/usb/wusbcore/wa-hc.c b/drivers/usb/wusbcore/wa-hc.c
1763 +index 252c7bd9218a..d01496fd27fe 100644
1764 +--- a/drivers/usb/wusbcore/wa-hc.c
1765 ++++ b/drivers/usb/wusbcore/wa-hc.c
1766 +@@ -39,6 +39,9 @@ int wa_create(struct wahc *wa, struct usb_interface *iface,
1767 + int result;
1768 + struct device *dev = &iface->dev;
1769 +
1770 ++ if (iface->cur_altsetting->desc.bNumEndpoints < 3)
1771 ++ return -ENODEV;
1772 ++
1773 + result = wa_rpipes_create(wa);
1774 + if (result < 0)
1775 + goto error_rpipes_create;
1776 +diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
1777 +index 0257f35cfb9d..e75bbe5a10cd 100644
1778 +--- a/drivers/uwb/hwa-rc.c
1779 ++++ b/drivers/uwb/hwa-rc.c
1780 +@@ -825,6 +825,9 @@ static int hwarc_probe(struct usb_interface *iface,
1781 + struct hwarc *hwarc;
1782 + struct device *dev = &iface->dev;
1783 +
1784 ++ if (iface->cur_altsetting->desc.bNumEndpoints < 1)
1785 ++ return -ENODEV;
1786 ++
1787 + result = -ENOMEM;
1788 + uwb_rc = uwb_rc_alloc();
1789 + if (uwb_rc == NULL) {
1790 +diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c
1791 +index 2bfc846ac071..6345e85822a4 100644
1792 +--- a/drivers/uwb/i1480/dfu/usb.c
1793 ++++ b/drivers/uwb/i1480/dfu/usb.c
1794 +@@ -362,6 +362,9 @@ int i1480_usb_probe(struct usb_interface *iface, const struct usb_device_id *id)
1795 + result);
1796 + }
1797 +
1798 ++ if (iface->cur_altsetting->desc.bNumEndpoints < 1)
1799 ++ return -ENODEV;
1800 ++
1801 + result = -ENOMEM;
1802 + i1480_usb = kzalloc(sizeof(*i1480_usb), GFP_KERNEL);
1803 + if (i1480_usb == NULL) {
1804 +diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c
1805 +index 0582b72ef377..1a9f18b40be6 100644
1806 +--- a/drivers/vfio/vfio_iommu_spapr_tce.c
1807 ++++ b/drivers/vfio/vfio_iommu_spapr_tce.c
1808 +@@ -511,6 +511,12 @@ static long tce_iommu_build_v2(struct tce_container *container,
1809 + unsigned long hpa;
1810 + enum dma_data_direction dirtmp;
1811 +
1812 ++ if (!tbl->it_userspace) {
1813 ++ ret = tce_iommu_userspace_view_alloc(tbl);
1814 ++ if (ret)
1815 ++ return ret;
1816 ++ }
1817 ++
1818 + for (i = 0; i < pages; ++i) {
1819 + struct mm_iommu_table_group_mem_t *mem = NULL;
1820 + unsigned long *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl,
1821 +@@ -584,15 +590,6 @@ static long tce_iommu_create_table(struct tce_container *container,
1822 + WARN_ON(!ret && !(*ptbl)->it_ops->free);
1823 + WARN_ON(!ret && ((*ptbl)->it_allocated_size != table_size));
1824 +
1825 +- if (!ret && container->v2) {
1826 +- ret = tce_iommu_userspace_view_alloc(*ptbl);
1827 +- if (ret)
1828 +- (*ptbl)->it_ops->free(*ptbl);
1829 +- }
1830 +-
1831 +- if (ret)
1832 +- decrement_locked_vm(table_size >> PAGE_SHIFT);
1833 +-
1834 + return ret;
1835 + }
1836 +
1837 +@@ -1064,10 +1061,7 @@ static int tce_iommu_take_ownership(struct tce_container *container,
1838 + if (!tbl || !tbl->it_map)
1839 + continue;
1840 +
1841 +- rc = tce_iommu_userspace_view_alloc(tbl);
1842 +- if (!rc)
1843 +- rc = iommu_take_ownership(tbl);
1844 +-
1845 ++ rc = iommu_take_ownership(tbl);
1846 + if (rc) {
1847 + for (j = 0; j < i; ++j)
1848 + iommu_release_ownership(
1849 +diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
1850 +index 6e92917ba77a..4e3c78d88832 100644
1851 +--- a/drivers/video/console/fbcon.c
1852 ++++ b/drivers/video/console/fbcon.c
1853 +@@ -1168,6 +1168,8 @@ static void fbcon_free_font(struct display *p, bool freefont)
1854 + p->userfont = 0;
1855 + }
1856 +
1857 ++static void set_vc_hi_font(struct vc_data *vc, bool set);
1858 ++
1859 + static void fbcon_deinit(struct vc_data *vc)
1860 + {
1861 + struct display *p = &fb_display[vc->vc_num];
1862 +@@ -1203,6 +1205,9 @@ finished:
1863 + if (free_font)
1864 + vc->vc_font.data = NULL;
1865 +
1866 ++ if (vc->vc_hi_font_mask)
1867 ++ set_vc_hi_font(vc, false);
1868 ++
1869 + if (!con_is_bound(&fb_con))
1870 + fbcon_exit();
1871 +
1872 +@@ -2439,32 +2444,10 @@ static int fbcon_get_font(struct vc_data *vc, struct console_font *font)
1873 + return 0;
1874 + }
1875 +
1876 +-static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
1877 +- const u8 * data, int userfont)
1878 ++/* set/clear vc_hi_font_mask and update vc attrs accordingly */
1879 ++static void set_vc_hi_font(struct vc_data *vc, bool set)
1880 + {
1881 +- struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1882 +- struct fbcon_ops *ops = info->fbcon_par;
1883 +- struct display *p = &fb_display[vc->vc_num];
1884 +- int resize;
1885 +- int cnt;
1886 +- char *old_data = NULL;
1887 +-
1888 +- if (CON_IS_VISIBLE(vc) && softback_lines)
1889 +- fbcon_set_origin(vc);
1890 +-
1891 +- resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
1892 +- if (p->userfont)
1893 +- old_data = vc->vc_font.data;
1894 +- if (userfont)
1895 +- cnt = FNTCHARCNT(data);
1896 +- else
1897 +- cnt = 256;
1898 +- vc->vc_font.data = (void *)(p->fontdata = data);
1899 +- if ((p->userfont = userfont))
1900 +- REFCOUNT(data)++;
1901 +- vc->vc_font.width = w;
1902 +- vc->vc_font.height = h;
1903 +- if (vc->vc_hi_font_mask && cnt == 256) {
1904 ++ if (!set) {
1905 + vc->vc_hi_font_mask = 0;
1906 + if (vc->vc_can_do_color) {
1907 + vc->vc_complement_mask >>= 1;
1908 +@@ -2487,7 +2470,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
1909 + ((c & 0xfe00) >> 1) | (c & 0xff);
1910 + vc->vc_attr >>= 1;
1911 + }
1912 +- } else if (!vc->vc_hi_font_mask && cnt == 512) {
1913 ++ } else {
1914 + vc->vc_hi_font_mask = 0x100;
1915 + if (vc->vc_can_do_color) {
1916 + vc->vc_complement_mask <<= 1;
1917 +@@ -2519,8 +2502,38 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
1918 + } else
1919 + vc->vc_video_erase_char = c & ~0x100;
1920 + }
1921 +-
1922 + }
1923 ++}
1924 ++
1925 ++static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
1926 ++ const u8 * data, int userfont)
1927 ++{
1928 ++ struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1929 ++ struct fbcon_ops *ops = info->fbcon_par;
1930 ++ struct display *p = &fb_display[vc->vc_num];
1931 ++ int resize;
1932 ++ int cnt;
1933 ++ char *old_data = NULL;
1934 ++
1935 ++ if (CON_IS_VISIBLE(vc) && softback_lines)
1936 ++ fbcon_set_origin(vc);
1937 ++
1938 ++ resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
1939 ++ if (p->userfont)
1940 ++ old_data = vc->vc_font.data;
1941 ++ if (userfont)
1942 ++ cnt = FNTCHARCNT(data);
1943 ++ else
1944 ++ cnt = 256;
1945 ++ vc->vc_font.data = (void *)(p->fontdata = data);
1946 ++ if ((p->userfont = userfont))
1947 ++ REFCOUNT(data)++;
1948 ++ vc->vc_font.width = w;
1949 ++ vc->vc_font.height = h;
1950 ++ if (vc->vc_hi_font_mask && cnt == 256)
1951 ++ set_vc_hi_font(vc, false);
1952 ++ else if (!vc->vc_hi_font_mask && cnt == 512)
1953 ++ set_vc_hi_font(vc, true);
1954 +
1955 + if (resize) {
1956 + int cols, rows;
1957 +diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c
1958 +index 611f9c11da85..2e319d0c395d 100644
1959 +--- a/drivers/xen/xen-acpi-processor.c
1960 ++++ b/drivers/xen/xen-acpi-processor.c
1961 +@@ -27,10 +27,10 @@
1962 + #include <linux/init.h>
1963 + #include <linux/module.h>
1964 + #include <linux/types.h>
1965 ++#include <linux/syscore_ops.h>
1966 + #include <linux/acpi.h>
1967 + #include <acpi/processor.h>
1968 + #include <xen/xen.h>
1969 +-#include <xen/xen-ops.h>
1970 + #include <xen/interface/platform.h>
1971 + #include <asm/xen/hypercall.h>
1972 +
1973 +@@ -466,15 +466,33 @@ static int xen_upload_processor_pm_data(void)
1974 + return rc;
1975 + }
1976 +
1977 +-static int xen_acpi_processor_resume(struct notifier_block *nb,
1978 +- unsigned long action, void *data)
1979 ++static void xen_acpi_processor_resume_worker(struct work_struct *dummy)
1980 + {
1981 ++ int rc;
1982 ++
1983 + bitmap_zero(acpi_ids_done, nr_acpi_bits);
1984 +- return xen_upload_processor_pm_data();
1985 ++
1986 ++ rc = xen_upload_processor_pm_data();
1987 ++ if (rc != 0)
1988 ++ pr_info("ACPI data upload failed, error = %d\n", rc);
1989 ++}
1990 ++
1991 ++static void xen_acpi_processor_resume(void)
1992 ++{
1993 ++ static DECLARE_WORK(wq, xen_acpi_processor_resume_worker);
1994 ++
1995 ++ /*
1996 ++ * xen_upload_processor_pm_data() calls non-atomic code.
1997 ++ * However, the context for xen_acpi_processor_resume is syscore
1998 ++ * with only the boot CPU online and in an atomic context.
1999 ++ *
2000 ++ * So defer the upload for some point safer.
2001 ++ */
2002 ++ schedule_work(&wq);
2003 + }
2004 +
2005 +-struct notifier_block xen_acpi_processor_resume_nb = {
2006 +- .notifier_call = xen_acpi_processor_resume,
2007 ++static struct syscore_ops xap_syscore_ops = {
2008 ++ .resume = xen_acpi_processor_resume,
2009 + };
2010 +
2011 + static int __init xen_acpi_processor_init(void)
2012 +@@ -527,7 +545,7 @@ static int __init xen_acpi_processor_init(void)
2013 + if (rc)
2014 + goto err_unregister;
2015 +
2016 +- xen_resume_notifier_register(&xen_acpi_processor_resume_nb);
2017 ++ register_syscore_ops(&xap_syscore_ops);
2018 +
2019 + return 0;
2020 + err_unregister:
2021 +@@ -544,7 +562,7 @@ static void __exit xen_acpi_processor_exit(void)
2022 + {
2023 + int i;
2024 +
2025 +- xen_resume_notifier_unregister(&xen_acpi_processor_resume_nb);
2026 ++ unregister_syscore_ops(&xap_syscore_ops);
2027 + kfree(acpi_ids_done);
2028 + kfree(acpi_id_present);
2029 + kfree(acpi_id_cst_present);
2030 +diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
2031 +index d4be4e23bc21..dad8e7bdf0a6 100644
2032 +--- a/fs/ext4/inline.c
2033 ++++ b/fs/ext4/inline.c
2034 +@@ -1158,10 +1158,9 @@ static int ext4_finish_convert_inline_dir(handle_t *handle,
2035 + set_buffer_uptodate(dir_block);
2036 + err = ext4_handle_dirty_dirent_node(handle, inode, dir_block);
2037 + if (err)
2038 +- goto out;
2039 ++ return err;
2040 + set_buffer_verified(dir_block);
2041 +-out:
2042 +- return err;
2043 ++ return ext4_mark_inode_dirty(handle, inode);
2044 + }
2045 +
2046 + static int ext4_convert_inline_data_nolock(handle_t *handle,
2047 +diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
2048 +index 1aabfda669b0..7183b7ea065b 100644
2049 +--- a/fs/xfs/libxfs/xfs_inode_buf.c
2050 ++++ b/fs/xfs/libxfs/xfs_inode_buf.c
2051 +@@ -299,6 +299,14 @@ xfs_dinode_verify(
2052 + if (dip->di_magic != cpu_to_be16(XFS_DINODE_MAGIC))
2053 + return false;
2054 +
2055 ++ /* don't allow invalid i_size */
2056 ++ if (be64_to_cpu(dip->di_size) & (1ULL << 63))
2057 ++ return false;
2058 ++
2059 ++ /* No zero-length symlinks. */
2060 ++ if (S_ISLNK(be16_to_cpu(dip->di_mode)) && dip->di_size == 0)
2061 ++ return false;
2062 ++
2063 + /* only version 3 or greater inodes are extensively verified here */
2064 + if (dip->di_version < 3)
2065 + return true;
2066 +diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
2067 +index dbae6490a79a..832764ee035a 100644
2068 +--- a/fs/xfs/xfs_bmap_util.c
2069 ++++ b/fs/xfs/xfs_bmap_util.c
2070 +@@ -1713,6 +1713,7 @@ xfs_swap_extents(
2071 + xfs_trans_t *tp;
2072 + xfs_bstat_t *sbp = &sxp->sx_stat;
2073 + xfs_ifork_t *tempifp, *ifp, *tifp;
2074 ++ xfs_extnum_t nextents;
2075 + int src_log_flags, target_log_flags;
2076 + int error = 0;
2077 + int aforkblks = 0;
2078 +@@ -1899,7 +1900,8 @@ xfs_swap_extents(
2079 + * pointer. Otherwise it's already NULL or
2080 + * pointing to the extent.
2081 + */
2082 +- if (ip->i_d.di_nextents <= XFS_INLINE_EXTS) {
2083 ++ nextents = ip->i_df.if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
2084 ++ if (nextents <= XFS_INLINE_EXTS) {
2085 + ifp->if_u1.if_extents =
2086 + ifp->if_u2.if_inline_ext;
2087 + }
2088 +@@ -1918,7 +1920,8 @@ xfs_swap_extents(
2089 + * pointer. Otherwise it's already NULL or
2090 + * pointing to the extent.
2091 + */
2092 +- if (tip->i_d.di_nextents <= XFS_INLINE_EXTS) {
2093 ++ nextents = tip->i_df.if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
2094 ++ if (nextents <= XFS_INLINE_EXTS) {
2095 + tifp->if_u1.if_extents =
2096 + tifp->if_u2.if_inline_ext;
2097 + }
2098 +diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
2099 +index eb1b8c8acfcb..8146b0cf20ce 100644
2100 +--- a/fs/xfs/xfs_buf.c
2101 ++++ b/fs/xfs/xfs_buf.c
2102 +@@ -375,6 +375,7 @@ retry:
2103 + out_free_pages:
2104 + for (i = 0; i < bp->b_page_count; i++)
2105 + __free_page(bp->b_pages[i]);
2106 ++ bp->b_flags &= ~_XBF_PAGES;
2107 + return error;
2108 + }
2109 +
2110 +diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
2111 +index 1d0043dc34e4..de2a722fe3cf 100644
2112 +--- a/include/linux/usb/quirks.h
2113 ++++ b/include/linux/usb/quirks.h
2114 +@@ -50,4 +50,10 @@
2115 + /* device can't handle Link Power Management */
2116 + #define USB_QUIRK_NO_LPM BIT(10)
2117 +
2118 ++/*
2119 ++ * Device reports its bInterval as linear frames instead of the
2120 ++ * USB 2.0 calculation.
2121 ++ */
2122 ++#define USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL BIT(11)
2123 ++
2124 + #endif /* __LINUX_USB_QUIRKS_H */
2125 +diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
2126 +index ddc3573894b0..bc95e48d5cfb 100644
2127 +--- a/net/ceph/osdmap.c
2128 ++++ b/net/ceph/osdmap.c
2129 +@@ -1265,7 +1265,6 @@ static int decode_new_up_state_weight(void **p, void *end,
2130 + if ((map->osd_state[osd] & CEPH_OSD_EXISTS) &&
2131 + (xorstate & CEPH_OSD_EXISTS)) {
2132 + pr_info("osd%d does not exist\n", osd);
2133 +- map->osd_weight[osd] = CEPH_OSD_IN;
2134 + ret = set_primary_affinity(map, osd,
2135 + CEPH_OSD_DEFAULT_PRIMARY_AFFINITY);
2136 + if (ret)
2137 +diff --git a/net/core/sock.c b/net/core/sock.c
2138 +index f4c0917e66b5..9c708a5fb751 100644
2139 +--- a/net/core/sock.c
2140 ++++ b/net/core/sock.c
2141 +@@ -1459,6 +1459,11 @@ void sk_destruct(struct sock *sk)
2142 + pr_debug("%s: optmem leakage (%d bytes) detected\n",
2143 + __func__, atomic_read(&sk->sk_omem_alloc));
2144 +
2145 ++ if (sk->sk_frag.page) {
2146 ++ put_page(sk->sk_frag.page);
2147 ++ sk->sk_frag.page = NULL;
2148 ++ }
2149 ++
2150 + if (sk->sk_peer_cred)
2151 + put_cred(sk->sk_peer_cred);
2152 + put_pid(sk->sk_peer_pid);
2153 +@@ -1552,6 +1557,12 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
2154 + is_charged = sk_filter_charge(newsk, filter);
2155 +
2156 + if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk, sk))) {
2157 ++ /* We need to make sure that we don't uncharge the new
2158 ++ * socket if we couldn't charge it in the first place
2159 ++ * as otherwise we uncharge the parent's filter.
2160 ++ */
2161 ++ if (!is_charged)
2162 ++ RCU_INIT_POINTER(newsk->sk_filter, NULL);
2163 + /* It is still raw copy of parent, so invalidate
2164 + * destructor and make plain sk_free() */
2165 + newsk->sk_destruct = NULL;
2166 +@@ -2691,11 +2702,6 @@ void sk_common_release(struct sock *sk)
2167 +
2168 + sk_refcnt_debug_release(sk);
2169 +
2170 +- if (sk->sk_frag.page) {
2171 +- put_page(sk->sk_frag.page);
2172 +- sk->sk_frag.page = NULL;
2173 +- }
2174 +-
2175 + sock_put(sk);
2176 + }
2177 + EXPORT_SYMBOL(sk_common_release);
2178 +diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
2179 +index 4e60dae86df5..1adba44f8fbc 100644
2180 +--- a/net/ipv4/fib_frontend.c
2181 ++++ b/net/ipv4/fib_frontend.c
2182 +@@ -1080,7 +1080,8 @@ static void nl_fib_input(struct sk_buff *skb)
2183 +
2184 + net = sock_net(skb->sk);
2185 + nlh = nlmsg_hdr(skb);
2186 +- if (skb->len < NLMSG_HDRLEN || skb->len < nlh->nlmsg_len ||
2187 ++ if (skb->len < nlmsg_total_size(sizeof(*frn)) ||
2188 ++ skb->len < nlh->nlmsg_len ||
2189 + nlmsg_len(nlh) < sizeof(*frn))
2190 + return;
2191 +
2192 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
2193 +index 7cc0f8aac28f..818630cec54f 100644
2194 +--- a/net/ipv4/tcp_input.c
2195 ++++ b/net/ipv4/tcp_input.c
2196 +@@ -5435,6 +5435,7 @@ void tcp_finish_connect(struct sock *sk, struct sk_buff *skb)
2197 + struct inet_connection_sock *icsk = inet_csk(sk);
2198 +
2199 + tcp_set_state(sk, TCP_ESTABLISHED);
2200 ++ icsk->icsk_ack.lrcvtime = tcp_time_stamp;
2201 +
2202 + if (skb) {
2203 + icsk->icsk_af_ops->sk_rx_dst_set(sk, skb);
2204 +@@ -5647,7 +5648,6 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
2205 + * to stand against the temptation 8) --ANK
2206 + */
2207 + inet_csk_schedule_ack(sk);
2208 +- icsk->icsk_ack.lrcvtime = tcp_time_stamp;
2209 + tcp_enter_quickack_mode(sk);
2210 + inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
2211 + TCP_DELACK_MAX, TCP_RTO_MAX);
2212 +diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
2213 +index 9475a2748a9a..019db68bdb9f 100644
2214 +--- a/net/ipv4/tcp_minisocks.c
2215 ++++ b/net/ipv4/tcp_minisocks.c
2216 +@@ -472,6 +472,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
2217 + newtp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT);
2218 + newtp->rtt_min[0].rtt = ~0U;
2219 + newicsk->icsk_rto = TCP_TIMEOUT_INIT;
2220 ++ newicsk->icsk_ack.lrcvtime = tcp_time_stamp;
2221 +
2222 + newtp->packets_out = 0;
2223 + newtp->retrans_out = 0;
2224 +diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
2225 +index d1bd4a45ca2d..d26b28def310 100644
2226 +--- a/net/openvswitch/flow_netlink.c
2227 ++++ b/net/openvswitch/flow_netlink.c
2228 +@@ -588,7 +588,7 @@ static int ip_tun_from_nlattr(const struct nlattr *attr,
2229 + ipv4 = true;
2230 + break;
2231 + case OVS_TUNNEL_KEY_ATTR_IPV6_SRC:
2232 +- SW_FLOW_KEY_PUT(match, tun_key.u.ipv6.dst,
2233 ++ SW_FLOW_KEY_PUT(match, tun_key.u.ipv6.src,
2234 + nla_get_in6_addr(a), is_mask);
2235 + ipv6 = true;
2236 + break;
2237 +diff --git a/net/unix/garbage.c b/net/unix/garbage.c
2238 +index 6a0d48525fcf..c36757e72844 100644
2239 +--- a/net/unix/garbage.c
2240 ++++ b/net/unix/garbage.c
2241 +@@ -146,6 +146,7 @@ void unix_notinflight(struct user_struct *user, struct file *fp)
2242 + if (s) {
2243 + struct unix_sock *u = unix_sk(s);
2244 +
2245 ++ BUG_ON(!atomic_long_read(&u->inflight));
2246 + BUG_ON(list_empty(&u->link));
2247 +
2248 + if (atomic_long_dec_and_test(&u->inflight))
2249 +@@ -341,6 +342,14 @@ void unix_gc(void)
2250 + }
2251 + list_del(&cursor);
2252 +
2253 ++ /* Now gc_candidates contains only garbage. Restore original
2254 ++ * inflight counters for these as well, and remove the skbuffs
2255 ++ * which are creating the cycle(s).
2256 ++ */
2257 ++ skb_queue_head_init(&hitlist);
2258 ++ list_for_each_entry(u, &gc_candidates, link)
2259 ++ scan_children(&u->sk, inc_inflight, &hitlist);
2260 ++
2261 + /* not_cycle_list contains those sockets which do not make up a
2262 + * cycle. Restore these to the inflight list.
2263 + */
2264 +@@ -350,14 +359,6 @@ void unix_gc(void)
2265 + list_move_tail(&u->link, &gc_inflight_list);
2266 + }
2267 +
2268 +- /* Now gc_candidates contains only garbage. Restore original
2269 +- * inflight counters for these as well, and remove the skbuffs
2270 +- * which are creating the cycle(s).
2271 +- */
2272 +- skb_queue_head_init(&hitlist);
2273 +- list_for_each_entry(u, &gc_candidates, link)
2274 +- scan_children(&u->sk, inc_inflight, &hitlist);
2275 +-
2276 + spin_unlock(&unix_gc_lock);
2277 +
2278 + /* Here we are. Hitlist is filled. Die. */
2279 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
2280 +index 1f0de6d74daa..9d0953e5734f 100644
2281 +--- a/net/wireless/nl80211.c
2282 ++++ b/net/wireless/nl80211.c
2283 +@@ -492,21 +492,17 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb,
2284 + {
2285 + int err;
2286 +
2287 +- rtnl_lock();
2288 +-
2289 + if (!cb->args[0]) {
2290 + err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
2291 + nl80211_fam.attrbuf, nl80211_fam.maxattr,
2292 + nl80211_policy);
2293 + if (err)
2294 +- goto out_unlock;
2295 ++ return err;
2296 +
2297 + *wdev = __cfg80211_wdev_from_attrs(sock_net(skb->sk),
2298 + nl80211_fam.attrbuf);
2299 +- if (IS_ERR(*wdev)) {
2300 +- err = PTR_ERR(*wdev);
2301 +- goto out_unlock;
2302 +- }
2303 ++ if (IS_ERR(*wdev))
2304 ++ return PTR_ERR(*wdev);
2305 + *rdev = wiphy_to_rdev((*wdev)->wiphy);
2306 + /* 0 is the first index - add 1 to parse only once */
2307 + cb->args[0] = (*rdev)->wiphy_idx + 1;
2308 +@@ -516,10 +512,8 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb,
2309 + struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1);
2310 + struct wireless_dev *tmp;
2311 +
2312 +- if (!wiphy) {
2313 +- err = -ENODEV;
2314 +- goto out_unlock;
2315 +- }
2316 ++ if (!wiphy)
2317 ++ return -ENODEV;
2318 + *rdev = wiphy_to_rdev(wiphy);
2319 + *wdev = NULL;
2320 +
2321 +@@ -530,21 +524,11 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb,
2322 + }
2323 + }
2324 +
2325 +- if (!*wdev) {
2326 +- err = -ENODEV;
2327 +- goto out_unlock;
2328 +- }
2329 ++ if (!*wdev)
2330 ++ return -ENODEV;
2331 + }
2332 +
2333 + return 0;
2334 +- out_unlock:
2335 +- rtnl_unlock();
2336 +- return err;
2337 +-}
2338 +-
2339 +-static void nl80211_finish_wdev_dump(struct cfg80211_registered_device *rdev)
2340 +-{
2341 +- rtnl_unlock();
2342 + }
2343 +
2344 + /* IE validation */
2345 +@@ -3884,9 +3868,10 @@ static int nl80211_dump_station(struct sk_buff *skb,
2346 + int sta_idx = cb->args[2];
2347 + int err;
2348 +
2349 ++ rtnl_lock();
2350 + err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
2351 + if (err)
2352 +- return err;
2353 ++ goto out_err;
2354 +
2355 + if (!wdev->netdev) {
2356 + err = -EINVAL;
2357 +@@ -3922,7 +3907,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
2358 + cb->args[2] = sta_idx;
2359 + err = skb->len;
2360 + out_err:
2361 +- nl80211_finish_wdev_dump(rdev);
2362 ++ rtnl_unlock();
2363 +
2364 + return err;
2365 + }
2366 +@@ -4639,9 +4624,10 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
2367 + int path_idx = cb->args[2];
2368 + int err;
2369 +
2370 ++ rtnl_lock();
2371 + err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
2372 + if (err)
2373 +- return err;
2374 ++ goto out_err;
2375 +
2376 + if (!rdev->ops->dump_mpath) {
2377 + err = -EOPNOTSUPP;
2378 +@@ -4675,7 +4661,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
2379 + cb->args[2] = path_idx;
2380 + err = skb->len;
2381 + out_err:
2382 +- nl80211_finish_wdev_dump(rdev);
2383 ++ rtnl_unlock();
2384 + return err;
2385 + }
2386 +
2387 +@@ -4835,9 +4821,10 @@ static int nl80211_dump_mpp(struct sk_buff *skb,
2388 + int path_idx = cb->args[2];
2389 + int err;
2390 +
2391 ++ rtnl_lock();
2392 + err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
2393 + if (err)
2394 +- return err;
2395 ++ goto out_err;
2396 +
2397 + if (!rdev->ops->dump_mpp) {
2398 + err = -EOPNOTSUPP;
2399 +@@ -4870,7 +4857,7 @@ static int nl80211_dump_mpp(struct sk_buff *skb,
2400 + cb->args[2] = path_idx;
2401 + err = skb->len;
2402 + out_err:
2403 +- nl80211_finish_wdev_dump(rdev);
2404 ++ rtnl_unlock();
2405 + return err;
2406 + }
2407 +
2408 +@@ -6806,9 +6793,12 @@ static int nl80211_dump_scan(struct sk_buff *skb, struct netlink_callback *cb)
2409 + int start = cb->args[2], idx = 0;
2410 + int err;
2411 +
2412 ++ rtnl_lock();
2413 + err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
2414 +- if (err)
2415 ++ if (err) {
2416 ++ rtnl_unlock();
2417 + return err;
2418 ++ }
2419 +
2420 + wdev_lock(wdev);
2421 + spin_lock_bh(&rdev->bss_lock);
2422 +@@ -6831,7 +6821,7 @@ static int nl80211_dump_scan(struct sk_buff *skb, struct netlink_callback *cb)
2423 + wdev_unlock(wdev);
2424 +
2425 + cb->args[2] = idx;
2426 +- nl80211_finish_wdev_dump(rdev);
2427 ++ rtnl_unlock();
2428 +
2429 + return skb->len;
2430 + }
2431 +@@ -6915,9 +6905,10 @@ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb)
2432 + int res;
2433 + bool radio_stats;
2434 +
2435 ++ rtnl_lock();
2436 + res = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
2437 + if (res)
2438 +- return res;
2439 ++ goto out_err;
2440 +
2441 + /* prepare_wdev_dump parsed the attributes */
2442 + radio_stats = nl80211_fam.attrbuf[NL80211_ATTR_SURVEY_RADIO_STATS];
2443 +@@ -6958,7 +6949,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb)
2444 + cb->args[2] = survey_idx;
2445 + res = skb->len;
2446 + out_err:
2447 +- nl80211_finish_wdev_dump(rdev);
2448 ++ rtnl_unlock();
2449 + return res;
2450 + }
2451 +
2452 +@@ -10158,17 +10149,13 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
2453 + void *data = NULL;
2454 + unsigned int data_len = 0;
2455 +
2456 +- rtnl_lock();
2457 +-
2458 + if (cb->args[0]) {
2459 + /* subtract the 1 again here */
2460 + struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1);
2461 + struct wireless_dev *tmp;
2462 +
2463 +- if (!wiphy) {
2464 +- err = -ENODEV;
2465 +- goto out_unlock;
2466 +- }
2467 ++ if (!wiphy)
2468 ++ return -ENODEV;
2469 + *rdev = wiphy_to_rdev(wiphy);
2470 + *wdev = NULL;
2471 +
2472 +@@ -10189,13 +10176,11 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
2473 + nl80211_fam.attrbuf, nl80211_fam.maxattr,
2474 + nl80211_policy);
2475 + if (err)
2476 +- goto out_unlock;
2477 ++ return err;
2478 +
2479 + if (!nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_ID] ||
2480 +- !nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_SUBCMD]) {
2481 +- err = -EINVAL;
2482 +- goto out_unlock;
2483 +- }
2484 ++ !nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_SUBCMD])
2485 ++ return -EINVAL;
2486 +
2487 + *wdev = __cfg80211_wdev_from_attrs(sock_net(skb->sk),
2488 + nl80211_fam.attrbuf);
2489 +@@ -10204,10 +10189,8 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
2490 +
2491 + *rdev = __cfg80211_rdev_from_attrs(sock_net(skb->sk),
2492 + nl80211_fam.attrbuf);
2493 +- if (IS_ERR(*rdev)) {
2494 +- err = PTR_ERR(*rdev);
2495 +- goto out_unlock;
2496 +- }
2497 ++ if (IS_ERR(*rdev))
2498 ++ return PTR_ERR(*rdev);
2499 +
2500 + vid = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_ID]);
2501 + subcmd = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_SUBCMD]);
2502 +@@ -10220,19 +10203,15 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
2503 + if (vcmd->info.vendor_id != vid || vcmd->info.subcmd != subcmd)
2504 + continue;
2505 +
2506 +- if (!vcmd->dumpit) {
2507 +- err = -EOPNOTSUPP;
2508 +- goto out_unlock;
2509 +- }
2510 ++ if (!vcmd->dumpit)
2511 ++ return -EOPNOTSUPP;
2512 +
2513 + vcmd_idx = i;
2514 + break;
2515 + }
2516 +
2517 +- if (vcmd_idx < 0) {
2518 +- err = -EOPNOTSUPP;
2519 +- goto out_unlock;
2520 +- }
2521 ++ if (vcmd_idx < 0)
2522 ++ return -EOPNOTSUPP;
2523 +
2524 + if (nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_DATA]) {
2525 + data = nla_data(nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_DATA]);
2526 +@@ -10249,9 +10228,6 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
2527 +
2528 + /* keep rtnl locked in successful case */
2529 + return 0;
2530 +- out_unlock:
2531 +- rtnl_unlock();
2532 +- return err;
2533 + }
2534 +
2535 + static int nl80211_vendor_cmd_dump(struct sk_buff *skb,
2536 +@@ -10266,9 +10242,10 @@ static int nl80211_vendor_cmd_dump(struct sk_buff *skb,
2537 + int err;
2538 + struct nlattr *vendor_data;
2539 +
2540 ++ rtnl_lock();
2541 + err = nl80211_prepare_vendor_dump(skb, cb, &rdev, &wdev);
2542 + if (err)
2543 +- return err;
2544 ++ goto out;
2545 +
2546 + vcmd_idx = cb->args[2];
2547 + data = (void *)cb->args[3];
2548 +@@ -10277,18 +10254,26 @@ static int nl80211_vendor_cmd_dump(struct sk_buff *skb,
2549 +
2550 + if (vcmd->flags & (WIPHY_VENDOR_CMD_NEED_WDEV |
2551 + WIPHY_VENDOR_CMD_NEED_NETDEV)) {
2552 +- if (!wdev)
2553 +- return -EINVAL;
2554 ++ if (!wdev) {
2555 ++ err = -EINVAL;
2556 ++ goto out;
2557 ++ }
2558 + if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_NETDEV &&
2559 +- !wdev->netdev)
2560 +- return -EINVAL;
2561 ++ !wdev->netdev) {
2562 ++ err = -EINVAL;
2563 ++ goto out;
2564 ++ }
2565 +
2566 + if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_RUNNING) {
2567 + if (wdev->netdev &&
2568 +- !netif_running(wdev->netdev))
2569 +- return -ENETDOWN;
2570 +- if (!wdev->netdev && !wdev->p2p_started)
2571 +- return -ENETDOWN;
2572 ++ !netif_running(wdev->netdev)) {
2573 ++ err = -ENETDOWN;
2574 ++ goto out;
2575 ++ }
2576 ++ if (!wdev->netdev && !wdev->p2p_started) {
2577 ++ err = -ENETDOWN;
2578 ++ goto out;
2579 ++ }
2580 + }
2581 + }
2582 +
2583 +diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
2584 +index 58e79e02f217..c67f9c212dd1 100644
2585 +--- a/sound/core/seq/seq_clientmgr.c
2586 ++++ b/sound/core/seq/seq_clientmgr.c
2587 +@@ -1921,6 +1921,7 @@ static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client,
2588 + info.output_pool != client->pool->size)) {
2589 + if (snd_seq_write_pool_allocated(client)) {
2590 + /* remove all existing cells */
2591 ++ snd_seq_pool_mark_closing(client->pool);
2592 + snd_seq_queue_client_leave_cells(client->number);
2593 + snd_seq_pool_done(client->pool);
2594 + }
2595 +diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c
2596 +index 86240d02b530..3f4efcb85df5 100644
2597 +--- a/sound/core/seq/seq_fifo.c
2598 ++++ b/sound/core/seq/seq_fifo.c
2599 +@@ -70,6 +70,9 @@ void snd_seq_fifo_delete(struct snd_seq_fifo **fifo)
2600 + return;
2601 + *fifo = NULL;
2602 +
2603 ++ if (f->pool)
2604 ++ snd_seq_pool_mark_closing(f->pool);
2605 ++
2606 + snd_seq_fifo_clear(f);
2607 +
2608 + /* wake up clients if any */
2609 +diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
2610 +index dfa5156f3585..5847c4475bf3 100644
2611 +--- a/sound/core/seq/seq_memory.c
2612 ++++ b/sound/core/seq/seq_memory.c
2613 +@@ -414,6 +414,18 @@ int snd_seq_pool_init(struct snd_seq_pool *pool)
2614 + return 0;
2615 + }
2616 +
2617 ++/* refuse the further insertion to the pool */
2618 ++void snd_seq_pool_mark_closing(struct snd_seq_pool *pool)
2619 ++{
2620 ++ unsigned long flags;
2621 ++
2622 ++ if (snd_BUG_ON(!pool))
2623 ++ return;
2624 ++ spin_lock_irqsave(&pool->lock, flags);
2625 ++ pool->closing = 1;
2626 ++ spin_unlock_irqrestore(&pool->lock, flags);
2627 ++}
2628 ++
2629 + /* remove events */
2630 + int snd_seq_pool_done(struct snd_seq_pool *pool)
2631 + {
2632 +@@ -424,10 +436,6 @@ int snd_seq_pool_done(struct snd_seq_pool *pool)
2633 + return -EINVAL;
2634 +
2635 + /* wait for closing all threads */
2636 +- spin_lock_irqsave(&pool->lock, flags);
2637 +- pool->closing = 1;
2638 +- spin_unlock_irqrestore(&pool->lock, flags);
2639 +-
2640 + if (waitqueue_active(&pool->output_sleep))
2641 + wake_up(&pool->output_sleep);
2642 +
2643 +@@ -484,6 +492,7 @@ int snd_seq_pool_delete(struct snd_seq_pool **ppool)
2644 + *ppool = NULL;
2645 + if (pool == NULL)
2646 + return 0;
2647 ++ snd_seq_pool_mark_closing(pool);
2648 + snd_seq_pool_done(pool);
2649 + kfree(pool);
2650 + return 0;
2651 +diff --git a/sound/core/seq/seq_memory.h b/sound/core/seq/seq_memory.h
2652 +index 4a2ec779b8a7..32f959c17786 100644
2653 +--- a/sound/core/seq/seq_memory.h
2654 ++++ b/sound/core/seq/seq_memory.h
2655 +@@ -84,6 +84,7 @@ static inline int snd_seq_total_cells(struct snd_seq_pool *pool)
2656 + int snd_seq_pool_init(struct snd_seq_pool *pool);
2657 +
2658 + /* done pool - free events */
2659 ++void snd_seq_pool_mark_closing(struct snd_seq_pool *pool);
2660 + int snd_seq_pool_done(struct snd_seq_pool *pool);
2661 +
2662 + /* create pool */
2663 +diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c
2664 +index ab4cdab5cfa5..79edd88d5cd0 100644
2665 +--- a/sound/pci/ctxfi/cthw20k1.c
2666 ++++ b/sound/pci/ctxfi/cthw20k1.c
2667 +@@ -1905,7 +1905,7 @@ static int hw_card_start(struct hw *hw)
2668 + return err;
2669 +
2670 + /* Set DMA transfer mask */
2671 +- if (dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) {
2672 ++ if (!dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) {
2673 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(dma_bits));
2674 + } else {
2675 + dma_set_mask(&pci->dev, DMA_BIT_MASK(32));
2676 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2677 +index cf0785ddbd14..1d4f34379f56 100644
2678 +--- a/sound/pci/hda/patch_realtek.c
2679 ++++ b/sound/pci/hda/patch_realtek.c
2680 +@@ -6040,6 +6040,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
2681 + ALC295_STANDARD_PINS,
2682 + {0x17, 0x21014040},
2683 + {0x18, 0x21a19050}),
2684 ++ SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
2685 ++ ALC295_STANDARD_PINS),
2686 + SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
2687 + ALC298_STANDARD_PINS,
2688 + {0x17, 0x90170110}),