Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2688713imj; Mon, 11 Feb 2019 07:03:47 -0800 (PST) X-Google-Smtp-Source: AHgI3IZP8rj9WkFyiu0KyLek1VjanR3uOY1piWG9BCOUvglKn3aaT3NRnWFfpuOBJuO+fmc1Yoyb X-Received: by 2002:a63:4913:: with SMTP id w19mr5376292pga.394.1549897427617; Mon, 11 Feb 2019 07:03:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897427; cv=none; d=google.com; s=arc-20160816; b=DxJmciPPD4mMuJ89nTI59qhKqg58yhRwSa+8SXgM1iKd8lf3BYlL88Vpetcm0wrzxU qNlWKFvJHsWfzJi7Fj03mZoLA3nAN7zPvotUGlh+QsoJcvcN2w/tHKNo8Tw8dfz3ZAG4 4YNrBGbyqZMQCYaPZ9iQmjVTwrHy1wwbgxUPNiTnySzbH0kUFgIrNTeK/G3JlmNBnx3y RXRHnnp7Hm6mYi/mIHPRk5gLL2/1SKAIZsyDSrLSfqcCp26CTzAqSUjnjXRdL9zUoguC rrvELeAexX06/AC9wWtpit4HjZwWr2oNDLqsnsV0n0mzsxknP/ygRwmn7V2BZo2JTYQL 5Weg== 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=GgW/SlgKtrwHPvntcCAXT3pzXVWqeHD9AOsFeI4d9Ow=; b=IROoYqElzaiyjxID4kxoqx/mPSabJJbW/P8yazXqyFVQTiclsyOq7MOpKzwkYGKwOx id6tdV09LUjKW+mVY66Dv+cZOowla3YbjLRFlaC7AMeS45/miYNzEi0IrM7nfDZGTbMz IRqi2GitoqBMP6bqtK6NyrJ5A0DLPW8rwgIzY5IHsJsfZiP6HY1N4BUikln+Z/+hCSos Gyh3M/dsqrX11l6XONU60glZwlMqrvIa+HZ0LfBTx2hEPPJnxd5Uy0mCSZCeWT5W68/8 Hc8cw2RyU10Adw36JkJhzniYcleiamYtk2cLDjyubGSVQapfWjed8QNoVutJbwQq5Lwd Wunw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MQ915OoN; 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 k19si2338964pfi.258.2019.02.11.07.03.24; Mon, 11 Feb 2019 07:03:47 -0800 (PST) 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=MQ915OoN; 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 S2390388AbfBKPCT (ORCPT + 99 others); Mon, 11 Feb 2019 10:02:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:50474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389628AbfBKPCS (ORCPT ); Mon, 11 Feb 2019 10:02:18 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 EEC48222A7; Mon, 11 Feb 2019 15:02:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897337; bh=d66DD7EgnL/Y+6u0zRkkaYRK3GzFHeqU38PwiQtrYb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MQ915OoNHOyz8la13op7dmR3hUpVnNGhsRH/Y4HmD2STHxhknPNoyqlJRp8O1PsFL bQGQy3Sx/2Xch9+5jCIShtUCW1CXYywruLAOMhjap8yDPe2HAcDW/M7vp55BxwKIkM u8IZUuK0jfc64Lpn0VzCIj/3G8nL9R6xhYOwO0Xg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenwen Wang , Jens Axboe , Sasha Levin Subject: [PATCH 4.14 151/205] gdrom: fix a memory leak bug Date: Mon, 11 Feb 2019 15:19:09 +0100 Message-Id: <20190211141838.222719515@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 093c48213ee37c3c3ff1cf5ac1aa2a9d8bc66017 ] In probe_gdrom(), the buffer pointed by 'gd.cd_info' is allocated through kzalloc() and is used to hold the information of the gdrom device. To register and unregister the device, the pointer 'gd.cd_info' is passed to the functions register_cdrom() and unregister_cdrom(), respectively. However, this buffer is not freed after it is used, which can cause a memory leak bug. This patch simply frees the buffer 'gd.cd_info' in exit_gdrom() to fix the above issue. Signed-off-by: Wenwen Wang Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/cdrom/gdrom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index ae3a7537cf0f..72cd96a8eb19 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c @@ -889,6 +889,7 @@ static void __exit exit_gdrom(void) platform_device_unregister(pd); platform_driver_unregister(&gdrom_driver); kfree(gd.toc); + kfree(gd.cd_info); } module_init(init_gdrom); -- 2.19.1