Commit 9361ebf
tty: n_gsm: fix invalid gsmtty_write_room() result
gsmtty_write() does not prevent the user to use the full fifo size of 4096
bytes as allocated in gsm_dlci_alloc(). However, gsmtty_write_room() tries
to limit the return value by 'TX_SIZE' and returns a negative value if the
fifo has more than 'TX_SIZE' bytes stored. This is obviously wrong as
'TX_SIZE' is defined as 512.
Define 'TX_SIZE' to the fifo size and use it accordingly for allocation to
keep the current behavior. Return the correct remaining size of the fifo in
gsmtty_write_room() via kfifo_avail().
Fixes: e1eaea4 ("tty: n_gsm line discipline")
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Starke <daniel.starke@siemens.com>
Link: https://lore.kernel.org/r/20220504081733.3494-3-daniel.starke@siemens.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent edd5f60 commit 9361ebf
1 file changed
Lines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| |||
1731 | 1732 | | |
1732 | 1733 | | |
1733 | 1734 | | |
1734 | | - | |
| 1735 | + | |
1735 | 1736 | | |
1736 | 1737 | | |
1737 | 1738 | | |
| |||
2976 | 2977 | | |
2977 | 2978 | | |
2978 | 2979 | | |
2979 | | - | |
2980 | | - | |
2981 | 2980 | | |
2982 | 2981 | | |
2983 | 2982 | | |
| |||
3217 | 3216 | | |
3218 | 3217 | | |
3219 | 3218 | | |
3220 | | - | |
| 3219 | + | |
3221 | 3220 | | |
3222 | 3221 | | |
3223 | 3222 | | |
| |||
0 commit comments