Annotation of /trunk/kernel-alx-legacy/patches-4.9/0350-4.9.251-all-fixes.patch
Parent Directory | Revision Log
Revision 3652 -
(hide annotations)
(download)
Mon Oct 24 14:07:31 2022 UTC (18 months, 2 weeks ago) by niro
File size: 38933 byte(s)
Mon Oct 24 14:07:31 2022 UTC (18 months, 2 weeks ago) by niro
File size: 38933 byte(s)
-linux-4.9.251
1 | niro | 3652 | diff --git a/Makefile b/Makefile |
2 | index 525d7ec7249d6..8ebbb60f2078a 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,6 +1,6 @@ | ||
6 | VERSION = 4 | ||
7 | PATCHLEVEL = 9 | ||
8 | -SUBLEVEL = 250 | ||
9 | +SUBLEVEL = 251 | ||
10 | EXTRAVERSION = | ||
11 | NAME = Roaring Lionus | ||
12 | |||
13 | @@ -349,7 +349,7 @@ OBJDUMP = $(CROSS_COMPILE)objdump | ||
14 | AWK = awk | ||
15 | GENKSYMS = scripts/genksyms/genksyms | ||
16 | INSTALLKERNEL := installkernel | ||
17 | -DEPMOD = /sbin/depmod | ||
18 | +DEPMOD = depmod | ||
19 | PERL = perl | ||
20 | PYTHON = python | ||
21 | CHECK = sparse | ||
22 | diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c | ||
23 | index e12ee86906c62..9436f34520491 100644 | ||
24 | --- a/arch/x86/kernel/cpu/mtrr/generic.c | ||
25 | +++ b/arch/x86/kernel/cpu/mtrr/generic.c | ||
26 | @@ -166,9 +166,6 @@ static u8 mtrr_type_lookup_variable(u64 start, u64 end, u64 *partial_end, | ||
27 | *repeat = 0; | ||
28 | *uniform = 1; | ||
29 | |||
30 | - /* Make end inclusive instead of exclusive */ | ||
31 | - end--; | ||
32 | - | ||
33 | prev_match = MTRR_TYPE_INVALID; | ||
34 | for (i = 0; i < num_var_ranges; ++i) { | ||
35 | unsigned short start_state, end_state, inclusive; | ||
36 | @@ -260,6 +257,9 @@ u8 mtrr_type_lookup(u64 start, u64 end, u8 *uniform) | ||
37 | int repeat; | ||
38 | u64 partial_end; | ||
39 | |||
40 | + /* Make end inclusive instead of exclusive */ | ||
41 | + end--; | ||
42 | + | ||
43 | if (!mtrr_state_set) | ||
44 | return MTRR_TYPE_INVALID; | ||
45 | |||
46 | diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c | ||
47 | index 08e0380414a9b..b68b102f67747 100644 | ||
48 | --- a/arch/x86/mm/pgtable.c | ||
49 | +++ b/arch/x86/mm/pgtable.c | ||
50 | @@ -697,6 +697,8 @@ int pud_free_pmd_page(pud_t *pud, unsigned long addr) | ||
51 | } | ||
52 | |||
53 | free_page((unsigned long)pmd_sv); | ||
54 | + | ||
55 | + pgtable_pmd_page_dtor(virt_to_page(pmd)); | ||
56 | free_page((unsigned long)pmd); | ||
57 | |||
58 | return 1; | ||
59 | diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c | ||
60 | index 074616b39f4d5..89adb49e435ef 100644 | ||
61 | --- a/drivers/atm/idt77252.c | ||
62 | +++ b/drivers/atm/idt77252.c | ||
63 | @@ -3615,7 +3615,7 @@ static int idt77252_init_one(struct pci_dev *pcidev, | ||
64 | |||
65 | if ((err = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32)))) { | ||
66 | printk("idt77252: can't enable DMA for PCI device at %s\n", pci_name(pcidev)); | ||
67 | - return err; | ||
68 | + goto err_out_disable_pdev; | ||
69 | } | ||
70 | |||
71 | card = kzalloc(sizeof(struct idt77252_dev), GFP_KERNEL); | ||
72 | diff --git a/drivers/base/core.c b/drivers/base/core.c | ||
73 | index ec5cc5d98a3e7..3b8487e28c84f 100644 | ||
74 | --- a/drivers/base/core.c | ||
75 | +++ b/drivers/base/core.c | ||
76 | @@ -2364,7 +2364,7 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode) | ||
77 | if (fwnode_is_primary(fn)) { | ||
78 | dev->fwnode = fn->secondary; | ||
79 | if (!(parent && fn == parent->fwnode)) | ||
80 | - fn->secondary = ERR_PTR(-ENODEV); | ||
81 | + fn->secondary = NULL; | ||
82 | } else { | ||
83 | dev->fwnode = NULL; | ||
84 | } | ||
85 | diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c | ||
86 | index e31199f3048ca..0d3b159f4c562 100644 | ||
87 | --- a/drivers/net/ethernet/ethoc.c | ||
88 | +++ b/drivers/net/ethernet/ethoc.c | ||
89 | @@ -1190,7 +1190,7 @@ static int ethoc_probe(struct platform_device *pdev) | ||
90 | ret = mdiobus_register(priv->mdio); | ||
91 | if (ret) { | ||
92 | dev_err(&netdev->dev, "failed to register MDIO bus\n"); | ||
93 | - goto free2; | ||
94 | + goto free3; | ||
95 | } | ||
96 | |||
97 | ret = ethoc_mdio_probe(netdev); | ||
98 | @@ -1222,6 +1222,7 @@ error2: | ||
99 | netif_napi_del(&priv->napi); | ||
100 | error: | ||
101 | mdiobus_unregister(priv->mdio); | ||
102 | +free3: | ||
103 | mdiobus_free(priv->mdio); | ||
104 | free2: | ||
105 | if (priv->clk) | ||
106 | diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c | ||
107 | index af922bac19ae7..cdef919d5b75c 100644 | ||
108 | --- a/drivers/net/ethernet/freescale/ucc_geth.c | ||
109 | +++ b/drivers/net/ethernet/freescale/ucc_geth.c | ||
110 | @@ -3939,12 +3939,12 @@ static int ucc_geth_remove(struct platform_device* ofdev) | ||
111 | struct device_node *np = ofdev->dev.of_node; | ||
112 | |||
113 | unregister_netdev(dev); | ||
114 | - free_netdev(dev); | ||
115 | ucc_geth_memclean(ugeth); | ||
116 | if (of_phy_is_fixed_link(np)) | ||
117 | of_phy_deregister_fixed_link(np); | ||
118 | of_node_put(ugeth->ug_info->tbi_node); | ||
119 | of_node_put(ugeth->ug_info->phy_node); | ||
120 | + free_netdev(dev); | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | ||
125 | index f38848c4f69da..62143ccfd5fb3 100644 | ||
126 | --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | ||
127 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | ||
128 | @@ -447,6 +447,10 @@ static void __lb_other_process(struct hns_nic_ring_data *ring_data, | ||
129 | /* for mutl buffer*/ | ||
130 | new_skb = skb_copy(skb, GFP_ATOMIC); | ||
131 | dev_kfree_skb_any(skb); | ||
132 | + if (!new_skb) { | ||
133 | + netdev_err(ndev, "skb alloc failed\n"); | ||
134 | + return; | ||
135 | + } | ||
136 | skb = new_skb; | ||
137 | |||
138 | check_ok = 0; | ||
139 | diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c | ||
140 | index be4e56826daf6..99ca9526dd65a 100644 | ||
141 | --- a/drivers/net/usb/cdc_ncm.c | ||
142 | +++ b/drivers/net/usb/cdc_ncm.c | ||
143 | @@ -1602,9 +1602,6 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb) | ||
144 | * USB_CDC_NOTIFY_NETWORK_CONNECTION notification shall be | ||
145 | * sent by device after USB_CDC_NOTIFY_SPEED_CHANGE. | ||
146 | */ | ||
147 | - netif_info(dev, link, dev->net, | ||
148 | - "network connection: %sconnected\n", | ||
149 | - !!event->wValue ? "" : "dis"); | ||
150 | usbnet_link_change(dev, !!event->wValue, 0); | ||
151 | break; | ||
152 | |||
153 | diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c | ||
154 | index 7118b82637605..a3447f8eaf66b 100644 | ||
155 | --- a/drivers/net/virtio_net.c | ||
156 | +++ b/drivers/net/virtio_net.c | ||
157 | @@ -1357,14 +1357,16 @@ static int virtnet_set_channels(struct net_device *dev, | ||
158 | |||
159 | get_online_cpus(); | ||
160 | err = virtnet_set_queues(vi, queue_pairs); | ||
161 | - if (!err) { | ||
162 | - netif_set_real_num_tx_queues(dev, queue_pairs); | ||
163 | - netif_set_real_num_rx_queues(dev, queue_pairs); | ||
164 | - | ||
165 | - virtnet_set_affinity(vi); | ||
166 | + if (err) { | ||
167 | + put_online_cpus(); | ||
168 | + goto err; | ||
169 | } | ||
170 | + virtnet_set_affinity(vi); | ||
171 | put_online_cpus(); | ||
172 | |||
173 | + netif_set_real_num_tx_queues(dev, queue_pairs); | ||
174 | + netif_set_real_num_rx_queues(dev, queue_pairs); | ||
175 | +err: | ||
176 | return err; | ||
177 | } | ||
178 | |||
179 | diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c | ||
180 | index 35589ee0cde11..fe543099768c0 100644 | ||
181 | --- a/drivers/net/wan/hdlc_ppp.c | ||
182 | +++ b/drivers/net/wan/hdlc_ppp.c | ||
183 | @@ -572,6 +572,13 @@ static void ppp_timer(unsigned long arg) | ||
184 | unsigned long flags; | ||
185 | |||
186 | spin_lock_irqsave(&ppp->lock, flags); | ||
187 | + /* mod_timer could be called after we entered this function but | ||
188 | + * before we got the lock. | ||
189 | + */ | ||
190 | + if (timer_pending(&proto->timer)) { | ||
191 | + spin_unlock_irqrestore(&ppp->lock, flags); | ||
192 | + return; | ||
193 | + } | ||
194 | switch (proto->state) { | ||
195 | case STOPPING: | ||
196 | case REQ_SENT: | ||
197 | diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c | ||
198 | index 7ea84e6c85bb8..553bdd0983f7e 100644 | ||
199 | --- a/drivers/usb/chipidea/ci_hdrc_imx.c | ||
200 | +++ b/drivers/usb/chipidea/ci_hdrc_imx.c | ||
201 | @@ -133,9 +133,13 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) | ||
202 | misc_pdev = of_find_device_by_node(args.np); | ||
203 | of_node_put(args.np); | ||
204 | |||
205 | - if (!misc_pdev || !platform_get_drvdata(misc_pdev)) | ||
206 | + if (!misc_pdev) | ||
207 | return ERR_PTR(-EPROBE_DEFER); | ||
208 | |||
209 | + if (!platform_get_drvdata(misc_pdev)) { | ||
210 | + put_device(&misc_pdev->dev); | ||
211 | + return ERR_PTR(-EPROBE_DEFER); | ||
212 | + } | ||
213 | data->dev = &misc_pdev->dev; | ||
214 | |||
215 | if (of_find_property(np, "disable-over-current", NULL)) | ||
216 | diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c | ||
217 | index 90f4a5c8012ca..a251514a0ee95 100644 | ||
218 | --- a/drivers/usb/class/cdc-acm.c | ||
219 | +++ b/drivers/usb/class/cdc-acm.c | ||
220 | @@ -1849,6 +1849,10 @@ static const struct usb_device_id acm_ids[] = { | ||
221 | { USB_DEVICE(0x04d8, 0x0083), /* Bootloader mode */ | ||
222 | .driver_info = IGNORE_DEVICE, | ||
223 | }, | ||
224 | + | ||
225 | + { USB_DEVICE(0x04d8, 0xf58b), | ||
226 | + .driver_info = IGNORE_DEVICE, | ||
227 | + }, | ||
228 | #endif | ||
229 | |||
230 | /*Samsung phone in firmware update mode */ | ||
231 | diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c | ||
232 | index 71c2ae4b81067..76701d6ce92c3 100644 | ||
233 | --- a/drivers/usb/class/usblp.c | ||
234 | +++ b/drivers/usb/class/usblp.c | ||
235 | @@ -289,8 +289,25 @@ static int usblp_ctrl_msg(struct usblp *usblp, int request, int type, int dir, i | ||
236 | #define usblp_reset(usblp)\ | ||
237 | usblp_ctrl_msg(usblp, USBLP_REQ_RESET, USB_TYPE_CLASS, USB_DIR_OUT, USB_RECIP_OTHER, 0, NULL, 0) | ||
238 | |||
239 | -#define usblp_hp_channel_change_request(usblp, channel, buffer) \ | ||
240 | - usblp_ctrl_msg(usblp, USBLP_REQ_HP_CHANNEL_CHANGE_REQUEST, USB_TYPE_VENDOR, USB_DIR_IN, USB_RECIP_INTERFACE, channel, buffer, 1) | ||
241 | +static int usblp_hp_channel_change_request(struct usblp *usblp, int channel, u8 *new_channel) | ||
242 | +{ | ||
243 | + u8 *buf; | ||
244 | + int ret; | ||
245 | + | ||
246 | + buf = kzalloc(1, GFP_KERNEL); | ||
247 | + if (!buf) | ||
248 | + return -ENOMEM; | ||
249 | + | ||
250 | + ret = usblp_ctrl_msg(usblp, USBLP_REQ_HP_CHANNEL_CHANGE_REQUEST, | ||
251 | + USB_TYPE_VENDOR, USB_DIR_IN, USB_RECIP_INTERFACE, | ||
252 | + channel, buf, 1); | ||
253 | + if (ret == 0) | ||
254 | + *new_channel = buf[0]; | ||
255 | + | ||
256 | + kfree(buf); | ||
257 | + | ||
258 | + return ret; | ||
259 | +} | ||
260 | |||
261 | /* | ||
262 | * See the description for usblp_select_alts() below for the usage | ||
263 | diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig | ||
264 | index f3ee80ece6828..59dc3054ad6e7 100644 | ||
265 | --- a/drivers/usb/gadget/Kconfig | ||
266 | +++ b/drivers/usb/gadget/Kconfig | ||
267 | @@ -258,6 +258,7 @@ config USB_CONFIGFS_NCM | ||
268 | depends on NET | ||
269 | select USB_U_ETHER | ||
270 | select USB_F_NCM | ||
271 | + select CRC32 | ||
272 | help | ||
273 | NCM is an advanced protocol for Ethernet encapsulation, allows | ||
274 | grouping of several ethernet frames into one USB transfer and | ||
275 | @@ -307,6 +308,7 @@ config USB_CONFIGFS_EEM | ||
276 | depends on NET | ||
277 | select USB_U_ETHER | ||
278 | select USB_F_EEM | ||
279 | + select CRC32 | ||
280 | help | ||
281 | CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM | ||
282 | and therefore can be supported by more hardware. Technically ECM and | ||
283 | diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c | ||
284 | index 5a1723d99fe51..c574bf981140a 100644 | ||
285 | --- a/drivers/usb/gadget/composite.c | ||
286 | +++ b/drivers/usb/gadget/composite.c | ||
287 | @@ -392,8 +392,11 @@ int usb_function_deactivate(struct usb_function *function) | ||
288 | |||
289 | spin_lock_irqsave(&cdev->lock, flags); | ||
290 | |||
291 | - if (cdev->deactivations == 0) | ||
292 | + if (cdev->deactivations == 0) { | ||
293 | + spin_unlock_irqrestore(&cdev->lock, flags); | ||
294 | status = usb_gadget_deactivate(cdev->gadget); | ||
295 | + spin_lock_irqsave(&cdev->lock, flags); | ||
296 | + } | ||
297 | if (status == 0) | ||
298 | cdev->deactivations++; | ||
299 | |||
300 | @@ -424,8 +427,11 @@ int usb_function_activate(struct usb_function *function) | ||
301 | status = -EINVAL; | ||
302 | else { | ||
303 | cdev->deactivations--; | ||
304 | - if (cdev->deactivations == 0) | ||
305 | + if (cdev->deactivations == 0) { | ||
306 | + spin_unlock_irqrestore(&cdev->lock, flags); | ||
307 | status = usb_gadget_activate(cdev->gadget); | ||
308 | + spin_lock_irqsave(&cdev->lock, flags); | ||
309 | + } | ||
310 | } | ||
311 | |||
312 | spin_unlock_irqrestore(&cdev->lock, flags); | ||
313 | diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c | ||
314 | index 6420cae820bc2..0aa1b8fa9b47a 100644 | ||
315 | --- a/drivers/usb/gadget/configfs.c | ||
316 | +++ b/drivers/usb/gadget/configfs.c | ||
317 | @@ -232,9 +232,16 @@ static ssize_t gadget_dev_desc_bcdUSB_store(struct config_item *item, | ||
318 | |||
319 | static ssize_t gadget_dev_desc_UDC_show(struct config_item *item, char *page) | ||
320 | { | ||
321 | - char *udc_name = to_gadget_info(item)->composite.gadget_driver.udc_name; | ||
322 | + struct gadget_info *gi = to_gadget_info(item); | ||
323 | + char *udc_name; | ||
324 | + int ret; | ||
325 | + | ||
326 | + mutex_lock(&gi->lock); | ||
327 | + udc_name = gi->composite.gadget_driver.udc_name; | ||
328 | + ret = sprintf(page, "%s\n", udc_name ?: ""); | ||
329 | + mutex_unlock(&gi->lock); | ||
330 | |||
331 | - return sprintf(page, "%s\n", udc_name ?: ""); | ||
332 | + return ret; | ||
333 | } | ||
334 | |||
335 | static int unregister_gadget(struct gadget_info *gi) | ||
336 | @@ -1214,9 +1221,9 @@ static void purge_configs_funcs(struct gadget_info *gi) | ||
337 | |||
338 | cfg = container_of(c, struct config_usb_cfg, c); | ||
339 | |||
340 | - list_for_each_entry_safe(f, tmp, &c->functions, list) { | ||
341 | + list_for_each_entry_safe_reverse(f, tmp, &c->functions, list) { | ||
342 | |||
343 | - list_move_tail(&f->list, &cfg->func_list); | ||
344 | + list_move(&f->list, &cfg->func_list); | ||
345 | if (f->unbind) { | ||
346 | dev_dbg(&gi->cdev.gadget->dev, | ||
347 | "unbind function '%s'/%p\n", | ||
348 | @@ -1502,7 +1509,7 @@ static const struct usb_gadget_driver configfs_driver_template = { | ||
349 | .suspend = configfs_composite_suspend, | ||
350 | .resume = configfs_composite_resume, | ||
351 | |||
352 | - .max_speed = USB_SPEED_SUPER, | ||
353 | + .max_speed = USB_SPEED_SUPER_PLUS, | ||
354 | .driver = { | ||
355 | .owner = THIS_MODULE, | ||
356 | .name = "configfs-gadget", | ||
357 | @@ -1542,7 +1549,7 @@ static struct config_group *gadgets_make( | ||
358 | gi->composite.unbind = configfs_do_nothing; | ||
359 | gi->composite.suspend = NULL; | ||
360 | gi->composite.resume = NULL; | ||
361 | - gi->composite.max_speed = USB_SPEED_SUPER; | ||
362 | + gi->composite.max_speed = USB_SPEED_SUPER_PLUS; | ||
363 | |||
364 | spin_lock_init(&gi->spinlock); | ||
365 | mutex_init(&gi->lock); | ||
366 | diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c | ||
367 | index d89b3046dd10b..b962f24b500bf 100644 | ||
368 | --- a/drivers/usb/gadget/function/f_printer.c | ||
369 | +++ b/drivers/usb/gadget/function/f_printer.c | ||
370 | @@ -1120,6 +1120,7 @@ fail_tx_reqs: | ||
371 | printer_req_free(dev->in_ep, req); | ||
372 | } | ||
373 | |||
374 | + usb_free_all_descriptors(f); | ||
375 | return ret; | ||
376 | |||
377 | } | ||
378 | diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c | ||
379 | index a631975e050d9..af7fd0185a44e 100644 | ||
380 | --- a/drivers/usb/gadget/function/f_uac2.c | ||
381 | +++ b/drivers/usb/gadget/function/f_uac2.c | ||
382 | @@ -766,7 +766,7 @@ static struct usb_endpoint_descriptor fs_epout_desc = { | ||
383 | |||
384 | .bEndpointAddress = USB_DIR_OUT, | ||
385 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | ||
386 | - .wMaxPacketSize = cpu_to_le16(1023), | ||
387 | + /* .wMaxPacketSize = DYNAMIC */ | ||
388 | .bInterval = 1, | ||
389 | }; | ||
390 | |||
391 | @@ -775,7 +775,7 @@ static struct usb_endpoint_descriptor hs_epout_desc = { | ||
392 | .bDescriptorType = USB_DT_ENDPOINT, | ||
393 | |||
394 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | ||
395 | - .wMaxPacketSize = cpu_to_le16(1024), | ||
396 | + /* .wMaxPacketSize = DYNAMIC */ | ||
397 | .bInterval = 4, | ||
398 | }; | ||
399 | |||
400 | @@ -843,7 +843,7 @@ static struct usb_endpoint_descriptor fs_epin_desc = { | ||
401 | |||
402 | .bEndpointAddress = USB_DIR_IN, | ||
403 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | ||
404 | - .wMaxPacketSize = cpu_to_le16(1023), | ||
405 | + /* .wMaxPacketSize = DYNAMIC */ | ||
406 | .bInterval = 1, | ||
407 | }; | ||
408 | |||
409 | @@ -852,7 +852,7 @@ static struct usb_endpoint_descriptor hs_epin_desc = { | ||
410 | .bDescriptorType = USB_DT_ENDPOINT, | ||
411 | |||
412 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | ||
413 | - .wMaxPacketSize = cpu_to_le16(1024), | ||
414 | + /* .wMaxPacketSize = DYNAMIC */ | ||
415 | .bInterval = 4, | ||
416 | }; | ||
417 | |||
418 | @@ -963,12 +963,28 @@ free_ep(struct uac2_rtd_params *prm, struct usb_ep *ep) | ||
419 | "%s:%d Error!\n", __func__, __LINE__); | ||
420 | } | ||
421 | |||
422 | -static void set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts, | ||
423 | +static int set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts, | ||
424 | struct usb_endpoint_descriptor *ep_desc, | ||
425 | - unsigned int factor, bool is_playback) | ||
426 | + enum usb_device_speed speed, bool is_playback) | ||
427 | { | ||
428 | int chmask, srate, ssize; | ||
429 | - u16 max_packet_size; | ||
430 | + u16 max_size_bw, max_size_ep; | ||
431 | + unsigned int factor; | ||
432 | + | ||
433 | + switch (speed) { | ||
434 | + case USB_SPEED_FULL: | ||
435 | + max_size_ep = 1023; | ||
436 | + factor = 1000; | ||
437 | + break; | ||
438 | + | ||
439 | + case USB_SPEED_HIGH: | ||
440 | + max_size_ep = 1024; | ||
441 | + factor = 8000; | ||
442 | + break; | ||
443 | + | ||
444 | + default: | ||
445 | + return -EINVAL; | ||
446 | + } | ||
447 | |||
448 | if (is_playback) { | ||
449 | chmask = uac2_opts->p_chmask; | ||
450 | @@ -980,10 +996,12 @@ static void set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts, | ||
451 | ssize = uac2_opts->c_ssize; | ||
452 | } | ||
453 | |||
454 | - max_packet_size = num_channels(chmask) * ssize * | ||
455 | + max_size_bw = num_channels(chmask) * ssize * | ||
456 | DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1))); | ||
457 | - ep_desc->wMaxPacketSize = cpu_to_le16(min_t(u16, max_packet_size, | ||
458 | - le16_to_cpu(ep_desc->wMaxPacketSize))); | ||
459 | + ep_desc->wMaxPacketSize = cpu_to_le16(min_t(u16, max_size_bw, | ||
460 | + max_size_ep)); | ||
461 | + | ||
462 | + return 0; | ||
463 | } | ||
464 | |||
465 | static int | ||
466 | @@ -1082,10 +1100,33 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) | ||
467 | uac2->c_prm.uac2 = uac2; | ||
468 | |||
469 | /* Calculate wMaxPacketSize according to audio bandwidth */ | ||
470 | - set_ep_max_packet_size(uac2_opts, &fs_epin_desc, 1000, true); | ||
471 | - set_ep_max_packet_size(uac2_opts, &fs_epout_desc, 1000, false); | ||
472 | - set_ep_max_packet_size(uac2_opts, &hs_epin_desc, 8000, true); | ||
473 | - set_ep_max_packet_size(uac2_opts, &hs_epout_desc, 8000, false); | ||
474 | + ret = set_ep_max_packet_size(uac2_opts, &fs_epin_desc, USB_SPEED_FULL, | ||
475 | + true); | ||
476 | + if (ret < 0) { | ||
477 | + dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); | ||
478 | + return ret; | ||
479 | + } | ||
480 | + | ||
481 | + ret = set_ep_max_packet_size(uac2_opts, &fs_epout_desc, USB_SPEED_FULL, | ||
482 | + false); | ||
483 | + if (ret < 0) { | ||
484 | + dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); | ||
485 | + return ret; | ||
486 | + } | ||
487 | + | ||
488 | + ret = set_ep_max_packet_size(uac2_opts, &hs_epin_desc, USB_SPEED_HIGH, | ||
489 | + true); | ||
490 | + if (ret < 0) { | ||
491 | + dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); | ||
492 | + return ret; | ||
493 | + } | ||
494 | + | ||
495 | + ret = set_ep_max_packet_size(uac2_opts, &hs_epout_desc, USB_SPEED_HIGH, | ||
496 | + false); | ||
497 | + if (ret < 0) { | ||
498 | + dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); | ||
499 | + return ret; | ||
500 | + } | ||
501 | |||
502 | hs_epout_desc.bEndpointAddress = fs_epout_desc.bEndpointAddress; | ||
503 | hs_epin_desc.bEndpointAddress = fs_epin_desc.bEndpointAddress; | ||
504 | diff --git a/drivers/usb/gadget/legacy/acm_ms.c b/drivers/usb/gadget/legacy/acm_ms.c | ||
505 | index c39de65a448ba..270bb88c51cb4 100644 | ||
506 | --- a/drivers/usb/gadget/legacy/acm_ms.c | ||
507 | +++ b/drivers/usb/gadget/legacy/acm_ms.c | ||
508 | @@ -207,8 +207,10 @@ static int acm_ms_bind(struct usb_composite_dev *cdev) | ||
509 | struct usb_descriptor_header *usb_desc; | ||
510 | |||
511 | usb_desc = usb_otg_descriptor_alloc(gadget); | ||
512 | - if (!usb_desc) | ||
513 | + if (!usb_desc) { | ||
514 | + status = -ENOMEM; | ||
515 | goto fail_string_ids; | ||
516 | + } | ||
517 | usb_otg_descriptor_init(gadget, usb_desc); | ||
518 | otg_desc[0] = usb_desc; | ||
519 | otg_desc[1] = NULL; | ||
520 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c | ||
521 | index b27987431079e..b0e1d3da2e7ed 100644 | ||
522 | --- a/drivers/usb/host/xhci.c | ||
523 | +++ b/drivers/usb/host/xhci.c | ||
524 | @@ -4409,19 +4409,19 @@ static u16 xhci_calculate_u1_timeout(struct xhci_hcd *xhci, | ||
525 | { | ||
526 | unsigned long long timeout_ns; | ||
527 | |||
528 | + if (xhci->quirks & XHCI_INTEL_HOST) | ||
529 | + timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); | ||
530 | + else | ||
531 | + timeout_ns = udev->u1_params.sel; | ||
532 | + | ||
533 | /* Prevent U1 if service interval is shorter than U1 exit latency */ | ||
534 | if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { | ||
535 | - if (xhci_service_interval_to_ns(desc) <= udev->u1_params.mel) { | ||
536 | + if (xhci_service_interval_to_ns(desc) <= timeout_ns) { | ||
537 | dev_dbg(&udev->dev, "Disable U1, ESIT shorter than exit latency\n"); | ||
538 | return USB3_LPM_DISABLED; | ||
539 | } | ||
540 | } | ||
541 | |||
542 | - if (xhci->quirks & XHCI_INTEL_HOST) | ||
543 | - timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); | ||
544 | - else | ||
545 | - timeout_ns = udev->u1_params.sel; | ||
546 | - | ||
547 | /* The U1 timeout is encoded in 1us intervals. | ||
548 | * Don't return a timeout of zero, because that's USB3_LPM_DISABLED. | ||
549 | */ | ||
550 | @@ -4473,19 +4473,19 @@ static u16 xhci_calculate_u2_timeout(struct xhci_hcd *xhci, | ||
551 | { | ||
552 | unsigned long long timeout_ns; | ||
553 | |||
554 | + if (xhci->quirks & XHCI_INTEL_HOST) | ||
555 | + timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); | ||
556 | + else | ||
557 | + timeout_ns = udev->u2_params.sel; | ||
558 | + | ||
559 | /* Prevent U2 if service interval is shorter than U2 exit latency */ | ||
560 | if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { | ||
561 | - if (xhci_service_interval_to_ns(desc) <= udev->u2_params.mel) { | ||
562 | + if (xhci_service_interval_to_ns(desc) <= timeout_ns) { | ||
563 | dev_dbg(&udev->dev, "Disable U2, ESIT shorter than exit latency\n"); | ||
564 | return USB3_LPM_DISABLED; | ||
565 | } | ||
566 | } | ||
567 | |||
568 | - if (xhci->quirks & XHCI_INTEL_HOST) | ||
569 | - timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); | ||
570 | - else | ||
571 | - timeout_ns = udev->u2_params.sel; | ||
572 | - | ||
573 | /* The U2 timeout is encoded in 256us intervals */ | ||
574 | timeout_ns = DIV_ROUND_UP_ULL(timeout_ns, 256 * 1000); | ||
575 | /* If the necessary timeout value is bigger than what we can set in the | ||
576 | diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c | ||
577 | index 1be1fa1b73770..16cab1b09ad8e 100644 | ||
578 | --- a/drivers/usb/misc/yurex.c | ||
579 | +++ b/drivers/usb/misc/yurex.c | ||
580 | @@ -507,6 +507,9 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer, | ||
581 | timeout = schedule_timeout(YUREX_WRITE_TIMEOUT); | ||
582 | finish_wait(&dev->waitq, &wait); | ||
583 | |||
584 | + /* make sure URB is idle after timeout or (spurious) CMD_ACK */ | ||
585 | + usb_kill_urb(dev->cntl_urb); | ||
586 | + | ||
587 | mutex_unlock(&dev->io_mutex); | ||
588 | |||
589 | if (retval < 0) { | ||
590 | diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c | ||
591 | index bdeb2b2489549..f3c0ad138c3ed 100644 | ||
592 | --- a/drivers/usb/serial/iuu_phoenix.c | ||
593 | +++ b/drivers/usb/serial/iuu_phoenix.c | ||
594 | @@ -553,23 +553,29 @@ static int iuu_uart_flush(struct usb_serial_port *port) | ||
595 | struct device *dev = &port->dev; | ||
596 | int i; | ||
597 | int status; | ||
598 | - u8 rxcmd = IUU_UART_RX; | ||
599 | + u8 *rxcmd; | ||
600 | struct iuu_private *priv = usb_get_serial_port_data(port); | ||
601 | |||
602 | if (iuu_led(port, 0xF000, 0, 0, 0xFF) < 0) | ||
603 | return -EIO; | ||
604 | |||
605 | + rxcmd = kmalloc(1, GFP_KERNEL); | ||
606 | + if (!rxcmd) | ||
607 | + return -ENOMEM; | ||
608 | + | ||
609 | + rxcmd[0] = IUU_UART_RX; | ||
610 | + | ||
611 | for (i = 0; i < 2; i++) { | ||
612 | - status = bulk_immediate(port, &rxcmd, 1); | ||
613 | + status = bulk_immediate(port, rxcmd, 1); | ||
614 | if (status != IUU_OPERATION_OK) { | ||
615 | dev_dbg(dev, "%s - uart_flush_write error\n", __func__); | ||
616 | - return status; | ||
617 | + goto out_free; | ||
618 | } | ||
619 | |||
620 | status = read_immediate(port, &priv->len, 1); | ||
621 | if (status != IUU_OPERATION_OK) { | ||
622 | dev_dbg(dev, "%s - uart_flush_read error\n", __func__); | ||
623 | - return status; | ||
624 | + goto out_free; | ||
625 | } | ||
626 | |||
627 | if (priv->len > 0) { | ||
628 | @@ -577,12 +583,16 @@ static int iuu_uart_flush(struct usb_serial_port *port) | ||
629 | status = read_immediate(port, priv->buf, priv->len); | ||
630 | if (status != IUU_OPERATION_OK) { | ||
631 | dev_dbg(dev, "%s - uart_flush_read error\n", __func__); | ||
632 | - return status; | ||
633 | + goto out_free; | ||
634 | } | ||
635 | } | ||
636 | } | ||
637 | dev_dbg(dev, "%s - uart_flush_read OK!\n", __func__); | ||
638 | iuu_led(port, 0, 0xF000, 0, 0xFF); | ||
639 | + | ||
640 | +out_free: | ||
641 | + kfree(rxcmd); | ||
642 | + | ||
643 | return status; | ||
644 | } | ||
645 | |||
646 | diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c | ||
647 | index 93a31ea8e210c..1899190d4f5d2 100644 | ||
648 | --- a/drivers/usb/serial/keyspan_pda.c | ||
649 | +++ b/drivers/usb/serial/keyspan_pda.c | ||
650 | @@ -559,10 +559,8 @@ exit: | ||
651 | static void keyspan_pda_write_bulk_callback(struct urb *urb) | ||
652 | { | ||
653 | struct usb_serial_port *port = urb->context; | ||
654 | - struct keyspan_pda_private *priv; | ||
655 | |||
656 | set_bit(0, &port->write_urbs_free); | ||
657 | - priv = usb_get_serial_port_data(port); | ||
658 | |||
659 | /* queue up a wakeup at scheduler time */ | ||
660 | usb_serial_port_softint(port); | ||
661 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c | ||
662 | index 6045a8e24068c..1998b314368e0 100644 | ||
663 | --- a/drivers/usb/serial/option.c | ||
664 | +++ b/drivers/usb/serial/option.c | ||
665 | @@ -2043,6 +2043,7 @@ static const struct usb_device_id option_ids[] = { | ||
666 | { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0105, 0xff), /* Fibocom NL678 series */ | ||
667 | .driver_info = RSVD(6) }, | ||
668 | { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a0, 0xff) }, /* Fibocom NL668-AM/NL652-EU (laptop MBIM) */ | ||
669 | + { USB_DEVICE_INTERFACE_CLASS(0x2df3, 0x9d03, 0xff) }, /* LongSung M5710 */ | ||
670 | { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */ | ||
671 | { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */ | ||
672 | { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) }, /* GosunCn GM500 ECM/NCM */ | ||
673 | diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h | ||
674 | index 018b0663d6109..1bf15f9d4f43e 100644 | ||
675 | --- a/drivers/usb/storage/unusual_uas.h | ||
676 | +++ b/drivers/usb/storage/unusual_uas.h | ||
677 | @@ -163,6 +163,13 @@ UNUSUAL_DEV(0x152d, 0x0578, 0x0000, 0x9999, | ||
678 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
679 | US_FL_BROKEN_FUA), | ||
680 | |||
681 | +/* Reported-by: Thinh Nguyen <thinhn@synopsys.com> */ | ||
682 | +UNUSUAL_DEV(0x154b, 0xf00b, 0x0000, 0x9999, | ||
683 | + "PNY", | ||
684 | + "Pro Elite SSD", | ||
685 | + USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
686 | + US_FL_NO_ATA_1X), | ||
687 | + | ||
688 | /* Reported-by: Thinh Nguyen <thinhn@synopsys.com> */ | ||
689 | UNUSUAL_DEV(0x154b, 0xf00d, 0x0000, 0x9999, | ||
690 | "PNY", | ||
691 | diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c | ||
692 | index 861f43f8f9cea..66663757cd701 100644 | ||
693 | --- a/drivers/vhost/net.c | ||
694 | +++ b/drivers/vhost/net.c | ||
695 | @@ -377,6 +377,7 @@ static void handle_tx(struct vhost_net *net) | ||
696 | size_t hdr_size; | ||
697 | struct socket *sock; | ||
698 | struct vhost_net_ubuf_ref *uninitialized_var(ubufs); | ||
699 | + struct ubuf_info *ubuf; | ||
700 | bool zcopy, zcopy_used; | ||
701 | int sent_pkts = 0; | ||
702 | |||
703 | @@ -444,9 +445,7 @@ static void handle_tx(struct vhost_net *net) | ||
704 | |||
705 | /* use msg_control to pass vhost zerocopy ubuf info to skb */ | ||
706 | if (zcopy_used) { | ||
707 | - struct ubuf_info *ubuf; | ||
708 | ubuf = nvq->ubuf_info + nvq->upend_idx; | ||
709 | - | ||
710 | vq->heads[nvq->upend_idx].id = cpu_to_vhost32(vq, head); | ||
711 | vq->heads[nvq->upend_idx].len = VHOST_DMA_IN_PROGRESS; | ||
712 | ubuf->callback = vhost_zerocopy_callback; | ||
713 | @@ -465,7 +464,8 @@ static void handle_tx(struct vhost_net *net) | ||
714 | err = sock->ops->sendmsg(sock, &msg, len); | ||
715 | if (unlikely(err < 0)) { | ||
716 | if (zcopy_used) { | ||
717 | - vhost_net_ubuf_put(ubufs); | ||
718 | + if (vq->heads[ubuf->desc].len == VHOST_DMA_IN_PROGRESS) | ||
719 | + vhost_net_ubuf_put(ubufs); | ||
720 | nvq->upend_idx = ((unsigned)nvq->upend_idx - 1) | ||
721 | % UIO_MAXIOV; | ||
722 | } | ||
723 | diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c | ||
724 | index f3938c5278832..6e680007cf6b0 100644 | ||
725 | --- a/drivers/video/fbdev/hyperv_fb.c | ||
726 | +++ b/drivers/video/fbdev/hyperv_fb.c | ||
727 | @@ -713,11 +713,9 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) | ||
728 | } | ||
729 | |||
730 | /* | ||
731 | - * Map the VRAM cacheable for performance. This is also required for | ||
732 | - * VM Connect to display properly for ARM64 Linux VM, as the host also | ||
733 | - * maps the VRAM cacheable. | ||
734 | + * Map the VRAM cacheable for performance. | ||
735 | */ | ||
736 | - fb_virt = ioremap_cache(par->mem->start, screen_fb_size); | ||
737 | + fb_virt = ioremap_wc(par->mem->start, screen_fb_size); | ||
738 | if (!fb_virt) | ||
739 | goto err2; | ||
740 | |||
741 | diff --git a/include/net/red.h b/include/net/red.h | ||
742 | index 3618cdfec884e..17821f66de111 100644 | ||
743 | --- a/include/net/red.h | ||
744 | +++ b/include/net/red.h | ||
745 | @@ -167,12 +167,14 @@ static inline void red_set_vars(struct red_vars *v) | ||
746 | v->qcount = -1; | ||
747 | } | ||
748 | |||
749 | -static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog) | ||
750 | +static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog, u8 Scell_log) | ||
751 | { | ||
752 | if (fls(qth_min) + Wlog > 32) | ||
753 | return false; | ||
754 | if (fls(qth_max) + Wlog > 32) | ||
755 | return false; | ||
756 | + if (Scell_log >= 32) | ||
757 | + return false; | ||
758 | if (qth_max < qth_min) | ||
759 | return false; | ||
760 | return true; | ||
761 | diff --git a/kernel/workqueue.c b/kernel/workqueue.c | ||
762 | index 00c295d3104bb..205c3131f8b05 100644 | ||
763 | --- a/kernel/workqueue.c | ||
764 | +++ b/kernel/workqueue.c | ||
765 | @@ -3448,17 +3448,24 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq) | ||
766 | * is updated and visible. | ||
767 | */ | ||
768 | if (!freezable || !workqueue_freezing) { | ||
769 | + bool kick = false; | ||
770 | + | ||
771 | pwq->max_active = wq->saved_max_active; | ||
772 | |||
773 | while (!list_empty(&pwq->delayed_works) && | ||
774 | - pwq->nr_active < pwq->max_active) | ||
775 | + pwq->nr_active < pwq->max_active) { | ||
776 | pwq_activate_first_delayed(pwq); | ||
777 | + kick = true; | ||
778 | + } | ||
779 | |||
780 | /* | ||
781 | * Need to kick a worker after thawed or an unbound wq's | ||
782 | - * max_active is bumped. It's a slow path. Do it always. | ||
783 | + * max_active is bumped. In realtime scenarios, always kicking a | ||
784 | + * worker will cause interference on the isolated cpu cores, so | ||
785 | + * let's kick iff work items were activated. | ||
786 | */ | ||
787 | - wake_up_worker(pwq->pool); | ||
788 | + if (kick) | ||
789 | + wake_up_worker(pwq->pool); | ||
790 | } else { | ||
791 | pwq->max_active = 0; | ||
792 | } | ||
793 | diff --git a/lib/genalloc.c b/lib/genalloc.c | ||
794 | index 7e85d1e37a6ea..0b8ee173cf3a6 100644 | ||
795 | --- a/lib/genalloc.c | ||
796 | +++ b/lib/genalloc.c | ||
797 | @@ -83,14 +83,14 @@ static int clear_bits_ll(unsigned long *addr, unsigned long mask_to_clear) | ||
798 | * users set the same bit, one user will return remain bits, otherwise | ||
799 | * return 0. | ||
800 | */ | ||
801 | -static int bitmap_set_ll(unsigned long *map, int start, int nr) | ||
802 | +static int bitmap_set_ll(unsigned long *map, unsigned long start, unsigned long nr) | ||
803 | { | ||
804 | unsigned long *p = map + BIT_WORD(start); | ||
805 | - const int size = start + nr; | ||
806 | + const unsigned long size = start + nr; | ||
807 | int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG); | ||
808 | unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start); | ||
809 | |||
810 | - while (nr - bits_to_set >= 0) { | ||
811 | + while (nr >= bits_to_set) { | ||
812 | if (set_bits_ll(p, mask_to_set)) | ||
813 | return nr; | ||
814 | nr -= bits_to_set; | ||
815 | @@ -118,14 +118,15 @@ static int bitmap_set_ll(unsigned long *map, int start, int nr) | ||
816 | * users clear the same bit, one user will return remain bits, | ||
817 | * otherwise return 0. | ||
818 | */ | ||
819 | -static int bitmap_clear_ll(unsigned long *map, int start, int nr) | ||
820 | +static unsigned long | ||
821 | +bitmap_clear_ll(unsigned long *map, unsigned long start, unsigned long nr) | ||
822 | { | ||
823 | unsigned long *p = map + BIT_WORD(start); | ||
824 | - const int size = start + nr; | ||
825 | + const unsigned long size = start + nr; | ||
826 | int bits_to_clear = BITS_PER_LONG - (start % BITS_PER_LONG); | ||
827 | unsigned long mask_to_clear = BITMAP_FIRST_WORD_MASK(start); | ||
828 | |||
829 | - while (nr - bits_to_clear >= 0) { | ||
830 | + while (nr >= bits_to_clear) { | ||
831 | if (clear_bits_ll(p, mask_to_clear)) | ||
832 | return nr; | ||
833 | nr -= bits_to_clear; | ||
834 | @@ -184,8 +185,8 @@ int gen_pool_add_virt(struct gen_pool *pool, unsigned long virt, phys_addr_t phy | ||
835 | size_t size, int nid) | ||
836 | { | ||
837 | struct gen_pool_chunk *chunk; | ||
838 | - int nbits = size >> pool->min_alloc_order; | ||
839 | - int nbytes = sizeof(struct gen_pool_chunk) + | ||
840 | + unsigned long nbits = size >> pool->min_alloc_order; | ||
841 | + unsigned long nbytes = sizeof(struct gen_pool_chunk) + | ||
842 | BITS_TO_LONGS(nbits) * sizeof(long); | ||
843 | |||
844 | chunk = vzalloc_node(nbytes, nid); | ||
845 | @@ -242,7 +243,7 @@ void gen_pool_destroy(struct gen_pool *pool) | ||
846 | struct list_head *_chunk, *_next_chunk; | ||
847 | struct gen_pool_chunk *chunk; | ||
848 | int order = pool->min_alloc_order; | ||
849 | - int bit, end_bit; | ||
850 | + unsigned long bit, end_bit; | ||
851 | |||
852 | list_for_each_safe(_chunk, _next_chunk, &pool->chunks) { | ||
853 | chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk); | ||
854 | @@ -293,7 +294,7 @@ unsigned long gen_pool_alloc_algo(struct gen_pool *pool, size_t size, | ||
855 | struct gen_pool_chunk *chunk; | ||
856 | unsigned long addr = 0; | ||
857 | int order = pool->min_alloc_order; | ||
858 | - int nbits, start_bit, end_bit, remain; | ||
859 | + unsigned long nbits, start_bit, end_bit, remain; | ||
860 | |||
861 | #ifndef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
862 | BUG_ON(in_nmi()); | ||
863 | @@ -376,7 +377,7 @@ void gen_pool_free(struct gen_pool *pool, unsigned long addr, size_t size) | ||
864 | { | ||
865 | struct gen_pool_chunk *chunk; | ||
866 | int order = pool->min_alloc_order; | ||
867 | - int start_bit, nbits, remain; | ||
868 | + unsigned long start_bit, nbits, remain; | ||
869 | |||
870 | #ifndef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
871 | BUG_ON(in_nmi()); | ||
872 | @@ -638,7 +639,7 @@ unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size, | ||
873 | index = bitmap_find_next_zero_area(map, size, start, nr, 0); | ||
874 | |||
875 | while (index < size) { | ||
876 | - int next_bit = find_next_bit(map, size, index + nr); | ||
877 | + unsigned long next_bit = find_next_bit(map, size, index + nr); | ||
878 | if ((next_bit - index) < len) { | ||
879 | len = next_bit - index; | ||
880 | start_bit = index; | ||
881 | diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c | ||
882 | index cbe3fdba4a2c8..aa4c045587d10 100644 | ||
883 | --- a/net/ipv4/fib_frontend.c | ||
884 | +++ b/net/ipv4/fib_frontend.c | ||
885 | @@ -292,7 +292,7 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb) | ||
886 | .flowi4_iif = LOOPBACK_IFINDEX, | ||
887 | .flowi4_oif = l3mdev_master_ifindex_rcu(dev), | ||
888 | .daddr = ip_hdr(skb)->saddr, | ||
889 | - .flowi4_tos = RT_TOS(ip_hdr(skb)->tos), | ||
890 | + .flowi4_tos = ip_hdr(skb)->tos & IPTOS_RT_MASK, | ||
891 | .flowi4_scope = scope, | ||
892 | .flowi4_mark = vmark ? skb->mark : 0, | ||
893 | }; | ||
894 | diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c | ||
895 | index 087db775b3dc7..c973d88e9ea72 100644 | ||
896 | --- a/net/ncsi/ncsi-rsp.c | ||
897 | +++ b/net/ncsi/ncsi-rsp.c | ||
898 | @@ -975,7 +975,7 @@ int ncsi_rcv_rsp(struct sk_buff *skb, struct net_device *dev, | ||
899 | int payload, i, ret; | ||
900 | |||
901 | /* Find the NCSI device */ | ||
902 | - nd = ncsi_find_dev(dev); | ||
903 | + nd = ncsi_find_dev(orig_dev); | ||
904 | ndp = nd ? TO_NCSI_DEV_PRIV(nd) : NULL; | ||
905 | if (!ndp) | ||
906 | return -ENODEV; | ||
907 | diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h | ||
908 | index d32fd6b036bfa..a4bd2d3a4821b 100644 | ||
909 | --- a/net/netfilter/ipset/ip_set_hash_gen.h | ||
910 | +++ b/net/netfilter/ipset/ip_set_hash_gen.h | ||
911 | @@ -113,20 +113,6 @@ htable_size(u8 hbits) | ||
912 | return hsize * sizeof(struct hbucket *) + sizeof(struct htable); | ||
913 | } | ||
914 | |||
915 | -/* Compute htable_bits from the user input parameter hashsize */ | ||
916 | -static u8 | ||
917 | -htable_bits(u32 hashsize) | ||
918 | -{ | ||
919 | - /* Assume that hashsize == 2^htable_bits */ | ||
920 | - u8 bits = fls(hashsize - 1); | ||
921 | - | ||
922 | - if (jhash_size(bits) != hashsize) | ||
923 | - /* Round up to the first 2^n value */ | ||
924 | - bits = fls(hashsize); | ||
925 | - | ||
926 | - return bits; | ||
927 | -} | ||
928 | - | ||
929 | #ifdef IP_SET_HASH_WITH_NETS | ||
930 | #if IPSET_NET_COUNT > 1 | ||
931 | #define __CIDR(cidr, i) (cidr[i]) | ||
932 | @@ -1309,7 +1295,11 @@ IPSET_TOKEN(HTYPE, _create)(struct net *net, struct ip_set *set, | ||
933 | get_random_bytes(&h->initval, sizeof(h->initval)); | ||
934 | set->timeout = IPSET_NO_TIMEOUT; | ||
935 | |||
936 | - hbits = htable_bits(hashsize); | ||
937 | + /* Compute htable_bits from the user input parameter hashsize. | ||
938 | + * Assume that hashsize == 2^htable_bits, | ||
939 | + * otherwise round up to the first 2^n value. | ||
940 | + */ | ||
941 | + hbits = fls(hashsize - 1); | ||
942 | hsize = htable_size(hbits); | ||
943 | if (hsize == 0) { | ||
944 | kfree(h); | ||
945 | diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c | ||
946 | index 92cfae66743bc..1076b8a50d008 100644 | ||
947 | --- a/net/netfilter/xt_RATEEST.c | ||
948 | +++ b/net/netfilter/xt_RATEEST.c | ||
949 | @@ -106,6 +106,9 @@ static int xt_rateest_tg_checkentry(const struct xt_tgchk_param *par) | ||
950 | } cfg; | ||
951 | int ret; | ||
952 | |||
953 | + if (strnlen(info->name, sizeof(est->name)) >= sizeof(est->name)) | ||
954 | + return -ENAMETOOLONG; | ||
955 | + | ||
956 | net_get_random_once(&jhash_rnd, sizeof(jhash_rnd)); | ||
957 | |||
958 | mutex_lock(&xt_rateest_mutex); | ||
959 | diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c | ||
960 | index d13e1de0b3a21..2fb79c245f3fc 100644 | ||
961 | --- a/net/sched/sch_choke.c | ||
962 | +++ b/net/sched/sch_choke.c | ||
963 | @@ -425,7 +425,7 @@ static int choke_change(struct Qdisc *sch, struct nlattr *opt) | ||
964 | |||
965 | ctl = nla_data(tb[TCA_CHOKE_PARMS]); | ||
966 | |||
967 | - if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog)) | ||
968 | + if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog, ctl->Scell_log)) | ||
969 | return -EINVAL; | ||
970 | |||
971 | if (ctl->limit > CHOKE_MAX_QUEUE) | ||
972 | diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c | ||
973 | index 729c0e4eca21d..d86a96313981b 100644 | ||
974 | --- a/net/sched/sch_gred.c | ||
975 | +++ b/net/sched/sch_gred.c | ||
976 | @@ -356,7 +356,7 @@ static inline int gred_change_vq(struct Qdisc *sch, int dp, | ||
977 | struct gred_sched *table = qdisc_priv(sch); | ||
978 | struct gred_sched_data *q = table->tab[dp]; | ||
979 | |||
980 | - if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog)) | ||
981 | + if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog, ctl->Scell_log)) | ||
982 | return -EINVAL; | ||
983 | |||
984 | if (!q) { | ||
985 | diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c | ||
986 | index 4610d44f58d3a..797895bddcfda 100644 | ||
987 | --- a/net/sched/sch_red.c | ||
988 | +++ b/net/sched/sch_red.c | ||
989 | @@ -184,7 +184,7 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt) | ||
990 | max_P = tb[TCA_RED_MAX_P] ? nla_get_u32(tb[TCA_RED_MAX_P]) : 0; | ||
991 | |||
992 | ctl = nla_data(tb[TCA_RED_PARMS]); | ||
993 | - if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog)) | ||
994 | + if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog, ctl->Scell_log)) | ||
995 | return -EINVAL; | ||
996 | |||
997 | if (ctl->limit > 0) { | ||
998 | diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c | ||
999 | index 633e237a406ca..69a5fffed86c7 100644 | ||
1000 | --- a/net/sched/sch_sfq.c | ||
1001 | +++ b/net/sched/sch_sfq.c | ||
1002 | @@ -645,7 +645,7 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt) | ||
1003 | } | ||
1004 | |||
1005 | if (ctl_v1 && !red_check_params(ctl_v1->qth_min, ctl_v1->qth_max, | ||
1006 | - ctl_v1->Wlog)) | ||
1007 | + ctl_v1->Wlog, ctl_v1->Scell_log)) | ||
1008 | return -EINVAL; | ||
1009 | if (ctl_v1 && ctl_v1->qth_min) { | ||
1010 | p = kmalloc(sizeof(*p), GFP_KERNEL); | ||
1011 | diff --git a/scripts/depmod.sh b/scripts/depmod.sh | ||
1012 | index baedaef53ca05..b0cb89e73bc56 100755 | ||
1013 | --- a/scripts/depmod.sh | ||
1014 | +++ b/scripts/depmod.sh | ||
1015 | @@ -14,6 +14,8 @@ if ! test -r System.map ; then | ||
1016 | exit 0 | ||
1017 | fi | ||
1018 | |||
1019 | +# legacy behavior: "depmod" in /sbin, no /sbin in PATH | ||
1020 | +PATH="$PATH:/sbin" | ||
1021 | if [ -z $(command -v $DEPMOD) ]; then | ||
1022 | echo "Warning: 'make modules_install' requires $DEPMOD. Please install it." >&2 | ||
1023 | echo "This is probably in the kmod package." >&2 | ||
1024 | diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py | ||
1025 | index f9b92ece78343..6d2e09a2ad2f9 100644 | ||
1026 | --- a/scripts/gdb/linux/dmesg.py | ||
1027 | +++ b/scripts/gdb/linux/dmesg.py | ||
1028 | @@ -12,6 +12,7 @@ | ||
1029 | # | ||
1030 | |||
1031 | import gdb | ||
1032 | +import sys | ||
1033 | |||
1034 | from linux import utils | ||
1035 | |||
1036 | @@ -23,10 +24,11 @@ class LxDmesg(gdb.Command): | ||
1037 | super(LxDmesg, self).__init__("lx-dmesg", gdb.COMMAND_DATA) | ||
1038 | |||
1039 | def invoke(self, arg, from_tty): | ||
1040 | - log_buf_addr = int(str(gdb.parse_and_eval("log_buf")).split()[0], 16) | ||
1041 | - log_first_idx = int(gdb.parse_and_eval("log_first_idx")) | ||
1042 | - log_next_idx = int(gdb.parse_and_eval("log_next_idx")) | ||
1043 | - log_buf_len = int(gdb.parse_and_eval("log_buf_len")) | ||
1044 | + log_buf_addr = int(str(gdb.parse_and_eval( | ||
1045 | + "(void *)'printk.c'::log_buf")).split()[0], 16) | ||
1046 | + log_first_idx = int(gdb.parse_and_eval("'printk.c'::log_first_idx")) | ||
1047 | + log_next_idx = int(gdb.parse_and_eval("'printk.c'::log_next_idx")) | ||
1048 | + log_buf_len = int(gdb.parse_and_eval("'printk.c'::log_buf_len")) | ||
1049 | |||
1050 | inf = gdb.inferiors()[0] | ||
1051 | start = log_buf_addr + log_first_idx | ||
1052 | @@ -51,13 +53,19 @@ class LxDmesg(gdb.Command): | ||
1053 | continue | ||
1054 | |||
1055 | text_len = utils.read_u16(log_buf[pos + 10:pos + 12]) | ||
1056 | - text = log_buf[pos + 16:pos + 16 + text_len].decode() | ||
1057 | + text = log_buf[pos + 16:pos + 16 + text_len].decode( | ||
1058 | + encoding='utf8', errors='replace') | ||
1059 | time_stamp = utils.read_u64(log_buf[pos:pos + 8]) | ||
1060 | |||
1061 | for line in text.splitlines(): | ||
1062 | - gdb.write("[{time:12.6f}] {line}\n".format( | ||
1063 | + msg = u"[{time:12.6f}] {line}\n".format( | ||
1064 | time=time_stamp / 1000000000.0, | ||
1065 | - line=line)) | ||
1066 | + line=line) | ||
1067 | + # With python2 gdb.write will attempt to convert unicode to | ||
1068 | + # ascii and might fail so pass an utf8-encoded str instead. | ||
1069 | + if sys.hexversion < 0x03000000: | ||
1070 | + msg = msg.encode(encoding='utf8', errors='replace') | ||
1071 | + gdb.write(msg) | ||
1072 | |||
1073 | pos += length | ||
1074 | |||
1075 | diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py | ||
1076 | index 38b1f09d1cd95..822e3767bc054 100644 | ||
1077 | --- a/scripts/gdb/linux/proc.py | ||
1078 | +++ b/scripts/gdb/linux/proc.py | ||
1079 | @@ -40,7 +40,7 @@ class LxVersion(gdb.Command): | ||
1080 | |||
1081 | def invoke(self, arg, from_tty): | ||
1082 | # linux_banner should contain a newline | ||
1083 | - gdb.write(gdb.parse_and_eval("linux_banner").string()) | ||
1084 | + gdb.write(gdb.parse_and_eval("(char *)linux_banner").string()) | ||
1085 | |||
1086 | LxVersion() | ||
1087 | |||
1088 | diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c | ||
1089 | index 1e99500dbb6c8..f7797e546e3de 100644 | ||
1090 | --- a/sound/pci/hda/patch_conexant.c | ||
1091 | +++ b/sound/pci/hda/patch_conexant.c | ||
1092 | @@ -1001,6 +1001,7 @@ static int patch_conexant_auto(struct hda_codec *codec) | ||
1093 | static const struct hda_device_id snd_hda_id_conexant[] = { | ||
1094 | HDA_CODEC_ENTRY(0x14f11f86, "CX8070", patch_conexant_auto), | ||
1095 | HDA_CODEC_ENTRY(0x14f12008, "CX8200", patch_conexant_auto), | ||
1096 | + HDA_CODEC_ENTRY(0x14f120d0, "CX11970", patch_conexant_auto), | ||
1097 | HDA_CODEC_ENTRY(0x14f15045, "CX20549 (Venice)", patch_conexant_auto), | ||
1098 | HDA_CODEC_ENTRY(0x14f15047, "CX20551 (Waikiki)", patch_conexant_auto), | ||
1099 | HDA_CODEC_ENTRY(0x14f15051, "CX20561 (Hermosa)", patch_conexant_auto), | ||
1100 | diff --git a/sound/usb/midi.c b/sound/usb/midi.c | ||
1101 | index b8d4b5b3e54a1..ea264727fdf7b 100644 | ||
1102 | --- a/sound/usb/midi.c | ||
1103 | +++ b/sound/usb/midi.c | ||
1104 | @@ -1867,6 +1867,8 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi *umidi, | ||
1105 | ms_ep = find_usb_ms_endpoint_descriptor(hostep); | ||
1106 | if (!ms_ep) | ||
1107 | continue; | ||
1108 | + if (ms_ep->bNumEmbMIDIJack > 0x10) | ||
1109 | + continue; | ||
1110 | if (usb_endpoint_dir_out(ep)) { | ||
1111 | if (endpoints[epidx].out_ep) { | ||
1112 | if (++epidx >= MIDI_MAX_ENDPOINTS) { | ||
1113 | @@ -2119,6 +2121,8 @@ static int snd_usbmidi_detect_roland(struct snd_usb_midi *umidi, | ||
1114 | cs_desc[1] == USB_DT_CS_INTERFACE && | ||
1115 | cs_desc[2] == 0xf1 && | ||
1116 | cs_desc[3] == 0x02) { | ||
1117 | + if (cs_desc[4] > 0x10 || cs_desc[5] > 0x10) | ||
1118 | + continue; | ||
1119 | endpoint->in_cables = (1 << cs_desc[4]) - 1; | ||
1120 | endpoint->out_cables = (1 << cs_desc[5]) - 1; | ||
1121 | return snd_usbmidi_detect_endpoints(umidi, endpoint, 1); |