On Wed, Nov 11, 2015, at 20:28, Eric Dumazet wrote:
> On Wed, 2015-11-11 at 20:14 +0100, Hannes Frederic Sowa wrote:
> > On Wed, Nov 11, 2015, at 19:58, Eric Dumazet wrote:
> 
> > Can you elaborate?
> > 
> > I use tail as a cookie and check if we already tried to append to the
> > same tail skb with skb_append_pagefrags. If during allocation, which we
> > do outside of the locks, a new skb arrives, we take that and try to
> > append again (and free the old skb), to correctly not create any
> > reordering in the data stream.
> > 
> > You think that tail could be reused in the meanwhile?
> 
> Hmmm, there is some funky stuff at least.
> 
> Are you sure the __skb_queue_tail(&other->sk_receive_queue, newskb)
> is appropriate ?
> 
> (Why not locking sk_receive_queue is safe ?)

We hold the other's state lock at that time.

But I see another problem in unix_stream_read_generic:


                /* Mark read part of skb as used */
                if (!(flags & MSG_PEEK)) {
                        UNIXCB(skb).consumed += chunk;

                        sk_peek_offset_bwd(sk, chunk);

                        if (UNIXCB(skb).fp)
                                unix_detach_fds(&scm, skb);

                        if (unix_skb_len(skb))
                                break;

                        skb_unlink(skb, &sk->sk_receive_queue);
                        consume_skb(skb);

                        if (scm.fp)
                                break;


The skb_unlink happens solely on the list lock and not on the state lock
of the sk, so it is not synchronized to the other locks.

Bye,
Hannes
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to