mirror-linux/Documentation
Chuck Lever 6b22d433aa net/handshake: Pass negative errno through handshake_complete()
handshake_complete() declares status as unsigned int and
tls_handshake_done() negates that value (-status) before handing
it to the TLS consumer. Consumers match on negative errno
constants -- xs_tls_handshake_done() has

	switch (status) {
	case 0:
	case -EACCES:
	case -ETIMEDOUT:
		lower_transport->xprt_err = status;
		break;
	default:
		lower_transport->xprt_err = -EACCES;
	}

so the API as designed expects callers to pass positive errno
values that the tlshd shim then negates.

Three internal callers in handshake_nl_accept_doit(), the
net-exit drain, and a kunit test follow kernel convention and
pass negative errnos -- -EIO, -ETIMEDOUT, -ETIMEDOUT. The
implicit conversion to unsigned int turns -ETIMEDOUT into
0xFFFFFF92; the subsequent -status in tls_handshake_done()
wraps back to 110, the consumer's switch falls through, and
the xprt reports -EACCES on what should be -ETIMEDOUT or -EIO.

Fix the API rather than the call sites. The natural kernel
convention is negative errno in, negative errno out. Change
handshake_complete() and hp_done to take int status, drop the
negation in tls_handshake_done(), and negate once in
handshake_nl_done_doit() where status arrives from the wire
as an unsigned netlink attribute. The three internal callers
were already correct under that convention and need no change.

At the same wire boundary, declare MAX_ERRNO as the netlink
policy upper bound for HANDSHAKE_A_DONE_STATUS. Attribute
validation rejects out-of-range values before
handshake_nl_done_doit() runs, and negating a bounded u32 there
stays within int range -- closing the UBSAN-visible signed-
integer overflow that an unconstrained u32 would invoke.

Fixes: 3b3009ea8a ("net/handshake: Create a NETLINK service for handling handshake requests")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Link: https://patch.msgid.link/20260525-handshake-file-pin-v3-3-66c616906ead@oracle.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-05-28 13:35:31 +02:00
..
ABI selinux: prune /sys/fs/selinux/user 2026-05-05 15:27:44 -04:00
PCI pci-v7.1-changes 2026-04-15 14:41:21 -07:00
RCU rcu-tasks: Document that RCU Tasks Trace grace periods now imply RCU grace periods 2026-03-30 15:48:14 -04:00
accel
accounting
admin-guide cgroup: Fixes for v7.1-rc2 2026-05-05 15:43:32 -07:00
arch riscv: Docs: fix unmatched quote warning 2026-05-13 22:21:32 -06:00
block Documentation: ublk: address review comments for SHMEM_ZC docs 2026-04-09 19:10:44 -06:00
bpf docs/bpf: add missing fsession attach type to docs 2026-04-12 12:42:38 -07:00
cdrom
core-api mm.git review status for linus..mm-stable 2026-04-15 12:59:16 -07:00
cpu-freq
crypto crypto/krb5, rxrpc: Fix lack of pre-decrypt/pre-verify length checks 2026-05-20 16:36:45 -07:00
dev-tools mm.git review status for linus..mm-stable 2026-04-15 12:59:16 -07:00
devicetree dt-bindings: ethernet: eswin: add optional TXD and RXD delay register offsets 2026-05-21 11:58:16 +02:00
doc-guide
driver-api We've finally gotten rid of the struct clk_ops::round_rate() code after months 2026-04-21 08:33:26 -07:00
edac
fault-injection
fb
features RISC-V updates for v7.1 2026-04-24 10:00:37 -07:00
filesystems \n 2026-04-27 16:45:39 -07:00
firmware-guide
firmware_class
fpga
gpu DRM Rust changes for v7.1-rc1 2026-04-01 07:32:05 +10:00
hid Docs: hid: intel-ish-hid: make long URL usable 2026-04-09 08:40:41 -06:00
hwmon docs: hwmon: sy7636a: fix temperature sysfs attribute name 2026-05-14 15:48:57 -07:00
i2c
iio
images
infiniband
input
kbuild Modules changes for v7.1-rc1 2026-04-14 17:16:38 -07:00
kernel-hacking
leds
litmus-tests
livepatch
locking
maintainer
mhi
misc-devices
mm mm.git review status for linus..mm-stable 2026-04-15 12:59:16 -07:00
netlabel
netlink net/handshake: Pass negative errno through handshake_complete() 2026-05-28 13:35:31 +02:00
networking ethernet: 3c509: Update documentation to match MAINTAINERS 2026-05-21 08:28:56 -07:00
nvdimm
nvme
pcmcia
peci
power
process docs: threat-model: don't limit root capabilities to CAP_SYS_ADMIN 2026-05-14 06:23:44 -06:00
rust docs: rust: general-information: use real example 2026-04-07 10:00:25 +02:00
scheduler sched_ext: Changes for v7.1 2026-04-15 10:54:24 -07:00
scsi
security ipe/stable-7.1 PR 20260413 2026-04-15 15:19:45 -07:00
sound ALSA: doc: cs35l56: Update path to HDA driver source 2026-05-15 08:53:34 +02:00
sphinx
sphinx-includes
sphinx-static
spi
staging net: remove ax25 and amateur radio (hamradio) subsystem 2026-04-23 10:24:02 -07:00
sunrpc/xdr
target
tee
timers
tools RTLA patches for v7.1: 2026-04-15 17:48:24 -07:00
trace Runtime Verification updates for 7.1: 2026-04-15 17:15:18 -07:00
translations Delete some obsolete networking code 2026-04-24 09:41:58 -07:00
usb
userspace-api rseq: Reenable performance optimizations conditionally 2026-05-06 17:40:27 +02:00
virt Documentation: kvm: update links in the references section of AMD Memory Encryption 2026-05-12 22:17:42 +02:00
w1
watchdog
wmi platform/wmi: Replace .no_notify_data with .min_event_size 2026-04-13 14:11:27 +03:00
.gitignore
.renames.txt Revert "drivers: net: 3com: 3c509: Remove this driver" 2026-05-21 08:28:56 -07:00
Changes
CodingStyle
Kconfig
Makefile
SubmittingPatches
atomic_bitops.txt
atomic_t.txt
conf.py
docutils.conf
index.rst
memory-barriers.txt
subsystem-apis.rst net: remove ISDN subsystem and Bluetooth CMTP 2026-04-23 10:24:02 -07:00