Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10424199ybi; Wed, 24 Jul 2019 22:59:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXCEJwYGa8RATZNnF2p9oZVEPqyV64KPXkTCY29S2xw+8ZEZvmuKxwXf1biKvogwfJCM3Y X-Received: by 2002:a65:52c5:: with SMTP id z5mr70708316pgp.118.1564034360041; Wed, 24 Jul 2019 22:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034360; cv=none; d=google.com; s=arc-20160816; b=r3sdYuO+3HnRKHJTrPxDwptwD8A+DvdN7bAXA0tZQWW8mxF074Pke88PRNGcySBLr9 XMpmVDO5kCQK0+TYbuU1Gmo3xDieD5KyIbE1CU7lwYbFKrwCccsFK7xhDHs2haoBpoIH t1fTu4H+7GYCv8lpMG7h8TtPf75IW6KB1uV0K6aIrxV9qquSDaHh55eA7Z5LnWhZYCAv 79UFavOyFLJg6+7bl18w0C0bHeotnKGv9ep/TmNFq9uzD+rkYtNyHPtJ+x5cfWUmmEjt gfmo5D3miL/9XuedsuDusCBIJLbbsLBbm9sS6Uk9HwLCKO8/F4hMwzwLwZ8yOnjC0Qx5 WtvQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TxjPh5YkGEPDqO6s1sFTBPqjeD0ez7yJ3EUE5V6+Rrk=; b=gVhJ4ZejyZjv/1jzkDLAHFxqm6SFAgZ+k4UD04bTTcJ+fi0IV6Bvqht3hTeKbyFowe VRk45qUDDHYUnhKxB50i3z9QhPcDdd8qFt1grRwoyLHj5rPY+OCaaOwg7+j0bzYYC5PX eU2ts4PCEU+lOh2wrOrx8zPF53QSROUTgcekNwIo43c9d2ibgimZ1bCEQX27/VHeopMt KXQYzHuiwyxfLgTrmskYfnUUbrW2IyM5GQWriDp3V9jPtRsabU/denxwC49XaDltYBSd VFIrQcoVz9sle+WTUqwf1Gkog06/s8gTzmnMshoY3OhljCuxX2flCb0YVKGHN4y4vHYn xYFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WJWmQpFs; 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 c13si15413055pfr.36.2019.07.24.22.59.05; Wed, 24 Jul 2019 22:59:20 -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; dkim=pass header.i=@kernel.org header.s=default header.b=WJWmQpFs; 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 S2404879AbfGYFnF (ORCPT + 99 others); Thu, 25 Jul 2019 01:43:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:57994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390984AbfGYFnB (ORCPT ); Thu, 25 Jul 2019 01:43:01 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CC94F21850; Thu, 25 Jul 2019 05:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033381; bh=BXbGsXOa9VO8OWmm5pyho2tcOhg7BywU2TkvD1p7kPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WJWmQpFs+l9IWFSmHy0I1fsbCWDB94TurRUDL725SxNnMRZ2qTsqojgxYaxHMTzLH qTgqygAO/1Kr88OiRFe+ae/CuimzvOrAaFbJPQI3rEUzQvkxq9Fw/afa9A2e2SIeqX ARo2EdGHIOGUunA7KGWnGQKUG/CIxveMkZKiQySI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Coly Li , Jens Axboe Subject: [PATCH 4.19 188/271] bcache: destroy dc->writeback_write_wq if failed to create dc->writeback_thread Date: Wed, 24 Jul 2019 21:20:57 +0200 Message-Id: <20190724191711.234053950@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Coly Li commit f54d801dda14942dbefa00541d10603015b7859c upstream. Commit 9baf30972b55 ("bcache: fix for gc and write-back race") added a new work queue dc->writeback_write_wq, but forgot to destroy it in the error condition when creating dc->writeback_thread failed. This patch destroys dc->writeback_write_wq if kthread_create() returns error pointer to dc->writeback_thread, then a memory leak is avoided. Fixes: 9baf30972b55 ("bcache: fix for gc and write-back race") Signed-off-by: Coly Li Cc: stable@vger.kernel.org Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/md/bcache/writeback.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -807,6 +807,7 @@ int bch_cached_dev_writeback_start(struc "bcache_writeback"); if (IS_ERR(dc->writeback_thread)) { cached_dev_put(dc); + destroy_workqueue(dc->writeback_write_wq); return PTR_ERR(dc->writeback_thread); }