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-6.8-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB / Thunderbolt fixes from Greg KH:
"Here are some small remaining fixes for USB and Thunderbolt drivers.
Included in here are fixes for:

- thunderbold NULL dereference fix

- typec driver fixes

- xhci driver regression fix

- usb-storage divide-by-0 fix

- ncm gadget driver fix

All of these have been in linux-next with no reported issues"

* tag 'usb-6.8-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
xhci: Fix failure to detect ring expansion need.
usb: port: Don't try to peer unused USB ports based on location
usb: gadget: ncm: Fix handling of zero block length packets
usb: typec: altmodes/displayport: create sysfs nodes as driver's default device attribute group
usb: typec: tpcm: Fix PORT_RESET behavior for self powered devices
usb: typec: ucsi: fix UCSI on SM8550 & SM8650 Qualcomm devices
USB: usb-storage: Prevent divide-by-0 error in isd200_ata_command
thunderbolt: Fix NULL pointer dereference in tb_port_update_credits()

+47 -20
+3
drivers/thunderbolt/switch.c
··· 1249 1249 ret = tb_port_do_update_credits(port); 1250 1250 if (ret) 1251 1251 return ret; 1252 + 1253 + if (!port->dual_link_port) 1254 + return 0; 1252 1255 return tb_port_do_update_credits(port->dual_link_port); 1253 1256 } 1254 1257
+3 -2
drivers/usb/core/port.c
··· 573 573 struct usb_hub *peer_hub = usb_hub_to_struct_hub(peer_hdev); 574 574 struct usb_device *hdev = to_usb_device(port_dev->dev.parent->parent); 575 575 576 - if (!peer_hub) 576 + if (!peer_hub || port_dev->connect_type == USB_PORT_NOT_USED) 577 577 return 0; 578 578 579 579 hcd = bus_to_hcd(hdev->bus); ··· 584 584 585 585 for (port1 = 1; port1 <= peer_hdev->maxchild; port1++) { 586 586 peer = peer_hub->ports[port1 - 1]; 587 - if (peer && peer->location == port_dev->location) { 587 + if (peer && peer->connect_type != USB_PORT_NOT_USED && 588 + peer->location == port_dev->location) { 588 589 link_peers_report(port_dev, peer); 589 590 return 1; /* done */ 590 591 }
+1 -1
drivers/usb/gadget/function/f_ncm.c
··· 1346 1346 if (to_process == 1 && 1347 1347 (*(unsigned char *)(ntb_ptr + block_len) == 0x00)) { 1348 1348 to_process--; 1349 - } else if (to_process > 0) { 1349 + } else if ((to_process > 0) && (block_len != 0)) { 1350 1350 ntb_ptr = (unsigned char *)(ntb_ptr + block_len); 1351 1351 goto parse_ntb; 1352 1352 }
+7 -1
drivers/usb/host/xhci-ring.c
··· 326 326 /* how many trbs will be queued past the enqueue segment? */ 327 327 trbs_past_seg = enq_used + num_trbs - (TRBS_PER_SEGMENT - 1); 328 328 329 - if (trbs_past_seg <= 0) 329 + /* 330 + * Consider expanding the ring already if num_trbs fills the current 331 + * segment (i.e. trbs_past_seg == 0), not only when num_trbs goes into 332 + * the next segment. Avoids confusing full ring with special empty ring 333 + * case below 334 + */ 335 + if (trbs_past_seg < 0) 330 336 return 0; 331 337 332 338 /* Empty ring special case, enqueue stuck on link trb while dequeue advanced */
+18 -5
drivers/usb/storage/isd200.c
··· 1105 1105 static int isd200_get_inquiry_data( struct us_data *us ) 1106 1106 { 1107 1107 struct isd200_info *info = (struct isd200_info *)us->extra; 1108 - int retStatus = ISD200_GOOD; 1108 + int retStatus; 1109 1109 u16 *id = info->id; 1110 1110 1111 1111 usb_stor_dbg(us, "Entering isd200_get_inquiry_data\n"); ··· 1136 1136 1137 1137 isd200_fix_driveid(id); 1138 1138 isd200_dump_driveid(us, id); 1139 + 1140 + /* Prevent division by 0 in isd200_scsi_to_ata() */ 1141 + if (id[ATA_ID_HEADS] == 0 || id[ATA_ID_SECTORS] == 0) { 1142 + usb_stor_dbg(us, " Invalid ATA Identify data\n"); 1143 + retStatus = ISD200_ERROR; 1144 + goto Done; 1145 + } 1139 1146 1140 1147 memset(&info->InquiryData, 0, sizeof(info->InquiryData)); 1141 1148 ··· 1209 1202 } 1210 1203 } 1211 1204 1205 + Done: 1212 1206 usb_stor_dbg(us, "Leaving isd200_get_inquiry_data %08X\n", retStatus); 1213 1207 1214 1208 return(retStatus); ··· 1489 1481 1490 1482 static int isd200_Initialization(struct us_data *us) 1491 1483 { 1484 + int rc = 0; 1485 + 1492 1486 usb_stor_dbg(us, "ISD200 Initialization...\n"); 1493 1487 1494 1488 /* Initialize ISD200 info struct */ 1495 1489 1496 - if (isd200_init_info(us) == ISD200_ERROR) { 1490 + if (isd200_init_info(us) < 0) { 1497 1491 usb_stor_dbg(us, "ERROR Initializing ISD200 Info struct\n"); 1492 + rc = -ENOMEM; 1498 1493 } else { 1499 1494 /* Get device specific data */ 1500 1495 1501 - if (isd200_get_inquiry_data(us) != ISD200_GOOD) 1496 + if (isd200_get_inquiry_data(us) != ISD200_GOOD) { 1502 1497 usb_stor_dbg(us, "ISD200 Initialization Failure\n"); 1503 - else 1498 + rc = -EINVAL; 1499 + } else { 1504 1500 usb_stor_dbg(us, "ISD200 Initialization complete\n"); 1501 + } 1505 1502 } 1506 1503 1507 - return 0; 1504 + return rc; 1508 1505 } 1509 1506 1510 1507
+9 -9
drivers/usb/typec/altmodes/displayport.c
··· 559 559 } 560 560 static DEVICE_ATTR_RO(hpd); 561 561 562 - static struct attribute *dp_altmode_attrs[] = { 562 + static struct attribute *displayport_attrs[] = { 563 563 &dev_attr_configuration.attr, 564 564 &dev_attr_pin_assignment.attr, 565 565 &dev_attr_hpd.attr, 566 566 NULL 567 567 }; 568 568 569 - static const struct attribute_group dp_altmode_group = { 569 + static const struct attribute_group displayport_group = { 570 570 .name = "displayport", 571 - .attrs = dp_altmode_attrs, 571 + .attrs = displayport_attrs, 572 + }; 573 + 574 + static const struct attribute_group *displayport_groups[] = { 575 + &displayport_group, 576 + NULL, 572 577 }; 573 578 574 579 int dp_altmode_probe(struct typec_altmode *alt) ··· 581 576 const struct typec_altmode *port = typec_altmode_get_partner(alt); 582 577 struct fwnode_handle *fwnode; 583 578 struct dp_altmode *dp; 584 - int ret; 585 579 586 580 /* FIXME: Port can only be DFP_U. */ 587 581 ··· 590 586 !(DP_CAP_PIN_ASSIGN_UFP_D(port->vdo) & 591 587 DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo))) 592 588 return -ENODEV; 593 - 594 - ret = sysfs_create_group(&alt->dev.kobj, &dp_altmode_group); 595 - if (ret) 596 - return ret; 597 589 598 590 dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL); 599 591 if (!dp) ··· 624 624 { 625 625 struct dp_altmode *dp = typec_altmode_get_drvdata(alt); 626 626 627 - sysfs_remove_group(&alt->dev.kobj, &dp_altmode_group); 628 627 cancel_work_sync(&dp->work); 629 628 630 629 if (dp->connector_fwnode) { ··· 648 649 .driver = { 649 650 .name = "typec_displayport", 650 651 .owner = THIS_MODULE, 652 + .dev_groups = displayport_groups, 651 653 }, 652 654 }; 653 655 module_typec_altmode_driver(dp_altmode_driver);
+5 -2
drivers/usb/typec/tcpm/tcpm.c
··· 4873 4873 break; 4874 4874 case PORT_RESET: 4875 4875 tcpm_reset_port(port); 4876 - tcpm_set_cc(port, tcpm_default_state(port) == SNK_UNATTACHED ? 4877 - TYPEC_CC_RD : tcpm_rp_cc(port)); 4876 + if (port->self_powered) 4877 + tcpm_set_cc(port, TYPEC_CC_OPEN); 4878 + else 4879 + tcpm_set_cc(port, tcpm_default_state(port) == SNK_UNATTACHED ? 4880 + TYPEC_CC_RD : tcpm_rp_cc(port)); 4878 4881 tcpm_set_state(port, PORT_RESET_WAIT_OFF, 4879 4882 PD_T_ERROR_RECOVERY); 4880 4883 break;
+1
drivers/usb/typec/ucsi/ucsi_glink.c
··· 301 301 { .compatible = "qcom,sc8180x-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, }, 302 302 { .compatible = "qcom,sc8280xp-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, }, 303 303 { .compatible = "qcom,sm8350-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, }, 304 + { .compatible = "qcom,sm8550-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, }, 304 305 {} 305 306 }; 306 307