Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp12252ybg; Mon, 27 Jul 2020 14:05:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUx4Q/JLChuM3GOAOW/6Oxa5ukxKNqDdGqiUEIpqitkcoiS6G4saPRxvVrOqK1PtVwUpNg X-Received: by 2002:a17:906:d930:: with SMTP id rn16mr7907389ejb.330.1595883926165; Mon, 27 Jul 2020 14:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595883926; cv=none; d=google.com; s=arc-20160816; b=tK5BvJUFSsLilVrdGcTV64LlXITijZLj1j6MZpS4iILsmQvTkCqYBFAMB6OU70KnEz 0wYknY18mONkR7v+Cz9htbnS43xw67I7ZIRlB25Xw4BwMuNgf4ELW9t2xiM1PfnqdNlC Dg+/c4mA0eCfz6S9MWe3LpaBGB9i7A5EDbvkjrwAkPESFA/Cz/o6qlhvdz9U57kCxaV3 iAuZiwh2nIvToVS17DEq2CkRX3AMnFGDPQs++sktZMT8vTF/HfL0upVcMXx4JFBTRAoY JUstQa5fZXjV85GwN2/FqCVMgCMi80vRnF8/RqfZdn51XLXBPp14v132MkTZhFYjXchx cQ1A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=fmK6L/0QiUgIiYwBxTGcL+joJ1wkGcxNcczqzti8GgY=; b=P7ZkDwOHeGBRvOUMt1G17rnPKhV0MyQFQLOqZinKLdvelKC6Lda38AyokZDmacQNrw qE2V7urZfhY6jLxSaZOJdFy9j17fW/au2/lwGRabKQIj0KHw7QrQ7JMDbDfWhBqG8xf3 Ym03WvBW+eGGXWFTCLQFFuTXAqivl93Faru36Z8uaX8YD3PJXW1Tzz1pPwKzWYxbHegd kTvnAxZ8S6OWcrIqZkrDXkvEiIQD3up8mOxhtPiZeNW4qGcuBOQVJ4+53XPuylQ1d6Pr gxUkxVAtKjfDmwpfX5aUAV+j13pGNf7Ywy3hh+L6QIzupoe5zEjxbaP/OXSyMVwHoMj3 r1CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c0dl7GcE; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk14si4925197edb.61.2020.07.27.14.05.02; Mon, 27 Jul 2020 14:05:26 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=c0dl7GcE; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726387AbgG0VEe (ORCPT + 99 others); Mon, 27 Jul 2020 17:04:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726139AbgG0VEe (ORCPT ); Mon, 27 Jul 2020 17:04:34 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDA6CC061794; Mon, 27 Jul 2020 14:04:33 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id 11so16723008qkn.2; Mon, 27 Jul 2020 14:04:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fmK6L/0QiUgIiYwBxTGcL+joJ1wkGcxNcczqzti8GgY=; b=c0dl7GcE3qXrMwLhOyjCKdHyJDcA7m5LeZ3ATOvuptnRH+viC3uFNrauwRs93IgcOo P4UOGQvq9tIWAxrDwItERdsK410OCjjyclMBJFN+cgOk0VnLVwcQW2Hh5oEE5mqvr/sy Wp2YwKveou+lupv1qxLro38uV9x6lR7/iDOKfz5rfHmJ9xNmzjrCVvCtMeOZW6J+gq9/ Mdz0yl3w6rZhpQRZyDKvcG+pfgBvm3EoYzycuT5KMx63zKkwwfyCQeBuPVVZcxpVrDXm W0lNdPqNBv+aT8T1t/pPhrftQIrYQ9BA9OHHIOw+bdlCQre/JI9Ds/Lit7p0ipW0aN3z kvbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fmK6L/0QiUgIiYwBxTGcL+joJ1wkGcxNcczqzti8GgY=; b=hEMiLRaSTC8md+GNMR6Z1+gJBxcyQPYQovqjvEj9DrkuVJMQzhII2S4BEhT93maIW5 mk63hzUvmc+N1Fz2/MKCBrlz7OhaVWwfroIVoIooVxbhLNgby5XlIcpjIzKi03gUPpT/ 1UjjNNocxFpYE+ANm8fdxjlwEkVyNf1Nxkdihhpas3hmOYBhTekFYHbC7eRe/uJXgnCc 6DcUuJUdvqiHCUo3C92EQgM1qd/JkeolDyNbfTlWB2/Gi/qifcIf+wBwsmlUmnXvgHoc u4hy/nQi0CcHPY1t9efW3z0kMLl3UPJ+ByW5wKRNTYnjwNZ06/s0f1vWeJ6z+E+81NZI /LAA== X-Gm-Message-State: AOAM531OvMSGN5egsnSc9CI93Hj6xtE0hJwvyyAxjI4Bt5osFzDm5Lh2 Xv1iYPQjhDJbbJkHUFU0iYbUsWApGQ== X-Received: by 2002:ae9:ef8d:: with SMTP id d135mr24189692qkg.109.1595883873133; Mon, 27 Jul 2020 14:04:33 -0700 (PDT) Received: from localhost.localdomain ([209.94.141.207]) by smtp.gmail.com with ESMTPSA id k2sm20964994qkf.127.2020.07.27.14.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 14:04:32 -0700 (PDT) From: Peilin Ye To: Kashyap Desai , Sumit Saxena Cc: Peilin Ye , Dan Carpenter , Arnd Bergmann , Greg Kroah-Hartman , Shivasharan S , "James E.J. Bottomley" , "Martin K. Petersen" , linux-kernel-mentees@lists.linuxfoundation.org, megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [Linux-kernel-mentees] [PATCH] scsi/megaraid: Prevent kernel-infoleak in kioc_to_mimd() Date: Mon, 27 Jul 2020 17:02:35 -0400 Message-Id: <20200727210235.327835-1-yepeilin.cs@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hinfo_to_cinfo() does no operation on `cinfo` when `hinfo` is NULL, causing kioc_to_mimd() to copy uninitialized stack memory to userspace. Fix it by initializing `cinfo` with memset(). Cc: stable@vger.kernel.org Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Suggested-by: Dan Carpenter Suggested-by: Arnd Bergmann Signed-off-by: Peilin Ye --- drivers/scsi/megaraid/megaraid_mm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index 8df53446641a..9df0e6b253a8 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c @@ -816,6 +816,8 @@ kioc_to_mimd(uioc_t *kioc, mimd_t __user *mimd) case MEGAIOC_QADAPINFO: + memset(&cinfo, 0, sizeof(cinfo)); + hinfo = (mraid_hba_info_t *)(unsigned long) kioc->buf_vaddr; -- 2.25.1