CVE-2022-49940

Source
https://cve.org/CVERecord?id=CVE-2022-49940
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49940.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2022-49940
Downstream
Related
Published
2025-06-18T10:54:40.745Z
Modified
2026-04-02T17:30:37.773270033Z
Summary
tty: n_gsm: add sanity check for gsm->receive in gsm_receive_buf()
Details

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

tty: ngsm: add sanity check for gsm->receive in gsmreceive_buf()

A null pointer dereference can happen when attempting to access the "gsm->receive()" function in gsmldreceivebuf(). Currently, the code assumes that gsm->recieve is only called after MUX activation. Since the gsmldreceivebuf() function can be accessed without the need to initialize the MUX, the gsm->receive() function will not be set and a NULL pointer dereference will occur.

Fix this by avoiding the call to "gsm->receive()" in case the function is not initialized by adding a sanity check.

Call Trace: <TASK> gsmldreceivebuf+0x1c2/0x2f0 drivers/tty/ngsm.c:2861 tiocsti drivers/tty/ttyio.c:2293 [inline] ttyioctl+0xa75/0x15d0 drivers/tty/ttyio.c:2692 vfs_ioctl fs/ioctl.c:51 [inline] __dosysioctl fs/ioctl.c:870 [inline] __sesysioctl fs/ioctl.c:856 [inline] __x64sysioctl+0x193/0x200 fs/ioctl.c:856 dosyscallx64 arch/x86/entry/common.c:50 [inline] dosyscall64+0x35/0xb0 arch/x86/entry/common.c:80 entrySYSCALL64afterhwframe+0x63/0xcd

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49940.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
b8faa754b523a845facdc83120b2ecd290d7fa6d
Fixed
5a82cf64f8ad63caf6bf115642ce44ddbc64311e
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
dfa9b6d34aac2154b5e926d7a7a061123bf137c6
Fixed
309aea4b6b813f6678c3a547cfd7fe3a76ffa976
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
5e59c010c6862da329db17acca086afd8bea1aa8
Fixed
5aa37f9510345a812c0998bcbbc4d88d1dcc4d8b
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
01aecd917114577c423f07cec0d186ad007d76fc
Fixed
f16c6d2e58a4c2b972efcf9eb12390ee0ba3befb
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
0 Unknown introduced commit / All previous commits are affected
Last affected
2dc1be365a70699f7dda92fd9e48b84546086070

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49940.json"