Skip to content
Heist/ feed
Back to feed
UnratedFix available

staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv()

Type: advisorySources: OSV

In the Linux kernel, the following vulnerability has been resolved: staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv() In rtw_init_cmd_priv(), if `pcmdpriv->rsp_allocated_buf` is allocated in failure, then `pcmdpriv->cmd_allocated_buf` will be not properly released. Besides, considering there are only two error paths and the first one can directly return, so we do not need implicitly jump to the `exit` tag to execute the error handler. So this patch added `kfree(pcmdpriv->cmd_allocated_buf);` on the error path to release the resource and simplified the return logic of rtw_init_cmd_priv(). As there is no proper device to test with, no runtime testing was performed.

Products
Kernel
Affected versions
Not specified
Fixed versions
5.10.150, 5.15.75, 5.19.17, 5.4.220, 6.0.3
CVEs
CVE-2022-50513
Confirmed fixed CVEs
Not specified
Updated in this feed
5 Nov 2026, 10:30 UTC · Revision 1

Source evidence

staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv()

core-osv · Original source

Published 7 Oct 2025, 15:19 UTC

In the Linux kernel, the following vulnerability has been resolved: staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv() In rtw_init_cmd_priv(), if `pcmdpriv->rsp_allocated_buf` is allocated in failure, then `pcmdpriv->cmd_allocated_buf` will be not properly released. Besides, considering there are only two error paths and the first one can directly return, so we do not need implicitly jump to the `exit` tag to execute the error handler. So this patch added `kfree(pcmdpriv->cmd_allocated_buf);` on the error path to release the resource and simplified the return logic of rtw_init_cmd_priv(). As there is no proper device to test with, no runtime testing was performed.

osv:CVE-2022-50513

Kernel

Fixed versions: 5.4.220, 5.10.150, 5.15.75, 5.19.17, 6.0.3

Complete source record
{
  "id": "fe33ecfd79c67b98a82bcbe70392bcb837b336a80a558fbe596f8cf7acdfa82e",
  "url": "https://osv.dev/vulnerability/CVE-2022-50513",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv()",
    "summary": "In the Linux kernel, the following vulnerability has been resolved: staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv() In rtw_init_cmd_priv(), if `pcmdpriv->rsp_allocated_buf` is allocated in failure, then `pcmdpriv->cmd_allocated_buf` will be not properly released. Besides, considering there are only two error paths and the first one can directly return, so we do not need implicitly jump to the `exit` tag to execute the error handler. So this patch added `kfree(pcmdpriv->cmd_allocated_buf);` on the error path to release the resource and simplified the return logic of rtw_init_cmd_priv(). As there is no proper device to test with, no runtime testing was performed.",
    "evidence": "osv:CVE-2022-50513",
    "products": [
      {
        "name": {
          "value": "Kernel",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "5.4.220",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "5.10.150",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "5.15.75",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "5.19.17",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.0.3",
            "evidence": "/affected/1/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "unknown",
    "structured": {
      "id": "CVE-2022-50513",
      "aliases": [
        "CVE-2022-50513"
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "554c0a3abf216c991c5ebddcdb2c08689ecd290b"
                },
                {
                  "fixed": "e5d8f05edb36fc4ab15beec62cb6ab62f5a60fe2"
                },
                {
                  "fixed": "e6cc39db24a63f68314473621020ed8cad7be423"
                },
                {
                  "fixed": "39bef9c6a91bbb790d04c1347cfeae584541fb6a"
                },
                {
                  "fixed": "a5be64ff6d21f7805a91e6d81f53fc19cd9f0fae"
                },
                {
                  "fixed": "8db6ca84eee0ac258706f3fca54f7c021cb159ef"
                },
                {
                  "fixed": "708056fba733a73d926772ea4ce9a42d240345da"
                }
              ]
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-50513.json"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "4.12.0"
                },
                {
                  "fixed": "5.4.220"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.5.0"
                },
                {
                  "fixed": "5.10.150"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.11.0"
                },
                {
                  "fixed": "5.15.75"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.16.0"
                },
                {
                  "fixed": "5.19.17"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.20.0"
                },
                {
                  "fixed": "6.0.3"
                }
              ]
            }
          ],
          "package": {
            "name": "Kernel",
            "ecosystem": "Linux"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-50513.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:43.780840095Z",
      "provider": "osv",
      "references": [
        "https://git.kernel.org/stable/c/39bef9c6a91bbb790d04c1347cfeae584541fb6a",
        "https://git.kernel.org/stable/c/708056fba733a73d926772ea4ce9a42d240345da",
        "https://git.kernel.org/stable/c/8db6ca84eee0ac258706f3fca54f7c021cb159ef",
        "https://git.kernel.org/stable/c/a5be64ff6d21f7805a91e6d81f53fc19cd9f0fae",
        "https://git.kernel.org/stable/c/e5d8f05edb36fc4ab15beec62cb6ab62f5a60fe2",
        "https://git.kernel.org/stable/c/e6cc39db24a63f68314473621020ed8cad7be423",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/50xxx/CVE-2022-50513.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2022-50513",
        "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
      ],
      "provider_metadata": {
        "cna_assigner": "Linux",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/50xxx/CVE-2022-50513.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2022-50513",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": null
  },
  "source_id": "core-osv",
  "document_id": 511627,
  "published_at": "2025-10-07T15:19:09.547+00:00"
}