Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1434959rdb; Sun, 8 Oct 2023 07:39:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEjxkRpuOrcgiVNwYjFNp0Oir00gBhaV276sY8zgNyDy79JJyht/QucwgsCFHRVC+c/d8lM X-Received: by 2002:a05:6a20:6a28:b0:15e:1351:f33a with SMTP id p40-20020a056a206a2800b0015e1351f33amr13425406pzk.47.1696775943106; Sun, 08 Oct 2023 07:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696775943; cv=none; d=google.com; s=arc-20160816; b=kE4NnOT9U47Ih4EzRP4LX5yoSUYFJPqdNOClvptOmn8uM42W+FpNyDuBPcjt5rB46i m/QuiqceW+ZpcAZWPcRN/2DFZw2vOv420h67b/1jjy3rjEAKOoW9VKp5delR9T0jV6dm a+BsIe9khuPn6iVSj8mVT0jTyoIbsV9Hs+vUokZikjexp4yX1ebjjL94M92yVzt+W1Wd A4++ffRUGhahkjMyUWPzRvS6uoG7czDsvG8CWDYWMypJsyGv/M1lknZjs7DT+RWI+an6 KfPECjo2bOGzonkRy2f3RuSvyriZENvI2WgHp1E3ZC6L84yie8FfymNgXlX/FCurvxOx G9Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=RoI0NzZPsRKEzf3D3JCemfXog6bSvCczYoK0HGBz6tk=; fh=o3TQe9DYTZYpfekWW2YnKGgMaQ3WKUt1ZeOSahlpawI=; b=Bb4a07CCsi1dGoNvczAytiVYBvsycRjaGIBlr4yk0QwrHGw9zTb4q5DufjngoMe73p Ed2E0NmcP96dGgDDVH0ZNv2WcaFbJMq3D1jt+FkOOlZnqZE1q65Ku+oqd/zcTsKAQ3Re 5cbDOUW9zQgfcp06SqyaSwio2zh4OEwXqUB9N7BV/2bAZ/vw6g7fe2R/9BI6ehbqEUd2 ruXif0FPxlAOJUr1VkcfKdjnp3Yg3ZO/aKXazSoiUSBBvEhGQNnKl0JsVjK1vBvUHr+y GBsnyWv4NSr1x8wVXzjXXzud4l9s/1vixZUhm1076Bqq9fDpj9EB7iUj39WkAw0HdRh7 oaGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=Q8eNVony; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id v17-20020a170902ca9100b001b8b437b01esi7331593pld.350.2023.10.08.07.38.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Oct 2023 07:39:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=Q8eNVony; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id BDBEC802682B; Sun, 8 Oct 2023 07:38:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234338AbjJHOhE (ORCPT + 99 others); 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=20K=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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sun, 08 Oct 2023 07:38:54 -0700 (PDT) X-Spam-Level: ** 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); -- 2.42.0