Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.4 commit in: /
Date: Wed, 02 Mar 2022 13:07:17
Message-Id: 1646226421.ab81be9d1323691b1f9aae81aad30ee63c6c4fdf.mpagano@gentoo
1 commit: ab81be9d1323691b1f9aae81aad30ee63c6c4fdf
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 2 13:07:01 2022 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 2 13:07:01 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=ab81be9d
7
8 Linux patch 5.4.182
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1181_linux-5.4.182.patch | 2110 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2114 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 7ddf9a06..8974b331 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -767,6 +767,10 @@ Patch: 1180_linux-5.4.181.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.4.181
23
24 +Patch: 1181_linux-5.4.182.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.4.182
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/1181_linux-5.4.182.patch b/1181_linux-5.4.182.patch
33 new file mode 100644
34 index 00000000..286bae77
35 --- /dev/null
36 +++ b/1181_linux-5.4.182.patch
37 @@ -0,0 +1,2110 @@
38 +diff --git a/Makefile b/Makefile
39 +index afe2420bb3de0..8750309fc42ac 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 5
45 + PATCHLEVEL = 4
46 +-SUBLEVEL = 181
47 ++SUBLEVEL = 182
48 + EXTRAVERSION =
49 + NAME = Kleptomaniac Octopus
50 +
51 +diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c
52 +index 237d20dd5622d..286cec4d86d7b 100644
53 +--- a/arch/parisc/kernel/unaligned.c
54 ++++ b/arch/parisc/kernel/unaligned.c
55 +@@ -340,7 +340,7 @@ static int emulate_stw(struct pt_regs *regs, int frreg, int flop)
56 + : "r" (val), "r" (regs->ior), "r" (regs->isr)
57 + : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER );
58 +
59 +- return 0;
60 ++ return ret;
61 + }
62 + static int emulate_std(struct pt_regs *regs, int frreg, int flop)
63 + {
64 +@@ -397,7 +397,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
65 + __asm__ __volatile__ (
66 + " mtsp %4, %%sr1\n"
67 + " zdep %2, 29, 2, %%r19\n"
68 +-" dep %%r0, 31, 2, %2\n"
69 ++" dep %%r0, 31, 2, %3\n"
70 + " mtsar %%r19\n"
71 + " zvdepi -2, 32, %%r19\n"
72 + "1: ldw 0(%%sr1,%3),%%r20\n"
73 +@@ -409,7 +409,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop)
74 + " andcm %%r21, %%r19, %%r21\n"
75 + " or %1, %%r20, %1\n"
76 + " or %2, %%r21, %2\n"
77 +-"3: stw %1,0(%%sr1,%1)\n"
78 ++"3: stw %1,0(%%sr1,%3)\n"
79 + "4: stw %%r1,4(%%sr1,%3)\n"
80 + "5: stw %2,8(%%sr1,%3)\n"
81 + " copy %%r0, %0\n"
82 +@@ -596,7 +596,6 @@ void handle_unaligned(struct pt_regs *regs)
83 + ret = ERR_NOTHANDLED; /* "undefined", but lets kill them. */
84 + break;
85 + }
86 +-#ifdef CONFIG_PA20
87 + switch (regs->iir & OPCODE2_MASK)
88 + {
89 + case OPCODE_FLDD_L:
90 +@@ -607,22 +606,23 @@ void handle_unaligned(struct pt_regs *regs)
91 + flop=1;
92 + ret = emulate_std(regs, R2(regs->iir),1);
93 + break;
94 ++#ifdef CONFIG_PA20
95 + case OPCODE_LDD_L:
96 + ret = emulate_ldd(regs, R2(regs->iir),0);
97 + break;
98 + case OPCODE_STD_L:
99 + ret = emulate_std(regs, R2(regs->iir),0);
100 + break;
101 +- }
102 + #endif
103 ++ }
104 + switch (regs->iir & OPCODE3_MASK)
105 + {
106 + case OPCODE_FLDW_L:
107 + flop=1;
108 +- ret = emulate_ldw(regs, R2(regs->iir),0);
109 ++ ret = emulate_ldw(regs, R2(regs->iir), 1);
110 + break;
111 + case OPCODE_LDW_M:
112 +- ret = emulate_ldw(regs, R2(regs->iir),1);
113 ++ ret = emulate_ldw(regs, R2(regs->iir), 0);
114 + break;
115 +
116 + case OPCODE_FSTW_L:
117 +diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h
118 +index 03b3de491b5e6..5ed702e2c55f4 100644
119 +--- a/arch/x86/include/asm/fpu/internal.h
120 ++++ b/arch/x86/include/asm/fpu/internal.h
121 +@@ -560,9 +560,11 @@ static inline void __fpregs_load_activate(void)
122 + * The FPU context is only stored/restored for a user task and
123 + * PF_KTHREAD is used to distinguish between kernel and user threads.
124 + */
125 +-static inline void switch_fpu_prepare(struct fpu *old_fpu, int cpu)
126 ++static inline void switch_fpu_prepare(struct task_struct *prev, int cpu)
127 + {
128 +- if (static_cpu_has(X86_FEATURE_FPU) && !(current->flags & PF_KTHREAD)) {
129 ++ struct fpu *old_fpu = &prev->thread.fpu;
130 ++
131 ++ if (static_cpu_has(X86_FEATURE_FPU) && !(prev->flags & PF_KTHREAD)) {
132 + if (!copy_fpregs_to_fpstate(old_fpu))
133 + old_fpu->last_cpu = -1;
134 + else
135 +@@ -581,10 +583,11 @@ static inline void switch_fpu_prepare(struct fpu *old_fpu, int cpu)
136 + * Load PKRU from the FPU context if available. Delay loading of the
137 + * complete FPU state until the return to userland.
138 + */
139 +-static inline void switch_fpu_finish(struct fpu *new_fpu)
140 ++static inline void switch_fpu_finish(struct task_struct *next)
141 + {
142 + u32 pkru_val = init_pkru_value;
143 + struct pkru_state *pk;
144 ++ struct fpu *next_fpu = &next->thread.fpu;
145 +
146 + if (!static_cpu_has(X86_FEATURE_FPU))
147 + return;
148 +@@ -598,7 +601,7 @@ static inline void switch_fpu_finish(struct fpu *new_fpu)
149 + * PKRU state is switched eagerly because it needs to be valid before we
150 + * return to userland e.g. for a copy_to_user() operation.
151 + */
152 +- if (!(current->flags & PF_KTHREAD)) {
153 ++ if (!(next->flags & PF_KTHREAD)) {
154 + /*
155 + * If the PKRU bit in xsave.header.xfeatures is not set,
156 + * then the PKRU component was in init state, which means
157 +@@ -607,7 +610,7 @@ static inline void switch_fpu_finish(struct fpu *new_fpu)
158 + * in memory is not valid. This means pkru_val has to be
159 + * set to 0 and not to init_pkru_value.
160 + */
161 +- pk = get_xsave_addr(&new_fpu->state.xsave, XFEATURE_PKRU);
162 ++ pk = get_xsave_addr(&next_fpu->state.xsave, XFEATURE_PKRU);
163 + pkru_val = pk ? pk->pkru : 0;
164 + }
165 + __write_pkru(pkru_val);
166 +diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
167 +index b8ceec4974fe3..352f876950ab3 100644
168 +--- a/arch/x86/kernel/process_32.c
169 ++++ b/arch/x86/kernel/process_32.c
170 +@@ -229,14 +229,12 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
171 + {
172 + struct thread_struct *prev = &prev_p->thread,
173 + *next = &next_p->thread;
174 +- struct fpu *prev_fpu = &prev->fpu;
175 +- struct fpu *next_fpu = &next->fpu;
176 + int cpu = smp_processor_id();
177 +
178 + /* never put a printk in __switch_to... printk() calls wake_up*() indirectly */
179 +
180 + if (!test_thread_flag(TIF_NEED_FPU_LOAD))
181 +- switch_fpu_prepare(prev_fpu, cpu);
182 ++ switch_fpu_prepare(prev_p, cpu);
183 +
184 + /*
185 + * Save away %gs. No need to save %fs, as it was saved on the
186 +@@ -292,7 +290,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
187 +
188 + this_cpu_write(current_task, next_p);
189 +
190 +- switch_fpu_finish(next_fpu);
191 ++ switch_fpu_finish(next_p);
192 +
193 + /* Load the Intel cache allocation PQR MSR. */
194 + resctrl_sched_in();
195 +diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
196 +index da3cc3a10d63f..633788362906a 100644
197 +--- a/arch/x86/kernel/process_64.c
198 ++++ b/arch/x86/kernel/process_64.c
199 +@@ -505,15 +505,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
200 + {
201 + struct thread_struct *prev = &prev_p->thread;
202 + struct thread_struct *next = &next_p->thread;
203 +- struct fpu *prev_fpu = &prev->fpu;
204 +- struct fpu *next_fpu = &next->fpu;
205 + int cpu = smp_processor_id();
206 +
207 + WARN_ON_ONCE(IS_ENABLED(CONFIG_DEBUG_ENTRY) &&
208 + this_cpu_read(irq_count) != -1);
209 +
210 + if (!test_thread_flag(TIF_NEED_FPU_LOAD))
211 +- switch_fpu_prepare(prev_fpu, cpu);
212 ++ switch_fpu_prepare(prev_p, cpu);
213 +
214 + /* We must save %fs and %gs before load_TLS() because
215 + * %fs and %gs may be cleared by load_TLS().
216 +@@ -565,7 +563,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
217 + this_cpu_write(current_task, next_p);
218 + this_cpu_write(cpu_current_top_of_stack, task_top_of_stack(next_p));
219 +
220 +- switch_fpu_finish(next_fpu);
221 ++ switch_fpu_finish(next_p);
222 +
223 + /* Reload sp0. */
224 + update_task_stack(next_p);
225 +diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
226 +index fad6c6a873130..499a947d56ddb 100644
227 +--- a/drivers/ata/pata_hpt37x.c
228 ++++ b/drivers/ata/pata_hpt37x.c
229 +@@ -917,6 +917,20 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
230 + irqmask &= ~0x10;
231 + pci_write_config_byte(dev, 0x5a, irqmask);
232 +
233 ++ /*
234 ++ * HPT371 chips physically have only one channel, the secondary one,
235 ++ * but the primary channel registers do exist! Go figure...
236 ++ * So, we manually disable the non-existing channel here
237 ++ * (if the BIOS hasn't done this already).
238 ++ */
239 ++ if (dev->device == PCI_DEVICE_ID_TTI_HPT371) {
240 ++ u8 mcr1;
241 ++
242 ++ pci_read_config_byte(dev, 0x50, &mcr1);
243 ++ mcr1 &= ~0x04;
244 ++ pci_write_config_byte(dev, 0x50, mcr1);
245 ++ }
246 ++
247 + /*
248 + * default to pci clock. make sure MA15/16 are set to output
249 + * to prevent drives having problems with 40-pin cables. Needed
250 +diff --git a/drivers/clk/ingenic/jz4725b-cgu.c b/drivers/clk/ingenic/jz4725b-cgu.c
251 +index a3b4635f62784..97afabb7fe8e5 100644
252 +--- a/drivers/clk/ingenic/jz4725b-cgu.c
253 ++++ b/drivers/clk/ingenic/jz4725b-cgu.c
254 +@@ -135,11 +135,10 @@ static const struct ingenic_cgu_clk_info jz4725b_cgu_clocks[] = {
255 + },
256 +
257 + [JZ4725B_CLK_I2S] = {
258 +- "i2s", CGU_CLK_MUX | CGU_CLK_DIV | CGU_CLK_GATE,
259 ++ "i2s", CGU_CLK_MUX | CGU_CLK_DIV,
260 + .parents = { JZ4725B_CLK_EXT, JZ4725B_CLK_PLL_HALF, -1, -1 },
261 + .mux = { CGU_REG_CPCCR, 31, 1 },
262 + .div = { CGU_REG_I2SCDR, 0, 1, 9, -1, -1, -1 },
263 +- .gate = { CGU_REG_CLKGR, 6 },
264 + },
265 +
266 + [JZ4725B_CLK_SPI] = {
267 +diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
268 +index a9058fda187e3..a41e1ddf9e6fc 100644
269 +--- a/drivers/gpio/gpio-tegra186.c
270 ++++ b/drivers/gpio/gpio-tegra186.c
271 +@@ -234,9 +234,12 @@ static int tegra186_gpio_of_xlate(struct gpio_chip *chip,
272 + return offset + pin;
273 + }
274 +
275 ++#define to_tegra_gpio(x) container_of((x), struct tegra_gpio, gpio)
276 ++
277 + static void tegra186_irq_ack(struct irq_data *data)
278 + {
279 +- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
280 ++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
281 ++ struct tegra_gpio *gpio = to_tegra_gpio(gc);
282 + void __iomem *base;
283 +
284 + base = tegra186_gpio_get_base(gpio, data->hwirq);
285 +@@ -248,7 +251,8 @@ static void tegra186_irq_ack(struct irq_data *data)
286 +
287 + static void tegra186_irq_mask(struct irq_data *data)
288 + {
289 +- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
290 ++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
291 ++ struct tegra_gpio *gpio = to_tegra_gpio(gc);
292 + void __iomem *base;
293 + u32 value;
294 +
295 +@@ -263,7 +267,8 @@ static void tegra186_irq_mask(struct irq_data *data)
296 +
297 + static void tegra186_irq_unmask(struct irq_data *data)
298 + {
299 +- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
300 ++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
301 ++ struct tegra_gpio *gpio = to_tegra_gpio(gc);
302 + void __iomem *base;
303 + u32 value;
304 +
305 +@@ -278,7 +283,8 @@ static void tegra186_irq_unmask(struct irq_data *data)
306 +
307 + static int tegra186_irq_set_type(struct irq_data *data, unsigned int type)
308 + {
309 +- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
310 ++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
311 ++ struct tegra_gpio *gpio = to_tegra_gpio(gc);
312 + void __iomem *base;
313 + u32 value;
314 +
315 +diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
316 +index 6ff1d308623a7..b368496ed6858 100644
317 +--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
318 ++++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
319 +@@ -1143,8 +1143,11 @@ static int soc15_common_early_init(void *handle)
320 + AMD_CG_SUPPORT_SDMA_MGCG |
321 + AMD_CG_SUPPORT_SDMA_LS;
322 +
323 ++ /*
324 ++ * MMHUB PG needs to be disabled for Picasso for
325 ++ * stability reasons.
326 ++ */
327 + adev->pg_flags = AMD_PG_SUPPORT_SDMA |
328 +- AMD_PG_SUPPORT_MMHUB |
329 + AMD_PG_SUPPORT_VCN;
330 + } else {
331 + adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
332 +diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
333 +index 9b69e55ad7010..3f0a798906004 100644
334 +--- a/drivers/gpu/drm/drm_edid.c
335 ++++ b/drivers/gpu/drm/drm_edid.c
336 +@@ -4659,6 +4659,7 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi
337 + if (!(edid->input & DRM_EDID_INPUT_DIGITAL))
338 + return quirks;
339 +
340 ++ info->color_formats |= DRM_COLOR_FORMAT_RGB444;
341 + drm_parse_cea_ext(connector, edid);
342 +
343 + /*
344 +@@ -4707,7 +4708,6 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi
345 + DRM_DEBUG("%s: Assigning EDID-1.4 digital sink color depth as %d bpc.\n",
346 + connector->name, info->bpc);
347 +
348 +- info->color_formats |= DRM_COLOR_FORMAT_RGB444;
349 + if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444)
350 + info->color_formats |= DRM_COLOR_FORMAT_YCRCB444;
351 + if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB422)
352 +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
353 +index 105b4be467a3e..ea2e11771bca5 100644
354 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
355 ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
356 +@@ -88,13 +88,20 @@ nvkm_pmu_fini(struct nvkm_subdev *subdev, bool suspend)
357 + return 0;
358 + }
359 +
360 +-static void
361 ++static int
362 + nvkm_pmu_reset(struct nvkm_pmu *pmu)
363 + {
364 + struct nvkm_device *device = pmu->subdev.device;
365 +
366 + if (!pmu->func->enabled(pmu))
367 +- return;
368 ++ return 0;
369 ++
370 ++ /* Inhibit interrupts, and wait for idle. */
371 ++ nvkm_wr32(device, 0x10a014, 0x0000ffff);
372 ++ nvkm_msec(device, 2000,
373 ++ if (!nvkm_rd32(device, 0x10a04c))
374 ++ break;
375 ++ );
376 +
377 + /* Reset. */
378 + if (pmu->func->reset)
379 +@@ -105,37 +112,25 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu)
380 + if (!(nvkm_rd32(device, 0x10a10c) & 0x00000006))
381 + break;
382 + );
383 ++
384 ++ return 0;
385 + }
386 +
387 + static int
388 + nvkm_pmu_preinit(struct nvkm_subdev *subdev)
389 + {
390 + struct nvkm_pmu *pmu = nvkm_pmu(subdev);
391 +- nvkm_pmu_reset(pmu);
392 +- return 0;
393 ++ return nvkm_pmu_reset(pmu);
394 + }
395 +
396 + static int
397 + nvkm_pmu_init(struct nvkm_subdev *subdev)
398 + {
399 + struct nvkm_pmu *pmu = nvkm_pmu(subdev);
400 +- struct nvkm_device *device = pmu->subdev.device;
401 +-
402 +- if (!pmu->func->init)
403 +- return 0;
404 +-
405 +- if (pmu->func->enabled(pmu)) {
406 +- /* Inhibit interrupts, and wait for idle. */
407 +- nvkm_wr32(device, 0x10a014, 0x0000ffff);
408 +- nvkm_msec(device, 2000,
409 +- if (!nvkm_rd32(device, 0x10a04c))
410 +- break;
411 +- );
412 +-
413 +- nvkm_pmu_reset(pmu);
414 +- }
415 +-
416 +- return pmu->func->init(pmu);
417 ++ int ret = nvkm_pmu_reset(pmu);
418 ++ if (ret == 0 && pmu->func->init)
419 ++ ret = pmu->func->init(pmu);
420 ++ return ret;
421 + }
422 +
423 + static int
424 +diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
425 +index bcdf25f32e220..a05d55125d13a 100644
426 +--- a/drivers/iio/accel/bmc150-accel-core.c
427 ++++ b/drivers/iio/accel/bmc150-accel-core.c
428 +@@ -1649,11 +1649,14 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
429 + ret = iio_device_register(indio_dev);
430 + if (ret < 0) {
431 + dev_err(dev, "Unable to register iio device\n");
432 +- goto err_trigger_unregister;
433 ++ goto err_pm_cleanup;
434 + }
435 +
436 + return 0;
437 +
438 ++err_pm_cleanup:
439 ++ pm_runtime_dont_use_autosuspend(dev);
440 ++ pm_runtime_disable(dev);
441 + err_trigger_unregister:
442 + bmc150_accel_unregister_triggers(data, BMC150_ACCEL_TRIGGERS - 1);
443 + err_buffer_cleanup:
444 +diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
445 +index 6ff6f625bbf69..bd762976a3815 100644
446 +--- a/drivers/iio/accel/kxcjk-1013.c
447 ++++ b/drivers/iio/accel/kxcjk-1013.c
448 +@@ -1409,11 +1409,14 @@ static int kxcjk1013_probe(struct i2c_client *client,
449 + ret = iio_device_register(indio_dev);
450 + if (ret < 0) {
451 + dev_err(&client->dev, "unable to register iio device\n");
452 +- goto err_buffer_cleanup;
453 ++ goto err_pm_cleanup;
454 + }
455 +
456 + return 0;
457 +
458 ++err_pm_cleanup:
459 ++ pm_runtime_dont_use_autosuspend(&client->dev);
460 ++ pm_runtime_disable(&client->dev);
461 + err_buffer_cleanup:
462 + iio_triggered_buffer_cleanup(indio_dev);
463 + err_trigger_unregister:
464 +diff --git a/drivers/iio/accel/mma9551.c b/drivers/iio/accel/mma9551.c
465 +index 99e4a21ca9421..8315c7ee66cf3 100644
466 +--- a/drivers/iio/accel/mma9551.c
467 ++++ b/drivers/iio/accel/mma9551.c
468 +@@ -496,11 +496,14 @@ static int mma9551_probe(struct i2c_client *client,
469 + ret = iio_device_register(indio_dev);
470 + if (ret < 0) {
471 + dev_err(&client->dev, "unable to register iio device\n");
472 +- goto out_poweroff;
473 ++ goto err_pm_cleanup;
474 + }
475 +
476 + return 0;
477 +
478 ++err_pm_cleanup:
479 ++ pm_runtime_dont_use_autosuspend(&client->dev);
480 ++ pm_runtime_disable(&client->dev);
481 + out_poweroff:
482 + mma9551_set_device_state(client, false);
483 +
484 +diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c
485 +index 312070dcf035a..73e85196d0bd3 100644
486 +--- a/drivers/iio/accel/mma9553.c
487 ++++ b/drivers/iio/accel/mma9553.c
488 +@@ -1135,12 +1135,15 @@ static int mma9553_probe(struct i2c_client *client,
489 + ret = iio_device_register(indio_dev);
490 + if (ret < 0) {
491 + dev_err(&client->dev, "unable to register iio device\n");
492 +- goto out_poweroff;
493 ++ goto err_pm_cleanup;
494 + }
495 +
496 + dev_dbg(&indio_dev->dev, "Registered device %s\n", name);
497 + return 0;
498 +
499 ++err_pm_cleanup:
500 ++ pm_runtime_dont_use_autosuspend(&client->dev);
501 ++ pm_runtime_disable(&client->dev);
502 + out_poweroff:
503 + mma9551_set_device_state(client, false);
504 + return ret;
505 +diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c
506 +index fa808f9c0d9af..635cc1e7b1234 100644
507 +--- a/drivers/iio/adc/ad7124.c
508 ++++ b/drivers/iio/adc/ad7124.c
509 +@@ -63,7 +63,7 @@
510 + #define AD7124_CONFIG_REF_SEL(x) FIELD_PREP(AD7124_CONFIG_REF_SEL_MSK, x)
511 + #define AD7124_CONFIG_PGA_MSK GENMASK(2, 0)
512 + #define AD7124_CONFIG_PGA(x) FIELD_PREP(AD7124_CONFIG_PGA_MSK, x)
513 +-#define AD7124_CONFIG_IN_BUFF_MSK GENMASK(7, 6)
514 ++#define AD7124_CONFIG_IN_BUFF_MSK GENMASK(6, 5)
515 + #define AD7124_CONFIG_IN_BUFF(x) FIELD_PREP(AD7124_CONFIG_IN_BUFF_MSK, x)
516 +
517 + /* AD7124_FILTER_X */
518 +diff --git a/drivers/iio/adc/men_z188_adc.c b/drivers/iio/adc/men_z188_adc.c
519 +index 3b2fbb7ce4310..26caee73b7641 100644
520 +--- a/drivers/iio/adc/men_z188_adc.c
521 ++++ b/drivers/iio/adc/men_z188_adc.c
522 +@@ -103,6 +103,7 @@ static int men_z188_probe(struct mcb_device *dev,
523 + struct z188_adc *adc;
524 + struct iio_dev *indio_dev;
525 + struct resource *mem;
526 ++ int ret;
527 +
528 + indio_dev = devm_iio_device_alloc(&dev->dev, sizeof(struct z188_adc));
529 + if (!indio_dev)
530 +@@ -129,8 +130,14 @@ static int men_z188_probe(struct mcb_device *dev,
531 + adc->mem = mem;
532 + mcb_set_drvdata(dev, indio_dev);
533 +
534 +- return iio_device_register(indio_dev);
535 ++ ret = iio_device_register(indio_dev);
536 ++ if (ret)
537 ++ goto err_unmap;
538 ++
539 ++ return 0;
540 +
541 ++err_unmap:
542 ++ iounmap(adc->base);
543 + err:
544 + mcb_release_mem(mem);
545 + return -ENXIO;
546 +diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c
547 +index 276bed47e8d66..bf1355360c518 100644
548 +--- a/drivers/iio/gyro/bmg160_core.c
549 ++++ b/drivers/iio/gyro/bmg160_core.c
550 +@@ -1173,11 +1173,14 @@ int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq,
551 + ret = iio_device_register(indio_dev);
552 + if (ret < 0) {
553 + dev_err(dev, "unable to register iio device\n");
554 +- goto err_buffer_cleanup;
555 ++ goto err_pm_cleanup;
556 + }
557 +
558 + return 0;
559 +
560 ++err_pm_cleanup:
561 ++ pm_runtime_dont_use_autosuspend(dev);
562 ++ pm_runtime_disable(dev);
563 + err_buffer_cleanup:
564 + iio_triggered_buffer_cleanup(indio_dev);
565 + err_trigger_unregister:
566 +diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c
567 +index e67466100aff4..c7d19f9ca7652 100644
568 +--- a/drivers/iio/imu/kmx61.c
569 ++++ b/drivers/iio/imu/kmx61.c
570 +@@ -1393,7 +1393,7 @@ static int kmx61_probe(struct i2c_client *client,
571 + ret = iio_device_register(data->acc_indio_dev);
572 + if (ret < 0) {
573 + dev_err(&client->dev, "Failed to register acc iio device\n");
574 +- goto err_buffer_cleanup_mag;
575 ++ goto err_pm_cleanup;
576 + }
577 +
578 + ret = iio_device_register(data->mag_indio_dev);
579 +@@ -1406,6 +1406,9 @@ static int kmx61_probe(struct i2c_client *client,
580 +
581 + err_iio_unregister_acc:
582 + iio_device_unregister(data->acc_indio_dev);
583 ++err_pm_cleanup:
584 ++ pm_runtime_dont_use_autosuspend(&client->dev);
585 ++ pm_runtime_disable(&client->dev);
586 + err_buffer_cleanup_mag:
587 + if (client->irq > 0)
588 + iio_triggered_buffer_cleanup(data->mag_indio_dev);
589 +diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c
590 +index 087dc16c2185c..ef8f429cc96f0 100644
591 +--- a/drivers/iio/magnetometer/bmc150_magn.c
592 ++++ b/drivers/iio/magnetometer/bmc150_magn.c
593 +@@ -944,13 +944,14 @@ int bmc150_magn_probe(struct device *dev, struct regmap *regmap,
594 + ret = iio_device_register(indio_dev);
595 + if (ret < 0) {
596 + dev_err(dev, "unable to register iio device\n");
597 +- goto err_disable_runtime_pm;
598 ++ goto err_pm_cleanup;
599 + }
600 +
601 + dev_dbg(dev, "Registered device %s\n", name);
602 + return 0;
603 +
604 +-err_disable_runtime_pm:
605 ++err_pm_cleanup:
606 ++ pm_runtime_dont_use_autosuspend(dev);
607 + pm_runtime_disable(dev);
608 + err_buffer_cleanup:
609 + iio_triggered_buffer_cleanup(indio_dev);
610 +diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
611 +index 8708ed5477e99..dac806b715afa 100644
612 +--- a/drivers/infiniband/ulp/srp/ib_srp.c
613 ++++ b/drivers/infiniband/ulp/srp/ib_srp.c
614 +@@ -4222,9 +4222,11 @@ static void srp_remove_one(struct ib_device *device, void *client_data)
615 + spin_unlock(&host->target_lock);
616 +
617 + /*
618 +- * Wait for tl_err and target port removal tasks.
619 ++ * srp_queue_remove_work() queues a call to
620 ++ * srp_remove_target(). The latter function cancels
621 ++ * target->tl_err_work so waiting for the remove works to
622 ++ * finish is sufficient.
623 + */
624 +- flush_workqueue(system_long_wq);
625 + flush_workqueue(srp_remove_wq);
626 +
627 + kfree(host);
628 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
629 +index e3dc2cbdc9f6c..e92cc60eade3f 100644
630 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
631 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
632 +@@ -1683,7 +1683,7 @@ static int mlx5e_get_module_eeprom(struct net_device *netdev,
633 + if (size_read < 0) {
634 + netdev_err(priv->netdev, "%s: mlx5_query_eeprom failed:0x%x\n",
635 + __func__, size_read);
636 +- return 0;
637 ++ return size_read;
638 + }
639 +
640 + i += size_read;
641 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
642 +index 7cc80dc4e6d89..31c832e5256e8 100644
643 +--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
644 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
645 +@@ -1977,10 +1977,6 @@ esw_check_vport_match_metadata_supported(const struct mlx5_eswitch *esw)
646 + if (!MLX5_CAP_ESW_FLOWTABLE(esw->dev, flow_source))
647 + return false;
648 +
649 +- if (mlx5_core_is_ecpf_esw_manager(esw->dev) ||
650 +- mlx5_ecpf_vport_exists(esw->dev))
651 +- return false;
652 +-
653 + return true;
654 + }
655 +
656 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
657 +index 5fe4e028567a9..5baf2c666d293 100644
658 +--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
659 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
660 +@@ -1947,6 +1947,8 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle)
661 + fte->node.del_hw_func = NULL;
662 + up_write_ref_node(&fte->node, false);
663 + tree_put_node(&fte->node, false);
664 ++ } else {
665 ++ up_write_ref_node(&fte->node, false);
666 + }
667 + kfree(handle);
668 + }
669 +diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
670 +index 22beeb5be9c41..c69ffcfe61689 100644
671 +--- a/drivers/net/ethernet/microchip/lan743x_main.c
672 ++++ b/drivers/net/ethernet/microchip/lan743x_main.c
673 +@@ -916,8 +916,7 @@ static int lan743x_phy_reset(struct lan743x_adapter *adapter)
674 + }
675 +
676 + static void lan743x_phy_update_flowcontrol(struct lan743x_adapter *adapter,
677 +- u8 duplex, u16 local_adv,
678 +- u16 remote_adv)
679 ++ u16 local_adv, u16 remote_adv)
680 + {
681 + struct lan743x_phy *phy = &adapter->phy;
682 + u8 cap;
683 +@@ -944,22 +943,17 @@ static void lan743x_phy_link_status_change(struct net_device *netdev)
684 +
685 + phy_print_status(phydev);
686 + if (phydev->state == PHY_RUNNING) {
687 +- struct ethtool_link_ksettings ksettings;
688 + int remote_advertisement = 0;
689 + int local_advertisement = 0;
690 +
691 +- memset(&ksettings, 0, sizeof(ksettings));
692 +- phy_ethtool_get_link_ksettings(netdev, &ksettings);
693 + local_advertisement =
694 + linkmode_adv_to_mii_adv_t(phydev->advertising);
695 + remote_advertisement =
696 + linkmode_adv_to_mii_adv_t(phydev->lp_advertising);
697 +
698 +- lan743x_phy_update_flowcontrol(adapter,
699 +- ksettings.base.duplex,
700 +- local_advertisement,
701 ++ lan743x_phy_update_flowcontrol(adapter, local_advertisement,
702 + remote_advertisement);
703 +- lan743x_ptp_update_latency(adapter, ksettings.base.speed);
704 ++ lan743x_ptp_update_latency(adapter, phydev->speed);
705 + }
706 + }
707 +
708 +diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
709 +index f8c8451919cb6..26772c3310f09 100644
710 +--- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
711 ++++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
712 +@@ -588,8 +588,8 @@ nfp_tunnel_add_shared_mac(struct nfp_app *app, struct net_device *netdev,
713 + int port, bool mod)
714 + {
715 + struct nfp_flower_priv *priv = app->priv;
716 +- int ida_idx = NFP_MAX_MAC_INDEX, err;
717 + struct nfp_tun_offloaded_mac *entry;
718 ++ int ida_idx = -1, err;
719 + u16 nfp_mac_idx = 0;
720 +
721 + entry = nfp_tunnel_lookup_offloaded_macs(app, netdev->dev_addr);
722 +@@ -663,7 +663,7 @@ err_remove_hash:
723 + err_free_entry:
724 + kfree(entry);
725 + err_free_ida:
726 +- if (ida_idx != NFP_MAX_MAC_INDEX)
727 ++ if (ida_idx != -1)
728 + ida_simple_remove(&priv->tun.mac_off_ids, ida_idx);
729 +
730 + return err;
731 +diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
732 +index bddd64e918ce0..a109438f4a78e 100644
733 +--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
734 ++++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
735 +@@ -1345,6 +1345,8 @@ static int temac_probe(struct platform_device *pdev)
736 + lp->indirect_lock = devm_kmalloc(&pdev->dev,
737 + sizeof(*lp->indirect_lock),
738 + GFP_KERNEL);
739 ++ if (!lp->indirect_lock)
740 ++ return -ENOMEM;
741 + spin_lock_init(lp->indirect_lock);
742 + }
743 +
744 +diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
745 +index 8325f6d65dccc..eee402a59f6da 100644
746 +--- a/drivers/net/usb/cdc_ether.c
747 ++++ b/drivers/net/usb/cdc_ether.c
748 +@@ -571,6 +571,11 @@ static const struct usb_device_id products[] = {
749 + .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \
750 + .bInterfaceProtocol = USB_CDC_PROTO_NONE
751 +
752 ++#define ZAURUS_FAKE_INTERFACE \
753 ++ .bInterfaceClass = USB_CLASS_COMM, \
754 ++ .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, \
755 ++ .bInterfaceProtocol = USB_CDC_PROTO_NONE
756 ++
757 + /* SA-1100 based Sharp Zaurus ("collie"), or compatible;
758 + * wire-incompatible with true CDC Ethernet implementations.
759 + * (And, it seems, needlessly so...)
760 +@@ -624,6 +629,13 @@ static const struct usb_device_id products[] = {
761 + .idProduct = 0x9032, /* SL-6000 */
762 + ZAURUS_MASTER_INTERFACE,
763 + .driver_info = 0,
764 ++}, {
765 ++ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
766 ++ | USB_DEVICE_ID_MATCH_DEVICE,
767 ++ .idVendor = 0x04DD,
768 ++ .idProduct = 0x9032, /* SL-6000 */
769 ++ ZAURUS_FAKE_INTERFACE,
770 ++ .driver_info = 0,
771 + }, {
772 + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
773 + | USB_DEVICE_ID_MATCH_DEVICE,
774 +diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c
775 +index e04c8054c2cf3..fce6713e970ba 100644
776 +--- a/drivers/net/usb/sr9700.c
777 ++++ b/drivers/net/usb/sr9700.c
778 +@@ -410,7 +410,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
779 + /* ignore the CRC length */
780 + len = (skb->data[1] | (skb->data[2] << 8)) - 4;
781 +
782 +- if (len > ETH_FRAME_LEN)
783 ++ if (len > ETH_FRAME_LEN || len > skb->len)
784 + return 0;
785 +
786 + /* the last packet of current skb */
787 +diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
788 +index 8e717a0b559b3..7984f2157d222 100644
789 +--- a/drivers/net/usb/zaurus.c
790 ++++ b/drivers/net/usb/zaurus.c
791 +@@ -256,6 +256,11 @@ static const struct usb_device_id products [] = {
792 + .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \
793 + .bInterfaceProtocol = USB_CDC_PROTO_NONE
794 +
795 ++#define ZAURUS_FAKE_INTERFACE \
796 ++ .bInterfaceClass = USB_CLASS_COMM, \
797 ++ .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, \
798 ++ .bInterfaceProtocol = USB_CDC_PROTO_NONE
799 ++
800 + /* SA-1100 based Sharp Zaurus ("collie"), or compatible. */
801 + {
802 + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
803 +@@ -313,6 +318,13 @@ static const struct usb_device_id products [] = {
804 + .idProduct = 0x9032, /* SL-6000 */
805 + ZAURUS_MASTER_INTERFACE,
806 + .driver_info = ZAURUS_PXA_INFO,
807 ++}, {
808 ++ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
809 ++ | USB_DEVICE_ID_MATCH_DEVICE,
810 ++ .idVendor = 0x04DD,
811 ++ .idProduct = 0x9032, /* SL-6000 */
812 ++ ZAURUS_FAKE_INTERFACE,
813 ++ .driver_info = (unsigned long)&bogus_mdlm_info,
814 + }, {
815 + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
816 + | USB_DEVICE_ID_MATCH_DEVICE,
817 +diff --git a/drivers/spi/spi-zynq-qspi.c b/drivers/spi/spi-zynq-qspi.c
818 +index 1ced6eb8b3303..b3588240eb39b 100644
819 +--- a/drivers/spi/spi-zynq-qspi.c
820 ++++ b/drivers/spi/spi-zynq-qspi.c
821 +@@ -558,6 +558,9 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem,
822 +
823 + if (op->dummy.nbytes) {
824 + tmpbuf = kzalloc(op->dummy.nbytes, GFP_KERNEL);
825 ++ if (!tmpbuf)
826 ++ return -ENOMEM;
827 ++
828 + memset(tmpbuf, 0xff, op->dummy.nbytes);
829 + reinit_completion(&xqspi->data_completion);
830 + xqspi->txbuf = tmpbuf;
831 +diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
832 +index 5eaef45799e61..344f48c909181 100644
833 +--- a/drivers/tee/optee/core.c
834 ++++ b/drivers/tee/optee/core.c
835 +@@ -552,6 +552,7 @@ static struct optee *optee_probe(struct device_node *np)
836 + struct optee *optee = NULL;
837 + void *memremaped_shm = NULL;
838 + struct tee_device *teedev;
839 ++ struct tee_context *ctx;
840 + u32 sec_caps;
841 + int rc;
842 +
843 +@@ -631,6 +632,12 @@ static struct optee *optee_probe(struct device_node *np)
844 + optee_supp_init(&optee->supp);
845 + optee->memremaped_shm = memremaped_shm;
846 + optee->pool = pool;
847 ++ ctx = teedev_open(optee->teedev);
848 ++ if (IS_ERR(ctx)) {
849 ++ rc = PTR_ERR(ctx);
850 ++ goto err;
851 ++ }
852 ++ optee->ctx = ctx;
853 +
854 + /*
855 + * Ensure that there are no pre-existing shm objects before enabling
856 +@@ -667,6 +674,7 @@ err:
857 +
858 + static void optee_remove(struct optee *optee)
859 + {
860 ++ teedev_close_context(optee->ctx);
861 + /*
862 + * Ask OP-TEE to free all cached shared memory objects to decrease
863 + * reference counters and also avoid wild pointers in secure world
864 +diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h
865 +index 54c3fa01d0024..0250cfde6312d 100644
866 +--- a/drivers/tee/optee/optee_private.h
867 ++++ b/drivers/tee/optee/optee_private.h
868 +@@ -69,6 +69,7 @@ struct optee_supp {
869 + * struct optee - main service struct
870 + * @supp_teedev: supplicant device
871 + * @teedev: client device
872 ++ * @ctx: driver internal TEE context
873 + * @invoke_fn: function to issue smc or hvc
874 + * @call_queue: queue of threads waiting to call @invoke_fn
875 + * @wait_queue: queue of threads from secure world waiting for a
876 +@@ -83,6 +84,7 @@ struct optee {
877 + struct tee_device *supp_teedev;
878 + struct tee_device *teedev;
879 + optee_invoke_fn *invoke_fn;
880 ++ struct tee_context *ctx;
881 + struct optee_call_queue call_queue;
882 + struct optee_wait_queue wait_queue;
883 + struct optee_supp supp;
884 +diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
885 +index aecf62016e7b8..be45ee6202991 100644
886 +--- a/drivers/tee/optee/rpc.c
887 ++++ b/drivers/tee/optee/rpc.c
888 +@@ -191,6 +191,7 @@ static struct tee_shm *cmd_alloc_suppl(struct tee_context *ctx, size_t sz)
889 + }
890 +
891 + static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx,
892 ++ struct optee *optee,
893 + struct optee_msg_arg *arg,
894 + struct optee_call_ctx *call_ctx)
895 + {
896 +@@ -220,7 +221,8 @@ static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx,
897 + shm = cmd_alloc_suppl(ctx, sz);
898 + break;
899 + case OPTEE_MSG_RPC_SHM_TYPE_KERNEL:
900 +- shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV);
901 ++ shm = tee_shm_alloc(optee->ctx, sz,
902 ++ TEE_SHM_MAPPED | TEE_SHM_PRIV);
903 + break;
904 + default:
905 + arg->ret = TEEC_ERROR_BAD_PARAMETERS;
906 +@@ -377,7 +379,7 @@ static void handle_rpc_func_cmd(struct tee_context *ctx, struct optee *optee,
907 + break;
908 + case OPTEE_MSG_RPC_CMD_SHM_ALLOC:
909 + free_pages_list(call_ctx);
910 +- handle_rpc_func_cmd_shm_alloc(ctx, arg, call_ctx);
911 ++ handle_rpc_func_cmd_shm_alloc(ctx, optee, arg, call_ctx);
912 + break;
913 + case OPTEE_MSG_RPC_CMD_SHM_FREE:
914 + handle_rpc_func_cmd_shm_free(ctx, arg);
915 +@@ -405,7 +407,7 @@ void optee_handle_rpc(struct tee_context *ctx, struct optee_rpc_param *param,
916 +
917 + switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) {
918 + case OPTEE_SMC_RPC_FUNC_ALLOC:
919 +- shm = tee_shm_alloc(ctx, param->a1,
920 ++ shm = tee_shm_alloc(optee->ctx, param->a1,
921 + TEE_SHM_MAPPED | TEE_SHM_PRIV);
922 + if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) {
923 + reg_pair_from_64(&param->a1, &param->a2, pa);
924 +diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
925 +index 85e0cef9e917e..a7ccd4d2bd106 100644
926 +--- a/drivers/tee/tee_core.c
927 ++++ b/drivers/tee/tee_core.c
928 +@@ -28,7 +28,7 @@ static DEFINE_SPINLOCK(driver_lock);
929 + static struct class *tee_class;
930 + static dev_t tee_devt;
931 +
932 +-static struct tee_context *teedev_open(struct tee_device *teedev)
933 ++struct tee_context *teedev_open(struct tee_device *teedev)
934 + {
935 + int rc;
936 + struct tee_context *ctx;
937 +@@ -56,6 +56,7 @@ err:
938 + return ERR_PTR(rc);
939 +
940 + }
941 ++EXPORT_SYMBOL_GPL(teedev_open);
942 +
943 + void teedev_ctx_get(struct tee_context *ctx)
944 + {
945 +@@ -82,13 +83,14 @@ void teedev_ctx_put(struct tee_context *ctx)
946 + kref_put(&ctx->refcount, teedev_ctx_release);
947 + }
948 +
949 +-static void teedev_close_context(struct tee_context *ctx)
950 ++void teedev_close_context(struct tee_context *ctx)
951 + {
952 + struct tee_device *teedev = ctx->teedev;
953 +
954 + teedev_ctx_put(ctx);
955 + tee_device_put(teedev);
956 + }
957 ++EXPORT_SYMBOL_GPL(teedev_close_context);
958 +
959 + static int tee_open(struct inode *inode, struct file *filp)
960 + {
961 +diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
962 +index 3d3d616e58989..f4fe73ce57108 100644
963 +--- a/drivers/tty/n_gsm.c
964 ++++ b/drivers/tty/n_gsm.c
965 +@@ -428,7 +428,7 @@ static u8 gsm_encode_modem(const struct gsm_dlci *dlci)
966 + modembits |= MDM_RTR;
967 + if (dlci->modem_tx & TIOCM_RI)
968 + modembits |= MDM_IC;
969 +- if (dlci->modem_tx & TIOCM_CD)
970 ++ if (dlci->modem_tx & TIOCM_CD || dlci->gsm->initiator)
971 + modembits |= MDM_DV;
972 + return modembits;
973 + }
974 +@@ -1490,7 +1490,7 @@ static void gsm_dlci_t1(struct timer_list *t)
975 + dlci->mode = DLCI_MODE_ADM;
976 + gsm_dlci_open(dlci);
977 + } else {
978 +- gsm_dlci_close(dlci);
979 ++ gsm_dlci_begin_close(dlci); /* prevent half open link */
980 + }
981 +
982 + break;
983 +@@ -1722,7 +1722,12 @@ static void gsm_dlci_release(struct gsm_dlci *dlci)
984 + gsm_destroy_network(dlci);
985 + mutex_unlock(&dlci->mutex);
986 +
987 +- tty_hangup(tty);
988 ++ /* We cannot use tty_hangup() because in tty_kref_put() the tty
989 ++ * driver assumes that the hangup queue is free and reuses it to
990 ++ * queue release_one_tty() -> NULL pointer panic in
991 ++ * process_one_work().
992 ++ */
993 ++ tty_vhangup(tty);
994 +
995 + tty_port_tty_set(&dlci->port, NULL);
996 + tty_kref_put(tty);
997 +diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
998 +index 5a7c152c9ee39..99964f96ff747 100644
999 +--- a/drivers/usb/dwc3/dwc3-pci.c
1000 ++++ b/drivers/usb/dwc3/dwc3-pci.c
1001 +@@ -81,8 +81,8 @@ static const struct acpi_gpio_mapping acpi_dwc3_byt_gpios[] = {
1002 + static struct gpiod_lookup_table platform_bytcr_gpios = {
1003 + .dev_id = "0000:00:16.0",
1004 + .table = {
1005 +- GPIO_LOOKUP("INT33FC:00", 54, "reset", GPIO_ACTIVE_HIGH),
1006 +- GPIO_LOOKUP("INT33FC:02", 14, "cs", GPIO_ACTIVE_HIGH),
1007 ++ GPIO_LOOKUP("INT33FC:00", 54, "cs", GPIO_ACTIVE_HIGH),
1008 ++ GPIO_LOOKUP("INT33FC:02", 14, "reset", GPIO_ACTIVE_HIGH),
1009 + {}
1010 + },
1011 + };
1012 +diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
1013 +index 2367bf5a13107..a1d8cb69d229d 100644
1014 +--- a/drivers/usb/dwc3/gadget.c
1015 ++++ b/drivers/usb/dwc3/gadget.c
1016 +@@ -3529,9 +3529,11 @@ static irqreturn_t dwc3_thread_interrupt(int irq, void *_evt)
1017 + unsigned long flags;
1018 + irqreturn_t ret = IRQ_NONE;
1019 +
1020 ++ local_bh_disable();
1021 + spin_lock_irqsave(&dwc->lock, flags);
1022 + ret = dwc3_process_event_buf(evt);
1023 + spin_unlock_irqrestore(&dwc->lock, flags);
1024 ++ local_bh_enable();
1025 +
1026 + return ret;
1027 + }
1028 +diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c
1029 +index ab827c1badc50..970ed1514f0bc 100644
1030 +--- a/drivers/usb/gadget/function/rndis.c
1031 ++++ b/drivers/usb/gadget/function/rndis.c
1032 +@@ -922,6 +922,7 @@ struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v)
1033 + params->resp_avail = resp_avail;
1034 + params->v = v;
1035 + INIT_LIST_HEAD(&params->resp_queue);
1036 ++ spin_lock_init(&params->resp_lock);
1037 + pr_debug("%s: configNr = %d\n", __func__, i);
1038 +
1039 + return params;
1040 +@@ -1015,12 +1016,14 @@ void rndis_free_response(struct rndis_params *params, u8 *buf)
1041 + {
1042 + rndis_resp_t *r, *n;
1043 +
1044 ++ spin_lock(&params->resp_lock);
1045 + list_for_each_entry_safe(r, n, &params->resp_queue, list) {
1046 + if (r->buf == buf) {
1047 + list_del(&r->list);
1048 + kfree(r);
1049 + }
1050 + }
1051 ++ spin_unlock(&params->resp_lock);
1052 + }
1053 + EXPORT_SYMBOL_GPL(rndis_free_response);
1054 +
1055 +@@ -1030,14 +1033,17 @@ u8 *rndis_get_next_response(struct rndis_params *params, u32 *length)
1056 +
1057 + if (!length) return NULL;
1058 +
1059 ++ spin_lock(&params->resp_lock);
1060 + list_for_each_entry_safe(r, n, &params->resp_queue, list) {
1061 + if (!r->send) {
1062 + r->send = 1;
1063 + *length = r->length;
1064 ++ spin_unlock(&params->resp_lock);
1065 + return r->buf;
1066 + }
1067 + }
1068 +
1069 ++ spin_unlock(&params->resp_lock);
1070 + return NULL;
1071 + }
1072 + EXPORT_SYMBOL_GPL(rndis_get_next_response);
1073 +@@ -1054,7 +1060,9 @@ static rndis_resp_t *rndis_add_response(struct rndis_params *params, u32 length)
1074 + r->length = length;
1075 + r->send = 0;
1076 +
1077 ++ spin_lock(&params->resp_lock);
1078 + list_add_tail(&r->list, &params->resp_queue);
1079 ++ spin_unlock(&params->resp_lock);
1080 + return r;
1081 + }
1082 +
1083 +diff --git a/drivers/usb/gadget/function/rndis.h b/drivers/usb/gadget/function/rndis.h
1084 +index c7e3a70ce6c1f..c996ba28bcb77 100644
1085 +--- a/drivers/usb/gadget/function/rndis.h
1086 ++++ b/drivers/usb/gadget/function/rndis.h
1087 +@@ -174,6 +174,7 @@ typedef struct rndis_params {
1088 + void (*resp_avail)(void *v);
1089 + void *v;
1090 + struct list_head resp_queue;
1091 ++ spinlock_t resp_lock;
1092 + } rndis_params;
1093 +
1094 + /* RNDIS Message parser and other useless functions */
1095 +diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c
1096 +index 29d8e5f8bb583..de22dd5436538 100644
1097 +--- a/drivers/usb/gadget/udc/udc-xilinx.c
1098 ++++ b/drivers/usb/gadget/udc/udc-xilinx.c
1099 +@@ -1613,6 +1613,8 @@ static void xudc_getstatus(struct xusb_udc *udc)
1100 + break;
1101 + case USB_RECIP_ENDPOINT:
1102 + epnum = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK;
1103 ++ if (epnum >= XUSB_MAX_ENDPOINTS)
1104 ++ goto stall;
1105 + target_ep = &udc->ep[epnum];
1106 + epcfgreg = udc->read_fn(udc->addr + target_ep->offset);
1107 + halt = epcfgreg & XUSB_EP_CFG_STALL_MASK;
1108 +@@ -1680,6 +1682,10 @@ static void xudc_set_clear_feature(struct xusb_udc *udc)
1109 + case USB_RECIP_ENDPOINT:
1110 + if (!udc->setup.wValue) {
1111 + endpoint = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK;
1112 ++ if (endpoint >= XUSB_MAX_ENDPOINTS) {
1113 ++ xudc_ep0_stall(udc);
1114 ++ return;
1115 ++ }
1116 + target_ep = &udc->ep[endpoint];
1117 + outinbit = udc->setup.wIndex & USB_ENDPOINT_DIR_MASK;
1118 + outinbit = outinbit >> 7;
1119 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1120 +index 1c8070023161f..8f029d44e9c9e 100644
1121 +--- a/drivers/usb/host/xhci.c
1122 ++++ b/drivers/usb/host/xhci.c
1123 +@@ -1091,6 +1091,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
1124 + int retval = 0;
1125 + bool comp_timer_running = false;
1126 + bool pending_portevent = false;
1127 ++ bool reinit_xhc = false;
1128 +
1129 + if (!hcd->state)
1130 + return 0;
1131 +@@ -1107,10 +1108,11 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
1132 + set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
1133 +
1134 + spin_lock_irq(&xhci->lock);
1135 +- if ((xhci->quirks & XHCI_RESET_ON_RESUME) || xhci->broken_suspend)
1136 +- hibernated = true;
1137 +
1138 +- if (!hibernated) {
1139 ++ if (hibernated || xhci->quirks & XHCI_RESET_ON_RESUME || xhci->broken_suspend)
1140 ++ reinit_xhc = true;
1141 ++
1142 ++ if (!reinit_xhc) {
1143 + /*
1144 + * Some controllers might lose power during suspend, so wait
1145 + * for controller not ready bit to clear, just as in xHC init.
1146 +@@ -1143,12 +1145,17 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
1147 + spin_unlock_irq(&xhci->lock);
1148 + return -ETIMEDOUT;
1149 + }
1150 +- temp = readl(&xhci->op_regs->status);
1151 + }
1152 +
1153 +- /* If restore operation fails, re-initialize the HC during resume */
1154 +- if ((temp & STS_SRE) || hibernated) {
1155 ++ temp = readl(&xhci->op_regs->status);
1156 +
1157 ++ /* re-initialize the HC on Restore Error, or Host Controller Error */
1158 ++ if (temp & (STS_SRE | STS_HCE)) {
1159 ++ reinit_xhc = true;
1160 ++ xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp);
1161 ++ }
1162 ++
1163 ++ if (reinit_xhc) {
1164 + if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
1165 + !(xhci_all_ports_seen_u0(xhci))) {
1166 + del_timer_sync(&xhci->comp_mode_recovery_timer);
1167 +@@ -1480,9 +1487,12 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
1168 + struct urb_priv *urb_priv;
1169 + int num_tds;
1170 +
1171 +- if (!urb || xhci_check_args(hcd, urb->dev, urb->ep,
1172 +- true, true, __func__) <= 0)
1173 ++ if (!urb)
1174 + return -EINVAL;
1175 ++ ret = xhci_check_args(hcd, urb->dev, urb->ep,
1176 ++ true, true, __func__);
1177 ++ if (ret <= 0)
1178 ++ return ret ? ret : -EINVAL;
1179 +
1180 + slot_id = urb->dev->slot_id;
1181 + ep_index = xhci_get_endpoint_index(&urb->ep->desc);
1182 +@@ -3282,7 +3292,7 @@ static int xhci_check_streams_endpoint(struct xhci_hcd *xhci,
1183 + return -EINVAL;
1184 + ret = xhci_check_args(xhci_to_hcd(xhci), udev, ep, 1, true, __func__);
1185 + if (ret <= 0)
1186 +- return -EINVAL;
1187 ++ return ret ? ret : -EINVAL;
1188 + if (usb_ss_max_streams(&ep->ss_ep_comp) == 0) {
1189 + xhci_warn(xhci, "WARN: SuperSpeed Endpoint Companion"
1190 + " descriptor for ep 0x%x does not support streams\n",
1191 +diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
1192 +index a5c10fe9f72a1..f06a09e59d8ba 100644
1193 +--- a/drivers/usb/serial/ch341.c
1194 ++++ b/drivers/usb/serial/ch341.c
1195 +@@ -80,7 +80,6 @@
1196 + #define CH341_LCR_CS5 0x00
1197 +
1198 + static const struct usb_device_id id_table[] = {
1199 +- { USB_DEVICE(0x1a86, 0x5512) },
1200 + { USB_DEVICE(0x1a86, 0x5523) },
1201 + { USB_DEVICE(0x1a86, 0x7522) },
1202 + { USB_DEVICE(0x1a86, 0x7523) },
1203 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1204 +index 81e7833910ca8..839eac04b5e30 100644
1205 +--- a/drivers/usb/serial/option.c
1206 ++++ b/drivers/usb/serial/option.c
1207 +@@ -198,6 +198,8 @@ static void option_instat_callback(struct urb *urb);
1208 +
1209 + #define DELL_PRODUCT_5821E 0x81d7
1210 + #define DELL_PRODUCT_5821E_ESIM 0x81e0
1211 ++#define DELL_PRODUCT_5829E_ESIM 0x81e4
1212 ++#define DELL_PRODUCT_5829E 0x81e6
1213 +
1214 + #define KYOCERA_VENDOR_ID 0x0c88
1215 + #define KYOCERA_PRODUCT_KPC650 0x17da
1216 +@@ -1063,6 +1065,10 @@ static const struct usb_device_id option_ids[] = {
1217 + .driver_info = RSVD(0) | RSVD(1) | RSVD(6) },
1218 + { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5821E_ESIM),
1219 + .driver_info = RSVD(0) | RSVD(1) | RSVD(6) },
1220 ++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E),
1221 ++ .driver_info = RSVD(0) | RSVD(6) },
1222 ++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E_ESIM),
1223 ++ .driver_info = RSVD(0) | RSVD(6) },
1224 + { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */
1225 + { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
1226 + { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
1227 +@@ -1273,10 +1279,16 @@ static const struct usb_device_id option_ids[] = {
1228 + .driver_info = NCTRL(2) },
1229 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x7011, 0xff), /* Telit LE910-S1 (ECM) */
1230 + .driver_info = NCTRL(2) },
1231 ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701a, 0xff), /* Telit LE910R1 (RNDIS) */
1232 ++ .driver_info = NCTRL(2) },
1233 ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701b, 0xff), /* Telit LE910R1 (ECM) */
1234 ++ .driver_info = NCTRL(2) },
1235 + { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */
1236 + .driver_info = NCTRL(0) | ZLP },
1237 + { USB_DEVICE(TELIT_VENDOR_ID, 0x9200), /* Telit LE910S1 flashing device */
1238 + .driver_info = NCTRL(0) | ZLP },
1239 ++ { USB_DEVICE(TELIT_VENDOR_ID, 0x9201), /* Telit LE910R1 flashing device */
1240 ++ .driver_info = NCTRL(0) | ZLP },
1241 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
1242 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff),
1243 + .driver_info = RSVD(1) },
1244 +diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
1245 +index 2bf7cb01da9a3..308df62655dd2 100644
1246 +--- a/drivers/vhost/vsock.c
1247 ++++ b/drivers/vhost/vsock.c
1248 +@@ -570,16 +570,18 @@ err:
1249 + return ret;
1250 + }
1251 +
1252 +-static int vhost_vsock_stop(struct vhost_vsock *vsock)
1253 ++static int vhost_vsock_stop(struct vhost_vsock *vsock, bool check_owner)
1254 + {
1255 + size_t i;
1256 +- int ret;
1257 ++ int ret = 0;
1258 +
1259 + mutex_lock(&vsock->dev.mutex);
1260 +
1261 +- ret = vhost_dev_check_owner(&vsock->dev);
1262 +- if (ret)
1263 +- goto err;
1264 ++ if (check_owner) {
1265 ++ ret = vhost_dev_check_owner(&vsock->dev);
1266 ++ if (ret)
1267 ++ goto err;
1268 ++ }
1269 +
1270 + for (i = 0; i < ARRAY_SIZE(vsock->vqs); i++) {
1271 + struct vhost_virtqueue *vq = &vsock->vqs[i];
1272 +@@ -694,7 +696,12 @@ static int vhost_vsock_dev_release(struct inode *inode, struct file *file)
1273 + * inefficient. Room for improvement here. */
1274 + vsock_for_each_connected_socket(vhost_vsock_reset_orphans);
1275 +
1276 +- vhost_vsock_stop(vsock);
1277 ++ /* Don't check the owner, because we are in the release path, so we
1278 ++ * need to stop the vsock device in any case.
1279 ++ * vhost_vsock_stop() can not fail in this case, so we don't need to
1280 ++ * check the return code.
1281 ++ */
1282 ++ vhost_vsock_stop(vsock, false);
1283 + vhost_vsock_flush(vsock);
1284 + vhost_dev_stop(&vsock->dev);
1285 +
1286 +@@ -792,7 +799,7 @@ static long vhost_vsock_dev_ioctl(struct file *f, unsigned int ioctl,
1287 + if (start)
1288 + return vhost_vsock_start(vsock);
1289 + else
1290 +- return vhost_vsock_stop(vsock);
1291 ++ return vhost_vsock_stop(vsock, true);
1292 + case VHOST_GET_FEATURES:
1293 + features = VHOST_VSOCK_FEATURES;
1294 + if (copy_to_user(argp, &features, sizeof(features)))
1295 +diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
1296 +index 2992cebb78661..d73d88d9c2598 100644
1297 +--- a/fs/configfs/dir.c
1298 ++++ b/fs/configfs/dir.c
1299 +@@ -36,6 +36,14 @@
1300 + */
1301 + DEFINE_SPINLOCK(configfs_dirent_lock);
1302 +
1303 ++/*
1304 ++ * All of link_obj/unlink_obj/link_group/unlink_group require that
1305 ++ * subsys->su_mutex is held.
1306 ++ * But parent configfs_subsystem is NULL when config_item is root.
1307 ++ * Use this mutex when config_item is root.
1308 ++ */
1309 ++static DEFINE_MUTEX(configfs_subsystem_mutex);
1310 ++
1311 + static void configfs_d_iput(struct dentry * dentry,
1312 + struct inode * inode)
1313 + {
1314 +@@ -1884,7 +1892,9 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
1315 + group->cg_item.ci_name = group->cg_item.ci_namebuf;
1316 +
1317 + sd = root->d_fsdata;
1318 ++ mutex_lock(&configfs_subsystem_mutex);
1319 + link_group(to_config_group(sd->s_element), group);
1320 ++ mutex_unlock(&configfs_subsystem_mutex);
1321 +
1322 + inode_lock_nested(d_inode(root), I_MUTEX_PARENT);
1323 +
1324 +@@ -1909,7 +1919,9 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
1325 + inode_unlock(d_inode(root));
1326 +
1327 + if (err) {
1328 ++ mutex_lock(&configfs_subsystem_mutex);
1329 + unlink_group(group);
1330 ++ mutex_unlock(&configfs_subsystem_mutex);
1331 + configfs_release_fs();
1332 + }
1333 + put_fragment(frag);
1334 +@@ -1956,7 +1968,9 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
1335 +
1336 + dput(dentry);
1337 +
1338 ++ mutex_lock(&configfs_subsystem_mutex);
1339 + unlink_group(group);
1340 ++ mutex_unlock(&configfs_subsystem_mutex);
1341 + configfs_release_fs();
1342 + }
1343 +
1344 +diff --git a/fs/file.c b/fs/file.c
1345 +index 09cefc944f86d..51f53a7dc2218 100644
1346 +--- a/fs/file.c
1347 ++++ b/fs/file.c
1348 +@@ -706,28 +706,69 @@ void do_close_on_exec(struct files_struct *files)
1349 + spin_unlock(&files->file_lock);
1350 + }
1351 +
1352 +-static struct file *__fget(unsigned int fd, fmode_t mask, unsigned int refs)
1353 ++static inline struct file *__fget_files_rcu(struct files_struct *files,
1354 ++ unsigned int fd, fmode_t mask, unsigned int refs)
1355 + {
1356 +- struct files_struct *files = current->files;
1357 +- struct file *file;
1358 ++ for (;;) {
1359 ++ struct file *file;
1360 ++ struct fdtable *fdt = rcu_dereference_raw(files->fdt);
1361 ++ struct file __rcu **fdentry;
1362 +
1363 +- rcu_read_lock();
1364 +-loop:
1365 +- file = fcheck_files(files, fd);
1366 +- if (file) {
1367 +- /* File object ref couldn't be taken.
1368 +- * dup2() atomicity guarantee is the reason
1369 +- * we loop to catch the new file (or NULL pointer)
1370 ++ if (unlikely(fd >= fdt->max_fds))
1371 ++ return NULL;
1372 ++
1373 ++ fdentry = fdt->fd + array_index_nospec(fd, fdt->max_fds);
1374 ++ file = rcu_dereference_raw(*fdentry);
1375 ++ if (unlikely(!file))
1376 ++ return NULL;
1377 ++
1378 ++ if (unlikely(file->f_mode & mask))
1379 ++ return NULL;
1380 ++
1381 ++ /*
1382 ++ * Ok, we have a file pointer. However, because we do
1383 ++ * this all locklessly under RCU, we may be racing with
1384 ++ * that file being closed.
1385 ++ *
1386 ++ * Such a race can take two forms:
1387 ++ *
1388 ++ * (a) the file ref already went down to zero,
1389 ++ * and get_file_rcu_many() fails. Just try
1390 ++ * again:
1391 ++ */
1392 ++ if (unlikely(!get_file_rcu_many(file, refs)))
1393 ++ continue;
1394 ++
1395 ++ /*
1396 ++ * (b) the file table entry has changed under us.
1397 ++ * Note that we don't need to re-check the 'fdt->fd'
1398 ++ * pointer having changed, because it always goes
1399 ++ * hand-in-hand with 'fdt'.
1400 ++ *
1401 ++ * If so, we need to put our refs and try again.
1402 + */
1403 +- if (file->f_mode & mask)
1404 +- file = NULL;
1405 +- else if (!get_file_rcu_many(file, refs))
1406 +- goto loop;
1407 +- else if (__fcheck_files(files, fd) != file) {
1408 ++ if (unlikely(rcu_dereference_raw(files->fdt) != fdt) ||
1409 ++ unlikely(rcu_dereference_raw(*fdentry) != file)) {
1410 + fput_many(file, refs);
1411 +- goto loop;
1412 ++ continue;
1413 + }
1414 ++
1415 ++ /*
1416 ++ * Ok, we have a ref to the file, and checked that it
1417 ++ * still exists.
1418 ++ */
1419 ++ return file;
1420 + }
1421 ++}
1422 ++
1423 ++
1424 ++static struct file *__fget(unsigned int fd, fmode_t mask, unsigned int refs)
1425 ++{
1426 ++ struct files_struct *files = current->files;
1427 ++ struct file *file;
1428 ++
1429 ++ rcu_read_lock();
1430 ++ file = __fget_files_rcu(files, fd, mask, refs);
1431 + rcu_read_unlock();
1432 +
1433 + return file;
1434 +diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
1435 +index 3fdbbc7a9848e..7878f145bf1bf 100644
1436 +--- a/fs/tracefs/inode.c
1437 ++++ b/fs/tracefs/inode.c
1438 +@@ -262,7 +262,6 @@ static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts)
1439 + if (!gid_valid(gid))
1440 + return -EINVAL;
1441 + opts->gid = gid;
1442 +- set_gid(tracefs_mount->mnt_root, gid);
1443 + break;
1444 + case Opt_mode:
1445 + if (match_octal(&args[0], &option))
1446 +@@ -289,7 +288,9 @@ static int tracefs_apply_options(struct super_block *sb)
1447 + inode->i_mode |= opts->mode;
1448 +
1449 + inode->i_uid = opts->uid;
1450 +- inode->i_gid = opts->gid;
1451 ++
1452 ++ /* Set all the group ids to the mount option */
1453 ++ set_gid(sb->s_root, opts->gid);
1454 +
1455 + return 0;
1456 + }
1457 +diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
1458 +index e08ace76eba6a..8868337e9445b 100644
1459 +--- a/include/linux/tee_drv.h
1460 ++++ b/include/linux/tee_drv.h
1461 +@@ -579,4 +579,18 @@ struct tee_client_driver {
1462 + #define to_tee_client_driver(d) \
1463 + container_of(d, struct tee_client_driver, driver)
1464 +
1465 ++/**
1466 ++ * teedev_open() - Open a struct tee_device
1467 ++ * @teedev: Device to open
1468 ++ *
1469 ++ * @return a pointer to struct tee_context on success or an ERR_PTR on failure.
1470 ++ */
1471 ++struct tee_context *teedev_open(struct tee_device *teedev);
1472 ++
1473 ++/**
1474 ++ * teedev_close_context() - closes a struct tee_context
1475 ++ * @ctx: The struct tee_context to close
1476 ++ */
1477 ++void teedev_close_context(struct tee_context *ctx);
1478 ++
1479 + #endif /*__TEE_DRV_H*/
1480 +diff --git a/include/net/checksum.h b/include/net/checksum.h
1481 +index 97bf4885a962f..e13d5ecf71cdb 100644
1482 +--- a/include/net/checksum.h
1483 ++++ b/include/net/checksum.h
1484 +@@ -22,7 +22,7 @@
1485 + #include <asm/checksum.h>
1486 +
1487 + #ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
1488 +-static inline
1489 ++static __always_inline
1490 + __wsum csum_and_copy_from_user (const void __user *src, void *dst,
1491 + int len, __wsum sum, int *err_ptr)
1492 + {
1493 +@@ -37,7 +37,7 @@ __wsum csum_and_copy_from_user (const void __user *src, void *dst,
1494 + #endif
1495 +
1496 + #ifndef HAVE_CSUM_COPY_USER
1497 +-static __inline__ __wsum csum_and_copy_to_user
1498 ++static __always_inline __wsum csum_and_copy_to_user
1499 + (const void *src, void __user *dst, int len, __wsum sum, int *err_ptr)
1500 + {
1501 + sum = csum_partial(src, len, sum);
1502 +@@ -54,7 +54,7 @@ static __inline__ __wsum csum_and_copy_to_user
1503 + #endif
1504 +
1505 + #ifndef HAVE_ARCH_CSUM_ADD
1506 +-static inline __wsum csum_add(__wsum csum, __wsum addend)
1507 ++static __always_inline __wsum csum_add(__wsum csum, __wsum addend)
1508 + {
1509 + u32 res = (__force u32)csum;
1510 + res += (__force u32)addend;
1511 +@@ -62,12 +62,12 @@ static inline __wsum csum_add(__wsum csum, __wsum addend)
1512 + }
1513 + #endif
1514 +
1515 +-static inline __wsum csum_sub(__wsum csum, __wsum addend)
1516 ++static __always_inline __wsum csum_sub(__wsum csum, __wsum addend)
1517 + {
1518 + return csum_add(csum, ~addend);
1519 + }
1520 +
1521 +-static inline __sum16 csum16_add(__sum16 csum, __be16 addend)
1522 ++static __always_inline __sum16 csum16_add(__sum16 csum, __be16 addend)
1523 + {
1524 + u16 res = (__force u16)csum;
1525 +
1526 +@@ -75,12 +75,12 @@ static inline __sum16 csum16_add(__sum16 csum, __be16 addend)
1527 + return (__force __sum16)(res + (res < (__force u16)addend));
1528 + }
1529 +
1530 +-static inline __sum16 csum16_sub(__sum16 csum, __be16 addend)
1531 ++static __always_inline __sum16 csum16_sub(__sum16 csum, __be16 addend)
1532 + {
1533 + return csum16_add(csum, ~addend);
1534 + }
1535 +
1536 +-static inline __wsum
1537 ++static __always_inline __wsum
1538 + csum_block_add(__wsum csum, __wsum csum2, int offset)
1539 + {
1540 + u32 sum = (__force u32)csum2;
1541 +@@ -92,36 +92,37 @@ csum_block_add(__wsum csum, __wsum csum2, int offset)
1542 + return csum_add(csum, (__force __wsum)sum);
1543 + }
1544 +
1545 +-static inline __wsum
1546 ++static __always_inline __wsum
1547 + csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len)
1548 + {
1549 + return csum_block_add(csum, csum2, offset);
1550 + }
1551 +
1552 +-static inline __wsum
1553 ++static __always_inline __wsum
1554 + csum_block_sub(__wsum csum, __wsum csum2, int offset)
1555 + {
1556 + return csum_block_add(csum, ~csum2, offset);
1557 + }
1558 +
1559 +-static inline __wsum csum_unfold(__sum16 n)
1560 ++static __always_inline __wsum csum_unfold(__sum16 n)
1561 + {
1562 + return (__force __wsum)n;
1563 + }
1564 +
1565 +-static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum)
1566 ++static __always_inline
1567 ++__wsum csum_partial_ext(const void *buff, int len, __wsum sum)
1568 + {
1569 + return csum_partial(buff, len, sum);
1570 + }
1571 +
1572 + #define CSUM_MANGLED_0 ((__force __sum16)0xffff)
1573 +
1574 +-static inline void csum_replace_by_diff(__sum16 *sum, __wsum diff)
1575 ++static __always_inline void csum_replace_by_diff(__sum16 *sum, __wsum diff)
1576 + {
1577 + *sum = csum_fold(csum_add(diff, ~csum_unfold(*sum)));
1578 + }
1579 +
1580 +-static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
1581 ++static __always_inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
1582 + {
1583 + __wsum tmp = csum_sub(~csum_unfold(*sum), (__force __wsum)from);
1584 +
1585 +@@ -134,11 +135,16 @@ static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
1586 + * m : old value of a 16bit field
1587 + * m' : new value of a 16bit field
1588 + */
1589 +-static inline void csum_replace2(__sum16 *sum, __be16 old, __be16 new)
1590 ++static __always_inline void csum_replace2(__sum16 *sum, __be16 old, __be16 new)
1591 + {
1592 + *sum = ~csum16_add(csum16_sub(~(*sum), old), new);
1593 + }
1594 +
1595 ++static inline void csum_replace(__wsum *csum, __wsum old, __wsum new)
1596 ++{
1597 ++ *csum = csum_add(csum_sub(*csum, old), new);
1598 ++}
1599 ++
1600 + struct sk_buff;
1601 + void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
1602 + __be32 from, __be32 to, bool pseudohdr);
1603 +@@ -148,16 +154,16 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb,
1604 + void inet_proto_csum_replace_by_diff(__sum16 *sum, struct sk_buff *skb,
1605 + __wsum diff, bool pseudohdr);
1606 +
1607 +-static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
1608 +- __be16 from, __be16 to,
1609 +- bool pseudohdr)
1610 ++static __always_inline
1611 ++void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
1612 ++ __be16 from, __be16 to, bool pseudohdr)
1613 + {
1614 + inet_proto_csum_replace4(sum, skb, (__force __be32)from,
1615 + (__force __be32)to, pseudohdr);
1616 + }
1617 +
1618 +-static inline __wsum remcsum_adjust(void *ptr, __wsum csum,
1619 +- int start, int offset)
1620 ++static __always_inline __wsum remcsum_adjust(void *ptr, __wsum csum,
1621 ++ int start, int offset)
1622 + {
1623 + __sum16 *psum = (__sum16 *)(ptr + offset);
1624 + __wsum delta;
1625 +@@ -173,7 +179,7 @@ static inline __wsum remcsum_adjust(void *ptr, __wsum csum,
1626 + return delta;
1627 + }
1628 +
1629 +-static inline void remcsum_unadjust(__sum16 *psum, __wsum delta)
1630 ++static __always_inline void remcsum_unadjust(__sum16 *psum, __wsum delta)
1631 + {
1632 + *psum = csum_fold(csum_sub(delta, (__force __wsum)*psum));
1633 + }
1634 +diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
1635 +index f694f08ad635b..886866bee8b27 100644
1636 +--- a/include/net/netfilter/nf_tables.h
1637 ++++ b/include/net/netfilter/nf_tables.h
1638 +@@ -805,7 +805,7 @@ struct nft_expr_ops {
1639 + int (*offload)(struct nft_offload_ctx *ctx,
1640 + struct nft_flow_rule *flow,
1641 + const struct nft_expr *expr);
1642 +- u32 offload_flags;
1643 ++ bool (*offload_action)(const struct nft_expr *expr);
1644 + const struct nft_expr_type *type;
1645 + void *data;
1646 + };
1647 +diff --git a/include/net/netfilter/nf_tables_offload.h b/include/net/netfilter/nf_tables_offload.h
1648 +index d0bb9e3bcec1c..a9989ca6e5af7 100644
1649 +--- a/include/net/netfilter/nf_tables_offload.h
1650 ++++ b/include/net/netfilter/nf_tables_offload.h
1651 +@@ -60,8 +60,6 @@ struct nft_flow_rule {
1652 + struct flow_rule *rule;
1653 + };
1654 +
1655 +-#define NFT_OFFLOAD_F_ACTION (1 << 0)
1656 +-
1657 + void nft_flow_rule_set_addr_type(struct nft_flow_rule *flow,
1658 + enum flow_dissector_key_id addr_type);
1659 +
1660 +diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
1661 +index ad9dffed8411d..3674798ade1fc 100644
1662 +--- a/kernel/cgroup/cpuset.c
1663 ++++ b/kernel/cgroup/cpuset.c
1664 +@@ -2204,6 +2204,7 @@ static void cpuset_attach(struct cgroup_taskset *tset)
1665 + cgroup_taskset_first(tset, &css);
1666 + cs = css_cs(css);
1667 +
1668 ++ cpus_read_lock();
1669 + percpu_down_write(&cpuset_rwsem);
1670 +
1671 + /* prepare for attach */
1672 +@@ -2259,6 +2260,7 @@ static void cpuset_attach(struct cgroup_taskset *tset)
1673 + wake_up(&cpuset_attach_wq);
1674 +
1675 + percpu_up_write(&cpuset_rwsem);
1676 ++ cpus_read_unlock();
1677 + }
1678 +
1679 + /* The various types of files and directories in a cpuset file system */
1680 +diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
1681 +index e913d41a41949..3105dbf6c0e96 100644
1682 +--- a/kernel/trace/trace_events_trigger.c
1683 ++++ b/kernel/trace/trace_events_trigger.c
1684 +@@ -940,6 +940,16 @@ static void
1685 + traceon_trigger(struct event_trigger_data *data, void *rec,
1686 + struct ring_buffer_event *event)
1687 + {
1688 ++ struct trace_event_file *file = data->private_data;
1689 ++
1690 ++ if (file) {
1691 ++ if (tracer_tracing_is_on(file->tr))
1692 ++ return;
1693 ++
1694 ++ tracer_tracing_on(file->tr);
1695 ++ return;
1696 ++ }
1697 ++
1698 + if (tracing_is_on())
1699 + return;
1700 +
1701 +@@ -950,8 +960,15 @@ static void
1702 + traceon_count_trigger(struct event_trigger_data *data, void *rec,
1703 + struct ring_buffer_event *event)
1704 + {
1705 +- if (tracing_is_on())
1706 +- return;
1707 ++ struct trace_event_file *file = data->private_data;
1708 ++
1709 ++ if (file) {
1710 ++ if (tracer_tracing_is_on(file->tr))
1711 ++ return;
1712 ++ } else {
1713 ++ if (tracing_is_on())
1714 ++ return;
1715 ++ }
1716 +
1717 + if (!data->count)
1718 + return;
1719 +@@ -959,13 +976,26 @@ traceon_count_trigger(struct event_trigger_data *data, void *rec,
1720 + if (data->count != -1)
1721 + (data->count)--;
1722 +
1723 +- tracing_on();
1724 ++ if (file)
1725 ++ tracer_tracing_on(file->tr);
1726 ++ else
1727 ++ tracing_on();
1728 + }
1729 +
1730 + static void
1731 + traceoff_trigger(struct event_trigger_data *data, void *rec,
1732 + struct ring_buffer_event *event)
1733 + {
1734 ++ struct trace_event_file *file = data->private_data;
1735 ++
1736 ++ if (file) {
1737 ++ if (!tracer_tracing_is_on(file->tr))
1738 ++ return;
1739 ++
1740 ++ tracer_tracing_off(file->tr);
1741 ++ return;
1742 ++ }
1743 ++
1744 + if (!tracing_is_on())
1745 + return;
1746 +
1747 +@@ -976,8 +1006,15 @@ static void
1748 + traceoff_count_trigger(struct event_trigger_data *data, void *rec,
1749 + struct ring_buffer_event *event)
1750 + {
1751 +- if (!tracing_is_on())
1752 +- return;
1753 ++ struct trace_event_file *file = data->private_data;
1754 ++
1755 ++ if (file) {
1756 ++ if (!tracer_tracing_is_on(file->tr))
1757 ++ return;
1758 ++ } else {
1759 ++ if (!tracing_is_on())
1760 ++ return;
1761 ++ }
1762 +
1763 + if (!data->count)
1764 + return;
1765 +@@ -985,7 +1022,10 @@ traceoff_count_trigger(struct event_trigger_data *data, void *rec,
1766 + if (data->count != -1)
1767 + (data->count)--;
1768 +
1769 +- tracing_off();
1770 ++ if (file)
1771 ++ tracer_tracing_off(file->tr);
1772 ++ else
1773 ++ tracing_off();
1774 + }
1775 +
1776 + static int
1777 +diff --git a/mm/memblock.c b/mm/memblock.c
1778 +index 38cef8b6df050..a75cc65f03307 100644
1779 +--- a/mm/memblock.c
1780 ++++ b/mm/memblock.c
1781 +@@ -348,14 +348,20 @@ void __init memblock_discard(void)
1782 + addr = __pa(memblock.reserved.regions);
1783 + size = PAGE_ALIGN(sizeof(struct memblock_region) *
1784 + memblock.reserved.max);
1785 +- __memblock_free_late(addr, size);
1786 ++ if (memblock_reserved_in_slab)
1787 ++ kfree(memblock.reserved.regions);
1788 ++ else
1789 ++ __memblock_free_late(addr, size);
1790 + }
1791 +
1792 + if (memblock.memory.regions != memblock_memory_init_regions) {
1793 + addr = __pa(memblock.memory.regions);
1794 + size = PAGE_ALIGN(sizeof(struct memblock_region) *
1795 + memblock.memory.max);
1796 +- __memblock_free_late(addr, size);
1797 ++ if (memblock_memory_in_slab)
1798 ++ kfree(memblock.memory.regions);
1799 ++ else
1800 ++ __memblock_free_late(addr, size);
1801 + }
1802 + }
1803 + #endif
1804 +diff --git a/net/core/filter.c b/net/core/filter.c
1805 +index 92ce4d46f02e4..d39518f691b4b 100644
1806 +--- a/net/core/filter.c
1807 ++++ b/net/core/filter.c
1808 +@@ -2516,6 +2516,9 @@ BPF_CALL_4(bpf_msg_pop_data, struct sk_msg *, msg, u32, start,
1809 + if (unlikely(flags))
1810 + return -EINVAL;
1811 +
1812 ++ if (unlikely(len == 0))
1813 ++ return 0;
1814 ++
1815 + /* First find the starting scatterlist element */
1816 + i = msg->sg.start;
1817 + do {
1818 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
1819 +index ac083685214e0..5bdb3cd20d619 100644
1820 +--- a/net/core/skbuff.c
1821 ++++ b/net/core/skbuff.c
1822 +@@ -2139,7 +2139,7 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta)
1823 + /* Free pulled out fragments. */
1824 + while ((list = skb_shinfo(skb)->frag_list) != insp) {
1825 + skb_shinfo(skb)->frag_list = list->next;
1826 +- kfree_skb(list);
1827 ++ consume_skb(list);
1828 + }
1829 + /* And insert new clone at head. */
1830 + if (clone) {
1831 +@@ -5846,7 +5846,7 @@ static int pskb_carve_frag_list(struct sk_buff *skb,
1832 + /* Free pulled out fragments. */
1833 + while ((list = shinfo->frag_list) != insp) {
1834 + shinfo->frag_list = list->next;
1835 +- kfree_skb(list);
1836 ++ consume_skb(list);
1837 + }
1838 + /* And insert new clone at head. */
1839 + if (clone) {
1840 +diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
1841 +index c800220c404d5..a7a6b1adb698b 100644
1842 +--- a/net/ipv4/af_inet.c
1843 ++++ b/net/ipv4/af_inet.c
1844 +@@ -1344,8 +1344,11 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb,
1845 + }
1846 +
1847 + ops = rcu_dereference(inet_offloads[proto]);
1848 +- if (likely(ops && ops->callbacks.gso_segment))
1849 ++ if (likely(ops && ops->callbacks.gso_segment)) {
1850 + segs = ops->callbacks.gso_segment(skb, features);
1851 ++ if (!segs)
1852 ++ skb->network_header = skb_mac_header(skb) + nhoff - skb->head;
1853 ++ }
1854 +
1855 + if (IS_ERR_OR_NULL(segs))
1856 + goto out;
1857 +diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
1858 +index 2a359d0dfe7e8..33e6392e8b820 100644
1859 +--- a/net/ipv4/ping.c
1860 ++++ b/net/ipv4/ping.c
1861 +@@ -187,7 +187,6 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident)
1862 + (int)ident, &ipv6_hdr(skb)->daddr, dif);
1863 + #endif
1864 + } else {
1865 +- pr_err("ping: protocol(%x) is not supported\n", ntohs(skb->protocol));
1866 + return NULL;
1867 + }
1868 +
1869 +diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
1870 +index 7fbb44736a34b..b7b4ba68f3a20 100644
1871 +--- a/net/ipv6/ip6_offload.c
1872 ++++ b/net/ipv6/ip6_offload.c
1873 +@@ -111,6 +111,8 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
1874 + if (likely(ops && ops->callbacks.gso_segment)) {
1875 + skb_reset_transport_header(skb);
1876 + segs = ops->callbacks.gso_segment(skb, features);
1877 ++ if (!segs)
1878 ++ skb->network_header = skb_mac_header(skb) + nhoff - skb->head;
1879 + }
1880 +
1881 + if (IS_ERR_OR_NULL(segs))
1882 +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
1883 +index 373ea0e49f12d..545da270e8020 100644
1884 +--- a/net/netfilter/nf_tables_api.c
1885 ++++ b/net/netfilter/nf_tables_api.c
1886 +@@ -5184,12 +5184,15 @@ static int nf_tables_updobj(const struct nft_ctx *ctx,
1887 + {
1888 + struct nft_object *newobj;
1889 + struct nft_trans *trans;
1890 +- int err;
1891 ++ int err = -ENOMEM;
1892 ++
1893 ++ if (!try_module_get(type->owner))
1894 ++ return -ENOENT;
1895 +
1896 + trans = nft_trans_alloc(ctx, NFT_MSG_NEWOBJ,
1897 + sizeof(struct nft_trans_obj));
1898 + if (!trans)
1899 +- return -ENOMEM;
1900 ++ goto err_trans;
1901 +
1902 + newobj = nft_obj_init(ctx, type, attr);
1903 + if (IS_ERR(newobj)) {
1904 +@@ -5206,6 +5209,8 @@ static int nf_tables_updobj(const struct nft_ctx *ctx,
1905 +
1906 + err_free_trans:
1907 + kfree(trans);
1908 ++err_trans:
1909 ++ module_put(type->owner);
1910 + return err;
1911 + }
1912 +
1913 +@@ -6544,7 +6549,7 @@ static void nft_obj_commit_update(struct nft_trans *trans)
1914 + if (obj->ops->update)
1915 + obj->ops->update(obj, newobj);
1916 +
1917 +- kfree(newobj);
1918 ++ nft_obj_destroy(&trans->ctx, newobj);
1919 + }
1920 +
1921 + static void nft_commit_release(struct nft_trans *trans)
1922 +@@ -7109,7 +7114,7 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
1923 + break;
1924 + case NFT_MSG_NEWOBJ:
1925 + if (nft_trans_obj_update(trans)) {
1926 +- kfree(nft_trans_obj_newobj(trans));
1927 ++ nft_obj_destroy(&trans->ctx, nft_trans_obj_newobj(trans));
1928 + nft_trans_destroy(trans);
1929 + } else {
1930 + trans->ctx.table->use--;
1931 +diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c
1932 +index 3aa4306ca39f6..2d3bc22c855c7 100644
1933 +--- a/net/netfilter/nf_tables_offload.c
1934 ++++ b/net/netfilter/nf_tables_offload.c
1935 +@@ -55,7 +55,8 @@ struct nft_flow_rule *nft_flow_rule_create(struct net *net,
1936 +
1937 + expr = nft_expr_first(rule);
1938 + while (nft_expr_more(rule, expr)) {
1939 +- if (expr->ops->offload_flags & NFT_OFFLOAD_F_ACTION)
1940 ++ if (expr->ops->offload_action &&
1941 ++ expr->ops->offload_action(expr))
1942 + num_actions++;
1943 +
1944 + expr = nft_expr_next(expr);
1945 +diff --git a/net/netfilter/nft_dup_netdev.c b/net/netfilter/nft_dup_netdev.c
1946 +index c2e78c160fd7c..6007089e1c2f7 100644
1947 +--- a/net/netfilter/nft_dup_netdev.c
1948 ++++ b/net/netfilter/nft_dup_netdev.c
1949 +@@ -67,6 +67,11 @@ static int nft_dup_netdev_offload(struct nft_offload_ctx *ctx,
1950 + return nft_fwd_dup_netdev_offload(ctx, flow, FLOW_ACTION_MIRRED, oif);
1951 + }
1952 +
1953 ++static bool nft_dup_netdev_offload_action(const struct nft_expr *expr)
1954 ++{
1955 ++ return true;
1956 ++}
1957 ++
1958 + static struct nft_expr_type nft_dup_netdev_type;
1959 + static const struct nft_expr_ops nft_dup_netdev_ops = {
1960 + .type = &nft_dup_netdev_type,
1961 +@@ -75,6 +80,7 @@ static const struct nft_expr_ops nft_dup_netdev_ops = {
1962 + .init = nft_dup_netdev_init,
1963 + .dump = nft_dup_netdev_dump,
1964 + .offload = nft_dup_netdev_offload,
1965 ++ .offload_action = nft_dup_netdev_offload_action,
1966 + };
1967 +
1968 + static struct nft_expr_type nft_dup_netdev_type __read_mostly = {
1969 +diff --git a/net/netfilter/nft_fwd_netdev.c b/net/netfilter/nft_fwd_netdev.c
1970 +index b77985986b24e..3b0dcd170551b 100644
1971 +--- a/net/netfilter/nft_fwd_netdev.c
1972 ++++ b/net/netfilter/nft_fwd_netdev.c
1973 +@@ -77,6 +77,11 @@ static int nft_fwd_netdev_offload(struct nft_offload_ctx *ctx,
1974 + return nft_fwd_dup_netdev_offload(ctx, flow, FLOW_ACTION_REDIRECT, oif);
1975 + }
1976 +
1977 ++static bool nft_fwd_netdev_offload_action(const struct nft_expr *expr)
1978 ++{
1979 ++ return true;
1980 ++}
1981 ++
1982 + struct nft_fwd_neigh {
1983 + enum nft_registers sreg_dev:8;
1984 + enum nft_registers sreg_addr:8;
1985 +@@ -219,6 +224,7 @@ static const struct nft_expr_ops nft_fwd_netdev_ops = {
1986 + .dump = nft_fwd_netdev_dump,
1987 + .validate = nft_fwd_validate,
1988 + .offload = nft_fwd_netdev_offload,
1989 ++ .offload_action = nft_fwd_netdev_offload_action,
1990 + };
1991 +
1992 + static const struct nft_expr_ops *
1993 +diff --git a/net/netfilter/nft_immediate.c b/net/netfilter/nft_immediate.c
1994 +index c7f0ef73d9397..98a8149be094b 100644
1995 +--- a/net/netfilter/nft_immediate.c
1996 ++++ b/net/netfilter/nft_immediate.c
1997 +@@ -163,6 +163,16 @@ static int nft_immediate_offload(struct nft_offload_ctx *ctx,
1998 + return 0;
1999 + }
2000 +
2001 ++static bool nft_immediate_offload_action(const struct nft_expr *expr)
2002 ++{
2003 ++ const struct nft_immediate_expr *priv = nft_expr_priv(expr);
2004 ++
2005 ++ if (priv->dreg == NFT_REG_VERDICT)
2006 ++ return true;
2007 ++
2008 ++ return false;
2009 ++}
2010 ++
2011 + static const struct nft_expr_ops nft_imm_ops = {
2012 + .type = &nft_imm_type,
2013 + .size = NFT_EXPR_SIZE(sizeof(struct nft_immediate_expr)),
2014 +@@ -173,7 +183,7 @@ static const struct nft_expr_ops nft_imm_ops = {
2015 + .dump = nft_immediate_dump,
2016 + .validate = nft_immediate_validate,
2017 + .offload = nft_immediate_offload,
2018 +- .offload_flags = NFT_OFFLOAD_F_ACTION,
2019 ++ .offload_action = nft_immediate_offload_action,
2020 + };
2021 +
2022 + struct nft_expr_type nft_imm_type __read_mostly = {
2023 +diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
2024 +index 5c68f9ea98810..2c0f8cbc5c43b 100644
2025 +--- a/net/openvswitch/actions.c
2026 ++++ b/net/openvswitch/actions.c
2027 +@@ -427,12 +427,43 @@ static void set_ipv6_addr(struct sk_buff *skb, u8 l4_proto,
2028 + memcpy(addr, new_addr, sizeof(__be32[4]));
2029 + }
2030 +
2031 +-static void set_ipv6_fl(struct ipv6hdr *nh, u32 fl, u32 mask)
2032 ++static void set_ipv6_dsfield(struct sk_buff *skb, struct ipv6hdr *nh, u8 ipv6_tclass, u8 mask)
2033 + {
2034 ++ u8 old_ipv6_tclass = ipv6_get_dsfield(nh);
2035 ++
2036 ++ ipv6_tclass = OVS_MASKED(old_ipv6_tclass, ipv6_tclass, mask);
2037 ++
2038 ++ if (skb->ip_summed == CHECKSUM_COMPLETE)
2039 ++ csum_replace(&skb->csum, (__force __wsum)(old_ipv6_tclass << 12),
2040 ++ (__force __wsum)(ipv6_tclass << 12));
2041 ++
2042 ++ ipv6_change_dsfield(nh, ~mask, ipv6_tclass);
2043 ++}
2044 ++
2045 ++static void set_ipv6_fl(struct sk_buff *skb, struct ipv6hdr *nh, u32 fl, u32 mask)
2046 ++{
2047 ++ u32 ofl;
2048 ++
2049 ++ ofl = nh->flow_lbl[0] << 16 | nh->flow_lbl[1] << 8 | nh->flow_lbl[2];
2050 ++ fl = OVS_MASKED(ofl, fl, mask);
2051 ++
2052 + /* Bits 21-24 are always unmasked, so this retains their values. */
2053 +- OVS_SET_MASKED(nh->flow_lbl[0], (u8)(fl >> 16), (u8)(mask >> 16));
2054 +- OVS_SET_MASKED(nh->flow_lbl[1], (u8)(fl >> 8), (u8)(mask >> 8));
2055 +- OVS_SET_MASKED(nh->flow_lbl[2], (u8)fl, (u8)mask);
2056 ++ nh->flow_lbl[0] = (u8)(fl >> 16);
2057 ++ nh->flow_lbl[1] = (u8)(fl >> 8);
2058 ++ nh->flow_lbl[2] = (u8)fl;
2059 ++
2060 ++ if (skb->ip_summed == CHECKSUM_COMPLETE)
2061 ++ csum_replace(&skb->csum, (__force __wsum)htonl(ofl), (__force __wsum)htonl(fl));
2062 ++}
2063 ++
2064 ++static void set_ipv6_ttl(struct sk_buff *skb, struct ipv6hdr *nh, u8 new_ttl, u8 mask)
2065 ++{
2066 ++ new_ttl = OVS_MASKED(nh->hop_limit, new_ttl, mask);
2067 ++
2068 ++ if (skb->ip_summed == CHECKSUM_COMPLETE)
2069 ++ csum_replace(&skb->csum, (__force __wsum)(nh->hop_limit << 8),
2070 ++ (__force __wsum)(new_ttl << 8));
2071 ++ nh->hop_limit = new_ttl;
2072 + }
2073 +
2074 + static void set_ip_ttl(struct sk_buff *skb, struct iphdr *nh, u8 new_ttl,
2075 +@@ -550,18 +581,17 @@ static int set_ipv6(struct sk_buff *skb, struct sw_flow_key *flow_key,
2076 + }
2077 + }
2078 + if (mask->ipv6_tclass) {
2079 +- ipv6_change_dsfield(nh, ~mask->ipv6_tclass, key->ipv6_tclass);
2080 ++ set_ipv6_dsfield(skb, nh, key->ipv6_tclass, mask->ipv6_tclass);
2081 + flow_key->ip.tos = ipv6_get_dsfield(nh);
2082 + }
2083 + if (mask->ipv6_label) {
2084 +- set_ipv6_fl(nh, ntohl(key->ipv6_label),
2085 ++ set_ipv6_fl(skb, nh, ntohl(key->ipv6_label),
2086 + ntohl(mask->ipv6_label));
2087 + flow_key->ipv6.label =
2088 + *(__be32 *)nh & htonl(IPV6_FLOWINFO_FLOWLABEL);
2089 + }
2090 + if (mask->ipv6_hlimit) {
2091 +- OVS_SET_MASKED(nh->hop_limit, key->ipv6_hlimit,
2092 +- mask->ipv6_hlimit);
2093 ++ set_ipv6_ttl(skb, nh, key->ipv6_hlimit, mask->ipv6_hlimit);
2094 + flow_key->ip.ttl = nh->hop_limit;
2095 + }
2096 + return 0;
2097 +diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
2098 +index 66a65c2cdb23c..c52083522b28e 100644
2099 +--- a/net/tipc/name_table.c
2100 ++++ b/net/tipc/name_table.c
2101 +@@ -812,7 +812,7 @@ static int __tipc_nl_add_nametable_publ(struct tipc_nl_msg *msg,
2102 + list_for_each_entry(p, &sr->all_publ, all_publ)
2103 + if (p->key == *last_key)
2104 + break;
2105 +- if (p->key != *last_key)
2106 ++ if (list_entry_is_head(p, &sr->all_publ, all_publ))
2107 + return -EPIPE;
2108 + } else {
2109 + p = list_first_entry(&sr->all_publ,
2110 +diff --git a/net/tipc/socket.c b/net/tipc/socket.c
2111 +index fbbac9ba2862f..f4217673eee70 100644
2112 +--- a/net/tipc/socket.c
2113 ++++ b/net/tipc/socket.c
2114 +@@ -3590,7 +3590,7 @@ static int __tipc_nl_list_sk_publ(struct sk_buff *skb,
2115 + if (p->key == *last_publ)
2116 + break;
2117 + }
2118 +- if (p->key != *last_publ) {
2119 ++ if (list_entry_is_head(p, &tsk->publications, binding_sock)) {
2120 + /* We never set seq or call nl_dump_check_consistent()
2121 + * this means that setting prev_seq here will cause the
2122 + * consistence check to fail in the netlink callback
2123 +diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
2124 +index a3f912615690f..3c874f52f1a25 100644
2125 +--- a/tools/perf/util/data.c
2126 ++++ b/tools/perf/util/data.c
2127 +@@ -44,10 +44,6 @@ int perf_data__create_dir(struct perf_data *data, int nr)
2128 + if (!files)
2129 + return -ENOMEM;
2130 +
2131 +- data->dir.version = PERF_DIR_VERSION;
2132 +- data->dir.files = files;
2133 +- data->dir.nr = nr;
2134 +-
2135 + for (i = 0; i < nr; i++) {
2136 + struct perf_data_file *file = &files[i];
2137 +
2138 +@@ -62,6 +58,9 @@ int perf_data__create_dir(struct perf_data *data, int nr)
2139 + file->fd = ret;
2140 + }
2141 +
2142 ++ data->dir.version = PERF_DIR_VERSION;
2143 ++ data->dir.files = files;
2144 ++ data->dir.nr = nr;
2145 + return 0;
2146 +
2147 + out_err: