Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5067443pxb; Mon, 15 Feb 2021 08:39:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuLQFURRXVL1coDVgnEHJhazW8mXZQgRj6rmkxKcBiL1Xjwl2jWeiUJrXrFvYHQlcLZKRy X-Received: by 2002:a17:906:7697:: with SMTP id o23mr9019767ejm.292.1613407145489; Mon, 15 Feb 2021 08:39:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613407145; cv=none; d=google.com; s=arc-20160816; b=zfAzsshoBVIdGFr82ZZMDdAPEIOVskNpkluUS8uoBEuXt4XU4X/8IeDg4SvoAVEyyO Sm3kCSzz64/G5A7oQPYvkvpWRZHsAYkQ4kzyOVFqY7b5SJJv7lDofNk2o2HlrpSiJA67 TYhYBLDj/8Yf74Ois7oaUDwzN0GxfQcWezjaLeymvNJchhITL7PafgQ3wHwihqIHkxUa DbBENX2wxs9Pv5P12MWaEjhK9sQ32SYg/i2Q6jnTM2Z84gWGMrIPmgZMjns2EXENBpxD HARba+C+N+wX2B7oSzo3REvUwDsEWViN4BPjFIomf2Jk9hL36/Jrih20FHAV4PV2MZbN 2YKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g29lc30ltWAHE/fh4pDAyImwJ4IMUKhR1Koa6a5wRRE=; b=MGEm6SKLVfMfu/6MT1bcroacXWeyVQMYVSEK3WytL42WFeTXawhjgHAI6yHqSaolAX KxdOgxinK/EKxuvnt/P52Xlt5dKIHGfy7I+2hNHLhuP96VzSH2LTSI/8sYxoZjuLdsJr XB3EKOmgRxMDDbkPumb6AbAt7v0gTkcz4wVC7xXFN3vq6TSWlOjlWfCd4jdKXj4P9IJk mKt8VNkGLhdnSFOrorbVM4LkmbAYIYpV/kP3/ASIuddfEnL444lnT39N/f8l76uqRzgc N6PstnfEZCdBFy4ltiv1QiSllY79Ew7v+7FCWns3A3ZSjnLeLBHMuvjlmOGB8ynnAs+y 12lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OjNehNTI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si12858027edy.432.2021.02.15.08.38.42; Mon, 15 Feb 2021 08:39:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OjNehNTI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232083AbhBOQhz (ORCPT + 99 others); Mon, 15 Feb 2021 11:37:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:50210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231514AbhBOPhz (ORCPT ); Mon, 15 Feb 2021 10:37:55 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id CAB2064EAD; Mon, 15 Feb 2021 15:33:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403215; bh=oottzwMwE9LU5zEDtqqbkNl1S94kxsMjf4g8+8diCFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OjNehNTIALh+x//I7m+inkOZOuGzStpctJL316m4wfzEA2Mpl16cswOsO+KoGZHb0 ZCsVYPiwOYvhtz4FzIjHyjFaYt4gUoC/CWS4YccaMVCjStr9wTFq85IMHAqox8UpXU GODl5BC5rSsPWZPxSxzno8LBwcoUAqSFDyvgycVc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Gilbert , Maurizio Lombardi , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.10 070/104] scsi: scsi_debug: Fix a memory leak Date: Mon, 15 Feb 2021 16:27:23 +0100 Message-Id: <20210215152721.720212090@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152719.459796636@linuxfoundation.org> References: <20210215152719.459796636@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maurizio Lombardi [ Upstream commit f852c596f2ee6f0eb364ea8f28f89da6da0ae7b5 ] The sdebug_q_arr pointer must be freed when the module is unloaded. $ cat /sys/kernel/debug/kmemleak unreferenced object 0xffff888e1cfb0000 (size 4096): comm "modprobe", pid 165555, jiffies 4325987516 (age 685.194s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000458f4f5d>] 0xffffffffc06702d9 [<000000003edc4b1f>] do_one_initcall+0xe9/0x57d [<00000000da7d518c>] do_init_module+0x1d1/0x6f0 [<000000009a6a9248>] load_module+0x36bd/0x4f50 [<00000000ddb0c3ce>] __do_sys_init_module+0x1db/0x260 [<000000009532db57>] do_syscall_64+0xa5/0x420 [<000000002916b13d>] entry_SYSCALL_64_after_hwframe+0x6a/0xdf Fixes: 87c715dcde63 ("scsi: scsi_debug: Add per_host_store option") Link: https://lore.kernel.org/r/20210208111734.34034-1-mlombard@redhat.com Acked-by: Douglas Gilbert Signed-off-by: Maurizio Lombardi Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/scsi_debug.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 4a08c450b756f..b6540b92f5661 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -6881,6 +6881,7 @@ static void __exit scsi_debug_exit(void) sdebug_erase_all_stores(false); xa_destroy(per_store_ap); + kfree(sdebug_q_arr); } device_initcall(scsi_debug_init); -- 2.27.0