From patchwork Fri Oct 27 02:33:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guoqing Jiang X-Patchwork-Id: 13438059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B0DEC25B6E for ; Fri, 27 Oct 2023 02:33:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345167AbjJ0Cd5 (ORCPT ); Thu, 26 Oct 2023 22:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345183AbjJ0Cd4 (ORCPT ); Thu, 26 Oct 2023 22:33:56 -0400 Received: from out-181.mta1.migadu.com (out-181.mta1.migadu.com [95.215.58.181]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4BDFD40 for ; Thu, 26 Oct 2023 19:33:53 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1698374032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vjSXmmTc0Teonn139UWL84hazaLoraGfpbtnxsf2zjQ=; b=BXRzCpt/G0Du+kvDp18B8W8Je4VvfGrmlLt4tHQbRhOdE4pSzdPCcGS44IsQj9Ny9ID/bA 7eGqk1Bb0HgCtsRXk3oDL1ktrGJw/E+BZCkQdxBJKmWURKo0iwKBtjgkBnsnHtw1Bx7a29 X45zAJOzeEM0E7o4BMN/duY4fv7KZ+o= From: Guoqing Jiang To: bmt@zurich.ibm.com, jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org Subject: [PATCH V3 07/18] RDMA/siw: Also goto out_sem_up if pin_user_pages returns 0 Date: Fri, 27 Oct 2023 10:33:17 +0800 Message-Id: <20231027023328.30347-8-guoqing.jiang@linux.dev> In-Reply-To: <20231027023328.30347-1-guoqing.jiang@linux.dev> References: <20231027023328.30347-1-guoqing.jiang@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Since it is legitimate for pin_user_pages returns 0, which means it might be dead loop here. Acked-by: Bernard Metzler Signed-off-by: Guoqing Jiang --- drivers/infiniband/sw/siw/siw_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/siw/siw_mem.c b/drivers/infiniband/sw/siw/siw_mem.c index c5f7f1669d09..92c5776a9eed 100644 --- a/drivers/infiniband/sw/siw/siw_mem.c +++ b/drivers/infiniband/sw/siw/siw_mem.c @@ -423,7 +423,7 @@ struct siw_umem *siw_umem_get(u64 start, u64 len, bool writable) while (nents) { rv = pin_user_pages(first_page_va, nents, foll_flags, plist); - if (rv < 0) + if (rv <= 0) goto out_sem_up; umem->num_pages += rv;