All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Konstantin Sinyuk" <ksinyuk@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [RFC PATCH 11/12] drm/fabric: add mutation KUnit tests
Date: Tue, 25 Aug 2026 08:10:38 +0000	[thread overview]
Message-ID: <20260825081038.8AAE91F00ADF@smtp.kernel.org> (raw)
In-Reply-To: <56ac95cbe4dfdfec86f4828bd59e4b3539b9bb39.1787552412.git.ksinyuk@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Uninitialized pointer in test timeout path causes kernel panic during cleanup
--

--- Patch [11]: [RFC PATCH 11/12] drm/fabric: add mutation KUnit tests ---
commit 4053deb9cc41982c0c7a86f0e14eb969bfd85f18
Author: Konstantin Sinyuk <ksinyuk@kernel.org>

drm/fabric: add mutation KUnit tests

This commit adds KUnit coverage for the drm_fabric object model and
topology-mutation paths. It tests various endpoint and port mutation scenarios,
including concurrent mutations, orphan attach/detach, and error paths.

> diff --git a/drivers/gpu/drm/fabric/drm_fabric_test.c b/drivers/gpu/drm/fabric/drm_fabric_test.c
> index 863b7cf690689..d2c88d1837375 100644
> --- a/drivers/gpu/drm/fabric/drm_fabric_test.c
> +++ b/drivers/gpu/drm/fabric/drm_fabric_test.c
[ ... ]
> +static void drm_fabric_test_attach_register_collision(struct kunit *test)
> +{
[ ... ]
> +	/* B then proceeds and must fail: X is now owned by A. */
> +	KUNIT_EXPECT_GT(test,
> +			wait_for_completion_timeout(&l4->reg_done, msecs_to_jiffies(5000)),
> +			0);
> +	if (!IS_ERR(l4->reg_ep)) {
> +		KUNIT_ASSERT_EQ(test, 0,
> +				kunit_add_action_or_reset(test,
> +							  fabrictest_unregister_endpoint,
> +							  l4->reg_ep));
> +		KUNIT_FAIL(test, "racing registration unexpectedly succeeded");
> +		return;
> +	}
> +
> +	KUNIT_EXPECT_EQ(test, PTR_ERR(l4->reg_ep), -EEXIST);
> +}

[Severity: Medium]
If the registration thread stalls and wait_for_completion_timeout() times out
(returning 0), l4->reg_ep will remain NULL since l4 was allocated with
kunit_kzalloc().

Because IS_ERR(NULL) evaluates to false, wouldn't this execution path enter
the if block and pass NULL to fabrictest_unregister_endpoint() during cleanup?

This would lead to a NULL pointer dereference and a kernel panic when
drm_fabric_endpoint_unregister() attempts to access the pointer.

Should this check use IS_ERR_OR_NULL(l4->reg_ep) instead, or should l4->reg_ep
be initialized to an error pointer before the thread is spawned?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787552412.git.ksinyuk@kernel.org?part=11

  reply	other threads:[~2026-08-25  8:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24  8:09 [RFC PATCH 0/12] drm/fabric: vendor-neutral topology infrastructure for scale-up accelerator interconnects Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 01/12] drm/fabric: add core object model and provider API Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 02/12] drm/fabric: add query uAPI and generated headers Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 03/12] drm/fabric: implement query netlink operations Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 04/12] drm/fabric: add read-only synthetic provider Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 05/12] drm/fabric: add object-model KUnit tests Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 06/12] drm/fabric: add YNL query and policy selftests Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 07/12] drm/fabric: add topology-provisioning core Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 08/12] drm/fabric: add provisioning netlink uAPI Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 09/12] drm/fabric: implement mutation netlink operations Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 10/12] drm/fabric: make the synthetic provider writable Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 11/12] drm/fabric: add mutation KUnit tests Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot [this message]
2026-08-24  8:09 ` [RFC PATCH 12/12] drm/fabric: add mutation netlink selftests Konstantin Sinyuk
2026-08-26  9:32 ` [RFC PATCH 0/12] drm/fabric: vendor-neutral topology infrastructure for scale-up accelerator interconnects Leon Romanovsky
2026-08-26 15:38   ` Konstantin Sinyuk
2026-08-27 17:09     ` Leon Romanovsky
2026-08-28 16:13       ` Rodrigo Vivi
2026-09-01 11:01         ` Leon Romanovsky
2026-09-01 15:25           ` Rodrigo Vivi
2026-09-02  7:10             ` Leon Romanovsky
2026-08-31 11:45       ` Konstantin Sinyuk
2026-08-27 12:35 ` Jiri Pirko
2026-08-28 16:28   ` Rodrigo Vivi
2026-08-28 17:03     ` Jason Gunthorpe
2026-08-31 11:45       ` Konstantin Sinyuk
2026-08-31 12:23         ` Jason Gunthorpe
2026-08-31 11:45   ` Konstantin Sinyuk

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=20260825081038.8AAE91F00ADF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ksinyuk@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.