From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 387E8434409; Tue, 21 Jul 2026 23:01:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674861; cv=none; b=J9rKZOBvmQnuDTsKrVqDsp87yiKg/cqgF9hGXtpt+ImRkroI/wKOMdIbF6CBJVH1YhyrocA6LWVS26khxR+70X5p99H/I4dZDVK1avFEFn/Zl5Daf0V3vG0j6FPE1z0cflqBIRDtQ+WrLw1OaGaamrE26N+7xcRSmStIKeNHz88= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674861; c=relaxed/simple; bh=ZiKuvjVwFhFlnhjgl1YK3gmpnAqZ+R97k6qQNTbeTlo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PDpLZtbLSge+0QYzR2ADASgJ9s1kEbFLNy8HPArs3wnBvm0ohkDSzglh+YpBgj1vAGuO5BToEyT6ZFw6k4P9smoLCSqIoHJ6vKv/dHN4i30LNLvEz+4rPfI14YO18iYw314FK0CHfKR53YActJDcDR/1xxgw8ZQD24dd40iQ2EY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1XZkSrcs; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1XZkSrcs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E19E1F00A3A; Tue, 21 Jul 2026 23:00:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784674860; bh=zp/plGtb17/6tqBaH+bYS9mzgJkIkx9Sp8pvCFuHwZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=1XZkSrcsdaDdywZ1Xjq2ZeheXt4G6e22sjL/VWAMpdo4N26awD5xkUEcBrBMFsgva B0hY4VCANeC5kWRVgy7Aj8RvxdMv1aVQ75MzFkEKiKLD4oN4/d/g3gt2kuRZoeg0eE zSfwNbOY1LMcuI/nk0aMmY6wS0r+UDusKR1qMWWE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ahsan Atta , Maksim Lukoshkov , Giovanni Cabiddu , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 681/699] crypto: qat - fix restarting state leak on allocation failure Date: Tue, 21 Jul 2026 17:27:20 +0200 Message-ID: <20260721152411.134488800@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152355.667394603@linuxfoundation.org> References: <20260721152355.667394603@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ahsan Atta [ Upstream commit 7d3ed20f7e46b3e991936fedd7a28f3ff4aec8d2 ] In adf_dev_aer_schedule_reset(), ADF_STATUS_RESTARTING is set before allocating reset_data. If the allocation fails, the function returns -ENOMEM without queuing reset work, so nothing ever clears the bit. This leaves the device permanently stuck in the restarting state, causing all subsequent reset attempts to be silently skipped. Fix this by using test_and_set_bit() to atomically claim the RESTARTING state, preventing duplicate reset scheduling races under concurrent fatal error reporting. If the subsequent allocation fails, clear the bit to restore clean state so future reset attempts can proceed. Cc: stable@vger.kernel.org Fixes: d8cba25d2c68 ("crypto: qat - Intel(R) QAT driver framework") Signed-off-by: Ahsan Atta Co-developed-by: Maksim Lukoshkov Signed-off-by: Maksim Lukoshkov Reviewed-by: Giovanni Cabiddu Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/qat/qat_common/adf_aer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/crypto/qat/qat_common/adf_aer.c +++ b/drivers/crypto/qat/qat_common/adf_aer.c @@ -116,13 +116,14 @@ static int adf_dev_aer_schedule_reset(st struct adf_reset_dev_data *reset_data; if (!adf_dev_started(accel_dev) || - test_bit(ADF_STATUS_RESTARTING, &accel_dev->status)) + test_and_set_bit(ADF_STATUS_RESTARTING, &accel_dev->status)) return 0; - set_bit(ADF_STATUS_RESTARTING, &accel_dev->status); reset_data = kzalloc(sizeof(*reset_data), GFP_KERNEL); - if (!reset_data) + if (!reset_data) { + clear_bit(ADF_STATUS_RESTARTING, &accel_dev->status); return -ENOMEM; + } reset_data->accel_dev = accel_dev; init_completion(&reset_data->compl); reset_data->mode = mode;