Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4628323pxj; Wed, 12 May 2021 09:33:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0wGqsUDXJsQpg7fAMbsgy/4NF/7mhNuyH74aiuEZBxDW0Q1slsw7HfobH06J8RfV7ZtO3 X-Received: by 2002:a2e:8682:: with SMTP id l2mr25965449lji.298.1620837237353; Wed, 12 May 2021 09:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837237; cv=none; d=google.com; s=arc-20160816; b=0UzbsuhaISnPsvtvI32uKlfJKAj0HHgU+6ruTQBFwEW417pdPHInfxJkoPba2yzsMk AWKp0HJ/uIJDmMY5Aiul+sq8zmXObi5Vdcxpanr1fPdQThhN0YeSi0Sysv8Ok0kOVExn ouKJ0R4rcvOBbt8P0clCiPFM4BWyiC9Rupyo2GTkfrMZLSjZMmt3EA7ReIyruLsYv2bn w+tIrAnM/dM9tFiP4q6pIFy9mY6QQOnji8l2ZBQdcl6bc+3aENsrMGL1TfLrTtzKrnSu WG1DMVf1HYQE9QvuzD/AeAyO34KcQQy2mdOwmiUpGV8H0+ds6PIfgzE/QRFxMDyNQaGE hRRw== 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=ZINggUrdulktE+MrZfhnzTU1xlAlPHP45Zt/jtvzDGc=; b=A0Kqx/xfJjezoQ/4PmowE6J4wU8GE8mHY88OFStM3qFesf3cJE19Tq2J/XFX53W7Sk saCQep2CHGMezQkM8ddCRNis+SQpCS03MrZM4xot25ttUSFtk9vomY+qAJFl41Ebung0 kEcy8fq9NkMm48A7ij2aocdbQ94YwPaEEa0NwnFOffNf47mjA34sCUTs0/pDkFmUOTvl ergGg7au0VYnnQvVRihYuwCOAD3T443v7A9Oc5wzAlzth8BWo4hh8MXuGo3rMqiOnJpI 3gEVn0eBpopNi/Z5CV2YjLs1hYoJsj13scmA6/J7BfrTppy7ujqO1FV/YYbKRI9R6/Z7 4R/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f7D2mY1G; 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 x22si405317lfa.432.2021.05.12.09.33.26; Wed, 12 May 2021 09:33:57 -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=@linuxfoundation.org header.s=korg header.b=f7D2mY1G; 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 S241820AbhELQay (ORCPT + 99 others); Wed, 12 May 2021 12:30:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:56600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234299AbhELPjX (ORCPT ); Wed, 12 May 2021 11:39:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7308961C71; Wed, 12 May 2021 15:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832847; bh=Mgfy+Fc6FsToJDhZcqaHwXxWhy/3U+/Rm9Q4F0nNTU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f7D2mY1GzrJpF4a2K+KJ3+Mf5EsL75JGT3H/2EMD6ZMxtUOLbE3M2W5ad7dK16/S2 rnY0I1Z0UUnsfvGmLqXMO3Vx2STgSELgIyDw3/m9RsFGZ8gLvEKB9iJ5ewMINU/RP6 vN+oUCGUaYrvLteCG++oaNRtunsWoZnsXfJBqd/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Goldman , Mike Marciniszyn , Dennis Dalessandro , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.10 403/530] IB/hfi1: Use kzalloc() for mmu_rb_handler allocation Date: Wed, 12 May 2021 16:48:33 +0200 Message-Id: <20210512144833.008204270@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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: Mike Marciniszyn [ Upstream commit ca5f72568e034e1295a7ae350b1f786fcbfb2848 ] The code currently assumes that the mmu_notifier struct embedded in mmu_rb_handler only contains two fields. There are now extra fields: struct mmu_notifier { struct hlist_node hlist; const struct mmu_notifier_ops *ops; struct mm_struct *mm; struct rcu_head rcu; unsigned int users; }; Given that there in no init for the mmu_notifier, a kzalloc() should be used to insure that any newly added fields are given a predictable initial value of zero. Fixes: 06e0ffa69312 ("IB/hfi1: Re-factor MMU notification code") Link: https://lore.kernel.org/r/1617026056-50483-9-git-send-email-dennis.dalessandro@cornelisnetworks.com Reviewed-by: Adam Goldman Signed-off-by: Mike Marciniszyn Signed-off-by: Dennis Dalessandro Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/hfi1/mmu_rb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hfi1/mmu_rb.c b/drivers/infiniband/hw/hfi1/mmu_rb.c index f3fb28e3d5d7..d213f65d4cdd 100644 --- a/drivers/infiniband/hw/hfi1/mmu_rb.c +++ b/drivers/infiniband/hw/hfi1/mmu_rb.c @@ -89,7 +89,7 @@ int hfi1_mmu_rb_register(void *ops_arg, struct mmu_rb_handler *h; int ret; - h = kmalloc(sizeof(*h), GFP_KERNEL); + h = kzalloc(sizeof(*h), GFP_KERNEL); if (!h) return -ENOMEM; -- 2.30.2