From patchwork Tue Oct 17 12:52:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junxian Huang X-Patchwork-Id: 154255 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4111169vqb; Tue, 17 Oct 2023 05:56:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtO91OwyLw+3KYdnIm3/Woyv9N0jvKPiwtie7N9e8DqXCFBcuss+ESIqxjWUpukSRJsrPU X-Received: by 2002:a17:902:f154:b0:1bf:349f:b85c with SMTP id d20-20020a170902f15400b001bf349fb85cmr2233159plb.1.1697547370654; Tue, 17 Oct 2023 05:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697547370; cv=none; d=google.com; s=arc-20160816; b=cMbz881Z/QL6yRflN1d1lxrJJijtS0v4MDPt8cAy3Plyl0Tn5cJa0wSVnLd79VpU41 PHb3iyQWBTUZ7eKXsH2fr6BVMvmGl74ywAFUbxYZ+bC1SMCgmdxAve92OsvcZ9rxZLa7 ft3thd09TLCOG5cqPCsFuZ7y5vFUzR4CihDXWywthLztJYLZLtaLLFvIgutgMZ80nmp6 v6p8JAHy8bJwE9QpA0yywPMuBkN7pQOS/zksDlHOlaAWfRytY4/EV+hsE+nEQ2RIX28s dqh7oE/PwQ7W0xucxYfIVagOW3JdZYY214KVmfHXwH8y8Otq3FSrBHLKROSOf9aIa1Pk axUQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DAl3gso+IkuzRordg2lJ9C8vRN/0wSdCYsIKVW2WvoI=; fh=KWvyQxL3Ff+3WPSMjlYu+P4255AmcMULAsFol6M1vNI=; b=krcI2AUF595tSuAJepCRlcxLCQb+1Ybwml+MNOEikBr8WtQO0xBUOSjFzNHDsAAHq0 ap19wQ8azk41zn1poGP3ctQKCljxuh2d9TWShSAkEAOGubMqkCZ6qcOe3pxtfLVWLiQX uVRkH79GBUBIx3aaBqryLSjWCKxTsp3pfl9yHd7O99iwAoJ2XGX18Ks6+qM2+NDZnNj+ QccR17Mjsf1ENi9YQHurKSzCrtb1wI0tu2bOB40ALmv1rrlSYczyjbc9dmbRr0YnHjnN EfFwBHlOUE3WJpM3pSip3yoD4OAmV/auQxQszfn9h2zzW9hOFIoBhc41J2tyElPMhQdt bo0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=hisilicon.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id c20-20020a170902c1d400b001c9d96cbd97si1584871plc.66.2023.10.17.05.56.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 05:56:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=hisilicon.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id C1F2D802957E; Tue, 17 Oct 2023 05:56:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234956AbjJQMz7 (ORCPT + 19 others); Tue, 17 Oct 2023 08:55:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234659AbjJQMz5 (ORCPT ); Tue, 17 Oct 2023 08:55:57 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 240FBDB; Tue, 17 Oct 2023 05:55:55 -0700 (PDT) Received: from kwepemi500006.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4S8v6G6YwFz15Nd1; Tue, 17 Oct 2023 20:53:10 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemi500006.china.huawei.com (7.221.188.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 17 Oct 2023 20:55:52 +0800 From: Junxian Huang To: , CC: , , , Subject: [PATCH for-rc 2/7] RDMA/hns: Fix uninitialized ucmd in hns_roce_create_qp_common() Date: Tue, 17 Oct 2023 20:52:34 +0800 Message-ID: <20231017125239.164455-3-huangjunxian6@hisilicon.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231017125239.164455-1-huangjunxian6@hisilicon.com> References: <20231017125239.164455-1-huangjunxian6@hisilicon.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500006.china.huawei.com (7.221.188.68) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 17 Oct 2023 05:56:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780007431752534232 X-GMAIL-MSGID: 1780007431752534232 From: Chengchang Tang ucmd in hns_roce_create_qp_common() are not initialized. But it works fine until new member sdb_addr is added to struct hns_roce_ib_create_qp. If the user-mode driver uses an old version ABI, then the value of the new member will be undefined after ib_copy_from_udata(). This patch fixes it by initialize this variable to 0. And the default value of the new member sdb_addr will be 0 which is invalid. Fixes: 0425e3e6e0c7 ("RDMA/hns: Support flush cqe for hip08 in kernel space") Signed-off-by: Chengchang Tang Signed-off-by: Junxian Huang --- drivers/infiniband/hw/hns/hns_roce_qp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c index cdc1c6de43a1..828b58534aa9 100644 --- a/drivers/infiniband/hw/hns/hns_roce_qp.c +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c @@ -1064,7 +1064,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev, { struct hns_roce_ib_create_qp_resp resp = {}; struct ib_device *ibdev = &hr_dev->ib_dev; - struct hns_roce_ib_create_qp ucmd; + struct hns_roce_ib_create_qp ucmd = {}; int ret; mutex_init(&hr_qp->mutex);