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