Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2625102yba; Fri, 10 May 2019 15:22:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkNj25VAwO9McYIKX4rksjGwNixLvQUp5yx1LS/3nxWt6v0+sq3iBSmVothNI+AsuUpdZ5 X-Received: by 2002:a63:e24:: with SMTP id d36mr16821448pgl.80.1557526947884; Fri, 10 May 2019 15:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557526947; cv=none; d=google.com; s=arc-20160816; b=jn7UJ0iqW2WqtRSexDIj2oC2LjFyo2EINp9Ltr7+iPMDzaKgIG5FrbYfdtzCK6L+SL UTPmL/YR1vp8thnsgpS8ZW42T7jXQ4GkJoH/qJgvrbgn8RXKy7reI4nBbhVkrA3cu/Jo SuhGNZzYJInRKKubaXvIoDK3QvvbMnqd9es3YpovflZNND49zcrAY4uOFWJ0u4WAs0bb Tq4dBoJ6jYsIhQNcm+TfUsPRNoTyaALtzM5th0/RaeJP6R+H06ZEhEJPmB/8oPJ9xec5 ohqWXQDWzfNiVys4QVlCj1/ovR1RhdW29Uf/wscOGGU1pDsSAkrS7zz+YFIF6jT+AhlT 0GhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=sgw5wia4pfYT5h9DxNtok3ySIgYl9VwTLrsusy0hZLE=; b=orywDsmTvhdpkE75tANV94tIKelzW4KJ2qSKmwU4TNiBH2fBeSxZ/BgbLJaX3j65se aonON8LudqYmoAR8A82d0OoLVhkQe2eXoenCI2C2pCx9FNFVu+qfJ8C960w9ib2gaY9e 17BqmJUsUnSuLTg3/8gvrnnEBFjFV4B15/7NYqLZNbeeXy3KSaWag3u32+JK86yzrA02 3x2GCe5qs3n0XuGD77BOzt3fZRctorwDrtZ1CtsMVU94DcxCeON2jnkMcFEX6k2QEcpu 6laZsfgnA9o43aXVhWa82SP++bdn4Ep2UvV/gy3iMx1wEg7FKar0mqnLczGPBusjnG+7 +nZg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o24si9513276pgh.375.2019.05.10.15.22.11; Fri, 10 May 2019 15:22:27 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728196AbfEJWUK (ORCPT + 99 others); Fri, 10 May 2019 18:20:10 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:58812 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727703AbfEJWUK (ORCPT ); Fri, 10 May 2019 18:20:10 -0400 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::3d8]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 619BA133E975E; Fri, 10 May 2019 15:20:09 -0700 (PDT) Date: Fri, 10 May 2019 15:20:08 -0700 (PDT) Message-Id: <20190510.152008.1902268386064871188.davem@davemloft.net> To: sgarzare@redhat.com 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 From: David Miller In-Reply-To: <20190510125843.95587-3-sgarzare@redhat.com> References: <20190510125843.95587-1-sgarzare@redhat.com> <20190510125843.95587-3-sgarzare@redhat.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 10 May 2019 15:20:09 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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().