mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: "T.J. Mercier" <tjmercier@google.com>,
	Fedor Pchelkin <pchelkin@ispras.ru>
Cc: Sumit Semwal <sumit.semwal@linaro.org>,
	Chris Wilson <chris@chris-wilson.co.uk>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org,
	Alexey Khoroshilov <khoroshilov@ispras.ru>,
	lvc-project@linuxtesting.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] dma-buf: handle testing kthreads creation failure
Date: Mon, 27 May 2024 17:01:51 +0200	[thread overview]
Message-ID: <b25747ca-c8a8-45de-a5e1-f8cf2caa2729@amd.com> (raw)
In-Reply-To: <CABdmKX2qdT0HvkX0B6kcxALwxZsLFOtgPsOP_rY0AXM1eAtAtA@mail.gmail.com>

Am 22.05.24 um 20:33 schrieb T.J. Mercier:
> On Wed, May 22, 2024 at 11:14 AM Fedor Pchelkin <pchelkin@ispras.ru> wrote:
>> kthread creation may possibly fail inside race_signal_callback(). In
>> such a case stop the already started threads, put the already taken
>> references to them and return with error code.
>>
>> Found by Linux Verification Center (linuxtesting.org).
>>
>> Fixes: 2989f6451084 ("dma-buf: Add selftests for dma-fence")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
> Reviewed-by: T.J. Mercier <tjmercier@google.com>

Just FYI: I've picked this one up and pushed it to drm-misc-fixes.

Regards,
Christian.

>> ---
>> v2: use kthread_stop_put() to actually put the last reference as
>>      T.J. Mercier noticed;
>>      link to v1: https://lore.kernel.org/lkml/20240522122326.696928-1-pchelkin@ispras.ru/
>>
>>   drivers/dma-buf/st-dma-fence.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/dma-buf/st-dma-fence.c b/drivers/dma-buf/st-dma-fence.c
>> index b7c6f7ea9e0c..6a1bfcd0cc21 100644
>> --- a/drivers/dma-buf/st-dma-fence.c
>> +++ b/drivers/dma-buf/st-dma-fence.c
>> @@ -540,6 +540,12 @@ static int race_signal_callback(void *arg)
>>                          t[i].before = pass;
>>                          t[i].task = kthread_run(thread_signal_callback, &t[i],
>>                                                  "dma-fence:%d", i);
>> +                       if (IS_ERR(t[i].task)) {
>> +                               ret = PTR_ERR(t[i].task);
>> +                               while (--i >= 0)
>> +                                       kthread_stop_put(t[i].task);
>> +                               return ret;
>> +                       }
>>                          get_task_struct(t[i].task);
>>                  }
>>
>> --
>> 2.39.2
>>


      reply	other threads:[~2024-05-27 15:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 18:13 Fedor Pchelkin
2024-05-22 18:33 ` T.J. Mercier
2024-05-27 15:01   ` Christian König [this message]

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=b25747ca-c8a8-45de-a5e1-f8cf2caa2729@amd.com \
    --to=christian.koenig@amd.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=khoroshilov@ispras.ru \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=pchelkin@ispras.ru \
    --cc=stable@vger.kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=tjmercier@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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

all inboxes | Powered by JetHome®