{"id":"CVE-2026-139138","state":"PUBLISHED","title":"ice: use reference counting and SRCU for PTP port access","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nice: use reference counting and SRCU for PTP port access\n\nThe ice adapter structure maintains a list of ports associated with the\nadapter. This is used for supporting PTP, where the clock owner must handle\nmany operations that require access to the PTP port structures of the\nassociated PFs.\n\nThis is implemented using a linked list and a mutex. This sort of works,\nbut a few places within the code do not acquire the mutex when iterating\nthe list. This includes ice_ptp_flush_all_tx_tracker(),\nice_ptp_restart_all_phy(), and ice_ptp_prepare_rebuild_sec().\n\nFixing this is tricky, especially since it is not clear if we can simply\nacquire the lock around the complete iterations.\n\nThe pattern of use for the port list is read-mostly with modifications only\nhappening during PF initialization when elements are inserted. This\ntypically only happens during early boot, though a PF could in principle be\nremoved or loaded at arbitrary times via bind and unbind operations.\n\nThe use of a mutex does mean the driver can sleep while holding it, but it\nstill creates complicates with lock ordering and prevents iterating the\nlist in any code path that *can't* sleep.\n\nInstead, use SRCU primitives for the port linked list, along with a\nreference count on the port. The kref reference counter ensures that a PF\nwill have a valid lifetime and not be removed until the reference is\nreleased. Note that this change focuses solely on the port list and does\nnot make an effort to resolve access to ctrl_pf, which is currently being\ninvestigated by another developer.\n\nUse of sleepable RCU is required because we often iterate the PTP port list\nand perform operations that might sleep. Attempts at implementing regular\nRCU have thus far not proven to be acceptable.\n\nThe remove path first removes the port from the list, and we use\nkref_get_unless_zero to ensure that such ports are skipped when iterating\nthe list. This ensures that once a port starts removing we will drop\nreferences and no longer be able to acquire new ones. This avoids loop\niterations chaining together to indefinitely block removal.\n\nThe ice_ptp_release_port_srcu() function is used as the release function\nfor the kref_put() call. This uses wake_up_var() to wake the removing\nthread. The waiting thread will block until the final reference has been\nremoved, then it will use synchronize_srcu() to ensure any outstanding SRCU\ncritical sections have had the necessary grace period.\n\nThis flow ensures that accesses to ports via the adapter port list will\nremain valid until both the SRCU critical sections have ended and all the\nreferences to the ports have been dropped. Strictly speaking, SRCU alone\nmight be sufficient for existing code paths, but the reference count allows\nthe option for passing a pointer to the port on to other functions if\nnecessary in the future.","publishedAt":"2026-11-30T13:31:55.982Z","updatedAt":"2026-11-30T13:31:55.982Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"e800654e85b5b27966fc6493201f5f8cf658beb6","status":"affected","lessThan":"85525fab62d8dbec58445de0c1ced59da4bd2d70","versionType":"git"},{"version":"e800654e85b5b27966fc6493201f5f8cf658beb6","status":"affected","lessThan":"91b962d7059d63a8566868be6f2871ed3c2cbe89","versionType":"git"},{"version":"e800654e85b5b27966fc6493201f5f8cf658beb6","status":"affected","lessThan":"d5d859a6efff473d799d35999a35aa764dcc185b","versionType":"git"},{"version":"2f59743be4d9568cad2d9cf697d1b897975421ed","status":"affected","versionType":"git"},{"version":"6.12.11","status":"affected","lessThan":"6.13","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/ethernet/intel/ice/ice_adapter.c","drivers/net/ethernet/intel/ice/ice_adapter.h","drivers/net/ethernet/intel/ice/ice_ptp.c","drivers/net/ethernet/intel/ice/ice_ptp.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.13","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.13","versionType":"semver"},{"version":"6.18.66","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/ethernet/intel/ice/ice_adapter.c","drivers/net/ethernet/intel/ice/ice_adapter.h","drivers/net/ethernet/intel/ice/ice_ptp.c","drivers/net/ethernet/intel/ice/ice_ptp.h"]}],"references":["https://git.kernel.org/stable/c/85525fab62d8dbec58445de0c1ced59da4bd2d70","https://git.kernel.org/stable/c/91b962d7059d63a8566868be6f2871ed3c2cbe89","https://git.kernel.org/stable/c/d5d859a6efff473d799d35999a35aa764dcc185b"],"weaknesses":[],"ingestedAt":"2026-11-30T13:44:05.999Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139138.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139138","state":"PUBLISHED","datePublished":"2026-11-30T13:31:55.982Z","dateUpdated":"2026-11-30T13:31:55.982Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.916Z"},"containers":{"cna":{"title":"ice: use reference counting and SRCU for PTP port access","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nice: use reference counting and SRCU for PTP port access\n\nThe ice adapter structure maintains a list of ports associated with the\nadapter. This is used for supporting PTP, where the clock owner must handle\nmany operations that require access to the PTP port structures of the\nassociated PFs.\n\nThis is implemented using a linked list and a mutex. This sort of works,\nbut a few places within the code do not acquire the mutex when iterating\nthe list. This includes ice_ptp_flush_all_tx_tracker(),\nice_ptp_restart_all_phy(), and ice_ptp_prepare_rebuild_sec().\n\nFixing this is tricky, especially since it is not clear if we can simply\nacquire the lock around the complete iterations.\n\nThe pattern of use for the port list is read-mostly with modifications only\nhappening during PF initialization when elements are inserted. This\ntypically only happens during early boot, though a PF could in principle be\nremoved or loaded at arbitrary times via bind and unbind operations.\n\nThe use of a mutex does mean the driver can sleep while holding it, but it\nstill creates complicates with lock ordering and prevents iterating the\nlist in any code path that *can't* sleep.\n\nInstead, use SRCU primitives for the port linked list, along with a\nreference count on the port. The kref reference counter ensures that a PF\nwill have a valid lifetime and not be removed until the reference is\nreleased. Note that this change focuses solely on the port list and does\nnot make an effort to resolve access to ctrl_pf, which is currently being\ninvestigated by another developer.\n\nUse of sleepable RCU is required because we often iterate the PTP port list\nand perform operations that might sleep. Attempts at implementing regular\nRCU have thus far not proven to be acceptable.\n\nThe remove path first removes the port from the list, and we use\nkref_get_unless_zero to ensure that such ports are skipped when iterating\nthe list. This ensures that once a port starts removing we will drop\nreferences and no longer be able to acquire new ones. This avoids loop\niterations chaining together to indefinitely block removal.\n\nThe ice_ptp_release_port_srcu() function is used as the release function\nfor the kref_put() call. This uses wake_up_var() to wake the removing\nthread. The waiting thread will block until the final reference has been\nremoved, then it will use synchronize_srcu() to ensure any outstanding SRCU\ncritical sections have had the necessary grace period.\n\nThis flow ensures that accesses to ports via the adapter port list will\nremain valid until both the SRCU critical sections have ended and all the\nreferences to the ports have been dropped. Strictly speaking, SRCU alone\nmight be sufficient for existing code paths, but the reference count allows\nthe option for passing a pointer to the port on to other functions if\nnecessary in the future."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"e800654e85b5b27966fc6493201f5f8cf658beb6","status":"affected","lessThan":"85525fab62d8dbec58445de0c1ced59da4bd2d70","versionType":"git"},{"version":"e800654e85b5b27966fc6493201f5f8cf658beb6","status":"affected","lessThan":"91b962d7059d63a8566868be6f2871ed3c2cbe89","versionType":"git"},{"version":"e800654e85b5b27966fc6493201f5f8cf658beb6","status":"affected","lessThan":"d5d859a6efff473d799d35999a35aa764dcc185b","versionType":"git"},{"version":"2f59743be4d9568cad2d9cf697d1b897975421ed","status":"affected","versionType":"git"},{"version":"6.12.11","status":"affected","lessThan":"6.13","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/ethernet/intel/ice/ice_adapter.c","drivers/net/ethernet/intel/ice/ice_adapter.h","drivers/net/ethernet/intel/ice/ice_ptp.c","drivers/net/ethernet/intel/ice/ice_ptp.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.13","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.13","versionType":"semver"},{"version":"6.18.66","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/ethernet/intel/ice/ice_adapter.c","drivers/net/ethernet/intel/ice/ice_adapter.h","drivers/net/ethernet/intel/ice/ice_ptp.c","drivers/net/ethernet/intel/ice/ice_ptp.h"]}],"references":[{"url":"https://git.kernel.org/stable/c/85525fab62d8dbec58445de0c1ced59da4bd2d70"},{"url":"https://git.kernel.org/stable/c/91b962d7059d63a8566868be6f2871ed3c2cbe89"},{"url":"https://git.kernel.org/stable/c/d5d859a6efff473d799d35999a35aa764dcc185b"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:31:55.982Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.13","versionEndExcluding":"6.18.66"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.13","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.13","versionEndExcluding":"7.4-rc1"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12.11"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}