[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpUawKFmqL-XLMwoBjSTAwj+NLhZ0Su1r-W+6U_fttZp9Q@mail.gmail.com>
Date: Mon, 17 May 2021 21:46:24 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: John Fastabend <john.fastabend@...il.com>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, Jiang Wang <jiang.wang@...edance.com>,
Xiongchun Duan <duanxiongchun@...edance.com>,
Dongdong Wang <wangdongdong.6@...edance.com>,
Cong Wang <cong.wang@...edance.com>,
Daniel Borkmann <daniel@...earbox.net>,
Jakub Sitnicki <jakub@...udflare.com>,
Lorenz Bauer <lmb@...udflare.com>
Subject: Re: [Patch bpf-next v3 02/10] af_unix: implement ->read_sock() for sockmap
On Mon, May 10, 2021 at 10:34 PM John Fastabend
<john.fastabend@...il.com> wrote:
> > +static int unix_read_sock(struct sock *sk, read_descriptor_t *desc,
> > + sk_read_actor_t recv_actor)
> > +{
> > + int copied = 0;
> > +
> > + while (1) {
> > + struct unix_sock *u = unix_sk(sk);
> > + struct sk_buff *skb;
> > + int used, err;
> > +
> > + mutex_lock(&u->iolock);
> > + skb = skb_recv_datagram(sk, 0, 1, &err);
> > + if (!skb) {
> > + mutex_unlock(&u->iolock);
> > + return err;
>
> Here we should check copied and break if copied is >0. Sure the caller here
> has desc.count = 1 but its still fairly fragile.
Technically, sockmap does not even care about what we return
here, so I am sure what you suggest here even makes a difference.
Also, desc->count is always 1 and never changes here.
Thanks.
Powered by blists - more mailing lists