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=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS 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 587B1C10F0E for ; Tue, 9 Apr 2019 16:55:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 24E4E20850 for ; Tue, 9 Apr 2019 16:55:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Vg5wGrnm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 24E4E20850 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=anholt.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3QBTsnnu1b+/vPDgGnL6NYTxoKt3tdalnxEGYvoE0kw=; b=Vg5wGrnm8jmYKCFetajeTupal +hPwuvguO6L2OzY+GNedbu96jDyX2zxLAFWER195EkeivMqFtYTDTjh69+udxbjoMOhweeq2ffYeg f/elJB9qxrNZ3olyGC7+z8GLqUvRVNwtk6mri4yUDeoKAc72aqpaElfStw8mQotDpRpbqdQjiZFk8 BBLLfwr2J1srLDdHQ0XmMIQYxXYfGVT5GJvG+nOx5rRPsPur5+PCOi5UBtjMmDcmbKYGEZdEWB4IV 268aTJ7U+36NTyddI3pVyjNCvtz9YcYAbr6xyiFzTCXwkJJqQ3UA8ETj6kTQtuLABlQuyBnhv+Ovj fqv4oNz5Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDu26-0008Gt-RD; Tue, 09 Apr 2019 16:55:38 +0000 Received: from anholt.net ([50.246.234.109]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDu23-0008Fz-72 for linux-arm-kernel@lists.infradead.org; Tue, 09 Apr 2019 16:55:36 +0000 Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 2E1BE10A32EB; Tue, 9 Apr 2019 09:55:30 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id AP9KTSRNASch; Tue, 9 Apr 2019 09:55:28 -0700 (PDT) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id A1FB210A32EA; Tue, 9 Apr 2019 09:55:28 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 3DC602FE36FA; Tue, 9 Apr 2019 09:55:28 -0700 (PDT) From: Eric Anholt To: Rob Herring Subject: Re: [PATCH v2 2/3] drm: Add a drm_gem_objects_lookup helper In-Reply-To: References: <20190401074730.12241-1-robh@kernel.org> <20190401074730.12241-3-robh@kernel.org> <155412649586.24691.809508732198367112@skylake-alporthouse-com> <8736n120jw.fsf@anholt.net> User-Agent: Notmuch/0.22.2+1~gb0bcfaa (http://notmuchmail.org) Emacs/26.1 (x86_64-pc-linux-gnu) Date: Tue, 09 Apr 2019 09:55:27 -0700 Message-ID: <878swjnmo0.fsf@anholt.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190409_095535_295915_84F949C9 X-CRM114-Status: GOOD ( 16.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Neil Armstrong , Maxime Ripard , Sean Paul , Will Deacon , Linux Kernel Mailing List , dri-devel , Chris Wilson , David Airlie , "list@263.net:IOMMU DRIVERS , Joerg Roedel , " , Alyssa Rosenzweig , Daniel Vetter , Steven Price , Robin Murphy , Linux ARM Content-Type: multipart/mixed; boundary="===============7169198857614492050==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============7169198857614492050== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Rob Herring writes: > On Mon, Apr 1, 2019 at 10:43 AM Eric Anholt wrote: >> >> Chris Wilson writes: >> >> > Quoting Daniel Vetter (2019-04-01 14:06:48) >> >> On Mon, Apr 1, 2019 at 9:47 AM Rob Herring wrote: >> >> > +{ >> >> > + int i, ret = 0; >> >> > + struct drm_gem_object *obj; >> >> > + >> >> > + spin_lock(&filp->table_lock); >> >> > + >> >> > + for (i = 0; i < count; i++) { >> >> > + /* Check if we currently have a reference on the object */ >> >> > + obj = idr_find(&filp->object_idr, handle[i]); >> >> > + if (!obj) { >> >> > + ret = -ENOENT; >> > >> > Unwind previous drm_gem_object_get(), the caller has no idea how many >> > were processed before the error. >> >> I had the same thought, but the pattern we have is that you're loading >> into a refcounted struct that will free the BOs when you're done, >> anyway. > > The real bug here is if allocation of the array fails. The BO array > may be NULL when the count is not. So this V3D cleanup hunk: > > for (i = 0; i < exec->bo_count; i++) > drm_gem_object_put_unlocked(&exec->bo[i]->base.base); > kvfree(exec->bo); > > Needs to be wrapped with 'if (exec->bo)'. We have a similar problem > with fence arrays too. Yeah, seems legit. Not really going to write new patches when I've got month-old critical patches I can't get acked, though. :/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlyszn8ACgkQtdYpNtH8 nugquA/8DPK4mN09dn/AZq67osFqFl6wN3K0sqmG6JaW+Opu7DkzH10fmUthRfbD +q2HSJATWQbIP04FLmCmOp6AeqfWV7aX8jB39ltn3EHxuFb0qdLyFm/Rp6Tyr+sb yn+GknjYKzO56+SZFoaIJuBcpZKEUjaxhfr85fgJxfR0nR7B2wH3n+IIRf+dFWeO 6hmRFNzENYeaPgQCHkNnYLxXnQDIDZ+eScp1Z3CwpU4LCJFEM6LylXx7xordg9qa ljfYYT/asSruPYpvTjiQ2fhvlsgFizn6uA4R//Ls45LMtQaT/4gnCFuAI8w8559O ppg7QkBHqbUYji7bSZVQzQwp/QNAGwg/aVbaKrLCj1hFRxj73e9VllofndapQV45 Vv/5CYaG84CntgdN8AK34R1s90NHDRkGJV9A3FaY/9sTk1y7uV+OArcdsChhNNRT m4eq1cBGwA4n8ZuxbApcM0m0e6oA6qMxathbeIaTab5UEYnlWl3UTsXaOT0EEuDx A0XRCq1X2natvm9Zf40AX9p4WUDH1eNE7DJyIHO7LY2jC++7v2YwWK2T/ccS09tK QUAhTvQc4wlCBTIz40s7cWcxPmEWQuhcaAnY6e499HZPiE0RoLarMh42t/fiz+Rp Ie3qcv6nRTNQHWJrGCKiKbQEiNK2MSzJxptXA0KGwFcvlp41CcY= =vGS6 -----END PGP SIGNATURE----- --=-=-=-- --===============7169198857614492050== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============7169198857614492050==--