tty: n_gsm: fix possible out-of-bounds in gsm0_receive()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ e1eaea46bb4020b38a141b84f88565d4603f8dd0 · < 774d83b008eccb1c48c14dc5486e7aa255731350| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
tty: n_gsm: fix possible out-of-bounds in gsm0_receive()
Assuming the following: - side A configures the n_gsm in basic option mode - side B sends the header of a basic option mode frame with data length 1 - side A switches to advanced option mode - side B sends 2 data bytes which exceeds gsm->len Reason: gsm->len is not used in advanced option mode. - side A switches to basic option mode - side B keeps sending until gsm0_receive() writes past gsm->buf Reason: Neither gsm->state nor gsm->len have been reset after reconfiguration.
Fix this by changing gsm->count to gsm->len comparison from equal to less than. Also add upper limit checks against the constant MAX_MRU in gsm0_receive() and gsm1_receive() to harden against memory corruption of gsm->len and gsm->mru.
All other checks remain as we still need to limit the data according to the user configuration and actual payload size.
From the CVE record · Linux
The Linux kernel's n_gsm driver can write past its buffer in gsm0_receive() after switching between basic and advanced option modes. A peer sending a specific sequence of frames during those mode changes can trigger the write. The input does not specify authentication requirements or user interaction.
Engineers running the Linux kernel with n_gsm should check their kernel; affected versions are not specified.