Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0257-5.4.158-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3637 - (show annotations) (download)
Mon Oct 24 12:40:44 2022 UTC (20 months ago) by niro
File size: 11477 byte(s)
-add missing
1 diff --git a/Makefile b/Makefile
2 index 49d639fe5a801..cef1d2704c410 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 = 157
10 +SUBLEVEL = 158
11 EXTRAVERSION =
12 NAME = Kleptomaniac Octopus
13
14 diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
15 index af58768a03937..702284bcd467c 100644
16 --- a/drivers/amba/bus.c
17 +++ b/drivers/amba/bus.c
18 @@ -375,9 +375,6 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent)
19 void __iomem *tmp;
20 int i, ret;
21
22 - WARN_ON(dev->irq[0] == (unsigned int)-1);
23 - WARN_ON(dev->irq[1] == (unsigned int)-1);
24 -
25 ret = request_resource(parent, &dev->res);
26 if (ret)
27 goto err_out;
28 diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
29 index a7b88ca8b97b3..fe81c565e7ef8 100644
30 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
31 +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
32 @@ -463,7 +463,6 @@ static void ttm_transfered_destroy(struct ttm_buffer_object *bo)
33 struct ttm_transfer_obj *fbo;
34
35 fbo = container_of(bo, struct ttm_transfer_obj, base);
36 - dma_resv_fini(&fbo->base.base._resv);
37 ttm_bo_put(fbo->bo);
38 kfree(fbo);
39 }
40 diff --git a/drivers/media/firewire/firedtv-avc.c b/drivers/media/firewire/firedtv-avc.c
41 index 2bf9467b917d1..71991f8638e6b 100644
42 --- a/drivers/media/firewire/firedtv-avc.c
43 +++ b/drivers/media/firewire/firedtv-avc.c
44 @@ -1165,7 +1165,11 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
45 read_pos += program_info_length;
46 write_pos += program_info_length;
47 }
48 - while (read_pos < length) {
49 + while (read_pos + 4 < length) {
50 + if (write_pos + 4 >= sizeof(c->operand) - 4) {
51 + ret = -EINVAL;
52 + goto out;
53 + }
54 c->operand[write_pos++] = msg[read_pos++];
55 c->operand[write_pos++] = msg[read_pos++];
56 c->operand[write_pos++] = msg[read_pos++];
57 @@ -1177,13 +1181,17 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
58 c->operand[write_pos++] = es_info_length >> 8;
59 c->operand[write_pos++] = es_info_length & 0xff;
60 if (es_info_length > 0) {
61 + if (read_pos >= length) {
62 + ret = -EINVAL;
63 + goto out;
64 + }
65 pmt_cmd_id = msg[read_pos++];
66 if (pmt_cmd_id != 1 && pmt_cmd_id != 4)
67 dev_err(fdtv->device, "invalid pmt_cmd_id %d at stream level\n",
68 pmt_cmd_id);
69
70 - if (es_info_length > sizeof(c->operand) - 4 -
71 - write_pos) {
72 + if (es_info_length > sizeof(c->operand) - 4 - write_pos ||
73 + es_info_length > length - read_pos) {
74 ret = -EINVAL;
75 goto out;
76 }
77 diff --git a/drivers/media/firewire/firedtv-ci.c b/drivers/media/firewire/firedtv-ci.c
78 index 9363d005e2b61..e0d57e09dab0c 100644
79 --- a/drivers/media/firewire/firedtv-ci.c
80 +++ b/drivers/media/firewire/firedtv-ci.c
81 @@ -134,6 +134,8 @@ static int fdtv_ca_pmt(struct firedtv *fdtv, void *arg)
82 } else {
83 data_length = msg->msg[3];
84 }
85 + if (data_length > sizeof(msg->msg) - data_pos)
86 + return -EINVAL;
87
88 return avc_ca_pmt(fdtv, &msg->msg[data_pos], data_length);
89 }
90 diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
91 index a109120da0e7c..22beeb5be9c41 100644
92 --- a/drivers/net/ethernet/microchip/lan743x_main.c
93 +++ b/drivers/net/ethernet/microchip/lan743x_main.c
94 @@ -1898,13 +1898,13 @@ static int lan743x_rx_next_index(struct lan743x_rx *rx, int index)
95 return ((++index) % rx->ring_size);
96 }
97
98 -static struct sk_buff *lan743x_rx_allocate_skb(struct lan743x_rx *rx)
99 +static struct sk_buff *lan743x_rx_allocate_skb(struct lan743x_rx *rx, gfp_t gfp)
100 {
101 int length = 0;
102
103 length = (LAN743X_MAX_FRAME_SIZE + ETH_HLEN + 4 + RX_HEAD_PADDING);
104 return __netdev_alloc_skb(rx->adapter->netdev,
105 - length, GFP_ATOMIC | GFP_DMA);
106 + length, gfp);
107 }
108
109 static void lan743x_rx_update_tail(struct lan743x_rx *rx, int index)
110 @@ -2077,7 +2077,8 @@ static int lan743x_rx_process_packet(struct lan743x_rx *rx)
111 struct sk_buff *new_skb = NULL;
112 int packet_length;
113
114 - new_skb = lan743x_rx_allocate_skb(rx);
115 + new_skb = lan743x_rx_allocate_skb(rx,
116 + GFP_ATOMIC | GFP_DMA);
117 if (!new_skb) {
118 /* failed to allocate next skb.
119 * Memory is very low.
120 @@ -2314,7 +2315,8 @@ static int lan743x_rx_ring_init(struct lan743x_rx *rx)
121
122 rx->last_head = 0;
123 for (index = 0; index < rx->ring_size; index++) {
124 - struct sk_buff *new_skb = lan743x_rx_allocate_skb(rx);
125 + struct sk_buff *new_skb = lan743x_rx_allocate_skb(rx,
126 + GFP_KERNEL);
127
128 ret = lan743x_rx_init_ring_element(rx, index, new_skb);
129 if (ret)
130 diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c
131 index 86b965875540d..d53e945dd08fc 100644
132 --- a/drivers/net/ethernet/sfc/ethtool.c
133 +++ b/drivers/net/ethernet/sfc/ethtool.c
134 @@ -128,20 +128,14 @@ efx_ethtool_get_link_ksettings(struct net_device *net_dev,
135 {
136 struct efx_nic *efx = netdev_priv(net_dev);
137 struct efx_link_state *link_state = &efx->link_state;
138 - u32 supported;
139
140 mutex_lock(&efx->mac_lock);
141 efx->phy_op->get_link_ksettings(efx, cmd);
142 mutex_unlock(&efx->mac_lock);
143
144 /* Both MACs support pause frames (bidirectional and respond-only) */
145 - ethtool_convert_link_mode_to_legacy_u32(&supported,
146 - cmd->link_modes.supported);
147 -
148 - supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
149 -
150 - ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
151 - supported);
152 + ethtool_link_ksettings_add_link_mode(cmd, supported, Pause);
153 + ethtool_link_ksettings_add_link_mode(cmd, supported, Asym_Pause);
154
155 if (LOOPBACK_INTERNAL(efx)) {
156 cmd->base.speed = link_state->speed;
157 diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
158 index 9b626c169554f..f08ed52d51f3f 100644
159 --- a/drivers/net/vrf.c
160 +++ b/drivers/net/vrf.c
161 @@ -1036,8 +1036,6 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,
162 bool need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr);
163 bool is_ndisc = ipv6_ndisc_frame(skb);
164
165 - nf_reset_ct(skb);
166 -
167 /* loopback, multicast & non-ND link-local traffic; do not push through
168 * packet taps again. Reset pkt_type for upper layers to process skb.
169 * For strict packets with a source LLA, determine the dst using the
170 @@ -1094,8 +1092,6 @@ static struct sk_buff *vrf_ip_rcv(struct net_device *vrf_dev,
171 skb->skb_iif = vrf_dev->ifindex;
172 IPCB(skb)->flags |= IPSKB_L3SLAVE;
173
174 - nf_reset_ct(skb);
175 -
176 if (ipv4_is_multicast(ip_hdr(skb)->daddr))
177 goto out;
178
179 diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
180 index 1f5b5c8a7f726..1ce3f90f782fd 100644
181 --- a/drivers/scsi/scsi.c
182 +++ b/drivers/scsi/scsi.c
183 @@ -555,8 +555,10 @@ EXPORT_SYMBOL(scsi_device_get);
184 */
185 void scsi_device_put(struct scsi_device *sdev)
186 {
187 - module_put(sdev->host->hostt->module);
188 + struct module *mod = sdev->host->hostt->module;
189 +
190 put_device(&sdev->sdev_gendev);
191 + module_put(mod);
192 }
193 EXPORT_SYMBOL(scsi_device_put);
194
195 diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
196 index 6aeb79e744e0b..12064ce76777d 100644
197 --- a/drivers/scsi/scsi_sysfs.c
198 +++ b/drivers/scsi/scsi_sysfs.c
199 @@ -438,9 +438,12 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
200 struct list_head *this, *tmp;
201 struct scsi_vpd *vpd_pg80 = NULL, *vpd_pg83 = NULL;
202 unsigned long flags;
203 + struct module *mod;
204
205 sdev = container_of(work, struct scsi_device, ew.work);
206
207 + mod = sdev->host->hostt->module;
208 +
209 scsi_dh_release_device(sdev);
210
211 parent = sdev->sdev_gendev.parent;
212 @@ -481,11 +484,17 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
213
214 if (parent)
215 put_device(parent);
216 + module_put(mod);
217 }
218
219 static void scsi_device_dev_release(struct device *dev)
220 {
221 struct scsi_device *sdp = to_scsi_device(dev);
222 +
223 + /* Set module pointer as NULL in case of module unloading */
224 + if (!try_module_get(sdp->host->hostt->module))
225 + sdp->host->hostt->module = NULL;
226 +
227 execute_in_process_context(scsi_device_dev_release_usercontext,
228 &sdp->ew);
229 }
230 diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
231 index 48ff9c66ae46d..d0f45600b6698 100644
232 --- a/drivers/usb/core/hcd.c
233 +++ b/drivers/usb/core/hcd.c
234 @@ -2636,7 +2636,6 @@ int usb_add_hcd(struct usb_hcd *hcd,
235 {
236 int retval;
237 struct usb_device *rhdev;
238 - struct usb_hcd *shared_hcd;
239
240 if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) {
241 hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev);
242 @@ -2793,26 +2792,13 @@ int usb_add_hcd(struct usb_hcd *hcd,
243 goto err_hcd_driver_start;
244 }
245
246 - /* starting here, usbcore will pay attention to the shared HCD roothub */
247 - shared_hcd = hcd->shared_hcd;
248 - if (!usb_hcd_is_primary_hcd(hcd) && shared_hcd && HCD_DEFER_RH_REGISTER(shared_hcd)) {
249 - retval = register_root_hub(shared_hcd);
250 - if (retval != 0)
251 - goto err_register_root_hub;
252 -
253 - if (shared_hcd->uses_new_polling && HCD_POLL_RH(shared_hcd))
254 - usb_hcd_poll_rh_status(shared_hcd);
255 - }
256 -
257 /* starting here, usbcore will pay attention to this root hub */
258 - if (!HCD_DEFER_RH_REGISTER(hcd)) {
259 - retval = register_root_hub(hcd);
260 - if (retval != 0)
261 - goto err_register_root_hub;
262 + retval = register_root_hub(hcd);
263 + if (retval != 0)
264 + goto err_register_root_hub;
265
266 - if (hcd->uses_new_polling && HCD_POLL_RH(hcd))
267 - usb_hcd_poll_rh_status(hcd);
268 - }
269 + if (hcd->uses_new_polling && HCD_POLL_RH(hcd))
270 + usb_hcd_poll_rh_status(hcd);
271
272 return retval;
273
274 @@ -2855,7 +2841,6 @@ EXPORT_SYMBOL_GPL(usb_add_hcd);
275 void usb_remove_hcd(struct usb_hcd *hcd)
276 {
277 struct usb_device *rhdev = hcd->self.root_hub;
278 - bool rh_registered;
279
280 dev_info(hcd->self.controller, "remove, state %x\n", hcd->state);
281
282 @@ -2866,7 +2851,6 @@ void usb_remove_hcd(struct usb_hcd *hcd)
283
284 dev_dbg(hcd->self.controller, "roothub graceful disconnect\n");
285 spin_lock_irq (&hcd_root_hub_lock);
286 - rh_registered = hcd->rh_registered;
287 hcd->rh_registered = 0;
288 spin_unlock_irq (&hcd_root_hub_lock);
289
290 @@ -2876,8 +2860,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
291 cancel_work_sync(&hcd->died_work);
292
293 mutex_lock(&usb_bus_idr_lock);
294 - if (rh_registered)
295 - usb_disconnect(&rhdev); /* Sets rhdev to NULL */
296 + usb_disconnect(&rhdev); /* Sets rhdev to NULL */
297 mutex_unlock(&usb_bus_idr_lock);
298
299 /*
300 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
301 index 4ef7484dff8b2..4bb850370bb6b 100644
302 --- a/drivers/usb/host/xhci.c
303 +++ b/drivers/usb/host/xhci.c
304 @@ -693,7 +693,6 @@ int xhci_run(struct usb_hcd *hcd)
305 if (ret)
306 xhci_free_command(xhci, command);
307 }
308 - set_bit(HCD_FLAG_DEFER_RH_REGISTER, &hcd->flags);
309 xhci_dbg_trace(xhci, trace_xhci_dbg_init,
310 "Finished xhci_run for USB2 roothub");
311
312 diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
313 index c0eb85b2981e0..712b2a603645f 100644
314 --- a/include/linux/usb/hcd.h
315 +++ b/include/linux/usb/hcd.h
316 @@ -124,7 +124,6 @@ struct usb_hcd {
317 #define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */
318 #define HCD_FLAG_DEAD 6 /* controller has died? */
319 #define HCD_FLAG_INTF_AUTHORIZED 7 /* authorize interfaces? */
320 -#define HCD_FLAG_DEFER_RH_REGISTER 8 /* Defer roothub registration */
321
322 /* The flags can be tested using these macros; they are likely to
323 * be slightly faster than test_bit().
324 @@ -135,7 +134,6 @@ struct usb_hcd {
325 #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
326 #define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING))
327 #define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD))
328 -#define HCD_DEFER_RH_REGISTER(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEFER_RH_REGISTER))
329
330 /*
331 * Specifies if interfaces are authorized by default