Magellan Linux

Contents of /trunk/kernel-alx-legacy/patches-4.9/0406-4.9.307-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3708 - (show annotations) (download)
Mon Oct 24 14:08:21 2022 UTC (19 months ago) by niro
File size: 14257 byte(s)
-linux-4.9.307
1 diff --git a/Makefile b/Makefile
2 index 482b841188572..19363e65ef226 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 9
8 -SUBLEVEL = 306
9 +SUBLEVEL = 307
10 EXTRAVERSION =
11 NAME = Roaring Lionus
12
13 diff --git a/arch/arm/include/asm/spectre.h b/arch/arm/include/asm/spectre.h
14 index d1fa5607d3aa3..85f9e538fb325 100644
15 --- a/arch/arm/include/asm/spectre.h
16 +++ b/arch/arm/include/asm/spectre.h
17 @@ -25,7 +25,13 @@ enum {
18 SPECTRE_V2_METHOD_LOOP8 = BIT(__SPECTRE_V2_METHOD_LOOP8),
19 };
20
21 +#ifdef CONFIG_GENERIC_CPU_VULNERABILITIES
22 void spectre_v2_update_state(unsigned int state, unsigned int methods);
23 +#else
24 +static inline void spectre_v2_update_state(unsigned int state,
25 + unsigned int methods)
26 +{}
27 +#endif
28
29 int spectre_bhb_update_vectors(unsigned int method);
30
31 diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
32 index 1040efcb98db6..77ec669fd5ee1 100644
33 --- a/arch/arm/kernel/entry-armv.S
34 +++ b/arch/arm/kernel/entry-armv.S
35 @@ -1074,9 +1074,9 @@ vector_bhb_loop8_\name:
36
37 @ bhb workaround
38 mov r0, #8
39 -1: b . + 4
40 +3: b . + 4
41 subs r0, r0, #1
42 - bne 1b
43 + bne 3b
44 dsb
45 isb
46 b 2b
47 diff --git a/drivers/gpio/gpio-ts4900.c b/drivers/gpio/gpio-ts4900.c
48 index 5bd21725e6043..930a6098b7589 100644
49 --- a/drivers/gpio/gpio-ts4900.c
50 +++ b/drivers/gpio/gpio-ts4900.c
51 @@ -1,7 +1,7 @@
52 /*
53 * Digital I/O driver for Technologic Systems I2C FPGA Core
54 *
55 - * Copyright (C) 2015 Technologic Systems
56 + * Copyright (C) 2015, 2018 Technologic Systems
57 * Copyright (C) 2016 Savoir-Faire Linux
58 *
59 * This program is free software; you can redistribute it and/or
60 @@ -52,19 +52,33 @@ static int ts4900_gpio_direction_input(struct gpio_chip *chip,
61 {
62 struct ts4900_gpio_priv *priv = gpiochip_get_data(chip);
63
64 - /*
65 - * This will clear the output enable bit, the other bits are
66 - * dontcare when this is cleared
67 + /* Only clear the OE bit here, requires a RMW. Prevents potential issue
68 + * with OE and data getting to the physical pin at different times.
69 */
70 - return regmap_write(priv->regmap, offset, 0);
71 + return regmap_update_bits(priv->regmap, offset, TS4900_GPIO_OE, 0);
72 }
73
74 static int ts4900_gpio_direction_output(struct gpio_chip *chip,
75 unsigned int offset, int value)
76 {
77 struct ts4900_gpio_priv *priv = gpiochip_get_data(chip);
78 + unsigned int reg;
79 int ret;
80
81 + /* If changing from an input to an output, we need to first set the
82 + * proper data bit to what is requested and then set OE bit. This
83 + * prevents a glitch that can occur on the IO line
84 + */
85 + regmap_read(priv->regmap, offset, &reg);
86 + if (!(reg & TS4900_GPIO_OE)) {
87 + if (value)
88 + reg = TS4900_GPIO_OUT;
89 + else
90 + reg &= ~TS4900_GPIO_OUT;
91 +
92 + regmap_write(priv->regmap, offset, reg);
93 + }
94 +
95 if (value)
96 ret = regmap_write(priv->regmap, offset, TS4900_GPIO_OE |
97 TS4900_GPIO_OUT);
98 diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
99 index ad7b9772a4b27..78f34e87212ac 100644
100 --- a/drivers/net/ethernet/nxp/lpc_eth.c
101 +++ b/drivers/net/ethernet/nxp/lpc_eth.c
102 @@ -1515,6 +1515,7 @@ static int lpc_eth_drv_resume(struct platform_device *pdev)
103 {
104 struct net_device *ndev = platform_get_drvdata(pdev);
105 struct netdata_local *pldat;
106 + int ret;
107
108 if (device_may_wakeup(&pdev->dev))
109 disable_irq_wake(ndev->irq);
110 @@ -1524,7 +1525,9 @@ static int lpc_eth_drv_resume(struct platform_device *pdev)
111 pldat = netdev_priv(ndev);
112
113 /* Enable interface clock */
114 - clk_enable(pldat->clk);
115 + ret = clk_enable(pldat->clk);
116 + if (ret)
117 + return ret;
118
119 /* Reset and initialize */
120 __lpc_eth_reset(pldat);
121 diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
122 index 6379bfedc9f00..9a7ba55b46933 100644
123 --- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c
124 +++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
125 @@ -2899,11 +2899,11 @@ int qed_iov_mark_vf_flr(struct qed_hwfn *p_hwfn, u32 *p_disabled_vfs)
126 return found;
127 }
128
129 -static void qed_iov_get_link(struct qed_hwfn *p_hwfn,
130 - u16 vfid,
131 - struct qed_mcp_link_params *p_params,
132 - struct qed_mcp_link_state *p_link,
133 - struct qed_mcp_link_capabilities *p_caps)
134 +static int qed_iov_get_link(struct qed_hwfn *p_hwfn,
135 + u16 vfid,
136 + struct qed_mcp_link_params *p_params,
137 + struct qed_mcp_link_state *p_link,
138 + struct qed_mcp_link_capabilities *p_caps)
139 {
140 struct qed_vf_info *p_vf = qed_iov_get_vf_info(p_hwfn,
141 vfid,
142 @@ -2911,7 +2911,7 @@ static void qed_iov_get_link(struct qed_hwfn *p_hwfn,
143 struct qed_bulletin_content *p_bulletin;
144
145 if (!p_vf)
146 - return;
147 + return -EINVAL;
148
149 p_bulletin = p_vf->bulletin.p_virt;
150
151 @@ -2921,6 +2921,7 @@ static void qed_iov_get_link(struct qed_hwfn *p_hwfn,
152 __qed_vf_get_link_state(p_hwfn, p_link, p_bulletin);
153 if (p_caps)
154 __qed_vf_get_link_caps(p_hwfn, p_caps, p_bulletin);
155 + return 0;
156 }
157
158 static void qed_iov_process_mbx_req(struct qed_hwfn *p_hwfn,
159 @@ -3538,6 +3539,7 @@ static int qed_get_vf_config(struct qed_dev *cdev,
160 struct qed_public_vf_info *vf_info;
161 struct qed_mcp_link_state link;
162 u32 tx_rate;
163 + int ret;
164
165 /* Sanitize request */
166 if (IS_VF(cdev))
167 @@ -3551,7 +3553,9 @@ static int qed_get_vf_config(struct qed_dev *cdev,
168
169 vf_info = qed_iov_get_public_vf_info(hwfn, vf_id, true);
170
171 - qed_iov_get_link(hwfn, vf_id, NULL, &link, NULL);
172 + ret = qed_iov_get_link(hwfn, vf_id, NULL, &link, NULL);
173 + if (ret)
174 + return ret;
175
176 /* Fill information about VF */
177 ivi->vf = vf_id;
178 diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c
179 index 170243d3276b9..d0449d5418f7e 100644
180 --- a/drivers/net/ethernet/qlogic/qed/qed_vf.c
181 +++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c
182 @@ -384,6 +384,9 @@ int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
183 p_iov->bulletin.size,
184 &p_iov->bulletin.phys,
185 GFP_KERNEL);
186 + if (!p_iov->bulletin.p_virt)
187 + goto free_pf2vf_reply;
188 +
189 DP_VERBOSE(p_hwfn, QED_MSG_IOV,
190 "VF's bulletin Board [%p virt 0x%llx phys 0x%08x bytes]\n",
191 p_iov->bulletin.p_virt,
192 @@ -397,6 +400,10 @@ int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
193
194 return qed_vf_pf_acquire(p_hwfn);
195
196 +free_pf2vf_reply:
197 + dma_free_coherent(&p_hwfn->cdev->pdev->dev,
198 + sizeof(union pfvf_tlvs),
199 + p_iov->pf2vf_reply, p_iov->pf2vf_reply_phys);
200 free_vf2pf_request:
201 dma_free_coherent(&p_hwfn->cdev->pdev->dev,
202 sizeof(union vfpf_tlvs),
203 diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
204 index df3b3384984ce..1f9a6ea356b02 100644
205 --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
206 +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
207 @@ -1175,7 +1175,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
208 if (rc) {
209 dev_err(dev,
210 "Cannot register network device, aborting\n");
211 - goto error;
212 + goto put_node;
213 }
214
215 dev_info(dev,
216 @@ -1183,6 +1183,8 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
217 (unsigned int __force)ndev->mem_start, lp->base_addr, ndev->irq);
218 return 0;
219
220 +put_node:
221 + of_node_put(lp->phy_node);
222 error:
223 xemaclite_remove_ndev(ndev);
224 return rc;
225 diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
226 index e6646c8a7bdbb..78788402edd8b 100644
227 --- a/drivers/net/xen-netback/xenbus.c
228 +++ b/drivers/net/xen-netback/xenbus.c
229 @@ -1040,15 +1040,11 @@ static void connect(struct backend_info *be)
230 xenvif_carrier_on(be->vif);
231
232 unregister_hotplug_status_watch(be);
233 - if (xenbus_exists(XBT_NIL, dev->nodename, "hotplug-status")) {
234 - err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch,
235 - NULL, hotplug_status_changed,
236 - "%s/%s", dev->nodename,
237 - "hotplug-status");
238 - if (err)
239 - goto err;
240 + err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, NULL,
241 + hotplug_status_changed,
242 + "%s/%s", dev->nodename, "hotplug-status");
243 + if (!err)
244 be->have_hotplug_status_watch = 1;
245 - }
246
247 netif_tx_wake_all_queues(be->vif->dev);
248
249 diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c
250 index ed65993aae96a..838ec17073fd1 100644
251 --- a/drivers/nfc/port100.c
252 +++ b/drivers/nfc/port100.c
253 @@ -1617,7 +1617,9 @@ free_nfc_dev:
254 nfc_digital_free_device(dev->nfc_digital_dev);
255
256 error:
257 + usb_kill_urb(dev->in_urb);
258 usb_free_urb(dev->in_urb);
259 + usb_kill_urb(dev->out_urb);
260 usb_free_urb(dev->out_urb);
261 usb_put_dev(dev->udev);
262
263 diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c
264 index 454e47424adea..463f920d37825 100644
265 --- a/drivers/staging/gdm724x/gdm_lte.c
266 +++ b/drivers/staging/gdm724x/gdm_lte.c
267 @@ -85,14 +85,15 @@ static void tx_complete(void *arg)
268
269 static int gdm_lte_rx(struct sk_buff *skb, struct nic *nic, int nic_type)
270 {
271 - int ret;
272 + int ret, len;
273
274 + len = skb->len + ETH_HLEN;
275 ret = netif_rx_ni(skb);
276 if (ret == NET_RX_DROP) {
277 nic->stats.rx_dropped++;
278 } else {
279 nic->stats.rx_packets++;
280 - nic->stats.rx_bytes += skb->len + ETH_HLEN;
281 + nic->stats.rx_bytes += len;
282 }
283
284 return 0;
285 diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
286 index b5bff1e760a34..8ded1d8941008 100644
287 --- a/fs/btrfs/extent-tree.c
288 +++ b/fs/btrfs/extent-tree.c
289 @@ -8457,6 +8457,7 @@ struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,
290 out_free_delayed:
291 btrfs_free_delayed_extent_op(extent_op);
292 out_free_buf:
293 + btrfs_tree_unlock(buf);
294 free_extent_buffer(buf);
295 out_free_reserved:
296 btrfs_free_reserved_extent(root, ins.objectid, ins.offset, 0);
297 diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
298 index 6dd276227217e..5747174e03266 100644
299 --- a/include/linux/mlx5/mlx5_ifc.h
300 +++ b/include/linux/mlx5/mlx5_ifc.h
301 @@ -7327,8 +7327,8 @@ struct mlx5_ifc_bufferx_reg_bits {
302 u8 reserved_at_0[0x6];
303 u8 lossy[0x1];
304 u8 epsb[0x1];
305 - u8 reserved_at_8[0xc];
306 - u8 size[0xc];
307 + u8 reserved_at_8[0x8];
308 + u8 size[0x10];
309
310 u8 xoff_threshold[0x10];
311 u8 xon_threshold[0x10];
312 diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
313 index 12bee7043be6f..90e0fd5621da9 100644
314 --- a/kernel/trace/trace.c
315 +++ b/kernel/trace/trace.c
316 @@ -1077,10 +1077,12 @@ static int __init set_buf_size(char *str)
317 if (!str)
318 return 0;
319 buf_size = memparse(str, &str);
320 - /* nr_entries can not be zero */
321 - if (buf_size == 0)
322 - return 0;
323 - trace_buf_size = buf_size;
324 + /*
325 + * nr_entries can not be zero and the startup
326 + * tests require some buffer space. Therefore
327 + * ensure we have at least 4096 bytes of buffer.
328 + */
329 + trace_buf_size = max(4096UL, buf_size);
330 return 1;
331 }
332 __setup("trace_buf_size=", set_buf_size);
333 diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
334 index c4ef1be59cb19..839c4237d1313 100644
335 --- a/net/ax25/af_ax25.c
336 +++ b/net/ax25/af_ax25.c
337 @@ -90,6 +90,13 @@ again:
338 ax25_for_each(s, &ax25_list) {
339 if (s->ax25_dev == ax25_dev) {
340 sk = s->sk;
341 + if (!sk) {
342 + spin_unlock_bh(&ax25_list_lock);
343 + s->ax25_dev = NULL;
344 + ax25_disconnect(s, ENETUNREACH);
345 + spin_lock_bh(&ax25_list_lock);
346 + goto again;
347 + }
348 sock_hold(sk);
349 spin_unlock_bh(&ax25_list_lock);
350 lock_sock(sk);
351 diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
352 index 4f384abb4cedd..eaf0a483211ac 100644
353 --- a/net/batman-adv/hard-interface.c
354 +++ b/net/batman-adv/hard-interface.c
355 @@ -155,22 +155,25 @@ static bool batadv_is_on_batman_iface(const struct net_device *net_dev)
356 struct net *net = dev_net(net_dev);
357 struct net_device *parent_dev;
358 const struct net *parent_net;
359 + int iflink;
360 bool ret;
361
362 /* check if this is a batman-adv mesh interface */
363 if (batadv_softif_is_valid(net_dev))
364 return true;
365
366 - /* no more parents..stop recursion */
367 - if (dev_get_iflink(net_dev) == 0 ||
368 - dev_get_iflink(net_dev) == net_dev->ifindex)
369 + iflink = dev_get_iflink(net_dev);
370 + if (iflink == 0)
371 return false;
372
373 parent_net = batadv_getlink_net(net_dev, net);
374
375 + /* iflink to itself, most likely physical device */
376 + if (net == parent_net && iflink == net_dev->ifindex)
377 + return false;
378 +
379 /* recurse over the parent device */
380 - parent_dev = __dev_get_by_index((struct net *)parent_net,
381 - dev_get_iflink(net_dev));
382 + parent_dev = __dev_get_by_index((struct net *)parent_net, iflink);
383 /* if we got a NULL parent_dev there is something broken.. */
384 if (!parent_dev) {
385 pr_err("Cannot find parent device\n");
386 diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
387 index 3fb5d8ecc8499..e42df58b88766 100644
388 --- a/net/core/net-sysfs.c
389 +++ b/net/core/net-sysfs.c
390 @@ -198,7 +198,7 @@ static ssize_t speed_show(struct device *dev,
391 if (!rtnl_trylock())
392 return restart_syscall();
393
394 - if (netif_running(netdev)) {
395 + if (netif_running(netdev) && netif_device_present(netdev)) {
396 struct ethtool_link_ksettings cmd;
397
398 if (!__ethtool_get_link_ksettings(netdev, &cmd))
399 diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c
400 index e8f56b7c5afb1..a044964fa8023 100644
401 --- a/net/sctp/sctp_diag.c
402 +++ b/net/sctp/sctp_diag.c
403 @@ -45,10 +45,6 @@ static void inet_diag_msg_sctpasoc_fill(struct inet_diag_msg *r,
404 r->idiag_timer = SCTP_EVENT_TIMEOUT_T3_RTX;
405 r->idiag_retrans = asoc->rtx_data_chunks;
406 r->idiag_expires = jiffies_to_msecs(t3_rtx->expires - jiffies);
407 - } else {
408 - r->idiag_timer = 0;
409 - r->idiag_retrans = 0;
410 - r->idiag_expires = 0;
411 }
412 }
413
414 @@ -128,13 +124,14 @@ static int inet_sctp_diag_fill(struct sock *sk, struct sctp_association *asoc,
415 r = nlmsg_data(nlh);
416 BUG_ON(!sk_fullsock(sk));
417
418 + r->idiag_timer = 0;
419 + r->idiag_retrans = 0;
420 + r->idiag_expires = 0;
421 if (asoc) {
422 inet_diag_msg_sctpasoc_fill(r, sk, asoc);
423 } else {
424 inet_diag_msg_common_fill(r, sk);
425 r->idiag_state = sk->sk_state;
426 - r->idiag_timer = 0;
427 - r->idiag_retrans = 0;
428 }
429
430 if (inet_diag_msg_attrs_fill(sk, skb, r, ext, user_ns, net_admin))
431 diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
432 index 26546892cd545..faab09215c88b 100644
433 --- a/tools/testing/selftests/memfd/memfd_test.c
434 +++ b/tools/testing/selftests/memfd/memfd_test.c
435 @@ -373,6 +373,7 @@ static void mfd_fail_write(int fd)
436 printf("mmap()+mprotect() didn't fail as expected\n");
437 abort();
438 }
439 + munmap(p, mfd_def_size);
440 }
441
442 /* verify PUNCH_HOLE fails */