From patchwork Fri Jan 25 08:30:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Ou X-Patchwork-Id: 10780749 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 513D61515 for ; Fri, 25 Jan 2019 07:55:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44DDE2F66B for ; Fri, 25 Jan 2019 07:55:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38FDA2F67C; Fri, 25 Jan 2019 07:55:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E57452F66C for ; Fri, 25 Jan 2019 07:55:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728912AbfAYHzs (ORCPT ); Fri, 25 Jan 2019 02:55:48 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:55822 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726271AbfAYHzr (ORCPT ); Fri, 25 Jan 2019 02:55:47 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 3D583CC22916EF8C7034; Fri, 25 Jan 2019 15:55:45 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.408.0; Fri, 25 Jan 2019 15:55:35 +0800 From: Lijun Ou To: , CC: , , Subject: [PATCH for-rc 2/8] RDMA/hns: Bugfix for exception of creating srq Date: Fri, 25 Jan 2019 16:30:24 +0800 Message-ID: <1548405030-124329-3-git-send-email-oulijun@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1548405030-124329-1-git-send-email-oulijun@huawei.com> References: <1548405030-124329-1-git-send-email-oulijun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It needs to copy the driver data to the user when creating srq. if copy fail, it need to free the srq resource that have allocated by hns_roce_srq_alloc function. This patch depends on the patch("[PATCH V3 for-next] RDMA/hns: Update the kernel header file of hns") Signed-off-by: Lijun Ou --- drivers/infiniband/hw/hns/hns_roce_srq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c index a934511..12deacf 100644 --- a/drivers/infiniband/hw/hns/hns_roce_srq.c +++ b/drivers/infiniband/hw/hns/hns_roce_srq.c @@ -385,12 +385,15 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd, if (ib_copy_to_udata(udata, &resp, min(udata->outlen, sizeof(resp)))) { ret = -EFAULT; - goto err_wrid; + goto err_srqc_alloc; } } return &srq->ibsrq; +err_srqc_alloc: + hns_roce_srq_free(hr_dev, srq); + err_wrid: kvfree(srq->wrid);