Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp305298lqp; Wed, 22 May 2024 05:25:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUusNuoWQC7r9IKgsWhUdvEmLcf7RZFDWLxat2uzgfCULjp1j1mLuByLBvNtI+n1TdPxtvrsQNhvz0LiLApbm9UKe8NqWjy1JELipDcyA== X-Google-Smtp-Source: AGHT+IFY2mH/2EW59mHHHoO6+SOGmBA49cG2Y3bk3QDV/XsmwgyGzxv1u4xdV3eWC6nYLcWHCBjp X-Received: by 2002:a17:906:e246:b0:a5c:eeb8:5215 with SMTP id a640c23a62f3a-a62280692a7mr125062066b.10.1716380700750; Wed, 22 May 2024 05:25:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716380700; cv=pass; d=google.com; s=arc-20160816; b=YYa4NNw4G2ylR1o+v5orVngq9wh3hG5KVbK+c54fqWpW2YhnfMDX0ojcyy05bcm/6F 9zJDuIfY7Ef/yqnFY0cGhklhWnfvvmkqurjltMsTsRA629bt8exhONANX8iRY8TxLIFT gNsaIX9xVg9pnNf/w+UCeXOHULbos4w7yx5G2vuCmxrs5VIpCXGzB3n6sQA80St0SlWO DzSnSF04JiI5RKVNLNAp5KF2kUYcuIh2zMB81q8SxYYTT8XaqwgnvjugbxOmE5Dp7p+f 77ooeyi0yrd3Cy1RMIEvtYgdR3N2suOp9YlzIFpWtLBoWkuXA169bX0nNG8RjUmVmoZd fAuA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature:dkim-filter; bh=rUu2N2ra3UJOVujeAUs8p16HRSJ3CxlvSQFgHAEciJQ=; fh=AZoJlEgNy+bo93EkXluaPQIW9RaQ+7gEeLV54ZvmIVk=; b=S3r96cgOj03oHAFfR0UXNJny8V2/t7UDL7OX26iSgV5mtPCkt4j16GXzKAaTnMF1UU YdmeyPu9ABMhME19k26Lz5jg5ar39t1/1Fk7B/ljy0hfWQ4jtRITB683KVSa6lunxEp5 t/Bw+cyVW9BU/rw/J3ep4wCGYM0A2dMQS8LYJzMJUFB1lveCKWePldrOLoITmg8M33pP tDJF/RPeh4T/FOSYOVEIZX1faiwCp0nREeMOgZhsrlc7Kb5O4RvmY+ud8AVnw+TqP8on yZSw9X0o8oYd2OCv3T0A4hFqmX9e/yLlqdZcDAa+TfkRTv6ee7Y6U3GEPmEvsEbvcXsL E12Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=HAL+jQ5B; arc=pass (i=1 spf=pass spfdomain=ispras.ru dkim=pass dkdomain=ispras.ru dmarc=pass fromdomain=ispras.ru); spf=pass (google.com: domain of linux-kernel+bounces-186215-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186215-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a1797caecsi1500801666b.257.2024.05.22.05.25.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 05:25:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186215-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=HAL+jQ5B; arc=pass (i=1 spf=pass spfdomain=ispras.ru dkim=pass dkdomain=ispras.ru dmarc=pass fromdomain=ispras.ru); spf=pass (google.com: domain of linux-kernel+bounces-186215-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186215-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 79DB31F2378B for ; Wed, 22 May 2024 12:25:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A90813D63D; Wed, 22 May 2024 12:24:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b="HAL+jQ5B" Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78B7F13D623; Wed, 22 May 2024 12:24:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.149.199.84 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716380687; cv=none; b=DW5phyaz4qsXByP68FyKbRNDD3YjNq6QB+1Lvzwog+l3p6OppM7HNCUXx05XxMV/gDgo5Rk1BqUwNznvKxlNLV8LT/gTtO62JDUqmB+lpU3zAsDYmYWNmqzZr6c1MTb2Y7ZgMe/X10o48CDH+9evVgmHovKbaiYNCmVzzjFfVYI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716380687; c=relaxed/simple; bh=SbgR4B/8IUmHI5DK+/2w/6ZWjC7dExfDIqXUiYTONlA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Cg9riUT0vAfeE9gQA1AjdDVvTGxS3l9iegO+DnZAmLwzETioHjBNv7pySOBZtiExgKIfykly9zyxKZ/ltP5EVT9oZYHNAKVZbEF613udFX4woKDzHhgcld/evE07dz/qPCJJIfYNSTxH+oUg4e/IKTnvEjI70p+gJf3TR3jo/Z0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ispras.ru; spf=pass smtp.mailfrom=ispras.ru; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b=HAL+jQ5B; arc=none smtp.client-ip=83.149.199.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ispras.ru Received: from fpc.intra.ispras.ru (unknown [10.10.165.15]) by mail.ispras.ru (Postfix) with ESMTPSA id C31C74076723; Wed, 22 May 2024 12:24:41 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru C31C74076723 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1716380681; bh=rUu2N2ra3UJOVujeAUs8p16HRSJ3CxlvSQFgHAEciJQ=; h=From:To:Cc:Subject:Date:From; b=HAL+jQ5B00d6NN5gqADYkmUDvs/AwYoXznpBcLvjjuk5ceUT40KCjExf2AMX94rWg qJS4NzODO20uMm0SQfeqo5JHLEPRZfgfR40ez2S52YcR7YBOMm5qqqT2XIVCQvqsQB d5S34/eA0XruF8UaVr57Jem/4C6SHQTdM6IMHHMU= From: Fedor Pchelkin To: =?UTF-8?q?Christian=20K=C3=B6nig?= , Sumit Semwal Cc: Fedor Pchelkin , Chris Wilson , Daniel Vetter , 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, stable@vger.kernel.org Subject: [PATCH] dma-buf: handle testing kthreads creation failure Date: Wed, 22 May 2024 15:23:26 +0300 Message-Id: <20240522122326.696928-1-pchelkin@ispras.ru> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit kthread creation may possibly fail inside race_signal_callback(). In such case stop the already started threads and return with error code. Found by Linux Verification Center (linuxtesting.org). Fixes: 2989f6451084 ("dma-buf: Add selftests for dma-fence") Cc: stable@vger.kernel.org Signed-off-by: Fedor Pchelkin --- drivers/dma-buf/st-dma-fence.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/dma-buf/st-dma-fence.c b/drivers/dma-buf/st-dma-fence.c index b7c6f7ea9e0c..ab1ec4631578 100644 --- a/drivers/dma-buf/st-dma-fence.c +++ b/drivers/dma-buf/st-dma-fence.c @@ -540,6 +540,12 @@ static int race_signal_callback(void *arg) t[i].before = pass; t[i].task = kthread_run(thread_signal_callback, &t[i], "dma-fence:%d", i); + if (IS_ERR(t[i].task)) { + ret = PTR_ERR(t[i].task); + while (--i >= 0) + kthread_stop(t[i].task); + return ret; + } get_task_struct(t[i].task); } -- 2.39.2