Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'usb-5.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB and Thunderbolt driver fixes from Greg KH:
"Here are some small Thunderbolt and USB driver fixes for some reported
issues:

- thunderbolt fixes for minor problems

- typec fixes for power issues

- usb-storage quirk addition

- usbip bugfix

- dwc3 bugfix when stopping transfers

- cdnsp bugfix for isoc transfers

- gadget use-after-free fix

All have been in linux-next this week with no reported issues"

* tag 'usb-5.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
usb: typec: tcpm: Skip sink_cap query only when VDM sm is busy
usb: dwc3: gadget: Prevent EP queuing while stopping transfers
usb: typec: tcpm: Invoke power_supply_changed for tcpm-source-psy-
usb: typec: Remove vdo[3] part of tps6598x_rx_identity_reg struct
usb-storage: Add quirk to defeat Kindle's automatic unload
usb: gadget: configfs: Fix KASAN use-after-free
usbip: Fix incorrect double assignment to udc->ud.tcp_rx
usb: cdnsp: Fixes incorrect value in ISOC TRB
thunderbolt: Increase runtime PM reference count on DP tunnel discovery
thunderbolt: Initialize HopID IDAs in tb_switch_alloc()

+62 -25
+8 -10
drivers/thunderbolt/switch.c
··· 768 768 769 769 tb_dump_port(port->sw->tb, &port->config); 770 770 771 - /* Control port does not need HopID allocation */ 772 - if (port->port) { 773 - ida_init(&port->in_hopids); 774 - ida_init(&port->out_hopids); 775 - } 776 - 777 771 INIT_LIST_HEAD(&port->list); 778 772 return 0; 779 773 ··· 1836 1842 dma_port_free(sw->dma_port); 1837 1843 1838 1844 tb_switch_for_each_port(sw, port) { 1839 - if (!port->disabled) { 1840 - ida_destroy(&port->in_hopids); 1841 - ida_destroy(&port->out_hopids); 1842 - } 1845 + ida_destroy(&port->in_hopids); 1846 + ida_destroy(&port->out_hopids); 1843 1847 } 1844 1848 1845 1849 kfree(sw->uuid); ··· 2017 2025 /* minimum setup for tb_find_cap and tb_drom_read to work */ 2018 2026 sw->ports[i].sw = sw; 2019 2027 sw->ports[i].port = i; 2028 + 2029 + /* Control port does not need HopID allocation */ 2030 + if (i) { 2031 + ida_init(&sw->ports[i].in_hopids); 2032 + ida_init(&sw->ports[i].out_hopids); 2033 + } 2020 2034 } 2021 2035 2022 2036 ret = tb_switch_find_vse_cap(sw, TB_VSE_CAP_PLUG_EVENTS);
+4
drivers/thunderbolt/tb.c
··· 138 138 parent->boot = true; 139 139 parent = tb_switch_parent(parent); 140 140 } 141 + } else if (tb_tunnel_is_dp(tunnel)) { 142 + /* Keep the domain from powering down */ 143 + pm_runtime_get_sync(&tunnel->src_port->sw->dev); 144 + pm_runtime_get_sync(&tunnel->dst_port->sw->dev); 141 145 } 142 146 143 147 list_add_tail(&tunnel->list, &tcm->tunnel_list);
+4 -1
drivers/usb/cdns3/cdnsp-ring.c
··· 2197 2197 * inverted in the first TDs isoc TRB. 2198 2198 */ 2199 2199 field = TRB_TYPE(TRB_ISOC) | TRB_TLBPC(last_burst_pkt) | 2200 - start_cycle ? 0 : 1 | TRB_SIA | TRB_TBC(burst_count); 2200 + TRB_SIA | TRB_TBC(burst_count); 2201 + 2202 + if (!start_cycle) 2203 + field |= TRB_CYCLE; 2201 2204 2202 2205 /* Fill the rest of the TRB fields, and remaining normal TRBs. */ 2203 2206 for (i = 0; i < trbs_per_td; i++) {
+5 -6
drivers/usb/dwc3/gadget.c
··· 783 783 784 784 trace_dwc3_gadget_ep_disable(dep); 785 785 786 - dwc3_remove_requests(dwc, dep); 787 - 788 786 /* make sure HW endpoint isn't stalled */ 789 787 if (dep->flags & DWC3_EP_STALL) 790 788 __dwc3_gadget_ep_set_halt(dep, 0, false); ··· 800 802 dep->endpoint.comp_desc = NULL; 801 803 dep->endpoint.desc = NULL; 802 804 } 805 + 806 + dwc3_remove_requests(dwc, dep); 803 807 804 808 return 0; 805 809 } ··· 1617 1617 { 1618 1618 struct dwc3 *dwc = dep->dwc; 1619 1619 1620 - if (!dep->endpoint.desc || !dwc->pullups_connected) { 1620 + if (!dep->endpoint.desc || !dwc->pullups_connected || !dwc->connected) { 1621 1621 dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n", 1622 1622 dep->name); 1623 1623 return -ESHUTDOWN; ··· 2247 2247 if (!is_on) { 2248 2248 u32 count; 2249 2249 2250 + dwc->connected = false; 2250 2251 /* 2251 2252 * In the Synopsis DesignWare Cores USB3 Databook Rev. 3.30a 2252 2253 * Section 4.1.8 Table 4-7, it states that for a device-initiated ··· 2272 2271 dwc->ev_buf->lpos = (dwc->ev_buf->lpos + count) % 2273 2272 dwc->ev_buf->length; 2274 2273 } 2275 - dwc->connected = false; 2276 2274 } else { 2277 2275 __dwc3_gadget_start(dwc); 2278 2276 } ··· 3321 3321 { 3322 3322 u32 reg; 3323 3323 3324 - dwc->connected = true; 3325 - 3326 3324 /* 3327 3325 * WORKAROUND: DWC3 revisions <1.88a have an issue which 3328 3326 * would cause a missing Disconnect Event if there's a ··· 3360 3362 * transfers." 3361 3363 */ 3362 3364 dwc3_stop_active_transfers(dwc); 3365 + dwc->connected = true; 3363 3366 3364 3367 reg = dwc3_readl(dwc->regs, DWC3_DCTL); 3365 3368 reg &= ~DWC3_DCTL_TSTCTRL_MASK;
+10 -4
drivers/usb/gadget/configfs.c
··· 97 97 struct list_head list; 98 98 }; 99 99 100 + #define USB_MAX_STRING_WITH_NULL_LEN (USB_MAX_STRING_LEN+1) 101 + 100 102 static int usb_string_copy(const char *s, char **s_copy) 101 103 { 102 104 int ret; ··· 108 106 if (ret > USB_MAX_STRING_LEN) 109 107 return -EOVERFLOW; 110 108 111 - str = kstrdup(s, GFP_KERNEL); 112 - if (!str) 113 - return -ENOMEM; 109 + if (copy) { 110 + str = copy; 111 + } else { 112 + str = kmalloc(USB_MAX_STRING_WITH_NULL_LEN, GFP_KERNEL); 113 + if (!str) 114 + return -ENOMEM; 115 + } 116 + strcpy(str, s); 114 117 if (str[ret - 1] == '\n') 115 118 str[ret - 1] = '\0'; 116 - kfree(copy); 117 119 *s_copy = str; 118 120 return 0; 119 121 }
+7
drivers/usb/storage/transport.c
··· 656 656 need_auto_sense = 1; 657 657 } 658 658 659 + /* Some devices (Kindle) require another command after SYNC CACHE */ 660 + if ((us->fflags & US_FL_SENSE_AFTER_SYNC) && 661 + srb->cmnd[0] == SYNCHRONIZE_CACHE) { 662 + usb_stor_dbg(us, "-- sense after SYNC CACHE\n"); 663 + need_auto_sense = 1; 664 + } 665 + 659 666 /* 660 667 * If we have a failure, we're going to do a REQUEST_SENSE 661 668 * automatically. Note that we differentiate between a command
+12
drivers/usb/storage/unusual_devs.h
··· 2212 2212 US_FL_NO_READ_DISC_INFO ), 2213 2213 2214 2214 /* 2215 + * Reported by Matthias Schwarzott <zzam@gentoo.org> 2216 + * The Amazon Kindle treats SYNCHRONIZE CACHE as an indication that 2217 + * the host may be finished with it, and automatically ejects its 2218 + * emulated media unless it receives another command within one second. 2219 + */ 2220 + UNUSUAL_DEV( 0x1949, 0x0004, 0x0000, 0x9999, 2221 + "Amazon", 2222 + "Kindle", 2223 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 2224 + US_FL_SENSE_AFTER_SYNC ), 2225 + 2226 + /* 2215 2227 * Reported by Oliver Neukum <oneukum@suse.com> 2216 2228 * This device morphes spontaneously into another device if the access 2217 2229 * pattern of Windows isn't followed. Thus writable media would be dirty
+9 -2
drivers/usb/typec/tcpm/tcpm.c
··· 942 942 943 943 port->supply_voltage = mv; 944 944 port->current_limit = max_ma; 945 + power_supply_changed(port->psy); 945 946 946 947 if (port->tcpc->set_current_limit) 947 948 ret = port->tcpc->set_current_limit(port->tcpc, max_ma, mv); ··· 2929 2928 2930 2929 port->pps_data.supported = false; 2931 2930 port->usb_type = POWER_SUPPLY_USB_TYPE_PD; 2931 + power_supply_changed(port->psy); 2932 2932 2933 2933 /* 2934 2934 * Select the source PDO providing the most power which has a ··· 2954 2952 port->pps_data.supported = true; 2955 2953 port->usb_type = 2956 2954 POWER_SUPPLY_USB_TYPE_PD_PPS; 2955 + power_supply_changed(port->psy); 2957 2956 } 2958 2957 continue; 2959 2958 default: ··· 3112 3109 port->pps_data.out_volt)); 3113 3110 port->pps_data.op_curr = min(port->pps_data.max_curr, 3114 3111 port->pps_data.op_curr); 3112 + power_supply_changed(port->psy); 3115 3113 } 3116 3114 3117 3115 return src_pdo; ··· 3348 3344 return ret; 3349 3345 } 3350 3346 port->vbus_charge = charge; 3347 + power_supply_changed(port->psy); 3351 3348 return 0; 3352 3349 } 3353 3350 ··· 3528 3523 port->try_src_count = 0; 3529 3524 port->try_snk_count = 0; 3530 3525 port->usb_type = POWER_SUPPLY_USB_TYPE_C; 3526 + power_supply_changed(port->psy); 3531 3527 port->nr_sink_caps = 0; 3532 3528 port->sink_cap_done = false; 3533 3529 if (port->tcpc->enable_frs) ··· 5173 5167 goto unlock; 5174 5168 5175 5169 /* Send when the state machine is idle */ 5176 - if (port->state != SNK_READY || port->vdm_state != VDM_STATE_DONE || port->send_discover) 5170 + if (port->state != SNK_READY || port->vdm_sm_running || port->send_discover) 5177 5171 goto resched; 5178 5172 5179 5173 port->upcoming_state = GET_SINK_CAP; ··· 5911 5905 ret = -EINVAL; 5912 5906 break; 5913 5907 } 5914 - 5908 + power_supply_changed(port->psy); 5915 5909 return ret; 5916 5910 } 5917 5911 ··· 6064 6058 err = devm_tcpm_psy_register(port); 6065 6059 if (err) 6066 6060 goto out_role_sw_put; 6061 + power_supply_changed(port->psy); 6067 6062 6068 6063 port->typec_port = typec_register_port(port->dev, &port->typec_caps); 6069 6064 if (IS_ERR(port->typec_port)) {
-1
drivers/usb/typec/tps6598x.c
··· 64 64 struct tps6598x_rx_identity_reg { 65 65 u8 status; 66 66 struct usb_pd_identity identity; 67 - u32 vdo[3]; 68 67 } __packed; 69 68 70 69 /* Standard Task return codes */
+1 -1
drivers/usb/usbip/vudc_sysfs.c
··· 174 174 175 175 udc->ud.tcp_socket = socket; 176 176 udc->ud.tcp_rx = tcp_rx; 177 - udc->ud.tcp_rx = tcp_tx; 177 + udc->ud.tcp_tx = tcp_tx; 178 178 udc->ud.status = SDEV_ST_USED; 179 179 180 180 spin_unlock_irq(&udc->ud.lock);
+2
include/linux/usb_usual.h
··· 86 86 /* lies about caching, so always sync */ \ 87 87 US_FLAG(NO_SAME, 0x40000000) \ 88 88 /* Cannot handle WRITE_SAME */ \ 89 + US_FLAG(SENSE_AFTER_SYNC, 0x80000000) \ 90 + /* Do REQUEST_SENSE after SYNCHRONIZE_CACHE */ \ 89 91 90 92 #define US_FLAG(name, value) US_FL_##name = value , 91 93 enum { US_DO_ALL_FLAGS };