Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3004877yba; Sat, 11 May 2019 01:31:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvhtoM9depvTVqml/0qyTOVgjsj/bZEg1XvxCvGNdoY1+YPFPilq6lfZYY53UCYSidQap9 X-Received: by 2002:a17:902:be15:: with SMTP id r21mr18661245pls.340.1557563503692; Sat, 11 May 2019 01:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557563503; cv=none; d=google.com; s=arc-20160816; b=MfTpjxPkbSpLG9qRbzCQvXkSLkTsRpRhfWCneMTnMa1WQvtzGu9KeC17ogUntwXxNy 9UlBH/V2f+lZRLY3CvPHL+kUhszD5O4Hi7/T1pRVlWBNOko+VfprZ8/dtybRHWmbLl/F Y2s760hHLlT+AEVZBfu0VLEZGEONXq5B0T+D8Qk6/j6MjwYrz7vtMOvrDebfWch2jJuj f64vsdnnY1szMvcVgXQNjoQEDVUWHiffirJMzCQ6uS1NKAmHz/U5OcY0oggnIf6HHvwD ngtP/hcSXjMRVN36Ad1Hi6byyk83k5msGjbWcTv6wezdgOLibpAM5q10JvJEW09XBiEW JXmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=SdcIkrLxlvfbUBZr0Qh6I0nrjoSmAfdYaMwVRnCWFzs=; b=g4ci3HPhoMRVhIoKOtiL7teA8Hbcv9/cGUt1qvkz9mOxzP0TMPzDOb7a9bnqu6J8fx CV3OQJC7Sb2OiLhLnle3X/0epJtBUPV5KaTSjR1AdMTlgX4hr5aZrSDk41kf7Kr2BUW3 aN6CcTU7IHbtRKyvB226GH5oaUDLoQ9vMXzAofmkb7vTK4/5mnbJCk9qUXHzzRfPDr5S JtaF3iH/BK7BtUWXE+XhnTJDZ5Nnf07+zLGiJzUmyz6tQrnHU8CO+zLjd8uEoVlmE2a2 taoSQgk8Y/EP9Ry5Nxkgn3rwQxOFWkiymmtUaTHfufxnH8O9Gu0mkt641e5aYgeI/3mk 4mZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si9963153plk.368.2019.05.11.01.31.15; Sat, 11 May 2019 01:31:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728477AbfEKI1L (ORCPT + 99 others); Sat, 11 May 2019 04:27:11 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:38888 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728407AbfEKI1K (ORCPT ); Sat, 11 May 2019 04:27:10 -0400 Received: by mail-wr1-f67.google.com with SMTP id v11so10120400wru.5 for ; Sat, 11 May 2019 01:27:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=SdcIkrLxlvfbUBZr0Qh6I0nrjoSmAfdYaMwVRnCWFzs=; b=fhhF2wzl2477G/b7P519YSy23v3d9JT9j4y2DufUrrRki88dks45+xHbNrj0McRYYl g/KulLauTiX5hMyXRMHSj8YGtlGN7FUbB2CMtQ4hyidoMlQ59mS8mFfV7zYsG8Q9F7wn 5i92NQIYVrBO7FHTr8xoxl++mJT+eHv0ES675zZ4Yr9t5x10eI8EZWldqv5g9EWIbmlK Lu5gWhyu5mlH8wsT0CV/D9VfGDW3R8Pb3uiqrZGbSC0aBlHhgIPeW84YOr0jjKZaAWo4 o+w0GruyZ+l6g7GazQEpbkPCi7bKOv3cOgJ/K3J3yAZEnxD5M6SBryFK4r0fQacK82qG p/4w== X-Gm-Message-State: APjAAAXVhJxnVUTDtyW9+cTF/zZOifAsCG6LsjydTKv0Su8f/gBLn4U3 gtliK/aGgaUSNSTz70nPx/YElg== X-Received: by 2002:a5d:49c1:: with SMTP id t1mr10376967wrs.247.1557563228981; Sat, 11 May 2019 01:27:08 -0700 (PDT) Received: from steredhat.homenet.telecomitalia.it (host151-251-static.12-87-b.business.telecomitalia.it. [87.12.251.151]) by smtp.gmail.com with ESMTPSA id g10sm8043541wrw.80.2019.05.11.01.27.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 May 2019 01:27:08 -0700 (PDT) Date: Sat, 11 May 2019 10:27:05 +0200 From: Stefano Garzarella To: David Miller Cc: netdev@vger.kernel.org, mst@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, stefanha@redhat.com, jasowang@redhat.com Subject: Re: [PATCH v2 2/8] vsock/virtio: free packets during the socket release Message-ID: <20190511082705.t62d3rfbgibc4zxi@steredhat.homenet.telecomitalia.it> References: <20190510125843.95587-1-sgarzare@redhat.com> <20190510125843.95587-3-sgarzare@redhat.com> <20190510.152008.1902268386064871188.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190510.152008.1902268386064871188.davem@davemloft.net> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 10, 2019 at 03:20:08PM -0700, David Miller wrote: > From: Stefano Garzarella > Date: Fri, 10 May 2019 14:58:37 +0200 > > > @@ -827,12 +827,20 @@ static bool virtio_transport_close(struct vsock_sock *vsk) > > > > void virtio_transport_release(struct vsock_sock *vsk) > > { > > + struct virtio_vsock_sock *vvs = vsk->trans; > > + struct virtio_vsock_buf *buf; > > struct sock *sk = &vsk->sk; > > bool remove_sock = true; > > > > lock_sock(sk); > > if (sk->sk_type == SOCK_STREAM) > > remove_sock = virtio_transport_close(vsk); > > + while (!list_empty(&vvs->rx_queue)) { > > + buf = list_first_entry(&vvs->rx_queue, > > + struct virtio_vsock_buf, list); > > Please use list_for_each_entry_safe(). Thanks for the review, I'll change it in the v3. Cheers, Stefano