Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Sat, 04 May 2019 18:27:13
Message-Id: 1556994412.02b66ae02c48faebac4ae52351c19b630ee72b1c.mpagano@gentoo
1 commit: 02b66ae02c48faebac4ae52351c19b630ee72b1c
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 4 18:26:52 2019 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sat May 4 18:26:52 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=02b66ae0
7
8 Linux patch 4.14.116
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1115_linux-4.14.116.patch | 1645 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1649 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 937317e..b8d93d4 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -503,6 +503,10 @@ Patch: 1114_4.14.115.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.14.115
23
24 +Patch: 1115_4.14.116.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.14.116
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1115_linux-4.14.116.patch b/1115_linux-4.14.116.patch
33 new file mode 100644
34 index 0000000..90f357f
35 --- /dev/null
36 +++ b/1115_linux-4.14.116.patch
37 @@ -0,0 +1,1645 @@
38 +diff --git a/Makefile b/Makefile
39 +index b27ffc1814e8..7dcaffff08a3 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 14
46 +-SUBLEVEL = 115
47 ++SUBLEVEL = 116
48 + EXTRAVERSION =
49 + NAME = Petit Gorille
50 +
51 +diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
52 +index 4bc70efe43d6..3178a5664942 100644
53 +--- a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
54 ++++ b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
55 +@@ -93,7 +93,7 @@
56 + };
57 +
58 + &hdmi {
59 +- hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
60 ++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>;
61 + };
62 +
63 + &uart0 {
64 +diff --git a/arch/arm/boot/dts/imx6qdl-icore-rqs.dtsi b/arch/arm/boot/dts/imx6qdl-icore-rqs.dtsi
65 +index 7ca291e9dbdb..80f1b3fb6abc 100644
66 +--- a/arch/arm/boot/dts/imx6qdl-icore-rqs.dtsi
67 ++++ b/arch/arm/boot/dts/imx6qdl-icore-rqs.dtsi
68 +@@ -222,7 +222,7 @@
69 + pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
70 + vmcc-supply = <&reg_sd3_vmmc>;
71 + cd-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
72 +- bus-witdh = <4>;
73 ++ bus-width = <4>;
74 + no-1-8-v;
75 + status = "okay";
76 + };
77 +@@ -233,7 +233,7 @@
78 + pinctrl-1 = <&pinctrl_usdhc4_100mhz>;
79 + pinctrl-2 = <&pinctrl_usdhc4_200mhz>;
80 + vmcc-supply = <&reg_sd4_vmmc>;
81 +- bus-witdh = <8>;
82 ++ bus-width = <8>;
83 + no-1-8-v;
84 + non-removable;
85 + status = "okay";
86 +diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
87 +index d81b0078a100..25b0704c6054 100644
88 +--- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
89 ++++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
90 +@@ -89,6 +89,7 @@
91 + pinctrl-names = "default";
92 + pinctrl-0 = <&pinctrl_enet>;
93 + phy-mode = "rgmii";
94 ++ phy-reset-duration = <10>; /* in msecs */
95 + phy-reset-gpios = <&gpio3 23 GPIO_ACTIVE_LOW>;
96 + phy-supply = <&vdd_eth_io_reg>;
97 + status = "disabled";
98 +diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
99 +index 1a61b1b997f2..3055c030f765 100644
100 +--- a/arch/s390/include/asm/elf.h
101 ++++ b/arch/s390/include/asm/elf.h
102 +@@ -252,11 +252,14 @@ do { \
103 +
104 + /*
105 + * Cache aliasing on the latest machines calls for a mapping granularity
106 +- * of 512KB. For 64-bit processes use a 512KB alignment and a randomization
107 +- * of up to 1GB. For 31-bit processes the virtual address space is limited,
108 +- * use no alignment and limit the randomization to 8MB.
109 ++ * of 512KB for the anonymous mapping base. For 64-bit processes use a
110 ++ * 512KB alignment and a randomization of up to 1GB. For 31-bit processes
111 ++ * the virtual address space is limited, use no alignment and limit the
112 ++ * randomization to 8MB.
113 ++ * For the additional randomization of the program break use 32MB for
114 ++ * 64-bit and 8MB for 31-bit.
115 + */
116 +-#define BRK_RND_MASK (is_compat_task() ? 0x7ffUL : 0x3ffffUL)
117 ++#define BRK_RND_MASK (is_compat_task() ? 0x7ffUL : 0x1fffUL)
118 + #define MMAP_RND_MASK (is_compat_task() ? 0x7ffUL : 0x3ff80UL)
119 + #define MMAP_ALIGN_MASK (is_compat_task() ? 0 : 0x7fUL)
120 + #define STACK_RND_MASK MMAP_RND_MASK
121 +diff --git a/drivers/ata/libata-zpodd.c b/drivers/ata/libata-zpodd.c
122 +index b3ed8f9953a8..173e6f2dd9af 100644
123 +--- a/drivers/ata/libata-zpodd.c
124 ++++ b/drivers/ata/libata-zpodd.c
125 +@@ -52,38 +52,52 @@ static int eject_tray(struct ata_device *dev)
126 + /* Per the spec, only slot type and drawer type ODD can be supported */
127 + static enum odd_mech_type zpodd_get_mech_type(struct ata_device *dev)
128 + {
129 +- char buf[16];
130 ++ char *buf;
131 + unsigned int ret;
132 +- struct rm_feature_desc *desc = (void *)(buf + 8);
133 ++ struct rm_feature_desc *desc;
134 + struct ata_taskfile tf;
135 + static const char cdb[] = { GPCMD_GET_CONFIGURATION,
136 + 2, /* only 1 feature descriptor requested */
137 + 0, 3, /* 3, removable medium feature */
138 + 0, 0, 0,/* reserved */
139 +- 0, sizeof(buf),
140 ++ 0, 16,
141 + 0, 0, 0,
142 + };
143 +
144 ++ buf = kzalloc(16, GFP_KERNEL);
145 ++ if (!buf)
146 ++ return ODD_MECH_TYPE_UNSUPPORTED;
147 ++ desc = (void *)(buf + 8);
148 ++
149 + ata_tf_init(dev, &tf);
150 + tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
151 + tf.command = ATA_CMD_PACKET;
152 + tf.protocol = ATAPI_PROT_PIO;
153 +- tf.lbam = sizeof(buf);
154 ++ tf.lbam = 16;
155 +
156 + ret = ata_exec_internal(dev, &tf, cdb, DMA_FROM_DEVICE,
157 +- buf, sizeof(buf), 0);
158 +- if (ret)
159 ++ buf, 16, 0);
160 ++ if (ret) {
161 ++ kfree(buf);
162 + return ODD_MECH_TYPE_UNSUPPORTED;
163 ++ }
164 +
165 +- if (be16_to_cpu(desc->feature_code) != 3)
166 ++ if (be16_to_cpu(desc->feature_code) != 3) {
167 ++ kfree(buf);
168 + return ODD_MECH_TYPE_UNSUPPORTED;
169 ++ }
170 +
171 +- if (desc->mech_type == 0 && desc->load == 0 && desc->eject == 1)
172 ++ if (desc->mech_type == 0 && desc->load == 0 && desc->eject == 1) {
173 ++ kfree(buf);
174 + return ODD_MECH_TYPE_SLOT;
175 +- else if (desc->mech_type == 1 && desc->load == 0 && desc->eject == 1)
176 ++ } else if (desc->mech_type == 1 && desc->load == 0 &&
177 ++ desc->eject == 1) {
178 ++ kfree(buf);
179 + return ODD_MECH_TYPE_DRAWER;
180 +- else
181 ++ } else {
182 ++ kfree(buf);
183 + return ODD_MECH_TYPE_UNSUPPORTED;
184 ++ }
185 + }
186 +
187 + /* Test if ODD is zero power ready by sense code */
188 +diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
189 +index f03fe916eb9d..f6d1bda8a802 100644
190 +--- a/drivers/gpio/gpio-aspeed.c
191 ++++ b/drivers/gpio/gpio-aspeed.c
192 +@@ -861,6 +861,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
193 +
194 + gpio->offset_timer =
195 + devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL);
196 ++ if (!gpio->offset_timer)
197 ++ return -ENOMEM;
198 +
199 + return aspeed_gpio_setup_irqs(gpio, pdev);
200 + }
201 +diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
202 +index ee8c046cab62..d6ed4e891b34 100644
203 +--- a/drivers/gpio/gpiolib-of.c
204 ++++ b/drivers/gpio/gpiolib-of.c
205 +@@ -499,7 +499,13 @@ int of_gpiochip_add(struct gpio_chip *chip)
206 +
207 + of_node_get(chip->of_node);
208 +
209 +- return of_gpiochip_scan_gpios(chip);
210 ++ status = of_gpiochip_scan_gpios(chip);
211 ++ if (status) {
212 ++ of_node_put(chip->of_node);
213 ++ gpiochip_remove_pin_ranges(chip);
214 ++ }
215 ++
216 ++ return status;
217 + }
218 +
219 + void of_gpiochip_remove(struct gpio_chip *chip)
220 +diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
221 +index 5deb44ac6791..0608243c3387 100644
222 +--- a/drivers/gpu/drm/meson/meson_drv.c
223 ++++ b/drivers/gpu/drm/meson/meson_drv.c
224 +@@ -277,10 +277,12 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
225 +
226 + ret = drm_dev_register(drm, 0);
227 + if (ret)
228 +- goto free_drm;
229 ++ goto uninstall_irq;
230 +
231 + return 0;
232 +
233 ++uninstall_irq:
234 ++ drm_irq_uninstall(drm);
235 + free_drm:
236 + drm_dev_unref(drm);
237 +
238 +@@ -294,10 +296,11 @@ static int meson_drv_bind(struct device *dev)
239 +
240 + static void meson_drv_unbind(struct device *dev)
241 + {
242 +- struct drm_device *drm = dev_get_drvdata(dev);
243 +- struct meson_drm *priv = drm->dev_private;
244 ++ struct meson_drm *priv = dev_get_drvdata(dev);
245 ++ struct drm_device *drm = priv->drm;
246 +
247 + drm_dev_unregister(drm);
248 ++ drm_irq_uninstall(drm);
249 + drm_kms_helper_poll_fini(drm);
250 + drm_fbdev_cma_fini(priv->fbdev);
251 + drm_mode_config_cleanup(drm);
252 +diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
253 +index bd339bfe0d15..684f7cdd814b 100644
254 +--- a/drivers/iommu/amd_iommu.c
255 ++++ b/drivers/iommu/amd_iommu.c
256 +@@ -3127,21 +3127,24 @@ static void amd_iommu_get_resv_regions(struct device *dev,
257 + return;
258 +
259 + list_for_each_entry(entry, &amd_iommu_unity_map, list) {
260 ++ int type, prot = 0;
261 + size_t length;
262 +- int prot = 0;
263 +
264 + if (devid < entry->devid_start || devid > entry->devid_end)
265 + continue;
266 +
267 ++ type = IOMMU_RESV_DIRECT;
268 + length = entry->address_end - entry->address_start;
269 + if (entry->prot & IOMMU_PROT_IR)
270 + prot |= IOMMU_READ;
271 + if (entry->prot & IOMMU_PROT_IW)
272 + prot |= IOMMU_WRITE;
273 ++ if (entry->prot & IOMMU_UNITY_MAP_FLAG_EXCL_RANGE)
274 ++ /* Exclusion range */
275 ++ type = IOMMU_RESV_RESERVED;
276 +
277 + region = iommu_alloc_resv_region(entry->address_start,
278 +- length, prot,
279 +- IOMMU_RESV_DIRECT);
280 ++ length, prot, type);
281 + if (!region) {
282 + pr_err("Out of memory allocating dm-regions for %s\n",
283 + dev_name(dev));
284 +diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
285 +index b97984a5ddad..91d7718625a6 100644
286 +--- a/drivers/iommu/amd_iommu_init.c
287 ++++ b/drivers/iommu/amd_iommu_init.c
288 +@@ -1980,6 +1980,9 @@ static int __init init_unity_map_range(struct ivmd_header *m)
289 + if (e == NULL)
290 + return -ENOMEM;
291 +
292 ++ if (m->flags & IVMD_FLAG_EXCL_RANGE)
293 ++ init_exclusion_range(m);
294 ++
295 + switch (m->type) {
296 + default:
297 + kfree(e);
298 +@@ -2026,9 +2029,7 @@ static int __init init_memory_definitions(struct acpi_table_header *table)
299 +
300 + while (p < end) {
301 + m = (struct ivmd_header *)p;
302 +- if (m->flags & IVMD_FLAG_EXCL_RANGE)
303 +- init_exclusion_range(m);
304 +- else if (m->flags & IVMD_FLAG_UNITY_MAP)
305 ++ if (m->flags & (IVMD_FLAG_UNITY_MAP | IVMD_FLAG_EXCL_RANGE))
306 + init_unity_map_range(m);
307 +
308 + p += m->length;
309 +diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h
310 +index f6b24c7d8b70..3054c0971759 100644
311 +--- a/drivers/iommu/amd_iommu_types.h
312 ++++ b/drivers/iommu/amd_iommu_types.h
313 +@@ -369,6 +369,8 @@
314 + #define IOMMU_PROT_IR 0x01
315 + #define IOMMU_PROT_IW 0x02
316 +
317 ++#define IOMMU_UNITY_MAP_FLAG_EXCL_RANGE (1 << 2)
318 ++
319 + /* IOMMU capabilities */
320 + #define IOMMU_CAP_IOTLB 24
321 + #define IOMMU_CAP_NPCACHE 26
322 +diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
323 +index 7fea18b0c15d..7cb4d685a1f1 100644
324 +--- a/drivers/leds/leds-pca9532.c
325 ++++ b/drivers/leds/leds-pca9532.c
326 +@@ -513,6 +513,7 @@ static int pca9532_probe(struct i2c_client *client,
327 + const struct i2c_device_id *id)
328 + {
329 + int devid;
330 ++ const struct of_device_id *of_id;
331 + struct pca9532_data *data = i2c_get_clientdata(client);
332 + struct pca9532_platform_data *pca9532_pdata =
333 + dev_get_platdata(&client->dev);
334 +@@ -528,8 +529,11 @@ static int pca9532_probe(struct i2c_client *client,
335 + dev_err(&client->dev, "no platform data\n");
336 + return -EINVAL;
337 + }
338 +- devid = (int)(uintptr_t)of_match_device(
339 +- of_pca9532_leds_match, &client->dev)->data;
340 ++ of_id = of_match_device(of_pca9532_leds_match,
341 ++ &client->dev);
342 ++ if (unlikely(!of_id))
343 ++ return -EINVAL;
344 ++ devid = (int)(uintptr_t) of_id->data;
345 + } else {
346 + devid = id->driver_data;
347 + }
348 +diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
349 +index 9046993947cc..2287749de087 100644
350 +--- a/drivers/net/ethernet/cadence/macb_main.c
351 ++++ b/drivers/net/ethernet/cadence/macb_main.c
352 +@@ -2817,14 +2817,20 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,
353 + *hclk = devm_clk_get(&pdev->dev, "hclk");
354 + }
355 +
356 +- if (IS_ERR(*pclk)) {
357 ++ if (IS_ERR_OR_NULL(*pclk)) {
358 + err = PTR_ERR(*pclk);
359 ++ if (!err)
360 ++ err = -ENODEV;
361 ++
362 + dev_err(&pdev->dev, "failed to get macb_clk (%u)\n", err);
363 + return err;
364 + }
365 +
366 +- if (IS_ERR(*hclk)) {
367 ++ if (IS_ERR_OR_NULL(*hclk)) {
368 + err = PTR_ERR(*hclk);
369 ++ if (!err)
370 ++ err = -ENODEV;
371 ++
372 + dev_err(&pdev->dev, "failed to get hclk (%u)\n", err);
373 + return err;
374 + }
375 +diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
376 +index 4878b7169e0f..30cbdf0fed59 100644
377 +--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
378 ++++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
379 +@@ -3176,6 +3176,7 @@ static ssize_t ehea_probe_port(struct device *dev,
380 +
381 + if (ehea_add_adapter_mr(adapter)) {
382 + pr_err("creating MR failed\n");
383 ++ of_node_put(eth_dn);
384 + return -EIO;
385 + }
386 +
387 +diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
388 +index 2fe96f1f3fe5..7ddaa7d88f1d 100644
389 +--- a/drivers/net/ethernet/micrel/ks8851.c
390 ++++ b/drivers/net/ethernet/micrel/ks8851.c
391 +@@ -526,9 +526,8 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
392 + /* set dma read address */
393 + ks8851_wrreg16(ks, KS_RXFDPR, RXFDPR_RXFPAI | 0x00);
394 +
395 +- /* start the packet dma process, and set auto-dequeue rx */
396 +- ks8851_wrreg16(ks, KS_RXQCR,
397 +- ks->rc_rxqcr | RXQCR_SDA | RXQCR_ADRFE);
398 ++ /* start DMA access */
399 ++ ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA);
400 +
401 + if (rxlen > 4) {
402 + unsigned int rxalign;
403 +@@ -559,7 +558,8 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
404 + }
405 + }
406 +
407 +- ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);
408 ++ /* end DMA access and dequeue packet */
409 ++ ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_RRXEF);
410 + }
411 + }
412 +
413 +@@ -776,6 +776,15 @@ static void ks8851_tx_work(struct work_struct *work)
414 + static int ks8851_net_open(struct net_device *dev)
415 + {
416 + struct ks8851_net *ks = netdev_priv(dev);
417 ++ int ret;
418 ++
419 ++ ret = request_threaded_irq(dev->irq, NULL, ks8851_irq,
420 ++ IRQF_TRIGGER_LOW | IRQF_ONESHOT,
421 ++ dev->name, ks);
422 ++ if (ret < 0) {
423 ++ netdev_err(dev, "failed to get irq\n");
424 ++ return ret;
425 ++ }
426 +
427 + /* lock the card, even if we may not actually be doing anything
428 + * else at the moment */
429 +@@ -840,6 +849,7 @@ static int ks8851_net_open(struct net_device *dev)
430 + netif_dbg(ks, ifup, ks->netdev, "network device up\n");
431 +
432 + mutex_unlock(&ks->lock);
433 ++ mii_check_link(&ks->mii);
434 + return 0;
435 + }
436 +
437 +@@ -890,6 +900,8 @@ static int ks8851_net_stop(struct net_device *dev)
438 + dev_kfree_skb(txb);
439 + }
440 +
441 ++ free_irq(dev->irq, ks);
442 ++
443 + return 0;
444 + }
445 +
446 +@@ -1499,6 +1511,7 @@ static int ks8851_probe(struct spi_device *spi)
447 +
448 + spi_set_drvdata(spi, ks);
449 +
450 ++ netif_carrier_off(ks->netdev);
451 + ndev->if_port = IF_PORT_100BASET;
452 + ndev->netdev_ops = &ks8851_netdev_ops;
453 + ndev->irq = spi->irq;
454 +@@ -1520,14 +1533,6 @@ static int ks8851_probe(struct spi_device *spi)
455 + ks8851_read_selftest(ks);
456 + ks8851_init_mac(ks);
457 +
458 +- ret = request_threaded_irq(spi->irq, NULL, ks8851_irq,
459 +- IRQF_TRIGGER_LOW | IRQF_ONESHOT,
460 +- ndev->name, ks);
461 +- if (ret < 0) {
462 +- dev_err(&spi->dev, "failed to get irq\n");
463 +- goto err_irq;
464 +- }
465 +-
466 + ret = register_netdev(ndev);
467 + if (ret) {
468 + dev_err(&spi->dev, "failed to register network device\n");
469 +@@ -1540,14 +1545,10 @@ static int ks8851_probe(struct spi_device *spi)
470 +
471 + return 0;
472 +
473 +-
474 + err_netdev:
475 +- free_irq(ndev->irq, ks);
476 +-
477 +-err_irq:
478 ++err_id:
479 + if (gpio_is_valid(gpio))
480 + gpio_set_value(gpio, 0);
481 +-err_id:
482 + regulator_disable(ks->vdd_reg);
483 + err_reg:
484 + regulator_disable(ks->vdd_io);
485 +@@ -1565,7 +1566,6 @@ static int ks8851_remove(struct spi_device *spi)
486 + dev_info(&spi->dev, "remove\n");
487 +
488 + unregister_netdev(priv->netdev);
489 +- free_irq(spi->irq, priv);
490 + if (gpio_is_valid(priv->gpio))
491 + gpio_set_value(priv->gpio, 0);
492 + regulator_disable(priv->vdd_reg);
493 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
494 +index 7f7deeaf1cf0..da042bc520d4 100644
495 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
496 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
497 +@@ -1047,6 +1047,8 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode)
498 +
499 + for (i = 0; i < QLCNIC_NUM_ILB_PKT; i++) {
500 + skb = netdev_alloc_skb(adapter->netdev, QLCNIC_ILB_PKT_SIZE);
501 ++ if (!skb)
502 ++ break;
503 + qlcnic_create_loopback_buff(skb->data, adapter->mac_addr);
504 + skb_put(skb, QLCNIC_ILB_PKT_SIZE);
505 + adapter->ahw->diag_cnt = 0;
506 +diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
507 +index 28cb38af1a34..ff7a71ca0b13 100644
508 +--- a/drivers/net/ethernet/ti/netcp_ethss.c
509 ++++ b/drivers/net/ethernet/ti/netcp_ethss.c
510 +@@ -3538,12 +3538,16 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev,
511 +
512 + ret = netcp_txpipe_init(&gbe_dev->tx_pipe, netcp_device,
513 + gbe_dev->dma_chan_name, gbe_dev->tx_queue_id);
514 +- if (ret)
515 ++ if (ret) {
516 ++ of_node_put(interfaces);
517 + return ret;
518 ++ }
519 +
520 + ret = netcp_txpipe_open(&gbe_dev->tx_pipe);
521 +- if (ret)
522 ++ if (ret) {
523 ++ of_node_put(interfaces);
524 + return ret;
525 ++ }
526 +
527 + /* Create network interfaces */
528 + INIT_LIST_HEAD(&gbe_dev->gbe_intf_head);
529 +diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
530 +index e74e1e897864..d46dc8cd1670 100644
531 +--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
532 ++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
533 +@@ -1575,12 +1575,14 @@ static int axienet_probe(struct platform_device *pdev)
534 + ret = of_address_to_resource(np, 0, &dmares);
535 + if (ret) {
536 + dev_err(&pdev->dev, "unable to get DMA resource\n");
537 ++ of_node_put(np);
538 + goto free_netdev;
539 + }
540 + lp->dma_regs = devm_ioremap_resource(&pdev->dev, &dmares);
541 + if (IS_ERR(lp->dma_regs)) {
542 + dev_err(&pdev->dev, "could not map DMA regs\n");
543 + ret = PTR_ERR(lp->dma_regs);
544 ++ of_node_put(np);
545 + goto free_netdev;
546 + }
547 + lp->rx_irq = irq_of_parse_and_map(np, 1);
548 +diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
549 +index aabbcfb6e6da..3d8a70d3ea9b 100644
550 +--- a/drivers/net/usb/ipheth.c
551 ++++ b/drivers/net/usb/ipheth.c
552 +@@ -148,6 +148,7 @@ struct ipheth_device {
553 + u8 bulk_in;
554 + u8 bulk_out;
555 + struct delayed_work carrier_work;
556 ++ bool confirmed_pairing;
557 + };
558 +
559 + static int ipheth_rx_submit(struct ipheth_device *dev, gfp_t mem_flags);
560 +@@ -259,7 +260,7 @@ static void ipheth_rcvbulk_callback(struct urb *urb)
561 +
562 + dev->net->stats.rx_packets++;
563 + dev->net->stats.rx_bytes += len;
564 +-
565 ++ dev->confirmed_pairing = true;
566 + netif_rx(skb);
567 + ipheth_rx_submit(dev, GFP_ATOMIC);
568 + }
569 +@@ -280,14 +281,24 @@ static void ipheth_sndbulk_callback(struct urb *urb)
570 + dev_err(&dev->intf->dev, "%s: urb status: %d\n",
571 + __func__, status);
572 +
573 +- netif_wake_queue(dev->net);
574 ++ if (status == 0)
575 ++ netif_wake_queue(dev->net);
576 ++ else
577 ++ // on URB error, trigger immediate poll
578 ++ schedule_delayed_work(&dev->carrier_work, 0);
579 + }
580 +
581 + static int ipheth_carrier_set(struct ipheth_device *dev)
582 + {
583 +- struct usb_device *udev = dev->udev;
584 ++ struct usb_device *udev;
585 + int retval;
586 +
587 ++ if (!dev)
588 ++ return 0;
589 ++ if (!dev->confirmed_pairing)
590 ++ return 0;
591 ++
592 ++ udev = dev->udev;
593 + retval = usb_control_msg(udev,
594 + usb_rcvctrlpipe(udev, IPHETH_CTRL_ENDP),
595 + IPHETH_CMD_CARRIER_CHECK, /* request */
596 +@@ -302,11 +313,14 @@ static int ipheth_carrier_set(struct ipheth_device *dev)
597 + return retval;
598 + }
599 +
600 +- if (dev->ctrl_buf[0] == IPHETH_CARRIER_ON)
601 ++ if (dev->ctrl_buf[0] == IPHETH_CARRIER_ON) {
602 + netif_carrier_on(dev->net);
603 +- else
604 ++ if (dev->tx_urb->status != -EINPROGRESS)
605 ++ netif_wake_queue(dev->net);
606 ++ } else {
607 + netif_carrier_off(dev->net);
608 +-
609 ++ netif_stop_queue(dev->net);
610 ++ }
611 + return 0;
612 + }
613 +
614 +@@ -386,7 +400,6 @@ static int ipheth_open(struct net_device *net)
615 + return retval;
616 +
617 + schedule_delayed_work(&dev->carrier_work, IPHETH_CARRIER_CHECK_TIMEOUT);
618 +- netif_start_queue(net);
619 + return retval;
620 + }
621 +
622 +@@ -489,7 +502,7 @@ static int ipheth_probe(struct usb_interface *intf,
623 + dev->udev = udev;
624 + dev->net = netdev;
625 + dev->intf = intf;
626 +-
627 ++ dev->confirmed_pairing = false;
628 + /* Set up endpoints */
629 + hintf = usb_altnum_to_altsetting(intf, IPHETH_ALT_INTFNUM);
630 + if (hintf == NULL) {
631 +@@ -540,7 +553,9 @@ static int ipheth_probe(struct usb_interface *intf,
632 + retval = -EIO;
633 + goto err_register_netdev;
634 + }
635 +-
636 ++ // carrier down and transmit queues stopped until packet from device
637 ++ netif_carrier_off(netdev);
638 ++ netif_tx_stop_all_queues(netdev);
639 + dev_info(&intf->dev, "Apple iPhone USB Ethernet device attached\n");
640 + return 0;
641 +
642 +diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
643 +index a19f2dc69e8a..d9830c86d0c1 100644
644 +--- a/drivers/s390/net/qeth_l3_main.c
645 ++++ b/drivers/s390/net/qeth_l3_main.c
646 +@@ -3022,12 +3022,14 @@ static int qeth_l3_probe_device(struct ccwgroup_device *gdev)
647 + struct qeth_card *card = dev_get_drvdata(&gdev->dev);
648 + int rc;
649 +
650 ++ hash_init(card->ip_htable);
651 ++
652 + if (gdev->dev.type == &qeth_generic_devtype) {
653 + rc = qeth_l3_create_device_attributes(&gdev->dev);
654 + if (rc)
655 + return rc;
656 + }
657 +- hash_init(card->ip_htable);
658 ++
659 + hash_init(card->ip_mc_htable);
660 + card->options.layer2 = 0;
661 + card->info.hwtrap = 0;
662 +diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
663 +index ca218c82321f..0c5fd722a72d 100644
664 +--- a/drivers/s390/scsi/zfcp_fc.c
665 ++++ b/drivers/s390/scsi/zfcp_fc.c
666 +@@ -240,10 +240,6 @@ static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range,
667 + list_for_each_entry(port, &adapter->port_list, list) {
668 + if ((port->d_id & range) == (ntoh24(page->rscn_fid) & range))
669 + zfcp_fc_test_link(port);
670 +- if (!port->d_id)
671 +- zfcp_erp_port_reopen(port,
672 +- ZFCP_STATUS_COMMON_ERP_FAILED,
673 +- "fcrscn1");
674 + }
675 + read_unlock_irqrestore(&adapter->port_list_lock, flags);
676 + }
677 +@@ -251,6 +247,7 @@ static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range,
678 + static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req)
679 + {
680 + struct fsf_status_read_buffer *status_buffer = (void *)fsf_req->data;
681 ++ struct zfcp_adapter *adapter = fsf_req->adapter;
682 + struct fc_els_rscn *head;
683 + struct fc_els_rscn_page *page;
684 + u16 i;
685 +@@ -264,6 +261,22 @@ static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req)
686 + no_entries = be16_to_cpu(head->rscn_plen) /
687 + sizeof(struct fc_els_rscn_page);
688 +
689 ++ if (no_entries > 1) {
690 ++ /* handle failed ports */
691 ++ unsigned long flags;
692 ++ struct zfcp_port *port;
693 ++
694 ++ read_lock_irqsave(&adapter->port_list_lock, flags);
695 ++ list_for_each_entry(port, &adapter->port_list, list) {
696 ++ if (port->d_id)
697 ++ continue;
698 ++ zfcp_erp_port_reopen(port,
699 ++ ZFCP_STATUS_COMMON_ERP_FAILED,
700 ++ "fcrscn1");
701 ++ }
702 ++ read_unlock_irqrestore(&adapter->port_list_lock, flags);
703 ++ }
704 ++
705 + for (i = 1; i < no_entries; i++) {
706 + /* skip head and start with 1st element */
707 + page++;
708 +diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
709 +index 22dc70a2138e..630b7404843d 100644
710 +--- a/drivers/scsi/qla4xxx/ql4_os.c
711 ++++ b/drivers/scsi/qla4xxx/ql4_os.c
712 +@@ -3207,6 +3207,8 @@ static int qla4xxx_conn_bind(struct iscsi_cls_session *cls_session,
713 + if (iscsi_conn_bind(cls_session, cls_conn, is_leading))
714 + return -EINVAL;
715 + ep = iscsi_lookup_endpoint(transport_fd);
716 ++ if (!ep)
717 ++ return -EINVAL;
718 + conn = cls_conn->dd_data;
719 + qla_conn = conn->dd_data;
720 + qla_conn->qla_ep = ep->dd_data;
721 +diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
722 +index be2f46eb9f78..904b988ecc4e 100644
723 +--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
724 ++++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
725 +@@ -188,7 +188,9 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
726 +
727 + pxmitpriv->free_xmit_extbuf_cnt = num_xmit_extbuf;
728 +
729 +- rtw_alloc_hwxmits(padapter);
730 ++ res = rtw_alloc_hwxmits(padapter);
731 ++ if (res == _FAIL)
732 ++ goto exit;
733 + rtw_init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
734 +
735 + for (i = 0; i < 4; i++)
736 +@@ -1573,7 +1575,7 @@ exit:
737 + return res;
738 + }
739 +
740 +-void rtw_alloc_hwxmits(struct adapter *padapter)
741 ++s32 rtw_alloc_hwxmits(struct adapter *padapter)
742 + {
743 + struct hw_xmit *hwxmits;
744 + struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
745 +@@ -1582,6 +1584,8 @@ void rtw_alloc_hwxmits(struct adapter *padapter)
746 +
747 + pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry,
748 + sizeof(struct hw_xmit), GFP_KERNEL);
749 ++ if (!pxmitpriv->hwxmits)
750 ++ return _FAIL;
751 +
752 + hwxmits = pxmitpriv->hwxmits;
753 +
754 +@@ -1589,6 +1593,7 @@ void rtw_alloc_hwxmits(struct adapter *padapter)
755 + hwxmits[1] .sta_queue = &pxmitpriv->vi_pending;
756 + hwxmits[2] .sta_queue = &pxmitpriv->be_pending;
757 + hwxmits[3] .sta_queue = &pxmitpriv->bk_pending;
758 ++ return _SUCCESS;
759 + }
760 +
761 + void rtw_free_hwxmits(struct adapter *padapter)
762 +diff --git a/drivers/staging/rtl8188eu/include/rtw_xmit.h b/drivers/staging/rtl8188eu/include/rtw_xmit.h
763 +index dd6b7a9a8d4a..1be4b478475a 100644
764 +--- a/drivers/staging/rtl8188eu/include/rtw_xmit.h
765 ++++ b/drivers/staging/rtl8188eu/include/rtw_xmit.h
766 +@@ -342,7 +342,7 @@ s32 rtw_txframes_sta_ac_pending(struct adapter *padapter,
767 + void rtw_init_hwxmits(struct hw_xmit *phwxmit, int entry);
768 + s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter);
769 + void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv);
770 +-void rtw_alloc_hwxmits(struct adapter *padapter);
771 ++s32 rtw_alloc_hwxmits(struct adapter *padapter);
772 + void rtw_free_hwxmits(struct adapter *padapter);
773 + s32 rtw_xmit(struct adapter *padapter, struct sk_buff **pkt);
774 +
775 +diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c b/drivers/staging/rtl8712/rtl8712_cmd.c
776 +index 0104aced113e..ccda04e916c5 100644
777 +--- a/drivers/staging/rtl8712/rtl8712_cmd.c
778 ++++ b/drivers/staging/rtl8712/rtl8712_cmd.c
779 +@@ -159,17 +159,9 @@ static u8 write_macreg_hdl(struct _adapter *padapter, u8 *pbuf)
780 +
781 + static u8 read_bbreg_hdl(struct _adapter *padapter, u8 *pbuf)
782 + {
783 +- u32 val;
784 +- void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd);
785 + struct cmd_obj *pcmd = (struct cmd_obj *)pbuf;
786 +
787 +- if (pcmd->rsp && pcmd->rspsz > 0)
788 +- memcpy(pcmd->rsp, (u8 *)&val, pcmd->rspsz);
789 +- pcmd_callback = cmd_callback[pcmd->cmdcode].callback;
790 +- if (!pcmd_callback)
791 +- r8712_free_cmd_obj(pcmd);
792 +- else
793 +- pcmd_callback(padapter, pcmd);
794 ++ r8712_free_cmd_obj(pcmd);
795 + return H2C_SUCCESS;
796 + }
797 +
798 +diff --git a/drivers/staging/rtl8712/rtl8712_cmd.h b/drivers/staging/rtl8712/rtl8712_cmd.h
799 +index 67e9e910aef9..d10a59d4a550 100644
800 +--- a/drivers/staging/rtl8712/rtl8712_cmd.h
801 ++++ b/drivers/staging/rtl8712/rtl8712_cmd.h
802 +@@ -152,7 +152,7 @@ enum rtl8712_h2c_cmd {
803 + static struct _cmd_callback cmd_callback[] = {
804 + {GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/
805 + {GEN_CMD_CODE(_Write_MACREG), NULL},
806 +- {GEN_CMD_CODE(_Read_BBREG), &r8712_getbbrfreg_cmdrsp_callback},
807 ++ {GEN_CMD_CODE(_Read_BBREG), NULL},
808 + {GEN_CMD_CODE(_Write_BBREG), NULL},
809 + {GEN_CMD_CODE(_Read_RFREG), &r8712_getbbrfreg_cmdrsp_callback},
810 + {GEN_CMD_CODE(_Write_RFREG), NULL}, /*5*/
811 +diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
812 +index 022f654419e4..91dab7f8a739 100644
813 +--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
814 ++++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
815 +@@ -271,7 +271,9 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
816 + }
817 + }
818 +
819 +- rtw_alloc_hwxmits(padapter);
820 ++ res = rtw_alloc_hwxmits(padapter);
821 ++ if (res == _FAIL)
822 ++ goto exit;
823 + rtw_init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
824 +
825 + for (i = 0; i < 4; i++) {
826 +@@ -2157,7 +2159,7 @@ exit:
827 + return res;
828 + }
829 +
830 +-void rtw_alloc_hwxmits(struct adapter *padapter)
831 ++s32 rtw_alloc_hwxmits(struct adapter *padapter)
832 + {
833 + struct hw_xmit *hwxmits;
834 + struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
835 +@@ -2168,10 +2170,8 @@ void rtw_alloc_hwxmits(struct adapter *padapter)
836 +
837 + pxmitpriv->hwxmits = (struct hw_xmit *)rtw_zmalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry);
838 +
839 +- if (pxmitpriv->hwxmits == NULL) {
840 +- DBG_871X("alloc hwxmits fail!...\n");
841 +- return;
842 +- }
843 ++ if (!pxmitpriv->hwxmits)
844 ++ return _FAIL;
845 +
846 + hwxmits = pxmitpriv->hwxmits;
847 +
848 +@@ -2217,7 +2217,7 @@ void rtw_alloc_hwxmits(struct adapter *padapter)
849 +
850 + }
851 +
852 +-
853 ++ return _SUCCESS;
854 + }
855 +
856 + void rtw_free_hwxmits(struct adapter *padapter)
857 +diff --git a/drivers/staging/rtl8723bs/include/rtw_xmit.h b/drivers/staging/rtl8723bs/include/rtw_xmit.h
858 +index 11571649cd2c..92236ca8a1ef 100644
859 +--- a/drivers/staging/rtl8723bs/include/rtw_xmit.h
860 ++++ b/drivers/staging/rtl8723bs/include/rtw_xmit.h
861 +@@ -494,7 +494,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter);
862 + void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv);
863 +
864 +
865 +-void rtw_alloc_hwxmits(struct adapter *padapter);
866 ++s32 rtw_alloc_hwxmits(struct adapter *padapter);
867 + void rtw_free_hwxmits(struct adapter *padapter);
868 +
869 +
870 +diff --git a/drivers/staging/rtlwifi/phydm/rtl_phydm.c b/drivers/staging/rtlwifi/phydm/rtl_phydm.c
871 +index 85e490d3601f..cab563fefc34 100644
872 +--- a/drivers/staging/rtlwifi/phydm/rtl_phydm.c
873 ++++ b/drivers/staging/rtlwifi/phydm/rtl_phydm.c
874 +@@ -191,6 +191,8 @@ static int rtl_phydm_init_priv(struct rtl_priv *rtlpriv,
875 +
876 + rtlpriv->phydm.internal =
877 + kzalloc(sizeof(struct phy_dm_struct), GFP_KERNEL);
878 ++ if (!rtlpriv->phydm.internal)
879 ++ return 0;
880 +
881 + _rtl_phydm_init_com_info(rtlpriv, ic, params);
882 +
883 +diff --git a/drivers/staging/rtlwifi/rtl8822be/fw.c b/drivers/staging/rtlwifi/rtl8822be/fw.c
884 +index acabb2470d55..02ca3157c5a5 100644
885 +--- a/drivers/staging/rtlwifi/rtl8822be/fw.c
886 ++++ b/drivers/staging/rtlwifi/rtl8822be/fw.c
887 +@@ -752,6 +752,8 @@ void rtl8822be_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
888 + u1_rsvd_page_loc, 3);
889 +
890 + skb = dev_alloc_skb(totalpacketlen);
891 ++ if (!skb)
892 ++ return;
893 + memcpy((u8 *)skb_put(skb, totalpacketlen), &reserved_page_packet,
894 + totalpacketlen);
895 +
896 +diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c
897 +index decc7f3c1ab2..ed545a61413c 100644
898 +--- a/drivers/tty/serial/ar933x_uart.c
899 ++++ b/drivers/tty/serial/ar933x_uart.c
900 +@@ -52,11 +52,6 @@ struct ar933x_uart_port {
901 + struct clk *clk;
902 + };
903 +
904 +-static inline bool ar933x_uart_console_enabled(void)
905 +-{
906 +- return IS_ENABLED(CONFIG_SERIAL_AR933X_CONSOLE);
907 +-}
908 +-
909 + static inline unsigned int ar933x_uart_read(struct ar933x_uart_port *up,
910 + int offset)
911 + {
912 +@@ -511,6 +506,7 @@ static const struct uart_ops ar933x_uart_ops = {
913 + .verify_port = ar933x_uart_verify_port,
914 + };
915 +
916 ++#ifdef CONFIG_SERIAL_AR933X_CONSOLE
917 + static struct ar933x_uart_port *
918 + ar933x_console_ports[CONFIG_SERIAL_AR933X_NR_UARTS];
919 +
920 +@@ -607,14 +603,7 @@ static struct console ar933x_uart_console = {
921 + .index = -1,
922 + .data = &ar933x_uart_driver,
923 + };
924 +-
925 +-static void ar933x_uart_add_console_port(struct ar933x_uart_port *up)
926 +-{
927 +- if (!ar933x_uart_console_enabled())
928 +- return;
929 +-
930 +- ar933x_console_ports[up->port.line] = up;
931 +-}
932 ++#endif /* CONFIG_SERIAL_AR933X_CONSOLE */
933 +
934 + static struct uart_driver ar933x_uart_driver = {
935 + .owner = THIS_MODULE,
936 +@@ -703,7 +692,9 @@ static int ar933x_uart_probe(struct platform_device *pdev)
937 + baud = ar933x_uart_get_baud(port->uartclk, 0, AR933X_UART_MAX_STEP);
938 + up->max_baud = min_t(unsigned int, baud, AR933X_UART_MAX_BAUD);
939 +
940 +- ar933x_uart_add_console_port(up);
941 ++#ifdef CONFIG_SERIAL_AR933X_CONSOLE
942 ++ ar933x_console_ports[up->port.line] = up;
943 ++#endif
944 +
945 + ret = uart_add_one_port(&ar933x_uart_driver, &up->port);
946 + if (ret)
947 +@@ -752,8 +743,9 @@ static int __init ar933x_uart_init(void)
948 + {
949 + int ret;
950 +
951 +- if (ar933x_uart_console_enabled())
952 +- ar933x_uart_driver.cons = &ar933x_uart_console;
953 ++#ifdef CONFIG_SERIAL_AR933X_CONSOLE
954 ++ ar933x_uart_driver.cons = &ar933x_uart_console;
955 ++#endif
956 +
957 + ret = uart_register_driver(&ar933x_uart_driver);
958 + if (ret)
959 +diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
960 +index a79f18edf2bd..e48523da47ac 100644
961 +--- a/drivers/tty/serial/sc16is7xx.c
962 ++++ b/drivers/tty/serial/sc16is7xx.c
963 +@@ -1483,7 +1483,7 @@ static int __init sc16is7xx_init(void)
964 + ret = i2c_add_driver(&sc16is7xx_i2c_uart_driver);
965 + if (ret < 0) {
966 + pr_err("failed to init sc16is7xx i2c --> %d\n", ret);
967 +- return ret;
968 ++ goto err_i2c;
969 + }
970 + #endif
971 +
972 +@@ -1491,10 +1491,18 @@ static int __init sc16is7xx_init(void)
973 + ret = spi_register_driver(&sc16is7xx_spi_uart_driver);
974 + if (ret < 0) {
975 + pr_err("failed to init sc16is7xx spi --> %d\n", ret);
976 +- return ret;
977 ++ goto err_spi;
978 + }
979 + #endif
980 + return ret;
981 ++
982 ++err_spi:
983 ++#ifdef CONFIG_SERIAL_SC16IS7XX_I2C
984 ++ i2c_del_driver(&sc16is7xx_i2c_uart_driver);
985 ++#endif
986 ++err_i2c:
987 ++ uart_unregister_driver(&sc16is7xx_uart);
988 ++ return ret;
989 + }
990 + module_init(sc16is7xx_init);
991 +
992 +diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c
993 +index e0759a826b60..7fb31a3b53e6 100644
994 +--- a/drivers/usb/gadget/udc/net2272.c
995 ++++ b/drivers/usb/gadget/udc/net2272.c
996 +@@ -958,6 +958,7 @@ net2272_dequeue(struct usb_ep *_ep, struct usb_request *_req)
997 + break;
998 + }
999 + if (&req->req != _req) {
1000 ++ ep->stopped = stopped;
1001 + spin_unlock_irqrestore(&ep->dev->lock, flags);
1002 + return -EINVAL;
1003 + }
1004 +diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
1005 +index 9cbb061582a7..170327f84ea1 100644
1006 +--- a/drivers/usb/gadget/udc/net2280.c
1007 ++++ b/drivers/usb/gadget/udc/net2280.c
1008 +@@ -870,9 +870,6 @@ static void start_queue(struct net2280_ep *ep, u32 dmactl, u32 td_dma)
1009 + (void) readl(&ep->dev->pci->pcimstctl);
1010 +
1011 + writel(BIT(DMA_START), &dma->dmastat);
1012 +-
1013 +- if (!ep->is_in)
1014 +- stop_out_naking(ep);
1015 + }
1016 +
1017 + static void start_dma(struct net2280_ep *ep, struct net2280_request *req)
1018 +@@ -911,6 +908,7 @@ static void start_dma(struct net2280_ep *ep, struct net2280_request *req)
1019 + writel(BIT(DMA_START), &dma->dmastat);
1020 + return;
1021 + }
1022 ++ stop_out_naking(ep);
1023 + }
1024 +
1025 + tmp = dmactl_default;
1026 +@@ -1279,9 +1277,9 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req)
1027 + break;
1028 + }
1029 + if (&req->req != _req) {
1030 ++ ep->stopped = stopped;
1031 + spin_unlock_irqrestore(&ep->dev->lock, flags);
1032 +- dev_err(&ep->dev->pdev->dev, "%s: Request mismatch\n",
1033 +- __func__);
1034 ++ ep_dbg(ep->dev, "%s: Request mismatch\n", __func__);
1035 + return -EINVAL;
1036 + }
1037 +
1038 +diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
1039 +index 65c0086e25ae..8d349230b2c7 100644
1040 +--- a/drivers/usb/host/u132-hcd.c
1041 ++++ b/drivers/usb/host/u132-hcd.c
1042 +@@ -3208,6 +3208,9 @@ static int __init u132_hcd_init(void)
1043 + printk(KERN_INFO "driver %s\n", hcd_name);
1044 + workqueue = create_singlethread_workqueue("u132");
1045 + retval = platform_driver_register(&u132_platform_driver);
1046 ++ if (retval)
1047 ++ destroy_workqueue(workqueue);
1048 ++
1049 + return retval;
1050 + }
1051 +
1052 +diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
1053 +index 135c91c434bf..ba8fcdb377e8 100644
1054 +--- a/drivers/usb/misc/usb251xb.c
1055 ++++ b/drivers/usb/misc/usb251xb.c
1056 +@@ -530,7 +530,7 @@ static int usb251xb_probe(struct usb251xb *hub)
1057 + dev);
1058 + int err;
1059 +
1060 +- if (np) {
1061 ++ if (np && of_id) {
1062 + err = usb251xb_get_ofdata(hub,
1063 + (struct usb251xb_data *)of_id->data);
1064 + if (err) {
1065 +diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
1066 +index a1492bdc6d03..f2b722f0df5d 100644
1067 +--- a/fs/ceph/inode.c
1068 ++++ b/fs/ceph/inode.c
1069 +@@ -520,6 +520,7 @@ static void ceph_i_callback(struct rcu_head *head)
1070 + struct inode *inode = container_of(head, struct inode, i_rcu);
1071 + struct ceph_inode_info *ci = ceph_inode(inode);
1072 +
1073 ++ kfree(ci->i_symlink);
1074 + kmem_cache_free(ceph_inode_cachep, ci);
1075 + }
1076 +
1077 +@@ -551,7 +552,6 @@ void ceph_destroy_inode(struct inode *inode)
1078 + ceph_put_snap_realm(mdsc, realm);
1079 + }
1080 +
1081 +- kfree(ci->i_symlink);
1082 + while ((n = rb_first(&ci->i_fragtree)) != NULL) {
1083 + frag = rb_entry(n, struct ceph_inode_frag, node);
1084 + rb_erase(n, &ci->i_fragtree);
1085 +diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
1086 +index 63fd33383413..770733106d6d 100644
1087 +--- a/fs/fuse/dev.c
1088 ++++ b/fs/fuse/dev.c
1089 +@@ -1981,10 +1981,8 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
1090 + rem += pipe->bufs[(pipe->curbuf + idx) & (pipe->buffers - 1)].len;
1091 +
1092 + ret = -EINVAL;
1093 +- if (rem < len) {
1094 +- pipe_unlock(pipe);
1095 +- goto out;
1096 +- }
1097 ++ if (rem < len)
1098 ++ goto out_free;
1099 +
1100 + rem = len;
1101 + while (rem) {
1102 +@@ -2002,7 +2000,9 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
1103 + pipe->curbuf = (pipe->curbuf + 1) & (pipe->buffers - 1);
1104 + pipe->nrbufs--;
1105 + } else {
1106 +- pipe_buf_get(pipe, ibuf);
1107 ++ if (!pipe_buf_get(pipe, ibuf))
1108 ++ goto out_free;
1109 ++
1110 + *obuf = *ibuf;
1111 + obuf->flags &= ~PIPE_BUF_FLAG_GIFT;
1112 + obuf->len = rem;
1113 +@@ -2025,11 +2025,11 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
1114 + ret = fuse_dev_do_write(fud, &cs, len);
1115 +
1116 + pipe_lock(pipe);
1117 ++out_free:
1118 + for (idx = 0; idx < nbuf; idx++)
1119 + pipe_buf_release(pipe, &bufs[idx]);
1120 + pipe_unlock(pipe);
1121 +
1122 +-out:
1123 + kfree(bufs);
1124 + return ret;
1125 + }
1126 +diff --git a/fs/nfs/client.c b/fs/nfs/client.c
1127 +index 7d6ddfd60271..a98d64a6eda5 100644
1128 +--- a/fs/nfs/client.c
1129 ++++ b/fs/nfs/client.c
1130 +@@ -459,7 +459,7 @@ void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
1131 + case XPRT_TRANSPORT_RDMA:
1132 + if (retrans == NFS_UNSPEC_RETRANS)
1133 + to->to_retries = NFS_DEF_TCP_RETRANS;
1134 +- if (timeo == NFS_UNSPEC_TIMEO || to->to_retries == 0)
1135 ++ if (timeo == NFS_UNSPEC_TIMEO || to->to_initval == 0)
1136 + to->to_initval = NFS_DEF_TCP_TIMEO * HZ / 10;
1137 + if (to->to_initval > NFS_MAX_TCP_TIMEOUT)
1138 + to->to_initval = NFS_MAX_TCP_TIMEOUT;
1139 +diff --git a/fs/pipe.c b/fs/pipe.c
1140 +index 8f9628494981..fa3c2c25cec5 100644
1141 +--- a/fs/pipe.c
1142 ++++ b/fs/pipe.c
1143 +@@ -194,9 +194,9 @@ EXPORT_SYMBOL(generic_pipe_buf_steal);
1144 + * in the tee() system call, when we duplicate the buffers in one
1145 + * pipe into another.
1146 + */
1147 +-void generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
1148 ++bool generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
1149 + {
1150 +- get_page(buf->page);
1151 ++ return try_get_page(buf->page);
1152 + }
1153 + EXPORT_SYMBOL(generic_pipe_buf_get);
1154 +
1155 +diff --git a/fs/splice.c b/fs/splice.c
1156 +index a598d444abe1..c84ac7e97e21 100644
1157 +--- a/fs/splice.c
1158 ++++ b/fs/splice.c
1159 +@@ -1571,7 +1571,11 @@ retry:
1160 + * Get a reference to this pipe buffer,
1161 + * so we can copy the contents over.
1162 + */
1163 +- pipe_buf_get(ipipe, ibuf);
1164 ++ if (!pipe_buf_get(ipipe, ibuf)) {
1165 ++ if (ret == 0)
1166 ++ ret = -EFAULT;
1167 ++ break;
1168 ++ }
1169 + *obuf = *ibuf;
1170 +
1171 + /*
1172 +@@ -1645,7 +1649,11 @@ static int link_pipe(struct pipe_inode_info *ipipe,
1173 + * Get a reference to this pipe buffer,
1174 + * so we can copy the contents over.
1175 + */
1176 +- pipe_buf_get(ipipe, ibuf);
1177 ++ if (!pipe_buf_get(ipipe, ibuf)) {
1178 ++ if (ret == 0)
1179 ++ ret = -EFAULT;
1180 ++ break;
1181 ++ }
1182 +
1183 + obuf = opipe->bufs + nbuf;
1184 + *obuf = *ibuf;
1185 +diff --git a/include/linux/mm.h b/include/linux/mm.h
1186 +index 58f2263de4de..ee0eae215210 100644
1187 +--- a/include/linux/mm.h
1188 ++++ b/include/linux/mm.h
1189 +@@ -824,6 +824,10 @@ static inline bool is_device_public_page(const struct page *page)
1190 + #endif /* CONFIG_DEVICE_PRIVATE || CONFIG_DEVICE_PUBLIC */
1191 +
1192 +
1193 ++/* 127: arbitrary random number, small enough to assemble well */
1194 ++#define page_ref_zero_or_close_to_overflow(page) \
1195 ++ ((unsigned int) page_ref_count(page) + 127u <= 127u)
1196 ++
1197 + static inline void get_page(struct page *page)
1198 + {
1199 + page = compound_head(page);
1200 +@@ -831,8 +835,17 @@ static inline void get_page(struct page *page)
1201 + * Getting a normal page or the head of a compound page
1202 + * requires to already have an elevated page->_refcount.
1203 + */
1204 +- VM_BUG_ON_PAGE(page_ref_count(page) <= 0, page);
1205 ++ VM_BUG_ON_PAGE(page_ref_zero_or_close_to_overflow(page), page);
1206 ++ page_ref_inc(page);
1207 ++}
1208 ++
1209 ++static inline __must_check bool try_get_page(struct page *page)
1210 ++{
1211 ++ page = compound_head(page);
1212 ++ if (WARN_ON_ONCE(page_ref_count(page) <= 0))
1213 ++ return false;
1214 + page_ref_inc(page);
1215 ++ return true;
1216 + }
1217 +
1218 + static inline void put_page(struct page *page)
1219 +diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
1220 +index 2dcf6e81b2e2..c251ad717345 100644
1221 +--- a/include/linux/pipe_fs_i.h
1222 ++++ b/include/linux/pipe_fs_i.h
1223 +@@ -108,18 +108,20 @@ struct pipe_buf_operations {
1224 + /*
1225 + * Get a reference to the pipe buffer.
1226 + */
1227 +- void (*get)(struct pipe_inode_info *, struct pipe_buffer *);
1228 ++ bool (*get)(struct pipe_inode_info *, struct pipe_buffer *);
1229 + };
1230 +
1231 + /**
1232 + * pipe_buf_get - get a reference to a pipe_buffer
1233 + * @pipe: the pipe that the buffer belongs to
1234 + * @buf: the buffer to get a reference to
1235 ++ *
1236 ++ * Return: %true if the reference was successfully obtained.
1237 + */
1238 +-static inline void pipe_buf_get(struct pipe_inode_info *pipe,
1239 ++static inline __must_check bool pipe_buf_get(struct pipe_inode_info *pipe,
1240 + struct pipe_buffer *buf)
1241 + {
1242 +- buf->ops->get(pipe, buf);
1243 ++ return buf->ops->get(pipe, buf);
1244 + }
1245 +
1246 + /**
1247 +@@ -179,7 +181,7 @@ struct pipe_inode_info *alloc_pipe_info(void);
1248 + void free_pipe_info(struct pipe_inode_info *);
1249 +
1250 + /* Generic pipe buffer ops functions */
1251 +-void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
1252 ++bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
1253 + int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
1254 + int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
1255 + int generic_pipe_buf_nosteal(struct pipe_inode_info *, struct pipe_buffer *);
1256 +diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
1257 +index fbf86ecd149d..bcaba7e8ca6e 100644
1258 +--- a/include/linux/sched/signal.h
1259 ++++ b/include/linux/sched/signal.h
1260 +@@ -377,10 +377,20 @@ static inline void set_restore_sigmask(void)
1261 + set_thread_flag(TIF_RESTORE_SIGMASK);
1262 + WARN_ON(!test_thread_flag(TIF_SIGPENDING));
1263 + }
1264 ++
1265 ++static inline void clear_tsk_restore_sigmask(struct task_struct *tsk)
1266 ++{
1267 ++ clear_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK);
1268 ++}
1269 ++
1270 + static inline void clear_restore_sigmask(void)
1271 + {
1272 + clear_thread_flag(TIF_RESTORE_SIGMASK);
1273 + }
1274 ++static inline bool test_tsk_restore_sigmask(struct task_struct *tsk)
1275 ++{
1276 ++ return test_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK);
1277 ++}
1278 + static inline bool test_restore_sigmask(void)
1279 + {
1280 + return test_thread_flag(TIF_RESTORE_SIGMASK);
1281 +@@ -398,6 +408,10 @@ static inline void set_restore_sigmask(void)
1282 + current->restore_sigmask = true;
1283 + WARN_ON(!test_thread_flag(TIF_SIGPENDING));
1284 + }
1285 ++static inline void clear_tsk_restore_sigmask(struct task_struct *tsk)
1286 ++{
1287 ++ tsk->restore_sigmask = false;
1288 ++}
1289 + static inline void clear_restore_sigmask(void)
1290 + {
1291 + current->restore_sigmask = false;
1292 +@@ -406,6 +420,10 @@ static inline bool test_restore_sigmask(void)
1293 + {
1294 + return current->restore_sigmask;
1295 + }
1296 ++static inline bool test_tsk_restore_sigmask(struct task_struct *tsk)
1297 ++{
1298 ++ return tsk->restore_sigmask;
1299 ++}
1300 + static inline bool test_and_clear_restore_sigmask(void)
1301 + {
1302 + if (!current->restore_sigmask)
1303 +diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h
1304 +index e82d93346b63..bb74ea83d57d 100644
1305 +--- a/include/net/tc_act/tc_gact.h
1306 ++++ b/include/net/tc_act/tc_gact.h
1307 +@@ -51,7 +51,7 @@ static inline bool is_tcf_gact_goto_chain(const struct tc_action *a)
1308 +
1309 + static inline u32 tcf_gact_goto_chain_index(const struct tc_action *a)
1310 + {
1311 +- return a->goto_chain->index;
1312 ++ return READ_ONCE(a->tcfa_action) & TC_ACT_EXT_VAL_MASK;
1313 + }
1314 +
1315 + #endif /* __NET_TC_GACT_H */
1316 +diff --git a/kernel/ptrace.c b/kernel/ptrace.c
1317 +index 84b1367935e4..f1c85b6c39ae 100644
1318 +--- a/kernel/ptrace.c
1319 ++++ b/kernel/ptrace.c
1320 +@@ -29,6 +29,7 @@
1321 + #include <linux/hw_breakpoint.h>
1322 + #include <linux/cn_proc.h>
1323 + #include <linux/compat.h>
1324 ++#include <linux/sched/signal.h>
1325 +
1326 + /*
1327 + * Access another process' address space via ptrace.
1328 +@@ -925,18 +926,26 @@ int ptrace_request(struct task_struct *child, long request,
1329 + ret = ptrace_setsiginfo(child, &siginfo);
1330 + break;
1331 +
1332 +- case PTRACE_GETSIGMASK:
1333 ++ case PTRACE_GETSIGMASK: {
1334 ++ sigset_t *mask;
1335 ++
1336 + if (addr != sizeof(sigset_t)) {
1337 + ret = -EINVAL;
1338 + break;
1339 + }
1340 +
1341 +- if (copy_to_user(datavp, &child->blocked, sizeof(sigset_t)))
1342 ++ if (test_tsk_restore_sigmask(child))
1343 ++ mask = &child->saved_sigmask;
1344 ++ else
1345 ++ mask = &child->blocked;
1346 ++
1347 ++ if (copy_to_user(datavp, mask, sizeof(sigset_t)))
1348 + ret = -EFAULT;
1349 + else
1350 + ret = 0;
1351 +
1352 + break;
1353 ++ }
1354 +
1355 + case PTRACE_SETSIGMASK: {
1356 + sigset_t new_set;
1357 +@@ -962,6 +971,8 @@ int ptrace_request(struct task_struct *child, long request,
1358 + child->blocked = new_set;
1359 + spin_unlock_irq(&child->sighand->siglock);
1360 +
1361 ++ clear_tsk_restore_sigmask(child);
1362 ++
1363 + ret = 0;
1364 + break;
1365 + }
1366 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
1367 +index 591be15404a1..ace0e8f6f2b4 100644
1368 +--- a/kernel/trace/trace.c
1369 ++++ b/kernel/trace/trace.c
1370 +@@ -6739,12 +6739,16 @@ static void buffer_pipe_buf_release(struct pipe_inode_info *pipe,
1371 + buf->private = 0;
1372 + }
1373 +
1374 +-static void buffer_pipe_buf_get(struct pipe_inode_info *pipe,
1375 ++static bool buffer_pipe_buf_get(struct pipe_inode_info *pipe,
1376 + struct pipe_buffer *buf)
1377 + {
1378 + struct buffer_ref *ref = (struct buffer_ref *)buf->private;
1379 +
1380 ++ if (refcount_read(&ref->refcount) > INT_MAX/2)
1381 ++ return false;
1382 ++
1383 + refcount_inc(&ref->refcount);
1384 ++ return true;
1385 + }
1386 +
1387 + /* Pipe buffer operations for a buffer. */
1388 +diff --git a/mm/gup.c b/mm/gup.c
1389 +index 7c0e5b1bbcd4..babcbd6d99c3 100644
1390 +--- a/mm/gup.c
1391 ++++ b/mm/gup.c
1392 +@@ -153,7 +153,10 @@ retry:
1393 + }
1394 +
1395 + if (flags & FOLL_GET) {
1396 +- get_page(page);
1397 ++ if (unlikely(!try_get_page(page))) {
1398 ++ page = ERR_PTR(-ENOMEM);
1399 ++ goto out;
1400 ++ }
1401 +
1402 + /* drop the pgmap reference now that we hold the page */
1403 + if (pgmap) {
1404 +@@ -280,7 +283,10 @@ retry_locked:
1405 + if (pmd_trans_unstable(pmd))
1406 + ret = -EBUSY;
1407 + } else {
1408 +- get_page(page);
1409 ++ if (unlikely(!try_get_page(page))) {
1410 ++ spin_unlock(ptl);
1411 ++ return ERR_PTR(-ENOMEM);
1412 ++ }
1413 + spin_unlock(ptl);
1414 + lock_page(page);
1415 + ret = split_huge_page(page);
1416 +@@ -464,7 +470,10 @@ static int get_gate_page(struct mm_struct *mm, unsigned long address,
1417 + if (is_device_public_page(*page))
1418 + goto unmap;
1419 + }
1420 +- get_page(*page);
1421 ++ if (unlikely(!try_get_page(*page))) {
1422 ++ ret = -ENOMEM;
1423 ++ goto unmap;
1424 ++ }
1425 + out:
1426 + ret = 0;
1427 + unmap:
1428 +@@ -1365,6 +1374,20 @@ static void undo_dev_pagemap(int *nr, int nr_start, struct page **pages)
1429 + }
1430 + }
1431 +
1432 ++/*
1433 ++ * Return the compund head page with ref appropriately incremented,
1434 ++ * or NULL if that failed.
1435 ++ */
1436 ++static inline struct page *try_get_compound_head(struct page *page, int refs)
1437 ++{
1438 ++ struct page *head = compound_head(page);
1439 ++ if (WARN_ON_ONCE(page_ref_count(head) < 0))
1440 ++ return NULL;
1441 ++ if (unlikely(!page_cache_add_speculative(head, refs)))
1442 ++ return NULL;
1443 ++ return head;
1444 ++}
1445 ++
1446 + #ifdef __HAVE_ARCH_PTE_SPECIAL
1447 + static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end,
1448 + int write, struct page **pages, int *nr)
1449 +@@ -1399,9 +1422,9 @@ static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end,
1450 +
1451 + VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
1452 + page = pte_page(pte);
1453 +- head = compound_head(page);
1454 +
1455 +- if (!page_cache_get_speculative(head))
1456 ++ head = try_get_compound_head(page, 1);
1457 ++ if (!head)
1458 + goto pte_unmap;
1459 +
1460 + if (unlikely(pte_val(pte) != pte_val(*ptep))) {
1461 +@@ -1537,8 +1560,8 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
1462 + refs++;
1463 + } while (addr += PAGE_SIZE, addr != end);
1464 +
1465 +- head = compound_head(pmd_page(orig));
1466 +- if (!page_cache_add_speculative(head, refs)) {
1467 ++ head = try_get_compound_head(pmd_page(orig), refs);
1468 ++ if (!head) {
1469 + *nr -= refs;
1470 + return 0;
1471 + }
1472 +@@ -1575,8 +1598,8 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr,
1473 + refs++;
1474 + } while (addr += PAGE_SIZE, addr != end);
1475 +
1476 +- head = compound_head(pud_page(orig));
1477 +- if (!page_cache_add_speculative(head, refs)) {
1478 ++ head = try_get_compound_head(pud_page(orig), refs);
1479 ++ if (!head) {
1480 + *nr -= refs;
1481 + return 0;
1482 + }
1483 +@@ -1612,8 +1635,8 @@ static int gup_huge_pgd(pgd_t orig, pgd_t *pgdp, unsigned long addr,
1484 + refs++;
1485 + } while (addr += PAGE_SIZE, addr != end);
1486 +
1487 +- head = compound_head(pgd_page(orig));
1488 +- if (!page_cache_add_speculative(head, refs)) {
1489 ++ head = try_get_compound_head(pgd_page(orig), refs);
1490 ++ if (!head) {
1491 + *nr -= refs;
1492 + return 0;
1493 + }
1494 +diff --git a/mm/hugetlb.c b/mm/hugetlb.c
1495 +index 7f75bd2fb8a7..64a62584290c 100644
1496 +--- a/mm/hugetlb.c
1497 ++++ b/mm/hugetlb.c
1498 +@@ -4255,6 +4255,19 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
1499 +
1500 + pfn_offset = (vaddr & ~huge_page_mask(h)) >> PAGE_SHIFT;
1501 + page = pte_page(huge_ptep_get(pte));
1502 ++
1503 ++ /*
1504 ++ * Instead of doing 'try_get_page()' below in the same_page
1505 ++ * loop, just check the count once here.
1506 ++ */
1507 ++ if (unlikely(page_count(page) <= 0)) {
1508 ++ if (pages) {
1509 ++ spin_unlock(ptl);
1510 ++ remainder = 0;
1511 ++ err = -ENOMEM;
1512 ++ break;
1513 ++ }
1514 ++ }
1515 + same_page:
1516 + if (pages) {
1517 + pages[i] = mem_map_offset(page, pfn_offset);
1518 +diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c
1519 +index 5fd283d9929e..89936e0d55c9 100644
1520 +--- a/net/bridge/br_netfilter_hooks.c
1521 ++++ b/net/bridge/br_netfilter_hooks.c
1522 +@@ -512,6 +512,7 @@ static unsigned int br_nf_pre_routing(void *priv,
1523 + nf_bridge->ipv4_daddr = ip_hdr(skb)->daddr;
1524 +
1525 + skb->protocol = htons(ETH_P_IP);
1526 ++ skb->transport_header = skb->network_header + ip_hdr(skb)->ihl * 4;
1527 +
1528 + NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, state->net, state->sk, skb,
1529 + skb->dev, NULL,
1530 +diff --git a/net/bridge/br_netfilter_ipv6.c b/net/bridge/br_netfilter_ipv6.c
1531 +index 5811208863b7..09d5e0c7b3ba 100644
1532 +--- a/net/bridge/br_netfilter_ipv6.c
1533 ++++ b/net/bridge/br_netfilter_ipv6.c
1534 +@@ -235,6 +235,8 @@ unsigned int br_nf_pre_routing_ipv6(void *priv,
1535 + nf_bridge->ipv6_daddr = ipv6_hdr(skb)->daddr;
1536 +
1537 + skb->protocol = htons(ETH_P_IPV6);
1538 ++ skb->transport_header = skb->network_header + sizeof(struct ipv6hdr);
1539 ++
1540 + NF_HOOK(NFPROTO_IPV6, NF_INET_PRE_ROUTING, state->net, state->sk, skb,
1541 + skb->dev, NULL,
1542 + br_nf_pre_routing_finish_ipv6);
1543 +diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c
1544 +index d83a4ec5900d..6f3205de887f 100644
1545 +--- a/net/netfilter/nft_set_rbtree.c
1546 ++++ b/net/netfilter/nft_set_rbtree.c
1547 +@@ -224,10 +224,6 @@ static void *nft_rbtree_deactivate(const struct net *net,
1548 + else if (d > 0)
1549 + parent = parent->rb_right;
1550 + else {
1551 +- if (!nft_set_elem_active(&rbe->ext, genmask)) {
1552 +- parent = parent->rb_left;
1553 +- continue;
1554 +- }
1555 + if (nft_rbtree_interval_end(rbe) &&
1556 + !nft_rbtree_interval_end(this)) {
1557 + parent = parent->rb_left;
1558 +@@ -236,6 +232,9 @@ static void *nft_rbtree_deactivate(const struct net *net,
1559 + nft_rbtree_interval_end(this)) {
1560 + parent = parent->rb_right;
1561 + continue;
1562 ++ } else if (!nft_set_elem_active(&rbe->ext, genmask)) {
1563 ++ parent = parent->rb_left;
1564 ++ continue;
1565 + }
1566 + nft_rbtree_flush(net, set, rbe);
1567 + return rbe;
1568 +diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
1569 +index d58de1dc5360..510049a7bd1d 100644
1570 +--- a/scripts/kconfig/lxdialog/inputbox.c
1571 ++++ b/scripts/kconfig/lxdialog/inputbox.c
1572 +@@ -126,7 +126,8 @@ do_resize:
1573 + case KEY_DOWN:
1574 + break;
1575 + case KEY_BACKSPACE:
1576 +- case 127:
1577 ++ case 8: /* ^H */
1578 ++ case 127: /* ^? */
1579 + if (pos) {
1580 + wattrset(dialog, dlg.inputbox.atr);
1581 + if (input_x == 0) {
1582 +diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
1583 +index 003114779815..e8e1944fa09b 100644
1584 +--- a/scripts/kconfig/nconf.c
1585 ++++ b/scripts/kconfig/nconf.c
1586 +@@ -1048,7 +1048,7 @@ static int do_match(int key, struct match_state *state, int *ans)
1587 + state->match_direction = FIND_NEXT_MATCH_UP;
1588 + *ans = get_mext_match(state->pattern,
1589 + state->match_direction);
1590 +- } else if (key == KEY_BACKSPACE || key == 127) {
1591 ++ } else if (key == KEY_BACKSPACE || key == 8 || key == 127) {
1592 + state->pattern[strlen(state->pattern)-1] = '\0';
1593 + adj_match_dir(&state->match_direction);
1594 + } else
1595 +diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c
1596 +index a64b1c31253e..0b63357f1d33 100644
1597 +--- a/scripts/kconfig/nconf.gui.c
1598 ++++ b/scripts/kconfig/nconf.gui.c
1599 +@@ -439,7 +439,8 @@ int dialog_inputbox(WINDOW *main_window,
1600 + case KEY_F(F_EXIT):
1601 + case KEY_F(F_BACK):
1602 + break;
1603 +- case 127:
1604 ++ case 8: /* ^H */
1605 ++ case 127: /* ^? */
1606 + case KEY_BACKSPACE:
1607 + if (cursor_position > 0) {
1608 + memmove(&result[cursor_position-1],
1609 +diff --git a/scripts/selinux/genheaders/genheaders.c b/scripts/selinux/genheaders/genheaders.c
1610 +index fa48fabcb330..3cc4893d98cc 100644
1611 +--- a/scripts/selinux/genheaders/genheaders.c
1612 ++++ b/scripts/selinux/genheaders/genheaders.c
1613 +@@ -9,7 +9,6 @@
1614 + #include <string.h>
1615 + #include <errno.h>
1616 + #include <ctype.h>
1617 +-#include <sys/socket.h>
1618 +
1619 + struct security_class_mapping {
1620 + const char *name;
1621 +diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c
1622 +index ffe8179f5d41..c29fa4a6228d 100644
1623 +--- a/scripts/selinux/mdp/mdp.c
1624 ++++ b/scripts/selinux/mdp/mdp.c
1625 +@@ -32,7 +32,6 @@
1626 + #include <stdlib.h>
1627 + #include <unistd.h>
1628 + #include <string.h>
1629 +-#include <sys/socket.h>
1630 +
1631 + static void usage(char *name)
1632 + {
1633 +diff --git a/security/selinux/include/classmap.h b/security/selinux/include/classmap.h
1634 +index cc35695d97b4..45ef6a0c17cc 100644
1635 +--- a/security/selinux/include/classmap.h
1636 ++++ b/security/selinux/include/classmap.h
1637 +@@ -1,5 +1,6 @@
1638 + /* SPDX-License-Identifier: GPL-2.0 */
1639 + #include <linux/capability.h>
1640 ++#include <linux/socket.h>
1641 +
1642 + #define COMMON_FILE_SOCK_PERMS "ioctl", "read", "write", "create", \
1643 + "getattr", "setattr", "lock", "relabelfrom", "relabelto", "append", "map"
1644 +diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c
1645 +index d72b8481f250..dc06f5e40041 100644
1646 +--- a/virt/kvm/arm/vgic/vgic-its.c
1647 ++++ b/virt/kvm/arm/vgic/vgic-its.c
1648 +@@ -704,8 +704,9 @@ static bool vgic_its_check_id(struct vgic_its *its, u64 baser, u32 id,
1649 + int l1_tbl_size = GITS_BASER_NR_PAGES(baser) * SZ_64K;
1650 + u64 indirect_ptr, type = GITS_BASER_TYPE(baser);
1651 + int esz = GITS_BASER_ENTRY_SIZE(baser);
1652 +- int index;
1653 ++ int index, idx;
1654 + gfn_t gfn;
1655 ++ bool ret;
1656 +
1657 + switch (type) {
1658 + case GITS_BASER_TYPE_DEVICE:
1659 +@@ -732,7 +733,8 @@ static bool vgic_its_check_id(struct vgic_its *its, u64 baser, u32 id,
1660 +
1661 + if (eaddr)
1662 + *eaddr = addr;
1663 +- return kvm_is_visible_gfn(its->dev->kvm, gfn);
1664 ++
1665 ++ goto out;
1666 + }
1667 +
1668 + /* calculate and check the index into the 1st level */
1669 +@@ -766,7 +768,12 @@ static bool vgic_its_check_id(struct vgic_its *its, u64 baser, u32 id,
1670 +
1671 + if (eaddr)
1672 + *eaddr = indirect_ptr;
1673 +- return kvm_is_visible_gfn(its->dev->kvm, gfn);
1674 ++
1675 ++out:
1676 ++ idx = srcu_read_lock(&its->dev->kvm->srcu);
1677 ++ ret = kvm_is_visible_gfn(its->dev->kvm, gfn);
1678 ++ srcu_read_unlock(&its->dev->kvm->srcu, idx);
1679 ++ return ret;
1680 + }
1681 +
1682 + static int vgic_its_alloc_collection(struct vgic_its *its,