ghsa-4jrv-w6c6-f8r5
Vulnerability from github
Published
2025-10-22 15:31
Modified
2025-10-22 15:31
Details

In the Linux kernel, the following vulnerability has been resolved:

usb: gadget: f_hid: fix f_hidg lifetime vs cdev

The embedded struct cdev does not have its lifetime correctly tied to the enclosing struct f_hidg, so there is a use-after-free if /dev/hidgN is held open while the gadget is deleted.

This can readily be replicated with libusbgx's example programs (for conciseness - operating directly via configfs is equivalent):

gadget-hid
exec 3<> /dev/hidg0
gadget-vid-pid-remove
exec 3<&-

Pull the existing device up in to struct f_hidg and make use of the cdev_device_{add,del}() helpers. This changes the lifetime of the device object to match struct f_hidg, but note that it is still added and deleted at the same time.

Show details on source website


{
  "affected": [],
  "aliases": [
    "CVE-2022-50568"
  ],
  "database_specific": {
    "cwe_ids": [],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-10-22T14:15:41Z",
    "severity": null
  },
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget: f_hid: fix f_hidg lifetime vs cdev\n\nThe embedded struct cdev does not have its lifetime correctly tied to\nthe enclosing struct f_hidg, so there is a use-after-free if /dev/hidgN\nis held open while the gadget is deleted.\n\nThis can readily be replicated with libusbgx\u0027s example programs (for\nconciseness - operating directly via configfs is equivalent):\n\n\tgadget-hid\n\texec 3\u003c\u003e /dev/hidg0\n\tgadget-vid-pid-remove\n\texec 3\u003c\u0026-\n\nPull the existing device up in to struct f_hidg and make use of the\ncdev_device_{add,del}() helpers.  This changes the lifetime of the\ndevice object to match struct f_hidg, but note that it is still added\nand deleted at the same time.",
  "id": "GHSA-4jrv-w6c6-f8r5",
  "modified": "2025-10-22T15:31:09Z",
  "published": "2025-10-22T15:31:09Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-50568"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/1b6a53e447ec3d81623610c8c7ec5082b47dfdce"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/1cd7f156f6389918f760687fbbf133c86da93162"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/89ff3dfac604614287ad5aad9370c3f984ea3f4b"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/9e08b7f5fa00e9d550851352bd0d1ba74ccffef2"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/9e4b85d815b14bd4db2deea2a54264a23de8b896"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/c78c87c4e389b62f8892af7f59857447aa6d9797"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/d3136b79705c2e3bba9c76adc5628af0215d798e"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…