Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2639767ybh; Fri, 24 Jul 2020 19:27:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+3qI46LH0P0mizQu6DHwDVq+VGULHeuMQFU7403IHa4lQyl+7pZEgaoOsvF+OjCdVflae X-Received: by 2002:a17:906:2641:: with SMTP id i1mr12336958ejc.380.1595644025392; Fri, 24 Jul 2020 19:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595644025; cv=none; d=google.com; s=arc-20160816; b=cuhoWPVVnzmgab5Vpl/+tgpxODyqDMQRaIF1RzuJTvoJ1SlUT72mTqTTKjlNrJymlu /rtNPcBDL1QRZa4kliiAYeSbpQCe0oWgVOyopCkY9QaVL2XGenJ80wQwY5XTA7NYvqNj J65wZHFis5yvjEUDoDJmBxu7c4q1am4W/AsbnlODjB5HZIVOqG6+YdlBlUkX+R4wsv8v amUCqBcHypZ1w/5oXiHvfCU9bUHVFVShnXDJSwokBMn11N4avo4uUZSRYHuAOVgBE1vZ 9Aq5vPvksQoXrO0w9+cobCkgWriWdzq/Aoiy0idGAmNKqRxICSeQAmsyG5IYIN6st+6K usyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=cw4v5UbP8rf9/hx/7hgInOZuy8gDAmKmuRFVpxcNnWc=; b=Wk2jvtr0QftbNDtGdQ4CYTS5ylorWA7iwm+sRWOYU5iSiRFgBTfxRoE1H2d45exQcY DowvrFtBm5rQSRHqKt+e6JFZfiGrLtvtZvQcGyk8X8WjxDcH1Tu0++pDd1swd0ocqnEs DfZ0BXoCh2ClSlk+R0SR8Dwg8fcLCMdWvaZYJ4apQjUucjJ6+WVRuv+W7UdpNqtOqTLd idyCIxqETAj1d7ujs1G7i8OWgsSDXxIJYqY7s/1x6ZHZCPMN5qYJ4wLXrqeTPjfCBWCe wwQu22InIpHHw+1Nj8/jCEAv5v+iQrxXpboeKohBfUKxeXaRC1NMcdoBDDf2M1155Qno pDvQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c14si1733074edr.41.2020.07.24.19.26.42; Fri, 24 Jul 2020 19:27:05 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726666AbgGYC02 (ORCPT + 99 others); Fri, 24 Jul 2020 22:26:28 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8275 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726572AbgGYC02 (ORCPT ); Fri, 24 Jul 2020 22:26:28 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 6A873FF51C619BC27CBE; Sat, 25 Jul 2020 10:26:24 +0800 (CST) Received: from huawei.com (10.175.104.57) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Sat, 25 Jul 2020 10:26:20 +0800 From: Li Heng To: , CC: , , Subject: [PATCH] nbd: add missed destroy_workqueue when nbd_start_device fails Date: Sat, 25 Jul 2020 10:27:50 +0800 Message-ID: <1595644070-26293-1-git-send-email-liheng40@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.104.57] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org destroy_workqueue() should be called to destroy ndev->tx_wq when nbd_start_device init resources fails. Reported-by: Hulk Robot Signed-off-by: Li Heng --- drivers/block/nbd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index ce7e9f22..45e0a9f4 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -4,7 +4,7 @@ * * Note that you can not swap over this thing, yet. Seems to work but * deadlocks sometimes - you can not swap over TCP in general. - * + * * Copyright 1997-2000, 2008 Pavel Machek * Parts copyright 2001 Steven Whitehouse * @@ -1270,6 +1270,7 @@ static int nbd_start_device(struct nbd_device *nbd) error = device_create_file(disk_to_dev(nbd->disk), &pid_attr); if (error) { dev_err(disk_to_dev(nbd->disk), "device_create_file failed!\n"); + destroy_workqueue(nbd->recv_workq); return error; } set_bit(NBD_RT_HAS_PID_FILE, &config->runtime_flags); @@ -1291,6 +1292,7 @@ static int nbd_start_device(struct nbd_device *nbd) */ if (i) flush_workqueue(nbd->recv_workq); + destroy_workqueue(nbd->recv_workq); return -ENOMEM; } sk_set_memalloc(config->socks[i]->sock->sk); -- 2.7.4