Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1718147pxb; Fri, 24 Sep 2021 10:19:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmQWch2xrPDnwyBFmkyYiuabI4Cx4CikZQ9XljWGSEeek+9Upv7D/hcOYgpBwUi6nlIuNX X-Received: by 2002:a05:6e02:1aa6:: with SMTP id l6mr9190745ilv.231.1632503953798; Fri, 24 Sep 2021 10:19:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632503953; cv=none; d=google.com; s=arc-20160816; b=H8sgD462t9BZ4qS1w2yhPGPom2Y3nX2FWvdDb8W8ORwWFadjUGmFRl88FVMJHrsu9W zEeIUj5aopYBRAjrhc3jA0YUNLiJHJvgdFMuszA0g9KkTz7WxqBdWI5rFg4yr1CIA97K 0NZNIg82P/VB6VvNz8/Hmm6okXUIu/hOPWe5G3LrwiCYm+5EL4jWtVtTaD0pUafghUk5 LJRQLaLGi4V6YFap3T4tpPRHfEgSmXPeDCbYhzHHQI+CShquSUqRrk2D+LBwL8OckYZp S/mPhNEt/CauCFsYIakxUXLoV27Gbyqjzb1bMCFBGwyBs7NyON3P6ONobsIrPhZCkwPy /Pmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HCWlPKf3l7kD76hW9tW0OXR5pC7Ny8k7ZeHs+yD5bUM=; b=pFEaT1vEQ0Y9V1K+SWnD6eOKTO9oh5jtshiUruNx6mhpBFQZUlgPgpKS4JQmAtb6UW bhjZebbFmRn6Rt2yC8vAvO2CxnhiSXkTLt0hPRosurxso2rMWXSb0Ug9PQSjbjvTvnsR 3zaftjdXqWk4Qc+PavRz3EPhcC5q/wdXWcHszQZgFXsFe1rzYtT50D94o5TS3EbmVhJq So9aJtU4aZ1KMnAi7akgkjgV1UX6ewvoEVXig8YoMIIQW3UIykztSPE7AjxfqcZj5JK0 vg3bn93k/awYE0TBffIlafmcNMFHOjwXZb0ok4tuB8wiZlyE1Td+bZKKSfmyjMo4vNZr PZyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZVujgrmd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 187si11314559jaf.20.2021.09.24.10.19.02; Fri, 24 Sep 2021 10:19:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZVujgrmd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344514AbhIXMvl (ORCPT + 99 others); Fri, 24 Sep 2021 08:51:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:44056 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344019AbhIXMuM (ORCPT ); Fri, 24 Sep 2021 08:50:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2194161263; Fri, 24 Sep 2021 12:48:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632487693; bh=ouAl9kHT6zBoIB9XgltFj93veoII8CkLD8fdgp3Ux2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZVujgrmduN5KqDaf8ys1FSQtWfjlzr+JRTPoxx9z6gUfesVJMAEdAXvJ4S9eE249F frQhQuRqkqZKWlPsUqUcLIkCmVjkqFDOF1moX6XQIo3fRmp0xCrgBNZyr1gbvwiLtB 1SC4kqZXMvo07vh+sbwCajy5IABjg1uieS0aA9kI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xie Yongji , Dominique Martinet Subject: [PATCH 4.19 11/34] 9p/trans_virtio: Remove sysfs file on probe failure Date: Fri, 24 Sep 2021 14:44:05 +0200 Message-Id: <20210924124330.333180805@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210924124329.965218583@linuxfoundation.org> References: <20210924124329.965218583@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xie Yongji commit f997ea3b7afc108eb9761f321b57de2d089c7c48 upstream. This ensures we don't leak the sysfs file if we failed to allocate chan->vc_wq during probe. Link: http://lkml.kernel.org/r/20210517083557.172-1-xieyongji@bytedance.com Fixes: 86c8437383ac ("net/9p: Add sysfs mount_tag file for virtio 9P device") Signed-off-by: Xie Yongji Signed-off-by: Dominique Martinet Signed-off-by: Greg Kroah-Hartman --- net/9p/trans_virtio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -620,7 +620,7 @@ static int p9_virtio_probe(struct virtio chan->vc_wq = kmalloc(sizeof(wait_queue_head_t), GFP_KERNEL); if (!chan->vc_wq) { err = -ENOMEM; - goto out_free_tag; + goto out_remove_file; } init_waitqueue_head(chan->vc_wq); chan->ring_bufs_avail = 1; @@ -638,6 +638,8 @@ static int p9_virtio_probe(struct virtio return 0; +out_remove_file: + sysfs_remove_file(&vdev->dev.kobj, &dev_attr_mount_tag.attr); out_free_tag: kfree(tag); out_free_vq: