[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210526140459.3749959-1-colin.king@canonical.com>
Date: Wed, 26 May 2021 15:04:59 +0100
From: Colin King <colin.king@...onical.com>
To: Ben Skeggs <bskeggs@...hat.com>, David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Alistair Popple <apopple@...dia.com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Andrew Morton <akpm@...ux-foundation.org>,
dri-devel@...ts.freedesktop.org, nouveau@...ts.freedesktop.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][next] nouveau/svm: Fix missing failure check on call to make_device_exclusive_range
From: Colin Ian King <colin.king@...onical.com>
The call to make_device_exclusive_range can potentially fail leaving
pointer page not initialized that leads to an uninitialized pointer
read issue. Fix this by adding a check to see if the call failed and
returning the error code.
Addresses-Coverity: ("Uninitialized pointer read")
Fixes: c620bba9828c ("nouveau/svm: implement atomic SVM access")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
drivers/gpu/drm/nouveau/nouveau_svm.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c
index 84726a89e665..b913b4907088 100644
--- a/drivers/gpu/drm/nouveau/nouveau_svm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_svm.c
@@ -609,8 +609,10 @@ static int nouveau_atomic_range_fault(struct nouveau_svmm *svmm,
notifier_seq = mmu_interval_read_begin(¬ifier->notifier);
mmap_read_lock(mm);
- make_device_exclusive_range(mm, start, start + PAGE_SIZE,
- &page, drm->dev);
+ ret = make_device_exclusive_range(mm, start, start + PAGE_SIZE,
+ &page, drm->dev);
+ if (ret < 0)
+ goto out;
mmap_read_unlock(mm);
if (!page) {
ret = -EINVAL;
--
2.31.1
Powered by blists - more mailing lists