Skip to content

Commit 1828210

Browse files
Stanislav Fomichevkuba-moo
authored andcommitted
net: devmem: expose tcp_recvmsg_locked errors
tcp_recvmsg_dmabuf can export the following errors: - EFAULT when linear copy fails - ETOOSMALL when cmsg put fails - ENODEV if one of the frags is readable - ENOMEM on xarray failures But they are all ignored and replaced by EFAULT in the caller (tcp_recvmsg_locked). Expose real error to the userspace to add more transparency on what specifically fails. In non-devmem case (skb_copy_datagram_msg) doing `if (!copied) copied=-EFAULT` is ok because skb_copy_datagram_msg can return only EFAULT. Reviewed-by: David Ahern <[email protected]> Reviewed-by: Mina Almasry <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: Stanislav Fomichev <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a055d3b commit 1828210

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/ipv4/tcp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,9 +2818,9 @@ static int tcp_recvmsg_locked(struct sock *sk, struct msghdr *msg, size_t len,
28182818

28192819
err = tcp_recvmsg_dmabuf(sk, skb, offset, msg,
28202820
used);
2821-
if (err <= 0) {
2821+
if (err < 0) {
28222822
if (!copied)
2823-
copied = -EFAULT;
2823+
copied = err;
28242824

28252825
break;
28262826
}

0 commit comments

Comments
 (0)