Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2657369imj; Mon, 11 Feb 2019 06:34:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IYqToLu8er53S9QwoqmRLR6qVOIBBJ+uJOd811wRyAo0MppJMJ1ZNsCGVrJe++2Sq8W+WuH X-Received: by 2002:a63:1204:: with SMTP id h4mr33762575pgl.51.1549895692184; Mon, 11 Feb 2019 06:34:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895692; cv=none; d=google.com; s=arc-20160816; b=dwaKChkTbyn5ipworTuA4XPvP1sGydq1aUPRBpomNQ7tQJW/LjuCC3Et/AuImvOMWn n9pwbbn+6XOBtr36ClzW+Ws7Jb1aYQ+WNHR1ZiD46zlXldl65rvb8h24PXCyrw7EJ5E8 HZFdryUMt297B+JU/l/MYt0KFZsL16Vf0GjzGJC560eRC1NFk4NSzNFPq1G4thqNTT36 Ooo2j5GAxi3QLHrN/PcHG/XxaYcdb7xWI2cBDX0i9ELTlQ7cp3OZPN1I1KMD1zwuECkx BqzvYA68E94g9E2MO89M2f8fS5qbrLcR8tcR++uyTwRs/uDlcjP8OBd7bR7/gtYHnGYH 7lWQ== 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=cfH0/1zJZiHsb081wxVCg+Q1GY0MDDrHHu/41Niei6g=; b=xj7LxFNwI5etMpSwC3bakX63ZpfyouP2fSeqzbI4bYbxa/uiY+6vJmg6XlTAU7AYjk sIBu7qbdjRO8JpebooKVXRBfCfToXogFCy5q8UPiPN0XiZVR+5td83vcNMSRRbMXyw7K 4n50ARtnaWE92ivvoEngur3BYEm4GrZ55o1Ola3d8PdzLgoLFa4VVOzU9FmqTuPb0tXw Lj9USgs8+X235Q8CKawa3A3GV7B14pgSFKZLQh6hVLhg2Dr8kphv2plTKUOMdvyKv60/ EKTSpA9Q3DC62ApSpNfP7IKU/S7wtMi2M9nAyk84AEOeQE9ufy7zPqNL9XhCj6u7wXWY +Z4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BqAZ7qTE; 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 d19si9661129pgg.314.2019.02.11.06.34.34; Mon, 11 Feb 2019 06:34:52 -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=BqAZ7qTE; 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 S1730772AbfBKOeA (ORCPT + 99 others); Mon, 11 Feb 2019 09:34:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:41946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730732AbfBKOd4 (ORCPT ); Mon, 11 Feb 2019 09:33:56 -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 77698204EC; Mon, 11 Feb 2019 14:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895636; bh=yyUylN4xcwBqmaik1W2T4pY5Lg6XQO75ZYDXQMZRNV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BqAZ7qTE2ANh2vLNuWENnku2vfm12HCz6IP6TufXUgDigJ6HeXg+uMDtUDMtZDhUM GGb5eG0siAan/3ImoiVUgkumGeMcmhDxlMgySnY5Cemvh9vRVYpdzxNeahvtQu1RVo BW0OB55OnZBzNHk0Pqq54PtiuxEhXbVCC+ReN+DQ= 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.20 271/352] gdrom: fix a memory leak bug Date: Mon, 11 Feb 2019 15:18:18 +0100 Message-Id: <20190211141904.232262469@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@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.20-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 a5b8afe3609c..f8b7345fe1cb 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c @@ -873,6 +873,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