Revision da353fac65fede6b8b4cfe207f0d9408e3121105 authored by Daniel Jordan on 27 October 2021, 21:59:20 UTC, committed by David S. Miller on 28 October 2021, 13:41:20 UTC
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: c46234ebb4d1e ("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>
1 parent a32f07d
History
File Mode Size
Kconfig -rw-r--r-- 3.2 KB
Makefile -rw-r--r-- 701 bytes
README -rw-r--r-- 7.9 KB
acl.h -rw-r--r-- 1.9 KB
bitmap.c -rw-r--r-- 39.6 KB
dir.c -rw-r--r-- 9.0 KB
do_balan.c -rw-r--r-- 54.0 KB
file.c -rw-r--r-- 7.4 KB
fix_node.c -rw-r--r-- 77.3 KB
hashes.c -rw-r--r-- 3.5 KB
ibalance.c -rw-r--r-- 34.3 KB
inode.c -rw-r--r-- 92.2 KB
ioctl.c -rw-r--r-- 5.0 KB
item_ops.c -rw-r--r-- 18.1 KB
journal.c -rw-r--r-- 120.6 KB
lbalance.c -rw-r--r-- 41.2 KB
lock.c -rw-r--r-- 2.6 KB
namei.c -rw-r--r-- 44.2 KB
objectid.c -rw-r--r-- 6.8 KB
prints.c -rw-r--r-- 21.4 KB
procfs.c -rw-r--r-- 13.1 KB
reiserfs.h -rw-r--r-- 116.8 KB
resize.c -rw-r--r-- 6.3 KB
stree.c -rw-r--r-- 64.3 KB
super.c -rw-r--r-- 70.2 KB
tail_conversion.c -rw-r--r-- 9.2 KB
xattr.c -rw-r--r-- 25.4 KB
xattr.h -rw-r--r-- 3.7 KB
xattr_acl.c -rw-r--r-- 9.7 KB
xattr_security.c -rw-r--r-- 2.8 KB
xattr_trusted.c -rw-r--r-- 1.2 KB
xattr_user.c -rw-r--r-- 1.1 KB

README

back to top