From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16EDB52844E; Wed, 30 Sep 2026 17:39:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790789992; cv=none; b=tdlpHqpGyozuvWrKoQVGOQT9HCpgmF9hBGLsURg7nLKDPWc9LdI5YXfS/v6zOba6/eXCW5R0ymXprTKCRHleoH3mCEB6kXnO3zF62NPCojUUs+EXUcfMcV1CV90wQGBqWg95UC1gKVE0H67/Ftz8A7MfKzCKfgH/f/KNiLaWrgE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790789992; c=relaxed/simple; bh=3losuV/8pXGxrEjLlPi6EJA8qdSp2ALW0n+HFTVRge8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OgRLnTjQ83nHym5i9zmJGyg2zIcma/hceZO4RDpqderBS1wndck5QONYquvuJRP7/1r+XI7pnQi+BAd5ODySJRhLCJ0u/WcgclZ7pP1A3wRrBnLT4HqLLhwrVAIQG8vAWu6sR8TpFCg8DZj8A3CmLr3GnNPQ8OmN1/IoJbBgndI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Kh4C7bul; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Kh4C7bul" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A84B1F000FF; Wed, 30 Sep 2026 17:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790789990; bh=s8jpiRg+rKC+mx3a6rjt4U8MeKCB+k0pPHUbrDn7imc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Kh4C7bullH92gmpOauahwWUBwPhHkzoB5yEa2VH10YRIN4Sfjk4tdZBzZnHJC/uf3 +b0iJ8juen0FCT5hMxwgM4ucAJFhNE/urafRPQ2vvJZ8O7MRuWTRkH2Nr9p1VstxyQ Lz75hybn5izp8OPGs6V/35HGD6KrT8AiLvzhw3iI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Nilesh Javali , Hannes Reinecke , "Martin K. Petersen (Oracle)" , Sasha Levin Subject: [PATCH 6.12 671/877] scsi: qla2xxx: Zero dport diagnostics buffer to avoid info leak Date: Wed, 30 Sep 2026 17:26:22 +0200 Message-ID: <20260930152429.147899083@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152414.738996857@linuxfoundation.org> References: <20260930152414.738996857@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nilesh Javali [ Upstream commit a152edab3854f01dd2daf3eaf8f32cbabdb3834e ] qla2x00_do_dport_diagnostics() allocates the qla_dport_diag response buffer with kmalloc_obj() (non-zeroing) and, on success, copies the full sizeof(*dd) back to user space via sg_copy_from_buffer(). The inbound sg_copy_to_buffer() only fills as many bytes as the user request payload provides, and qla26xx_dport_diagnostics() zeroes only dd->buf. The options and unused[] fields are therefore copied out uninitialized, leaking kernel heap contents to user space. Allocate with kzalloc_obj(), matching qla2x00_do_dport_diagnostics_v2(). Fixes: ec89146215d1 ("qla2xxx: Add bsg interface to support D_Port Diagnostics.") Cc: stable@vger.kernel.org Signed-off-by: Nilesh Javali Reviewed-by: Hannes Reinecke Link: https://patch.msgid.link/20260723050413.3897522-54-njavali@marvell.com Signed-off-by: Martin K. Petersen (Oracle) [ Adapted kzalloc_obj(*dd) to kzalloc(sizeof(*dd), GFP_KERNEL) to match the branch’s allocation syntax. ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_bsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c @@ -2412,7 +2412,7 @@ qla2x00_do_dport_diagnostics(struct bsg_ !IS_QLA28XX(vha->hw)) return -EPERM; - dd = kmalloc(sizeof(*dd), GFP_KERNEL); + dd = kzalloc(sizeof(*dd), GFP_KERNEL); if (!dd) { ql_log(ql_log_warn, vha, 0x70db, "Failed to allocate memory for dport.\n");