Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756770AbcCBBOh (ORCPT ); Tue, 1 Mar 2016 20:14:37 -0500 Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:34623 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752799AbcCAXzl (ORCPT ); Tue, 1 Mar 2016 18:55:41 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=SG7DdCPYmkCqMBMAD+FybXpvDjW78jHgkGNHCGIRFJfetPiuJZ8Qd235IM7dUddIPE8RHfSHPNxE 6WuWSWYKLy/GFugmXoVfOlN6Ss1x6Ozn2Cl43bfeoogx0fXdGcxpzl/c1qlgGwP4rr2FXZ+zTRZE hOeQPWuFNptNQUcNgow=; From: Greg Kroah-Hartman Subject: [PATCH 4.4 065/342] bcache: fix a leak in bch_cached_dev_run() X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , Al Viro , Joshua Schmid , Eric Wheeler , Kent Overstreet , Jens Axboe Message-Id: <20160301234530.099781748@linuxfoundation.org> In-Reply-To: <20160301234527.990448862@linuxfoundation.org> References: <20160301234527.990448862@linuxfoundation.org> X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.8910b97516074355a322b1cefad21ecd X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:54:05 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 985 Lines: 34 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Al Viro commit 4d4d8573a8451acc9f01cbea24b7e55f04a252fe upstream. Signed-off-by: Al Viro Tested-by: Joshua Schmid Tested-by: Eric Wheeler Cc: Kent Overstreet Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/md/bcache/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -849,8 +849,11 @@ void bch_cached_dev_run(struct cached_de buf[SB_LABEL_SIZE] = '\0'; env[2] = kasprintf(GFP_KERNEL, "CACHED_LABEL=%s", buf); - if (atomic_xchg(&dc->running, 1)) + if (atomic_xchg(&dc->running, 1)) { + kfree(env[1]); + kfree(env[2]); return; + } if (!d->c && BDEV_STATE(&dc->sb) != BDEV_STATE_NONE) {