Magellan Linux

Annotation of /trunk/kernel-alx/patches-5.4/0182-5.4.83-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3635 - (hide annotations) (download)
Mon Oct 24 12:34:12 2022 UTC (18 months, 3 weeks ago) by niro
File size: 63010 byte(s)
-sync kernel patches
1 niro 3635 diff --git a/Makefile b/Makefile
2     index e520dee34490a..eee1aa092ede8 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 = 82
10     +SUBLEVEL = 83
11     EXTRAVERSION =
12     NAME = Kleptomaniac Octopus
13    
14     diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
15     index 3a9f79d18f6b0..1b7b0d0c3ebdd 100644
16     --- a/arch/powerpc/platforms/powernv/setup.c
17     +++ b/arch/powerpc/platforms/powernv/setup.c
18     @@ -186,11 +186,16 @@ static void __init pnv_init(void)
19     add_preferred_console("hvc", 0, NULL);
20    
21     if (!radix_enabled()) {
22     + size_t size = sizeof(struct slb_entry) * mmu_slb_size;
23     int i;
24    
25     /* Allocate per cpu area to save old slb contents during MCE */
26     - for_each_possible_cpu(i)
27     - paca_ptrs[i]->mce_faulty_slbs = memblock_alloc_node(mmu_slb_size, __alignof__(*paca_ptrs[i]->mce_faulty_slbs), cpu_to_node(i));
28     + for_each_possible_cpu(i) {
29     + paca_ptrs[i]->mce_faulty_slbs =
30     + memblock_alloc_node(size,
31     + __alignof__(struct slb_entry),
32     + cpu_to_node(i));
33     + }
34     }
35     }
36    
37     diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
38     index 133f6adcb39cb..b3ac2455faadc 100644
39     --- a/arch/powerpc/platforms/pseries/msi.c
40     +++ b/arch/powerpc/platforms/pseries/msi.c
41     @@ -458,7 +458,8 @@ again:
42     return hwirq;
43     }
44    
45     - virq = irq_create_mapping(NULL, hwirq);
46     + virq = irq_create_mapping_affinity(NULL, hwirq,
47     + entry->affinity);
48    
49     if (!virq) {
50     pr_debug("rtas_msi: Failed mapping hwirq %d\n", hwirq);
51     diff --git a/arch/x86/include/asm/insn.h b/arch/x86/include/asm/insn.h
52     index 154f27be8bfcb..a51ffeea6d879 100644
53     --- a/arch/x86/include/asm/insn.h
54     +++ b/arch/x86/include/asm/insn.h
55     @@ -195,6 +195,21 @@ static inline int insn_offset_immediate(struct insn *insn)
56     return insn_offset_displacement(insn) + insn->displacement.nbytes;
57     }
58    
59     +/**
60     + * for_each_insn_prefix() -- Iterate prefixes in the instruction
61     + * @insn: Pointer to struct insn.
62     + * @idx: Index storage.
63     + * @prefix: Prefix byte.
64     + *
65     + * Iterate prefix bytes of given @insn. Each prefix byte is stored in @prefix
66     + * and the index is stored in @idx (note that this @idx is just for a cursor,
67     + * do not change it.)
68     + * Since prefixes.nbytes can be bigger than 4 if some prefixes
69     + * are repeated, it cannot be used for looping over the prefixes.
70     + */
71     +#define for_each_insn_prefix(insn, idx, prefix) \
72     + for (idx = 0; idx < ARRAY_SIZE(insn->prefixes.bytes) && (prefix = insn->prefixes.bytes[idx]) != 0; idx++)
73     +
74     #define POP_SS_OPCODE 0x1f
75     #define MOV_SREG_OPCODE 0x8e
76    
77     diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
78     index 8cd745ef8c7b7..fae5b00cbccfb 100644
79     --- a/arch/x86/kernel/uprobes.c
80     +++ b/arch/x86/kernel/uprobes.c
81     @@ -255,12 +255,13 @@ static volatile u32 good_2byte_insns[256 / 32] = {
82    
83     static bool is_prefix_bad(struct insn *insn)
84     {
85     + insn_byte_t p;
86     int i;
87    
88     - for (i = 0; i < insn->prefixes.nbytes; i++) {
89     + for_each_insn_prefix(insn, i, p) {
90     insn_attr_t attr;
91    
92     - attr = inat_get_opcode_attribute(insn->prefixes.bytes[i]);
93     + attr = inat_get_opcode_attribute(p);
94     switch (attr) {
95     case INAT_MAKE_PREFIX(INAT_PFX_ES):
96     case INAT_MAKE_PREFIX(INAT_PFX_CS):
97     @@ -715,6 +716,7 @@ static const struct uprobe_xol_ops push_xol_ops = {
98     static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn)
99     {
100     u8 opc1 = OPCODE1(insn);
101     + insn_byte_t p;
102     int i;
103    
104     switch (opc1) {
105     @@ -746,8 +748,8 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn)
106     * Intel and AMD behavior differ in 64-bit mode: Intel ignores 66 prefix.
107     * No one uses these insns, reject any branch insns with such prefix.
108     */
109     - for (i = 0; i < insn->prefixes.nbytes; i++) {
110     - if (insn->prefixes.bytes[i] == 0x66)
111     + for_each_insn_prefix(insn, i, p) {
112     + if (p == 0x66)
113     return -ENOTSUPP;
114     }
115    
116     diff --git a/arch/x86/lib/insn-eval.c b/arch/x86/lib/insn-eval.c
117     index 306c3a0902bad..cbe7e2503394f 100644
118     --- a/arch/x86/lib/insn-eval.c
119     +++ b/arch/x86/lib/insn-eval.c
120     @@ -70,14 +70,15 @@ static int get_seg_reg_override_idx(struct insn *insn)
121     {
122     int idx = INAT_SEG_REG_DEFAULT;
123     int num_overrides = 0, i;
124     + insn_byte_t p;
125    
126     insn_get_prefixes(insn);
127    
128     /* Look for any segment override prefixes. */
129     - for (i = 0; i < insn->prefixes.nbytes; i++) {
130     + for_each_insn_prefix(insn, i, p) {
131     insn_attr_t attr;
132    
133     - attr = inat_get_opcode_attribute(insn->prefixes.bytes[i]);
134     + attr = inat_get_opcode_attribute(p);
135     switch (attr) {
136     case INAT_MAKE_PREFIX(INAT_PFX_CS):
137     idx = INAT_SEG_REG_CS;
138     diff --git a/drivers/gpu/drm/i915/gt/intel_mocs.c b/drivers/gpu/drm/i915/gt/intel_mocs.c
139     index cea184a7dde9d..e97a2aa31485c 100644
140     --- a/drivers/gpu/drm/i915/gt/intel_mocs.c
141     +++ b/drivers/gpu/drm/i915/gt/intel_mocs.c
142     @@ -130,7 +130,19 @@ static const struct drm_i915_mocs_entry skylake_mocs_table[] = {
143     GEN9_MOCS_ENTRIES,
144     MOCS_ENTRY(I915_MOCS_CACHED,
145     LE_3_WB | LE_TC_2_LLC_ELLC | LE_LRUM(3),
146     - L3_3_WB)
147     + L3_3_WB),
148     +
149     + /*
150     + * mocs:63
151     + * - used by the L3 for all of its evictions.
152     + * Thus it is expected to allow LLC cacheability to enable coherent
153     + * flows to be maintained.
154     + * - used to force L3 uncachable cycles.
155     + * Thus it is expected to make the surface L3 uncacheable.
156     + */
157     + MOCS_ENTRY(63,
158     + LE_3_WB | LE_TC_1_LLC | LE_LRUM(3),
159     + L3_1_UC)
160     };
161    
162     /* NOTE: the LE_TGT_CACHE is not used on Broxton */
163     diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
164     index 9543c9816eed9..9d3f42fd63522 100644
165     --- a/drivers/i2c/busses/i2c-imx.c
166     +++ b/drivers/i2c/busses/i2c-imx.c
167     @@ -414,6 +414,19 @@ static void i2c_imx_dma_free(struct imx_i2c_struct *i2c_imx)
168     dma->chan_using = NULL;
169     }
170    
171     +static void i2c_imx_clear_irq(struct imx_i2c_struct *i2c_imx, unsigned int bits)
172     +{
173     + unsigned int temp;
174     +
175     + /*
176     + * i2sr_clr_opcode is the value to clear all interrupts. Here we want to
177     + * clear only <bits>, so we write ~i2sr_clr_opcode with just <bits>
178     + * toggled. This is required because i.MX needs W0C and Vybrid uses W1C.
179     + */
180     + temp = ~i2c_imx->hwdata->i2sr_clr_opcode ^ bits;
181     + imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR);
182     +}
183     +
184     static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy)
185     {
186     unsigned long orig_jiffies = jiffies;
187     @@ -426,8 +439,7 @@ static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy)
188    
189     /* check for arbitration lost */
190     if (temp & I2SR_IAL) {
191     - temp &= ~I2SR_IAL;
192     - imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR);
193     + i2c_imx_clear_irq(i2c_imx, I2SR_IAL);
194     return -EAGAIN;
195     }
196    
197     @@ -458,6 +470,16 @@ static int i2c_imx_trx_complete(struct imx_i2c_struct *i2c_imx)
198     dev_dbg(&i2c_imx->adapter.dev, "<%s> Timeout\n", __func__);
199     return -ETIMEDOUT;
200     }
201     +
202     + /* check for arbitration lost */
203     + if (i2c_imx->i2csr & I2SR_IAL) {
204     + dev_dbg(&i2c_imx->adapter.dev, "<%s> Arbitration lost\n", __func__);
205     + i2c_imx_clear_irq(i2c_imx, I2SR_IAL);
206     +
207     + i2c_imx->i2csr = 0;
208     + return -EAGAIN;
209     + }
210     +
211     dev_dbg(&i2c_imx->adapter.dev, "<%s> TRX complete\n", __func__);
212     i2c_imx->i2csr = 0;
213     return 0;
214     @@ -567,6 +589,8 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
215     /* Stop I2C transaction */
216     dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__);
217     temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);
218     + if (!(temp & I2CR_MSTA))
219     + i2c_imx->stopped = 1;
220     temp &= ~(I2CR_MSTA | I2CR_MTX);
221     if (i2c_imx->dma)
222     temp &= ~I2CR_DMAEN;
223     @@ -597,9 +621,7 @@ static irqreturn_t i2c_imx_isr(int irq, void *dev_id)
224     if (temp & I2SR_IIF) {
225     /* save status register */
226     i2c_imx->i2csr = temp;
227     - temp &= ~I2SR_IIF;
228     - temp |= (i2c_imx->hwdata->i2sr_clr_opcode & I2SR_IIF);
229     - imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR);
230     + i2c_imx_clear_irq(i2c_imx, I2SR_IIF);
231     wake_up(&i2c_imx->queue);
232     return IRQ_HANDLED;
233     }
234     @@ -732,9 +754,12 @@ static int i2c_imx_dma_read(struct imx_i2c_struct *i2c_imx,
235     */
236     dev_dbg(dev, "<%s> clear MSTA\n", __func__);
237     temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);
238     + if (!(temp & I2CR_MSTA))
239     + i2c_imx->stopped = 1;
240     temp &= ~(I2CR_MSTA | I2CR_MTX);
241     imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR);
242     - i2c_imx_bus_busy(i2c_imx, 0);
243     + if (!i2c_imx->stopped)
244     + i2c_imx_bus_busy(i2c_imx, 0);
245     } else {
246     /*
247     * For i2c master receiver repeat restart operation like:
248     @@ -857,9 +882,12 @@ static int i2c_imx_read(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs, bo
249     dev_dbg(&i2c_imx->adapter.dev,
250     "<%s> clear MSTA\n", __func__);
251     temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);
252     + if (!(temp & I2CR_MSTA))
253     + i2c_imx->stopped = 1;
254     temp &= ~(I2CR_MSTA | I2CR_MTX);
255     imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR);
256     - i2c_imx_bus_busy(i2c_imx, 0);
257     + if (!i2c_imx->stopped)
258     + i2c_imx_bus_busy(i2c_imx, 0);
259     } else {
260     /*
261     * For i2c master receiver repeat restart operation like:
262     diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
263     index e09cd0775ae91..3417f7dffa943 100644
264     --- a/drivers/i2c/busses/i2c-qup.c
265     +++ b/drivers/i2c/busses/i2c-qup.c
266     @@ -806,7 +806,8 @@ static int qup_i2c_bam_schedule_desc(struct qup_i2c_dev *qup)
267     if (ret || qup->bus_err || qup->qup_err) {
268     reinit_completion(&qup->xfer);
269    
270     - if (qup_i2c_change_state(qup, QUP_RUN_STATE)) {
271     + ret = qup_i2c_change_state(qup, QUP_RUN_STATE);
272     + if (ret) {
273     dev_err(qup->dev, "change to run state timed out");
274     goto desc_err;
275     }
276     diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
277     index 5a89c1cfdaa97..6ff6b5710dd4e 100644
278     --- a/drivers/input/serio/i8042.c
279     +++ b/drivers/input/serio/i8042.c
280     @@ -1468,7 +1468,8 @@ static int __init i8042_setup_aux(void)
281     if (error)
282     goto err_free_ports;
283    
284     - if (aux_enable())
285     + error = aux_enable();
286     + if (error)
287     goto err_free_irq;
288    
289     i8042_aux_irq_registered = true;
290     diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h
291     index 3ec090adcdae7..76e9d3e2f9f20 100644
292     --- a/drivers/iommu/amd_iommu_types.h
293     +++ b/drivers/iommu/amd_iommu_types.h
294     @@ -254,7 +254,7 @@
295     #define DTE_IRQ_REMAP_INTCTL_MASK (0x3ULL << 60)
296     #define DTE_IRQ_TABLE_LEN_MASK (0xfULL << 1)
297     #define DTE_IRQ_REMAP_INTCTL (2ULL << 60)
298     -#define DTE_IRQ_TABLE_LEN (8ULL << 1)
299     +#define DTE_IRQ_TABLE_LEN (9ULL << 1)
300     #define DTE_IRQ_REMAP_ENABLE 1ULL
301    
302     #define PAGE_MODE_NONE 0x00
303     diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
304     index 4e414b06192eb..08ae59a6e8734 100644
305     --- a/drivers/md/dm-writecache.c
306     +++ b/drivers/md/dm-writecache.c
307     @@ -316,7 +316,7 @@ err1:
308     #else
309     static int persistent_memory_claim(struct dm_writecache *wc)
310     {
311     - BUG();
312     + return -EOPNOTSUPP;
313     }
314     #endif
315    
316     @@ -1889,7 +1889,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
317     struct wc_memory_superblock s;
318    
319     static struct dm_arg _args[] = {
320     - {0, 10, "Invalid number of feature args"},
321     + {0, 16, "Invalid number of feature args"},
322     };
323    
324     as.argc = argc;
325     diff --git a/drivers/md/dm.c b/drivers/md/dm.c
326     index 667db23f10ee1..bf3c2a1159e68 100644
327     --- a/drivers/md/dm.c
328     +++ b/drivers/md/dm.c
329     @@ -455,8 +455,10 @@ static int dm_blk_report_zones(struct gendisk *disk, sector_t sector,
330     return -EAGAIN;
331    
332     map = dm_get_live_table(md, &srcu_idx);
333     - if (!map)
334     - return -EIO;
335     + if (!map) {
336     + ret = -EIO;
337     + goto out;
338     + }
339    
340     tgt = dm_table_find_target(map, sector);
341     if (!tgt) {
342     @@ -493,7 +495,6 @@ out:
343    
344     static int dm_prepare_ioctl(struct mapped_device *md, int *srcu_idx,
345     struct block_device **bdev)
346     - __acquires(md->io_barrier)
347     {
348     struct dm_target *tgt;
349     struct dm_table *map;
350     @@ -527,7 +528,6 @@ retry:
351     }
352    
353     static void dm_unprepare_ioctl(struct mapped_device *md, int srcu_idx)
354     - __releases(md->io_barrier)
355     {
356     dm_put_live_table(md, srcu_idx);
357     }
358     diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
359     index 496ae07aca5e5..c7ec3d24eabc8 100644
360     --- a/drivers/net/geneve.c
361     +++ b/drivers/net/geneve.c
362     @@ -254,21 +254,11 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs,
363     skb_dst_set(skb, &tun_dst->dst);
364    
365     /* Ignore packet loops (and multicast echo) */
366     - if (ether_addr_equal(eth_hdr(skb)->h_source, geneve->dev->dev_addr))
367     - goto rx_error;
368     -
369     - switch (skb_protocol(skb, true)) {
370     - case htons(ETH_P_IP):
371     - if (pskb_may_pull(skb, sizeof(struct iphdr)))
372     - goto rx_error;
373     - break;
374     - case htons(ETH_P_IPV6):
375     - if (pskb_may_pull(skb, sizeof(struct ipv6hdr)))
376     - goto rx_error;
377     - break;
378     - default:
379     - goto rx_error;
380     + if (ether_addr_equal(eth_hdr(skb)->h_source, geneve->dev->dev_addr)) {
381     + geneve->dev->stats.rx_errors++;
382     + goto drop;
383     }
384     +
385     oiph = skb_network_header(skb);
386     skb_reset_network_header(skb);
387    
388     @@ -309,8 +299,6 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs,
389     u64_stats_update_end(&stats->syncp);
390     }
391     return;
392     -rx_error:
393     - geneve->dev->stats.rx_errors++;
394     drop:
395     /* Consume bad packet */
396     kfree_skb(skb);
397     diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c
398     index 6ad985e98e425..5a906101498d9 100644
399     --- a/drivers/net/wireless/realtek/rtw88/debug.c
400     +++ b/drivers/net/wireless/realtek/rtw88/debug.c
401     @@ -146,6 +146,8 @@ static int rtw_debugfs_copy_from_user(char tmp[], int size,
402     {
403     int tmp_len;
404    
405     + memset(tmp, 0, size);
406     +
407     if (count < num)
408     return -EFAULT;
409    
410     diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
411     index cae7caf5ab282..5a1174a8e2bac 100644
412     --- a/drivers/pinctrl/intel/pinctrl-baytrail.c
413     +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
414     @@ -811,6 +811,21 @@ static void byt_gpio_disable_free(struct pinctrl_dev *pctl_dev,
415     pm_runtime_put(&vg->pdev->dev);
416     }
417    
418     +static void byt_gpio_direct_irq_check(struct byt_gpio *vg,
419     + unsigned int offset)
420     +{
421     + void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG);
422     +
423     + /*
424     + * Before making any direction modifications, do a check if gpio is set
425     + * for direct IRQ. On Bay Trail, setting GPIO to output does not make
426     + * sense, so let's at least inform the caller before they shoot
427     + * themselves in the foot.
428     + */
429     + if (readl(conf_reg) & BYT_DIRECT_IRQ_EN)
430     + dev_info_once(&vg->pdev->dev, "Potential Error: Setting GPIO with direct_irq_en to output");
431     +}
432     +
433     static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev,
434     struct pinctrl_gpio_range *range,
435     unsigned int offset,
436     @@ -818,7 +833,6 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev,
437     {
438     struct byt_gpio *vg = pinctrl_dev_get_drvdata(pctl_dev);
439     void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG);
440     - void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG);
441     unsigned long flags;
442     u32 value;
443    
444     @@ -829,14 +843,8 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev,
445     if (input)
446     value |= BYT_OUTPUT_EN;
447     else
448     - /*
449     - * Before making any direction modifications, do a check if gpio
450     - * is set for direct IRQ. On baytrail, setting GPIO to output
451     - * does not make sense, so let's at least warn the caller before
452     - * they shoot themselves in the foot.
453     - */
454     - WARN(readl(conf_reg) & BYT_DIRECT_IRQ_EN,
455     - "Potential Error: Setting GPIO with direct_irq_en to output");
456     + byt_gpio_direct_irq_check(vg, offset);
457     +
458     writel(value, val_reg);
459    
460     raw_spin_unlock_irqrestore(&byt_lock, flags);
461     @@ -1176,19 +1184,50 @@ static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
462    
463     static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
464     {
465     - return pinctrl_gpio_direction_input(chip->base + offset);
466     + struct byt_gpio *vg = gpiochip_get_data(chip);
467     + void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG);
468     + unsigned long flags;
469     + u32 reg;
470     +
471     + raw_spin_lock_irqsave(&byt_lock, flags);
472     +
473     + reg = readl(val_reg);
474     + reg &= ~BYT_DIR_MASK;
475     + reg |= BYT_OUTPUT_EN;
476     + writel(reg, val_reg);
477     +
478     + raw_spin_unlock_irqrestore(&byt_lock, flags);
479     + return 0;
480     }
481    
482     +/*
483     + * Note despite the temptation this MUST NOT be converted into a call to
484     + * pinctrl_gpio_direction_output() + byt_gpio_set() that does not work this
485     + * MUST be done as a single BYT_VAL_REG register write.
486     + * See the commit message of the commit adding this comment for details.
487     + */
488     static int byt_gpio_direction_output(struct gpio_chip *chip,
489     unsigned int offset, int value)
490     {
491     - int ret = pinctrl_gpio_direction_output(chip->base + offset);
492     + struct byt_gpio *vg = gpiochip_get_data(chip);
493     + void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG);
494     + unsigned long flags;
495     + u32 reg;
496    
497     - if (ret)
498     - return ret;
499     + raw_spin_lock_irqsave(&byt_lock, flags);
500    
501     - byt_gpio_set(chip, offset, value);
502     + byt_gpio_direct_irq_check(vg, offset);
503    
504     + reg = readl(val_reg);
505     + reg &= ~BYT_DIR_MASK;
506     + if (value)
507     + reg |= BYT_LEVEL;
508     + else
509     + reg &= ~BYT_LEVEL;
510     +
511     + writel(reg, val_reg);
512     +
513     + raw_spin_unlock_irqrestore(&byt_lock, flags);
514     return 0;
515     }
516    
517     diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
518     index bae7cf70ee177..1c5c172315de4 100644
519     --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
520     +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
521     @@ -650,7 +650,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
522     Mpi26NVMeEncapsulatedRequest_t *nvme_encap_request = NULL;
523     struct _pcie_device *pcie_device = NULL;
524     u16 smid;
525     - u8 timeout;
526     + unsigned long timeout;
527     u8 issue_reset;
528     u32 sz, sz_arg;
529     void *psge;
530     diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
531     index 5bc97b22491cd..56ee84e85bee2 100644
532     --- a/drivers/spi/spi-bcm2835.c
533     +++ b/drivers/spi/spi-bcm2835.c
534     @@ -1310,21 +1310,22 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
535     dev_name(&pdev->dev), ctlr);
536     if (err) {
537     dev_err(&pdev->dev, "could not request IRQ: %d\n", err);
538     - goto out_clk_disable;
539     + goto out_dma_release;
540     }
541    
542     err = spi_register_controller(ctlr);
543     if (err) {
544     dev_err(&pdev->dev, "could not register SPI controller: %d\n",
545     err);
546     - goto out_clk_disable;
547     + goto out_dma_release;
548     }
549    
550     bcm2835_debugfs_create(bs, dev_name(&pdev->dev));
551    
552     return 0;
553    
554     -out_clk_disable:
555     +out_dma_release:
556     + bcm2835_dma_release(ctlr, bs);
557     clk_disable_unprepare(bs->clk);
558     return err;
559     }
560     diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c
561     index 9917dbce24703..472804c3f44dc 100644
562     --- a/drivers/staging/speakup/spk_ttyio.c
563     +++ b/drivers/staging/speakup/spk_ttyio.c
564     @@ -47,27 +47,20 @@ static int spk_ttyio_ldisc_open(struct tty_struct *tty)
565     {
566     struct spk_ldisc_data *ldisc_data;
567    
568     + if (tty != speakup_tty)
569     + /* Somebody tried to use this line discipline outside speakup */
570     + return -ENODEV;
571     +
572     if (!tty->ops->write)
573     return -EOPNOTSUPP;
574    
575     - mutex_lock(&speakup_tty_mutex);
576     - if (speakup_tty) {
577     - mutex_unlock(&speakup_tty_mutex);
578     - return -EBUSY;
579     - }
580     - speakup_tty = tty;
581     -
582     ldisc_data = kmalloc(sizeof(struct spk_ldisc_data), GFP_KERNEL);
583     - if (!ldisc_data) {
584     - speakup_tty = NULL;
585     - mutex_unlock(&speakup_tty_mutex);
586     + if (!ldisc_data)
587     return -ENOMEM;
588     - }
589    
590     init_completion(&ldisc_data->completion);
591     ldisc_data->buf_free = true;
592     - speakup_tty->disc_data = ldisc_data;
593     - mutex_unlock(&speakup_tty_mutex);
594     + tty->disc_data = ldisc_data;
595    
596     return 0;
597     }
598     @@ -189,9 +182,25 @@ static int spk_ttyio_initialise_ldisc(struct spk_synth *synth)
599    
600     tty_unlock(tty);
601    
602     + mutex_lock(&speakup_tty_mutex);
603     + speakup_tty = tty;
604     ret = tty_set_ldisc(tty, N_SPEAKUP);
605     if (ret)
606     - pr_err("speakup: Failed to set N_SPEAKUP on tty\n");
607     + speakup_tty = NULL;
608     + mutex_unlock(&speakup_tty_mutex);
609     +
610     + if (!ret)
611     + /* Success */
612     + return 0;
613     +
614     + pr_err("speakup: Failed to set N_SPEAKUP on tty\n");
615     +
616     + tty_lock(tty);
617     + if (tty->ops->close)
618     + tty->ops->close(tty, NULL);
619     + tty_unlock(tty);
620     +
621     + tty_kclose(tty);
622    
623     return ret;
624     }
625     diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c
626     index 245588f691e79..2f932b61b69ad 100644
627     --- a/drivers/thunderbolt/icm.c
628     +++ b/drivers/thunderbolt/icm.c
629     @@ -1919,7 +1919,9 @@ static int complete_rpm(struct device *dev, void *data)
630    
631     static void remove_unplugged_switch(struct tb_switch *sw)
632     {
633     - pm_runtime_get_sync(sw->dev.parent);
634     + struct device *parent = get_device(sw->dev.parent);
635     +
636     + pm_runtime_get_sync(parent);
637    
638     /*
639     * Signal this and switches below for rpm_complete because
640     @@ -1930,8 +1932,10 @@ static void remove_unplugged_switch(struct tb_switch *sw)
641     bus_for_each_dev(&tb_bus_type, &sw->dev, NULL, complete_rpm);
642     tb_switch_remove(sw);
643    
644     - pm_runtime_mark_last_busy(sw->dev.parent);
645     - pm_runtime_put_autosuspend(sw->dev.parent);
646     + pm_runtime_mark_last_busy(parent);
647     + pm_runtime_put_autosuspend(parent);
648     +
649     + put_device(parent);
650     }
651    
652     static void icm_free_unplugged_children(struct tb_switch *sw)
653     diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
654     index 36c1c59cc72a2..642765bf10230 100644
655     --- a/drivers/tty/tty_io.c
656     +++ b/drivers/tty/tty_io.c
657     @@ -2894,10 +2894,14 @@ void __do_SAK(struct tty_struct *tty)
658     struct task_struct *g, *p;
659     struct pid *session;
660     int i;
661     + unsigned long flags;
662    
663     if (!tty)
664     return;
665     - session = tty->session;
666     +
667     + spin_lock_irqsave(&tty->ctrl_lock, flags);
668     + session = get_pid(tty->session);
669     + spin_unlock_irqrestore(&tty->ctrl_lock, flags);
670    
671     tty_ldisc_flush(tty);
672    
673     @@ -2929,6 +2933,7 @@ void __do_SAK(struct tty_struct *tty)
674     task_unlock(p);
675     } while_each_thread(g, p);
676     read_unlock(&tasklist_lock);
677     + put_pid(session);
678     #endif
679     }
680    
681     diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c
682     index f8ed50a168481..813be2c052629 100644
683     --- a/drivers/tty/tty_jobctrl.c
684     +++ b/drivers/tty/tty_jobctrl.c
685     @@ -103,8 +103,8 @@ static void __proc_set_tty(struct tty_struct *tty)
686     put_pid(tty->session);
687     put_pid(tty->pgrp);
688     tty->pgrp = get_pid(task_pgrp(current));
689     - spin_unlock_irqrestore(&tty->ctrl_lock, flags);
690     tty->session = get_pid(task_session(current));
691     + spin_unlock_irqrestore(&tty->ctrl_lock, flags);
692     if (current->signal->tty) {
693     tty_debug(tty, "current tty %s not NULL!!\n",
694     current->signal->tty->name);
695     @@ -293,20 +293,23 @@ void disassociate_ctty(int on_exit)
696     spin_lock_irq(&current->sighand->siglock);
697     put_pid(current->signal->tty_old_pgrp);
698     current->signal->tty_old_pgrp = NULL;
699     -
700     tty = tty_kref_get(current->signal->tty);
701     + spin_unlock_irq(&current->sighand->siglock);
702     +
703     if (tty) {
704     unsigned long flags;
705     +
706     + tty_lock(tty);
707     spin_lock_irqsave(&tty->ctrl_lock, flags);
708     put_pid(tty->session);
709     put_pid(tty->pgrp);
710     tty->session = NULL;
711     tty->pgrp = NULL;
712     spin_unlock_irqrestore(&tty->ctrl_lock, flags);
713     + tty_unlock(tty);
714     tty_kref_put(tty);
715     }
716    
717     - spin_unlock_irq(&current->sighand->siglock);
718     /* Now clear signal->tty under the lock */
719     read_lock(&tasklist_lock);
720     session_clear_tty(task_session(current));
721     @@ -477,14 +480,19 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t
722     return -ENOTTY;
723     if (retval)
724     return retval;
725     - if (!current->signal->tty ||
726     - (current->signal->tty != real_tty) ||
727     - (real_tty->session != task_session(current)))
728     - return -ENOTTY;
729     +
730     if (get_user(pgrp_nr, p))
731     return -EFAULT;
732     if (pgrp_nr < 0)
733     return -EINVAL;
734     +
735     + spin_lock_irq(&real_tty->ctrl_lock);
736     + if (!current->signal->tty ||
737     + (current->signal->tty != real_tty) ||
738     + (real_tty->session != task_session(current))) {
739     + retval = -ENOTTY;
740     + goto out_unlock_ctrl;
741     + }
742     rcu_read_lock();
743     pgrp = find_vpid(pgrp_nr);
744     retval = -ESRCH;
745     @@ -494,12 +502,12 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t
746     if (session_of_pgrp(pgrp) != task_session(current))
747     goto out_unlock;
748     retval = 0;
749     - spin_lock_irq(&tty->ctrl_lock);
750     put_pid(real_tty->pgrp);
751     real_tty->pgrp = get_pid(pgrp);
752     - spin_unlock_irq(&tty->ctrl_lock);
753     out_unlock:
754     rcu_read_unlock();
755     +out_unlock_ctrl:
756     + spin_unlock_irq(&real_tty->ctrl_lock);
757     return retval;
758     }
759    
760     @@ -511,20 +519,30 @@ out_unlock:
761     *
762     * Obtain the session id of the tty. If there is no session
763     * return an error.
764     - *
765     - * Locking: none. Reference to current->signal->tty is safe.
766     */
767     static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
768     {
769     + unsigned long flags;
770     + pid_t sid;
771     +
772     /*
773     * (tty == real_tty) is a cheap way of
774     * testing if the tty is NOT a master pty.
775     */
776     if (tty == real_tty && current->signal->tty != real_tty)
777     return -ENOTTY;
778     +
779     + spin_lock_irqsave(&real_tty->ctrl_lock, flags);
780     if (!real_tty->session)
781     - return -ENOTTY;
782     - return put_user(pid_vnr(real_tty->session), p);
783     + goto err;
784     + sid = pid_vnr(real_tty->session);
785     + spin_unlock_irqrestore(&real_tty->ctrl_lock, flags);
786     +
787     + return put_user(sid, p);
788     +
789     +err:
790     + spin_unlock_irqrestore(&real_tty->ctrl_lock, flags);
791     + return -ENOTTY;
792     }
793    
794     /*
795     diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
796     index f8bcfc506f4a3..d2cfb8ff9ca8a 100644
797     --- a/drivers/usb/gadget/function/f_fs.c
798     +++ b/drivers/usb/gadget/function/f_fs.c
799     @@ -1328,7 +1328,7 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code,
800     case FUNCTIONFS_ENDPOINT_DESC:
801     {
802     int desc_idx;
803     - struct usb_endpoint_descriptor *desc;
804     + struct usb_endpoint_descriptor desc1, *desc;
805    
806     switch (epfile->ffs->gadget->speed) {
807     case USB_SPEED_SUPER:
808     @@ -1340,10 +1340,12 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code,
809     default:
810     desc_idx = 0;
811     }
812     +
813     desc = epfile->ep->descs[desc_idx];
814     + memcpy(&desc1, desc, desc->bLength);
815    
816     spin_unlock_irq(&epfile->ffs->eps_lock);
817     - ret = copy_to_user((void __user *)value, desc, desc->bLength);
818     + ret = copy_to_user((void __user *)value, &desc1, desc1.bLength);
819     if (ret)
820     ret = -EFAULT;
821     return ret;
822     diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
823     index 390bc4b250453..fdaefbe924908 100644
824     --- a/drivers/usb/serial/ch341.c
825     +++ b/drivers/usb/serial/ch341.c
826     @@ -80,10 +80,11 @@
827     #define CH341_LCR_CS5 0x00
828    
829     static const struct usb_device_id id_table[] = {
830     - { USB_DEVICE(0x4348, 0x5523) },
831     + { USB_DEVICE(0x1a86, 0x5512) },
832     + { USB_DEVICE(0x1a86, 0x5523) },
833     { USB_DEVICE(0x1a86, 0x7522) },
834     { USB_DEVICE(0x1a86, 0x7523) },
835     - { USB_DEVICE(0x1a86, 0x5523) },
836     + { USB_DEVICE(0x4348, 0x5523) },
837     { },
838     };
839     MODULE_DEVICE_TABLE(usb, id_table);
840     diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
841     index 5ee48b0650c45..5f6b82ebccc5a 100644
842     --- a/drivers/usb/serial/kl5kusb105.c
843     +++ b/drivers/usb/serial/kl5kusb105.c
844     @@ -276,12 +276,12 @@ static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port)
845     priv->cfg.unknown2 = cfg->unknown2;
846     spin_unlock_irqrestore(&priv->lock, flags);
847    
848     + kfree(cfg);
849     +
850     /* READ_ON and urb submission */
851     rc = usb_serial_generic_open(tty, port);
852     - if (rc) {
853     - retval = rc;
854     - goto err_free_cfg;
855     - }
856     + if (rc)
857     + return rc;
858    
859     rc = usb_control_msg(port->serial->dev,
860     usb_sndctrlpipe(port->serial->dev, 0),
861     @@ -324,8 +324,6 @@ err_disable_read:
862     KLSI_TIMEOUT);
863     err_generic_close:
864     usb_serial_generic_close(port);
865     -err_free_cfg:
866     - kfree(cfg);
867    
868     return retval;
869     }
870     diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
871     index 741c72bd499a9..c2ef238653002 100644
872     --- a/drivers/usb/serial/option.c
873     +++ b/drivers/usb/serial/option.c
874     @@ -419,6 +419,7 @@ static void option_instat_callback(struct urb *urb);
875     #define CINTERION_PRODUCT_PH8 0x0053
876     #define CINTERION_PRODUCT_AHXX 0x0055
877     #define CINTERION_PRODUCT_PLXX 0x0060
878     +#define CINTERION_PRODUCT_EXS82 0x006c
879     #define CINTERION_PRODUCT_PH8_2RMNET 0x0082
880     #define CINTERION_PRODUCT_PH8_AUDIO 0x0083
881     #define CINTERION_PRODUCT_AHXX_2RMNET 0x0084
882     @@ -1105,9 +1106,8 @@ static const struct usb_device_id option_ids[] = {
883     { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff),
884     .driver_info = NUMEP2 },
885     { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) },
886     - { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0xff, 0xff),
887     - .driver_info = NUMEP2 },
888     - { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0, 0) },
889     + { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
890     + .driver_info = RSVD(4) },
891     { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff),
892     .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
893     { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
894     @@ -1902,6 +1902,7 @@ static const struct usb_device_id option_ids[] = {
895     { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_AUDIO, 0xff) },
896     { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_CLS8, 0xff),
897     .driver_info = RSVD(0) | RSVD(4) },
898     + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EXS82, 0xff) },
899     { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
900     { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
901     { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
902     @@ -2046,12 +2047,13 @@ static const struct usb_device_id option_ids[] = {
903     .driver_info = RSVD(0) | RSVD(1) | RSVD(6) },
904     { USB_DEVICE(0x0489, 0xe0b5), /* Foxconn T77W968 ESIM */
905     .driver_info = RSVD(0) | RSVD(1) | RSVD(6) },
906     - { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 */
907     + { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */
908     .driver_info = RSVD(4) | RSVD(5) | RSVD(6) },
909     { USB_DEVICE(0x2cb7, 0x0104), /* Fibocom NL678 series */
910     .driver_info = RSVD(4) | RSVD(5) },
911     { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0105, 0xff), /* Fibocom NL678 series */
912     .driver_info = RSVD(6) },
913     + { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a0, 0xff) }, /* Fibocom NL668-AM/NL652-EU (laptop MBIM) */
914     { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */
915     { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */
916     { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) }, /* GosunCn GM500 ECM/NCM */
917     diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
918     index f5df2a4195c24..ab9eeb5ff8e57 100644
919     --- a/fs/cifs/connect.c
920     +++ b/fs/cifs/connect.c
921     @@ -975,6 +975,8 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)
922     list_del_init(&server->tcp_ses_list);
923     spin_unlock(&cifs_tcp_ses_lock);
924    
925     + cancel_delayed_work_sync(&server->echo);
926     +
927     spin_lock(&GlobalMid_Lock);
928     server->tcpStatus = CifsExiting;
929     spin_unlock(&GlobalMid_Lock);
930     diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
931     index eafc49de4d7f7..6d6de183915b5 100644
932     --- a/fs/cifs/transport.c
933     +++ b/fs/cifs/transport.c
934     @@ -340,8 +340,8 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
935     return -EAGAIN;
936    
937     if (signal_pending(current)) {
938     - cifs_dbg(FYI, "signal is pending before sending any data\n");
939     - return -EINTR;
940     + cifs_dbg(FYI, "signal pending before send request\n");
941     + return -ERESTARTSYS;
942     }
943    
944     /* cork the socket */
945     diff --git a/fs/coredump.c b/fs/coredump.c
946     index 5c0375e7440f6..f34767eedf38e 100644
947     --- a/fs/coredump.c
948     +++ b/fs/coredump.c
949     @@ -224,7 +224,8 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm,
950     */
951     if (ispipe) {
952     if (isspace(*pat_ptr)) {
953     - was_space = true;
954     + if (cn->used != 0)
955     + was_space = true;
956     pat_ptr++;
957     continue;
958     } else if (was_space) {
959     diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
960     index 5d9d93ca0db70..c056ed5c6df30 100644
961     --- a/fs/gfs2/rgrp.c
962     +++ b/fs/gfs2/rgrp.c
963     @@ -1008,6 +1008,10 @@ static int gfs2_ri_update(struct gfs2_inode *ip)
964     if (error < 0)
965     return error;
966    
967     + if (RB_EMPTY_ROOT(&sdp->sd_rindex_tree)) {
968     + fs_err(sdp, "no resource groups found in the file system.\n");
969     + return -ENOENT;
970     + }
971     set_rgrp_preferences(sdp);
972    
973     sdp->sd_rindex_uptodate = 1;
974     diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
975     index e85f714a623ef..824d7a19dd66e 100644
976     --- a/include/linux/irqdomain.h
977     +++ b/include/linux/irqdomain.h
978     @@ -382,11 +382,19 @@ extern void irq_domain_associate_many(struct irq_domain *domain,
979     extern void irq_domain_disassociate(struct irq_domain *domain,
980     unsigned int irq);
981    
982     -extern unsigned int irq_create_mapping(struct irq_domain *host,
983     - irq_hw_number_t hwirq);
984     +extern unsigned int irq_create_mapping_affinity(struct irq_domain *host,
985     + irq_hw_number_t hwirq,
986     + const struct irq_affinity_desc *affinity);
987     extern unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec);
988     extern void irq_dispose_mapping(unsigned int virq);
989    
990     +static inline unsigned int irq_create_mapping(struct irq_domain *host,
991     + irq_hw_number_t hwirq)
992     +{
993     + return irq_create_mapping_affinity(host, hwirq, NULL);
994     +}
995     +
996     +
997     /**
998     * irq_linear_revmap() - Find a linux irq from a hw irq number.
999     * @domain: domain owning this hardware interrupt
1000     diff --git a/include/linux/tty.h b/include/linux/tty.h
1001     index a99e9b8e4e316..eb33d948788cc 100644
1002     --- a/include/linux/tty.h
1003     +++ b/include/linux/tty.h
1004     @@ -306,6 +306,10 @@ struct tty_struct {
1005     struct termiox *termiox; /* May be NULL for unsupported */
1006     char name[64];
1007     struct pid *pgrp; /* Protected by ctrl lock */
1008     + /*
1009     + * Writes protected by both ctrl lock and legacy mutex, readers must use
1010     + * at least one of them.
1011     + */
1012     struct pid *session;
1013     unsigned long flags;
1014     int count;
1015     diff --git a/include/net/netfilter/nf_tables_offload.h b/include/net/netfilter/nf_tables_offload.h
1016     index 03cf5856d76f2..d0bb9e3bcec1c 100644
1017     --- a/include/net/netfilter/nf_tables_offload.h
1018     +++ b/include/net/netfilter/nf_tables_offload.h
1019     @@ -37,6 +37,7 @@ void nft_offload_update_dependency(struct nft_offload_ctx *ctx,
1020    
1021     struct nft_flow_key {
1022     struct flow_dissector_key_basic basic;
1023     + struct flow_dissector_key_control control;
1024     union {
1025     struct flow_dissector_key_ipv4_addrs ipv4;
1026     struct flow_dissector_key_ipv6_addrs ipv6;
1027     @@ -61,6 +62,9 @@ struct nft_flow_rule {
1028    
1029     #define NFT_OFFLOAD_F_ACTION (1 << 0)
1030    
1031     +void nft_flow_rule_set_addr_type(struct nft_flow_rule *flow,
1032     + enum flow_dissector_key_id addr_type);
1033     +
1034     struct nft_rule;
1035     struct nft_flow_rule *nft_flow_rule_create(struct net *net, const struct nft_rule *rule);
1036     void nft_flow_rule_destroy(struct nft_flow_rule *flow);
1037     diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
1038     index c776b8e86fbcc..5a60de39457c7 100644
1039     --- a/kernel/irq/irqdomain.c
1040     +++ b/kernel/irq/irqdomain.c
1041     @@ -638,17 +638,19 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain)
1042     EXPORT_SYMBOL_GPL(irq_create_direct_mapping);
1043    
1044     /**
1045     - * irq_create_mapping() - Map a hardware interrupt into linux irq space
1046     + * irq_create_mapping_affinity() - Map a hardware interrupt into linux irq space
1047     * @domain: domain owning this hardware interrupt or NULL for default domain
1048     * @hwirq: hardware irq number in that domain space
1049     + * @affinity: irq affinity
1050     *
1051     * Only one mapping per hardware interrupt is permitted. Returns a linux
1052     * irq number.
1053     * If the sense/trigger is to be specified, set_irq_type() should be called
1054     * on the number returned from that call.
1055     */
1056     -unsigned int irq_create_mapping(struct irq_domain *domain,
1057     - irq_hw_number_t hwirq)
1058     +unsigned int irq_create_mapping_affinity(struct irq_domain *domain,
1059     + irq_hw_number_t hwirq,
1060     + const struct irq_affinity_desc *affinity)
1061     {
1062     struct device_node *of_node;
1063     int virq;
1064     @@ -674,7 +676,8 @@ unsigned int irq_create_mapping(struct irq_domain *domain,
1065     }
1066    
1067     /* Allocate a virtual interrupt number */
1068     - virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node), NULL);
1069     + virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node),
1070     + affinity);
1071     if (virq <= 0) {
1072     pr_debug("-> virq allocation failed\n");
1073     return 0;
1074     @@ -690,7 +693,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain,
1075    
1076     return virq;
1077     }
1078     -EXPORT_SYMBOL_GPL(irq_create_mapping);
1079     +EXPORT_SYMBOL_GPL(irq_create_mapping_affinity);
1080    
1081     /**
1082     * irq_create_strict_mappings() - Map a range of hw irqs to fixed linux irqs
1083     diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
1084     index fbba31baef53c..cbb76ffaf499f 100644
1085     --- a/kernel/trace/ftrace.c
1086     +++ b/kernel/trace/ftrace.c
1087     @@ -1626,6 +1626,8 @@ static bool test_rec_ops_needs_regs(struct dyn_ftrace *rec)
1088     static struct ftrace_ops *
1089     ftrace_find_tramp_ops_any(struct dyn_ftrace *rec);
1090     static struct ftrace_ops *
1091     +ftrace_find_tramp_ops_any_other(struct dyn_ftrace *rec, struct ftrace_ops *op_exclude);
1092     +static struct ftrace_ops *
1093     ftrace_find_tramp_ops_next(struct dyn_ftrace *rec, struct ftrace_ops *ops);
1094    
1095     static bool __ftrace_hash_rec_update(struct ftrace_ops *ops,
1096     @@ -1763,7 +1765,7 @@ static bool __ftrace_hash_rec_update(struct ftrace_ops *ops,
1097     * to it.
1098     */
1099     if (ftrace_rec_count(rec) == 1 &&
1100     - ftrace_find_tramp_ops_any(rec))
1101     + ftrace_find_tramp_ops_any_other(rec, ops))
1102     rec->flags |= FTRACE_FL_TRAMP;
1103     else
1104     rec->flags &= ~FTRACE_FL_TRAMP;
1105     @@ -2191,6 +2193,24 @@ ftrace_find_tramp_ops_any(struct dyn_ftrace *rec)
1106     return NULL;
1107     }
1108    
1109     +static struct ftrace_ops *
1110     +ftrace_find_tramp_ops_any_other(struct dyn_ftrace *rec, struct ftrace_ops *op_exclude)
1111     +{
1112     + struct ftrace_ops *op;
1113     + unsigned long ip = rec->ip;
1114     +
1115     + do_for_each_ftrace_op(op, ftrace_ops_list) {
1116     +
1117     + if (op == op_exclude || !op->trampoline)
1118     + continue;
1119     +
1120     + if (hash_contains_ip(ip, op->func_hash))
1121     + return op;
1122     + } while_for_each_ftrace_op(op);
1123     +
1124     + return NULL;
1125     +}
1126     +
1127     static struct ftrace_ops *
1128     ftrace_find_tramp_ops_next(struct dyn_ftrace *rec,
1129     struct ftrace_ops *op)
1130     diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
1131     index f7cac11a90055..67af28f03cf41 100644
1132     --- a/kernel/trace/trace.c
1133     +++ b/kernel/trace/trace.c
1134     @@ -160,7 +160,8 @@ static union trace_eval_map_item *trace_eval_maps;
1135     #endif /* CONFIG_TRACE_EVAL_MAP_FILE */
1136    
1137     static int tracing_set_tracer(struct trace_array *tr, const char *buf);
1138     -static void ftrace_trace_userstack(struct ring_buffer *buffer,
1139     +static void ftrace_trace_userstack(struct trace_array *tr,
1140     + struct ring_buffer *buffer,
1141     unsigned long flags, int pc);
1142    
1143     #define MAX_TRACER_SIZE 100
1144     @@ -2621,7 +2622,7 @@ void trace_buffer_unlock_commit_regs(struct trace_array *tr,
1145     * two. They are not that meaningful.
1146     */
1147     ftrace_trace_stack(tr, buffer, flags, regs ? 0 : STACK_SKIP, pc, regs);
1148     - ftrace_trace_userstack(buffer, flags, pc);
1149     + ftrace_trace_userstack(tr, buffer, flags, pc);
1150     }
1151    
1152     /*
1153     @@ -2936,13 +2937,14 @@ EXPORT_SYMBOL_GPL(trace_dump_stack);
1154     static DEFINE_PER_CPU(int, user_stack_count);
1155    
1156     static void
1157     -ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
1158     +ftrace_trace_userstack(struct trace_array *tr,
1159     + struct ring_buffer *buffer, unsigned long flags, int pc)
1160     {
1161     struct trace_event_call *call = &event_user_stack;
1162     struct ring_buffer_event *event;
1163     struct userstack_entry *entry;
1164    
1165     - if (!(global_trace.trace_flags & TRACE_ITER_USERSTACKTRACE))
1166     + if (!(tr->trace_flags & TRACE_ITER_USERSTACKTRACE))
1167     return;
1168    
1169     /*
1170     @@ -2981,7 +2983,8 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
1171     preempt_enable();
1172     }
1173     #else /* CONFIG_USER_STACKTRACE_SUPPORT */
1174     -static void ftrace_trace_userstack(struct ring_buffer *buffer,
1175     +static void ftrace_trace_userstack(struct trace_array *tr,
1176     + struct ring_buffer *buffer,
1177     unsigned long flags, int pc)
1178     {
1179     }
1180     diff --git a/lib/syscall.c b/lib/syscall.c
1181     index fb328e7ccb089..71ffcf5aff122 100644
1182     --- a/lib/syscall.c
1183     +++ b/lib/syscall.c
1184     @@ -7,6 +7,7 @@
1185    
1186     static int collect_syscall(struct task_struct *target, struct syscall_info *info)
1187     {
1188     + unsigned long args[6] = { };
1189     struct pt_regs *regs;
1190    
1191     if (!try_get_task_stack(target)) {
1192     @@ -27,8 +28,14 @@ static int collect_syscall(struct task_struct *target, struct syscall_info *info
1193    
1194     info->data.nr = syscall_get_nr(target, regs);
1195     if (info->data.nr != -1L)
1196     - syscall_get_arguments(target, regs,
1197     - (unsigned long *)&info->data.args[0]);
1198     + syscall_get_arguments(target, regs, args);
1199     +
1200     + info->data.args[0] = args[0];
1201     + info->data.args[1] = args[1];
1202     + info->data.args[2] = args[2];
1203     + info->data.args[3] = args[3];
1204     + info->data.args[4] = args[4];
1205     + info->data.args[5] = args[5];
1206    
1207     put_task_stack(target);
1208     return 0;
1209     diff --git a/mm/list_lru.c b/mm/list_lru.c
1210     index 0f1f6b06b7f36..d12c1943f6f39 100644
1211     --- a/mm/list_lru.c
1212     +++ b/mm/list_lru.c
1213     @@ -544,7 +544,6 @@ static void memcg_drain_list_lru_node(struct list_lru *lru, int nid,
1214     struct list_lru_node *nlru = &lru->node[nid];
1215     int dst_idx = dst_memcg->kmemcg_id;
1216     struct list_lru_one *src, *dst;
1217     - bool set;
1218    
1219     /*
1220     * Since list_lru_{add,del} may be called under an IRQ-safe lock,
1221     @@ -556,11 +555,12 @@ static void memcg_drain_list_lru_node(struct list_lru *lru, int nid,
1222     dst = list_lru_from_memcg_idx(nlru, dst_idx);
1223    
1224     list_splice_init(&src->list, &dst->list);
1225     - set = (!dst->nr_items && src->nr_items);
1226     - dst->nr_items += src->nr_items;
1227     - if (set)
1228     +
1229     + if (src->nr_items) {
1230     + dst->nr_items += src->nr_items;
1231     memcg_set_shrinker_bit(dst_memcg, nid, lru_shrinker_id(lru));
1232     - src->nr_items = 0;
1233     + src->nr_items = 0;
1234     + }
1235    
1236     spin_unlock_irq(&nlru->lock);
1237     }
1238     diff --git a/mm/swapfile.c b/mm/swapfile.c
1239     index ff83ffe7a9108..7947633d3cede 100644
1240     --- a/mm/swapfile.c
1241     +++ b/mm/swapfile.c
1242     @@ -2824,6 +2824,7 @@ late_initcall(max_swapfiles_check);
1243     static struct swap_info_struct *alloc_swap_info(void)
1244     {
1245     struct swap_info_struct *p;
1246     + struct swap_info_struct *defer = NULL;
1247     unsigned int type;
1248     int i;
1249    
1250     @@ -2852,7 +2853,7 @@ static struct swap_info_struct *alloc_swap_info(void)
1251     smp_wmb();
1252     WRITE_ONCE(nr_swapfiles, nr_swapfiles + 1);
1253     } else {
1254     - kvfree(p);
1255     + defer = p;
1256     p = swap_info[type];
1257     /*
1258     * Do not memset this entry: a racing procfs swap_next()
1259     @@ -2865,6 +2866,7 @@ static struct swap_info_struct *alloc_swap_info(void)
1260     plist_node_init(&p->avail_lists[i], 0);
1261     p->flags = SWP_USED;
1262     spin_unlock(&swap_lock);
1263     + kvfree(defer);
1264     spin_lock_init(&p->lock);
1265     spin_lock_init(&p->cont_lock);
1266    
1267     diff --git a/net/can/af_can.c b/net/can/af_can.c
1268     index fd6ef6d26846f..306d3584a4417 100644
1269     --- a/net/can/af_can.c
1270     +++ b/net/can/af_can.c
1271     @@ -539,10 +539,13 @@ void can_rx_unregister(struct net *net, struct net_device *dev, canid_t can_id,
1272    
1273     /* Check for bugs in CAN protocol implementations using af_can.c:
1274     * 'rcv' will be NULL if no matching list item was found for removal.
1275     + * As this case may potentially happen when closing a socket while
1276     + * the notifier for removing the CAN netdev is running we just print
1277     + * a warning here.
1278     */
1279     if (!rcv) {
1280     - WARN(1, "BUG: receive list entry not found for dev %s, id %03X, mask %03X\n",
1281     - DNAME(dev), can_id, mask);
1282     + pr_warn("can: receive list entry not found for dev %s, id %03X, mask %03X\n",
1283     + DNAME(dev), can_id, mask);
1284     goto out;
1285     }
1286    
1287     diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
1288     index 3cc4daa856d6b..16ae770f049dd 100644
1289     --- a/net/netfilter/ipset/ip_set_core.c
1290     +++ b/net/netfilter/ipset/ip_set_core.c
1291     @@ -285,8 +285,7 @@ flag_nested(const struct nlattr *nla)
1292    
1293     static const struct nla_policy ipaddr_policy[IPSET_ATTR_IPADDR_MAX + 1] = {
1294     [IPSET_ATTR_IPADDR_IPV4] = { .type = NLA_U32 },
1295     - [IPSET_ATTR_IPADDR_IPV6] = { .type = NLA_BINARY,
1296     - .len = sizeof(struct in6_addr) },
1297     + [IPSET_ATTR_IPADDR_IPV6] = NLA_POLICY_EXACT_LEN(sizeof(struct in6_addr)),
1298     };
1299    
1300     int
1301     diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
1302     index 51391d5d22656..459b7c0547115 100644
1303     --- a/net/netfilter/nf_tables_api.c
1304     +++ b/net/netfilter/nf_tables_api.c
1305     @@ -560,7 +560,8 @@ static int nft_request_module(struct net *net, const char *fmt, ...)
1306     static void lockdep_nfnl_nft_mutex_not_held(void)
1307     {
1308     #ifdef CONFIG_PROVE_LOCKING
1309     - WARN_ON_ONCE(lockdep_nfnl_is_held(NFNL_SUBSYS_NFTABLES));
1310     + if (debug_locks)
1311     + WARN_ON_ONCE(lockdep_nfnl_is_held(NFNL_SUBSYS_NFTABLES));
1312     #endif
1313     }
1314    
1315     diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c
1316     index c480549a7f946..3aa4306ca39f6 100644
1317     --- a/net/netfilter/nf_tables_offload.c
1318     +++ b/net/netfilter/nf_tables_offload.c
1319     @@ -28,6 +28,23 @@ static struct nft_flow_rule *nft_flow_rule_alloc(int num_actions)
1320     return flow;
1321     }
1322    
1323     +void nft_flow_rule_set_addr_type(struct nft_flow_rule *flow,
1324     + enum flow_dissector_key_id addr_type)
1325     +{
1326     + struct nft_flow_match *match = &flow->match;
1327     + struct nft_flow_key *mask = &match->mask;
1328     + struct nft_flow_key *key = &match->key;
1329     +
1330     + if (match->dissector.used_keys & BIT(FLOW_DISSECTOR_KEY_CONTROL))
1331     + return;
1332     +
1333     + key->control.addr_type = addr_type;
1334     + mask->control.addr_type = 0xffff;
1335     + match->dissector.used_keys |= BIT(FLOW_DISSECTOR_KEY_CONTROL);
1336     + match->dissector.offset[FLOW_DISSECTOR_KEY_CONTROL] =
1337     + offsetof(struct nft_flow_key, control);
1338     +}
1339     +
1340     struct nft_flow_rule *nft_flow_rule_create(struct net *net,
1341     const struct nft_rule *rule)
1342     {
1343     diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
1344     index 62dc728bf93c9..921f8f45b17f4 100644
1345     --- a/net/netfilter/nft_payload.c
1346     +++ b/net/netfilter/nft_payload.c
1347     @@ -197,6 +197,7 @@ static int nft_payload_offload_ip(struct nft_offload_ctx *ctx,
1348    
1349     NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_IPV4_ADDRS, ipv4, src,
1350     sizeof(struct in_addr), reg);
1351     + nft_flow_rule_set_addr_type(flow, FLOW_DISSECTOR_KEY_IPV4_ADDRS);
1352     break;
1353     case offsetof(struct iphdr, daddr):
1354     if (priv->len != sizeof(struct in_addr))
1355     @@ -204,6 +205,7 @@ static int nft_payload_offload_ip(struct nft_offload_ctx *ctx,
1356    
1357     NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_IPV4_ADDRS, ipv4, dst,
1358     sizeof(struct in_addr), reg);
1359     + nft_flow_rule_set_addr_type(flow, FLOW_DISSECTOR_KEY_IPV4_ADDRS);
1360     break;
1361     case offsetof(struct iphdr, protocol):
1362     if (priv->len != sizeof(__u8))
1363     @@ -233,6 +235,7 @@ static int nft_payload_offload_ip6(struct nft_offload_ctx *ctx,
1364    
1365     NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_IPV6_ADDRS, ipv6, src,
1366     sizeof(struct in6_addr), reg);
1367     + nft_flow_rule_set_addr_type(flow, FLOW_DISSECTOR_KEY_IPV6_ADDRS);
1368     break;
1369     case offsetof(struct ipv6hdr, daddr):
1370     if (priv->len != sizeof(struct in6_addr))
1371     @@ -240,6 +243,7 @@ static int nft_payload_offload_ip6(struct nft_offload_ctx *ctx,
1372    
1373     NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_IPV6_ADDRS, ipv6, dst,
1374     sizeof(struct in6_addr), reg);
1375     + nft_flow_rule_set_addr_type(flow, FLOW_DISSECTOR_KEY_IPV6_ADDRS);
1376     break;
1377     case offsetof(struct ipv6hdr, nexthdr):
1378     if (priv->len != sizeof(__u8))
1379     diff --git a/net/tipc/core.c b/net/tipc/core.c
1380     index 2374adb505589..e3d79f8b69d81 100644
1381     --- a/net/tipc/core.c
1382     +++ b/net/tipc/core.c
1383     @@ -59,6 +59,7 @@ static int __net_init tipc_init_net(struct net *net)
1384     tn->trial_addr = 0;
1385     tn->addr_trial_end = 0;
1386     tn->capabilities = TIPC_NODE_CAPABILITIES;
1387     + INIT_WORK(&tn->final_work.work, tipc_net_finalize_work);
1388     memset(tn->node_id, 0, sizeof(tn->node_id));
1389     memset(tn->node_id_string, 0, sizeof(tn->node_id_string));
1390     tn->mon_threshold = TIPC_DEF_MON_THRESHOLD;
1391     @@ -96,13 +97,13 @@ out_sk_rht:
1392    
1393     static void __net_exit tipc_exit_net(struct net *net)
1394     {
1395     + struct tipc_net *tn = tipc_net(net);
1396     +
1397     tipc_detach_loopback(net);
1398     + /* Make sure the tipc_net_finalize_work() finished */
1399     + cancel_work_sync(&tn->final_work.work);
1400     tipc_net_stop(net);
1401    
1402     - /* Make sure the tipc_net_finalize_work stopped
1403     - * before releasing the resources.
1404     - */
1405     - flush_scheduled_work();
1406     tipc_bcast_stop(net);
1407     tipc_nametbl_stop(net);
1408     tipc_sk_rht_destroy(net);
1409     diff --git a/net/tipc/core.h b/net/tipc/core.h
1410     index 3042f654e0af0..e119c4a88d63e 100644
1411     --- a/net/tipc/core.h
1412     +++ b/net/tipc/core.h
1413     @@ -86,6 +86,12 @@ extern unsigned int tipc_net_id __read_mostly;
1414     extern int sysctl_tipc_rmem[3] __read_mostly;
1415     extern int sysctl_tipc_named_timeout __read_mostly;
1416    
1417     +struct tipc_net_work {
1418     + struct work_struct work;
1419     + struct net *net;
1420     + u32 addr;
1421     +};
1422     +
1423     struct tipc_net {
1424     u8 node_id[NODE_ID_LEN];
1425     u32 node_addr;
1426     @@ -134,6 +140,9 @@ struct tipc_net {
1427    
1428     /* Tracing of node internal messages */
1429     struct packet_type loopback_pt;
1430     +
1431     + /* Work item for net finalize */
1432     + struct tipc_net_work final_work;
1433     };
1434    
1435     static inline struct tipc_net *tipc_net(struct net *net)
1436     diff --git a/net/tipc/net.c b/net/tipc/net.c
1437     index 2de3cec9929d8..2498ce8b83c1a 100644
1438     --- a/net/tipc/net.c
1439     +++ b/net/tipc/net.c
1440     @@ -105,12 +105,6 @@
1441     * - A local spin_lock protecting the queue of subscriber events.
1442     */
1443    
1444     -struct tipc_net_work {
1445     - struct work_struct work;
1446     - struct net *net;
1447     - u32 addr;
1448     -};
1449     -
1450     static void tipc_net_finalize(struct net *net, u32 addr);
1451    
1452     int tipc_net_init(struct net *net, u8 *node_id, u32 addr)
1453     @@ -142,25 +136,21 @@ static void tipc_net_finalize(struct net *net, u32 addr)
1454     TIPC_CLUSTER_SCOPE, 0, addr);
1455     }
1456    
1457     -static void tipc_net_finalize_work(struct work_struct *work)
1458     +void tipc_net_finalize_work(struct work_struct *work)
1459     {
1460     struct tipc_net_work *fwork;
1461    
1462     fwork = container_of(work, struct tipc_net_work, work);
1463     tipc_net_finalize(fwork->net, fwork->addr);
1464     - kfree(fwork);
1465     }
1466    
1467     void tipc_sched_net_finalize(struct net *net, u32 addr)
1468     {
1469     - struct tipc_net_work *fwork = kzalloc(sizeof(*fwork), GFP_ATOMIC);
1470     + struct tipc_net *tn = tipc_net(net);
1471    
1472     - if (!fwork)
1473     - return;
1474     - INIT_WORK(&fwork->work, tipc_net_finalize_work);
1475     - fwork->net = net;
1476     - fwork->addr = addr;
1477     - schedule_work(&fwork->work);
1478     + tn->final_work.net = net;
1479     + tn->final_work.addr = addr;
1480     + schedule_work(&tn->final_work.work);
1481     }
1482    
1483     void tipc_net_stop(struct net *net)
1484     diff --git a/net/tipc/net.h b/net/tipc/net.h
1485     index b7f2e364eb99e..a6a4dba136738 100644
1486     --- a/net/tipc/net.h
1487     +++ b/net/tipc/net.h
1488     @@ -42,6 +42,7 @@
1489     extern const struct nla_policy tipc_nl_net_policy[];
1490    
1491     int tipc_net_init(struct net *net, u8 *node_id, u32 addr);
1492     +void tipc_net_finalize_work(struct work_struct *work);
1493     void tipc_sched_net_finalize(struct net *net, u32 addr);
1494     void tipc_net_stop(struct net *net);
1495     int tipc_nl_net_dump(struct sk_buff *skb, struct netlink_callback *cb);
1496     diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
1497     index e1750bdbe51f6..3caea6d58c9aa 100644
1498     --- a/sound/pci/hda/hda_generic.c
1499     +++ b/sound/pci/hda/hda_generic.c
1500     @@ -1364,16 +1364,20 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs,
1501     struct nid_path *path;
1502     hda_nid_t pin = pins[i];
1503    
1504     - path = snd_hda_get_path_from_idx(codec, path_idx[i]);
1505     - if (path) {
1506     - badness += assign_out_path_ctls(codec, path);
1507     - continue;
1508     + if (!spec->obey_preferred_dacs) {
1509     + path = snd_hda_get_path_from_idx(codec, path_idx[i]);
1510     + if (path) {
1511     + badness += assign_out_path_ctls(codec, path);
1512     + continue;
1513     + }
1514     }
1515    
1516     dacs[i] = get_preferred_dac(codec, pin);
1517     if (dacs[i]) {
1518     if (is_dac_already_used(codec, dacs[i]))
1519     badness += bad->shared_primary;
1520     + } else if (spec->obey_preferred_dacs) {
1521     + badness += BAD_NO_PRIMARY_DAC;
1522     }
1523    
1524     if (!dacs[i])
1525     diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h
1526     index fb9f1a90238bf..e728df6145adb 100644
1527     --- a/sound/pci/hda/hda_generic.h
1528     +++ b/sound/pci/hda/hda_generic.h
1529     @@ -236,6 +236,7 @@ struct hda_gen_spec {
1530     unsigned int power_down_unused:1; /* power down unused widgets */
1531     unsigned int dac_min_mute:1; /* minimal = mute for DACs */
1532     unsigned int suppress_vmaster:1; /* don't create vmaster kctls */
1533     + unsigned int obey_preferred_dacs:1; /* obey preferred_dacs assignment */
1534    
1535     /* other internal flags */
1536     unsigned int no_analog:1; /* digital I/O only */
1537     diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1538     index bd802cbc1165a..c804c15debc69 100644
1539     --- a/sound/pci/hda/patch_realtek.c
1540     +++ b/sound/pci/hda/patch_realtek.c
1541     @@ -436,6 +436,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
1542     alc_update_coef_idx(codec, 0x7, 1<<5, 0);
1543     break;
1544     case 0x10ec0892:
1545     + case 0x10ec0897:
1546     alc_update_coef_idx(codec, 0x7, 1<<5, 0);
1547     break;
1548     case 0x10ec0899:
1549     @@ -5990,6 +5991,21 @@ static void alc274_fixup_bind_dacs(struct hda_codec *codec,
1550     codec->power_save_node = 0;
1551     }
1552    
1553     +/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
1554     +static void alc289_fixup_asus_ga401(struct hda_codec *codec,
1555     + const struct hda_fixup *fix, int action)
1556     +{
1557     + static const hda_nid_t preferred_pairs[] = {
1558     + 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
1559     + };
1560     + struct alc_spec *spec = codec->spec;
1561     +
1562     + if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1563     + spec->gen.preferred_dacs = preferred_pairs;
1564     + spec->gen.obey_preferred_dacs = 1;
1565     + }
1566     +}
1567     +
1568     /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
1569     static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
1570     const struct hda_fixup *fix, int action)
1571     @@ -7543,11 +7559,10 @@ static const struct hda_fixup alc269_fixups[] = {
1572     .chain_id = ALC269_FIXUP_HEADSET_MIC
1573     },
1574     [ALC289_FIXUP_ASUS_GA401] = {
1575     - .type = HDA_FIXUP_PINS,
1576     - .v.pins = (const struct hda_pintbl[]) {
1577     - { 0x19, 0x03a11020 }, /* headset mic with jack detect */
1578     - { }
1579     - },
1580     + .type = HDA_FIXUP_FUNC,
1581     + .v.func = alc289_fixup_asus_ga401,
1582     + .chained = true,
1583     + .chain_id = ALC289_FIXUP_ASUS_GA502,
1584     },
1585     [ALC289_FIXUP_ASUS_GA502] = {
1586     .type = HDA_FIXUP_PINS,
1587     @@ -7671,7 +7686,7 @@ static const struct hda_fixup alc269_fixups[] = {
1588     { }
1589     },
1590     .chained = true,
1591     - .chain_id = ALC289_FIXUP_ASUS_GA401
1592     + .chain_id = ALC289_FIXUP_ASUS_GA502
1593     },
1594     [ALC274_FIXUP_HP_MIC] = {
1595     .type = HDA_FIXUP_VERBS,
1596     @@ -7847,6 +7862,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
1597     SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
1598     SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
1599     SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
1600     + SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
1601     SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
1602     SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
1603     SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
1604     @@ -8573,6 +8589,9 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
1605     SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
1606     ALC292_STANDARD_PINS,
1607     {0x13, 0x90a60140}),
1608     + SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
1609     + {0x17, 0x90170110},
1610     + {0x21, 0x04211020}),
1611     SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
1612     {0x14, 0x90170110},
1613     {0x1b, 0x90a70130},
1614     @@ -10156,6 +10175,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {
1615     HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
1616     HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
1617     HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
1618     + HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
1619     HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
1620     HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
1621     HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
1622     diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
1623     index 9b8bb7bbe945d..4c56b782500db 100644
1624     --- a/sound/soc/codecs/wm_adsp.c
1625     +++ b/sound/soc/codecs/wm_adsp.c
1626     @@ -1912,6 +1912,7 @@ static int wm_adsp_load(struct wm_adsp *dsp)
1627     mem = wm_adsp_find_region(dsp, type);
1628     if (!mem) {
1629     adsp_err(dsp, "No region of type: %x\n", type);
1630     + ret = -EINVAL;
1631     goto out_fw;
1632     }
1633    
1634     diff --git a/tools/arch/x86/include/asm/insn.h b/tools/arch/x86/include/asm/insn.h
1635     index 37a4c390750bc..d7f0ae8f3c442 100644
1636     --- a/tools/arch/x86/include/asm/insn.h
1637     +++ b/tools/arch/x86/include/asm/insn.h
1638     @@ -195,6 +195,21 @@ static inline int insn_offset_immediate(struct insn *insn)
1639     return insn_offset_displacement(insn) + insn->displacement.nbytes;
1640     }
1641    
1642     +/**
1643     + * for_each_insn_prefix() -- Iterate prefixes in the instruction
1644     + * @insn: Pointer to struct insn.
1645     + * @idx: Index storage.
1646     + * @prefix: Prefix byte.
1647     + *
1648     + * Iterate prefix bytes of given @insn. Each prefix byte is stored in @prefix
1649     + * and the index is stored in @idx (note that this @idx is just for a cursor,
1650     + * do not change it.)
1651     + * Since prefixes.nbytes can be bigger than 4 if some prefixes
1652     + * are repeated, it cannot be used for looping over the prefixes.
1653     + */
1654     +#define for_each_insn_prefix(insn, idx, prefix) \
1655     + for (idx = 0; idx < ARRAY_SIZE(insn->prefixes.bytes) && (prefix = insn->prefixes.bytes[idx]) != 0; idx++)
1656     +
1657     #define POP_SS_OPCODE 0x1f
1658     #define MOV_SREG_OPCODE 0x8e
1659    
1660     diff --git a/tools/testing/selftests/bpf/prog_tests/map_init.c b/tools/testing/selftests/bpf/prog_tests/map_init.c
1661     deleted file mode 100644
1662     index 14a31109dd0e0..0000000000000
1663     --- a/tools/testing/selftests/bpf/prog_tests/map_init.c
1664     +++ /dev/null
1665     @@ -1,214 +0,0 @@
1666     -// SPDX-License-Identifier: GPL-2.0-only
1667     -/* Copyright (c) 2020 Tessares SA <http://www.tessares.net> */
1668     -
1669     -#include <test_progs.h>
1670     -#include "test_map_init.skel.h"
1671     -
1672     -#define TEST_VALUE 0x1234
1673     -#define FILL_VALUE 0xdeadbeef
1674     -
1675     -static int nr_cpus;
1676     -static int duration;
1677     -
1678     -typedef unsigned long long map_key_t;
1679     -typedef unsigned long long map_value_t;
1680     -typedef struct {
1681     - map_value_t v; /* padding */
1682     -} __bpf_percpu_val_align pcpu_map_value_t;
1683     -
1684     -
1685     -static int map_populate(int map_fd, int num)
1686     -{
1687     - pcpu_map_value_t value[nr_cpus];
1688     - int i, err;
1689     - map_key_t key;
1690     -
1691     - for (i = 0; i < nr_cpus; i++)
1692     - bpf_percpu(value, i) = FILL_VALUE;
1693     -
1694     - for (key = 1; key <= num; key++) {
1695     - err = bpf_map_update_elem(map_fd, &key, value, BPF_NOEXIST);
1696     - if (!ASSERT_OK(err, "bpf_map_update_elem"))
1697     - return -1;
1698     - }
1699     -
1700     - return 0;
1701     -}
1702     -
1703     -static struct test_map_init *setup(enum bpf_map_type map_type, int map_sz,
1704     - int *map_fd, int populate)
1705     -{
1706     - struct test_map_init *skel;
1707     - int err;
1708     -
1709     - skel = test_map_init__open();
1710     - if (!ASSERT_OK_PTR(skel, "skel_open"))
1711     - return NULL;
1712     -
1713     - err = bpf_map__set_type(skel->maps.hashmap1, map_type);
1714     - if (!ASSERT_OK(err, "bpf_map__set_type"))
1715     - goto error;
1716     -
1717     - err = bpf_map__set_max_entries(skel->maps.hashmap1, map_sz);
1718     - if (!ASSERT_OK(err, "bpf_map__set_max_entries"))
1719     - goto error;
1720     -
1721     - err = test_map_init__load(skel);
1722     - if (!ASSERT_OK(err, "skel_load"))
1723     - goto error;
1724     -
1725     - *map_fd = bpf_map__fd(skel->maps.hashmap1);
1726     - if (CHECK(*map_fd < 0, "bpf_map__fd", "failed\n"))
1727     - goto error;
1728     -
1729     - err = map_populate(*map_fd, populate);
1730     - if (!ASSERT_OK(err, "map_populate"))
1731     - goto error_map;
1732     -
1733     - return skel;
1734     -
1735     -error_map:
1736     - close(*map_fd);
1737     -error:
1738     - test_map_init__destroy(skel);
1739     - return NULL;
1740     -}
1741     -
1742     -/* executes bpf program that updates map with key, value */
1743     -static int prog_run_insert_elem(struct test_map_init *skel, map_key_t key,
1744     - map_value_t value)
1745     -{
1746     - struct test_map_init__bss *bss;
1747     -
1748     - bss = skel->bss;
1749     -
1750     - bss->inKey = key;
1751     - bss->inValue = value;
1752     - bss->inPid = getpid();
1753     -
1754     - if (!ASSERT_OK(test_map_init__attach(skel), "skel_attach"))
1755     - return -1;
1756     -
1757     - /* Let tracepoint trigger */
1758     - syscall(__NR_getpgid);
1759     -
1760     - test_map_init__detach(skel);
1761     -
1762     - return 0;
1763     -}
1764     -
1765     -static int check_values_one_cpu(pcpu_map_value_t *value, map_value_t expected)
1766     -{
1767     - int i, nzCnt = 0;
1768     - map_value_t val;
1769     -
1770     - for (i = 0; i < nr_cpus; i++) {
1771     - val = bpf_percpu(value, i);
1772     - if (val) {
1773     - if (CHECK(val != expected, "map value",
1774     - "unexpected for cpu %d: 0x%llx\n", i, val))
1775     - return -1;
1776     - nzCnt++;
1777     - }
1778     - }
1779     -
1780     - if (CHECK(nzCnt != 1, "map value", "set for %d CPUs instead of 1!\n",
1781     - nzCnt))
1782     - return -1;
1783     -
1784     - return 0;
1785     -}
1786     -
1787     -/* Add key=1 elem with values set for all CPUs
1788     - * Delete elem key=1
1789     - * Run bpf prog that inserts new key=1 elem with value=0x1234
1790     - * (bpf prog can only set value for current CPU)
1791     - * Lookup Key=1 and check value is as expected for all CPUs:
1792     - * value set by bpf prog for one CPU, 0 for all others
1793     - */
1794     -static void test_pcpu_map_init(void)
1795     -{
1796     - pcpu_map_value_t value[nr_cpus];
1797     - struct test_map_init *skel;
1798     - int map_fd, err;
1799     - map_key_t key;
1800     -
1801     - /* max 1 elem in map so insertion is forced to reuse freed entry */
1802     - skel = setup(BPF_MAP_TYPE_PERCPU_HASH, 1, &map_fd, 1);
1803     - if (!ASSERT_OK_PTR(skel, "prog_setup"))
1804     - return;
1805     -
1806     - /* delete element so the entry can be re-used*/
1807     - key = 1;
1808     - err = bpf_map_delete_elem(map_fd, &key);
1809     - if (!ASSERT_OK(err, "bpf_map_delete_elem"))
1810     - goto cleanup;
1811     -
1812     - /* run bpf prog that inserts new elem, re-using the slot just freed */
1813     - err = prog_run_insert_elem(skel, key, TEST_VALUE);
1814     - if (!ASSERT_OK(err, "prog_run_insert_elem"))
1815     - goto cleanup;
1816     -
1817     - /* check that key=1 was re-created by bpf prog */
1818     - err = bpf_map_lookup_elem(map_fd, &key, value);
1819     - if (!ASSERT_OK(err, "bpf_map_lookup_elem"))
1820     - goto cleanup;
1821     -
1822     - /* and has expected values */
1823     - check_values_one_cpu(value, TEST_VALUE);
1824     -
1825     -cleanup:
1826     - test_map_init__destroy(skel);
1827     -}
1828     -
1829     -/* Add key=1 and key=2 elems with values set for all CPUs
1830     - * Run bpf prog that inserts new key=3 elem
1831     - * (only for current cpu; other cpus should have initial value = 0)
1832     - * Lookup Key=1 and check value is as expected for all CPUs
1833     - */
1834     -static void test_pcpu_lru_map_init(void)
1835     -{
1836     - pcpu_map_value_t value[nr_cpus];
1837     - struct test_map_init *skel;
1838     - int map_fd, err;
1839     - map_key_t key;
1840     -
1841     - /* Set up LRU map with 2 elements, values filled for all CPUs.
1842     - * With these 2 elements, the LRU map is full
1843     - */
1844     - skel = setup(BPF_MAP_TYPE_LRU_PERCPU_HASH, 2, &map_fd, 2);
1845     - if (!ASSERT_OK_PTR(skel, "prog_setup"))
1846     - return;
1847     -
1848     - /* run bpf prog that inserts new key=3 element, re-using LRU slot */
1849     - key = 3;
1850     - err = prog_run_insert_elem(skel, key, TEST_VALUE);
1851     - if (!ASSERT_OK(err, "prog_run_insert_elem"))
1852     - goto cleanup;
1853     -
1854     - /* check that key=3 replaced one of earlier elements */
1855     - err = bpf_map_lookup_elem(map_fd, &key, value);
1856     - if (!ASSERT_OK(err, "bpf_map_lookup_elem"))
1857     - goto cleanup;
1858     -
1859     - /* and has expected values */
1860     - check_values_one_cpu(value, TEST_VALUE);
1861     -
1862     -cleanup:
1863     - test_map_init__destroy(skel);
1864     -}
1865     -
1866     -void test_map_init(void)
1867     -{
1868     - nr_cpus = bpf_num_possible_cpus();
1869     - if (nr_cpus <= 1) {
1870     - printf("%s:SKIP: >1 cpu needed for this test\n", __func__);
1871     - test__skip();
1872     - return;
1873     - }
1874     -
1875     - if (test__start_subtest("pcpu_map_init"))
1876     - test_pcpu_map_init();
1877     - if (test__start_subtest("pcpu_lru_map_init"))
1878     - test_pcpu_lru_map_init();
1879     -}
1880     diff --git a/tools/testing/selftests/bpf/progs/test_map_init.c b/tools/testing/selftests/bpf/progs/test_map_init.c
1881     deleted file mode 100644
1882     index c89d28ead6737..0000000000000
1883     --- a/tools/testing/selftests/bpf/progs/test_map_init.c
1884     +++ /dev/null
1885     @@ -1,33 +0,0 @@
1886     -// SPDX-License-Identifier: GPL-2.0
1887     -/* Copyright (c) 2020 Tessares SA <http://www.tessares.net> */
1888     -
1889     -#include "vmlinux.h"
1890     -#include <bpf/bpf_helpers.h>
1891     -
1892     -__u64 inKey = 0;
1893     -__u64 inValue = 0;
1894     -__u32 inPid = 0;
1895     -
1896     -struct {
1897     - __uint(type, BPF_MAP_TYPE_PERCPU_HASH);
1898     - __uint(max_entries, 2);
1899     - __type(key, __u64);
1900     - __type(value, __u64);
1901     -} hashmap1 SEC(".maps");
1902     -
1903     -
1904     -SEC("tp/syscalls/sys_enter_getpgid")
1905     -int sysenter_getpgid(const void *ctx)
1906     -{
1907     - /* Just do it for once, when called from our own test prog. This
1908     - * ensures the map value is only updated for a single CPU.
1909     - */
1910     - int cur_pid = bpf_get_current_pid_tgid() >> 32;
1911     -
1912     - if (cur_pid == inPid)
1913     - bpf_map_update_elem(&hashmap1, &inKey, &inValue, BPF_NOEXIST);
1914     -
1915     - return 0;
1916     -}
1917     -
1918     -char _license[] SEC("license") = "GPL";