Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9980674ybi; Wed, 24 Jul 2019 13:28:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyh+LtAr5US8404QF7cLFlRWgW2WNUohhUoePrYl6mAkPYOLPpoBeO1NHcEgAZfROxtohse X-Received: by 2002:a17:902:b702:: with SMTP id d2mr90319560pls.259.1564000104667; Wed, 24 Jul 2019 13:28:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564000104; cv=none; d=google.com; s=arc-20160816; b=ezKfq56wOnxH4XCvvFGFgiqOIpcM+Cfj9JHUxWTvDWSeCcbu9S3L+biCL7xQrffNQ/ GZaovXM5wvuLLUi+joqj9LyHo3arER0/rHEMHL8o3Lr/1Vn3pxBVC7mjk7bPL9KOR/j5 nv6cz3jp85WNhJok15UhvdYhq0kSjdhruhqEM5SY10AIS42gtDPfaWdMcDQeUmSNhJCs 7NzB1n4ZyAp5pCN19NSo1vHO9t7jDjHYe1vTRy+ZCiczgfptTNnDbfFM7c/xqbljZztE j/6CKvtiBj0ltcqfkHg1X5TqO4gJfUjLOvLjiUgX6u4oFOSNQ4jy02igOWH5nv7zSalj 1cmg== 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=RDX9nLY/lCJ4AXiTk+ESmlzGIuhf/nQyspJdeHY4vnQ=; b=by1xHSYAuTVG73cALBPcFhMNhciD6wGlxY5/Z8sWSxe/T4n6SWhQlVGmE1yKDmr++S RisNXWK7WyB1Ynn4eVR4aPjchcaYjlAVAFFy1VytIIlAv6qEyjI5etAWbI+6t2XOR4XR 7CwWcdP0HTUebYwDkc+PzoIW5Czer3mKRsx3hYvdAgzqGqLDj/H9AWqqWnLMDYUpal2E bXhSyAsUHp9PTxJ52Y5/ovKlZ2KhGE6+wHEdZ7+IPYKHBdAhkCih0Cc9M4YR6UUP3nLf 4QQSGfjkRfiJnDNEmEz9yHH9wtSHmIE26r81h2Pm+l8F70DpBywz/GG5CoXyPB+8OCTc XUnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eAZbwRxE; 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 v141si19406609pgb.183.2019.07.24.13.28.10; Wed, 24 Jul 2019 13:28:24 -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=eAZbwRxE; 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 S2390187AbfGXU04 (ORCPT + 99 others); Wed, 24 Jul 2019 16:26:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:36300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388363AbfGXTgc (ORCPT ); Wed, 24 Jul 2019 15:36:32 -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 A9813214AF; Wed, 24 Jul 2019 19:36:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996992; bh=gQ0sO9cXgN/kznbncuXVuL2Tn5qrJBMk4NT5njuP8Pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eAZbwRxE5GSD35uJulipPZ85je8OoZp1RnpRBYbImuFHTH3wisHTO1rGyYPsVrEt+ pnmRdSnQI8GGxucWJWTD+X4RUq6oZBrVtpw2uP+iuzpK1tHIBTASU8/zZloEYO5meL 9b0tzVGiusgKU+zNR2KJ5MtMGIfvpu+YTuRIyIyA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Coly Li , Jens Axboe Subject: [PATCH 5.2 285/413] bcache: destroy dc->writeback_write_wq if failed to create dc->writeback_thread Date: Wed, 24 Jul 2019 21:19:36 +0200 Message-Id: <20190724191756.658501267@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@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 @@ -834,6 +834,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); } dc->writeback_running = true;