> static inline int sk_peek_offset(struct sock *sk, int flags) > { > - if (unlikely(flags & MSG_PEEK)) { > - s32 off = READ_ONCE(sk->sk_peek_off); > - if (off >= 0) > - return off; > - } > + if (unlikely(flags & MSG_PEEK)) > + return READ_ONCE(sk->sk_peek_off); > > return 0; > }
I noticed too late that this function is used in one case where the result is not blindly passed to __skb_try_recv_from_queue. The AF_UNIX stream case will need a floor on its offset. - skip = sk_peek_offset(sk, flags); + skip = max(sk_peek_offset(sk, flags), 0);