Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0184-5.4.85-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3635 - (show annotations) (download)
Mon Oct 24 12:34:12 2022 UTC (20 months ago) by niro
File size: 46827 byte(s)
-sync kernel patches
1 diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
2 index fea15cd49fbc7..74ba077e99e56 100644
3 --- a/Documentation/admin-guide/kernel-parameters.txt
4 +++ b/Documentation/admin-guide/kernel-parameters.txt
5 @@ -5151,6 +5151,7 @@
6 device);
7 j = NO_REPORT_LUNS (don't use report luns
8 command, uas only);
9 + k = NO_SAME (do not use WRITE_SAME, uas only)
10 l = NOT_LOCKABLE (don't try to lock and
11 unlock ejectable media, not on uas);
12 m = MAX_SECTORS_64 (don't transfer more
13 diff --git a/Documentation/virt/kvm/mmu.txt b/Documentation/virt/kvm/mmu.txt
14 index dadb29e8738fe..ec072c6bc03f8 100644
15 --- a/Documentation/virt/kvm/mmu.txt
16 +++ b/Documentation/virt/kvm/mmu.txt
17 @@ -420,7 +420,7 @@ If the generation number of the spte does not equal the global generation
18 number, it will ignore the cached MMIO information and handle the page
19 fault through the slow path.
20
21 -Since only 19 bits are used to store generation-number on mmio spte, all
22 +Since only 18 bits are used to store generation-number on mmio spte, all
23 pages are zapped when there is an overflow.
24
25 Unfortunately, a single memory access might access kvm_memslots(kvm) multiple
26 diff --git a/Makefile b/Makefile
27 index fe0ab15cfd835..a2a2546fcda80 100644
28 --- a/Makefile
29 +++ b/Makefile
30 @@ -1,7 +1,7 @@
31 # SPDX-License-Identifier: GPL-2.0
32 VERSION = 5
33 PATCHLEVEL = 4
34 -SUBLEVEL = 84
35 +SUBLEVEL = 85
36 EXTRAVERSION =
37 NAME = Kleptomaniac Octopus
38
39 diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
40 index 17095435c875c..499cb2e727a09 100644
41 --- a/arch/x86/kernel/cpu/resctrl/internal.h
42 +++ b/arch/x86/kernel/cpu/resctrl/internal.h
43 @@ -276,7 +276,6 @@ struct rftype {
44 * struct mbm_state - status for each MBM counter in each domain
45 * @chunks: Total data moved (multiply by rdt_group.mon_scale to get bytes)
46 * @prev_msr Value of IA32_QM_CTR for this RMID last time we read it
47 - * @chunks_bw Total local data moved. Used for bandwidth calculation
48 * @prev_bw_msr:Value of previous IA32_QM_CTR for bandwidth counting
49 * @prev_bw The most recent bandwidth in MBps
50 * @delta_bw Difference between the current and previous bandwidth
51 @@ -285,7 +284,6 @@ struct rftype {
52 struct mbm_state {
53 u64 chunks;
54 u64 prev_msr;
55 - u64 chunks_bw;
56 u64 prev_bw_msr;
57 u32 prev_bw;
58 u32 delta_bw;
59 diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
60 index 0cf4f87f60126..50f683ecd2c6c 100644
61 --- a/arch/x86/kernel/cpu/resctrl/monitor.c
62 +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
63 @@ -280,8 +280,6 @@ static void mbm_bw_count(u32 rmid, struct rmid_read *rr)
64 return;
65
66 chunks = mbm_overflow_count(m->prev_bw_msr, tval);
67 - m->chunks_bw += chunks;
68 - m->chunks = m->chunks_bw;
69 cur_bw = (chunks * r->mon_scale) >> 20;
70
71 if (m->delta_comp)
72 @@ -451,15 +449,14 @@ static void mbm_update(struct rdt_domain *d, int rmid)
73 }
74 if (is_mbm_local_enabled()) {
75 rr.evtid = QOS_L3_MBM_LOCAL_EVENT_ID;
76 + __mon_event_count(rmid, &rr);
77
78 /*
79 * Call the MBA software controller only for the
80 * control groups and when user has enabled
81 * the software controller explicitly.
82 */
83 - if (!is_mba_sc(NULL))
84 - __mon_event_count(rmid, &rr);
85 - else
86 + if (is_mba_sc(NULL))
87 mbm_bw_count(rmid, &rr);
88 }
89 }
90 diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
91 index b90e8fd2f6ced..47c27c6e38426 100644
92 --- a/arch/x86/kvm/mmu.c
93 +++ b/arch/x86/kvm/mmu.c
94 @@ -407,11 +407,11 @@ static inline bool is_access_track_spte(u64 spte)
95 }
96
97 /*
98 - * Due to limited space in PTEs, the MMIO generation is a 19 bit subset of
99 + * Due to limited space in PTEs, the MMIO generation is a 18 bit subset of
100 * the memslots generation and is derived as follows:
101 *
102 * Bits 0-8 of the MMIO generation are propagated to spte bits 3-11
103 - * Bits 9-18 of the MMIO generation are propagated to spte bits 52-61
104 + * Bits 9-17 of the MMIO generation are propagated to spte bits 54-62
105 *
106 * The KVM_MEMSLOT_GEN_UPDATE_IN_PROGRESS flag is intentionally not included in
107 * the MMIO generation number, as doing so would require stealing a bit from
108 @@ -420,18 +420,29 @@ static inline bool is_access_track_spte(u64 spte)
109 * requires a full MMU zap). The flag is instead explicitly queried when
110 * checking for MMIO spte cache hits.
111 */
112 -#define MMIO_SPTE_GEN_MASK GENMASK_ULL(17, 0)
113
114 #define MMIO_SPTE_GEN_LOW_START 3
115 #define MMIO_SPTE_GEN_LOW_END 11
116 -#define MMIO_SPTE_GEN_LOW_MASK GENMASK_ULL(MMIO_SPTE_GEN_LOW_END, \
117 - MMIO_SPTE_GEN_LOW_START)
118
119 #define MMIO_SPTE_GEN_HIGH_START PT64_SECOND_AVAIL_BITS_SHIFT
120 #define MMIO_SPTE_GEN_HIGH_END 62
121 +
122 +#define MMIO_SPTE_GEN_LOW_MASK GENMASK_ULL(MMIO_SPTE_GEN_LOW_END, \
123 + MMIO_SPTE_GEN_LOW_START)
124 #define MMIO_SPTE_GEN_HIGH_MASK GENMASK_ULL(MMIO_SPTE_GEN_HIGH_END, \
125 MMIO_SPTE_GEN_HIGH_START)
126
127 +#define MMIO_SPTE_GEN_LOW_BITS (MMIO_SPTE_GEN_LOW_END - MMIO_SPTE_GEN_LOW_START + 1)
128 +#define MMIO_SPTE_GEN_HIGH_BITS (MMIO_SPTE_GEN_HIGH_END - MMIO_SPTE_GEN_HIGH_START + 1)
129 +
130 +/* remember to adjust the comment above as well if you change these */
131 +static_assert(MMIO_SPTE_GEN_LOW_BITS == 9 && MMIO_SPTE_GEN_HIGH_BITS == 9);
132 +
133 +#define MMIO_SPTE_GEN_LOW_SHIFT (MMIO_SPTE_GEN_LOW_START - 0)
134 +#define MMIO_SPTE_GEN_HIGH_SHIFT (MMIO_SPTE_GEN_HIGH_START - MMIO_SPTE_GEN_LOW_BITS)
135 +
136 +#define MMIO_SPTE_GEN_MASK GENMASK_ULL(MMIO_SPTE_GEN_LOW_BITS + MMIO_SPTE_GEN_HIGH_BITS - 1, 0)
137 +
138 static u64 generation_mmio_spte_mask(u64 gen)
139 {
140 u64 mask;
141 @@ -439,8 +450,8 @@ static u64 generation_mmio_spte_mask(u64 gen)
142 WARN_ON(gen & ~MMIO_SPTE_GEN_MASK);
143 BUILD_BUG_ON((MMIO_SPTE_GEN_HIGH_MASK | MMIO_SPTE_GEN_LOW_MASK) & SPTE_SPECIAL_MASK);
144
145 - mask = (gen << MMIO_SPTE_GEN_LOW_START) & MMIO_SPTE_GEN_LOW_MASK;
146 - mask |= (gen << MMIO_SPTE_GEN_HIGH_START) & MMIO_SPTE_GEN_HIGH_MASK;
147 + mask = (gen << MMIO_SPTE_GEN_LOW_SHIFT) & MMIO_SPTE_GEN_LOW_MASK;
148 + mask |= (gen << MMIO_SPTE_GEN_HIGH_SHIFT) & MMIO_SPTE_GEN_HIGH_MASK;
149 return mask;
150 }
151
152 @@ -448,8 +459,8 @@ static u64 get_mmio_spte_generation(u64 spte)
153 {
154 u64 gen;
155
156 - gen = (spte & MMIO_SPTE_GEN_LOW_MASK) >> MMIO_SPTE_GEN_LOW_START;
157 - gen |= (spte & MMIO_SPTE_GEN_HIGH_MASK) >> MMIO_SPTE_GEN_HIGH_START;
158 + gen = (spte & MMIO_SPTE_GEN_LOW_MASK) >> MMIO_SPTE_GEN_LOW_SHIFT;
159 + gen |= (spte & MMIO_SPTE_GEN_HIGH_MASK) >> MMIO_SPTE_GEN_HIGH_SHIFT;
160 return gen;
161 }
162
163 diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
164 index fcb52efec0753..89121d7ce3e6f 100644
165 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
166 +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
167 @@ -141,8 +141,8 @@ static const struct {
168 { ENETC_PM0_R255, "MAC rx 128-255 byte packets" },
169 { ENETC_PM0_R511, "MAC rx 256-511 byte packets" },
170 { ENETC_PM0_R1023, "MAC rx 512-1023 byte packets" },
171 - { ENETC_PM0_R1518, "MAC rx 1024-1518 byte packets" },
172 - { ENETC_PM0_R1519X, "MAC rx 1519 to max-octet packets" },
173 + { ENETC_PM0_R1522, "MAC rx 1024-1522 byte packets" },
174 + { ENETC_PM0_R1523X, "MAC rx 1523 to max-octet packets" },
175 { ENETC_PM0_ROVR, "MAC rx oversized packets" },
176 { ENETC_PM0_RJBR, "MAC rx jabber packets" },
177 { ENETC_PM0_RFRG, "MAC rx fragment packets" },
178 @@ -161,9 +161,13 @@ static const struct {
179 { ENETC_PM0_TBCA, "MAC tx broadcast frames" },
180 { ENETC_PM0_TPKT, "MAC tx packets" },
181 { ENETC_PM0_TUND, "MAC tx undersized packets" },
182 + { ENETC_PM0_T64, "MAC tx 64 byte packets" },
183 { ENETC_PM0_T127, "MAC tx 65-127 byte packets" },
184 + { ENETC_PM0_T255, "MAC tx 128-255 byte packets" },
185 + { ENETC_PM0_T511, "MAC tx 256-511 byte packets" },
186 { ENETC_PM0_T1023, "MAC tx 512-1023 byte packets" },
187 - { ENETC_PM0_T1518, "MAC tx 1024-1518 byte packets" },
188 + { ENETC_PM0_T1522, "MAC tx 1024-1522 byte packets" },
189 + { ENETC_PM0_T1523X, "MAC tx 1523 to max-octet packets" },
190 { ENETC_PM0_TCNP, "MAC tx control packets" },
191 { ENETC_PM0_TDFR, "MAC tx deferred packets" },
192 { ENETC_PM0_TMCOL, "MAC tx multiple collisions" },
193 diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h
194 index 88276299f4473..7428f62408a20 100644
195 --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h
196 +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h
197 @@ -239,8 +239,8 @@ enum enetc_bdr_type {TX, RX};
198 #define ENETC_PM0_R255 0x8180
199 #define ENETC_PM0_R511 0x8188
200 #define ENETC_PM0_R1023 0x8190
201 -#define ENETC_PM0_R1518 0x8198
202 -#define ENETC_PM0_R1519X 0x81A0
203 +#define ENETC_PM0_R1522 0x8198
204 +#define ENETC_PM0_R1523X 0x81A0
205 #define ENETC_PM0_ROVR 0x81A8
206 #define ENETC_PM0_RJBR 0x81B0
207 #define ENETC_PM0_RFRG 0x81B8
208 @@ -259,9 +259,13 @@ enum enetc_bdr_type {TX, RX};
209 #define ENETC_PM0_TBCA 0x8250
210 #define ENETC_PM0_TPKT 0x8260
211 #define ENETC_PM0_TUND 0x8268
212 +#define ENETC_PM0_T64 0x8270
213 #define ENETC_PM0_T127 0x8278
214 +#define ENETC_PM0_T255 0x8280
215 +#define ENETC_PM0_T511 0x8288
216 #define ENETC_PM0_T1023 0x8290
217 -#define ENETC_PM0_T1518 0x8298
218 +#define ENETC_PM0_T1522 0x8298
219 +#define ENETC_PM0_T1523X 0x82A0
220 #define ENETC_PM0_TCNP 0x82C0
221 #define ENETC_PM0_TDFR 0x82D0
222 #define ENETC_PM0_TMCOL 0x82D8
223 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.h
224 index 38b79321c4c44..de69ebf688577 100644
225 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.h
226 +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.h
227 @@ -35,8 +35,6 @@
228
229 #define HCLGE_DBG_DFX_SSU_2_OFFSET 12
230
231 -#pragma pack(1)
232 -
233 struct hclge_qos_pri_map_cmd {
234 u8 pri0_tc : 4,
235 pri1_tc : 4;
236 @@ -85,8 +83,6 @@ struct hclge_dbg_reg_type_info {
237 struct hclge_dbg_reg_common_msg reg_msg;
238 };
239
240 -#pragma pack()
241 -
242 static struct hclge_dbg_dfx_message hclge_dbg_bios_common_reg[] = {
243 {false, "Reserved"},
244 {true, "BP_CPU_STATE"},
245 diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
246 index 70fd246840e21..b5eb116249dda 100644
247 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
248 +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
249 @@ -1383,8 +1383,10 @@ static void mlx4_en_tx_timeout(struct net_device *dev)
250 }
251
252 priv->port_stats.tx_timeout++;
253 - en_dbg(DRV, priv, "Scheduling watchdog\n");
254 - queue_work(mdev->workqueue, &priv->watchdog_task);
255 + if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state)) {
256 + en_dbg(DRV, priv, "Scheduling port restart\n");
257 + queue_work(mdev->workqueue, &priv->restart_task);
258 + }
259 }
260
261
262 @@ -1738,6 +1740,7 @@ int mlx4_en_start_port(struct net_device *dev)
263 mlx4_en_deactivate_cq(priv, cq);
264 goto tx_err;
265 }
266 + clear_bit(MLX4_EN_TX_RING_STATE_RECOVERING, &tx_ring->state);
267 if (t != TX_XDP) {
268 tx_ring->tx_queue = netdev_get_tx_queue(dev, i);
269 tx_ring->recycle_ring = NULL;
270 @@ -1834,6 +1837,7 @@ int mlx4_en_start_port(struct net_device *dev)
271 local_bh_enable();
272 }
273
274 + clear_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state);
275 netif_tx_start_all_queues(dev);
276 netif_device_attach(dev);
277
278 @@ -2004,7 +2008,7 @@ void mlx4_en_stop_port(struct net_device *dev, int detach)
279 static void mlx4_en_restart(struct work_struct *work)
280 {
281 struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
282 - watchdog_task);
283 + restart_task);
284 struct mlx4_en_dev *mdev = priv->mdev;
285 struct net_device *dev = priv->dev;
286
287 @@ -2386,7 +2390,7 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)
288 if (netif_running(dev)) {
289 mutex_lock(&mdev->state_lock);
290 if (!mdev->device_up) {
291 - /* NIC is probably restarting - let watchdog task reset
292 + /* NIC is probably restarting - let restart task reset
293 * the port */
294 en_dbg(DRV, priv, "Change MTU called with card down!?\n");
295 } else {
296 @@ -2395,7 +2399,9 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)
297 if (err) {
298 en_err(priv, "Failed restarting port:%d\n",
299 priv->port);
300 - queue_work(mdev->workqueue, &priv->watchdog_task);
301 + if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING,
302 + &priv->state))
303 + queue_work(mdev->workqueue, &priv->restart_task);
304 }
305 }
306 mutex_unlock(&mdev->state_lock);
307 @@ -2865,7 +2871,8 @@ static int mlx4_xdp_set(struct net_device *dev, struct bpf_prog *prog)
308 if (err) {
309 en_err(priv, "Failed starting port %d for XDP change\n",
310 priv->port);
311 - queue_work(mdev->workqueue, &priv->watchdog_task);
312 + if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state))
313 + queue_work(mdev->workqueue, &priv->restart_task);
314 }
315 }
316
317 @@ -3263,7 +3270,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
318 priv->counter_index = MLX4_SINK_COUNTER_INDEX(mdev->dev);
319 spin_lock_init(&priv->stats_lock);
320 INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode);
321 - INIT_WORK(&priv->watchdog_task, mlx4_en_restart);
322 + INIT_WORK(&priv->restart_task, mlx4_en_restart);
323 INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate);
324 INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats);
325 INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task);
326 diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
327 index 191ead7a7fa59..605c079d48417 100644
328 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
329 +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
330 @@ -392,6 +392,35 @@ int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring)
331 return cnt;
332 }
333
334 +static void mlx4_en_handle_err_cqe(struct mlx4_en_priv *priv, struct mlx4_err_cqe *err_cqe,
335 + u16 cqe_index, struct mlx4_en_tx_ring *ring)
336 +{
337 + struct mlx4_en_dev *mdev = priv->mdev;
338 + struct mlx4_en_tx_info *tx_info;
339 + struct mlx4_en_tx_desc *tx_desc;
340 + u16 wqe_index;
341 + int desc_size;
342 +
343 + en_err(priv, "CQE error - cqn 0x%x, ci 0x%x, vendor syndrome: 0x%x syndrome: 0x%x\n",
344 + ring->sp_cqn, cqe_index, err_cqe->vendor_err_syndrome, err_cqe->syndrome);
345 + print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1, err_cqe, sizeof(*err_cqe),
346 + false);
347 +
348 + wqe_index = be16_to_cpu(err_cqe->wqe_index) & ring->size_mask;
349 + tx_info = &ring->tx_info[wqe_index];
350 + desc_size = tx_info->nr_txbb << LOG_TXBB_SIZE;
351 + en_err(priv, "Related WQE - qpn 0x%x, wqe index 0x%x, wqe size 0x%x\n", ring->qpn,
352 + wqe_index, desc_size);
353 + tx_desc = ring->buf + (wqe_index << LOG_TXBB_SIZE);
354 + print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1, tx_desc, desc_size, false);
355 +
356 + if (test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state))
357 + return;
358 +
359 + en_err(priv, "Scheduling port restart\n");
360 + queue_work(mdev->workqueue, &priv->restart_task);
361 +}
362 +
363 bool mlx4_en_process_tx_cq(struct net_device *dev,
364 struct mlx4_en_cq *cq, int napi_budget)
365 {
366 @@ -438,13 +467,10 @@ bool mlx4_en_process_tx_cq(struct net_device *dev,
367 dma_rmb();
368
369 if (unlikely((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) ==
370 - MLX4_CQE_OPCODE_ERROR)) {
371 - struct mlx4_err_cqe *cqe_err = (struct mlx4_err_cqe *)cqe;
372 -
373 - en_err(priv, "CQE error - vendor syndrome: 0x%x syndrome: 0x%x\n",
374 - cqe_err->vendor_err_syndrome,
375 - cqe_err->syndrome);
376 - }
377 + MLX4_CQE_OPCODE_ERROR))
378 + if (!test_and_set_bit(MLX4_EN_TX_RING_STATE_RECOVERING, &ring->state))
379 + mlx4_en_handle_err_cqe(priv, (struct mlx4_err_cqe *)cqe, index,
380 + ring);
381
382 /* Skip over last polled CQE */
383 new_index = be16_to_cpu(cqe->wqe_index) & size_mask;
384 diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
385 index 630f15977f091..a2f69c6f0c79f 100644
386 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
387 +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
388 @@ -271,6 +271,10 @@ struct mlx4_en_page_cache {
389 } buf[MLX4_EN_CACHE_SIZE];
390 };
391
392 +enum {
393 + MLX4_EN_TX_RING_STATE_RECOVERING,
394 +};
395 +
396 struct mlx4_en_priv;
397
398 struct mlx4_en_tx_ring {
399 @@ -317,6 +321,7 @@ struct mlx4_en_tx_ring {
400 * Only queue_stopped might be used if BQL is not properly working.
401 */
402 unsigned long queue_stopped;
403 + unsigned long state;
404 struct mlx4_hwq_resources sp_wqres;
405 struct mlx4_qp sp_qp;
406 struct mlx4_qp_context sp_context;
407 @@ -530,6 +535,10 @@ struct mlx4_en_stats_bitmap {
408 struct mutex mutex; /* for mutual access to stats bitmap */
409 };
410
411 +enum {
412 + MLX4_EN_STATE_FLAG_RESTARTING,
413 +};
414 +
415 struct mlx4_en_priv {
416 struct mlx4_en_dev *mdev;
417 struct mlx4_en_port_profile *prof;
418 @@ -595,7 +604,7 @@ struct mlx4_en_priv {
419 struct mlx4_en_cq *rx_cq[MAX_RX_RINGS];
420 struct mlx4_qp drop_qp;
421 struct work_struct rx_mode_task;
422 - struct work_struct watchdog_task;
423 + struct work_struct restart_task;
424 struct work_struct linkstate_task;
425 struct delayed_work stats_task;
426 struct delayed_work service_task;
427 @@ -643,6 +652,7 @@ struct mlx4_en_priv {
428 u32 pflags;
429 u8 rss_key[MLX4_EN_RSS_KEY_SIZE];
430 u8 rss_hash_fn;
431 + unsigned long state;
432 };
433
434 enum mlx4_en_wol {
435 diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c
436 index 3a0b289d97719..eedec13460787 100644
437 --- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
438 +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
439 @@ -780,7 +780,9 @@ static void lan743x_ethtool_get_wol(struct net_device *netdev,
440
441 wol->supported = 0;
442 wol->wolopts = 0;
443 - phy_ethtool_get_wol(netdev->phydev, wol);
444 +
445 + if (netdev->phydev)
446 + phy_ethtool_get_wol(netdev->phydev, wol);
447
448 wol->supported |= WAKE_BCAST | WAKE_UCAST | WAKE_MCAST |
449 WAKE_MAGIC | WAKE_PHY | WAKE_ARP;
450 @@ -809,9 +811,8 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,
451
452 device_set_wakeup_enable(&adapter->pdev->dev, (bool)wol->wolopts);
453
454 - phy_ethtool_set_wol(netdev->phydev, wol);
455 -
456 - return 0;
457 + return netdev->phydev ? phy_ethtool_set_wol(netdev->phydev, wol)
458 + : -ENETDOWN;
459 }
460 #endif /* CONFIG_PM */
461
462 diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
463 index d1d6ba9cdccdd..2788d4c5b1926 100644
464 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
465 +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
466 @@ -29,7 +29,6 @@
467 #define PRG_ETH0_EXT_RMII_MODE 4
468
469 /* mux to choose between fclk_div2 (bit unset) and mpll2 (bit set) */
470 -#define PRG_ETH0_CLK_M250_SEL_SHIFT 4
471 #define PRG_ETH0_CLK_M250_SEL_MASK GENMASK(4, 4)
472
473 #define PRG_ETH0_TXDLY_SHIFT 5
474 @@ -143,8 +142,9 @@ static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac)
475 }
476
477 clk_configs->m250_mux.reg = dwmac->regs + PRG_ETH0;
478 - clk_configs->m250_mux.shift = PRG_ETH0_CLK_M250_SEL_SHIFT;
479 - clk_configs->m250_mux.mask = PRG_ETH0_CLK_M250_SEL_MASK;
480 + clk_configs->m250_mux.shift = __ffs(PRG_ETH0_CLK_M250_SEL_MASK);
481 + clk_configs->m250_mux.mask = PRG_ETH0_CLK_M250_SEL_MASK >>
482 + clk_configs->m250_mux.shift;
483 clk = meson8b_dwmac_register_clk(dwmac, "m250_sel", mux_parent_names,
484 MUX_CLK_NUM_PARENTS, &clk_mux_ops,
485 &clk_configs->m250_mux.hw);
486 diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
487 index 189cdb7633671..18c5a9bb6759c 100644
488 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
489 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
490 @@ -1441,6 +1441,19 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv, u32 queue)
491 stmmac_free_tx_buffer(priv, queue, i);
492 }
493
494 +/**
495 + * stmmac_free_tx_skbufs - free TX skb buffers
496 + * @priv: private structure
497 + */
498 +static void stmmac_free_tx_skbufs(struct stmmac_priv *priv)
499 +{
500 + u32 tx_queue_cnt = priv->plat->tx_queues_to_use;
501 + u32 queue;
502 +
503 + for (queue = 0; queue < tx_queue_cnt; queue++)
504 + dma_free_tx_skbufs(priv, queue);
505 +}
506 +
507 /**
508 * free_dma_rx_desc_resources - free RX dma desc resources
509 * @priv: private structure
510 @@ -2745,9 +2758,6 @@ static int stmmac_release(struct net_device *dev)
511 struct stmmac_priv *priv = netdev_priv(dev);
512 u32 chan;
513
514 - if (priv->eee_enabled)
515 - del_timer_sync(&priv->eee_ctrl_timer);
516 -
517 /* Stop and disconnect the PHY */
518 phylink_stop(priv->phylink);
519 phylink_disconnect_phy(priv->phylink);
520 @@ -2764,6 +2774,11 @@ static int stmmac_release(struct net_device *dev)
521 if (priv->lpi_irq > 0)
522 free_irq(priv->lpi_irq, dev);
523
524 + if (priv->eee_enabled) {
525 + priv->tx_path_in_lpi_mode = false;
526 + del_timer_sync(&priv->eee_ctrl_timer);
527 + }
528 +
529 /* Stop TX/RX DMA and clear the descriptors */
530 stmmac_stop_all_dma(priv);
531
532 @@ -4748,6 +4763,11 @@ int stmmac_suspend(struct device *dev)
533 for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
534 del_timer_sync(&priv->tx_queue[chan].txtimer);
535
536 + if (priv->eee_enabled) {
537 + priv->tx_path_in_lpi_mode = false;
538 + del_timer_sync(&priv->eee_ctrl_timer);
539 + }
540 +
541 /* Stop TX/RX DMA */
542 stmmac_stop_all_dma(priv);
543
544 @@ -4846,6 +4866,7 @@ int stmmac_resume(struct device *dev)
545
546 stmmac_reset_queues_param(priv);
547
548 + stmmac_free_tx_skbufs(priv);
549 stmmac_clear_descriptors(priv);
550
551 stmmac_hw_setup(ndev, false);
552 diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
553 index eb480204cdbeb..5b8451c58aa4c 100644
554 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c
555 +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
556 @@ -1425,9 +1425,7 @@ static int temac_probe(struct platform_device *pdev)
557 of_node_put(dma_np);
558 } else if (pdata) {
559 /* 2nd memory resource specifies DMA registers */
560 - res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
561 - lp->sdma_regs = devm_ioremap_nocache(&pdev->dev, res->start,
562 - resource_size(res));
563 + lp->sdma_regs = devm_platform_ioremap_resource(pdev, 1);
564 if (IS_ERR(lp->sdma_regs)) {
565 dev_err(&pdev->dev,
566 "could not map DMA registers\n");
567 diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
568 index 0c7d746c03304..14dfb92783456 100644
569 --- a/drivers/net/vrf.c
570 +++ b/drivers/net/vrf.c
571 @@ -1038,11 +1038,17 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,
572 int orig_iif = skb->skb_iif;
573 bool need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr);
574 bool is_ndisc = ipv6_ndisc_frame(skb);
575 + bool is_ll_src;
576
577 /* loopback, multicast & non-ND link-local traffic; do not push through
578 - * packet taps again. Reset pkt_type for upper layers to process skb
579 + * packet taps again. Reset pkt_type for upper layers to process skb.
580 + * for packets with lladdr src, however, skip so that the dst can be
581 + * determine at input using original ifindex in the case that daddr
582 + * needs strict
583 */
584 - if (skb->pkt_type == PACKET_LOOPBACK || (need_strict && !is_ndisc)) {
585 + is_ll_src = ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL;
586 + if (skb->pkt_type == PACKET_LOOPBACK ||
587 + (need_strict && !is_ndisc && !is_ll_src)) {
588 skb->dev = vrf_dev;
589 skb->skb_iif = vrf_dev->ifindex;
590 IP6CB(skb)->flags |= IP6SKB_L3SLAVE;
591 diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
592 index f2c6d9d3bb28f..efe793a2fc65d 100644
593 --- a/drivers/tty/serial/8250/8250_omap.c
594 +++ b/drivers/tty/serial/8250/8250_omap.c
595 @@ -170,11 +170,6 @@ static void omap_8250_mdr1_errataset(struct uart_8250_port *up,
596 struct omap8250_priv *priv)
597 {
598 u8 timeout = 255;
599 - u8 old_mdr1;
600 -
601 - old_mdr1 = serial_in(up, UART_OMAP_MDR1);
602 - if (old_mdr1 == priv->mdr1)
603 - return;
604
605 serial_out(up, UART_OMAP_MDR1, priv->mdr1);
606 udelay(2);
607 diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
608 index b55c3a699fc65..c1592403222f5 100644
609 --- a/drivers/usb/core/quirks.c
610 +++ b/drivers/usb/core/quirks.c
611 @@ -342,6 +342,9 @@ static const struct usb_device_id usb_quirk_list[] = {
612 { USB_DEVICE(0x06a3, 0x0006), .driver_info =
613 USB_QUIRK_CONFIG_INTF_STRINGS },
614
615 + /* Agfa SNAPSCAN 1212U */
616 + { USB_DEVICE(0x06bd, 0x0001), .driver_info = USB_QUIRK_RESET_RESUME },
617 +
618 /* Guillemot Webcam Hercules Dualpix Exchange (2nd ID) */
619 { USB_DEVICE(0x06f8, 0x0804), .driver_info = USB_QUIRK_RESET_RESUME },
620
621 diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
622 index 4c9d1e49d5ed1..a49c27b2ba16d 100644
623 --- a/drivers/usb/gadget/udc/dummy_hcd.c
624 +++ b/drivers/usb/gadget/udc/dummy_hcd.c
625 @@ -2733,7 +2733,7 @@ static int __init init(void)
626 {
627 int retval = -ENOMEM;
628 int i;
629 - struct dummy *dum[MAX_NUM_UDC];
630 + struct dummy *dum[MAX_NUM_UDC] = {};
631
632 if (usb_disabled())
633 return -ENODEV;
634 diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
635 index 933936abb6fb7..1a274f8a5bf11 100644
636 --- a/drivers/usb/host/xhci-hub.c
637 +++ b/drivers/usb/host/xhci-hub.c
638 @@ -1705,6 +1705,10 @@ retry:
639 hcd->state = HC_STATE_SUSPENDED;
640 bus_state->next_statechange = jiffies + msecs_to_jiffies(10);
641 spin_unlock_irqrestore(&xhci->lock, flags);
642 +
643 + if (bus_state->bus_suspended)
644 + usleep_range(5000, 10000);
645 +
646 return 0;
647 }
648
649 diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
650 index 3c90c14390d60..d08b0079eecb1 100644
651 --- a/drivers/usb/host/xhci-pci.c
652 +++ b/drivers/usb/host/xhci-pci.c
653 @@ -45,6 +45,7 @@
654 #define PCI_DEVICE_ID_INTEL_DNV_XHCI 0x19d0
655 #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI 0x15b5
656 #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI 0x15b6
657 +#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_XHCI 0x15c1
658 #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_XHCI 0x15db
659 #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_XHCI 0x15d4
660 #define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_XHCI 0x15e9
661 @@ -220,6 +221,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
662 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
663 (pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI ||
664 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI ||
665 + pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_XHCI ||
666 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_XHCI ||
667 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_XHCI ||
668 pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_XHCI ||
669 diff --git a/drivers/usb/misc/sisusbvga/Kconfig b/drivers/usb/misc/sisusbvga/Kconfig
670 index 9b632ab24f033..df7404c526c8b 100644
671 --- a/drivers/usb/misc/sisusbvga/Kconfig
672 +++ b/drivers/usb/misc/sisusbvga/Kconfig
673 @@ -16,7 +16,7 @@ config USB_SISUSBVGA
674
675 config USB_SISUSBVGA_CON
676 bool "Text console and mode switching support" if USB_SISUSBVGA
677 - depends on VT
678 + depends on VT && BROKEN
679 select FONT_8x16
680 ---help---
681 Say Y here if you want a VGA text console via the USB dongle or
682 diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
683 index 1ec1baa7604ed..678903d1ce4da 100644
684 --- a/drivers/usb/storage/uas.c
685 +++ b/drivers/usb/storage/uas.c
686 @@ -867,6 +867,9 @@ static int uas_slave_configure(struct scsi_device *sdev)
687 if (devinfo->flags & US_FL_NO_READ_CAPACITY_16)
688 sdev->no_read_capacity_16 = 1;
689
690 + /* Some disks cannot handle WRITE_SAME */
691 + if (devinfo->flags & US_FL_NO_SAME)
692 + sdev->no_write_same = 1;
693 /*
694 * Some disks return the total number of blocks in response
695 * to READ CAPACITY rather than the highest block number.
696 diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h
697 index dcdfcdfd2ad13..749c69be091cc 100644
698 --- a/drivers/usb/storage/unusual_uas.h
699 +++ b/drivers/usb/storage/unusual_uas.h
700 @@ -35,12 +35,15 @@ UNUSUAL_DEV(0x054c, 0x087d, 0x0000, 0x9999,
701 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
702 US_FL_NO_REPORT_OPCODES),
703
704 -/* Reported-by: Julian Groß <julian.g@posteo.de> */
705 +/*
706 + * Initially Reported-by: Julian Groß <julian.g@posteo.de>
707 + * Further reports David C. Partridge <david.partridge@perdrix.co.uk>
708 + */
709 UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999,
710 "LaCie",
711 "2Big Quadra USB3",
712 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
713 - US_FL_NO_REPORT_OPCODES),
714 + US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME),
715
716 /*
717 * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI
718 diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
719 index 9a79cd9762f31..2349dfa3b1762 100644
720 --- a/drivers/usb/storage/usb.c
721 +++ b/drivers/usb/storage/usb.c
722 @@ -541,6 +541,9 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags)
723 case 'j':
724 f |= US_FL_NO_REPORT_LUNS;
725 break;
726 + case 'k':
727 + f |= US_FL_NO_SAME;
728 + break;
729 case 'l':
730 f |= US_FL_NOT_LOCKABLE;
731 break;
732 diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
733 index 000a5954b2e89..a7f7ebdd3069e 100644
734 --- a/include/linux/usb_usual.h
735 +++ b/include/linux/usb_usual.h
736 @@ -84,6 +84,8 @@
737 /* Cannot handle REPORT_LUNS */ \
738 US_FLAG(ALWAYS_SYNC, 0x20000000) \
739 /* lies about caching, so always sync */ \
740 + US_FLAG(NO_SAME, 0x40000000) \
741 + /* Cannot handle WRITE_SAME */ \
742
743 #define US_FLAG(name, value) US_FL_##name = value ,
744 enum { US_DO_ALL_FLAGS };
745 diff --git a/include/uapi/linux/ptrace.h b/include/uapi/linux/ptrace.h
746 index a71b6e3b03ebc..83ee45fa634b9 100644
747 --- a/include/uapi/linux/ptrace.h
748 +++ b/include/uapi/linux/ptrace.h
749 @@ -81,7 +81,8 @@ struct seccomp_metadata {
750
751 struct ptrace_syscall_info {
752 __u8 op; /* PTRACE_SYSCALL_INFO_* */
753 - __u32 arch __attribute__((__aligned__(sizeof(__u32))));
754 + __u8 pad[3];
755 + __u32 arch;
756 __u64 instruction_pointer;
757 __u64 stack_pointer;
758 union {
759 diff --git a/kernel/sched/membarrier.c b/kernel/sched/membarrier.c
760 index 168479a7d61b8..be0ca3306be8c 100644
761 --- a/kernel/sched/membarrier.c
762 +++ b/kernel/sched/membarrier.c
763 @@ -30,6 +30,23 @@ static void ipi_mb(void *info)
764 smp_mb(); /* IPIs should be serializing but paranoid. */
765 }
766
767 +static void ipi_sync_core(void *info)
768 +{
769 + /*
770 + * The smp_mb() in membarrier after all the IPIs is supposed to
771 + * ensure that memory on remote CPUs that occur before the IPI
772 + * become visible to membarrier()'s caller -- see scenario B in
773 + * the big comment at the top of this file.
774 + *
775 + * A sync_core() would provide this guarantee, but
776 + * sync_core_before_usermode() might end up being deferred until
777 + * after membarrier()'s smp_mb().
778 + */
779 + smp_mb(); /* IPIs should be serializing but paranoid. */
780 +
781 + sync_core_before_usermode();
782 +}
783 +
784 static void ipi_sync_rq_state(void *info)
785 {
786 struct mm_struct *mm = (struct mm_struct *) info;
787 @@ -134,6 +151,7 @@ static int membarrier_private_expedited(int flags)
788 int cpu;
789 cpumask_var_t tmpmask;
790 struct mm_struct *mm = current->mm;
791 + smp_call_func_t ipi_func = ipi_mb;
792
793 if (flags & MEMBARRIER_FLAG_SYNC_CORE) {
794 if (!IS_ENABLED(CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE))
795 @@ -141,6 +159,7 @@ static int membarrier_private_expedited(int flags)
796 if (!(atomic_read(&mm->membarrier_state) &
797 MEMBARRIER_STATE_PRIVATE_EXPEDITED_SYNC_CORE_READY))
798 return -EPERM;
799 + ipi_func = ipi_sync_core;
800 } else {
801 if (!(atomic_read(&mm->membarrier_state) &
802 MEMBARRIER_STATE_PRIVATE_EXPEDITED_READY))
803 @@ -181,7 +200,7 @@ static int membarrier_private_expedited(int flags)
804 rcu_read_unlock();
805
806 preempt_disable();
807 - smp_call_function_many(tmpmask, ipi_mb, NULL, 1);
808 + smp_call_function_many(tmpmask, ipi_func, NULL, 1);
809 preempt_enable();
810
811 free_cpumask_var(tmpmask);
812 diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
813 index b99efa42e81dc..0dd8984a261da 100644
814 --- a/net/bridge/br_device.c
815 +++ b/net/bridge/br_device.c
816 @@ -168,6 +168,9 @@ static int br_dev_open(struct net_device *dev)
817 br_stp_enable_bridge(br);
818 br_multicast_open(br);
819
820 + if (br_opt_get(br, BROPT_MULTICAST_ENABLED))
821 + br_multicast_join_snoopers(br);
822 +
823 return 0;
824 }
825
826 @@ -188,6 +191,9 @@ static int br_dev_stop(struct net_device *dev)
827 br_stp_disable_bridge(br);
828 br_multicast_stop(br);
829
830 + if (br_opt_get(br, BROPT_MULTICAST_ENABLED))
831 + br_multicast_leave_snoopers(br);
832 +
833 netif_stop_queue(dev);
834
835 return 0;
836 diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
837 index ee2902b51d45a..066cd3c59cfdb 100644
838 --- a/net/bridge/br_multicast.c
839 +++ b/net/bridge/br_multicast.c
840 @@ -1848,7 +1848,7 @@ static inline void br_ip6_multicast_join_snoopers(struct net_bridge *br)
841 }
842 #endif
843
844 -static void br_multicast_join_snoopers(struct net_bridge *br)
845 +void br_multicast_join_snoopers(struct net_bridge *br)
846 {
847 br_ip4_multicast_join_snoopers(br);
848 br_ip6_multicast_join_snoopers(br);
849 @@ -1879,7 +1879,7 @@ static inline void br_ip6_multicast_leave_snoopers(struct net_bridge *br)
850 }
851 #endif
852
853 -static void br_multicast_leave_snoopers(struct net_bridge *br)
854 +void br_multicast_leave_snoopers(struct net_bridge *br)
855 {
856 br_ip4_multicast_leave_snoopers(br);
857 br_ip6_multicast_leave_snoopers(br);
858 @@ -1898,9 +1898,6 @@ static void __br_multicast_open(struct net_bridge *br,
859
860 void br_multicast_open(struct net_bridge *br)
861 {
862 - if (br_opt_get(br, BROPT_MULTICAST_ENABLED))
863 - br_multicast_join_snoopers(br);
864 -
865 __br_multicast_open(br, &br->ip4_own_query);
866 #if IS_ENABLED(CONFIG_IPV6)
867 __br_multicast_open(br, &br->ip6_own_query);
868 @@ -1916,9 +1913,6 @@ void br_multicast_stop(struct net_bridge *br)
869 del_timer_sync(&br->ip6_other_query.timer);
870 del_timer_sync(&br->ip6_own_query.timer);
871 #endif
872 -
873 - if (br_opt_get(br, BROPT_MULTICAST_ENABLED))
874 - br_multicast_leave_snoopers(br);
875 }
876
877 void br_multicast_dev_del(struct net_bridge *br)
878 @@ -2049,6 +2043,7 @@ static void br_multicast_start_querier(struct net_bridge *br,
879 int br_multicast_toggle(struct net_bridge *br, unsigned long val)
880 {
881 struct net_bridge_port *port;
882 + bool change_snoopers = false;
883
884 spin_lock_bh(&br->multicast_lock);
885 if (!!br_opt_get(br, BROPT_MULTICAST_ENABLED) == !!val)
886 @@ -2057,7 +2052,7 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val)
887 br_mc_disabled_update(br->dev, val);
888 br_opt_toggle(br, BROPT_MULTICAST_ENABLED, !!val);
889 if (!br_opt_get(br, BROPT_MULTICAST_ENABLED)) {
890 - br_multicast_leave_snoopers(br);
891 + change_snoopers = true;
892 goto unlock;
893 }
894
895 @@ -2068,9 +2063,30 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val)
896 list_for_each_entry(port, &br->port_list, list)
897 __br_multicast_enable_port(port);
898
899 + change_snoopers = true;
900 +
901 unlock:
902 spin_unlock_bh(&br->multicast_lock);
903
904 + /* br_multicast_join_snoopers has the potential to cause
905 + * an MLD Report/Leave to be delivered to br_multicast_rcv,
906 + * which would in turn call br_multicast_add_group, which would
907 + * attempt to acquire multicast_lock. This function should be
908 + * called after the lock has been released to avoid deadlocks on
909 + * multicast_lock.
910 + *
911 + * br_multicast_leave_snoopers does not have the problem since
912 + * br_multicast_rcv first checks BROPT_MULTICAST_ENABLED, and
913 + * returns without calling br_multicast_ipv4/6_rcv if it's not
914 + * enabled. Moved both functions out just for symmetry.
915 + */
916 + if (change_snoopers) {
917 + if (br_opt_get(br, BROPT_MULTICAST_ENABLED))
918 + br_multicast_join_snoopers(br);
919 + else
920 + br_multicast_leave_snoopers(br);
921 + }
922 +
923 return 0;
924 }
925
926 diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
927 index cecb4223440e7..7615c2210e0da 100644
928 --- a/net/bridge/br_private.h
929 +++ b/net/bridge/br_private.h
930 @@ -665,6 +665,8 @@ void br_multicast_del_port(struct net_bridge_port *port);
931 void br_multicast_enable_port(struct net_bridge_port *port);
932 void br_multicast_disable_port(struct net_bridge_port *port);
933 void br_multicast_init(struct net_bridge *br);
934 +void br_multicast_join_snoopers(struct net_bridge *br);
935 +void br_multicast_leave_snoopers(struct net_bridge *br);
936 void br_multicast_open(struct net_bridge *br);
937 void br_multicast_stop(struct net_bridge *br);
938 void br_multicast_dev_del(struct net_bridge *br);
939 @@ -792,6 +794,14 @@ static inline void br_multicast_init(struct net_bridge *br)
940 {
941 }
942
943 +static inline void br_multicast_join_snoopers(struct net_bridge *br)
944 +{
945 +}
946 +
947 +static inline void br_multicast_leave_snoopers(struct net_bridge *br)
948 +{
949 +}
950 +
951 static inline void br_multicast_open(struct net_bridge *br)
952 {
953 }
954 diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
955 index 48413b5eb61fc..9257292bd1aed 100644
956 --- a/net/bridge/br_vlan.c
957 +++ b/net/bridge/br_vlan.c
958 @@ -260,8 +260,10 @@ static int __vlan_add(struct net_bridge_vlan *v, u16 flags,
959 }
960
961 masterv = br_vlan_get_master(br, v->vid, extack);
962 - if (!masterv)
963 + if (!masterv) {
964 + err = -ENOMEM;
965 goto out_filt;
966 + }
967 v->brvlan = masterv;
968 if (br_opt_get(br, BROPT_VLAN_STATS_PER_PORT)) {
969 v->stats = netdev_alloc_pcpu_stats(struct br_vlan_stats);
970 diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
971 index ed2ab03cf971c..da994f7e3def9 100644
972 --- a/net/ipv4/fib_frontend.c
973 +++ b/net/ipv4/fib_frontend.c
974 @@ -835,7 +835,7 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb,
975 if (has_gw && has_via) {
976 NL_SET_ERR_MSG(extack,
977 "Nexthop configuration can not contain both GATEWAY and VIA");
978 - goto errout;
979 + return -EINVAL;
980 }
981
982 return 0;
983 diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
984 index 54fd6bc5adcca..adace90f49fac 100644
985 --- a/net/ipv4/tcp_input.c
986 +++ b/net/ipv4/tcp_input.c
987 @@ -446,7 +446,6 @@ void tcp_init_buffer_space(struct sock *sk)
988 if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK))
989 tcp_sndbuf_expand(sk);
990
991 - tp->rcvq_space.space = min_t(u32, tp->rcv_wnd, TCP_INIT_CWND * tp->advmss);
992 tcp_mstamp_refresh(tp);
993 tp->rcvq_space.time = tp->tcp_mstamp;
994 tp->rcvq_space.seq = tp->copied_seq;
995 @@ -470,6 +469,8 @@ void tcp_init_buffer_space(struct sock *sk)
996
997 tp->rcv_ssthresh = min(tp->rcv_ssthresh, tp->window_clamp);
998 tp->snd_cwnd_stamp = tcp_jiffies32;
999 + tp->rcvq_space.space = min3(tp->rcv_ssthresh, tp->rcv_wnd,
1000 + (u32)TCP_INIT_CWND * tp->advmss);
1001 }
1002
1003 /* 4. Recalculate window clamp after socket hit its memory bounds. */
1004 diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
1005 index 4407193bd7029..5e311e6a31d51 100644
1006 --- a/net/ipv4/tcp_output.c
1007 +++ b/net/ipv4/tcp_output.c
1008 @@ -1654,7 +1654,8 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited)
1009 * window, and remember whether we were cwnd-limited then.
1010 */
1011 if (!before(tp->snd_una, tp->max_packets_seq) ||
1012 - tp->packets_out > tp->max_packets_out) {
1013 + tp->packets_out > tp->max_packets_out ||
1014 + is_cwnd_limited) {
1015 tp->max_packets_out = tp->packets_out;
1016 tp->max_packets_seq = tp->snd_nxt;
1017 tp->is_cwnd_limited = is_cwnd_limited;
1018 @@ -2476,6 +2477,10 @@ repair:
1019 else
1020 tcp_chrono_stop(sk, TCP_CHRONO_RWND_LIMITED);
1021
1022 + is_cwnd_limited |= (tcp_packets_in_flight(tp) >= tp->snd_cwnd);
1023 + if (likely(sent_pkts || is_cwnd_limited))
1024 + tcp_cwnd_validate(sk, is_cwnd_limited);
1025 +
1026 if (likely(sent_pkts)) {
1027 if (tcp_in_cwnd_reduction(sk))
1028 tp->prr_out += sent_pkts;
1029 @@ -2483,8 +2488,6 @@ repair:
1030 /* Send one loss probe per tail loss episode. */
1031 if (push_one != 2)
1032 tcp_schedule_loss_probe(sk, false);
1033 - is_cwnd_limited |= (tcp_packets_in_flight(tp) >= tp->snd_cwnd);
1034 - tcp_cwnd_validate(sk, is_cwnd_limited);
1035 return false;
1036 }
1037 return !tp->packets_out && !tcp_write_queue_empty(sk);
1038 diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
1039 index 5d016bbdf16e8..c7ff200d0bd41 100644
1040 --- a/net/ipv4/udp.c
1041 +++ b/net/ipv4/udp.c
1042 @@ -2117,7 +2117,7 @@ static int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
1043 __skb_pull(skb, skb_transport_offset(skb));
1044 ret = udp_queue_rcv_one_skb(sk, skb);
1045 if (ret > 0)
1046 - ip_protocol_deliver_rcu(dev_net(skb->dev), skb, -ret);
1047 + ip_protocol_deliver_rcu(dev_net(skb->dev), skb, ret);
1048 }
1049 return 0;
1050 }
1051 diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
1052 index aca608ae313fe..1708b64d41094 100644
1053 --- a/net/mac80211/mesh_pathtbl.c
1054 +++ b/net/mac80211/mesh_pathtbl.c
1055 @@ -60,6 +60,7 @@ static struct mesh_table *mesh_table_alloc(void)
1056 atomic_set(&newtbl->entries, 0);
1057 spin_lock_init(&newtbl->gates_lock);
1058 spin_lock_init(&newtbl->walk_lock);
1059 + rhashtable_init(&newtbl->rhead, &mesh_rht_params);
1060
1061 return newtbl;
1062 }
1063 @@ -775,9 +776,6 @@ int mesh_pathtbl_init(struct ieee80211_sub_if_data *sdata)
1064 goto free_path;
1065 }
1066
1067 - rhashtable_init(&tbl_path->rhead, &mesh_rht_params);
1068 - rhashtable_init(&tbl_mpp->rhead, &mesh_rht_params);
1069 -
1070 sdata->u.mesh.mesh_paths = tbl_path;
1071 sdata->u.mesh.mpp_paths = tbl_mpp;
1072
1073 diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
1074 index f57c610d75237..46004e329a24a 100644
1075 --- a/sound/core/oss/pcm_oss.c
1076 +++ b/sound/core/oss/pcm_oss.c
1077 @@ -1934,11 +1934,15 @@ static int snd_pcm_oss_set_subdivide(struct snd_pcm_oss_file *pcm_oss_file, int
1078 static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsigned int val)
1079 {
1080 struct snd_pcm_runtime *runtime;
1081 + int fragshift;
1082
1083 runtime = substream->runtime;
1084 if (runtime->oss.subdivision || runtime->oss.fragshift)
1085 return -EINVAL;
1086 - runtime->oss.fragshift = val & 0xffff;
1087 + fragshift = val & 0xffff;
1088 + if (fragshift >= 31)
1089 + return -EINVAL;
1090 + runtime->oss.fragshift = fragshift;
1091 runtime->oss.maxfrags = (val >> 16) & 0xffff;
1092 if (runtime->oss.fragshift < 4) /* < 16 */
1093 runtime->oss.fragshift = 4;
1094 diff --git a/sound/usb/format.c b/sound/usb/format.c
1095 index 1f9ea513230a6..9e9d4c10dfac6 100644
1096 --- a/sound/usb/format.c
1097 +++ b/sound/usb/format.c
1098 @@ -40,6 +40,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
1099 case UAC_VERSION_1:
1100 default: {
1101 struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
1102 + if (format >= 64)
1103 + return 0; /* invalid format */
1104 sample_width = fmt->bBitResolution;
1105 sample_bytes = fmt->bSubframeSize;
1106 format = 1ULL << format;
1107 diff --git a/sound/usb/stream.c b/sound/usb/stream.c
1108 index d01edd5da6cf8..c5cbba9fdf0da 100644
1109 --- a/sound/usb/stream.c
1110 +++ b/sound/usb/stream.c
1111 @@ -193,16 +193,16 @@ static int usb_chmap_ctl_get(struct snd_kcontrol *kcontrol,
1112 struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
1113 struct snd_usb_substream *subs = info->private_data;
1114 struct snd_pcm_chmap_elem *chmap = NULL;
1115 - int i;
1116 + int i = 0;
1117
1118 - memset(ucontrol->value.integer.value, 0,
1119 - sizeof(ucontrol->value.integer.value));
1120 if (subs->cur_audiofmt)
1121 chmap = subs->cur_audiofmt->chmap;
1122 if (chmap) {
1123 for (i = 0; i < chmap->channels; i++)
1124 ucontrol->value.integer.value[i] = chmap->map[i];
1125 }
1126 + for (; i < subs->channels_max; i++)
1127 + ucontrol->value.integer.value[i] = 0;
1128 return 0;
1129 }
1130
1131 diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
1132 index 6c4f21db5fbad..fe587a9594634 100755
1133 --- a/tools/testing/ktest/ktest.pl
1134 +++ b/tools/testing/ktest/ktest.pl
1135 @@ -4197,7 +4197,12 @@ sub do_send_mail {
1136 $mail_command =~ s/\$SUBJECT/$subject/g;
1137 $mail_command =~ s/\$MESSAGE/$message/g;
1138
1139 - run_command $mail_command;
1140 + my $ret = run_command $mail_command;
1141 + if (!$ret && defined($file)) {
1142 + # try again without the file
1143 + $message .= "\n\n*** FAILED TO SEND LOG ***\n\n";
1144 + do_send_email($subject, $message);
1145 + }
1146 }
1147
1148 sub send_email {
1149 diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc
1150 index a753c73d869ab..0f60087583d8f 100644
1151 --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc
1152 +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc
1153 @@ -11,16 +11,12 @@ grep -A10 "fetcharg:" README | grep -q '\[u\]<offset>' || exit_unsupported
1154 :;: "user-memory access syntax and ustring working on user memory";:
1155 echo 'p:myevent do_sys_open path=+0($arg2):ustring path2=+u0($arg2):string' \
1156 > kprobe_events
1157 -echo 'p:myevent2 do_sys_openat2 path=+0($arg2):ustring path2=+u0($arg2):string' \
1158 - >> kprobe_events
1159
1160 grep myevent kprobe_events | \
1161 grep -q 'path=+0($arg2):ustring path2=+u0($arg2):string'
1162 echo 1 > events/kprobes/myevent/enable
1163 -echo 1 > events/kprobes/myevent2/enable
1164 echo > /dev/null
1165 echo 0 > events/kprobes/myevent/enable
1166 -echo 0 > events/kprobes/myevent2/enable
1167
1168 grep myevent trace | grep -q 'path="/dev/null" path2="/dev/null"'
1169
1170 diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh
1171 index 9fd3a0b97f0db..38133da2973d4 100755
1172 --- a/tools/testing/selftests/net/fcnal-test.sh
1173 +++ b/tools/testing/selftests/net/fcnal-test.sh
1174 @@ -239,6 +239,28 @@ setup_cmd_nsb()
1175 fi
1176 }
1177
1178 +setup_cmd_nsc()
1179 +{
1180 + local cmd="$*"
1181 + local rc
1182 +
1183 + run_cmd_nsc ${cmd}
1184 + rc=$?
1185 + if [ $rc -ne 0 ]; then
1186 + # show user the command if not done so already
1187 + if [ "$VERBOSE" = "0" ]; then
1188 + echo "setup command: $cmd"
1189 + fi
1190 + echo "failed. stopping tests"
1191 + if [ "${PAUSE_ON_FAIL}" = "yes" ]; then
1192 + echo
1193 + echo "hit enter to continue"
1194 + read a
1195 + fi
1196 + exit $rc
1197 + fi
1198 +}
1199 +
1200 # set sysctl values in NS-A
1201 set_sysctl()
1202 {
1203 @@ -447,6 +469,36 @@ setup()
1204 sleep 1
1205 }
1206
1207 +setup_lla_only()
1208 +{
1209 + # make sure we are starting with a clean slate
1210 + kill_procs
1211 + cleanup 2>/dev/null
1212 +
1213 + log_debug "Configuring network namespaces"
1214 + set -e
1215 +
1216 + create_ns ${NSA} "-" "-"
1217 + create_ns ${NSB} "-" "-"
1218 + create_ns ${NSC} "-" "-"
1219 + connect_ns ${NSA} ${NSA_DEV} "-" "-" \
1220 + ${NSB} ${NSB_DEV} "-" "-"
1221 + connect_ns ${NSA} ${NSA_DEV2} "-" "-" \
1222 + ${NSC} ${NSC_DEV} "-" "-"
1223 +
1224 + NSA_LINKIP6=$(get_linklocal ${NSA} ${NSA_DEV})
1225 + NSB_LINKIP6=$(get_linklocal ${NSB} ${NSB_DEV})
1226 + NSC_LINKIP6=$(get_linklocal ${NSC} ${NSC_DEV})
1227 +
1228 + create_vrf ${NSA} ${VRF} ${VRF_TABLE} "-" "-"
1229 + ip -netns ${NSA} link set dev ${NSA_DEV} vrf ${VRF}
1230 + ip -netns ${NSA} link set dev ${NSA_DEV2} vrf ${VRF}
1231 +
1232 + set +e
1233 +
1234 + sleep 1
1235 +}
1236 +
1237 ################################################################################
1238 # IPv4
1239
1240 @@ -3329,10 +3381,53 @@ use_case_br()
1241 setup_cmd_nsb ip li del vlan100 2>/dev/null
1242 }
1243
1244 +# VRF only.
1245 +# ns-A device is connected to both ns-B and ns-C on a single VRF but only has
1246 +# LLA on the interfaces
1247 +use_case_ping_lla_multi()
1248 +{
1249 + setup_lla_only
1250 + # only want reply from ns-A
1251 + setup_cmd_nsb sysctl -qw net.ipv6.icmp.echo_ignore_multicast=1
1252 + setup_cmd_nsc sysctl -qw net.ipv6.icmp.echo_ignore_multicast=1
1253 +
1254 + log_start
1255 + run_cmd_nsb ping -c1 -w1 ${MCAST}%${NSB_DEV}
1256 + log_test_addr ${MCAST}%${NSB_DEV} $? 0 "Pre cycle, ping out ns-B"
1257 +
1258 + run_cmd_nsc ping -c1 -w1 ${MCAST}%${NSC_DEV}
1259 + log_test_addr ${MCAST}%${NSC_DEV} $? 0 "Pre cycle, ping out ns-C"
1260 +
1261 + # cycle/flap the first ns-A interface
1262 + setup_cmd ip link set ${NSA_DEV} down
1263 + setup_cmd ip link set ${NSA_DEV} up
1264 + sleep 1
1265 +
1266 + log_start
1267 + run_cmd_nsb ping -c1 -w1 ${MCAST}%${NSB_DEV}
1268 + log_test_addr ${MCAST}%${NSB_DEV} $? 0 "Post cycle ${NSA} ${NSA_DEV}, ping out ns-B"
1269 + run_cmd_nsc ping -c1 -w1 ${MCAST}%${NSC_DEV}
1270 + log_test_addr ${MCAST}%${NSC_DEV} $? 0 "Post cycle ${NSA} ${NSA_DEV}, ping out ns-C"
1271 +
1272 + # cycle/flap the second ns-A interface
1273 + setup_cmd ip link set ${NSA_DEV2} down
1274 + setup_cmd ip link set ${NSA_DEV2} up
1275 + sleep 1
1276 +
1277 + log_start
1278 + run_cmd_nsb ping -c1 -w1 ${MCAST}%${NSB_DEV}
1279 + log_test_addr ${MCAST}%${NSB_DEV} $? 0 "Post cycle ${NSA} ${NSA_DEV2}, ping out ns-B"
1280 + run_cmd_nsc ping -c1 -w1 ${MCAST}%${NSC_DEV}
1281 + log_test_addr ${MCAST}%${NSC_DEV} $? 0 "Post cycle ${NSA} ${NSA_DEV2}, ping out ns-C"
1282 +}
1283 +
1284 use_cases()
1285 {
1286 log_section "Use cases"
1287 + log_subsection "Device enslaved to bridge"
1288 use_case_br
1289 + log_subsection "Ping LLA with multiple interfaces"
1290 + use_case_ping_lla_multi
1291 }
1292
1293 ################################################################################