From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752531AbdJFUcT (ORCPT ); Fri, 6 Oct 2017 16:32:19 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:35786 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751484AbdJFUcS (ORCPT ); Fri, 6 Oct 2017 16:32:18 -0400 Subject: Re: [PATCH v4 02/13] xen/pvcalls: implement frontend disconnect To: Stefano Stabellini References: <1505516440-11111-1-git-send-email-sstabellini@kernel.org> <1505516440-11111-2-git-send-email-sstabellini@kernel.org> <7f24ec66-d370-5f2f-3c6a-8e949c8ed074@oracle.com> <4aa02396-b2b6-dd89-b83c-32e6919c8f18@oracle.com> Cc: xen-devel@lists.xen.org, linux-kernel@vger.kernel.org, jgross@suse.com, Stefano Stabellini From: Boris Ostrovsky Message-ID: <5d477777-28c2-af84-9b92-1a89d3f51067@oracle.com> Date: Fri, 6 Oct 2017 16:31:11 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/06/2017 04:29 PM, Stefano Stabellini wrote: > On Fri, 6 Oct 2017, Boris Ostrovsky wrote: >> On 10/06/2017 01:51 PM, Stefano Stabellini wrote: >>> On Wed, 20 Sep 2017, Boris Ostrovsky wrote: >>>>> + >>>>> +struct pvcalls_bedata { >>>>> + struct xen_pvcalls_front_ring ring; >>>>> + grant_ref_t ref; >>>>> + int irq; >>>>> + >>>>> + struct list_head socket_mappings; >>>>> + struct list_head socketpass_mappings; >>>>> + spinlock_t socket_lock; >>>>> + >>>>> + wait_queue_head_t inflight_req; >>>>> + struct xen_pvcalls_response rsp[PVCALLS_NR_REQ_PER_RING]; >>>>> +}; >>>>> +static struct xenbus_device *pvcalls_front_dev; >>>>> +static atomic_t pvcalls_refcount; >>>> Should the refcount be per back/frontend? >>> Yes it is, but only one back/frontend connection is supported by the >>> frontend. I can add a comment. >> Since it's per backend connection --- shouldn't it be part of struct >> pvcalls_bedata? > struct pvcalls_bedata is allocated with kzalloc. To protect accesses to > it, pvcalls_refcount needs to be outside of it. Oh, yes, of course. I think you also might be accessing it after the struct is freed. Nevermind then. -boris