From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0BDEA42C08 for ; Thu, 1 Jun 2023 22:01:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 08FF042B8B; Thu, 1 Jun 2023 22:01:02 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id C2DF0427F2 for ; Thu, 1 Jun 2023 22:00:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685649659; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZdSb3Y9DIN5IpBTx2+XHSjb1g7lwgstL0JQ4ZMU7O78=; b=OqJnBBS3cmi7DDKvQW6CODHaOh4/WVsStJOG/0V8oF+lny2SDgWOaHuLlGdm4RK4HjCA0l Py6caU3Qw1poBeFs9bdM2hnBvie8B0wepW0vAETUKyJBOzl7syEnwWMkjaSA1Z6F4/J1iU qefBmiKEO7IOMj8tpYvFmlJ8onWg79g= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-490-nG0yIU-mPkekTWRdzGU6Qg-1; Thu, 01 Jun 2023 16:00:55 -0400 X-MC-Unique: nG0yIU-mPkekTWRdzGU6Qg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 52790801585; Thu, 1 Jun 2023 20:00:55 +0000 (UTC) Received: from [10.39.208.25] (unknown [10.39.208.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0446A492B0A; Thu, 1 Jun 2023 20:00:52 +0000 (UTC) Message-ID: Date: Thu, 1 Jun 2023 22:00:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH] net/virtio-user: fix leak when initialisation fails To: David Marchand , dev@dpdk.org Cc: stable@dpdk.org, Chenbo Xia , Yuanhan Liu , Wenfeng Liu , Jianfeng Tan References: <20230413101041.1638478-1-david.marchand@redhat.com> From: Maxime Coquelin In-Reply-To: <20230413101041.1638478-1-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On 4/13/23 12:10, David Marchand wrote: > Caught with ASan. > If initialising a virtio_user port fails, we may leak the ifname passed > via a devargs. > > Fixes: 4214a1b493f2 ("net/virtio-user: support changing tap interface name") > Cc: stable@dpdk.org > > Signed-off-by: David Marchand > --- > drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c > index f46a131b5c..744f3c30d2 100644 > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c > @@ -696,11 +696,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues, > dev->frontend_features = 0; > dev->unsupported_features = 0; > dev->backend_type = backend_type; > - > - if (*ifname) { > - dev->ifname = *ifname; > - *ifname = NULL; > - } > + dev->ifname = *ifname; > > if (virtio_user_dev_setup(dev) < 0) { > PMD_INIT_LOG(ERR, "(%s) backend set up fails", dev->path); > @@ -794,6 +790,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues, > } > } > > + *ifname = NULL; > return 0; > > notify_uninit: Applied to dpdk-next-virtio/main. Thanks, Maxime