From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A2EEC1A315A; Mon, 10 Mar 2025 17:16:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741627003; cv=none; b=R3RK7kmwrXEC09xDq/mfmbpHK5Bl3Ub6VvrocU1+6/FnPrR9Pi97FljOJKuRXAw9mMu1xeW/XjssapOrc5GgvAN0hDezbLH2E/WkwOuNLcOh0vRiB7nbWgVNkU/lSm3Es0JkebhmNVSZa+qszlFJnb9hGV8Dyd0Aue7kE/r+Lxc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741627003; c=relaxed/simple; bh=mwcXsBTKC5r2HJy38BrF1A0qYBf/93AZIH4JCU+J1f4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tV4GJWO0zqIQO2ZroRTJf70OARia0IJ+cvYH3R1oZh1UwZZ177fq4xs0NnQS3wJwmecJGka73vZShq8ajcfEbN7ryusGs3qQJPOWclwdIpZRTL/G1KacNe8eE+pZfrB9y5Usg3bZRtCEmKtjXnK6RJecbA7MFhh+gmnm8pn4Cyk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rZEE6/4n; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="rZEE6/4n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BADAC4CEE5; Mon, 10 Mar 2025 17:16:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1741627003; bh=mwcXsBTKC5r2HJy38BrF1A0qYBf/93AZIH4JCU+J1f4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rZEE6/4nGttweVlgPSkFQGVO/5AkehpyhiFhapT/xY1i1MXN0Q/2u6kkL/cgjH1xS Hy98HduqDVUuILn3hvXk6e1UNRGc6HF1xXRhiofC7vgXZWovftANjdm9p3NXZ1kMC/ ptrRe44zn9EcA8zxIfb5ES+Te1YOi4m5zZdO62Ho= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Visweswara Tanuku Subject: [PATCH 6.13 188/207] slimbus: messaging: Free transaction ID in delayed interrupt scenario Date: Mon, 10 Mar 2025 18:06:21 +0100 Message-ID: <20250310170455.256043227@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250310170447.729440535@linuxfoundation.org> References: <20250310170447.729440535@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Visweswara Tanuku commit dcb0d43ba8eb9517e70b1a0e4b0ae0ab657a0e5a upstream. In case of interrupt delay for any reason, slim_do_transfer() returns timeout error but the transaction ID (TID) is not freed. This results into invalid memory access inside qcom_slim_ngd_rx_msgq_cb() due to invalid TID. Fix the issue by freeing the TID in slim_do_transfer() before returning timeout error to avoid invalid memory access. Call trace: __memcpy_fromio+0x20/0x190 qcom_slim_ngd_rx_msgq_cb+0x130/0x290 [slim_qcom_ngd_ctrl] vchan_complete+0x2a0/0x4a0 tasklet_action_common+0x274/0x700 tasklet_action+0x28/0x3c _stext+0x188/0x620 run_ksoftirqd+0x34/0x74 smpboot_thread_fn+0x1d8/0x464 kthread+0x178/0x238 ret_from_fork+0x10/0x20 Code: aa0003e8 91000429 f100044a 3940002b (3800150b) ---[ end trace 0fe00bec2b975c99 ]--- Kernel panic - not syncing: Oops: Fatal exception in interrupt. Fixes: afbdcc7c384b ("slimbus: Add messaging APIs to slimbus framework") Cc: stable Signed-off-by: Visweswara Tanuku Link: https://lore.kernel.org/r/20250124125740.16897-1-quic_vtanuku@quicinc.com Signed-off-by: Greg Kroah-Hartman --- drivers/slimbus/messaging.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/slimbus/messaging.c +++ b/drivers/slimbus/messaging.c @@ -148,8 +148,9 @@ int slim_do_transfer(struct slim_control } ret = ctrl->xfer_msg(ctrl, txn); - - if (!ret && need_tid && !txn->msg->comp) { + if (ret == -ETIMEDOUT) { + slim_free_txn_tid(ctrl, txn); + } else if (!ret && need_tid && !txn->msg->comp) { unsigned long ms = txn->rl + HZ; time_left = wait_for_completion_timeout(txn->comp,