Magellan Linux

Contents of /trunk/kernel-alx-legacy/patches-4.9/0422-4.9.323-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3724 - (show annotations) (download)
Mon Oct 24 14:08:35 2022 UTC (19 months ago) by niro
File size: 11026 byte(s)
-linux-4.9.323
1 diff --git a/Makefile b/Makefile
2 index bd4c898a9940e..44c3b223062a1 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 9
8 -SUBLEVEL = 322
9 +SUBLEVEL = 323
10 EXTRAVERSION =
11 NAME = Roaring Lionus
12
13 diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
14 index ca266fcca186c..f191057065f72 100644
15 --- a/drivers/dma/at_xdmac.c
16 +++ b/drivers/dma/at_xdmac.c
17 @@ -1806,6 +1806,11 @@ static int at_xdmac_alloc_chan_resources(struct dma_chan *chan)
18 for (i = 0; i < init_nr_desc_per_channel; i++) {
19 desc = at_xdmac_alloc_desc(chan, GFP_ATOMIC);
20 if (!desc) {
21 + if (i == 0) {
22 + dev_warn(chan2dev(chan),
23 + "can't allocate any descriptors\n");
24 + return -EIO;
25 + }
26 dev_warn(chan2dev(chan),
27 "only %d descriptors have been allocated\n", i);
28 break;
29 diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
30 index a7e1f6e17e3d1..8ea8d04e1ae02 100644
31 --- a/drivers/dma/ti-dma-crossbar.c
32 +++ b/drivers/dma/ti-dma-crossbar.c
33 @@ -251,6 +251,7 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
34 if (dma_spec->args[0] >= xbar->xbar_requests) {
35 dev_err(&pdev->dev, "Invalid XBAR request number: %d\n",
36 dma_spec->args[0]);
37 + put_device(&pdev->dev);
38 return ERR_PTR(-EINVAL);
39 }
40
41 @@ -258,12 +259,14 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
42 dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", 0);
43 if (!dma_spec->np) {
44 dev_err(&pdev->dev, "Can't get DMA master\n");
45 + put_device(&pdev->dev);
46 return ERR_PTR(-EINVAL);
47 }
48
49 map = kzalloc(sizeof(*map), GFP_KERNEL);
50 if (!map) {
51 of_node_put(dma_spec->np);
52 + put_device(&pdev->dev);
53 return ERR_PTR(-ENOMEM);
54 }
55
56 @@ -274,6 +277,8 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
57 mutex_unlock(&xbar->mutex);
58 dev_err(&pdev->dev, "Run out of free DMA requests\n");
59 kfree(map);
60 + of_node_put(dma_spec->np);
61 + put_device(&pdev->dev);
62 return ERR_PTR(-ENOMEM);
63 }
64 set_bit(map->xbar_out, xbar->dma_inuse);
65 diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
66 index a29ac9bae6d5e..9ab056bb834d9 100644
67 --- a/drivers/i2c/busses/i2c-cadence.c
68 +++ b/drivers/i2c/busses/i2c-cadence.c
69 @@ -992,6 +992,7 @@ static int cdns_i2c_probe(struct platform_device *pdev)
70 return 0;
71
72 err_clk_dis:
73 + clk_notifier_unregister(id->clk, &id->clk_rate_change_nb);
74 clk_disable_unprepare(id->clk);
75 pm_runtime_set_suspended(&pdev->dev);
76 pm_runtime_disable(&pdev->dev);
77 diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
78 index 9ad5a7019abfd..d8b8cf36de312 100644
79 --- a/drivers/iommu/dmar.c
80 +++ b/drivers/iommu/dmar.c
81 @@ -373,7 +373,7 @@ static int dmar_pci_bus_notifier(struct notifier_block *nb,
82
83 static struct notifier_block dmar_pci_bus_nb = {
84 .notifier_call = dmar_pci_bus_notifier,
85 - .priority = INT_MIN,
86 + .priority = 1,
87 };
88
89 static struct dmar_drhd_unit *
90 diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
91 index c6a176d8681c0..4e3432182092d 100644
92 --- a/drivers/net/can/grcan.c
93 +++ b/drivers/net/can/grcan.c
94 @@ -1669,7 +1669,6 @@ static int grcan_probe(struct platform_device *ofdev)
95 */
96 sysid_parent = of_find_node_by_path("/ambapp0");
97 if (sysid_parent) {
98 - of_node_get(sysid_parent);
99 err = of_property_read_u32(sysid_parent, "systemid", &sysid);
100 if (!err && ((sysid & GRLIB_VERSION_MASK) >=
101 GRCAN_TXBUG_SAFE_GRLIB_VERSION))
102 diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
103 index 6771c51f72c37..e3dc59fffdb78 100644
104 --- a/drivers/net/can/usb/gs_usb.c
105 +++ b/drivers/net/can/usb/gs_usb.c
106 @@ -192,6 +192,8 @@ struct gs_can {
107
108 struct usb_anchor tx_submitted;
109 atomic_t active_tx_urbs;
110 + void *rxbuf[GS_MAX_RX_URBS];
111 + dma_addr_t rxbuf_dma[GS_MAX_RX_URBS];
112 };
113
114 /* usb interface struct */
115 @@ -601,6 +603,7 @@ static int gs_can_open(struct net_device *netdev)
116 for (i = 0; i < GS_MAX_RX_URBS; i++) {
117 struct urb *urb;
118 u8 *buf;
119 + dma_addr_t buf_dma;
120
121 /* alloc rx urb */
122 urb = usb_alloc_urb(0, GFP_KERNEL);
123 @@ -611,7 +614,7 @@ static int gs_can_open(struct net_device *netdev)
124 buf = usb_alloc_coherent(dev->udev,
125 sizeof(struct gs_host_frame),
126 GFP_KERNEL,
127 - &urb->transfer_dma);
128 + &buf_dma);
129 if (!buf) {
130 netdev_err(netdev,
131 "No memory left for USB buffer\n");
132 @@ -619,6 +622,8 @@ static int gs_can_open(struct net_device *netdev)
133 return -ENOMEM;
134 }
135
136 + urb->transfer_dma = buf_dma;
137 +
138 /* fill, anchor, and submit rx urb */
139 usb_fill_bulk_urb(urb,
140 dev->udev,
141 @@ -642,10 +647,17 @@ static int gs_can_open(struct net_device *netdev)
142 rc);
143
144 usb_unanchor_urb(urb);
145 + usb_free_coherent(dev->udev,
146 + sizeof(struct gs_host_frame),
147 + buf,
148 + buf_dma);
149 usb_free_urb(urb);
150 break;
151 }
152
153 + dev->rxbuf[i] = buf;
154 + dev->rxbuf_dma[i] = buf_dma;
155 +
156 /* Drop reference,
157 * USB core will take care of freeing it
158 */
159 @@ -710,13 +722,20 @@ static int gs_can_close(struct net_device *netdev)
160 int rc;
161 struct gs_can *dev = netdev_priv(netdev);
162 struct gs_usb *parent = dev->parent;
163 + unsigned int i;
164
165 netif_stop_queue(netdev);
166
167 /* Stop polling */
168 parent->active_channels--;
169 - if (!parent->active_channels)
170 + if (!parent->active_channels) {
171 usb_kill_anchored_urbs(&parent->rx_submitted);
172 + for (i = 0; i < GS_MAX_RX_URBS; i++)
173 + usb_free_coherent(dev->udev,
174 + sizeof(struct gs_host_frame),
175 + dev->rxbuf[i],
176 + dev->rxbuf_dma[i]);
177 + }
178
179 /* Stop sending URBs */
180 usb_kill_anchored_urbs(&dev->tx_submitted);
181 diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
182 index 4b7a9672d92b7..d8253c6ac2b08 100644
183 --- a/drivers/net/usb/usbnet.c
184 +++ b/drivers/net/usb/usbnet.c
185 @@ -2085,7 +2085,7 @@ static void usbnet_async_cmd_cb(struct urb *urb)
186 int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
187 u16 value, u16 index, const void *data, u16 size)
188 {
189 - struct usb_ctrlrequest *req = NULL;
190 + struct usb_ctrlrequest *req;
191 struct urb *urb;
192 int err = -ENOMEM;
193 void *buf = NULL;
194 @@ -2103,7 +2103,7 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
195 if (!buf) {
196 netdev_err(dev->net, "Error allocating buffer"
197 " in %s!\n", __func__);
198 - goto fail_free;
199 + goto fail_free_urb;
200 }
201 }
202
203 @@ -2127,14 +2127,21 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
204 if (err < 0) {
205 netdev_err(dev->net, "Error submitting the control"
206 " message: status=%d\n", err);
207 - goto fail_free;
208 + goto fail_free_all;
209 }
210 return 0;
211
212 +fail_free_all:
213 + kfree(req);
214 fail_free_buf:
215 kfree(buf);
216 -fail_free:
217 - kfree(req);
218 + /*
219 + * avoid a double free
220 + * needed because the flag can be set only
221 + * after filling the URB
222 + */
223 + urb->transfer_flags = 0;
224 +fail_free_urb:
225 usb_free_urb(urb);
226 fail:
227 return err;
228 diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c
229 index 383977ea3a3ca..0b5aba4bf3380 100644
230 --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c
231 +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c
232 @@ -158,26 +158,26 @@ static const struct sunxi_desc_pin sun8i_a83t_pins[] = {
233 SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 14),
234 SUNXI_FUNCTION(0x0, "gpio_in"),
235 SUNXI_FUNCTION(0x1, "gpio_out"),
236 - SUNXI_FUNCTION(0x2, "nand"), /* DQ6 */
237 + SUNXI_FUNCTION(0x2, "nand0"), /* DQ6 */
238 SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */
239 SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 15),
240 SUNXI_FUNCTION(0x0, "gpio_in"),
241 SUNXI_FUNCTION(0x1, "gpio_out"),
242 - SUNXI_FUNCTION(0x2, "nand"), /* DQ7 */
243 + SUNXI_FUNCTION(0x2, "nand0"), /* DQ7 */
244 SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */
245 SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 16),
246 SUNXI_FUNCTION(0x0, "gpio_in"),
247 SUNXI_FUNCTION(0x1, "gpio_out"),
248 - SUNXI_FUNCTION(0x2, "nand"), /* DQS */
249 + SUNXI_FUNCTION(0x2, "nand0"), /* DQS */
250 SUNXI_FUNCTION(0x3, "mmc2")), /* RST */
251 SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 17),
252 SUNXI_FUNCTION(0x0, "gpio_in"),
253 SUNXI_FUNCTION(0x1, "gpio_out"),
254 - SUNXI_FUNCTION(0x2, "nand")), /* CE2 */
255 + SUNXI_FUNCTION(0x2, "nand0")), /* CE2 */
256 SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 18),
257 SUNXI_FUNCTION(0x0, "gpio_in"),
258 SUNXI_FUNCTION(0x1, "gpio_out"),
259 - SUNXI_FUNCTION(0x2, "nand")), /* CE3 */
260 + SUNXI_FUNCTION(0x2, "nand0")), /* CE3 */
261 /* Hole */
262 SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2),
263 SUNXI_FUNCTION(0x0, "gpio_in"),
264 diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
265 index c5f2f1e3cc4bd..48d62da622260 100644
266 --- a/fs/xfs/xfs_inode.c
267 +++ b/fs/xfs/xfs_inode.c
268 @@ -2973,7 +2973,6 @@ xfs_rename(
269 * appropriately.
270 */
271 if (flags & RENAME_WHITEOUT) {
272 - ASSERT(!(flags & (RENAME_NOREPLACE | RENAME_EXCHANGE)));
273 error = xfs_rename_alloc_whiteout(target_dp, &wip);
274 if (error)
275 return error;
276 diff --git a/include/video/of_display_timing.h b/include/video/of_display_timing.h
277 index ea755b5616d80..cb3f3b2e7ccfa 100644
278 --- a/include/video/of_display_timing.h
279 +++ b/include/video/of_display_timing.h
280 @@ -9,6 +9,8 @@
281 #ifndef __LINUX_OF_DISPLAY_TIMING_H
282 #define __LINUX_OF_DISPLAY_TIMING_H
283
284 +#include <linux/errno.h>
285 +
286 struct device_node;
287 struct display_timing;
288 struct display_timings;
289 diff --git a/lib/idr.c b/lib/idr.c
290 index 6098336df2672..c657e35433e6e 100644
291 --- a/lib/idr.c
292 +++ b/lib/idr.c
293 @@ -1124,7 +1124,9 @@ void ida_simple_remove(struct ida *ida, unsigned int id)
294 {
295 unsigned long flags;
296
297 - BUG_ON((int)id < 0);
298 + if ((int)id < 0)
299 + return;
300 +
301 spin_lock_irqsave(&simple_ida_lock, flags);
302 ida_remove(ida, id);
303 spin_unlock_irqrestore(&simple_ida_lock, flags);
304 diff --git a/mm/slub.c b/mm/slub.c
305 index 0b13135fd5719..c07c5fa6adcd1 100644
306 --- a/mm/slub.c
307 +++ b/mm/slub.c
308 @@ -2556,6 +2556,7 @@ redo:
309 deactivate_slab(s, page, c->freelist);
310 c->page = NULL;
311 c->freelist = NULL;
312 + c->tid = next_tid(c->tid);
313 goto new_slab;
314 }
315 }
316 @@ -2569,6 +2570,7 @@ redo:
317 deactivate_slab(s, page, c->freelist);
318 c->page = NULL;
319 c->freelist = NULL;
320 + c->tid = next_tid(c->tid);
321 goto new_slab;
322 }
323
324 @@ -2581,6 +2583,7 @@ redo:
325
326 if (!freelist) {
327 c->page = NULL;
328 + c->tid = next_tid(c->tid);
329 stat(s, DEACTIVATE_BYPASS);
330 goto new_slab;
331 }
332 @@ -2605,6 +2608,7 @@ new_slab:
333 c->partial = page->next;
334 stat(s, CPU_PARTIAL_ALLOC);
335 c->freelist = NULL;
336 + c->tid = next_tid(c->tid);
337 goto redo;
338 }
339
340 @@ -2627,6 +2631,7 @@ new_slab:
341 deactivate_slab(s, page, get_freepointer(s, freelist));
342 c->page = NULL;
343 c->freelist = NULL;
344 + c->tid = next_tid(c->tid);
345 return freelist;
346 }
347
348 diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
349 index 9f704a7f2a282..34e7e2ab78fe5 100644
350 --- a/net/rose/rose_route.c
351 +++ b/net/rose/rose_route.c
352 @@ -230,8 +230,8 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh)
353 {
354 struct rose_neigh *s;
355
356 - rose_stop_ftimer(rose_neigh);
357 - rose_stop_t0timer(rose_neigh);
358 + del_timer_sync(&rose_neigh->ftimer);
359 + del_timer_sync(&rose_neigh->t0timer);
360
361 skb_queue_purge(&rose_neigh->queue);
362