CVE-2022-50459 (GCVE-0-2022-50459)
Vulnerability from cvelistv5
Published
2025-10-01 11:45
Modified
2025-10-01 11:45
Severity ?
Summary
In the Linux kernel, the following vulnerability has been resolved: scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername() Fix a NULL pointer crash that occurs when we are freeing the socket at the same time we access it via sysfs. The problem is that: 1. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() take the frwd_lock and do sock_hold() then drop the frwd_lock. sock_hold() does a get on the "struct sock". 2. iscsi_sw_tcp_release_conn() does sockfd_put() which does the last put on the "struct socket" and that does __sock_release() which sets the sock->ops to NULL. 3. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() then call kernel_getpeername() which accesses the NULL sock->ops. Above we do a get on the "struct sock", but we needed a get on the "struct socket". Originally, we just held the frwd_lock the entire time but in commit bcf3a2953d36 ("scsi: iscsi: iscsi_tcp: Avoid holding spinlock while calling getpeername()") we switched to refcount based because the network layer changed and started taking a mutex in that path, so we could no longer hold the frwd_lock. Instead of trying to maintain multiple refcounts, this just has us use a mutex for accessing the socket in the interface code paths.
Impacted products
Vendor Product Version
Linux Linux Version: bcf3a2953d36bbfb9bd44ccb3db0897d935cc485
Version: bcf3a2953d36bbfb9bd44ccb3db0897d935cc485
Version: bcf3a2953d36bbfb9bd44ccb3db0897d935cc485
Version: bcf3a2953d36bbfb9bd44ccb3db0897d935cc485
Version: bcf3a2953d36bbfb9bd44ccb3db0897d935cc485
Version: 7d29e950766327f658cb92722b9445ac3b3ae023
Create a notification for this product.
   Linux Linux Version: 5.9
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "drivers/scsi/iscsi_tcp.c",
            "drivers/scsi/iscsi_tcp.h"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "884a788f065578bb640382279a83d1df433b13e6",
              "status": "affected",
              "version": "bcf3a2953d36bbfb9bd44ccb3db0897d935cc485",
              "versionType": "git"
            },
            {
              "lessThan": "a26b0658751bb0a3b28386fca715333b104d32a2",
              "status": "affected",
              "version": "bcf3a2953d36bbfb9bd44ccb3db0897d935cc485",
              "versionType": "git"
            },
            {
              "lessThan": "897dbbc57d71e8a34ec1af8e573a142de457da38",
              "status": "affected",
              "version": "bcf3a2953d36bbfb9bd44ccb3db0897d935cc485",
              "versionType": "git"
            },
            {
              "lessThan": "0a0b861fce2657ba08ec356a74346b37ca4b2008",
              "status": "affected",
              "version": "bcf3a2953d36bbfb9bd44ccb3db0897d935cc485",
              "versionType": "git"
            },
            {
              "lessThan": "57569c37f0add1b6489e1a1563c71519daf732cf",
              "status": "affected",
              "version": "bcf3a2953d36bbfb9bd44ccb3db0897d935cc485",
              "versionType": "git"
            },
            {
              "status": "affected",
              "version": "7d29e950766327f658cb92722b9445ac3b3ae023",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "drivers/scsi/iscsi_tcp.c",
            "drivers/scsi/iscsi_tcp.h"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "5.9"
            },
            {
              "lessThan": "5.9",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.10.*",
              "status": "unaffected",
              "version": "5.10.150",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.15.*",
              "status": "unaffected",
              "version": "5.15.75",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.19.*",
              "status": "unaffected",
              "version": "5.19.17",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.0.*",
              "status": "unaffected",
              "version": "6.0.3",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.1",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.10.150",
                  "versionStartIncluding": "5.9",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.15.75",
                  "versionStartIncluding": "5.9",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.19.17",
                  "versionStartIncluding": "5.9",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.0.3",
                  "versionStartIncluding": "5.9",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.1",
                  "versionStartIncluding": "5.9",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionStartIncluding": "5.8.14",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nscsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername()\n\nFix a NULL pointer crash that occurs when we are freeing the socket at the\nsame time we access it via sysfs.\n\nThe problem is that:\n\n 1. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() take\n    the frwd_lock and do sock_hold() then drop the frwd_lock. sock_hold()\n    does a get on the \"struct sock\".\n\n 2. iscsi_sw_tcp_release_conn() does sockfd_put() which does the last put\n    on the \"struct socket\" and that does __sock_release() which sets the\n    sock-\u003eops to NULL.\n\n 3. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() then\n    call kernel_getpeername() which accesses the NULL sock-\u003eops.\n\nAbove we do a get on the \"struct sock\", but we needed a get on the \"struct\nsocket\". Originally, we just held the frwd_lock the entire time but in\ncommit bcf3a2953d36 (\"scsi: iscsi: iscsi_tcp: Avoid holding spinlock while\ncalling getpeername()\") we switched to refcount based because the network\nlayer changed and started taking a mutex in that path, so we could no\nlonger hold the frwd_lock.\n\nInstead of trying to maintain multiple refcounts, this just has us use a\nmutex for accessing the socket in the interface code paths."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2025-10-01T11:45:31.740Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/884a788f065578bb640382279a83d1df433b13e6"
        },
        {
          "url": "https://git.kernel.org/stable/c/a26b0658751bb0a3b28386fca715333b104d32a2"
        },
        {
          "url": "https://git.kernel.org/stable/c/897dbbc57d71e8a34ec1af8e573a142de457da38"
        },
        {
          "url": "https://git.kernel.org/stable/c/0a0b861fce2657ba08ec356a74346b37ca4b2008"
        },
        {
          "url": "https://git.kernel.org/stable/c/57569c37f0add1b6489e1a1563c71519daf732cf"
        }
      ],
      "title": "scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername()",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2022-50459",
    "datePublished": "2025-10-01T11:45:31.740Z",
    "dateReserved": "2025-10-01T11:38:45.640Z",
    "dateUpdated": "2025-10-01T11:45:31.740Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1",
  "vulnerability-lookup:meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2022-50459\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2025-10-01T12:15:39.283\",\"lastModified\":\"2025-10-02T19:12:17.160\",\"vulnStatus\":\"Awaiting Analysis\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nscsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername()\\n\\nFix a NULL pointer crash that occurs when we are freeing the socket at the\\nsame time we access it via sysfs.\\n\\nThe problem is that:\\n\\n 1. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() take\\n    the frwd_lock and do sock_hold() then drop the frwd_lock. sock_hold()\\n    does a get on the \\\"struct sock\\\".\\n\\n 2. iscsi_sw_tcp_release_conn() does sockfd_put() which does the last put\\n    on the \\\"struct socket\\\" and that does __sock_release() which sets the\\n    sock-\u003eops to NULL.\\n\\n 3. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() then\\n    call kernel_getpeername() which accesses the NULL sock-\u003eops.\\n\\nAbove we do a get on the \\\"struct sock\\\", but we needed a get on the \\\"struct\\nsocket\\\". Originally, we just held the frwd_lock the entire time but in\\ncommit bcf3a2953d36 (\\\"scsi: iscsi: iscsi_tcp: Avoid holding spinlock while\\ncalling getpeername()\\\") we switched to refcount based because the network\\nlayer changed and started taking a mutex in that path, so we could no\\nlonger hold the frwd_lock.\\n\\nInstead of trying to maintain multiple refcounts, this just has us use a\\nmutex for accessing the socket in the interface code paths.\"}],\"metrics\":{},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/0a0b861fce2657ba08ec356a74346b37ca4b2008\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/57569c37f0add1b6489e1a1563c71519daf732cf\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/884a788f065578bb640382279a83d1df433b13e6\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/897dbbc57d71e8a34ec1af8e573a142de457da38\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/a26b0658751bb0a3b28386fca715333b104d32a2\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}"
  }
}


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.
  • 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…