From patchwork Sun Oct 8 14:36:36 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pavel Sakharov
X-Patchwork-Id: 13412742
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id 9D388E95A67
for ; Sun, 8 Oct 2023 14:37:04 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S234336AbjJHOhE (ORCPT );
Sun, 8 Oct 2023 10:37:04 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40560 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S232990AbjJHOhC (ORCPT
); Sun, 8 Oct 2023 10:37:02 -0400
Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F387EA4;
Sun, 8 Oct 2023 07:37:00 -0700 (PDT)
Received: from localhost.localdomain (unknown [85.89.126.105])
by mail.ispras.ru (Postfix) with ESMTPSA id 4C4ED40F1DEB;
Sun, 8 Oct 2023 14:36:57 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 4C4ED40F1DEB
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru;
s=default; t=1696775817;
bh=RoI0NzZPsRKEzf3D3JCemfXog6bSvCczYoK0HGBz6tk=;
h=From:To:Cc:Subject:Date:From;
b=Q8eNVonyqxFLuwSGdRKO3poe5TFCrbHZorXms5AfSGQK/RYBvjDy5T6lJiNKTtKEM
hisIozg7H45+6TZ4xM8DJF6FYvAC9qaMwpwZqpNpB2BIEmZfmAvjT3znNBXzTMpn4m
y6DKkfx+IMycG/5rg0CdUm8BDz8h7RMB1UfPG9cQ=
From: Pavel Sakharov
To: Sumit Semwal
Cc: Pavel Sakharov ,
=?utf-8?q?Christian_K=C3=B6nig?= ,
Arvind Yadav , linux-media@vger.kernel.org,
dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
linux-kernel@vger.kernel.org, Alexey Khoroshilov ,
lvc-project@linuxtesting.org
Subject: [PATCH] dma-buf: Fix NULL pointer dereference in sanitycheck()
Date: Sun, 8 Oct 2023 17:36:36 +0300
Message-ID: <20231008143637.113957-1-p.sakharov@ispras.ru>
X-Mailer: git-send-email 2.42.0
MIME-Version: 1.0
Precedence: bulk
List-ID:
X-Mailing-List: linux-media@vger.kernel.org
If mock_chain() returns NULL, NULL pointer is dereferenced in
dma_fence_enable_sw_signaling().
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Pavel Sakharov
Fixes: d62c43a953ce ("dma-buf: Enable signaling on fence for selftests")
---
drivers/dma-buf/st-dma-fence-chain.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/dma-buf/st-dma-fence-chain.c b/drivers/dma-buf/st-dma-fence-chain.c
index c0979c8049b5..661de4add4c7 100644
--- a/drivers/dma-buf/st-dma-fence-chain.c
+++ b/drivers/dma-buf/st-dma-fence-chain.c
@@ -84,11 +84,11 @@ static int sanitycheck(void *arg)
return -ENOMEM;
chain = mock_chain(NULL, f, 1);
- if (!chain)
+ if (chain)
+ dma_fence_enable_sw_signaling(chain);
+ else
err = -ENOMEM;
- dma_fence_enable_sw_signaling(chain);
-
dma_fence_signal(f);
dma_fence_put(f);