Contents of /trunk/kernel-alx/patches-4.19/0138-4.19.39-all-fixes.patch
Parent Directory | Revision Log
Revision 3417 -
(show annotations)
(download)
Fri Aug 2 11:47:47 2019 UTC (5 years, 1 month ago) by niro
File size: 75005 byte(s)
Fri Aug 2 11:47:47 2019 UTC (5 years, 1 month ago) by niro
File size: 75005 byte(s)
-linux-4.19.39
1 | diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801 |
2 | index d1ee484a787d..ee9984f35868 100644 |
3 | --- a/Documentation/i2c/busses/i2c-i801 |
4 | +++ b/Documentation/i2c/busses/i2c-i801 |
5 | @@ -36,6 +36,7 @@ Supported adapters: |
6 | * Intel Cannon Lake (PCH) |
7 | * Intel Cedar Fork (PCH) |
8 | * Intel Ice Lake (PCH) |
9 | + * Intel Comet Lake (PCH) |
10 | Datasheets: Publicly available at the Intel website |
11 | |
12 | On Intel Patsburg and later chipsets, both the normal host SMBus controller |
13 | diff --git a/Makefile b/Makefile |
14 | index 14d4aeb48907..be1bd297bca9 100644 |
15 | --- a/Makefile |
16 | +++ b/Makefile |
17 | @@ -1,7 +1,7 @@ |
18 | # SPDX-License-Identifier: GPL-2.0 |
19 | VERSION = 4 |
20 | PATCHLEVEL = 19 |
21 | -SUBLEVEL = 38 |
22 | +SUBLEVEL = 39 |
23 | EXTRAVERSION = |
24 | NAME = "People's Front" |
25 | |
26 | diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig |
27 | index cd4c74daf71e..51794c7fa6d5 100644 |
28 | --- a/arch/arm/Kconfig |
29 | +++ b/arch/arm/Kconfig |
30 | @@ -612,6 +612,7 @@ config ARCH_DAVINCI |
31 | select HAVE_IDE |
32 | select PM_GENERIC_DOMAINS if PM |
33 | select PM_GENERIC_DOMAINS_OF if PM && OF |
34 | + select REGMAP_MMIO |
35 | select RESET_CONTROLLER |
36 | select USE_OF |
37 | select ZONE_DMA |
38 | diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts |
39 | index 5641d162dfdb..28e7513ce617 100644 |
40 | --- a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts |
41 | +++ b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts |
42 | @@ -93,7 +93,7 @@ |
43 | }; |
44 | |
45 | &hdmi { |
46 | - hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; |
47 | + hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; |
48 | }; |
49 | |
50 | &pwm { |
51 | diff --git a/arch/arm/boot/dts/imx6qdl-icore-rqs.dtsi b/arch/arm/boot/dts/imx6qdl-icore-rqs.dtsi |
52 | index acc3b11fba2a..cde3025d9603 100644 |
53 | --- a/arch/arm/boot/dts/imx6qdl-icore-rqs.dtsi |
54 | +++ b/arch/arm/boot/dts/imx6qdl-icore-rqs.dtsi |
55 | @@ -298,7 +298,7 @@ |
56 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; |
57 | vmcc-supply = <®_sd3_vmmc>; |
58 | cd-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; |
59 | - bus-witdh = <4>; |
60 | + bus-width = <4>; |
61 | no-1-8-v; |
62 | status = "okay"; |
63 | }; |
64 | @@ -309,7 +309,7 @@ |
65 | pinctrl-1 = <&pinctrl_usdhc4_100mhz>; |
66 | pinctrl-2 = <&pinctrl_usdhc4_200mhz>; |
67 | vmcc-supply = <®_sd4_vmmc>; |
68 | - bus-witdh = <8>; |
69 | + bus-width = <8>; |
70 | no-1-8-v; |
71 | non-removable; |
72 | status = "okay"; |
73 | diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi |
74 | index ed1aafd56973..fe4e89d773f5 100644 |
75 | --- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi |
76 | +++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi |
77 | @@ -89,6 +89,7 @@ |
78 | pinctrl-names = "default"; |
79 | pinctrl-0 = <&pinctrl_enet>; |
80 | phy-mode = "rgmii"; |
81 | + phy-reset-duration = <10>; /* in msecs */ |
82 | phy-reset-gpios = <&gpio3 23 GPIO_ACTIVE_LOW>; |
83 | phy-supply = <&vdd_eth_io_reg>; |
84 | status = "disabled"; |
85 | diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h |
86 | index 265ea9cf7df7..523c499e42db 100644 |
87 | --- a/arch/arm/include/asm/kvm_mmu.h |
88 | +++ b/arch/arm/include/asm/kvm_mmu.h |
89 | @@ -317,6 +317,17 @@ static inline int kvm_read_guest_lock(struct kvm *kvm, |
90 | return ret; |
91 | } |
92 | |
93 | +static inline int kvm_write_guest_lock(struct kvm *kvm, gpa_t gpa, |
94 | + const void *data, unsigned long len) |
95 | +{ |
96 | + int srcu_idx = srcu_read_lock(&kvm->srcu); |
97 | + int ret = kvm_write_guest(kvm, gpa, data, len); |
98 | + |
99 | + srcu_read_unlock(&kvm->srcu, srcu_idx); |
100 | + |
101 | + return ret; |
102 | +} |
103 | + |
104 | static inline void *kvm_get_hyp_vector(void) |
105 | { |
106 | switch(read_cpuid_part()) { |
107 | diff --git a/arch/arm/mach-imx/mach-imx51.c b/arch/arm/mach-imx/mach-imx51.c |
108 | index c7169c2f94c4..08c7892866c2 100644 |
109 | --- a/arch/arm/mach-imx/mach-imx51.c |
110 | +++ b/arch/arm/mach-imx/mach-imx51.c |
111 | @@ -59,6 +59,7 @@ static void __init imx51_m4if_setup(void) |
112 | return; |
113 | |
114 | m4if_base = of_iomap(np, 0); |
115 | + of_node_put(np); |
116 | if (!m4if_base) { |
117 | pr_err("Unable to map M4IF registers\n"); |
118 | return; |
119 | diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h |
120 | index d6fff7de5539..b2558447c67d 100644 |
121 | --- a/arch/arm64/include/asm/kvm_mmu.h |
122 | +++ b/arch/arm64/include/asm/kvm_mmu.h |
123 | @@ -394,6 +394,17 @@ static inline int kvm_read_guest_lock(struct kvm *kvm, |
124 | return ret; |
125 | } |
126 | |
127 | +static inline int kvm_write_guest_lock(struct kvm *kvm, gpa_t gpa, |
128 | + const void *data, unsigned long len) |
129 | +{ |
130 | + int srcu_idx = srcu_read_lock(&kvm->srcu); |
131 | + int ret = kvm_write_guest(kvm, gpa, data, len); |
132 | + |
133 | + srcu_read_unlock(&kvm->srcu, srcu_idx); |
134 | + |
135 | + return ret; |
136 | +} |
137 | + |
138 | #ifdef CONFIG_KVM_INDIRECT_VECTORS |
139 | /* |
140 | * EL2 vectors can be mapped and rerouted in a number of ways, |
141 | diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c |
142 | index 18b9a522a2b3..0688816f19e2 100644 |
143 | --- a/arch/arm64/kvm/reset.c |
144 | +++ b/arch/arm64/kvm/reset.c |
145 | @@ -117,6 +117,9 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) |
146 | int ret = -EINVAL; |
147 | bool loaded; |
148 | |
149 | + /* Reset PMU outside of the non-preemptible section */ |
150 | + kvm_pmu_vcpu_reset(vcpu); |
151 | + |
152 | preempt_disable(); |
153 | loaded = (vcpu->cpu != -1); |
154 | if (loaded) |
155 | @@ -164,9 +167,6 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) |
156 | vcpu->arch.reset_state.reset = false; |
157 | } |
158 | |
159 | - /* Reset PMU */ |
160 | - kvm_pmu_vcpu_reset(vcpu); |
161 | - |
162 | /* Default workaround setup is enabled (if supported) */ |
163 | if (kvm_arm_have_ssbd() == KVM_SSBD_KERNEL) |
164 | vcpu->arch.workaround_flags |= VCPU_WORKAROUND_2_FLAG; |
165 | diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h |
166 | index 7d22a474a040..f74639a05f0f 100644 |
167 | --- a/arch/s390/include/asm/elf.h |
168 | +++ b/arch/s390/include/asm/elf.h |
169 | @@ -252,11 +252,14 @@ do { \ |
170 | |
171 | /* |
172 | * Cache aliasing on the latest machines calls for a mapping granularity |
173 | - * of 512KB. For 64-bit processes use a 512KB alignment and a randomization |
174 | - * of up to 1GB. For 31-bit processes the virtual address space is limited, |
175 | - * use no alignment and limit the randomization to 8MB. |
176 | + * of 512KB for the anonymous mapping base. For 64-bit processes use a |
177 | + * 512KB alignment and a randomization of up to 1GB. For 31-bit processes |
178 | + * the virtual address space is limited, use no alignment and limit the |
179 | + * randomization to 8MB. |
180 | + * For the additional randomization of the program break use 32MB for |
181 | + * 64-bit and 8MB for 31-bit. |
182 | */ |
183 | -#define BRK_RND_MASK (is_compat_task() ? 0x7ffUL : 0x3ffffUL) |
184 | +#define BRK_RND_MASK (is_compat_task() ? 0x7ffUL : 0x1fffUL) |
185 | #define MMAP_RND_MASK (is_compat_task() ? 0x7ffUL : 0x3ff80UL) |
186 | #define MMAP_ALIGN_MASK (is_compat_task() ? 0 : 0x7fUL) |
187 | #define STACK_RND_MASK MMAP_RND_MASK |
188 | diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c |
189 | index 1e95d57760cf..b69f7d428443 100644 |
190 | --- a/arch/x86/mm/mmap.c |
191 | +++ b/arch/x86/mm/mmap.c |
192 | @@ -230,7 +230,7 @@ bool mmap_address_hint_valid(unsigned long addr, unsigned long len) |
193 | /* Can we access it for direct reading/writing? Must be RAM: */ |
194 | int valid_phys_addr_range(phys_addr_t addr, size_t count) |
195 | { |
196 | - return addr + count <= __pa(high_memory); |
197 | + return addr + count - 1 <= __pa(high_memory - 1); |
198 | } |
199 | |
200 | /* Can we access it through mmap? Must be a valid physical address: */ |
201 | diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c |
202 | index d10105825d57..47d097946872 100644 |
203 | --- a/arch/x86/realmode/init.c |
204 | +++ b/arch/x86/realmode/init.c |
205 | @@ -20,8 +20,6 @@ void __init set_real_mode_mem(phys_addr_t mem, size_t size) |
206 | void *base = __va(mem); |
207 | |
208 | real_mode_header = (struct real_mode_header *) base; |
209 | - printk(KERN_DEBUG "Base memory trampoline at [%p] %llx size %zu\n", |
210 | - base, (unsigned long long)mem, size); |
211 | } |
212 | |
213 | void __init reserve_real_mode(void) |
214 | diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c |
215 | index 4424997ecf30..e10fec99a182 100644 |
216 | --- a/drivers/acpi/acpica/evgpe.c |
217 | +++ b/drivers/acpi/acpica/evgpe.c |
218 | @@ -81,12 +81,8 @@ acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) |
219 | |
220 | ACPI_FUNCTION_TRACE(ev_enable_gpe); |
221 | |
222 | - /* Clear the GPE status */ |
223 | - status = acpi_hw_clear_gpe(gpe_event_info); |
224 | - if (ACPI_FAILURE(status)) |
225 | - return_ACPI_STATUS(status); |
226 | - |
227 | /* Enable the requested GPE */ |
228 | + |
229 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE); |
230 | return_ACPI_STATUS(status); |
231 | } |
232 | diff --git a/drivers/ata/libata-zpodd.c b/drivers/ata/libata-zpodd.c |
233 | index b3ed8f9953a8..173e6f2dd9af 100644 |
234 | --- a/drivers/ata/libata-zpodd.c |
235 | +++ b/drivers/ata/libata-zpodd.c |
236 | @@ -52,38 +52,52 @@ static int eject_tray(struct ata_device *dev) |
237 | /* Per the spec, only slot type and drawer type ODD can be supported */ |
238 | static enum odd_mech_type zpodd_get_mech_type(struct ata_device *dev) |
239 | { |
240 | - char buf[16]; |
241 | + char *buf; |
242 | unsigned int ret; |
243 | - struct rm_feature_desc *desc = (void *)(buf + 8); |
244 | + struct rm_feature_desc *desc; |
245 | struct ata_taskfile tf; |
246 | static const char cdb[] = { GPCMD_GET_CONFIGURATION, |
247 | 2, /* only 1 feature descriptor requested */ |
248 | 0, 3, /* 3, removable medium feature */ |
249 | 0, 0, 0,/* reserved */ |
250 | - 0, sizeof(buf), |
251 | + 0, 16, |
252 | 0, 0, 0, |
253 | }; |
254 | |
255 | + buf = kzalloc(16, GFP_KERNEL); |
256 | + if (!buf) |
257 | + return ODD_MECH_TYPE_UNSUPPORTED; |
258 | + desc = (void *)(buf + 8); |
259 | + |
260 | ata_tf_init(dev, &tf); |
261 | tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; |
262 | tf.command = ATA_CMD_PACKET; |
263 | tf.protocol = ATAPI_PROT_PIO; |
264 | - tf.lbam = sizeof(buf); |
265 | + tf.lbam = 16; |
266 | |
267 | ret = ata_exec_internal(dev, &tf, cdb, DMA_FROM_DEVICE, |
268 | - buf, sizeof(buf), 0); |
269 | - if (ret) |
270 | + buf, 16, 0); |
271 | + if (ret) { |
272 | + kfree(buf); |
273 | return ODD_MECH_TYPE_UNSUPPORTED; |
274 | + } |
275 | |
276 | - if (be16_to_cpu(desc->feature_code) != 3) |
277 | + if (be16_to_cpu(desc->feature_code) != 3) { |
278 | + kfree(buf); |
279 | return ODD_MECH_TYPE_UNSUPPORTED; |
280 | + } |
281 | |
282 | - if (desc->mech_type == 0 && desc->load == 0 && desc->eject == 1) |
283 | + if (desc->mech_type == 0 && desc->load == 0 && desc->eject == 1) { |
284 | + kfree(buf); |
285 | return ODD_MECH_TYPE_SLOT; |
286 | - else if (desc->mech_type == 1 && desc->load == 0 && desc->eject == 1) |
287 | + } else if (desc->mech_type == 1 && desc->load == 0 && |
288 | + desc->eject == 1) { |
289 | + kfree(buf); |
290 | return ODD_MECH_TYPE_DRAWER; |
291 | - else |
292 | + } else { |
293 | + kfree(buf); |
294 | return ODD_MECH_TYPE_UNSUPPORTED; |
295 | + } |
296 | } |
297 | |
298 | /* Test if ODD is zero power ready by sense code */ |
299 | diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c |
300 | index 2342e154029b..b696ec35efb3 100644 |
301 | --- a/drivers/gpio/gpio-aspeed.c |
302 | +++ b/drivers/gpio/gpio-aspeed.c |
303 | @@ -1225,6 +1225,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) |
304 | |
305 | gpio->offset_timer = |
306 | devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL); |
307 | + if (!gpio->offset_timer) |
308 | + return -ENOMEM; |
309 | |
310 | return aspeed_gpio_setup_irqs(gpio, pdev); |
311 | } |
312 | diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c |
313 | index d4e7a09598fa..e0f149bdf98f 100644 |
314 | --- a/drivers/gpio/gpiolib-of.c |
315 | +++ b/drivers/gpio/gpiolib-of.c |
316 | @@ -646,7 +646,13 @@ int of_gpiochip_add(struct gpio_chip *chip) |
317 | |
318 | of_node_get(chip->of_node); |
319 | |
320 | - return of_gpiochip_scan_gpios(chip); |
321 | + status = of_gpiochip_scan_gpios(chip); |
322 | + if (status) { |
323 | + of_node_put(chip->of_node); |
324 | + gpiochip_remove_pin_ranges(chip); |
325 | + } |
326 | + |
327 | + return status; |
328 | } |
329 | |
330 | void of_gpiochip_remove(struct gpio_chip *chip) |
331 | diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c |
332 | index ea4941da9b27..0201ccb22f4c 100644 |
333 | --- a/drivers/gpu/drm/drm_drv.c |
334 | +++ b/drivers/gpu/drm/drm_drv.c |
335 | @@ -381,11 +381,7 @@ void drm_dev_unplug(struct drm_device *dev) |
336 | synchronize_srcu(&drm_unplug_srcu); |
337 | |
338 | drm_dev_unregister(dev); |
339 | - |
340 | - mutex_lock(&drm_global_mutex); |
341 | - if (dev->open_count == 0) |
342 | - drm_dev_put(dev); |
343 | - mutex_unlock(&drm_global_mutex); |
344 | + drm_dev_put(dev); |
345 | } |
346 | EXPORT_SYMBOL(drm_dev_unplug); |
347 | |
348 | diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c |
349 | index ffa8dc35515f..e4ccb52c67ea 100644 |
350 | --- a/drivers/gpu/drm/drm_file.c |
351 | +++ b/drivers/gpu/drm/drm_file.c |
352 | @@ -479,11 +479,9 @@ int drm_release(struct inode *inode, struct file *filp) |
353 | |
354 | drm_file_free(file_priv); |
355 | |
356 | - if (!--dev->open_count) { |
357 | + if (!--dev->open_count) |
358 | drm_lastclose(dev); |
359 | - if (drm_dev_is_unplugged(dev)) |
360 | - drm_put_dev(dev); |
361 | - } |
362 | + |
363 | mutex_unlock(&drm_global_mutex); |
364 | |
365 | drm_minor_release(minor); |
366 | diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c |
367 | index 611ac340fb28..588b3b0c8315 100644 |
368 | --- a/drivers/gpu/drm/meson/meson_drv.c |
369 | +++ b/drivers/gpu/drm/meson/meson_drv.c |
370 | @@ -300,10 +300,12 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) |
371 | |
372 | ret = drm_dev_register(drm, 0); |
373 | if (ret) |
374 | - goto free_drm; |
375 | + goto uninstall_irq; |
376 | |
377 | return 0; |
378 | |
379 | +uninstall_irq: |
380 | + drm_irq_uninstall(drm); |
381 | free_drm: |
382 | drm_dev_put(drm); |
383 | |
384 | @@ -317,10 +319,11 @@ static int meson_drv_bind(struct device *dev) |
385 | |
386 | static void meson_drv_unbind(struct device *dev) |
387 | { |
388 | - struct drm_device *drm = dev_get_drvdata(dev); |
389 | - struct meson_drm *priv = drm->dev_private; |
390 | + struct meson_drm *priv = dev_get_drvdata(dev); |
391 | + struct drm_device *drm = priv->drm; |
392 | |
393 | drm_dev_unregister(drm); |
394 | + drm_irq_uninstall(drm); |
395 | drm_kms_helper_poll_fini(drm); |
396 | drm_fbdev_cma_fini(priv->fbdev); |
397 | drm_mode_config_cleanup(drm); |
398 | diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c |
399 | index 8f4fcbb515fb..bb97cad1eb69 100644 |
400 | --- a/drivers/gpu/drm/tegra/hub.c |
401 | +++ b/drivers/gpu/drm/tegra/hub.c |
402 | @@ -378,14 +378,16 @@ static int tegra_shared_plane_atomic_check(struct drm_plane *plane, |
403 | static void tegra_shared_plane_atomic_disable(struct drm_plane *plane, |
404 | struct drm_plane_state *old_state) |
405 | { |
406 | - struct tegra_dc *dc = to_tegra_dc(old_state->crtc); |
407 | struct tegra_plane *p = to_tegra_plane(plane); |
408 | + struct tegra_dc *dc; |
409 | u32 value; |
410 | |
411 | /* rien ne va plus */ |
412 | if (!old_state || !old_state->crtc) |
413 | return; |
414 | |
415 | + dc = to_tegra_dc(old_state->crtc); |
416 | + |
417 | /* |
418 | * XXX Legacy helpers seem to sometimes call ->atomic_disable() even |
419 | * on planes that are already disabled. Make sure we fallback to the |
420 | diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig |
421 | index ac4b09642f63..8f803812ea24 100644 |
422 | --- a/drivers/i2c/busses/Kconfig |
423 | +++ b/drivers/i2c/busses/Kconfig |
424 | @@ -131,6 +131,7 @@ config I2C_I801 |
425 | Cannon Lake (PCH) |
426 | Cedar Fork (PCH) |
427 | Ice Lake (PCH) |
428 | + Comet Lake (PCH) |
429 | |
430 | This driver can also be built as a module. If so, the module |
431 | will be called i2c-i801. |
432 | diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c |
433 | index c91e145ef5a5..679c6c41f64b 100644 |
434 | --- a/drivers/i2c/busses/i2c-i801.c |
435 | +++ b/drivers/i2c/busses/i2c-i801.c |
436 | @@ -71,6 +71,7 @@ |
437 | * Cannon Lake-LP (PCH) 0x9da3 32 hard yes yes yes |
438 | * Cedar Fork (PCH) 0x18df 32 hard yes yes yes |
439 | * Ice Lake-LP (PCH) 0x34a3 32 hard yes yes yes |
440 | + * Comet Lake (PCH) 0x02a3 32 hard yes yes yes |
441 | * |
442 | * Features supported by this driver: |
443 | * Software PEC no |
444 | @@ -240,6 +241,7 @@ |
445 | #define PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS 0xa223 |
446 | #define PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS 0xa2a3 |
447 | #define PCI_DEVICE_ID_INTEL_CANNONLAKE_H_SMBUS 0xa323 |
448 | +#define PCI_DEVICE_ID_INTEL_COMETLAKE_SMBUS 0x02a3 |
449 | |
450 | struct i801_mux_config { |
451 | char *gpio_chip; |
452 | @@ -1038,6 +1040,7 @@ static const struct pci_device_id i801_ids[] = { |
453 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CANNONLAKE_H_SMBUS) }, |
454 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CANNONLAKE_LP_SMBUS) }, |
455 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICELAKE_LP_SMBUS) }, |
456 | + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_COMETLAKE_SMBUS) }, |
457 | { 0, } |
458 | }; |
459 | |
460 | @@ -1534,6 +1537,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) |
461 | case PCI_DEVICE_ID_INTEL_DNV_SMBUS: |
462 | case PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS: |
463 | case PCI_DEVICE_ID_INTEL_ICELAKE_LP_SMBUS: |
464 | + case PCI_DEVICE_ID_INTEL_COMETLAKE_SMBUS: |
465 | priv->features |= FEATURE_I2C_BLOCK_READ; |
466 | priv->features |= FEATURE_IRQ; |
467 | priv->features |= FEATURE_SMBUS_PEC; |
468 | diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c |
469 | index 0b3877681e4a..8d9920ff4134 100644 |
470 | --- a/drivers/iommu/amd_iommu.c |
471 | +++ b/drivers/iommu/amd_iommu.c |
472 | @@ -3119,21 +3119,24 @@ static void amd_iommu_get_resv_regions(struct device *dev, |
473 | return; |
474 | |
475 | list_for_each_entry(entry, &amd_iommu_unity_map, list) { |
476 | + int type, prot = 0; |
477 | size_t length; |
478 | - int prot = 0; |
479 | |
480 | if (devid < entry->devid_start || devid > entry->devid_end) |
481 | continue; |
482 | |
483 | + type = IOMMU_RESV_DIRECT; |
484 | length = entry->address_end - entry->address_start; |
485 | if (entry->prot & IOMMU_PROT_IR) |
486 | prot |= IOMMU_READ; |
487 | if (entry->prot & IOMMU_PROT_IW) |
488 | prot |= IOMMU_WRITE; |
489 | + if (entry->prot & IOMMU_UNITY_MAP_FLAG_EXCL_RANGE) |
490 | + /* Exclusion range */ |
491 | + type = IOMMU_RESV_RESERVED; |
492 | |
493 | region = iommu_alloc_resv_region(entry->address_start, |
494 | - length, prot, |
495 | - IOMMU_RESV_DIRECT); |
496 | + length, prot, type); |
497 | if (!region) { |
498 | pr_err("Out of memory allocating dm-regions for %s\n", |
499 | dev_name(dev)); |
500 | diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c |
501 | index e062ab9687c7..be3801d43d48 100644 |
502 | --- a/drivers/iommu/amd_iommu_init.c |
503 | +++ b/drivers/iommu/amd_iommu_init.c |
504 | @@ -2001,6 +2001,9 @@ static int __init init_unity_map_range(struct ivmd_header *m) |
505 | if (e == NULL) |
506 | return -ENOMEM; |
507 | |
508 | + if (m->flags & IVMD_FLAG_EXCL_RANGE) |
509 | + init_exclusion_range(m); |
510 | + |
511 | switch (m->type) { |
512 | default: |
513 | kfree(e); |
514 | @@ -2047,9 +2050,7 @@ static int __init init_memory_definitions(struct acpi_table_header *table) |
515 | |
516 | while (p < end) { |
517 | m = (struct ivmd_header *)p; |
518 | - if (m->flags & IVMD_FLAG_EXCL_RANGE) |
519 | - init_exclusion_range(m); |
520 | - else if (m->flags & IVMD_FLAG_UNITY_MAP) |
521 | + if (m->flags & (IVMD_FLAG_UNITY_MAP | IVMD_FLAG_EXCL_RANGE)) |
522 | init_unity_map_range(m); |
523 | |
524 | p += m->length; |
525 | diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h |
526 | index e2b342e65a7b..69f3d4c95b53 100644 |
527 | --- a/drivers/iommu/amd_iommu_types.h |
528 | +++ b/drivers/iommu/amd_iommu_types.h |
529 | @@ -373,6 +373,8 @@ |
530 | #define IOMMU_PROT_IR 0x01 |
531 | #define IOMMU_PROT_IW 0x02 |
532 | |
533 | +#define IOMMU_UNITY_MAP_FLAG_EXCL_RANGE (1 << 2) |
534 | + |
535 | /* IOMMU capabilities */ |
536 | #define IOMMU_CAP_IOTLB 24 |
537 | #define IOMMU_CAP_NPCACHE 26 |
538 | diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c |
539 | index 7fea18b0c15d..7cb4d685a1f1 100644 |
540 | --- a/drivers/leds/leds-pca9532.c |
541 | +++ b/drivers/leds/leds-pca9532.c |
542 | @@ -513,6 +513,7 @@ static int pca9532_probe(struct i2c_client *client, |
543 | const struct i2c_device_id *id) |
544 | { |
545 | int devid; |
546 | + const struct of_device_id *of_id; |
547 | struct pca9532_data *data = i2c_get_clientdata(client); |
548 | struct pca9532_platform_data *pca9532_pdata = |
549 | dev_get_platdata(&client->dev); |
550 | @@ -528,8 +529,11 @@ static int pca9532_probe(struct i2c_client *client, |
551 | dev_err(&client->dev, "no platform data\n"); |
552 | return -EINVAL; |
553 | } |
554 | - devid = (int)(uintptr_t)of_match_device( |
555 | - of_pca9532_leds_match, &client->dev)->data; |
556 | + of_id = of_match_device(of_pca9532_leds_match, |
557 | + &client->dev); |
558 | + if (unlikely(!of_id)) |
559 | + return -EINVAL; |
560 | + devid = (int)(uintptr_t) of_id->data; |
561 | } else { |
562 | devid = id->driver_data; |
563 | } |
564 | diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c |
565 | index 3dd3ed46d473..136f86a1627d 100644 |
566 | --- a/drivers/leds/trigger/ledtrig-netdev.c |
567 | +++ b/drivers/leds/trigger/ledtrig-netdev.c |
568 | @@ -122,7 +122,8 @@ static ssize_t device_name_store(struct device *dev, |
569 | trigger_data->net_dev = NULL; |
570 | } |
571 | |
572 | - strncpy(trigger_data->device_name, buf, size); |
573 | + memcpy(trigger_data->device_name, buf, size); |
574 | + trigger_data->device_name[size] = 0; |
575 | if (size > 0 && trigger_data->device_name[size - 1] == '\n') |
576 | trigger_data->device_name[size - 1] = 0; |
577 | |
578 | @@ -301,11 +302,11 @@ static int netdev_trig_notify(struct notifier_block *nb, |
579 | container_of(nb, struct led_netdev_data, notifier); |
580 | |
581 | if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE |
582 | - && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER |
583 | - && evt != NETDEV_CHANGENAME) |
584 | + && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER) |
585 | return NOTIFY_DONE; |
586 | |
587 | - if (strcmp(dev->name, trigger_data->device_name)) |
588 | + if (!(dev == trigger_data->net_dev || |
589 | + (evt == NETDEV_REGISTER && !strcmp(dev->name, trigger_data->device_name)))) |
590 | return NOTIFY_DONE; |
591 | |
592 | cancel_delayed_work_sync(&trigger_data->work); |
593 | @@ -320,12 +321,9 @@ static int netdev_trig_notify(struct notifier_block *nb, |
594 | dev_hold(dev); |
595 | trigger_data->net_dev = dev; |
596 | break; |
597 | - case NETDEV_CHANGENAME: |
598 | case NETDEV_UNREGISTER: |
599 | - if (trigger_data->net_dev) { |
600 | - dev_put(trigger_data->net_dev); |
601 | - trigger_data->net_dev = NULL; |
602 | - } |
603 | + dev_put(trigger_data->net_dev); |
604 | + trigger_data->net_dev = NULL; |
605 | break; |
606 | case NETDEV_UP: |
607 | case NETDEV_CHANGE: |
608 | diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c |
609 | index 8abea1c3844f..7d7b51383adf 100644 |
610 | --- a/drivers/net/ethernet/cadence/macb_main.c |
611 | +++ b/drivers/net/ethernet/cadence/macb_main.c |
612 | @@ -3323,14 +3323,20 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk, |
613 | *hclk = devm_clk_get(&pdev->dev, "hclk"); |
614 | } |
615 | |
616 | - if (IS_ERR(*pclk)) { |
617 | + if (IS_ERR_OR_NULL(*pclk)) { |
618 | err = PTR_ERR(*pclk); |
619 | + if (!err) |
620 | + err = -ENODEV; |
621 | + |
622 | dev_err(&pdev->dev, "failed to get macb_clk (%u)\n", err); |
623 | return err; |
624 | } |
625 | |
626 | - if (IS_ERR(*hclk)) { |
627 | + if (IS_ERR_OR_NULL(*hclk)) { |
628 | err = PTR_ERR(*hclk); |
629 | + if (!err) |
630 | + err = -ENODEV; |
631 | + |
632 | dev_err(&pdev->dev, "failed to get hclk (%u)\n", err); |
633 | return err; |
634 | } |
635 | diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c |
636 | index 03f64f40b2a3..506f78322d74 100644 |
637 | --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c |
638 | +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c |
639 | @@ -3161,6 +3161,7 @@ static ssize_t ehea_probe_port(struct device *dev, |
640 | |
641 | if (ehea_add_adapter_mr(adapter)) { |
642 | pr_err("creating MR failed\n"); |
643 | + of_node_put(eth_dn); |
644 | return -EIO; |
645 | } |
646 | |
647 | diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c |
648 | index bd6e9014bc74..b83b070a9eec 100644 |
649 | --- a/drivers/net/ethernet/micrel/ks8851.c |
650 | +++ b/drivers/net/ethernet/micrel/ks8851.c |
651 | @@ -535,9 +535,8 @@ static void ks8851_rx_pkts(struct ks8851_net *ks) |
652 | /* set dma read address */ |
653 | ks8851_wrreg16(ks, KS_RXFDPR, RXFDPR_RXFPAI | 0x00); |
654 | |
655 | - /* start the packet dma process, and set auto-dequeue rx */ |
656 | - ks8851_wrreg16(ks, KS_RXQCR, |
657 | - ks->rc_rxqcr | RXQCR_SDA | RXQCR_ADRFE); |
658 | + /* start DMA access */ |
659 | + ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA); |
660 | |
661 | if (rxlen > 4) { |
662 | unsigned int rxalign; |
663 | @@ -568,7 +567,8 @@ static void ks8851_rx_pkts(struct ks8851_net *ks) |
664 | } |
665 | } |
666 | |
667 | - ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr); |
668 | + /* end DMA access and dequeue packet */ |
669 | + ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_RRXEF); |
670 | } |
671 | } |
672 | |
673 | @@ -785,6 +785,15 @@ static void ks8851_tx_work(struct work_struct *work) |
674 | static int ks8851_net_open(struct net_device *dev) |
675 | { |
676 | struct ks8851_net *ks = netdev_priv(dev); |
677 | + int ret; |
678 | + |
679 | + ret = request_threaded_irq(dev->irq, NULL, ks8851_irq, |
680 | + IRQF_TRIGGER_LOW | IRQF_ONESHOT, |
681 | + dev->name, ks); |
682 | + if (ret < 0) { |
683 | + netdev_err(dev, "failed to get irq\n"); |
684 | + return ret; |
685 | + } |
686 | |
687 | /* lock the card, even if we may not actually be doing anything |
688 | * else at the moment */ |
689 | @@ -849,6 +858,7 @@ static int ks8851_net_open(struct net_device *dev) |
690 | netif_dbg(ks, ifup, ks->netdev, "network device up\n"); |
691 | |
692 | mutex_unlock(&ks->lock); |
693 | + mii_check_link(&ks->mii); |
694 | return 0; |
695 | } |
696 | |
697 | @@ -899,6 +909,8 @@ static int ks8851_net_stop(struct net_device *dev) |
698 | dev_kfree_skb(txb); |
699 | } |
700 | |
701 | + free_irq(dev->irq, ks); |
702 | + |
703 | return 0; |
704 | } |
705 | |
706 | @@ -1508,6 +1520,7 @@ static int ks8851_probe(struct spi_device *spi) |
707 | |
708 | spi_set_drvdata(spi, ks); |
709 | |
710 | + netif_carrier_off(ks->netdev); |
711 | ndev->if_port = IF_PORT_100BASET; |
712 | ndev->netdev_ops = &ks8851_netdev_ops; |
713 | ndev->irq = spi->irq; |
714 | @@ -1529,14 +1542,6 @@ static int ks8851_probe(struct spi_device *spi) |
715 | ks8851_read_selftest(ks); |
716 | ks8851_init_mac(ks); |
717 | |
718 | - ret = request_threaded_irq(spi->irq, NULL, ks8851_irq, |
719 | - IRQF_TRIGGER_LOW | IRQF_ONESHOT, |
720 | - ndev->name, ks); |
721 | - if (ret < 0) { |
722 | - dev_err(&spi->dev, "failed to get irq\n"); |
723 | - goto err_irq; |
724 | - } |
725 | - |
726 | ret = register_netdev(ndev); |
727 | if (ret) { |
728 | dev_err(&spi->dev, "failed to register network device\n"); |
729 | @@ -1549,14 +1554,10 @@ static int ks8851_probe(struct spi_device *spi) |
730 | |
731 | return 0; |
732 | |
733 | - |
734 | err_netdev: |
735 | - free_irq(ndev->irq, ks); |
736 | - |
737 | -err_irq: |
738 | +err_id: |
739 | if (gpio_is_valid(gpio)) |
740 | gpio_set_value(gpio, 0); |
741 | -err_id: |
742 | regulator_disable(ks->vdd_reg); |
743 | err_reg: |
744 | regulator_disable(ks->vdd_io); |
745 | @@ -1574,7 +1575,6 @@ static int ks8851_remove(struct spi_device *spi) |
746 | dev_info(&spi->dev, "remove\n"); |
747 | |
748 | unregister_netdev(priv->netdev); |
749 | - free_irq(spi->irq, priv); |
750 | if (gpio_is_valid(priv->gpio)) |
751 | gpio_set_value(priv->gpio, 0); |
752 | regulator_disable(priv->vdd_reg); |
753 | diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c |
754 | index 3b0adda7cc9c..a4cd6f2cfb86 100644 |
755 | --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c |
756 | +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c |
757 | @@ -1048,6 +1048,8 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode) |
758 | |
759 | for (i = 0; i < QLCNIC_NUM_ILB_PKT; i++) { |
760 | skb = netdev_alloc_skb(adapter->netdev, QLCNIC_ILB_PKT_SIZE); |
761 | + if (!skb) |
762 | + break; |
763 | qlcnic_create_loopback_buff(skb->data, adapter->mac_addr); |
764 | skb_put(skb, QLCNIC_ILB_PKT_SIZE); |
765 | adapter->ahw->diag_cnt = 0; |
766 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
767 | index 62460a5b4ad9..39c105092214 100644 |
768 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
769 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
770 | @@ -3195,14 +3195,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) |
771 | stmmac_prepare_tx_desc(priv, first, 1, nopaged_len, |
772 | csum_insertion, priv->mode, 1, last_segment, |
773 | skb->len); |
774 | - |
775 | - /* The own bit must be the latest setting done when prepare the |
776 | - * descriptor and then barrier is needed to make sure that |
777 | - * all is coherent before granting the DMA engine. |
778 | - */ |
779 | - wmb(); |
780 | + } else { |
781 | + stmmac_set_tx_owner(priv, first); |
782 | } |
783 | |
784 | + /* The own bit must be the latest setting done when prepare the |
785 | + * descriptor and then barrier is needed to make sure that |
786 | + * all is coherent before granting the DMA engine. |
787 | + */ |
788 | + wmb(); |
789 | + |
790 | netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len); |
791 | |
792 | stmmac_enable_dma_transmission(priv, priv->ioaddr); |
793 | diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c |
794 | index 72b98e27c992..d177dfd1df89 100644 |
795 | --- a/drivers/net/ethernet/ti/netcp_ethss.c |
796 | +++ b/drivers/net/ethernet/ti/netcp_ethss.c |
797 | @@ -3655,12 +3655,16 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev, |
798 | |
799 | ret = netcp_txpipe_init(&gbe_dev->tx_pipe, netcp_device, |
800 | gbe_dev->dma_chan_name, gbe_dev->tx_queue_id); |
801 | - if (ret) |
802 | + if (ret) { |
803 | + of_node_put(interfaces); |
804 | return ret; |
805 | + } |
806 | |
807 | ret = netcp_txpipe_open(&gbe_dev->tx_pipe); |
808 | - if (ret) |
809 | + if (ret) { |
810 | + of_node_put(interfaces); |
811 | return ret; |
812 | + } |
813 | |
814 | /* Create network interfaces */ |
815 | INIT_LIST_HEAD(&gbe_dev->gbe_intf_head); |
816 | diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
817 | index f24f48f33802..7cfd7ff38e86 100644 |
818 | --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
819 | +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
820 | @@ -1574,12 +1574,14 @@ static int axienet_probe(struct platform_device *pdev) |
821 | ret = of_address_to_resource(np, 0, &dmares); |
822 | if (ret) { |
823 | dev_err(&pdev->dev, "unable to get DMA resource\n"); |
824 | + of_node_put(np); |
825 | goto free_netdev; |
826 | } |
827 | lp->dma_regs = devm_ioremap_resource(&pdev->dev, &dmares); |
828 | if (IS_ERR(lp->dma_regs)) { |
829 | dev_err(&pdev->dev, "could not map DMA regs\n"); |
830 | ret = PTR_ERR(lp->dma_regs); |
831 | + of_node_put(np); |
832 | goto free_netdev; |
833 | } |
834 | lp->rx_irq = irq_of_parse_and_map(np, 1); |
835 | diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c |
836 | index cd1d8faccca5..cd6b95e673a5 100644 |
837 | --- a/drivers/net/ieee802154/adf7242.c |
838 | +++ b/drivers/net/ieee802154/adf7242.c |
839 | @@ -1268,6 +1268,10 @@ static int adf7242_probe(struct spi_device *spi) |
840 | INIT_DELAYED_WORK(&lp->work, adf7242_rx_cal_work); |
841 | lp->wqueue = alloc_ordered_workqueue(dev_name(&spi->dev), |
842 | WQ_MEM_RECLAIM); |
843 | + if (unlikely(!lp->wqueue)) { |
844 | + ret = -ENOMEM; |
845 | + goto err_hw_init; |
846 | + } |
847 | |
848 | ret = adf7242_hw_init(lp); |
849 | if (ret) |
850 | diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c |
851 | index 624bff4d3636..f1ed1744801c 100644 |
852 | --- a/drivers/net/ieee802154/mac802154_hwsim.c |
853 | +++ b/drivers/net/ieee802154/mac802154_hwsim.c |
854 | @@ -332,7 +332,7 @@ static int hwsim_get_radio_nl(struct sk_buff *msg, struct genl_info *info) |
855 | goto out_err; |
856 | } |
857 | |
858 | - genlmsg_reply(skb, info); |
859 | + res = genlmsg_reply(skb, info); |
860 | break; |
861 | } |
862 | |
863 | diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c |
864 | index da8f5ad30c71..260248fbb8fe 100644 |
865 | --- a/drivers/nvme/host/multipath.c |
866 | +++ b/drivers/nvme/host/multipath.c |
867 | @@ -349,15 +349,12 @@ static inline bool nvme_state_is_live(enum nvme_ana_state state) |
868 | static void nvme_update_ns_ana_state(struct nvme_ana_group_desc *desc, |
869 | struct nvme_ns *ns) |
870 | { |
871 | - enum nvme_ana_state old; |
872 | - |
873 | mutex_lock(&ns->head->lock); |
874 | - old = ns->ana_state; |
875 | ns->ana_grpid = le32_to_cpu(desc->grpid); |
876 | ns->ana_state = desc->state; |
877 | clear_bit(NVME_NS_ANA_PENDING, &ns->flags); |
878 | |
879 | - if (nvme_state_is_live(ns->ana_state) && !nvme_state_is_live(old)) |
880 | + if (nvme_state_is_live(ns->ana_state)) |
881 | nvme_mpath_set_live(ns); |
882 | mutex_unlock(&ns->head->lock); |
883 | } |
884 | diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c |
885 | index 7f71ca0d08e7..9c5e801b3f6c 100644 |
886 | --- a/drivers/s390/net/qeth_l3_main.c |
887 | +++ b/drivers/s390/net/qeth_l3_main.c |
888 | @@ -2586,12 +2586,14 @@ static int qeth_l3_probe_device(struct ccwgroup_device *gdev) |
889 | struct qeth_card *card = dev_get_drvdata(&gdev->dev); |
890 | int rc; |
891 | |
892 | + hash_init(card->ip_htable); |
893 | + |
894 | if (gdev->dev.type == &qeth_generic_devtype) { |
895 | rc = qeth_l3_create_device_attributes(&gdev->dev); |
896 | if (rc) |
897 | return rc; |
898 | } |
899 | - hash_init(card->ip_htable); |
900 | + |
901 | hash_init(card->ip_mc_htable); |
902 | card->options.layer2 = 0; |
903 | card->info.hwtrap = 0; |
904 | diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c |
905 | index f6c415d6ef48..5eb7aabe2d8b 100644 |
906 | --- a/drivers/s390/scsi/zfcp_fc.c |
907 | +++ b/drivers/s390/scsi/zfcp_fc.c |
908 | @@ -239,10 +239,6 @@ static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range, |
909 | list_for_each_entry(port, &adapter->port_list, list) { |
910 | if ((port->d_id & range) == (ntoh24(page->rscn_fid) & range)) |
911 | zfcp_fc_test_link(port); |
912 | - if (!port->d_id) |
913 | - zfcp_erp_port_reopen(port, |
914 | - ZFCP_STATUS_COMMON_ERP_FAILED, |
915 | - "fcrscn1"); |
916 | } |
917 | read_unlock_irqrestore(&adapter->port_list_lock, flags); |
918 | } |
919 | @@ -250,6 +246,7 @@ static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range, |
920 | static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req) |
921 | { |
922 | struct fsf_status_read_buffer *status_buffer = (void *)fsf_req->data; |
923 | + struct zfcp_adapter *adapter = fsf_req->adapter; |
924 | struct fc_els_rscn *head; |
925 | struct fc_els_rscn_page *page; |
926 | u16 i; |
927 | @@ -263,6 +260,22 @@ static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req) |
928 | no_entries = be16_to_cpu(head->rscn_plen) / |
929 | sizeof(struct fc_els_rscn_page); |
930 | |
931 | + if (no_entries > 1) { |
932 | + /* handle failed ports */ |
933 | + unsigned long flags; |
934 | + struct zfcp_port *port; |
935 | + |
936 | + read_lock_irqsave(&adapter->port_list_lock, flags); |
937 | + list_for_each_entry(port, &adapter->port_list, list) { |
938 | + if (port->d_id) |
939 | + continue; |
940 | + zfcp_erp_port_reopen(port, |
941 | + ZFCP_STATUS_COMMON_ERP_FAILED, |
942 | + "fcrscn1"); |
943 | + } |
944 | + read_unlock_irqrestore(&adapter->port_list_lock, flags); |
945 | + } |
946 | + |
947 | for (i = 1; i < no_entries; i++) { |
948 | /* skip head and start with 1st element */ |
949 | page++; |
950 | diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h |
951 | index 39eb415987fc..074760f21014 100644 |
952 | --- a/drivers/scsi/aacraid/aacraid.h |
953 | +++ b/drivers/scsi/aacraid/aacraid.h |
954 | @@ -2639,9 +2639,14 @@ static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor) |
955 | return capacity; |
956 | } |
957 | |
958 | +static inline int aac_pci_offline(struct aac_dev *dev) |
959 | +{ |
960 | + return pci_channel_offline(dev->pdev) || dev->handle_pci_error; |
961 | +} |
962 | + |
963 | static inline int aac_adapter_check_health(struct aac_dev *dev) |
964 | { |
965 | - if (unlikely(pci_channel_offline(dev->pdev))) |
966 | + if (unlikely(aac_pci_offline(dev))) |
967 | return -1; |
968 | |
969 | return (dev)->a_ops.adapter_check_health(dev); |
970 | diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c |
971 | index 3236240a4edd..b7588de4484e 100644 |
972 | --- a/drivers/scsi/aacraid/commsup.c |
973 | +++ b/drivers/scsi/aacraid/commsup.c |
974 | @@ -673,7 +673,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, |
975 | return -ETIMEDOUT; |
976 | } |
977 | |
978 | - if (unlikely(pci_channel_offline(dev->pdev))) |
979 | + if (unlikely(aac_pci_offline(dev))) |
980 | return -EFAULT; |
981 | |
982 | if ((blink = aac_adapter_check_health(dev)) > 0) { |
983 | @@ -773,7 +773,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback, |
984 | |
985 | spin_unlock_irqrestore(&fibptr->event_lock, flags); |
986 | |
987 | - if (unlikely(pci_channel_offline(dev->pdev))) |
988 | + if (unlikely(aac_pci_offline(dev))) |
989 | return -EFAULT; |
990 | |
991 | fibptr->flags |= FIB_CONTEXT_FLAG_WAIT; |
992 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c |
993 | index b59bba3e6516..8776330175e3 100644 |
994 | --- a/drivers/scsi/mpt3sas/mpt3sas_base.c |
995 | +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c |
996 | @@ -3280,12 +3280,18 @@ mpt3sas_base_free_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid) |
997 | |
998 | if (smid < ioc->hi_priority_smid) { |
999 | struct scsiio_tracker *st; |
1000 | + void *request; |
1001 | |
1002 | st = _get_st_from_smid(ioc, smid); |
1003 | if (!st) { |
1004 | _base_recovery_check(ioc); |
1005 | return; |
1006 | } |
1007 | + |
1008 | + /* Clear MPI request frame */ |
1009 | + request = mpt3sas_base_get_msg_frame(ioc, smid); |
1010 | + memset(request, 0, ioc->request_sz); |
1011 | + |
1012 | mpt3sas_base_clear_st(ioc, st); |
1013 | _base_recovery_check(ioc); |
1014 | return; |
1015 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
1016 | index 622832e55211..73d661a0ecbb 100644 |
1017 | --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
1018 | +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
1019 | @@ -1474,11 +1474,23 @@ mpt3sas_scsih_scsi_lookup_get(struct MPT3SAS_ADAPTER *ioc, u16 smid) |
1020 | { |
1021 | struct scsi_cmnd *scmd = NULL; |
1022 | struct scsiio_tracker *st; |
1023 | + Mpi25SCSIIORequest_t *mpi_request; |
1024 | |
1025 | if (smid > 0 && |
1026 | smid <= ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT) { |
1027 | u32 unique_tag = smid - 1; |
1028 | |
1029 | + mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); |
1030 | + |
1031 | + /* |
1032 | + * If SCSI IO request is outstanding at driver level then |
1033 | + * DevHandle filed must be non-zero. If DevHandle is zero |
1034 | + * then it means that this smid is free at driver level, |
1035 | + * so return NULL. |
1036 | + */ |
1037 | + if (!mpi_request->DevHandle) |
1038 | + return scmd; |
1039 | + |
1040 | scmd = scsi_host_find_tag(ioc->shost, unique_tag); |
1041 | if (scmd) { |
1042 | st = scsi_cmd_priv(scmd); |
1043 | diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c |
1044 | index 575445c761b4..5dd3e4e01b10 100644 |
1045 | --- a/drivers/scsi/qla4xxx/ql4_os.c |
1046 | +++ b/drivers/scsi/qla4xxx/ql4_os.c |
1047 | @@ -3204,6 +3204,8 @@ static int qla4xxx_conn_bind(struct iscsi_cls_session *cls_session, |
1048 | if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) |
1049 | return -EINVAL; |
1050 | ep = iscsi_lookup_endpoint(transport_fd); |
1051 | + if (!ep) |
1052 | + return -EINVAL; |
1053 | conn = cls_conn->dd_data; |
1054 | qla_conn = conn->dd_data; |
1055 | qla_conn->qla_ep = ep->dd_data; |
1056 | diff --git a/drivers/staging/axis-fifo/Kconfig b/drivers/staging/axis-fifo/Kconfig |
1057 | index 687537203d9c..d9725888af6f 100644 |
1058 | --- a/drivers/staging/axis-fifo/Kconfig |
1059 | +++ b/drivers/staging/axis-fifo/Kconfig |
1060 | @@ -3,6 +3,7 @@ |
1061 | # |
1062 | config XIL_AXIS_FIFO |
1063 | tristate "Xilinx AXI-Stream FIFO IP core driver" |
1064 | + depends on OF |
1065 | default n |
1066 | help |
1067 | This adds support for the Xilinx AXI-Stream |
1068 | diff --git a/drivers/staging/mt7621-pci/Kconfig b/drivers/staging/mt7621-pci/Kconfig |
1069 | index d33533872a16..c8fa17cfa807 100644 |
1070 | --- a/drivers/staging/mt7621-pci/Kconfig |
1071 | +++ b/drivers/staging/mt7621-pci/Kconfig |
1072 | @@ -1,6 +1,7 @@ |
1073 | config PCI_MT7621 |
1074 | tristate "MediaTek MT7621 PCI Controller" |
1075 | depends on RALINK |
1076 | + depends on PCI |
1077 | select PCI_DRIVERS_GENERIC |
1078 | help |
1079 | This selects a driver for the MediaTek MT7621 PCI Controller. |
1080 | diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c |
1081 | index 2130d78e0d9f..dd9b02d316f3 100644 |
1082 | --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c |
1083 | +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c |
1084 | @@ -178,7 +178,9 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) |
1085 | |
1086 | pxmitpriv->free_xmit_extbuf_cnt = num_xmit_extbuf; |
1087 | |
1088 | - rtw_alloc_hwxmits(padapter); |
1089 | + res = rtw_alloc_hwxmits(padapter); |
1090 | + if (res == _FAIL) |
1091 | + goto exit; |
1092 | rtw_init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry); |
1093 | |
1094 | for (i = 0; i < 4; i++) |
1095 | @@ -1502,7 +1504,7 @@ exit: |
1096 | return res; |
1097 | } |
1098 | |
1099 | -void rtw_alloc_hwxmits(struct adapter *padapter) |
1100 | +s32 rtw_alloc_hwxmits(struct adapter *padapter) |
1101 | { |
1102 | struct hw_xmit *hwxmits; |
1103 | struct xmit_priv *pxmitpriv = &padapter->xmitpriv; |
1104 | @@ -1511,6 +1513,8 @@ void rtw_alloc_hwxmits(struct adapter *padapter) |
1105 | |
1106 | pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry, |
1107 | sizeof(struct hw_xmit), GFP_KERNEL); |
1108 | + if (!pxmitpriv->hwxmits) |
1109 | + return _FAIL; |
1110 | |
1111 | hwxmits = pxmitpriv->hwxmits; |
1112 | |
1113 | @@ -1518,6 +1522,7 @@ void rtw_alloc_hwxmits(struct adapter *padapter) |
1114 | hwxmits[1] .sta_queue = &pxmitpriv->vi_pending; |
1115 | hwxmits[2] .sta_queue = &pxmitpriv->be_pending; |
1116 | hwxmits[3] .sta_queue = &pxmitpriv->bk_pending; |
1117 | + return _SUCCESS; |
1118 | } |
1119 | |
1120 | void rtw_free_hwxmits(struct adapter *padapter) |
1121 | diff --git a/drivers/staging/rtl8188eu/include/rtw_xmit.h b/drivers/staging/rtl8188eu/include/rtw_xmit.h |
1122 | index 788f59c74ea1..ba7e15fbde72 100644 |
1123 | --- a/drivers/staging/rtl8188eu/include/rtw_xmit.h |
1124 | +++ b/drivers/staging/rtl8188eu/include/rtw_xmit.h |
1125 | @@ -336,7 +336,7 @@ s32 rtw_txframes_sta_ac_pending(struct adapter *padapter, |
1126 | void rtw_init_hwxmits(struct hw_xmit *phwxmit, int entry); |
1127 | s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter); |
1128 | void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv); |
1129 | -void rtw_alloc_hwxmits(struct adapter *padapter); |
1130 | +s32 rtw_alloc_hwxmits(struct adapter *padapter); |
1131 | void rtw_free_hwxmits(struct adapter *padapter); |
1132 | s32 rtw_xmit(struct adapter *padapter, struct sk_buff **pkt); |
1133 | |
1134 | diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c b/drivers/staging/rtl8712/rtl8712_cmd.c |
1135 | index b1dfe9f46619..63bc811681d9 100644 |
1136 | --- a/drivers/staging/rtl8712/rtl8712_cmd.c |
1137 | +++ b/drivers/staging/rtl8712/rtl8712_cmd.c |
1138 | @@ -159,17 +159,9 @@ static u8 write_macreg_hdl(struct _adapter *padapter, u8 *pbuf) |
1139 | |
1140 | static u8 read_bbreg_hdl(struct _adapter *padapter, u8 *pbuf) |
1141 | { |
1142 | - u32 val; |
1143 | - void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd); |
1144 | struct cmd_obj *pcmd = (struct cmd_obj *)pbuf; |
1145 | |
1146 | - if (pcmd->rsp && pcmd->rspsz > 0) |
1147 | - memcpy(pcmd->rsp, (u8 *)&val, pcmd->rspsz); |
1148 | - pcmd_callback = cmd_callback[pcmd->cmdcode].callback; |
1149 | - if (!pcmd_callback) |
1150 | - r8712_free_cmd_obj(pcmd); |
1151 | - else |
1152 | - pcmd_callback(padapter, pcmd); |
1153 | + r8712_free_cmd_obj(pcmd); |
1154 | return H2C_SUCCESS; |
1155 | } |
1156 | |
1157 | diff --git a/drivers/staging/rtl8712/rtl8712_cmd.h b/drivers/staging/rtl8712/rtl8712_cmd.h |
1158 | index 9181bb6b04c3..a101a0a50955 100644 |
1159 | --- a/drivers/staging/rtl8712/rtl8712_cmd.h |
1160 | +++ b/drivers/staging/rtl8712/rtl8712_cmd.h |
1161 | @@ -152,7 +152,7 @@ enum rtl8712_h2c_cmd { |
1162 | static struct _cmd_callback cmd_callback[] = { |
1163 | {GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/ |
1164 | {GEN_CMD_CODE(_Write_MACREG), NULL}, |
1165 | - {GEN_CMD_CODE(_Read_BBREG), &r8712_getbbrfreg_cmdrsp_callback}, |
1166 | + {GEN_CMD_CODE(_Read_BBREG), NULL}, |
1167 | {GEN_CMD_CODE(_Write_BBREG), NULL}, |
1168 | {GEN_CMD_CODE(_Read_RFREG), &r8712_getbbrfreg_cmdrsp_callback}, |
1169 | {GEN_CMD_CODE(_Write_RFREG), NULL}, /*5*/ |
1170 | diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c |
1171 | index edb678190b4b..16291de5c0d9 100644 |
1172 | --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c |
1173 | +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c |
1174 | @@ -260,7 +260,9 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) |
1175 | } |
1176 | } |
1177 | |
1178 | - rtw_alloc_hwxmits(padapter); |
1179 | + res = rtw_alloc_hwxmits(padapter); |
1180 | + if (res == _FAIL) |
1181 | + goto exit; |
1182 | rtw_init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry); |
1183 | |
1184 | for (i = 0; i < 4; i++) { |
1185 | @@ -2144,7 +2146,7 @@ exit: |
1186 | return res; |
1187 | } |
1188 | |
1189 | -void rtw_alloc_hwxmits(struct adapter *padapter) |
1190 | +s32 rtw_alloc_hwxmits(struct adapter *padapter) |
1191 | { |
1192 | struct hw_xmit *hwxmits; |
1193 | struct xmit_priv *pxmitpriv = &padapter->xmitpriv; |
1194 | @@ -2155,10 +2157,8 @@ void rtw_alloc_hwxmits(struct adapter *padapter) |
1195 | |
1196 | pxmitpriv->hwxmits = rtw_zmalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry); |
1197 | |
1198 | - if (pxmitpriv->hwxmits == NULL) { |
1199 | - DBG_871X("alloc hwxmits fail!...\n"); |
1200 | - return; |
1201 | - } |
1202 | + if (!pxmitpriv->hwxmits) |
1203 | + return _FAIL; |
1204 | |
1205 | hwxmits = pxmitpriv->hwxmits; |
1206 | |
1207 | @@ -2204,7 +2204,7 @@ void rtw_alloc_hwxmits(struct adapter *padapter) |
1208 | |
1209 | } |
1210 | |
1211 | - |
1212 | + return _SUCCESS; |
1213 | } |
1214 | |
1215 | void rtw_free_hwxmits(struct adapter *padapter) |
1216 | diff --git a/drivers/staging/rtl8723bs/include/rtw_xmit.h b/drivers/staging/rtl8723bs/include/rtw_xmit.h |
1217 | index a75b668d09a6..021c72361fbb 100644 |
1218 | --- a/drivers/staging/rtl8723bs/include/rtw_xmit.h |
1219 | +++ b/drivers/staging/rtl8723bs/include/rtw_xmit.h |
1220 | @@ -486,7 +486,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter); |
1221 | void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv); |
1222 | |
1223 | |
1224 | -void rtw_alloc_hwxmits(struct adapter *padapter); |
1225 | +s32 rtw_alloc_hwxmits(struct adapter *padapter); |
1226 | void rtw_free_hwxmits(struct adapter *padapter); |
1227 | |
1228 | |
1229 | diff --git a/drivers/staging/rtlwifi/phydm/rtl_phydm.c b/drivers/staging/rtlwifi/phydm/rtl_phydm.c |
1230 | index 9930ed954abb..4cc77b2016e1 100644 |
1231 | --- a/drivers/staging/rtlwifi/phydm/rtl_phydm.c |
1232 | +++ b/drivers/staging/rtlwifi/phydm/rtl_phydm.c |
1233 | @@ -180,6 +180,8 @@ static int rtl_phydm_init_priv(struct rtl_priv *rtlpriv, |
1234 | |
1235 | rtlpriv->phydm.internal = |
1236 | kzalloc(sizeof(struct phy_dm_struct), GFP_KERNEL); |
1237 | + if (!rtlpriv->phydm.internal) |
1238 | + return 0; |
1239 | |
1240 | _rtl_phydm_init_com_info(rtlpriv, ic, params); |
1241 | |
1242 | diff --git a/drivers/staging/rtlwifi/rtl8822be/fw.c b/drivers/staging/rtlwifi/rtl8822be/fw.c |
1243 | index a40396614814..c1ed52df05f0 100644 |
1244 | --- a/drivers/staging/rtlwifi/rtl8822be/fw.c |
1245 | +++ b/drivers/staging/rtlwifi/rtl8822be/fw.c |
1246 | @@ -741,6 +741,8 @@ void rtl8822be_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) |
1247 | u1_rsvd_page_loc, 3); |
1248 | |
1249 | skb = dev_alloc_skb(totalpacketlen); |
1250 | + if (!skb) |
1251 | + return; |
1252 | memcpy((u8 *)skb_put(skb, totalpacketlen), &reserved_page_packet, |
1253 | totalpacketlen); |
1254 | |
1255 | diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c |
1256 | index db5df3d54818..3bdd56a1021b 100644 |
1257 | --- a/drivers/tty/serial/ar933x_uart.c |
1258 | +++ b/drivers/tty/serial/ar933x_uart.c |
1259 | @@ -49,11 +49,6 @@ struct ar933x_uart_port { |
1260 | struct clk *clk; |
1261 | }; |
1262 | |
1263 | -static inline bool ar933x_uart_console_enabled(void) |
1264 | -{ |
1265 | - return IS_ENABLED(CONFIG_SERIAL_AR933X_CONSOLE); |
1266 | -} |
1267 | - |
1268 | static inline unsigned int ar933x_uart_read(struct ar933x_uart_port *up, |
1269 | int offset) |
1270 | { |
1271 | @@ -508,6 +503,7 @@ static const struct uart_ops ar933x_uart_ops = { |
1272 | .verify_port = ar933x_uart_verify_port, |
1273 | }; |
1274 | |
1275 | +#ifdef CONFIG_SERIAL_AR933X_CONSOLE |
1276 | static struct ar933x_uart_port * |
1277 | ar933x_console_ports[CONFIG_SERIAL_AR933X_NR_UARTS]; |
1278 | |
1279 | @@ -604,14 +600,7 @@ static struct console ar933x_uart_console = { |
1280 | .index = -1, |
1281 | .data = &ar933x_uart_driver, |
1282 | }; |
1283 | - |
1284 | -static void ar933x_uart_add_console_port(struct ar933x_uart_port *up) |
1285 | -{ |
1286 | - if (!ar933x_uart_console_enabled()) |
1287 | - return; |
1288 | - |
1289 | - ar933x_console_ports[up->port.line] = up; |
1290 | -} |
1291 | +#endif /* CONFIG_SERIAL_AR933X_CONSOLE */ |
1292 | |
1293 | static struct uart_driver ar933x_uart_driver = { |
1294 | .owner = THIS_MODULE, |
1295 | @@ -700,7 +689,9 @@ static int ar933x_uart_probe(struct platform_device *pdev) |
1296 | baud = ar933x_uart_get_baud(port->uartclk, 0, AR933X_UART_MAX_STEP); |
1297 | up->max_baud = min_t(unsigned int, baud, AR933X_UART_MAX_BAUD); |
1298 | |
1299 | - ar933x_uart_add_console_port(up); |
1300 | +#ifdef CONFIG_SERIAL_AR933X_CONSOLE |
1301 | + ar933x_console_ports[up->port.line] = up; |
1302 | +#endif |
1303 | |
1304 | ret = uart_add_one_port(&ar933x_uart_driver, &up->port); |
1305 | if (ret) |
1306 | @@ -749,8 +740,9 @@ static int __init ar933x_uart_init(void) |
1307 | { |
1308 | int ret; |
1309 | |
1310 | - if (ar933x_uart_console_enabled()) |
1311 | - ar933x_uart_driver.cons = &ar933x_uart_console; |
1312 | +#ifdef CONFIG_SERIAL_AR933X_CONSOLE |
1313 | + ar933x_uart_driver.cons = &ar933x_uart_console; |
1314 | +#endif |
1315 | |
1316 | ret = uart_register_driver(&ar933x_uart_driver); |
1317 | if (ret) |
1318 | diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c |
1319 | index 47b41159a8bc..55b178c1bd65 100644 |
1320 | --- a/drivers/tty/serial/sc16is7xx.c |
1321 | +++ b/drivers/tty/serial/sc16is7xx.c |
1322 | @@ -1481,7 +1481,7 @@ static int __init sc16is7xx_init(void) |
1323 | ret = i2c_add_driver(&sc16is7xx_i2c_uart_driver); |
1324 | if (ret < 0) { |
1325 | pr_err("failed to init sc16is7xx i2c --> %d\n", ret); |
1326 | - return ret; |
1327 | + goto err_i2c; |
1328 | } |
1329 | #endif |
1330 | |
1331 | @@ -1489,10 +1489,18 @@ static int __init sc16is7xx_init(void) |
1332 | ret = spi_register_driver(&sc16is7xx_spi_uart_driver); |
1333 | if (ret < 0) { |
1334 | pr_err("failed to init sc16is7xx spi --> %d\n", ret); |
1335 | - return ret; |
1336 | + goto err_spi; |
1337 | } |
1338 | #endif |
1339 | return ret; |
1340 | + |
1341 | +err_spi: |
1342 | +#ifdef CONFIG_SERIAL_SC16IS7XX_I2C |
1343 | + i2c_del_driver(&sc16is7xx_i2c_uart_driver); |
1344 | +#endif |
1345 | +err_i2c: |
1346 | + uart_unregister_driver(&sc16is7xx_uart); |
1347 | + return ret; |
1348 | } |
1349 | module_init(sc16is7xx_init); |
1350 | |
1351 | diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c |
1352 | index fdc6e4e403e8..8cced3609e24 100644 |
1353 | --- a/drivers/usb/dwc3/dwc3-pci.c |
1354 | +++ b/drivers/usb/dwc3/dwc3-pci.c |
1355 | @@ -29,6 +29,7 @@ |
1356 | #define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa |
1357 | #define PCI_DEVICE_ID_INTEL_APL 0x5aaa |
1358 | #define PCI_DEVICE_ID_INTEL_KBP 0xa2b0 |
1359 | +#define PCI_DEVICE_ID_INTEL_CMLH 0x02ee |
1360 | #define PCI_DEVICE_ID_INTEL_GLK 0x31aa |
1361 | #define PCI_DEVICE_ID_INTEL_CNPLP 0x9dee |
1362 | #define PCI_DEVICE_ID_INTEL_CNPH 0xa36e |
1363 | @@ -305,6 +306,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = { |
1364 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD), |
1365 | (kernel_ulong_t) &dwc3_pci_mrfld_properties, }, |
1366 | |
1367 | + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CMLH), |
1368 | + (kernel_ulong_t) &dwc3_pci_intel_properties, }, |
1369 | + |
1370 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SPTLP), |
1371 | (kernel_ulong_t) &dwc3_pci_intel_properties, }, |
1372 | |
1373 | diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c |
1374 | index b77f3126580e..c2011cd7df8c 100644 |
1375 | --- a/drivers/usb/gadget/udc/net2272.c |
1376 | +++ b/drivers/usb/gadget/udc/net2272.c |
1377 | @@ -945,6 +945,7 @@ net2272_dequeue(struct usb_ep *_ep, struct usb_request *_req) |
1378 | break; |
1379 | } |
1380 | if (&req->req != _req) { |
1381 | + ep->stopped = stopped; |
1382 | spin_unlock_irqrestore(&ep->dev->lock, flags); |
1383 | return -EINVAL; |
1384 | } |
1385 | diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c |
1386 | index b02ab2a8d927..ee872cad5270 100644 |
1387 | --- a/drivers/usb/gadget/udc/net2280.c |
1388 | +++ b/drivers/usb/gadget/udc/net2280.c |
1389 | @@ -866,9 +866,6 @@ static void start_queue(struct net2280_ep *ep, u32 dmactl, u32 td_dma) |
1390 | (void) readl(&ep->dev->pci->pcimstctl); |
1391 | |
1392 | writel(BIT(DMA_START), &dma->dmastat); |
1393 | - |
1394 | - if (!ep->is_in) |
1395 | - stop_out_naking(ep); |
1396 | } |
1397 | |
1398 | static void start_dma(struct net2280_ep *ep, struct net2280_request *req) |
1399 | @@ -907,6 +904,7 @@ static void start_dma(struct net2280_ep *ep, struct net2280_request *req) |
1400 | writel(BIT(DMA_START), &dma->dmastat); |
1401 | return; |
1402 | } |
1403 | + stop_out_naking(ep); |
1404 | } |
1405 | |
1406 | tmp = dmactl_default; |
1407 | @@ -1275,9 +1273,9 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req) |
1408 | break; |
1409 | } |
1410 | if (&req->req != _req) { |
1411 | + ep->stopped = stopped; |
1412 | spin_unlock_irqrestore(&ep->dev->lock, flags); |
1413 | - dev_err(&ep->dev->pdev->dev, "%s: Request mismatch\n", |
1414 | - __func__); |
1415 | + ep_dbg(ep->dev, "%s: Request mismatch\n", __func__); |
1416 | return -EINVAL; |
1417 | } |
1418 | |
1419 | diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c |
1420 | index 5b8a3d9530c4..5cac83aaeac3 100644 |
1421 | --- a/drivers/usb/host/u132-hcd.c |
1422 | +++ b/drivers/usb/host/u132-hcd.c |
1423 | @@ -3202,6 +3202,9 @@ static int __init u132_hcd_init(void) |
1424 | printk(KERN_INFO "driver %s\n", hcd_name); |
1425 | workqueue = create_singlethread_workqueue("u132"); |
1426 | retval = platform_driver_register(&u132_platform_driver); |
1427 | + if (retval) |
1428 | + destroy_workqueue(workqueue); |
1429 | + |
1430 | return retval; |
1431 | } |
1432 | |
1433 | diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c |
1434 | index a6efb9a72939..5f7734c729b1 100644 |
1435 | --- a/drivers/usb/misc/usb251xb.c |
1436 | +++ b/drivers/usb/misc/usb251xb.c |
1437 | @@ -601,7 +601,7 @@ static int usb251xb_probe(struct usb251xb *hub) |
1438 | dev); |
1439 | int err; |
1440 | |
1441 | - if (np) { |
1442 | + if (np && of_id) { |
1443 | err = usb251xb_get_ofdata(hub, |
1444 | (struct usb251xb_data *)of_id->data); |
1445 | if (err) { |
1446 | diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c |
1447 | index 4055ab4d5c52..3e518c2ae2bf 100644 |
1448 | --- a/fs/ceph/inode.c |
1449 | +++ b/fs/ceph/inode.c |
1450 | @@ -524,6 +524,7 @@ static void ceph_i_callback(struct rcu_head *head) |
1451 | struct inode *inode = container_of(head, struct inode, i_rcu); |
1452 | struct ceph_inode_info *ci = ceph_inode(inode); |
1453 | |
1454 | + kfree(ci->i_symlink); |
1455 | kmem_cache_free(ceph_inode_cachep, ci); |
1456 | } |
1457 | |
1458 | @@ -561,7 +562,6 @@ void ceph_destroy_inode(struct inode *inode) |
1459 | ceph_put_snap_realm(mdsc, realm); |
1460 | } |
1461 | |
1462 | - kfree(ci->i_symlink); |
1463 | while ((n = rb_first(&ci->i_fragtree)) != NULL) { |
1464 | frag = rb_entry(n, struct ceph_inode_frag, node); |
1465 | rb_erase(n, &ci->i_fragtree); |
1466 | diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c |
1467 | index baaed4d05b22..249de20f752a 100644 |
1468 | --- a/fs/fuse/dev.c |
1469 | +++ b/fs/fuse/dev.c |
1470 | @@ -1989,10 +1989,8 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe, |
1471 | rem += pipe->bufs[(pipe->curbuf + idx) & (pipe->buffers - 1)].len; |
1472 | |
1473 | ret = -EINVAL; |
1474 | - if (rem < len) { |
1475 | - pipe_unlock(pipe); |
1476 | - goto out; |
1477 | - } |
1478 | + if (rem < len) |
1479 | + goto out_free; |
1480 | |
1481 | rem = len; |
1482 | while (rem) { |
1483 | @@ -2010,7 +2008,9 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe, |
1484 | pipe->curbuf = (pipe->curbuf + 1) & (pipe->buffers - 1); |
1485 | pipe->nrbufs--; |
1486 | } else { |
1487 | - pipe_buf_get(pipe, ibuf); |
1488 | + if (!pipe_buf_get(pipe, ibuf)) |
1489 | + goto out_free; |
1490 | + |
1491 | *obuf = *ibuf; |
1492 | obuf->flags &= ~PIPE_BUF_FLAG_GIFT; |
1493 | obuf->len = rem; |
1494 | @@ -2033,11 +2033,11 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe, |
1495 | ret = fuse_dev_do_write(fud, &cs, len); |
1496 | |
1497 | pipe_lock(pipe); |
1498 | +out_free: |
1499 | for (idx = 0; idx < nbuf; idx++) |
1500 | pipe_buf_release(pipe, &bufs[idx]); |
1501 | pipe_unlock(pipe); |
1502 | |
1503 | -out: |
1504 | kvfree(bufs); |
1505 | return ret; |
1506 | } |
1507 | diff --git a/fs/nfs/client.c b/fs/nfs/client.c |
1508 | index 96d5f8135eb9..751ca65da8a3 100644 |
1509 | --- a/fs/nfs/client.c |
1510 | +++ b/fs/nfs/client.c |
1511 | @@ -459,7 +459,7 @@ void nfs_init_timeout_values(struct rpc_timeout *to, int proto, |
1512 | case XPRT_TRANSPORT_RDMA: |
1513 | if (retrans == NFS_UNSPEC_RETRANS) |
1514 | to->to_retries = NFS_DEF_TCP_RETRANS; |
1515 | - if (timeo == NFS_UNSPEC_TIMEO || to->to_retries == 0) |
1516 | + if (timeo == NFS_UNSPEC_TIMEO || to->to_initval == 0) |
1517 | to->to_initval = NFS_DEF_TCP_TIMEO * HZ / 10; |
1518 | if (to->to_initval > NFS_MAX_TCP_TIMEOUT) |
1519 | to->to_initval = NFS_MAX_TCP_TIMEOUT; |
1520 | diff --git a/fs/pipe.c b/fs/pipe.c |
1521 | index c51750ed4011..2a297bce381f 100644 |
1522 | --- a/fs/pipe.c |
1523 | +++ b/fs/pipe.c |
1524 | @@ -189,9 +189,9 @@ EXPORT_SYMBOL(generic_pipe_buf_steal); |
1525 | * in the tee() system call, when we duplicate the buffers in one |
1526 | * pipe into another. |
1527 | */ |
1528 | -void generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf) |
1529 | +bool generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf) |
1530 | { |
1531 | - get_page(buf->page); |
1532 | + return try_get_page(buf->page); |
1533 | } |
1534 | EXPORT_SYMBOL(generic_pipe_buf_get); |
1535 | |
1536 | diff --git a/fs/splice.c b/fs/splice.c |
1537 | index c78e0e3ff6c4..485e409ef841 100644 |
1538 | --- a/fs/splice.c |
1539 | +++ b/fs/splice.c |
1540 | @@ -1584,7 +1584,11 @@ retry: |
1541 | * Get a reference to this pipe buffer, |
1542 | * so we can copy the contents over. |
1543 | */ |
1544 | - pipe_buf_get(ipipe, ibuf); |
1545 | + if (!pipe_buf_get(ipipe, ibuf)) { |
1546 | + if (ret == 0) |
1547 | + ret = -EFAULT; |
1548 | + break; |
1549 | + } |
1550 | *obuf = *ibuf; |
1551 | |
1552 | /* |
1553 | @@ -1658,7 +1662,11 @@ static int link_pipe(struct pipe_inode_info *ipipe, |
1554 | * Get a reference to this pipe buffer, |
1555 | * so we can copy the contents over. |
1556 | */ |
1557 | - pipe_buf_get(ipipe, ibuf); |
1558 | + if (!pipe_buf_get(ipipe, ibuf)) { |
1559 | + if (ret == 0) |
1560 | + ret = -EFAULT; |
1561 | + break; |
1562 | + } |
1563 | |
1564 | obuf = opipe->bufs + nbuf; |
1565 | *obuf = *ibuf; |
1566 | diff --git a/include/linux/mm.h b/include/linux/mm.h |
1567 | index e899460f1bc5..bdec425c8e14 100644 |
1568 | --- a/include/linux/mm.h |
1569 | +++ b/include/linux/mm.h |
1570 | @@ -915,6 +915,10 @@ static inline bool is_device_public_page(const struct page *page) |
1571 | } |
1572 | #endif /* CONFIG_DEV_PAGEMAP_OPS */ |
1573 | |
1574 | +/* 127: arbitrary random number, small enough to assemble well */ |
1575 | +#define page_ref_zero_or_close_to_overflow(page) \ |
1576 | + ((unsigned int) page_ref_count(page) + 127u <= 127u) |
1577 | + |
1578 | static inline void get_page(struct page *page) |
1579 | { |
1580 | page = compound_head(page); |
1581 | @@ -922,8 +926,17 @@ static inline void get_page(struct page *page) |
1582 | * Getting a normal page or the head of a compound page |
1583 | * requires to already have an elevated page->_refcount. |
1584 | */ |
1585 | - VM_BUG_ON_PAGE(page_ref_count(page) <= 0, page); |
1586 | + VM_BUG_ON_PAGE(page_ref_zero_or_close_to_overflow(page), page); |
1587 | + page_ref_inc(page); |
1588 | +} |
1589 | + |
1590 | +static inline __must_check bool try_get_page(struct page *page) |
1591 | +{ |
1592 | + page = compound_head(page); |
1593 | + if (WARN_ON_ONCE(page_ref_count(page) <= 0)) |
1594 | + return false; |
1595 | page_ref_inc(page); |
1596 | + return true; |
1597 | } |
1598 | |
1599 | static inline void put_page(struct page *page) |
1600 | diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h |
1601 | index 66ee63cd5968..7897a3cc05b9 100644 |
1602 | --- a/include/linux/pipe_fs_i.h |
1603 | +++ b/include/linux/pipe_fs_i.h |
1604 | @@ -108,18 +108,20 @@ struct pipe_buf_operations { |
1605 | /* |
1606 | * Get a reference to the pipe buffer. |
1607 | */ |
1608 | - void (*get)(struct pipe_inode_info *, struct pipe_buffer *); |
1609 | + bool (*get)(struct pipe_inode_info *, struct pipe_buffer *); |
1610 | }; |
1611 | |
1612 | /** |
1613 | * pipe_buf_get - get a reference to a pipe_buffer |
1614 | * @pipe: the pipe that the buffer belongs to |
1615 | * @buf: the buffer to get a reference to |
1616 | + * |
1617 | + * Return: %true if the reference was successfully obtained. |
1618 | */ |
1619 | -static inline void pipe_buf_get(struct pipe_inode_info *pipe, |
1620 | +static inline __must_check bool pipe_buf_get(struct pipe_inode_info *pipe, |
1621 | struct pipe_buffer *buf) |
1622 | { |
1623 | - buf->ops->get(pipe, buf); |
1624 | + return buf->ops->get(pipe, buf); |
1625 | } |
1626 | |
1627 | /** |
1628 | @@ -178,7 +180,7 @@ struct pipe_inode_info *alloc_pipe_info(void); |
1629 | void free_pipe_info(struct pipe_inode_info *); |
1630 | |
1631 | /* Generic pipe buffer ops functions */ |
1632 | -void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); |
1633 | +bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); |
1634 | int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *); |
1635 | int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); |
1636 | int generic_pipe_buf_nosteal(struct pipe_inode_info *, struct pipe_buffer *); |
1637 | diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h |
1638 | index 1be35729c2c5..660d78c9af6c 100644 |
1639 | --- a/include/linux/sched/signal.h |
1640 | +++ b/include/linux/sched/signal.h |
1641 | @@ -417,10 +417,20 @@ static inline void set_restore_sigmask(void) |
1642 | set_thread_flag(TIF_RESTORE_SIGMASK); |
1643 | WARN_ON(!test_thread_flag(TIF_SIGPENDING)); |
1644 | } |
1645 | + |
1646 | +static inline void clear_tsk_restore_sigmask(struct task_struct *tsk) |
1647 | +{ |
1648 | + clear_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK); |
1649 | +} |
1650 | + |
1651 | static inline void clear_restore_sigmask(void) |
1652 | { |
1653 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
1654 | } |
1655 | +static inline bool test_tsk_restore_sigmask(struct task_struct *tsk) |
1656 | +{ |
1657 | + return test_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK); |
1658 | +} |
1659 | static inline bool test_restore_sigmask(void) |
1660 | { |
1661 | return test_thread_flag(TIF_RESTORE_SIGMASK); |
1662 | @@ -438,6 +448,10 @@ static inline void set_restore_sigmask(void) |
1663 | current->restore_sigmask = true; |
1664 | WARN_ON(!test_thread_flag(TIF_SIGPENDING)); |
1665 | } |
1666 | +static inline void clear_tsk_restore_sigmask(struct task_struct *tsk) |
1667 | +{ |
1668 | + tsk->restore_sigmask = false; |
1669 | +} |
1670 | static inline void clear_restore_sigmask(void) |
1671 | { |
1672 | current->restore_sigmask = false; |
1673 | @@ -446,6 +460,10 @@ static inline bool test_restore_sigmask(void) |
1674 | { |
1675 | return current->restore_sigmask; |
1676 | } |
1677 | +static inline bool test_tsk_restore_sigmask(struct task_struct *tsk) |
1678 | +{ |
1679 | + return tsk->restore_sigmask; |
1680 | +} |
1681 | static inline bool test_and_clear_restore_sigmask(void) |
1682 | { |
1683 | if (!current->restore_sigmask) |
1684 | diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h |
1685 | index ef8dd0db70ce..56935bf027a7 100644 |
1686 | --- a/include/net/tc_act/tc_gact.h |
1687 | +++ b/include/net/tc_act/tc_gact.h |
1688 | @@ -56,7 +56,7 @@ static inline bool is_tcf_gact_goto_chain(const struct tc_action *a) |
1689 | |
1690 | static inline u32 tcf_gact_goto_chain_index(const struct tc_action *a) |
1691 | { |
1692 | - return a->goto_chain->index; |
1693 | + return READ_ONCE(a->tcfa_action) & TC_ACT_EXT_VAL_MASK; |
1694 | } |
1695 | |
1696 | #endif /* __NET_TC_GACT_H */ |
1697 | diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h |
1698 | index 7161856bcf9c..c2c10cc9ffa0 100644 |
1699 | --- a/include/net/xdp_sock.h |
1700 | +++ b/include/net/xdp_sock.h |
1701 | @@ -34,7 +34,6 @@ struct xdp_umem { |
1702 | u32 headroom; |
1703 | u32 chunk_size_nohr; |
1704 | struct user_struct *user; |
1705 | - struct pid *pid; |
1706 | unsigned long address; |
1707 | refcount_t users; |
1708 | struct work_struct work; |
1709 | diff --git a/kernel/ptrace.c b/kernel/ptrace.c |
1710 | index 21fec73d45d4..fc0d667f5792 100644 |
1711 | --- a/kernel/ptrace.c |
1712 | +++ b/kernel/ptrace.c |
1713 | @@ -29,6 +29,7 @@ |
1714 | #include <linux/hw_breakpoint.h> |
1715 | #include <linux/cn_proc.h> |
1716 | #include <linux/compat.h> |
1717 | +#include <linux/sched/signal.h> |
1718 | |
1719 | /* |
1720 | * Access another process' address space via ptrace. |
1721 | @@ -925,18 +926,26 @@ int ptrace_request(struct task_struct *child, long request, |
1722 | ret = ptrace_setsiginfo(child, &siginfo); |
1723 | break; |
1724 | |
1725 | - case PTRACE_GETSIGMASK: |
1726 | + case PTRACE_GETSIGMASK: { |
1727 | + sigset_t *mask; |
1728 | + |
1729 | if (addr != sizeof(sigset_t)) { |
1730 | ret = -EINVAL; |
1731 | break; |
1732 | } |
1733 | |
1734 | - if (copy_to_user(datavp, &child->blocked, sizeof(sigset_t))) |
1735 | + if (test_tsk_restore_sigmask(child)) |
1736 | + mask = &child->saved_sigmask; |
1737 | + else |
1738 | + mask = &child->blocked; |
1739 | + |
1740 | + if (copy_to_user(datavp, mask, sizeof(sigset_t))) |
1741 | ret = -EFAULT; |
1742 | else |
1743 | ret = 0; |
1744 | |
1745 | break; |
1746 | + } |
1747 | |
1748 | case PTRACE_SETSIGMASK: { |
1749 | sigset_t new_set; |
1750 | @@ -962,6 +971,8 @@ int ptrace_request(struct task_struct *child, long request, |
1751 | child->blocked = new_set; |
1752 | spin_unlock_irq(&child->sighand->siglock); |
1753 | |
1754 | + clear_tsk_restore_sigmask(child); |
1755 | + |
1756 | ret = 0; |
1757 | break; |
1758 | } |
1759 | diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
1760 | index 5455ee05bc3b..1bd7a758583b 100644 |
1761 | --- a/kernel/trace/trace.c |
1762 | +++ b/kernel/trace/trace.c |
1763 | @@ -6823,12 +6823,16 @@ static void buffer_pipe_buf_release(struct pipe_inode_info *pipe, |
1764 | buf->private = 0; |
1765 | } |
1766 | |
1767 | -static void buffer_pipe_buf_get(struct pipe_inode_info *pipe, |
1768 | +static bool buffer_pipe_buf_get(struct pipe_inode_info *pipe, |
1769 | struct pipe_buffer *buf) |
1770 | { |
1771 | struct buffer_ref *ref = (struct buffer_ref *)buf->private; |
1772 | |
1773 | + if (refcount_read(&ref->refcount) > INT_MAX/2) |
1774 | + return false; |
1775 | + |
1776 | refcount_inc(&ref->refcount); |
1777 | + return true; |
1778 | } |
1779 | |
1780 | /* Pipe buffer operations for a buffer. */ |
1781 | diff --git a/mm/gup.c b/mm/gup.c |
1782 | index 0a5374e6e82d..caadd31714a5 100644 |
1783 | --- a/mm/gup.c |
1784 | +++ b/mm/gup.c |
1785 | @@ -153,7 +153,10 @@ retry: |
1786 | } |
1787 | |
1788 | if (flags & FOLL_GET) { |
1789 | - get_page(page); |
1790 | + if (unlikely(!try_get_page(page))) { |
1791 | + page = ERR_PTR(-ENOMEM); |
1792 | + goto out; |
1793 | + } |
1794 | |
1795 | /* drop the pgmap reference now that we hold the page */ |
1796 | if (pgmap) { |
1797 | @@ -296,7 +299,10 @@ retry_locked: |
1798 | if (pmd_trans_unstable(pmd)) |
1799 | ret = -EBUSY; |
1800 | } else { |
1801 | - get_page(page); |
1802 | + if (unlikely(!try_get_page(page))) { |
1803 | + spin_unlock(ptl); |
1804 | + return ERR_PTR(-ENOMEM); |
1805 | + } |
1806 | spin_unlock(ptl); |
1807 | lock_page(page); |
1808 | ret = split_huge_page(page); |
1809 | @@ -480,7 +486,10 @@ static int get_gate_page(struct mm_struct *mm, unsigned long address, |
1810 | if (is_device_public_page(*page)) |
1811 | goto unmap; |
1812 | } |
1813 | - get_page(*page); |
1814 | + if (unlikely(!try_get_page(*page))) { |
1815 | + ret = -ENOMEM; |
1816 | + goto unmap; |
1817 | + } |
1818 | out: |
1819 | ret = 0; |
1820 | unmap: |
1821 | @@ -1368,6 +1377,20 @@ static void undo_dev_pagemap(int *nr, int nr_start, struct page **pages) |
1822 | } |
1823 | } |
1824 | |
1825 | +/* |
1826 | + * Return the compund head page with ref appropriately incremented, |
1827 | + * or NULL if that failed. |
1828 | + */ |
1829 | +static inline struct page *try_get_compound_head(struct page *page, int refs) |
1830 | +{ |
1831 | + struct page *head = compound_head(page); |
1832 | + if (WARN_ON_ONCE(page_ref_count(head) < 0)) |
1833 | + return NULL; |
1834 | + if (unlikely(!page_cache_add_speculative(head, refs))) |
1835 | + return NULL; |
1836 | + return head; |
1837 | +} |
1838 | + |
1839 | #ifdef CONFIG_ARCH_HAS_PTE_SPECIAL |
1840 | static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end, |
1841 | int write, struct page **pages, int *nr) |
1842 | @@ -1402,9 +1425,9 @@ static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end, |
1843 | |
1844 | VM_BUG_ON(!pfn_valid(pte_pfn(pte))); |
1845 | page = pte_page(pte); |
1846 | - head = compound_head(page); |
1847 | |
1848 | - if (!page_cache_get_speculative(head)) |
1849 | + head = try_get_compound_head(page, 1); |
1850 | + if (!head) |
1851 | goto pte_unmap; |
1852 | |
1853 | if (unlikely(pte_val(pte) != pte_val(*ptep))) { |
1854 | @@ -1543,8 +1566,8 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, |
1855 | refs++; |
1856 | } while (addr += PAGE_SIZE, addr != end); |
1857 | |
1858 | - head = compound_head(pmd_page(orig)); |
1859 | - if (!page_cache_add_speculative(head, refs)) { |
1860 | + head = try_get_compound_head(pmd_page(orig), refs); |
1861 | + if (!head) { |
1862 | *nr -= refs; |
1863 | return 0; |
1864 | } |
1865 | @@ -1581,8 +1604,8 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr, |
1866 | refs++; |
1867 | } while (addr += PAGE_SIZE, addr != end); |
1868 | |
1869 | - head = compound_head(pud_page(orig)); |
1870 | - if (!page_cache_add_speculative(head, refs)) { |
1871 | + head = try_get_compound_head(pud_page(orig), refs); |
1872 | + if (!head) { |
1873 | *nr -= refs; |
1874 | return 0; |
1875 | } |
1876 | @@ -1618,8 +1641,8 @@ static int gup_huge_pgd(pgd_t orig, pgd_t *pgdp, unsigned long addr, |
1877 | refs++; |
1878 | } while (addr += PAGE_SIZE, addr != end); |
1879 | |
1880 | - head = compound_head(pgd_page(orig)); |
1881 | - if (!page_cache_add_speculative(head, refs)) { |
1882 | + head = try_get_compound_head(pgd_page(orig), refs); |
1883 | + if (!head) { |
1884 | *nr -= refs; |
1885 | return 0; |
1886 | } |
1887 | diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
1888 | index 9e5f66cbf711..5fb779cda972 100644 |
1889 | --- a/mm/hugetlb.c |
1890 | +++ b/mm/hugetlb.c |
1891 | @@ -4299,6 +4299,19 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, |
1892 | |
1893 | pfn_offset = (vaddr & ~huge_page_mask(h)) >> PAGE_SHIFT; |
1894 | page = pte_page(huge_ptep_get(pte)); |
1895 | + |
1896 | + /* |
1897 | + * Instead of doing 'try_get_page()' below in the same_page |
1898 | + * loop, just check the count once here. |
1899 | + */ |
1900 | + if (unlikely(page_count(page) <= 0)) { |
1901 | + if (pages) { |
1902 | + spin_unlock(ptl); |
1903 | + remainder = 0; |
1904 | + err = -ENOMEM; |
1905 | + break; |
1906 | + } |
1907 | + } |
1908 | same_page: |
1909 | if (pages) { |
1910 | pages[i] = mem_map_offset(page, pfn_offset); |
1911 | diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c |
1912 | index 3b0a03b92080..212c184c1eee 100644 |
1913 | --- a/net/bridge/br_netfilter_hooks.c |
1914 | +++ b/net/bridge/br_netfilter_hooks.c |
1915 | @@ -515,6 +515,7 @@ static unsigned int br_nf_pre_routing(void *priv, |
1916 | nf_bridge->ipv4_daddr = ip_hdr(skb)->daddr; |
1917 | |
1918 | skb->protocol = htons(ETH_P_IP); |
1919 | + skb->transport_header = skb->network_header + ip_hdr(skb)->ihl * 4; |
1920 | |
1921 | NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, state->net, state->sk, skb, |
1922 | skb->dev, NULL, |
1923 | diff --git a/net/bridge/br_netfilter_ipv6.c b/net/bridge/br_netfilter_ipv6.c |
1924 | index 5811208863b7..09d5e0c7b3ba 100644 |
1925 | --- a/net/bridge/br_netfilter_ipv6.c |
1926 | +++ b/net/bridge/br_netfilter_ipv6.c |
1927 | @@ -235,6 +235,8 @@ unsigned int br_nf_pre_routing_ipv6(void *priv, |
1928 | nf_bridge->ipv6_daddr = ipv6_hdr(skb)->daddr; |
1929 | |
1930 | skb->protocol = htons(ETH_P_IPV6); |
1931 | + skb->transport_header = skb->network_header + sizeof(struct ipv6hdr); |
1932 | + |
1933 | NF_HOOK(NFPROTO_IPV6, NF_INET_PRE_ROUTING, state->net, state->sk, skb, |
1934 | skb->dev, NULL, |
1935 | br_nf_pre_routing_finish_ipv6); |
1936 | diff --git a/net/ipv6/netfilter/ip6t_srh.c b/net/ipv6/netfilter/ip6t_srh.c |
1937 | index 1059894a6f4c..4cb83fb69844 100644 |
1938 | --- a/net/ipv6/netfilter/ip6t_srh.c |
1939 | +++ b/net/ipv6/netfilter/ip6t_srh.c |
1940 | @@ -210,6 +210,8 @@ static bool srh1_mt6(const struct sk_buff *skb, struct xt_action_param *par) |
1941 | psidoff = srhoff + sizeof(struct ipv6_sr_hdr) + |
1942 | ((srh->segments_left + 1) * sizeof(struct in6_addr)); |
1943 | psid = skb_header_pointer(skb, psidoff, sizeof(_psid), &_psid); |
1944 | + if (!psid) |
1945 | + return false; |
1946 | if (NF_SRH_INVF(srhinfo, IP6T_SRH_INV_PSID, |
1947 | ipv6_masked_addr_cmp(psid, &srhinfo->psid_msk, |
1948 | &srhinfo->psid_addr))) |
1949 | @@ -223,6 +225,8 @@ static bool srh1_mt6(const struct sk_buff *skb, struct xt_action_param *par) |
1950 | nsidoff = srhoff + sizeof(struct ipv6_sr_hdr) + |
1951 | ((srh->segments_left - 1) * sizeof(struct in6_addr)); |
1952 | nsid = skb_header_pointer(skb, nsidoff, sizeof(_nsid), &_nsid); |
1953 | + if (!nsid) |
1954 | + return false; |
1955 | if (NF_SRH_INVF(srhinfo, IP6T_SRH_INV_NSID, |
1956 | ipv6_masked_addr_cmp(nsid, &srhinfo->nsid_msk, |
1957 | &srhinfo->nsid_addr))) |
1958 | @@ -233,6 +237,8 @@ static bool srh1_mt6(const struct sk_buff *skb, struct xt_action_param *par) |
1959 | if (srhinfo->mt_flags & IP6T_SRH_LSID) { |
1960 | lsidoff = srhoff + sizeof(struct ipv6_sr_hdr); |
1961 | lsid = skb_header_pointer(skb, lsidoff, sizeof(_lsid), &_lsid); |
1962 | + if (!lsid) |
1963 | + return false; |
1964 | if (NF_SRH_INVF(srhinfo, IP6T_SRH_INV_LSID, |
1965 | ipv6_masked_addr_cmp(lsid, &srhinfo->lsid_msk, |
1966 | &srhinfo->lsid_addr))) |
1967 | diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig |
1968 | index f61c306de1d0..e0fb56d67d42 100644 |
1969 | --- a/net/netfilter/Kconfig |
1970 | +++ b/net/netfilter/Kconfig |
1971 | @@ -1003,6 +1003,7 @@ config NETFILTER_XT_TARGET_TEE |
1972 | depends on NETFILTER_ADVANCED |
1973 | depends on IPV6 || IPV6=n |
1974 | depends on !NF_CONNTRACK || NF_CONNTRACK |
1975 | + depends on IP6_NF_IPTABLES || !IP6_NF_IPTABLES |
1976 | select NF_DUP_IPV4 |
1977 | select NF_DUP_IPV6 if IP6_NF_IPTABLES |
1978 | ---help--- |
1979 | diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c |
1980 | index 0e5ec126f6ad..b3e75f9cb686 100644 |
1981 | --- a/net/netfilter/nft_set_rbtree.c |
1982 | +++ b/net/netfilter/nft_set_rbtree.c |
1983 | @@ -302,10 +302,6 @@ static void *nft_rbtree_deactivate(const struct net *net, |
1984 | else if (d > 0) |
1985 | parent = parent->rb_right; |
1986 | else { |
1987 | - if (!nft_set_elem_active(&rbe->ext, genmask)) { |
1988 | - parent = parent->rb_left; |
1989 | - continue; |
1990 | - } |
1991 | if (nft_rbtree_interval_end(rbe) && |
1992 | !nft_rbtree_interval_end(this)) { |
1993 | parent = parent->rb_left; |
1994 | @@ -314,6 +310,9 @@ static void *nft_rbtree_deactivate(const struct net *net, |
1995 | nft_rbtree_interval_end(this)) { |
1996 | parent = parent->rb_right; |
1997 | continue; |
1998 | + } else if (!nft_set_elem_active(&rbe->ext, genmask)) { |
1999 | + parent = parent->rb_left; |
2000 | + continue; |
2001 | } |
2002 | nft_rbtree_flush(net, set, rbe); |
2003 | return rbe; |
2004 | diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c |
2005 | index bfe2dbea480b..a3b037fbfecd 100644 |
2006 | --- a/net/xdp/xdp_umem.c |
2007 | +++ b/net/xdp/xdp_umem.c |
2008 | @@ -152,9 +152,6 @@ static void xdp_umem_unaccount_pages(struct xdp_umem *umem) |
2009 | |
2010 | static void xdp_umem_release(struct xdp_umem *umem) |
2011 | { |
2012 | - struct task_struct *task; |
2013 | - struct mm_struct *mm; |
2014 | - |
2015 | xdp_umem_clear_dev(umem); |
2016 | |
2017 | if (umem->fq) { |
2018 | @@ -169,21 +166,10 @@ static void xdp_umem_release(struct xdp_umem *umem) |
2019 | |
2020 | xdp_umem_unpin_pages(umem); |
2021 | |
2022 | - task = get_pid_task(umem->pid, PIDTYPE_PID); |
2023 | - put_pid(umem->pid); |
2024 | - if (!task) |
2025 | - goto out; |
2026 | - mm = get_task_mm(task); |
2027 | - put_task_struct(task); |
2028 | - if (!mm) |
2029 | - goto out; |
2030 | - |
2031 | - mmput(mm); |
2032 | kfree(umem->pages); |
2033 | umem->pages = NULL; |
2034 | |
2035 | xdp_umem_unaccount_pages(umem); |
2036 | -out: |
2037 | kfree(umem); |
2038 | } |
2039 | |
2040 | @@ -312,7 +298,6 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) |
2041 | if (size_chk < 0) |
2042 | return -EINVAL; |
2043 | |
2044 | - umem->pid = get_task_pid(current, PIDTYPE_PID); |
2045 | umem->address = (unsigned long)addr; |
2046 | umem->props.chunk_mask = ~((u64)chunk_size - 1); |
2047 | umem->props.size = size; |
2048 | @@ -328,7 +313,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) |
2049 | |
2050 | err = xdp_umem_account_pages(umem); |
2051 | if (err) |
2052 | - goto out; |
2053 | + return err; |
2054 | |
2055 | err = xdp_umem_pin_pages(umem); |
2056 | if (err) |
2057 | @@ -347,8 +332,6 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) |
2058 | |
2059 | out_account: |
2060 | xdp_umem_unaccount_pages(umem); |
2061 | -out: |
2062 | - put_pid(umem->pid); |
2063 | return err; |
2064 | } |
2065 | |
2066 | diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c |
2067 | index fe82ff6d744e..b15c8d1744f5 100644 |
2068 | --- a/scripts/kconfig/lxdialog/inputbox.c |
2069 | +++ b/scripts/kconfig/lxdialog/inputbox.c |
2070 | @@ -126,7 +126,8 @@ do_resize: |
2071 | case KEY_DOWN: |
2072 | break; |
2073 | case KEY_BACKSPACE: |
2074 | - case 127: |
2075 | + case 8: /* ^H */ |
2076 | + case 127: /* ^? */ |
2077 | if (pos) { |
2078 | wattrset(dialog, dlg.inputbox.atr); |
2079 | if (input_x == 0) { |
2080 | diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c |
2081 | index 1ef232ae5ab9..c8ff1c99dd5c 100644 |
2082 | --- a/scripts/kconfig/nconf.c |
2083 | +++ b/scripts/kconfig/nconf.c |
2084 | @@ -1049,7 +1049,7 @@ static int do_match(int key, struct match_state *state, int *ans) |
2085 | state->match_direction = FIND_NEXT_MATCH_UP; |
2086 | *ans = get_mext_match(state->pattern, |
2087 | state->match_direction); |
2088 | - } else if (key == KEY_BACKSPACE || key == 127) { |
2089 | + } else if (key == KEY_BACKSPACE || key == 8 || key == 127) { |
2090 | state->pattern[strlen(state->pattern)-1] = '\0'; |
2091 | adj_match_dir(&state->match_direction); |
2092 | } else |
2093 | diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c |
2094 | index 88874acfda36..820fc9256532 100644 |
2095 | --- a/scripts/kconfig/nconf.gui.c |
2096 | +++ b/scripts/kconfig/nconf.gui.c |
2097 | @@ -440,7 +440,8 @@ int dialog_inputbox(WINDOW *main_window, |
2098 | case KEY_F(F_EXIT): |
2099 | case KEY_F(F_BACK): |
2100 | break; |
2101 | - case 127: |
2102 | + case 8: /* ^H */ |
2103 | + case 127: /* ^? */ |
2104 | case KEY_BACKSPACE: |
2105 | if (cursor_position > 0) { |
2106 | memmove(&result[cursor_position-1], |
2107 | diff --git a/scripts/selinux/genheaders/genheaders.c b/scripts/selinux/genheaders/genheaders.c |
2108 | index fa48fabcb330..3cc4893d98cc 100644 |
2109 | --- a/scripts/selinux/genheaders/genheaders.c |
2110 | +++ b/scripts/selinux/genheaders/genheaders.c |
2111 | @@ -9,7 +9,6 @@ |
2112 | #include <string.h> |
2113 | #include <errno.h> |
2114 | #include <ctype.h> |
2115 | -#include <sys/socket.h> |
2116 | |
2117 | struct security_class_mapping { |
2118 | const char *name; |
2119 | diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c |
2120 | index 073fe7537f6c..6d51b74bc679 100644 |
2121 | --- a/scripts/selinux/mdp/mdp.c |
2122 | +++ b/scripts/selinux/mdp/mdp.c |
2123 | @@ -32,7 +32,6 @@ |
2124 | #include <stdlib.h> |
2125 | #include <unistd.h> |
2126 | #include <string.h> |
2127 | -#include <sys/socket.h> |
2128 | |
2129 | static void usage(char *name) |
2130 | { |
2131 | diff --git a/security/selinux/include/classmap.h b/security/selinux/include/classmap.h |
2132 | index bd5fe0d3204a..201f7e588a29 100644 |
2133 | --- a/security/selinux/include/classmap.h |
2134 | +++ b/security/selinux/include/classmap.h |
2135 | @@ -1,5 +1,6 @@ |
2136 | /* SPDX-License-Identifier: GPL-2.0 */ |
2137 | #include <linux/capability.h> |
2138 | +#include <linux/socket.h> |
2139 | |
2140 | #define COMMON_FILE_SOCK_PERMS "ioctl", "read", "write", "create", \ |
2141 | "getattr", "setattr", "lock", "relabelfrom", "relabelto", "append", "map" |
2142 | diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c |
2143 | index b1508ce3e412..076718a7b3ea 100644 |
2144 | --- a/tools/perf/util/machine.c |
2145 | +++ b/tools/perf/util/machine.c |
2146 | @@ -1358,6 +1358,20 @@ static void machine__set_kernel_mmap(struct machine *machine, |
2147 | machine->vmlinux_map->end = ~0ULL; |
2148 | } |
2149 | |
2150 | +static void machine__update_kernel_mmap(struct machine *machine, |
2151 | + u64 start, u64 end) |
2152 | +{ |
2153 | + struct map *map = machine__kernel_map(machine); |
2154 | + |
2155 | + map__get(map); |
2156 | + map_groups__remove(&machine->kmaps, map); |
2157 | + |
2158 | + machine__set_kernel_mmap(machine, start, end); |
2159 | + |
2160 | + map_groups__insert(&machine->kmaps, map); |
2161 | + map__put(map); |
2162 | +} |
2163 | + |
2164 | int machine__create_kernel_maps(struct machine *machine) |
2165 | { |
2166 | struct dso *kernel = machine__get_kernel(machine); |
2167 | @@ -1390,17 +1404,11 @@ int machine__create_kernel_maps(struct machine *machine) |
2168 | goto out_put; |
2169 | } |
2170 | |
2171 | - /* we have a real start address now, so re-order the kmaps */ |
2172 | - map = machine__kernel_map(machine); |
2173 | - |
2174 | - map__get(map); |
2175 | - map_groups__remove(&machine->kmaps, map); |
2176 | - |
2177 | - /* assume it's the last in the kmaps */ |
2178 | - machine__set_kernel_mmap(machine, addr, ~0ULL); |
2179 | - |
2180 | - map_groups__insert(&machine->kmaps, map); |
2181 | - map__put(map); |
2182 | + /* |
2183 | + * we have a real start address now, so re-order the kmaps |
2184 | + * assume it's the last in the kmaps |
2185 | + */ |
2186 | + machine__update_kernel_mmap(machine, addr, ~0ULL); |
2187 | } |
2188 | |
2189 | if (machine__create_extra_kernel_maps(machine, kernel)) |
2190 | @@ -1536,7 +1544,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine, |
2191 | if (strstr(kernel->long_name, "vmlinux")) |
2192 | dso__set_short_name(kernel, "[kernel.vmlinux]", false); |
2193 | |
2194 | - machine__set_kernel_mmap(machine, event->mmap.start, |
2195 | + machine__update_kernel_mmap(machine, event->mmap.start, |
2196 | event->mmap.start + event->mmap.len); |
2197 | |
2198 | /* |
2199 | diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c |
2200 | index f376c82afb61..621bb004067e 100644 |
2201 | --- a/virt/kvm/arm/vgic/vgic-its.c |
2202 | +++ b/virt/kvm/arm/vgic/vgic-its.c |
2203 | @@ -760,8 +760,9 @@ static bool vgic_its_check_id(struct vgic_its *its, u64 baser, u32 id, |
2204 | int l1_tbl_size = GITS_BASER_NR_PAGES(baser) * SZ_64K; |
2205 | u64 indirect_ptr, type = GITS_BASER_TYPE(baser); |
2206 | int esz = GITS_BASER_ENTRY_SIZE(baser); |
2207 | - int index; |
2208 | + int index, idx; |
2209 | gfn_t gfn; |
2210 | + bool ret; |
2211 | |
2212 | switch (type) { |
2213 | case GITS_BASER_TYPE_DEVICE: |
2214 | @@ -788,7 +789,8 @@ static bool vgic_its_check_id(struct vgic_its *its, u64 baser, u32 id, |
2215 | |
2216 | if (eaddr) |
2217 | *eaddr = addr; |
2218 | - return kvm_is_visible_gfn(its->dev->kvm, gfn); |
2219 | + |
2220 | + goto out; |
2221 | } |
2222 | |
2223 | /* calculate and check the index into the 1st level */ |
2224 | @@ -822,7 +824,12 @@ static bool vgic_its_check_id(struct vgic_its *its, u64 baser, u32 id, |
2225 | |
2226 | if (eaddr) |
2227 | *eaddr = indirect_ptr; |
2228 | - return kvm_is_visible_gfn(its->dev->kvm, gfn); |
2229 | + |
2230 | +out: |
2231 | + idx = srcu_read_lock(&its->dev->kvm->srcu); |
2232 | + ret = kvm_is_visible_gfn(its->dev->kvm, gfn); |
2233 | + srcu_read_unlock(&its->dev->kvm->srcu, idx); |
2234 | + return ret; |
2235 | } |
2236 | |
2237 | static int vgic_its_alloc_collection(struct vgic_its *its, |
2238 | @@ -1935,7 +1942,7 @@ static int vgic_its_save_ite(struct vgic_its *its, struct its_device *dev, |
2239 | ((u64)ite->irq->intid << KVM_ITS_ITE_PINTID_SHIFT) | |
2240 | ite->collection->collection_id; |
2241 | val = cpu_to_le64(val); |
2242 | - return kvm_write_guest(kvm, gpa, &val, ite_esz); |
2243 | + return kvm_write_guest_lock(kvm, gpa, &val, ite_esz); |
2244 | } |
2245 | |
2246 | /** |
2247 | @@ -2082,7 +2089,7 @@ static int vgic_its_save_dte(struct vgic_its *its, struct its_device *dev, |
2248 | (itt_addr_field << KVM_ITS_DTE_ITTADDR_SHIFT) | |
2249 | (dev->num_eventid_bits - 1)); |
2250 | val = cpu_to_le64(val); |
2251 | - return kvm_write_guest(kvm, ptr, &val, dte_esz); |
2252 | + return kvm_write_guest_lock(kvm, ptr, &val, dte_esz); |
2253 | } |
2254 | |
2255 | /** |
2256 | @@ -2262,7 +2269,7 @@ static int vgic_its_save_cte(struct vgic_its *its, |
2257 | ((u64)collection->target_addr << KVM_ITS_CTE_RDBASE_SHIFT) | |
2258 | collection->collection_id); |
2259 | val = cpu_to_le64(val); |
2260 | - return kvm_write_guest(its->dev->kvm, gpa, &val, esz); |
2261 | + return kvm_write_guest_lock(its->dev->kvm, gpa, &val, esz); |
2262 | } |
2263 | |
2264 | static int vgic_its_restore_cte(struct vgic_its *its, gpa_t gpa, int esz) |
2265 | @@ -2333,7 +2340,7 @@ static int vgic_its_save_collection_table(struct vgic_its *its) |
2266 | */ |
2267 | val = 0; |
2268 | BUG_ON(cte_esz > sizeof(val)); |
2269 | - ret = kvm_write_guest(its->dev->kvm, gpa, &val, cte_esz); |
2270 | + ret = kvm_write_guest_lock(its->dev->kvm, gpa, &val, cte_esz); |
2271 | return ret; |
2272 | } |
2273 | |
2274 | diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c |
2275 | index 9c0dd234ebe8..3f2350a4d4ab 100644 |
2276 | --- a/virt/kvm/arm/vgic/vgic-v3.c |
2277 | +++ b/virt/kvm/arm/vgic/vgic-v3.c |
2278 | @@ -358,7 +358,7 @@ retry: |
2279 | if (status) { |
2280 | /* clear consumed data */ |
2281 | val &= ~(1 << bit_nr); |
2282 | - ret = kvm_write_guest(kvm, ptr, &val, 1); |
2283 | + ret = kvm_write_guest_lock(kvm, ptr, &val, 1); |
2284 | if (ret) |
2285 | return ret; |
2286 | } |
2287 | @@ -409,7 +409,7 @@ int vgic_v3_save_pending_tables(struct kvm *kvm) |
2288 | else |
2289 | val &= ~(1 << bit_nr); |
2290 | |
2291 | - ret = kvm_write_guest(kvm, ptr, &val, 1); |
2292 | + ret = kvm_write_guest_lock(kvm, ptr, &val, 1); |
2293 | if (ret) |
2294 | return ret; |
2295 | } |