Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4914264imc; Mon, 25 Feb 2019 13:31:46 -0800 (PST) X-Google-Smtp-Source: AHgI3IbDUQJMxvnDKLLyX2CgVbjKPyjvoHMR2E9ouuzHB/PT7qdcMUcUFhvdMW7piKGHRW4yNlV7 X-Received: by 2002:a63:2b03:: with SMTP id r3mr1751852pgr.1.1551130306289; Mon, 25 Feb 2019 13:31:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551130306; cv=none; d=google.com; s=arc-20160816; b=QpHlDstuvtwocCIxHQbKxd7hnFepsbn4hilTME8Sil+GOOu11WBlp0kyin8aTrLvbN OPfEJOdYoWaLuCyiFuwSN4ke5wRkCXmTt3FTkA3ZHk6X7TbQ+hs4jV9LAWZ+DikcYEfW 55FB8GTBbzKCBftYBF2aowI9NsMZdSOg9uI91xdiKZdC2zMG0SGes7yqo/IugP1PcSP5 4MyvoQ8oKn5BAfJ0mepTlCLgCpol8SK+UChI0YGpQicZlvOhu+O7NsMmmBhbbwcWL0dz XQXXEZdBVpebKt7omWL6YB2hTSfbUMagfLDHqlkV9buT2ls/htDUi77RMAAa/p3jie4w FGHw== 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=FQk7p1Baz+GVkgAi6FkQdpR0LBmGN2cSLU0XB6Dcw04=; b=xweFTLADsAkr4lh8q0ufeEw6FFkatxDawc6DGfUDwq0+2PJ+6MNuBgh9uOvzgt/zGk OoUZO8zeuGZX6eW59D1cCTEsA4cM0zbOSm05w8Wx9OVMuLR3x0IiHloSdQ6kxdY42ftu CJiy1smTtTnbd5dI9/18F+gbhLrfInXxjkmG6ws83pWTKxagO1OEnHaRE8s0d9rx+rLz ZtC63iQmJlBInL3n6A022bGWZk9OHwgNbc59lS9VB9hmsUFJEsjyYPmMg2Wb+GkW6ljm bg8CC5gAGdJCzKaJM6qKKooyJmg6nhP+KWOL8gdDI3rtUlxh7+Kl8MCclnFhyeLirhcg aUqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KltXKEx+; 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 g4si11016545plm.184.2019.02.25.13.31.31; Mon, 25 Feb 2019 13:31:46 -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=KltXKEx+; 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 S1732269AbfBYVbN (ORCPT + 99 others); Mon, 25 Feb 2019 16:31:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:36784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731836AbfBYVbK (ORCPT ); Mon, 25 Feb 2019 16:31:10 -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 5AC0421841; Mon, 25 Feb 2019 21:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551130268; bh=Yk1fAl1Jx3MOx+KYLcvHGe2koIrk+/noMIpcjfp4sVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KltXKEx+x82H8mB6AxVWSJNJsOTinLwIZVywGkQp6vH+64BVwG0PKy2vg5RVyejQo bUhOHXZElfXsss/QAiJncBk4fpWia0AVuJ+YpKExL2MspcBHycuVEKIzs2jgOMBJYf mY8h8de07QZfdg5MdeO6YV3R/GDxkF0+1uuDVaoI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Murashkin , Parav Pandit , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.20 068/183] RDMA/mthca: Clear QP objects during their allocation Date: Mon, 25 Feb 2019 22:10:41 +0100 Message-Id: <20190225195106.005092881@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190225195054.748060397@linuxfoundation.org> References: <20190225195054.748060397@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 9d9f59b4204bc41896c866b3e5856e5b416aa199 ] As part of audit process to update drivers to use rdma_restrack_add() ensure that QP objects is cleared before access. Such change fixes the crash observed with uninitialized non zero sgid attr accessed by ib_destroy_qp(). CPU: 3 PID: 74 Comm: kworker/u16:1 Not tainted 4.19.10-300.fc29.x86_64 Workqueue: ipoib_wq ipoib_cm_tx_reap [ib_ipoib] RIP: 0010:rdma_put_gid_attr+0x9/0x30 [ib_core] RSP: 0018:ffffb7ad819dbde8 EFLAGS: 00010202 RAX: 0000000000000000 RBX: ffff8d1bdf5a2e00 RCX: 0000000000002699 RDX: 206c656e72656af8 RSI: ffff8d1bf7ae6160 RDI: 206c656e72656b20 RBP: 0000000000000000 R08: 0000000000026160 R09: ffffffffc06b45bf R10: ffffe849887da000 R11: 0000000000000002 R12: ffff8d1be30cb400 R13: ffff8d1bdf681800 R14: ffff8d1be2272400 R15: ffff8d1be30ca000 FS: 0000000000000000(0000) GS:ffff8d1bf7ac0000(0000) knlGS:0000000000000000 Trace: ib_destroy_qp+0xc9/0x240 [ib_core] ipoib_cm_tx_reap+0x1f9/0x4e0 [ib_ipoib] process_one_work+0x1a1/0x3a0 worker_thread+0x30/0x380 ? pwq_unbound_release_workfn+0xd0/0xd0 kthread+0x112/0x130 ? kthread_create_worker_on_cpu+0x70/0x70 ret_from_fork+0x22/0x40 Reported-by: Alexander Murashkin Tested-by: Alexander Murashkin Fixes: 1a1f460ff151 ("RDMA: Hold the sgid_attr inside the struct ib_ah/qp") Signed-off-by: Parav Pandit Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/mthca/mthca_provider.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 691c6f0489386..2428c7d89c6be 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c @@ -533,7 +533,7 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd, { struct mthca_ucontext *context; - qp = kmalloc(sizeof *qp, GFP_KERNEL); + qp = kzalloc(sizeof(*qp), GFP_KERNEL); if (!qp) return ERR_PTR(-ENOMEM); @@ -599,7 +599,7 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd, if (pd->uobject) return ERR_PTR(-EINVAL); - qp = kmalloc(sizeof (struct mthca_sqp), GFP_KERNEL); + qp = kzalloc(sizeof(struct mthca_sqp), GFP_KERNEL); if (!qp) return ERR_PTR(-ENOMEM); -- 2.19.1