Repository navigation
Commit f3dec7e
net/tls: Fix flipped sign in tls_err_abort() calls
commit da353fa upstream.
sk->sk_err appears to expect a positive value, a convention that ktls
doesn't always follow and that leads to memory corruption in other code.
For instance,
[kworker]
tls_encrypt_done(..., err=<negative error from crypto request>)
tls_err_abort(.., err)
sk->sk_err = err;
[task]
splice_from_pipe_feed
...
tls_sw_do_sendpage
if (sk->sk_err) {
ret = -sk->sk_err; // ret is positive
splice_from_pipe_feed (continued)
ret = actor(...) // ret is still positive and interpreted as bytes
// written, resulting in underflow of buf->len and
// sd->len, leading to huge buf->offset and bogus
// addresses computed in later calls to actor()
Fix all tls_err_abort() callers to pass a negative error code
consistently and centralize the error-prone sign flip there, throwing in
a warning to catch future misuse and uninlining the function so it
really does only warn once.
Cc: stable@vger.kernel.org
Fixes: c46234e ("tls: RX path for ktls")
Reported-by: syzbot+b187b77c8474f9648fae@syzkaller.appspotmail.com
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent c828115 commit f3dec7e
2 files changed
Lines changed: 15 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
| 362 | + | |
362 | 363 | | |
363 | 364 | | |
364 | 365 | | |
| |||
467 | 468 | | |
468 | 469 | | |
469 | 470 | | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | 471 | | |
477 | 472 | | |
478 | 473 | | |
| |||
513 | 508 | | |
514 | 509 | | |
515 | 510 | | |
516 | | - | |
| 511 | + | |
517 | 512 | | |
518 | 513 | | |
519 | 514 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
46 | 55 | | |
47 | 56 | | |
48 | 57 | | |
| |||
419 | 428 | | |
420 | 429 | | |
421 | 430 | | |
422 | | - | |
| 431 | + | |
423 | 432 | | |
424 | 433 | | |
425 | 434 | | |
| |||
764 | 773 | | |
765 | 774 | | |
766 | 775 | | |
767 | | - | |
| 776 | + | |
768 | 777 | | |
769 | 778 | | |
770 | 779 | | |
| |||
1828 | 1837 | | |
1829 | 1838 | | |
1830 | 1839 | | |
1831 | | - | |
| 1840 | + | |
1832 | 1841 | | |
1833 | 1842 | | |
1834 | 1843 | | |
| |||
2008 | 2017 | | |
2009 | 2018 | | |
2010 | 2019 | | |
2011 | | - | |
| 2020 | + | |
2012 | 2021 | | |
2013 | 2022 | | |
2014 | 2023 | | |
| |||
0 commit comments