udp: fix linear skb reception with PEEK_OFF
copy_linear_skb() is broken; both of its callers actually expect 'len' to be the amount we are trying to copy, not the offset of the end. Fix it keeping the meanings of arguments in sync with what the callers (both of them) expect. Also restore a saner behavior on EFAULT (i.e. preserving the iov_iter position in case of failure): The commit fd851ba9 ("udp: harden copy_linear_skb()") avoids the more destructive effect of the buggy copy_linear_skb(), e.g. no more invalid memory access, but said function still behaves incorrectly: when peeking with offset it can fail with EINVAL instead of copying the appropriate amount of memory. Reported-by: NSasha Levin <alexander.levin@verizon.com> Fixes: b65ac446 ("udp: try to avoid 2 cache miss on dequeue") Fixes: fd851ba9 ("udp: harden copy_linear_skb()") Signed-off-by: NAl Viro <viro@ZenIV.linux.org.uk> Acked-by: NPaolo Abeni <pabeni@redhat.com> Tested-by: NSasha Levin <alexander.levin@verizon.com> Acked-by: NEric Dumazet <edumazet@google.com> Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Showing
想要评论请 注册 或 登录