Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Sat, 30 Jan 2021 12:58:58
Message-Id: 1612011499.3861fd2903ba962c24c49165e92ba1c3f05a92b1.alicef@gentoo
1 commit: 3861fd2903ba962c24c49165e92ba1c3f05a92b1
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jan 30 12:56:49 2021 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Sat Jan 30 12:58:19 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=3861fd29
7
8 Linux patch 4.14.218
9
10 Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org>
11
12 0000_README | 4 +
13 1217_linux-4.14.218.patch | 1636 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1640 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 1169529..3da0f64 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -911,6 +911,10 @@ Patch: 1216_linux-4.14.217.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.14.217
23
24 +Patch: 1217_linux-4.14.218.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.14.218
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/1217_linux-4.14.218.patch b/1217_linux-4.14.218.patch
33 new file mode 100644
34 index 0000000..83cd2a5
35 --- /dev/null
36 +++ b/1217_linux-4.14.218.patch
37 @@ -0,0 +1,1636 @@
38 +diff --git a/Makefile b/Makefile
39 +index 2dabcc4f0d16d..494420ad33a1d 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 = 217
47 ++SUBLEVEL = 218
48 + EXTRAVERSION =
49 + NAME = Petit Gorille
50 +
51 +diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
52 +index ba7f4c8f5c3e4..e8e637c4f354d 100644
53 +--- a/arch/arm/xen/enlighten.c
54 ++++ b/arch/arm/xen/enlighten.c
55 +@@ -393,7 +393,7 @@ static int __init xen_guest_init(void)
56 + }
57 + gnttab_init();
58 + if (!xen_initial_domain())
59 +- xenbus_probe(NULL);
60 ++ xenbus_probe();
61 +
62 + /*
63 + * Making sure board specific code will not set up ops for
64 +diff --git a/arch/sh/drivers/dma/Kconfig b/arch/sh/drivers/dma/Kconfig
65 +index d0de378beefe5..7d54f284ce10f 100644
66 +--- a/arch/sh/drivers/dma/Kconfig
67 ++++ b/arch/sh/drivers/dma/Kconfig
68 +@@ -63,8 +63,7 @@ config PVR2_DMA
69 +
70 + config G2_DMA
71 + tristate "G2 Bus DMA support"
72 +- depends on SH_DREAMCAST
73 +- select SH_DMA_API
74 ++ depends on SH_DREAMCAST && SH_DMA_API
75 + help
76 + This enables support for the DMA controller for the Dreamcast's
77 + G2 bus. Drivers that want this will generally enable this on
78 +diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
79 +index 3a250ca2406c0..644f9e14cb095 100644
80 +--- a/arch/x86/boot/compressed/Makefile
81 ++++ b/arch/x86/boot/compressed/Makefile
82 +@@ -36,6 +36,8 @@ KBUILD_CFLAGS += -mno-mmx -mno-sse
83 + KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
84 + KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
85 + KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
86 ++# Disable relocation relaxation in case the link is not PIE.
87 ++KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no)
88 +
89 + KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
90 + GCOV_PROFILE := n
91 +diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
92 +index e79db7ba2f10d..bd58f0743cfc4 100644
93 +--- a/drivers/acpi/scan.c
94 ++++ b/drivers/acpi/scan.c
95 +@@ -585,6 +585,8 @@ static int acpi_get_device_data(acpi_handle handle, struct acpi_device **device,
96 + if (!device)
97 + return -EINVAL;
98 +
99 ++ *device = NULL;
100 ++
101 + status = acpi_get_data_full(handle, acpi_scan_drop_device,
102 + (void **)device, callback);
103 + if (ACPI_FAILURE(status) || !*device) {
104 +diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
105 +index fc762b4adcb22..b14d481ab7dbb 100644
106 +--- a/drivers/gpio/gpio-mvebu.c
107 ++++ b/drivers/gpio/gpio-mvebu.c
108 +@@ -654,9 +654,8 @@ static void mvebu_pwm_get_state(struct pwm_chip *chip,
109 +
110 + spin_lock_irqsave(&mvpwm->lock, flags);
111 +
112 +- val = (unsigned long long)
113 +- readl_relaxed(mvebu_pwmreg_blink_on_duration(mvpwm));
114 +- val *= NSEC_PER_SEC;
115 ++ u = readl_relaxed(mvebu_pwmreg_blink_on_duration(mvpwm));
116 ++ val = (unsigned long long) u * NSEC_PER_SEC;
117 + do_div(val, mvpwm->clk_rate);
118 + if (val > UINT_MAX)
119 + state->duty_cycle = UINT_MAX;
120 +@@ -665,21 +664,17 @@ static void mvebu_pwm_get_state(struct pwm_chip *chip,
121 + else
122 + state->duty_cycle = 1;
123 +
124 +- val = (unsigned long long)
125 +- readl_relaxed(mvebu_pwmreg_blink_off_duration(mvpwm));
126 ++ val = (unsigned long long) u; /* on duration */
127 ++ /* period = on + off duration */
128 ++ val += readl_relaxed(mvebu_pwmreg_blink_off_duration(mvpwm));
129 + val *= NSEC_PER_SEC;
130 + do_div(val, mvpwm->clk_rate);
131 +- if (val < state->duty_cycle) {
132 ++ if (val > UINT_MAX)
133 ++ state->period = UINT_MAX;
134 ++ else if (val)
135 ++ state->period = val;
136 ++ else
137 + state->period = 1;
138 +- } else {
139 +- val -= state->duty_cycle;
140 +- if (val > UINT_MAX)
141 +- state->period = UINT_MAX;
142 +- else if (val)
143 +- state->period = val;
144 +- else
145 +- state->period = 1;
146 +- }
147 +
148 + regmap_read(mvchip->regs, GPIO_BLINK_EN_OFF + mvchip->offset, &u);
149 + if (u)
150 +diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
151 +index 331478bd2ff86..ec7c8cc0e4b62 100644
152 +--- a/drivers/gpu/drm/drm_atomic_helper.c
153 ++++ b/drivers/gpu/drm/drm_atomic_helper.c
154 +@@ -2608,7 +2608,7 @@ int drm_atomic_helper_set_config(struct drm_mode_set *set,
155 +
156 + ret = handle_conflicting_encoders(state, true);
157 + if (ret)
158 +- return ret;
159 ++ goto fail;
160 +
161 + ret = drm_atomic_commit(state);
162 +
163 +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
164 +index 7deb81b6dbac6..4b571cc6bc70f 100644
165 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
166 ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
167 +@@ -75,7 +75,7 @@ shadow_image(struct nvkm_bios *bios, int idx, u32 offset, struct shadow *mthd)
168 + nvkm_debug(subdev, "%08x: type %02x, %d bytes\n",
169 + image.base, image.type, image.size);
170 +
171 +- if (!shadow_fetch(bios, mthd, image.size)) {
172 ++ if (!shadow_fetch(bios, mthd, image.base + image.size)) {
173 + nvkm_debug(subdev, "%08x: fetch failed\n", image.base);
174 + return 0;
175 + }
176 +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
177 +index edb6148cbca04..d0e80ad526845 100644
178 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
179 ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
180 +@@ -33,7 +33,7 @@ static void
181 + gm200_i2c_aux_fini(struct gm200_i2c_aux *aux)
182 + {
183 + struct nvkm_device *device = aux->base.pad->i2c->subdev.device;
184 +- nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00310000, 0x00000000);
185 ++ nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00710000, 0x00000000);
186 + }
187 +
188 + static int
189 +@@ -54,10 +54,10 @@ gm200_i2c_aux_init(struct gm200_i2c_aux *aux)
190 + AUX_ERR(&aux->base, "begin idle timeout %08x", ctrl);
191 + return -EBUSY;
192 + }
193 +- } while (ctrl & 0x03010000);
194 ++ } while (ctrl & 0x07010000);
195 +
196 + /* set some magic, and wait up to 1ms for it to appear */
197 +- nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00300000, ureq);
198 ++ nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00700000, ureq);
199 + timeout = 1000;
200 + do {
201 + ctrl = nvkm_rd32(device, 0x00d954 + (aux->ch * 0x50));
202 +@@ -67,7 +67,7 @@ gm200_i2c_aux_init(struct gm200_i2c_aux *aux)
203 + gm200_i2c_aux_fini(aux);
204 + return -EBUSY;
205 + }
206 +- } while ((ctrl & 0x03000000) != urep);
207 ++ } while ((ctrl & 0x07000000) != urep);
208 +
209 + return 0;
210 + }
211 +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c
212 +index d80dbc8f09b20..55a4ea4393c62 100644
213 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c
214 ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c
215 +@@ -22,6 +22,7 @@
216 + * Authors: Ben Skeggs
217 + */
218 + #include "priv.h"
219 ++#include <subdev/timer.h>
220 +
221 + static void
222 + gf100_ibus_intr_hub(struct nvkm_subdev *ibus, int i)
223 +@@ -31,7 +32,6 @@ gf100_ibus_intr_hub(struct nvkm_subdev *ibus, int i)
224 + u32 data = nvkm_rd32(device, 0x122124 + (i * 0x0400));
225 + u32 stat = nvkm_rd32(device, 0x122128 + (i * 0x0400));
226 + nvkm_debug(ibus, "HUB%d: %06x %08x (%08x)\n", i, addr, data, stat);
227 +- nvkm_mask(device, 0x122128 + (i * 0x0400), 0x00000200, 0x00000000);
228 + }
229 +
230 + static void
231 +@@ -42,7 +42,6 @@ gf100_ibus_intr_rop(struct nvkm_subdev *ibus, int i)
232 + u32 data = nvkm_rd32(device, 0x124124 + (i * 0x0400));
233 + u32 stat = nvkm_rd32(device, 0x124128 + (i * 0x0400));
234 + nvkm_debug(ibus, "ROP%d: %06x %08x (%08x)\n", i, addr, data, stat);
235 +- nvkm_mask(device, 0x124128 + (i * 0x0400), 0x00000200, 0x00000000);
236 + }
237 +
238 + static void
239 +@@ -53,7 +52,6 @@ gf100_ibus_intr_gpc(struct nvkm_subdev *ibus, int i)
240 + u32 data = nvkm_rd32(device, 0x128124 + (i * 0x0400));
241 + u32 stat = nvkm_rd32(device, 0x128128 + (i * 0x0400));
242 + nvkm_debug(ibus, "GPC%d: %06x %08x (%08x)\n", i, addr, data, stat);
243 +- nvkm_mask(device, 0x128128 + (i * 0x0400), 0x00000200, 0x00000000);
244 + }
245 +
246 + void
247 +@@ -90,6 +88,12 @@ gf100_ibus_intr(struct nvkm_subdev *ibus)
248 + intr1 &= ~stat;
249 + }
250 + }
251 ++
252 ++ nvkm_mask(device, 0x121c4c, 0x0000003f, 0x00000002);
253 ++ nvkm_msec(device, 2000,
254 ++ if (!(nvkm_rd32(device, 0x121c4c) & 0x0000003f))
255 ++ break;
256 ++ );
257 + }
258 +
259 + static int
260 +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c
261 +index 9025ed1bd2a99..4caf3ef087e1d 100644
262 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c
263 ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c
264 +@@ -22,6 +22,7 @@
265 + * Authors: Ben Skeggs
266 + */
267 + #include "priv.h"
268 ++#include <subdev/timer.h>
269 +
270 + static void
271 + gk104_ibus_intr_hub(struct nvkm_subdev *ibus, int i)
272 +@@ -31,7 +32,6 @@ gk104_ibus_intr_hub(struct nvkm_subdev *ibus, int i)
273 + u32 data = nvkm_rd32(device, 0x122124 + (i * 0x0800));
274 + u32 stat = nvkm_rd32(device, 0x122128 + (i * 0x0800));
275 + nvkm_debug(ibus, "HUB%d: %06x %08x (%08x)\n", i, addr, data, stat);
276 +- nvkm_mask(device, 0x122128 + (i * 0x0800), 0x00000200, 0x00000000);
277 + }
278 +
279 + static void
280 +@@ -42,7 +42,6 @@ gk104_ibus_intr_rop(struct nvkm_subdev *ibus, int i)
281 + u32 data = nvkm_rd32(device, 0x124124 + (i * 0x0800));
282 + u32 stat = nvkm_rd32(device, 0x124128 + (i * 0x0800));
283 + nvkm_debug(ibus, "ROP%d: %06x %08x (%08x)\n", i, addr, data, stat);
284 +- nvkm_mask(device, 0x124128 + (i * 0x0800), 0x00000200, 0x00000000);
285 + }
286 +
287 + static void
288 +@@ -53,7 +52,6 @@ gk104_ibus_intr_gpc(struct nvkm_subdev *ibus, int i)
289 + u32 data = nvkm_rd32(device, 0x128124 + (i * 0x0800));
290 + u32 stat = nvkm_rd32(device, 0x128128 + (i * 0x0800));
291 + nvkm_debug(ibus, "GPC%d: %06x %08x (%08x)\n", i, addr, data, stat);
292 +- nvkm_mask(device, 0x128128 + (i * 0x0800), 0x00000200, 0x00000000);
293 + }
294 +
295 + void
296 +@@ -90,6 +88,12 @@ gk104_ibus_intr(struct nvkm_subdev *ibus)
297 + intr1 &= ~stat;
298 + }
299 + }
300 ++
301 ++ nvkm_mask(device, 0x12004c, 0x0000003f, 0x00000002);
302 ++ nvkm_msec(device, 2000,
303 ++ if (!(nvkm_rd32(device, 0x12004c) & 0x0000003f))
304 ++ break;
305 ++ );
306 + }
307 +
308 + static int
309 +diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c
310 +index 99ef61de9b1e7..6a66825370249 100644
311 +--- a/drivers/hwtracing/intel_th/pci.c
312 ++++ b/drivers/hwtracing/intel_th/pci.c
313 +@@ -238,6 +238,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
314 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4b26),
315 + .driver_data = (kernel_ulong_t)&intel_th_2x,
316 + },
317 ++ {
318 ++ /* Alder Lake-P */
319 ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x51a6),
320 ++ .driver_data = (kernel_ulong_t)&intel_th_2x,
321 ++ },
322 + {
323 + /* Emmitsburg PCH */
324 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x1bcc),
325 +diff --git a/drivers/hwtracing/stm/heartbeat.c b/drivers/hwtracing/stm/heartbeat.c
326 +index 3da7b673aab25..3957ce678265d 100644
327 +--- a/drivers/hwtracing/stm/heartbeat.c
328 ++++ b/drivers/hwtracing/stm/heartbeat.c
329 +@@ -72,7 +72,7 @@ static void stm_heartbeat_unlink(struct stm_source_data *data)
330 +
331 + static int stm_heartbeat_init(void)
332 + {
333 +- int i, ret = -ENOMEM;
334 ++ int i, ret;
335 +
336 + if (nr_devs < 0 || nr_devs > STM_HEARTBEAT_MAX)
337 + return -EINVAL;
338 +@@ -80,8 +80,10 @@ static int stm_heartbeat_init(void)
339 + for (i = 0; i < nr_devs; i++) {
340 + stm_heartbeat[i].data.name =
341 + kasprintf(GFP_KERNEL, "heartbeat.%d", i);
342 +- if (!stm_heartbeat[i].data.name)
343 ++ if (!stm_heartbeat[i].data.name) {
344 ++ ret = -ENOMEM;
345 + goto fail_unregister;
346 ++ }
347 +
348 + stm_heartbeat[i].data.nr_chans = 1;
349 + stm_heartbeat[i].data.link = stm_heartbeat_link;
350 +diff --git a/drivers/i2c/busses/i2c-octeon-core.c b/drivers/i2c/busses/i2c-octeon-core.c
351 +index 1d87757990568..cd512a93f3ba9 100644
352 +--- a/drivers/i2c/busses/i2c-octeon-core.c
353 ++++ b/drivers/i2c/busses/i2c-octeon-core.c
354 +@@ -346,7 +346,7 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target,
355 + if (result)
356 + return result;
357 + if (recv_len && i == 0) {
358 +- if (data[i] > I2C_SMBUS_BLOCK_MAX + 1)
359 ++ if (data[i] > I2C_SMBUS_BLOCK_MAX)
360 + return -EPROTO;
361 + length += data[i];
362 + }
363 +diff --git a/drivers/i2c/busses/i2c-tegra-bpmp.c b/drivers/i2c/busses/i2c-tegra-bpmp.c
364 +index f6cd35d0a2ac0..240bd1e908927 100644
365 +--- a/drivers/i2c/busses/i2c-tegra-bpmp.c
366 ++++ b/drivers/i2c/busses/i2c-tegra-bpmp.c
367 +@@ -91,7 +91,7 @@ static int tegra_bpmp_xlate_flags(u16 flags, u16 *out)
368 + flags &= ~I2C_M_RECV_LEN;
369 + }
370 +
371 +- return (flags != 0) ? -EINVAL : 0;
372 ++ return 0;
373 + }
374 +
375 + /**
376 +diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
377 +index 712d86b4be09b..7a2cda108a97e 100644
378 +--- a/drivers/iio/dac/ad5504.c
379 ++++ b/drivers/iio/dac/ad5504.c
380 +@@ -189,9 +189,9 @@ static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev,
381 + return ret;
382 +
383 + if (pwr_down)
384 +- st->pwr_down_mask |= (1 << chan->channel);
385 +- else
386 + st->pwr_down_mask &= ~(1 << chan->channel);
387 ++ else
388 ++ st->pwr_down_mask |= (1 << chan->channel);
389 +
390 + ret = ad5504_spi_write(st, AD5504_ADDR_CTRL,
391 + AD5504_DAC_PWRDWN_MODE(st->pwr_down_mode) |
392 +diff --git a/drivers/irqchip/irq-mips-cpu.c b/drivers/irqchip/irq-mips-cpu.c
393 +index 66f97fde13d80..51e09f6c653c3 100644
394 +--- a/drivers/irqchip/irq-mips-cpu.c
395 ++++ b/drivers/irqchip/irq-mips-cpu.c
396 +@@ -201,6 +201,13 @@ static int mips_cpu_ipi_alloc(struct irq_domain *domain, unsigned int virq,
397 + if (ret)
398 + return ret;
399 +
400 ++ ret = irq_domain_set_hwirq_and_chip(domain->parent, virq + i, hwirq,
401 ++ &mips_mt_cpu_irq_controller,
402 ++ NULL);
403 ++
404 ++ if (ret)
405 ++ return ret;
406 ++
407 + ret = irq_set_irq_type(virq + i, IRQ_TYPE_LEVEL_HIGH);
408 + if (ret)
409 + return ret;
410 +diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
411 +index 78d4e7347e2f3..c855ab2feb181 100644
412 +--- a/drivers/md/dm-table.c
413 ++++ b/drivers/md/dm-table.c
414 +@@ -431,14 +431,23 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
415 + {
416 + int r;
417 + dev_t dev;
418 ++ unsigned int major, minor;
419 ++ char dummy;
420 + struct dm_dev_internal *dd;
421 + struct dm_table *t = ti->table;
422 +
423 + BUG_ON(!t);
424 +
425 +- dev = dm_get_dev_t(path);
426 +- if (!dev)
427 +- return -ENODEV;
428 ++ if (sscanf(path, "%u:%u%c", &major, &minor, &dummy) == 2) {
429 ++ /* Extract the major/minor numbers */
430 ++ dev = MKDEV(major, minor);
431 ++ if (MAJOR(dev) != major || MINOR(dev) != minor)
432 ++ return -EOVERFLOW;
433 ++ } else {
434 ++ dev = dm_get_dev_t(path);
435 ++ if (!dev)
436 ++ return -ENODEV;
437 ++ }
438 +
439 + dd = find_device(&t->devices, dev);
440 + if (!dd) {
441 +diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c
442 +index fafb02644efde..ca34fa424634f 100644
443 +--- a/drivers/mmc/host/sdhci-xenon.c
444 ++++ b/drivers/mmc/host/sdhci-xenon.c
445 +@@ -170,7 +170,12 @@ static void xenon_reset_exit(struct sdhci_host *host,
446 + /* Disable tuning request and auto-retuning again */
447 + xenon_retune_setup(host);
448 +
449 +- xenon_set_acg(host, true);
450 ++ /*
451 ++ * The ACG should be turned off at the early init time, in order
452 ++ * to solve a possible issues with the 1.8V regulator stabilization.
453 ++ * The feature is enabled in later stage.
454 ++ */
455 ++ xenon_set_acg(host, false);
456 +
457 + xenon_set_sdclk_off_idle(host, sdhc_id, false);
458 +
459 +diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
460 +index c483c4b787fee..1025cfd463ece 100644
461 +--- a/drivers/net/can/dev.c
462 ++++ b/drivers/net/can/dev.c
463 +@@ -578,11 +578,11 @@ static void can_restart(struct net_device *dev)
464 + }
465 + cf->can_id |= CAN_ERR_RESTARTED;
466 +
467 +- netif_rx_ni(skb);
468 +-
469 + stats->rx_packets++;
470 + stats->rx_bytes += cf->can_dlc;
471 +
472 ++ netif_rx_ni(skb);
473 ++
474 + restart:
475 + netdev_dbg(dev, "restarted\n");
476 + priv->can_stats.restarts++;
477 +diff --git a/drivers/net/can/vxcan.c b/drivers/net/can/vxcan.c
478 +index b4c4a2c764378..fc9197f14a3fb 100644
479 +--- a/drivers/net/can/vxcan.c
480 ++++ b/drivers/net/can/vxcan.c
481 +@@ -49,6 +49,7 @@ static netdev_tx_t vxcan_xmit(struct sk_buff *skb, struct net_device *dev)
482 + struct net_device *peer;
483 + struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
484 + struct net_device_stats *peerstats, *srcstats = &dev->stats;
485 ++ u8 len;
486 +
487 + if (can_dropped_invalid_skb(dev, skb))
488 + return NETDEV_TX_OK;
489 +@@ -71,12 +72,13 @@ static netdev_tx_t vxcan_xmit(struct sk_buff *skb, struct net_device *dev)
490 + skb->dev = peer;
491 + skb->ip_summed = CHECKSUM_UNNECESSARY;
492 +
493 ++ len = cfd->len;
494 + if (netif_rx_ni(skb) == NET_RX_SUCCESS) {
495 + srcstats->tx_packets++;
496 +- srcstats->tx_bytes += cfd->len;
497 ++ srcstats->tx_bytes += len;
498 + peerstats = &peer->stats;
499 + peerstats->rx_packets++;
500 +- peerstats->rx_bytes += cfd->len;
501 ++ peerstats->rx_bytes += len;
502 + }
503 +
504 + out_unlock:
505 +diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
506 +index 5c3fa0be8844e..c17cdbd0bb6af 100644
507 +--- a/drivers/net/dsa/b53/b53_common.c
508 ++++ b/drivers/net/dsa/b53/b53_common.c
509 +@@ -970,7 +970,7 @@ int b53_vlan_prepare(struct dsa_switch *ds, int port,
510 + if ((is5325(dev) || is5365(dev)) && vlan->vid_begin == 0)
511 + return -EOPNOTSUPP;
512 +
513 +- if (vlan->vid_end > dev->num_vlans)
514 ++ if (vlan->vid_end >= dev->num_vlans)
515 + return -ERANGE;
516 +
517 + b53_enable_vlan(dev, true);
518 +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
519 +index 25f3b2ad26e9c..1f4987364ef88 100644
520 +--- a/drivers/net/ethernet/renesas/sh_eth.c
521 ++++ b/drivers/net/ethernet/renesas/sh_eth.c
522 +@@ -2517,10 +2517,10 @@ static int sh_eth_close(struct net_device *ndev)
523 + /* Free all the skbuffs in the Rx queue and the DMA buffer. */
524 + sh_eth_ring_free(ndev);
525 +
526 +- pm_runtime_put_sync(&mdp->pdev->dev);
527 +-
528 + mdp->is_opened = 0;
529 +
530 ++ pm_runtime_put(&mdp->pdev->dev);
531 ++
532 + return 0;
533 + }
534 +
535 +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
536 +index 342e086e41991..f46fa8a2f6585 100644
537 +--- a/drivers/scsi/ufs/ufshcd.c
538 ++++ b/drivers/scsi/ufs/ufshcd.c
539 +@@ -5536,19 +5536,16 @@ static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd)
540 + {
541 + struct Scsi_Host *host;
542 + struct ufs_hba *hba;
543 +- unsigned int tag;
544 + u32 pos;
545 + int err;
546 +- u8 resp = 0xF;
547 +- struct ufshcd_lrb *lrbp;
548 ++ u8 resp = 0xF, lun;
549 + unsigned long flags;
550 +
551 + host = cmd->device->host;
552 + hba = shost_priv(host);
553 +- tag = cmd->request->tag;
554 +
555 +- lrbp = &hba->lrb[tag];
556 +- err = ufshcd_issue_tm_cmd(hba, lrbp->lun, 0, UFS_LOGICAL_RESET, &resp);
557 ++ lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun);
558 ++ err = ufshcd_issue_tm_cmd(hba, lun, 0, UFS_LOGICAL_RESET, &resp);
559 + if (err || resp != UPIU_TASK_MANAGEMENT_FUNC_COMPL) {
560 + if (!err)
561 + err = resp;
562 +@@ -5557,7 +5554,7 @@ static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd)
563 +
564 + /* clear the commands that were pending for corresponding LUN */
565 + for_each_set_bit(pos, &hba->outstanding_reqs, hba->nutrs) {
566 +- if (hba->lrb[pos].lun == lrbp->lun) {
567 ++ if (hba->lrb[pos].lun == lun) {
568 + err = ufshcd_clear_cmd(hba, pos);
569 + if (err)
570 + break;
571 +diff --git a/drivers/usb/gadget/udc/bdc/Kconfig b/drivers/usb/gadget/udc/bdc/Kconfig
572 +index c74ac25dddcd0..051091bd265bc 100644
573 +--- a/drivers/usb/gadget/udc/bdc/Kconfig
574 ++++ b/drivers/usb/gadget/udc/bdc/Kconfig
575 +@@ -15,7 +15,7 @@ if USB_BDC_UDC
576 + comment "Platform Support"
577 + config USB_BDC_PCI
578 + tristate "BDC support for PCIe based platforms"
579 +- depends on USB_PCI
580 ++ depends on USB_PCI && BROKEN
581 + default USB_BDC_UDC
582 + help
583 + Enable support for platforms which have BDC connected through PCIe, such as Lego3 FPGA platform.
584 +diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
585 +index 4c6d612990ba4..db7c8aec23fc6 100644
586 +--- a/drivers/usb/gadget/udc/core.c
587 ++++ b/drivers/usb/gadget/udc/core.c
588 +@@ -1458,10 +1458,13 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
589 + struct device_attribute *attr, const char *buf, size_t n)
590 + {
591 + struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
592 ++ ssize_t ret;
593 +
594 ++ mutex_lock(&udc_lock);
595 + if (!udc->driver) {
596 + dev_err(dev, "soft-connect without a gadget driver\n");
597 +- return -EOPNOTSUPP;
598 ++ ret = -EOPNOTSUPP;
599 ++ goto out;
600 + }
601 +
602 + if (sysfs_streq(buf, "connect")) {
603 +@@ -1473,10 +1476,14 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
604 + usb_gadget_udc_stop(udc);
605 + } else {
606 + dev_err(dev, "unsupported command '%s'\n", buf);
607 +- return -EINVAL;
608 ++ ret = -EINVAL;
609 ++ goto out;
610 + }
611 +
612 +- return n;
613 ++ ret = n;
614 ++out:
615 ++ mutex_unlock(&udc_lock);
616 ++ return ret;
617 + }
618 + static DEVICE_ATTR(soft_connect, S_IWUSR, NULL, usb_udc_softconn_store);
619 +
620 +diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
621 +index 44b7066b12469..406294a5a5f74 100644
622 +--- a/drivers/usb/host/ehci-hcd.c
623 ++++ b/drivers/usb/host/ehci-hcd.c
624 +@@ -587,6 +587,7 @@ static int ehci_run (struct usb_hcd *hcd)
625 + struct ehci_hcd *ehci = hcd_to_ehci (hcd);
626 + u32 temp;
627 + u32 hcc_params;
628 ++ int rc;
629 +
630 + hcd->uses_new_polling = 1;
631 +
632 +@@ -642,9 +643,20 @@ static int ehci_run (struct usb_hcd *hcd)
633 + down_write(&ehci_cf_port_reset_rwsem);
634 + ehci->rh_state = EHCI_RH_RUNNING;
635 + ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag);
636 ++
637 ++ /* Wait until HC become operational */
638 + ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
639 + msleep(5);
640 ++ rc = ehci_handshake(ehci, &ehci->regs->status, STS_HALT, 0, 100 * 1000);
641 ++
642 + up_write(&ehci_cf_port_reset_rwsem);
643 ++
644 ++ if (rc) {
645 ++ ehci_err(ehci, "USB %x.%x, controller refused to start: %d\n",
646 ++ ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), rc);
647 ++ return rc;
648 ++ }
649 ++
650 + ehci->last_periodic_enable = ktime_get_real();
651 +
652 + temp = HC_VERSION(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
653 +diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
654 +index c144172a09a40..1cb613364eb62 100644
655 +--- a/drivers/usb/host/ehci-hub.c
656 ++++ b/drivers/usb/host/ehci-hub.c
657 +@@ -358,6 +358,9 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
658 +
659 + unlink_empty_async_suspended(ehci);
660 +
661 ++ /* Some Synopsys controllers mistakenly leave IAA turned on */
662 ++ ehci_writel(ehci, STS_IAA, &ehci->regs->status);
663 ++
664 + /* Any IAA cycle that started before the suspend is now invalid */
665 + end_iaa_cycle(ehci);
666 + ehci_handle_start_intr_unlinks(ehci);
667 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
668 +index 9828c1eff9a5f..0c5b2c75b8713 100644
669 +--- a/drivers/usb/host/xhci-ring.c
670 ++++ b/drivers/usb/host/xhci-ring.c
671 +@@ -2907,6 +2907,8 @@ static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring,
672 + trb->field[0] = cpu_to_le32(field1);
673 + trb->field[1] = cpu_to_le32(field2);
674 + trb->field[2] = cpu_to_le32(field3);
675 ++ /* make sure TRB is fully written before giving it to the controller */
676 ++ wmb();
677 + trb->field[3] = cpu_to_le32(field4);
678 +
679 + trace_xhci_queue_trb(ring, trb);
680 +diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
681 +index 28df32d856715..808720b9f33e0 100644
682 +--- a/drivers/usb/host/xhci-tegra.c
683 ++++ b/drivers/usb/host/xhci-tegra.c
684 +@@ -579,6 +579,13 @@ static void tegra_xusb_mbox_handle(struct tegra_xusb *tegra,
685 + enable);
686 + if (err < 0)
687 + break;
688 ++
689 ++ /*
690 ++ * wait 500us for LFPS detector to be disabled before
691 ++ * sending ACK
692 ++ */
693 ++ if (!enable)
694 ++ usleep_range(500, 1000);
695 + }
696 +
697 + if (err < 0) {
698 +diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
699 +index aca8456752797..8c08c7d46d3d0 100644
700 +--- a/drivers/xen/events/events_base.c
701 ++++ b/drivers/xen/events/events_base.c
702 +@@ -1987,16 +1987,6 @@ static struct irq_chip xen_percpu_chip __read_mostly = {
703 + .irq_ack = ack_dynirq,
704 + };
705 +
706 +-int xen_set_callback_via(uint64_t via)
707 +-{
708 +- struct xen_hvm_param a;
709 +- a.domid = DOMID_SELF;
710 +- a.index = HVM_PARAM_CALLBACK_IRQ;
711 +- a.value = via;
712 +- return HYPERVISOR_hvm_op(HVMOP_set_param, &a);
713 +-}
714 +-EXPORT_SYMBOL_GPL(xen_set_callback_via);
715 +-
716 + #ifdef CONFIG_XEN_PVHVM
717 + /* Vector callbacks are better than PCI interrupts to receive event
718 + * channel notifications because we can receive vector callbacks on any
719 +diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c
720 +index 5d7dcad0b0a0d..4cec8146609ad 100644
721 +--- a/drivers/xen/platform-pci.c
722 ++++ b/drivers/xen/platform-pci.c
723 +@@ -162,7 +162,6 @@ static int platform_pci_probe(struct pci_dev *pdev,
724 + ret = gnttab_init();
725 + if (ret)
726 + goto grant_out;
727 +- xenbus_probe(NULL);
728 + return 0;
729 + grant_out:
730 + gnttab_free_auto_xlat_frames();
731 +diff --git a/drivers/xen/xenbus/xenbus.h b/drivers/xen/xenbus/xenbus.h
732 +index 139539b0ab20d..e6a8d02d35254 100644
733 +--- a/drivers/xen/xenbus/xenbus.h
734 ++++ b/drivers/xen/xenbus/xenbus.h
735 +@@ -114,6 +114,7 @@ int xenbus_probe_node(struct xen_bus_type *bus,
736 + const char *type,
737 + const char *nodename);
738 + int xenbus_probe_devices(struct xen_bus_type *bus);
739 ++void xenbus_probe(void);
740 +
741 + void xenbus_dev_changed(const char *node, struct xen_bus_type *bus);
742 +
743 +diff --git a/drivers/xen/xenbus/xenbus_comms.c b/drivers/xen/xenbus/xenbus_comms.c
744 +index eb5151fc8efab..e5fda0256feb3 100644
745 +--- a/drivers/xen/xenbus/xenbus_comms.c
746 ++++ b/drivers/xen/xenbus/xenbus_comms.c
747 +@@ -57,16 +57,8 @@ DEFINE_MUTEX(xs_response_mutex);
748 + static int xenbus_irq;
749 + static struct task_struct *xenbus_task;
750 +
751 +-static DECLARE_WORK(probe_work, xenbus_probe);
752 +-
753 +-
754 + static irqreturn_t wake_waiting(int irq, void *unused)
755 + {
756 +- if (unlikely(xenstored_ready == 0)) {
757 +- xenstored_ready = 1;
758 +- schedule_work(&probe_work);
759 +- }
760 +-
761 + wake_up(&xb_waitq);
762 + return IRQ_HANDLED;
763 + }
764 +diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
765 +index 217bcc092a968..fe24e8dcb2b8e 100644
766 +--- a/drivers/xen/xenbus/xenbus_probe.c
767 ++++ b/drivers/xen/xenbus/xenbus_probe.c
768 +@@ -674,29 +674,76 @@ void unregister_xenstore_notifier(struct notifier_block *nb)
769 + }
770 + EXPORT_SYMBOL_GPL(unregister_xenstore_notifier);
771 +
772 +-void xenbus_probe(struct work_struct *unused)
773 ++void xenbus_probe(void)
774 + {
775 + xenstored_ready = 1;
776 +
777 ++ /*
778 ++ * In the HVM case, xenbus_init() deferred its call to
779 ++ * xs_init() in case callbacks were not operational yet.
780 ++ * So do it now.
781 ++ */
782 ++ if (xen_store_domain_type == XS_HVM)
783 ++ xs_init();
784 ++
785 + /* Notify others that xenstore is up */
786 + blocking_notifier_call_chain(&xenstore_chain, 0, NULL);
787 + }
788 +-EXPORT_SYMBOL_GPL(xenbus_probe);
789 +
790 +-static int __init xenbus_probe_initcall(void)
791 ++/*
792 ++ * Returns true when XenStore init must be deferred in order to
793 ++ * allow the PCI platform device to be initialised, before we
794 ++ * can actually have event channel interrupts working.
795 ++ */
796 ++static bool xs_hvm_defer_init_for_callback(void)
797 + {
798 +- if (!xen_domain())
799 +- return -ENODEV;
800 ++#ifdef CONFIG_XEN_PVHVM
801 ++ return xen_store_domain_type == XS_HVM &&
802 ++ !xen_have_vector_callback;
803 ++#else
804 ++ return false;
805 ++#endif
806 ++}
807 +
808 +- if (xen_initial_domain() || xen_hvm_domain())
809 +- return 0;
810 ++static int __init xenbus_probe_initcall(void)
811 ++{
812 ++ /*
813 ++ * Probe XenBus here in the XS_PV case, and also XS_HVM unless we
814 ++ * need to wait for the platform PCI device to come up.
815 ++ */
816 ++ if (xen_store_domain_type == XS_PV ||
817 ++ (xen_store_domain_type == XS_HVM &&
818 ++ !xs_hvm_defer_init_for_callback()))
819 ++ xenbus_probe();
820 +
821 +- xenbus_probe(NULL);
822 + return 0;
823 + }
824 +-
825 + device_initcall(xenbus_probe_initcall);
826 +
827 ++int xen_set_callback_via(uint64_t via)
828 ++{
829 ++ struct xen_hvm_param a;
830 ++ int ret;
831 ++
832 ++ a.domid = DOMID_SELF;
833 ++ a.index = HVM_PARAM_CALLBACK_IRQ;
834 ++ a.value = via;
835 ++
836 ++ ret = HYPERVISOR_hvm_op(HVMOP_set_param, &a);
837 ++ if (ret)
838 ++ return ret;
839 ++
840 ++ /*
841 ++ * If xenbus_probe_initcall() deferred the xenbus_probe()
842 ++ * due to the callback not functioning yet, we can do it now.
843 ++ */
844 ++ if (!xenstored_ready && xs_hvm_defer_init_for_callback())
845 ++ xenbus_probe();
846 ++
847 ++ return ret;
848 ++}
849 ++EXPORT_SYMBOL_GPL(xen_set_callback_via);
850 ++
851 + /* Set up event channel for xenstored which is run as a local process
852 + * (this is normally used only in dom0)
853 + */
854 +@@ -810,11 +857,17 @@ static int __init xenbus_init(void)
855 + break;
856 + }
857 +
858 +- /* Initialize the interface to xenstore. */
859 +- err = xs_init();
860 +- if (err) {
861 +- pr_warn("Error initializing xenstore comms: %i\n", err);
862 +- goto out_error;
863 ++ /*
864 ++ * HVM domains may not have a functional callback yet. In that
865 ++ * case let xs_init() be called from xenbus_probe(), which will
866 ++ * get invoked at an appropriate time.
867 ++ */
868 ++ if (xen_store_domain_type != XS_HVM) {
869 ++ err = xs_init();
870 ++ if (err) {
871 ++ pr_warn("Error initializing xenstore comms: %i\n", err);
872 ++ goto out_error;
873 ++ }
874 + }
875 +
876 + if ((xen_store_domain_type != XS_LOCAL) &&
877 +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
878 +index 898f962d3a068..eb635eab304ed 100644
879 +--- a/fs/ext4/inode.c
880 ++++ b/fs/ext4/inode.c
881 +@@ -5064,16 +5064,16 @@ static int other_inode_match(struct inode * inode, unsigned long ino,
882 +
883 + if ((inode->i_ino != ino) ||
884 + (inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW |
885 +- I_DIRTY_SYNC | I_DIRTY_DATASYNC)) ||
886 ++ I_DIRTY_INODE)) ||
887 + ((inode->i_state & I_DIRTY_TIME) == 0))
888 + return 0;
889 + spin_lock(&inode->i_lock);
890 + if (((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW |
891 +- I_DIRTY_SYNC | I_DIRTY_DATASYNC)) == 0) &&
892 ++ I_DIRTY_INODE)) == 0) &&
893 + (inode->i_state & I_DIRTY_TIME)) {
894 + struct ext4_inode_info *ei = EXT4_I(inode);
895 +
896 +- inode->i_state &= ~(I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED);
897 ++ inode->i_state &= ~I_DIRTY_TIME;
898 + spin_unlock(&inode->i_lock);
899 +
900 + spin_lock(&ei->i_raw_lock);
901 +diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
902 +index 3dbb875ed7903..384f95e1936dd 100644
903 +--- a/fs/fs-writeback.c
904 ++++ b/fs/fs-writeback.c
905 +@@ -1154,7 +1154,7 @@ static bool inode_dirtied_after(struct inode *inode, unsigned long t)
906 + */
907 + static int move_expired_inodes(struct list_head *delaying_queue,
908 + struct list_head *dispatch_queue,
909 +- int flags, unsigned long dirtied_before)
910 ++ unsigned long dirtied_before)
911 + {
912 + LIST_HEAD(tmp);
913 + struct list_head *pos, *node;
914 +@@ -1170,8 +1170,6 @@ static int move_expired_inodes(struct list_head *delaying_queue,
915 + list_move(&inode->i_io_list, &tmp);
916 + moved++;
917 + spin_lock(&inode->i_lock);
918 +- if (flags & EXPIRE_DIRTY_ATIME)
919 +- inode->i_state |= I_DIRTY_TIME_EXPIRED;
920 + inode->i_state |= I_SYNC_QUEUED;
921 + spin_unlock(&inode->i_lock);
922 + if (sb_is_blkdev_sb(inode->i_sb))
923 +@@ -1219,11 +1217,11 @@ static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work,
924 +
925 + assert_spin_locked(&wb->list_lock);
926 + list_splice_init(&wb->b_more_io, &wb->b_io);
927 +- moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, 0, dirtied_before);
928 ++ moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, dirtied_before);
929 + if (!work->for_sync)
930 + time_expire_jif = jiffies - dirtytime_expire_interval * HZ;
931 + moved += move_expired_inodes(&wb->b_dirty_time, &wb->b_io,
932 +- EXPIRE_DIRTY_ATIME, time_expire_jif);
933 ++ time_expire_jif);
934 + if (moved)
935 + wb_io_lists_populated(wb);
936 + trace_writeback_queue_io(wb, work, dirtied_before, moved);
937 +@@ -1391,26 +1389,26 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
938 + ret = err;
939 + }
940 +
941 ++ /*
942 ++ * If the inode has dirty timestamps and we need to write them, call
943 ++ * mark_inode_dirty_sync() to notify the filesystem about it and to
944 ++ * change I_DIRTY_TIME into I_DIRTY_SYNC.
945 ++ */
946 ++ if ((inode->i_state & I_DIRTY_TIME) &&
947 ++ (wbc->sync_mode == WB_SYNC_ALL || wbc->for_sync ||
948 ++ time_after(jiffies, inode->dirtied_time_when +
949 ++ dirtytime_expire_interval * HZ))) {
950 ++ trace_writeback_lazytime(inode);
951 ++ mark_inode_dirty_sync(inode);
952 ++ }
953 ++
954 + /*
955 + * Some filesystems may redirty the inode during the writeback
956 + * due to delalloc, clear dirty metadata flags right before
957 + * write_inode()
958 + */
959 + spin_lock(&inode->i_lock);
960 +-
961 + dirty = inode->i_state & I_DIRTY;
962 +- if (inode->i_state & I_DIRTY_TIME) {
963 +- if ((dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) ||
964 +- wbc->sync_mode == WB_SYNC_ALL ||
965 +- unlikely(inode->i_state & I_DIRTY_TIME_EXPIRED) ||
966 +- unlikely(time_after(jiffies,
967 +- (inode->dirtied_time_when +
968 +- dirtytime_expire_interval * HZ)))) {
969 +- dirty |= I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED;
970 +- trace_writeback_lazytime(inode);
971 +- }
972 +- } else
973 +- inode->i_state &= ~I_DIRTY_TIME_EXPIRED;
974 + inode->i_state &= ~dirty;
975 +
976 + /*
977 +@@ -1431,8 +1429,6 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
978 +
979 + spin_unlock(&inode->i_lock);
980 +
981 +- if (dirty & I_DIRTY_TIME)
982 +- mark_inode_dirty_sync(inode);
983 + /* Don't write the inode if only I_DIRTY_PAGES was set */
984 + if (dirty & ~I_DIRTY_PAGES) {
985 + int err = write_inode(inode, wbc);
986 +@@ -2136,7 +2132,6 @@ static noinline void block_dump___mark_inode_dirty(struct inode *inode)
987 + */
988 + void __mark_inode_dirty(struct inode *inode, int flags)
989 + {
990 +-#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
991 + struct super_block *sb = inode->i_sb;
992 + int dirtytime;
993 +
994 +@@ -2146,7 +2141,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
995 + * Don't do this for I_DIRTY_PAGES - that doesn't actually
996 + * dirty the inode itself
997 + */
998 +- if (flags & (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_TIME)) {
999 ++ if (flags & (I_DIRTY_INODE | I_DIRTY_TIME)) {
1000 + trace_writeback_dirty_inode_start(inode, flags);
1001 +
1002 + if (sb->s_op->dirty_inode)
1003 +@@ -2222,7 +2217,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
1004 + if (dirtytime)
1005 + inode->dirtied_time_when = jiffies;
1006 +
1007 +- if (inode->i_state & (I_DIRTY_INODE | I_DIRTY_PAGES))
1008 ++ if (inode->i_state & I_DIRTY)
1009 + dirty_list = &wb->b_dirty;
1010 + else
1011 + dirty_list = &wb->b_dirty_time;
1012 +@@ -2246,8 +2241,6 @@ void __mark_inode_dirty(struct inode *inode, int flags)
1013 + }
1014 + out_unlock_inode:
1015 + spin_unlock(&inode->i_lock);
1016 +-
1017 +-#undef I_DIRTY_INODE
1018 + }
1019 + EXPORT_SYMBOL(__mark_inode_dirty);
1020 +
1021 +diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
1022 +index 639e2c86758a4..bcf95ec1bc31d 100644
1023 +--- a/fs/gfs2/super.c
1024 ++++ b/fs/gfs2/super.c
1025 +@@ -791,7 +791,7 @@ static void gfs2_dirty_inode(struct inode *inode, int flags)
1026 + int need_endtrans = 0;
1027 + int ret;
1028 +
1029 +- if (!(flags & (I_DIRTY_DATASYNC|I_DIRTY_SYNC)))
1030 ++ if (!(flags & I_DIRTY_INODE))
1031 + return;
1032 + if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
1033 + return;
1034 +diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
1035 +index 6d7ead22c1b4c..6aef1d7ec96b6 100644
1036 +--- a/include/linux/compiler-gcc.h
1037 ++++ b/include/linux/compiler-gcc.h
1038 +@@ -152,6 +152,12 @@
1039 +
1040 + #if GCC_VERSION < 30200
1041 + # error Sorry, your compiler is too old - please upgrade it.
1042 ++#elif defined(CONFIG_ARM64) && GCC_VERSION < 50100 && !defined(__clang__)
1043 ++/*
1044 ++ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
1045 ++ * https://lore.kernel.org/r/20210107111841.GN1551@××××××××××××××××××.uk
1046 ++ */
1047 ++# error Sorry, your version of GCC is too old - please use 5.1 or newer.
1048 + #endif
1049 +
1050 + #if GCC_VERSION < 30300
1051 +diff --git a/include/linux/fs.h b/include/linux/fs.h
1052 +index 30172ad84b25f..309c151decd8c 100644
1053 +--- a/include/linux/fs.h
1054 ++++ b/include/linux/fs.h
1055 +@@ -2010,12 +2010,12 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
1056 + #define I_DIO_WAKEUP (1 << __I_DIO_WAKEUP)
1057 + #define I_LINKABLE (1 << 10)
1058 + #define I_DIRTY_TIME (1 << 11)
1059 +-#define I_DIRTY_TIME_EXPIRED (1 << 12)
1060 + #define I_WB_SWITCH (1 << 13)
1061 + #define I_OVL_INUSE (1 << 14)
1062 + #define I_SYNC_QUEUED (1 << 17)
1063 +
1064 +-#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
1065 ++#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
1066 ++#define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES)
1067 + #define I_DIRTY_ALL (I_DIRTY | I_DIRTY_TIME)
1068 +
1069 + extern void __mark_inode_dirty(struct inode *, int);
1070 +diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
1071 +index 3a76ca2eecd06..627f5759b67d1 100644
1072 +--- a/include/trace/events/writeback.h
1073 ++++ b/include/trace/events/writeback.h
1074 +@@ -20,7 +20,6 @@
1075 + {I_CLEAR, "I_CLEAR"}, \
1076 + {I_SYNC, "I_SYNC"}, \
1077 + {I_DIRTY_TIME, "I_DIRTY_TIME"}, \
1078 +- {I_DIRTY_TIME_EXPIRED, "I_DIRTY_TIME_EXPIRED"}, \
1079 + {I_REFERENCED, "I_REFERENCED"} \
1080 + )
1081 +
1082 +diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
1083 +index eba01ab5a55e0..fe9a9fa2ebc45 100644
1084 +--- a/include/xen/xenbus.h
1085 ++++ b/include/xen/xenbus.h
1086 +@@ -187,7 +187,7 @@ void xs_suspend_cancel(void);
1087 +
1088 + struct work_struct;
1089 +
1090 +-void xenbus_probe(struct work_struct *);
1091 ++void xenbus_probe(void);
1092 +
1093 + #define XENBUS_IS_ERR_READ(str) ({ \
1094 + if (!IS_ERR(str) && strlen(str) == 0) { \
1095 +diff --git a/kernel/futex.c b/kernel/futex.c
1096 +index 322b9a840da63..39d2c20f500db 100644
1097 +--- a/kernel/futex.c
1098 ++++ b/kernel/futex.c
1099 +@@ -839,6 +839,29 @@ static struct futex_pi_state *alloc_pi_state(void)
1100 + return pi_state;
1101 + }
1102 +
1103 ++static void pi_state_update_owner(struct futex_pi_state *pi_state,
1104 ++ struct task_struct *new_owner)
1105 ++{
1106 ++ struct task_struct *old_owner = pi_state->owner;
1107 ++
1108 ++ lockdep_assert_held(&pi_state->pi_mutex.wait_lock);
1109 ++
1110 ++ if (old_owner) {
1111 ++ raw_spin_lock(&old_owner->pi_lock);
1112 ++ WARN_ON(list_empty(&pi_state->list));
1113 ++ list_del_init(&pi_state->list);
1114 ++ raw_spin_unlock(&old_owner->pi_lock);
1115 ++ }
1116 ++
1117 ++ if (new_owner) {
1118 ++ raw_spin_lock(&new_owner->pi_lock);
1119 ++ WARN_ON(!list_empty(&pi_state->list));
1120 ++ list_add(&pi_state->list, &new_owner->pi_state_list);
1121 ++ pi_state->owner = new_owner;
1122 ++ raw_spin_unlock(&new_owner->pi_lock);
1123 ++ }
1124 ++}
1125 ++
1126 + static void get_pi_state(struct futex_pi_state *pi_state)
1127 + {
1128 + WARN_ON_ONCE(!atomic_inc_not_zero(&pi_state->refcount));
1129 +@@ -861,17 +884,11 @@ static void put_pi_state(struct futex_pi_state *pi_state)
1130 + * and has cleaned up the pi_state already
1131 + */
1132 + if (pi_state->owner) {
1133 +- struct task_struct *owner;
1134 + unsigned long flags;
1135 +
1136 + raw_spin_lock_irqsave(&pi_state->pi_mutex.wait_lock, flags);
1137 +- owner = pi_state->owner;
1138 +- if (owner) {
1139 +- raw_spin_lock(&owner->pi_lock);
1140 +- list_del_init(&pi_state->list);
1141 +- raw_spin_unlock(&owner->pi_lock);
1142 +- }
1143 +- rt_mutex_proxy_unlock(&pi_state->pi_mutex, owner);
1144 ++ pi_state_update_owner(pi_state, NULL);
1145 ++ rt_mutex_proxy_unlock(&pi_state->pi_mutex);
1146 + raw_spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags);
1147 + }
1148 +
1149 +@@ -1035,7 +1052,8 @@ static inline void exit_pi_state_list(struct task_struct *curr) { }
1150 + * FUTEX_OWNER_DIED bit. See [4]
1151 + *
1152 + * [10] There is no transient state which leaves owner and user space
1153 +- * TID out of sync.
1154 ++ * TID out of sync. Except one error case where the kernel is denied
1155 ++ * write access to the user address, see fixup_pi_state_owner().
1156 + *
1157 + *
1158 + * Serialization and lifetime rules:
1159 +@@ -1615,26 +1633,15 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_pi_state *pi_
1160 + ret = -EINVAL;
1161 + }
1162 +
1163 +- if (ret)
1164 +- goto out_unlock;
1165 +-
1166 +- /*
1167 +- * This is a point of no return; once we modify the uval there is no
1168 +- * going back and subsequent operations must not fail.
1169 +- */
1170 +-
1171 +- raw_spin_lock(&pi_state->owner->pi_lock);
1172 +- WARN_ON(list_empty(&pi_state->list));
1173 +- list_del_init(&pi_state->list);
1174 +- raw_spin_unlock(&pi_state->owner->pi_lock);
1175 +-
1176 +- raw_spin_lock(&new_owner->pi_lock);
1177 +- WARN_ON(!list_empty(&pi_state->list));
1178 +- list_add(&pi_state->list, &new_owner->pi_state_list);
1179 +- pi_state->owner = new_owner;
1180 +- raw_spin_unlock(&new_owner->pi_lock);
1181 +-
1182 +- postunlock = __rt_mutex_futex_unlock(&pi_state->pi_mutex, &wake_q);
1183 ++ if (!ret) {
1184 ++ /*
1185 ++ * This is a point of no return; once we modified the uval
1186 ++ * there is no going back and subsequent operations must
1187 ++ * not fail.
1188 ++ */
1189 ++ pi_state_update_owner(pi_state, new_owner);
1190 ++ postunlock = __rt_mutex_futex_unlock(&pi_state->pi_mutex, &wake_q);
1191 ++ }
1192 +
1193 + out_unlock:
1194 + raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
1195 +@@ -1725,8 +1732,8 @@ static int futex_atomic_op_inuser(unsigned int encoded_op, u32 __user *uaddr)
1196 + {
1197 + unsigned int op = (encoded_op & 0x70000000) >> 28;
1198 + unsigned int cmp = (encoded_op & 0x0f000000) >> 24;
1199 +- int oparg = sign_extend32((encoded_op & 0x00fff000) >> 12, 12);
1200 +- int cmparg = sign_extend32(encoded_op & 0x00000fff, 12);
1201 ++ int oparg = sign_extend32((encoded_op & 0x00fff000) >> 12, 11);
1202 ++ int cmparg = sign_extend32(encoded_op & 0x00000fff, 11);
1203 + int oldval, ret;
1204 +
1205 + if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) {
1206 +@@ -2457,18 +2464,13 @@ static void unqueue_me_pi(struct futex_q *q)
1207 + spin_unlock(q->lock_ptr);
1208 + }
1209 +
1210 +-static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
1211 +- struct task_struct *argowner)
1212 ++static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
1213 ++ struct task_struct *argowner)
1214 + {
1215 ++ u32 uval, uninitialized_var(curval), newval, newtid;
1216 + struct futex_pi_state *pi_state = q->pi_state;
1217 +- u32 uval, uninitialized_var(curval), newval;
1218 + struct task_struct *oldowner, *newowner;
1219 +- u32 newtid;
1220 +- int ret, err = 0;
1221 +-
1222 +- lockdep_assert_held(q->lock_ptr);
1223 +-
1224 +- raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock);
1225 ++ int err = 0;
1226 +
1227 + oldowner = pi_state->owner;
1228 +
1229 +@@ -2502,14 +2504,12 @@ retry:
1230 + * We raced against a concurrent self; things are
1231 + * already fixed up. Nothing to do.
1232 + */
1233 +- ret = 0;
1234 +- goto out_unlock;
1235 ++ return 0;
1236 + }
1237 +
1238 + if (__rt_mutex_futex_trylock(&pi_state->pi_mutex)) {
1239 +- /* We got the lock after all, nothing to fix. */
1240 +- ret = 0;
1241 +- goto out_unlock;
1242 ++ /* We got the lock. pi_state is correct. Tell caller. */
1243 ++ return 1;
1244 + }
1245 +
1246 + /*
1247 +@@ -2536,8 +2536,7 @@ retry:
1248 + * We raced against a concurrent self; things are
1249 + * already fixed up. Nothing to do.
1250 + */
1251 +- ret = 0;
1252 +- goto out_unlock;
1253 ++ return 1;
1254 + }
1255 + newowner = argowner;
1256 + }
1257 +@@ -2567,22 +2566,9 @@ retry:
1258 + * We fixed up user space. Now we need to fix the pi_state
1259 + * itself.
1260 + */
1261 +- if (pi_state->owner != NULL) {
1262 +- raw_spin_lock(&pi_state->owner->pi_lock);
1263 +- WARN_ON(list_empty(&pi_state->list));
1264 +- list_del_init(&pi_state->list);
1265 +- raw_spin_unlock(&pi_state->owner->pi_lock);
1266 +- }
1267 ++ pi_state_update_owner(pi_state, newowner);
1268 +
1269 +- pi_state->owner = newowner;
1270 +-
1271 +- raw_spin_lock(&newowner->pi_lock);
1272 +- WARN_ON(!list_empty(&pi_state->list));
1273 +- list_add(&pi_state->list, &newowner->pi_state_list);
1274 +- raw_spin_unlock(&newowner->pi_lock);
1275 +- raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
1276 +-
1277 +- return 0;
1278 ++ return argowner == current;
1279 +
1280 + /*
1281 + * In order to reschedule or handle a page fault, we need to drop the
1282 +@@ -2603,17 +2589,16 @@ handle_err:
1283 +
1284 + switch (err) {
1285 + case -EFAULT:
1286 +- ret = fault_in_user_writeable(uaddr);
1287 ++ err = fault_in_user_writeable(uaddr);
1288 + break;
1289 +
1290 + case -EAGAIN:
1291 + cond_resched();
1292 +- ret = 0;
1293 ++ err = 0;
1294 + break;
1295 +
1296 + default:
1297 + WARN_ON_ONCE(1);
1298 +- ret = err;
1299 + break;
1300 + }
1301 +
1302 +@@ -2623,17 +2608,44 @@ handle_err:
1303 + /*
1304 + * Check if someone else fixed it for us:
1305 + */
1306 +- if (pi_state->owner != oldowner) {
1307 +- ret = 0;
1308 +- goto out_unlock;
1309 +- }
1310 ++ if (pi_state->owner != oldowner)
1311 ++ return argowner == current;
1312 +
1313 +- if (ret)
1314 +- goto out_unlock;
1315 ++ /* Retry if err was -EAGAIN or the fault in succeeded */
1316 ++ if (!err)
1317 ++ goto retry;
1318 +
1319 +- goto retry;
1320 ++ /*
1321 ++ * fault_in_user_writeable() failed so user state is immutable. At
1322 ++ * best we can make the kernel state consistent but user state will
1323 ++ * be most likely hosed and any subsequent unlock operation will be
1324 ++ * rejected due to PI futex rule [10].
1325 ++ *
1326 ++ * Ensure that the rtmutex owner is also the pi_state owner despite
1327 ++ * the user space value claiming something different. There is no
1328 ++ * point in unlocking the rtmutex if current is the owner as it
1329 ++ * would need to wait until the next waiter has taken the rtmutex
1330 ++ * to guarantee consistent state. Keep it simple. Userspace asked
1331 ++ * for this wreckaged state.
1332 ++ *
1333 ++ * The rtmutex has an owner - either current or some other
1334 ++ * task. See the EAGAIN loop above.
1335 ++ */
1336 ++ pi_state_update_owner(pi_state, rt_mutex_owner(&pi_state->pi_mutex));
1337 +
1338 +-out_unlock:
1339 ++ return err;
1340 ++}
1341 ++
1342 ++static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
1343 ++ struct task_struct *argowner)
1344 ++{
1345 ++ struct futex_pi_state *pi_state = q->pi_state;
1346 ++ int ret;
1347 ++
1348 ++ lockdep_assert_held(q->lock_ptr);
1349 ++
1350 ++ raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock);
1351 ++ ret = __fixup_pi_state_owner(uaddr, q, argowner);
1352 + raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
1353 + return ret;
1354 + }
1355 +@@ -2657,8 +2669,6 @@ static long futex_wait_restart(struct restart_block *restart);
1356 + */
1357 + static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked)
1358 + {
1359 +- int ret = 0;
1360 +-
1361 + if (locked) {
1362 + /*
1363 + * Got the lock. We might not be the anticipated owner if we
1364 +@@ -2669,8 +2679,8 @@ static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked)
1365 + * stable state, anything else needs more attention.
1366 + */
1367 + if (q->pi_state->owner != current)
1368 +- ret = fixup_pi_state_owner(uaddr, q, current);
1369 +- goto out;
1370 ++ return fixup_pi_state_owner(uaddr, q, current);
1371 ++ return 1;
1372 + }
1373 +
1374 + /*
1375 +@@ -2681,24 +2691,17 @@ static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked)
1376 + * Another speculative read; pi_state->owner == current is unstable
1377 + * but needs our attention.
1378 + */
1379 +- if (q->pi_state->owner == current) {
1380 +- ret = fixup_pi_state_owner(uaddr, q, NULL);
1381 +- goto out;
1382 +- }
1383 ++ if (q->pi_state->owner == current)
1384 ++ return fixup_pi_state_owner(uaddr, q, NULL);
1385 +
1386 + /*
1387 + * Paranoia check. If we did not take the lock, then we should not be
1388 +- * the owner of the rt_mutex.
1389 ++ * the owner of the rt_mutex. Warn and establish consistent state.
1390 + */
1391 +- if (rt_mutex_owner(&q->pi_state->pi_mutex) == current) {
1392 +- printk(KERN_ERR "fixup_owner: ret = %d pi-mutex: %p "
1393 +- "pi-state %p\n", ret,
1394 +- q->pi_state->pi_mutex.owner,
1395 +- q->pi_state->owner);
1396 +- }
1397 ++ if (WARN_ON_ONCE(rt_mutex_owner(&q->pi_state->pi_mutex) == current))
1398 ++ return fixup_pi_state_owner(uaddr, q, current);
1399 +
1400 +-out:
1401 +- return ret ? ret : locked;
1402 ++ return 0;
1403 + }
1404 +
1405 + /**
1406 +@@ -2919,7 +2922,6 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags,
1407 + ktime_t *time, int trylock)
1408 + {
1409 + struct hrtimer_sleeper timeout, *to = NULL;
1410 +- struct futex_pi_state *pi_state = NULL;
1411 + struct task_struct *exiting = NULL;
1412 + struct rt_mutex_waiter rt_waiter;
1413 + struct futex_hash_bucket *hb;
1414 +@@ -3062,23 +3064,9 @@ no_block:
1415 + if (res)
1416 + ret = (res < 0) ? res : 0;
1417 +
1418 +- /*
1419 +- * If fixup_owner() faulted and was unable to handle the fault, unlock
1420 +- * it and return the fault to userspace.
1421 +- */
1422 +- if (ret && (rt_mutex_owner(&q.pi_state->pi_mutex) == current)) {
1423 +- pi_state = q.pi_state;
1424 +- get_pi_state(pi_state);
1425 +- }
1426 +-
1427 + /* Unqueue and drop the lock */
1428 + unqueue_me_pi(&q);
1429 +
1430 +- if (pi_state) {
1431 +- rt_mutex_futex_unlock(&pi_state->pi_mutex);
1432 +- put_pi_state(pi_state);
1433 +- }
1434 +-
1435 + goto out_put_key;
1436 +
1437 + out_unlock_put_key:
1438 +@@ -3344,7 +3332,6 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
1439 + u32 __user *uaddr2)
1440 + {
1441 + struct hrtimer_sleeper timeout, *to = NULL;
1442 +- struct futex_pi_state *pi_state = NULL;
1443 + struct rt_mutex_waiter rt_waiter;
1444 + struct futex_hash_bucket *hb;
1445 + union futex_key key2 = FUTEX_KEY_INIT;
1446 +@@ -3429,16 +3416,17 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
1447 + if (q.pi_state && (q.pi_state->owner != current)) {
1448 + spin_lock(q.lock_ptr);
1449 + ret = fixup_pi_state_owner(uaddr2, &q, current);
1450 +- if (ret && rt_mutex_owner(&q.pi_state->pi_mutex) == current) {
1451 +- pi_state = q.pi_state;
1452 +- get_pi_state(pi_state);
1453 +- }
1454 + /*
1455 + * Drop the reference to the pi state which
1456 + * the requeue_pi() code acquired for us.
1457 + */
1458 + put_pi_state(q.pi_state);
1459 + spin_unlock(q.lock_ptr);
1460 ++ /*
1461 ++ * Adjust the return value. It's either -EFAULT or
1462 ++ * success (1) but the caller expects 0 for success.
1463 ++ */
1464 ++ ret = ret < 0 ? ret : 0;
1465 + }
1466 + } else {
1467 + struct rt_mutex *pi_mutex;
1468 +@@ -3469,25 +3457,10 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
1469 + if (res)
1470 + ret = (res < 0) ? res : 0;
1471 +
1472 +- /*
1473 +- * If fixup_pi_state_owner() faulted and was unable to handle
1474 +- * the fault, unlock the rt_mutex and return the fault to
1475 +- * userspace.
1476 +- */
1477 +- if (ret && rt_mutex_owner(&q.pi_state->pi_mutex) == current) {
1478 +- pi_state = q.pi_state;
1479 +- get_pi_state(pi_state);
1480 +- }
1481 +-
1482 + /* Unqueue and drop the lock. */
1483 + unqueue_me_pi(&q);
1484 + }
1485 +
1486 +- if (pi_state) {
1487 +- rt_mutex_futex_unlock(&pi_state->pi_mutex);
1488 +- put_pi_state(pi_state);
1489 +- }
1490 +-
1491 + if (ret == -EINTR) {
1492 + /*
1493 + * We've already been requeued, but cannot restart by calling
1494 +diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
1495 +index 71c554a9e17f1..ed1d8959e7149 100644
1496 +--- a/kernel/locking/rtmutex.c
1497 ++++ b/kernel/locking/rtmutex.c
1498 +@@ -1719,8 +1719,7 @@ void rt_mutex_init_proxy_locked(struct rt_mutex *lock,
1499 + * possible because it belongs to the pi_state which is about to be freed
1500 + * and it is not longer visible to other tasks.
1501 + */
1502 +-void rt_mutex_proxy_unlock(struct rt_mutex *lock,
1503 +- struct task_struct *proxy_owner)
1504 ++void rt_mutex_proxy_unlock(struct rt_mutex *lock)
1505 + {
1506 + debug_rt_mutex_proxy_unlock(lock);
1507 + rt_mutex_set_owner(lock, NULL);
1508 +diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h
1509 +index 68686b3ec3c17..4d27cb0d9d8a4 100644
1510 +--- a/kernel/locking/rtmutex_common.h
1511 ++++ b/kernel/locking/rtmutex_common.h
1512 +@@ -132,8 +132,7 @@ enum rtmutex_chainwalk {
1513 + extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock);
1514 + extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock,
1515 + struct task_struct *proxy_owner);
1516 +-extern void rt_mutex_proxy_unlock(struct rt_mutex *lock,
1517 +- struct task_struct *proxy_owner);
1518 ++extern void rt_mutex_proxy_unlock(struct rt_mutex *lock);
1519 + extern void rt_mutex_init_waiter(struct rt_mutex_waiter *waiter);
1520 + extern int __rt_mutex_start_proxy_lock(struct rt_mutex *lock,
1521 + struct rt_mutex_waiter *waiter,
1522 +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
1523 +index 8082328eb01a4..d929c0afbacca 100644
1524 +--- a/kernel/trace/ring_buffer.c
1525 ++++ b/kernel/trace/ring_buffer.c
1526 +@@ -4262,6 +4262,8 @@ void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu)
1527 +
1528 + if (!cpumask_test_cpu(cpu, buffer->cpumask))
1529 + return;
1530 ++ /* prevent another thread from changing buffer sizes */
1531 ++ mutex_lock(&buffer->mutex);
1532 +
1533 + atomic_inc(&buffer->resize_disabled);
1534 + atomic_inc(&cpu_buffer->record_disabled);
1535 +@@ -4285,6 +4287,8 @@ void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu)
1536 +
1537 + atomic_dec(&cpu_buffer->record_disabled);
1538 + atomic_dec(&buffer->resize_disabled);
1539 ++
1540 ++ mutex_unlock(&buffer->mutex);
1541 + }
1542 + EXPORT_SYMBOL_GPL(ring_buffer_reset_cpu);
1543 +
1544 +diff --git a/mm/slub.c b/mm/slub.c
1545 +index 6e7e8106e9a64..f1b4d4dc3bb3b 100644
1546 +--- a/mm/slub.c
1547 ++++ b/mm/slub.c
1548 +@@ -5755,10 +5755,8 @@ static int sysfs_slab_add(struct kmem_cache *s)
1549 +
1550 + s->kobj.kset = kset;
1551 + err = kobject_init_and_add(&s->kobj, &slab_ktype, NULL, "%s", name);
1552 +- if (err) {
1553 +- kobject_put(&s->kobj);
1554 ++ if (err)
1555 + goto out;
1556 +- }
1557 +
1558 + err = sysfs_create_group(&s->kobj, &slab_attr_group);
1559 + if (err)
1560 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
1561 +index a1e17c8d80a6e..82ffadff1e9c0 100644
1562 +--- a/net/core/skbuff.c
1563 ++++ b/net/core/skbuff.c
1564 +@@ -398,7 +398,11 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len,
1565 +
1566 + len += NET_SKB_PAD;
1567 +
1568 +- if ((len > SKB_WITH_OVERHEAD(PAGE_SIZE)) ||
1569 ++ /* If requested length is either too small or too big,
1570 ++ * we use kmalloc() for skb->head allocation.
1571 ++ */
1572 ++ if (len <= SKB_WITH_OVERHEAD(1024) ||
1573 ++ len > SKB_WITH_OVERHEAD(PAGE_SIZE) ||
1574 + (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) {
1575 + skb = __alloc_skb(len, gfp_mask, SKB_ALLOC_RX, NUMA_NO_NODE);
1576 + if (!skb)
1577 +diff --git a/net/ipv4/netfilter/ipt_rpfilter.c b/net/ipv4/netfilter/ipt_rpfilter.c
1578 +index 341d1bd637af2..6b8908e1e0baf 100644
1579 +--- a/net/ipv4/netfilter/ipt_rpfilter.c
1580 ++++ b/net/ipv4/netfilter/ipt_rpfilter.c
1581 +@@ -94,7 +94,7 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par)
1582 + flow.saddr = rpfilter_get_saddr(iph->daddr);
1583 + flow.flowi4_oif = 0;
1584 + flow.flowi4_mark = info->flags & XT_RPFILTER_VALID_MARK ? skb->mark : 0;
1585 +- flow.flowi4_tos = RT_TOS(iph->tos);
1586 ++ flow.flowi4_tos = iph->tos & IPTOS_RT_MASK;
1587 + flow.flowi4_scope = RT_SCOPE_UNIVERSE;
1588 + flow.flowi4_oif = l3mdev_master_ifindex_rcu(xt_in(par));
1589 +
1590 +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
1591 +index f335dd4c84e2d..8f298f27f6ecf 100644
1592 +--- a/net/ipv4/udp.c
1593 ++++ b/net/ipv4/udp.c
1594 +@@ -2321,7 +2321,8 @@ int udp_v4_early_demux(struct sk_buff *skb)
1595 + */
1596 + if (!inet_sk(sk)->inet_daddr && in_dev)
1597 + return ip_mc_validate_source(skb, iph->daddr,
1598 +- iph->saddr, iph->tos,
1599 ++ iph->saddr,
1600 ++ iph->tos & IPTOS_RT_MASK,
1601 + skb->dev, in_dev, &itag);
1602 + }
1603 + return 0;
1604 +diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
1605 +index e58fdefcd2ca2..e47d5047d5373 100644
1606 +--- a/net/ipv6/addrconf.c
1607 ++++ b/net/ipv6/addrconf.c
1608 +@@ -2356,6 +2356,7 @@ static void addrconf_add_mroute(struct net_device *dev)
1609 + .fc_dst_len = 8,
1610 + .fc_flags = RTF_UP,
1611 + .fc_nlinfo.nl_net = dev_net(dev),
1612 ++ .fc_protocol = RTPROT_KERNEL,
1613 + };
1614 +
1615 + ipv6_addr_set(&cfg.fc_dst, htonl(0xFF000000), 0, 0, 0);
1616 +diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
1617 +index c2d2c054a4e49..5b119efb20eee 100644
1618 +--- a/net/sched/cls_tcindex.c
1619 ++++ b/net/sched/cls_tcindex.c
1620 +@@ -357,9 +357,13 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
1621 + if (tb[TCA_TCINDEX_MASK])
1622 + cp->mask = nla_get_u16(tb[TCA_TCINDEX_MASK]);
1623 +
1624 +- if (tb[TCA_TCINDEX_SHIFT])
1625 ++ if (tb[TCA_TCINDEX_SHIFT]) {
1626 + cp->shift = nla_get_u32(tb[TCA_TCINDEX_SHIFT]);
1627 +-
1628 ++ if (cp->shift > 16) {
1629 ++ err = -EINVAL;
1630 ++ goto errout;
1631 ++ }
1632 ++ }
1633 + if (!cp->hash) {
1634 + /* Hash not specified, use perfect hash if the upper limit
1635 + * of the hashing index is below the threshold.
1636 +diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c
1637 +index c939459172353..247b68790a522 100644
1638 +--- a/sound/core/seq/oss/seq_oss_synth.c
1639 ++++ b/sound/core/seq/oss/seq_oss_synth.c
1640 +@@ -624,7 +624,8 @@ snd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_in
1641 +
1642 + if (info->is_midi) {
1643 + struct midi_info minf;
1644 +- snd_seq_oss_midi_make_info(dp, info->midi_mapped, &minf);
1645 ++ if (snd_seq_oss_midi_make_info(dp, info->midi_mapped, &minf))
1646 ++ return -ENXIO;
1647 + inf->synth_type = SYNTH_TYPE_MIDI;
1648 + inf->synth_subtype = 0;
1649 + inf->nr_voices = 16;
1650 +diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
1651 +index fc30d1e8aa76a..9dd104c308e1d 100644
1652 +--- a/sound/pci/hda/patch_via.c
1653 ++++ b/sound/pci/hda/patch_via.c
1654 +@@ -135,6 +135,7 @@ static struct via_spec *via_new_spec(struct hda_codec *codec)
1655 + spec->codec_type = VT1708S;
1656 + spec->gen.indep_hp = 1;
1657 + spec->gen.keep_eapd_on = 1;
1658 ++ spec->gen.dac_min_mute = 1;
1659 + spec->gen.pcm_playback_hook = via_playback_pcm_hook;
1660 + spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1661 + codec->power_save_node = 1;
1662 +diff --git a/sound/soc/intel/boards/haswell.c b/sound/soc/intel/boards/haswell.c
1663 +index 8158409921e02..c6007aa95fff1 100644
1664 +--- a/sound/soc/intel/boards/haswell.c
1665 ++++ b/sound/soc/intel/boards/haswell.c
1666 +@@ -197,6 +197,7 @@ static struct platform_driver haswell_audio = {
1667 + .probe = haswell_audio_probe,
1668 + .driver = {
1669 + .name = "haswell-audio",
1670 ++ .pm = &snd_soc_pm_ops,
1671 + },
1672 + };
1673 +