From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B08DBC47257 for ; Sat, 9 May 2020 09:05:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7CBAD24957 for ; Sat, 9 May 2020 09:05:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="Ts3CIrEN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CBAD24957 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D91E6E317; Sat, 9 May 2020 09:05:14 +0000 (UTC) Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by gabe.freedesktop.org (Postfix) with ESMTPS id 87B066EB5C for ; Fri, 8 May 2020 19:52:58 +0000 (UTC) Received: by mail-qk1-x744.google.com with SMTP id n14so2966543qke.8 for ; Fri, 08 May 2020 12:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=+PiQ6ckxUTnSDo+AGLRh/Fg+o3k0O3ko3wY06x3JoKE=; b=Ts3CIrENqZECosUV9ufuB6NplQ4bZIANry4cTq9ctiFl2W3eKhj5UpDDQOEaY6A2Yd mNvqS8MpDNbFmXG47isv0LHHuWhU9DrWeNeUqpMHP3rRP+c5b6gcvtAg+8ZLRMd/gdoD 1i8v4D54gKF1JaotzplFLT3nMfQ5VKcTVTMjFomlH2d9ykBhs9YeoAV4r0fEyjl3TlPr v2KDioACvLG1JOHWROC3jtqtFiE8v+6chVfwhJVwQ6LpHrO+DnmO5kWS3VjbGmk9WNEY aeK1VQ7Ix6UqBc9nyw9EdxtaWdyBCOYz2f1ZZWBmiN42UGRN2WCkIjnAj9hWJy7yjUPW HsMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=+PiQ6ckxUTnSDo+AGLRh/Fg+o3k0O3ko3wY06x3JoKE=; b=ECrKRoucXQ7MbSpOkGt0j0b7GgS+MHyim5c+A1IrEKDe+F0k8Mc2YIQhpEyTlMP+3R jr9dSHIKADDHEdQdbDOeeLowFY2Ta+14PceBhow+wPA6ut17rNQBlTWbBtvadHZAyJy/ g4ptX53Fc+xUifEgZbjaWci4GNmV43yqyQECQuKJpsS2eIiXq26wHOml9DdY4azMOttZ RkbmNR/vPozSUMzUz25Wn2+LHtYSKF/q6Qp8ZRcaNgXF6sJToS7yyKjJxizTCC+ywsdJ WcLkWF626NvNFSibDxzbNqt/ibUbAxbeuK8EyPxIetXiRqZfMC0YnI9ahYGGYXJ8SULK m6aQ== X-Gm-Message-State: AGi0PuYIQSYuIPZ1IIJK7GVkyCz5wotTG10mZnKMM8LU6oSY3dIait5U bskhd6AnO8wYi42vu73kkxmpSg== X-Google-Smtp-Source: APiQypJ92/0qZ5iunL9hikarn4eDK0RllMv8mjTvIrEJ1zjbLNqAjWeKqDY9cc4vVlZEbqAojJlNqA== X-Received: by 2002:a37:a4d8:: with SMTP id n207mr4488919qke.354.1588967577470; Fri, 08 May 2020 12:52:57 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-57-212.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.57.212]) by smtp.gmail.com with ESMTPSA id c4sm1945896qkf.120.2020.05.08.12.52.56 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 12:52:56 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1jX93I-0002SQ-9Q; Fri, 08 May 2020 16:52:56 -0300 Date: Fri, 8 May 2020 16:52:56 -0300 From: Jason Gunthorpe To: Christoph Hellwig Subject: Re: [PATCH 09/12] rdma: use __anon_inode_getfd Message-ID: <20200508195256.GA8912@ziepe.ca> References: <20200508153634.249933-1-hch@lst.de> <20200508153634.249933-10-hch@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200508153634.249933-10-hch@lst.de> User-Agent: Mutt/1.9.4 (2018-02-28) X-Mailman-Approved-At: Sat, 09 May 2020 09:04:57 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bpf@vger.kernel.org, kvm@vger.kernel.org, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-gpio@vger.kernel.org, Alexander Viro , linux-fsdevel@vger.kernel.org, linux-integrity@vger.kernel.org, io-uring@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, May 08, 2020 at 05:36:31PM +0200, Christoph Hellwig wrote: > Use __anon_inode_getfd instead of opencoding the logic using > get_unused_fd_flags + anon_inode_getfile. > > Signed-off-by: Christoph Hellwig > --- > drivers/infiniband/core/rdma_core.c | 17 ++++------------- > 1 file changed, 4 insertions(+), 13 deletions(-) > diff --git a/drivers/infiniband/core/rdma_core.c b/drivers/infiniband/core/rdma_core.c > index 5128cb16bb485..541e5e06347f6 100644 > --- a/drivers/infiniband/core/rdma_core.c > +++ b/drivers/infiniband/core/rdma_core.c > @@ -462,30 +462,21 @@ alloc_begin_fd_uobject(const struct uverbs_api_object *obj, > if (WARN_ON(fd_type->fops->release != &uverbs_uobject_fd_release)) > return ERR_PTR(-EINVAL); > > - new_fd = get_unused_fd_flags(O_CLOEXEC); > - if (new_fd < 0) > - return ERR_PTR(new_fd); > - > uobj = alloc_uobj(attrs, obj); > if (IS_ERR(uobj)) > - goto err_fd; > + return uobj; > > /* Note that uverbs_uobject_fd_release() is called during abort */ > - filp = anon_inode_getfile(fd_type->name, fd_type->fops, NULL, > - fd_type->flags); > - if (IS_ERR(filp)) { > - uobj = ERR_CAST(filp); > + new_fd = __anon_inode_getfd(fd_type->name, fd_type->fops, NULL, > + fd_type->flags | O_CLOEXEC, &filp); > + if (new_fd < 0) > goto err_uobj; This will conflict with a fix (83a267021221 'RDMA/core: Fix overwriting of uobj in case of error') that is going to go to -rc soon. Also the above misses returning an ERR_PTR if __anon_inode_getfd fails, it returns a uobj that had been freed.. I suppose it should be something like if (new_fd < 0) { uverbs_uobject_put(uobj); return ERR_PTR(new_fd) } ? Jason _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel