CVE-2021-47649
Vulnerability from cvelistv5
Published
2025-02-26 01:54
Modified
2025-05-04 07:15
Severity ?
Summary
In the Linux kernel, the following vulnerability has been resolved: udmabuf: validate ubuf->pagecount Syzbot has reported GPF in sg_alloc_append_table_from_pages(). The problem was in ubuf->pages == ZERO_PTR. ubuf->pagecount is calculated from arguments passed from user-space. If user creates udmabuf with list.size == 0 then ubuf->pagecount will be also equal to zero; it causes kmalloc_array() to return ZERO_PTR. Fix it by validating ubuf->pagecount before passing it to kmalloc_array().
Impacted products
Vendor Product Version
Linux Linux Version: fbb0de795078190a9834b3409e4b009cfb18a6d4
Version: fbb0de795078190a9834b3409e4b009cfb18a6d4
Version: fbb0de795078190a9834b3409e4b009cfb18a6d4
Version: fbb0de795078190a9834b3409e4b009cfb18a6d4
Version: fbb0de795078190a9834b3409e4b009cfb18a6d4
Version: fbb0de795078190a9834b3409e4b009cfb18a6d4
Create a notification for this product.
   Linux Linux Version: 4.20
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "drivers/dma-buf/udmabuf.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "5d50f851dd307c07ca5591297093f19967c834a9",
              "status": "affected",
              "version": "fbb0de795078190a9834b3409e4b009cfb18a6d4",
              "versionType": "git"
            },
            {
              "lessThan": "b267a8118c2b171bf7d67b90ed64154eeab9fae0",
              "status": "affected",
              "version": "fbb0de795078190a9834b3409e4b009cfb18a6d4",
              "versionType": "git"
            },
            {
              "lessThan": "811b667cefbea9cb7511a874b169d6a92907137e",
              "status": "affected",
              "version": "fbb0de795078190a9834b3409e4b009cfb18a6d4",
              "versionType": "git"
            },
            {
              "lessThan": "a3728d32fc61eb0fe283cb8ff60b2c8f751e2202",
              "status": "affected",
              "version": "fbb0de795078190a9834b3409e4b009cfb18a6d4",
              "versionType": "git"
            },
            {
              "lessThan": "9e9b4a269f84d3230f2af84ff42322db676440d9",
              "status": "affected",
              "version": "fbb0de795078190a9834b3409e4b009cfb18a6d4",
              "versionType": "git"
            },
            {
              "lessThan": "2b6dd600dd72573c23ea180b5b0b2f1813405882",
              "status": "affected",
              "version": "fbb0de795078190a9834b3409e4b009cfb18a6d4",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "drivers/dma-buf/udmabuf.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "4.20"
            },
            {
              "lessThan": "4.20",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.4.*",
              "status": "unaffected",
              "version": "5.4.189",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.10.*",
              "status": "unaffected",
              "version": "5.10.110",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.15.*",
              "status": "unaffected",
              "version": "5.15.33",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.16.*",
              "status": "unaffected",
              "version": "5.16.19",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.17.*",
              "status": "unaffected",
              "version": "5.17.2",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "5.18",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.4.189",
                  "versionStartIncluding": "4.20",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.10.110",
                  "versionStartIncluding": "4.20",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.15.33",
                  "versionStartIncluding": "4.20",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.16.19",
                  "versionStartIncluding": "4.20",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.17.2",
                  "versionStartIncluding": "4.20",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.18",
                  "versionStartIncluding": "4.20",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nudmabuf: validate ubuf-\u003epagecount\n\nSyzbot has reported GPF in sg_alloc_append_table_from_pages(). The\nproblem was in ubuf-\u003epages == ZERO_PTR.\n\nubuf-\u003epagecount is calculated from arguments passed from user-space. If\nuser creates udmabuf with list.size == 0 then ubuf-\u003epagecount will be\nalso equal to zero; it causes kmalloc_array() to return ZERO_PTR.\n\nFix it by validating ubuf-\u003epagecount before passing it to\nkmalloc_array()."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2025-05-04T07:15:30.553Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/5d50f851dd307c07ca5591297093f19967c834a9"
        },
        {
          "url": "https://git.kernel.org/stable/c/b267a8118c2b171bf7d67b90ed64154eeab9fae0"
        },
        {
          "url": "https://git.kernel.org/stable/c/811b667cefbea9cb7511a874b169d6a92907137e"
        },
        {
          "url": "https://git.kernel.org/stable/c/a3728d32fc61eb0fe283cb8ff60b2c8f751e2202"
        },
        {
          "url": "https://git.kernel.org/stable/c/9e9b4a269f84d3230f2af84ff42322db676440d9"
        },
        {
          "url": "https://git.kernel.org/stable/c/2b6dd600dd72573c23ea180b5b0b2f1813405882"
        }
      ],
      "title": "udmabuf: validate ubuf-\u003epagecount",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2021-47649",
    "datePublished": "2025-02-26T01:54:16.574Z",
    "dateReserved": "2025-02-26T01:48:21.520Z",
    "dateUpdated": "2025-05-04T07:15:30.553Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1"
}