From: "Christian König" <christian.koenig@amd.com>
To: Qasim Ijaz <qasdev00@gmail.com>,
ray.huang@amd.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
simona@ffwll.ch, thomas.hellstrom@linux.intel.com,
Arunpravin.PaneerSelvam@amd.com, karolina.stolarek@intel.com,
jeff.johnson@oss.qualcomm.com, bigeasy@linutronix.de
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] drm/ttm/tests: fix potential null pointer dereference in ttm_bo_unreserve_bulk()
Date: Thu, 13 Mar 2025 15:20:34 +0100 [thread overview]
Message-ID: <6a24d733-88ef-4cfb-8cc8-1c01fb64fc0f@amd.com> (raw)
In-Reply-To: <20250311190138.17276-1-qasdev00@gmail.com>
Am 11.03.25 um 20:01 schrieb Qasim Ijaz:
> In the ttm_bo_unreserve_bulk() test function, resv is allocated
> using kunit_kzalloc(), but the subsequent assertion mistakenly
> verifies the ttm_dev pointer instead of checking the resv pointer.
> This mistake means that if allocation for resv fails, the error will
> go undetected, resv will be NULL and a call to dma_resv_init(resv)
The description here is correct, but the subject line is a bit misleading.
Please use something like this instead "drm/ttm/tests: incorrect assert in ttm_bo_unreserve_bulk()".
> will dereference a NULL pointer.
That irrelevant, an allocation failure will result in a NULL pointer deref anyway. This is just an unit test.
>
> Fix the assertion to properly verify the resv pointer.
>
> Fixes: 588c4c8d58c4 ("drm/ttm/tests: Fix a warning in ttm_bo_unreserve_bulk")
> Cc: stable@vger.kernel.org
Please drop those tags. This is just an unit test, not relevant for stability and therefore shouldn't be backported.
Regards,
Christian.
> Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
> ---
> drivers/gpu/drm/ttm/tests/ttm_bo_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/tests/ttm_bo_test.c b/drivers/gpu/drm/ttm/tests/ttm_bo_test.c
> index f8f20d2f6174..e08e5a138420 100644
> --- a/drivers/gpu/drm/ttm/tests/ttm_bo_test.c
> +++ b/drivers/gpu/drm/ttm/tests/ttm_bo_test.c
> @@ -340,7 +340,7 @@ static void ttm_bo_unreserve_bulk(struct kunit *test)
> KUNIT_ASSERT_NOT_NULL(test, ttm_dev);
>
> resv = kunit_kzalloc(test, sizeof(*resv), GFP_KERNEL);
> - KUNIT_ASSERT_NOT_NULL(test, ttm_dev);
> + KUNIT_ASSERT_NOT_NULL(test, resv);
>
> err = ttm_device_kunit_init(priv, ttm_dev, false, false);
> KUNIT_ASSERT_EQ(test, err, 0);
next prev parent reply other threads:[~2025-03-13 14:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-11 19:01 Qasim Ijaz
2025-03-13 14:20 ` Christian König [this message]
2025-03-13 15:46 Qasim Ijaz
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=6a24d733-88ef-4cfb-8cc8-1c01fb64fc0f@amd.com \
--to=christian.koenig@amd.com \
--cc=Arunpravin.PaneerSelvam@amd.com \
--cc=airlied@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=karolina.stolarek@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=qasdev00@gmail.com \
--cc=ray.huang@amd.com \
--cc=simona@ffwll.ch \
--cc=stable@vger.kernel.org \
--cc=thomas.hellstrom@linux.intel.com \
--cc=tzimmermann@suse.de \
/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®