Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946220AbbEVQYb (ORCPT ); Fri, 22 May 2015 12:24:31 -0400 Received: from mail-ig0-f171.google.com ([209.85.213.171]:36148 "EHLO mail-ig0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946079AbbEVQY3 (ORCPT ); Fri, 22 May 2015 12:24:29 -0400 Message-ID: <555F583B.1010309@android.com> Date: Fri, 22 May 2015 09:24:27 -0700 From: Mark Salyzyn User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Hannes Frederic Sowa CC: linux-kernel@vger.kernel.org, "David S. Miller" , Al Viro , David Howells , Ying Xue , Christoph Hellwig , netdev@vger.kernel.org Subject: Re: net/unix: sk_socket can disappear when state is unlocked References: <1432225541-28498-1-git-send-email-salyzyn@android.com> <1432288230.3364.23.camel@redhat.com> <555F4267.30704@android.com> <1432308915.28081.10.camel@redhat.com> In-Reply-To: <1432308915.28081.10.camel@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 846 Lines: 18 On 05/22/2015 08:35 AM, Hannes Frederic Sowa wrote: > I still wonder if we need to actually recheck the condition and not > simply break out of unix_stream_data_wait: > > We return to the unix_stream_recvmsg loop and recheck the > sk_receive_queue. At this point sk_receive_queue is not really protected > with unix_state_lock against concurrent modification with unix_release, > as such we could end up concurrently dequeueing packets if socket is > DEAD. sock destroy(sic) is called before sock_orphan which sets SOCK_DEAD, so the receive queue has already been drained. Sincerely -- Mark Salyzyn -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/