From: Eric Anholt <eric@anholt•net>
To: Rob Herring <robh@kernel•org>
Cc: Neil Armstrong <narmstrong@baylibre•com>,
Maxime Ripard <maxime.ripard@bootlin•com>,
Sean Paul <sean@poorly•run>, Will Deacon <will.deacon@arm•com>,
Linux Kernel Mailing List <linux-kernel@vger•kernel.org>,
dri-devel <dri-devel@lists•freedesktop.org>,
Chris Wilson <chris@chris-wilson•co.uk>,
David Airlie <airlied@linux•ie>,
"list@263•net:IOMMU DRIVERS <iommu@lists•linux-foundation.org>,
Joerg Roedel <joro@8bytes•org>,
" <iommu@lists•linux-foundation.org>,
Alyssa Rosenzweig <alyssa@rosenzweig•io>,
Daniel Vetter <daniel@ffwll•ch>,
Steven Price <steven.price@arm•com>,
Robin Murphy <robin.murphy@arm•com>,
Linux ARM <linux-arm-kernel@lists•infradead.org>
Subject: Re: [PATCH v2 2/3] drm: Add a drm_gem_objects_lookup helper
Date: Tue, 09 Apr 2019 09:55:27 -0700 [thread overview]
Message-ID: <878swjnmo0.fsf@anholt.net> (raw)
In-Reply-To: <CAL_Jsq+So-kadir8o8T-YNYkfOYD8vopAS3UWGbSdRVLjH_JGQ@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1483 bytes --]
Rob Herring <robh@kernel•org> writes:
> On Mon, Apr 1, 2019 at 10:43 AM Eric Anholt <eric@anholt•net> wrote:
>>
>> Chris Wilson <chris@chris-wilson•co.uk> writes:
>>
>> > Quoting Daniel Vetter (2019-04-01 14:06:48)
>> >> On Mon, Apr 1, 2019 at 9:47 AM Rob Herring <robh@kernel•org> 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. :/
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-04-09 16:55 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-01 7:47 [PATCH v2 0/3] Initial Panfrost driver Rob Herring
2019-04-01 7:47 ` [PATCH v3 1/3] iommu: io-pgtable: Add ARM Mali midgard MMU page table format Rob Herring
2019-04-01 19:11 ` Robin Murphy
2019-04-05 10:02 ` Robin Murphy
2019-04-11 13:15 ` Joerg Roedel
2019-04-05 9:42 ` Steven Price
2019-04-05 9:51 ` Robin Murphy
2019-04-05 10:36 ` Steven Price
2019-04-08 8:56 ` Steven Price
2019-04-01 7:47 ` [PATCH v2 2/3] drm: Add a drm_gem_objects_lookup helper Rob Herring
2019-04-01 13:06 ` Daniel Vetter
2019-04-01 13:48 ` Chris Wilson
2019-04-01 15:43 ` Eric Anholt
2019-04-08 20:09 ` Rob Herring
2019-04-09 16:55 ` Eric Anholt [this message]
2019-04-01 16:59 ` Rob Herring
2019-04-01 18:22 ` Eric Anholt
2019-04-01 15:05 ` [PATCH v2 0/3] Initial Panfrost driver Alyssa Rosenzweig
[not found] ` <20190401074730.12241-4-robh@kernel.org>
2019-04-01 8:24 ` [PATCH v2 3/3] drm/panfrost: Add initial panfrost driver Neil Armstrong
2019-04-01 19:17 ` Robin Murphy
2019-04-01 16:02 ` Eric Anholt
2019-04-01 19:12 ` Robin Murphy
2019-04-02 0:33 ` Alyssa Rosenzweig
2019-04-02 11:23 ` Robin Murphy
2019-04-03 4:57 ` Rob Herring
2019-04-05 12:57 ` Robin Murphy
[not found] ` <5efdc3cb-7367-65e1-d1bf-14051db5da10@arm.com>
2019-04-05 16:16 ` Alyssa Rosenzweig
2019-04-05 16:42 ` Steven Price
2019-04-05 16:53 ` Alyssa Rosenzweig
2019-04-15 9:18 ` Daniel Vetter
2019-04-15 9:30 ` Steven Price
2019-04-16 7:51 ` Daniel Vetter
2019-04-08 21:04 ` Rob Herring
2019-04-09 15:56 ` Tomeu Vizoso
2019-04-09 16:15 ` Rob Herring
2019-04-10 10:28 ` Steven Price
2019-04-10 10:19 ` Steven Price
2019-04-10 11:50 ` Tomeu Vizoso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878swjnmo0.fsf@anholt.net \
--to=eric@anholt$(echo .)net \
--cc=airlied@linux$(echo .)ie \
--cc=alyssa@rosenzweig$(echo .)io \
--cc=chris@chris-wilson$(echo .)co.uk \
--cc=daniel@ffwll$(echo .)ch \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=iommu@lists$(echo .)linux-foundation.org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=maxime.ripard@bootlin$(echo .)com \
--cc=narmstrong@baylibre$(echo .)com \
--cc=robh@kernel$(echo .)org \
--cc=robin.murphy@arm$(echo .)com \
--cc=sean@poorly$(echo .)run \
--cc=steven.price@arm$(echo .)com \
--cc=will.deacon@arm$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox