diff options
| author | Steve Grubb <sgrubb@redhat.com> | 2026-09-10 13:53:15 -0400 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-09-16 19:00:26 -0700 |
| commit | 65734bbe4a9fb78fca55b27c969656bfad1c7dc3 (patch) | |
| tree | d8dfd94177228620e4f53d32a5b08cc527eb5e65 /include/linux/debugobjects.h | |
| parent | c5faf1d4df8f5be608267dfa87cc819dde0bef97 (diff) | |
net: preserve socketpair output on setup failure
socketpair() writes the reserved descriptor numbers to userspace before
creating the sockets and their file objects. A later failure therefore
leaves a modified caller's array despite returning an error, contrary to
POSIX. For example, socketpair(AF_UNIX, SOCK_STREAM, -1, fd) returns
EPROTONOSUPPORT but replaces the array's sentinel values with unused fd
numbers.
Defer the output stores until both file objects have been created, before
installing either descriptor. If a store faults, drop both file references
before releasing the reserved descriptor slots. Keep the early descriptor
reservation and the existing setup-failure cleanup paths.
In practice, I doubt anyone notices. But this aligns with the expected
behavior
Signed-off-by: Steve Grubb <sgrubb@redhat.com>
Link: https://patch.msgid.link/JyK226D0S5CWGUpAC4MO4A@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux/debugobjects.h')
0 files changed, 0 insertions, 0 deletions
