From nobody Mon Feb 9 03:30:54 2026 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54BA6376BD7 for ; Thu, 29 Jan 2026 23:41:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769730108; cv=none; b=SuGQz9Ta4qZqdZl7FUKV62p6sfxxekrsihT9kJNb0gCGwSMh4ExGV/vLS0s525N1ozsTpygvWqYKywSha6KjC8Xau7lHA2yDry1V7EqeiVSOSBXZgkq5yaLbyzFdtjaqsjVVhRGVZyoGUozKHlb3H0OhmCLqH7LZ+F4NjsBS1wg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769730108; c=relaxed/simple; bh=QH1FbRZ5O40aoaT0YcL+3+LXNJuDKiXP0TiGLPkfKQo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=lkk0s/TIj+eMbbvUKaZF5XLUVfTKDpUYQAPNtoJaQ08hL3Z/2JNyMD32h57w/eNcofpDJPigsHrDlvRXq5zqwExwz39fF/Fml+T8KukzCOo9mG5ZmlIoCs+Y0flhycioHAgq9e4oUlZoewjbxuUJZxl9kSKe3znFLubSkl0Cs4s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MS0yJ21G; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MS0yJ21G" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-81f4e136481so769627b3a.3 for ; Thu, 29 Jan 2026 15:41:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769730106; x=1770334906; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=98ySn8T1ILY+Jx5xtFPY1cgInaA1UDWQE/WcppunKN0=; b=MS0yJ21Gj1xy0K4toaQA8qYQx/FIpyUIe+Yu6JG3mk4cUtrbUxr6ODn3Fc6lKvM+1F e99euSMISlZsmIiBCuewRNn2jdZa6toHHJZN70fRHQCxVYjfuk7SiY0mgkNEchP6/B2i H1D5mKB/TKdvD7S077SrBHX5SV1+xhjSuAtE3ZpiR1t/OF5H7aRK4mD+ReAs5b9CwgDK D97TtcjrL90VskZEHqrGia5rE7bxm7Az65lSAO/ao/yj+ZlmH6qKEqGIrl2QeeVwCoSc 1BjCTOvbPjvy5STVmUF56ij08BWv44oI/X3UsX/0dOD5U0XzolKnovL1lXkVL/EPcOOK pNCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769730107; x=1770334907; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=98ySn8T1ILY+Jx5xtFPY1cgInaA1UDWQE/WcppunKN0=; b=mQgOHkArauK2RXP/Ztlv1nRn84RFvYwaJJi6VYppLPfmVm0XQaRIUZcgXW27KsQuaM sn7dP+kDJqJiR/TAa4gfe/0ntrn7O4jpEU5SmJhARIjtADISJ/OSJ5dMhAS7ATM0BDXm MmyOT7CZaQTMmUBXodp/FYGHBUGRuV1LyAtiwl0HjgSYtnwgNXEFrp8l1dNrpZSlflIg kdL9JTSfW6rOO7WllbLuXcEOmxZD07gao3n0F5kYlfh5OWfzEIU5dzAJWUqd4Dmy7MbJ 5maEmiWR2t43zJRIHd1pX/kbEop9j2Hl0toBltkjKUM4vy7sAfL05+jS1kIQuWou8cFH r/Eg== X-Forwarded-Encrypted: i=1; AJvYcCUgW07ybrCnQLTV8jsRW9jOsMmvo5tFwOuEmbLqlREE0mPapp9cJPeNcfn8OKbSXw838ekd4a2HogzwhlA=@vger.kernel.org X-Gm-Message-State: AOJu0Yxwup+Y78dZbFItCWuXiUk/yvt5IposzP8xH5bMGT1leGm2itf1 MucOMGugKmt9OaIi7YjCWWqAmCGh7N9cc0PWsihG6yyDD7d1wfj+s9VK X-Gm-Gg: AZuq6aIdfiVWiaELHOD3r3Rr7OfGKtlhLa32Z5AeTdRDYslvD3v5CQEuFKFgN5BxrIB fonFbqlqScuIdiASiaRN8OavutePUk51Ala3EBYzsRTVBqrgwJIM0kuVEKPAX7CHzxb2kNok+L8 /VNwP2u8NYmssvwg+LwpS9iBU3c80ViS+DW5VZ3LsZDJHuzAMomkfdW1GQ16NSUntXg0JEfAk8L eUitF5EbMNpQ/Dk8jFpnoes6t32r1r24tXEHF/U9Wl787bptlblOnEBYIZFZ+UC6S8QkrpJjcLx cVIqW0yzEVedYQR5UPI20OCDqb8nJHJ846cRpp4lmp8p0/B5+glWIcRqNj/VXwScnrUouwoYxKv Opmfpo7Q3O5L1a5X1Km74xon36ak4TCQ32I5ZyAj2+queAjUVUZXQdgFocnPmMxyXr4qgDRSq3x 1ecGmAV2cBHqrBlE+AMdXmKjZd3nJjSUM= X-Received: by 2002:a05:6a00:39a9:b0:81f:be3c:37e4 with SMTP id d2e1a72fcca58-823ab67bc4cmr780481b3a.27.1769730106458; Thu, 29 Jan 2026 15:41:46 -0800 (PST) Received: from localhost.localdomain ([1.203.169.108]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82379c54d4dsm7397903b3a.67.2026.01.29.15.41.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jan 2026 15:41:46 -0800 (PST) From: Xingjing Deng X-Google-Original-From: Xingjing Deng To: srini@kernel.org, amahesh@qti.qualcomm.com, arnd@arndb.de, gregkh@linuxfoundation.org Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Xingjing Deng , stable@vger.kernel.org Subject: [PATCH v5] misc: fastrpc: possible double-free of cctx->remote_heap Date: Fri, 30 Jan 2026 07:41:40 +0800 Message-Id: <20260129234140.410983-1-xjdeng@buaa.edu.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" fastrpc_init_create_static_process() may free cctx->remote_heap on the err_map path but does not clear the pointer. Later, fastrpc_rpmsg_remove() frees cctx->remote_heap again if it is non-NULL, which can lead to a double-free if the INIT_CREATE_STATIC ioctl hits the error path and the rpm= sg device is subsequently removed/unbound. Clear cctx->remote_heap after freeing it in the error path to prevent the later cleanup from freeing it again. This issue was found by an in-house analysis workflow that extracts AST-bas= ed information and runs static checks, with LLM assistance for triage, and was confirmed by manual code review. No hardware testing was performed. Fixes: 0871561055e66 ("misc: fastrpc: Add support for audiopd") Cc: stable@vger.kernel.org # 6.2+ Signed-off-by: Xingjing Deng Reviewed-by: Dmitry Baryshkov --- v5:=20 - Add the detail description of how the tool detect. - Link to v4: https://lore.kernel.org/linux-arm-msm/20260128042600.2641857-= 1-xjdeng@buaa.edu.cn/ v4: - Add description of the detection tool. - Link to v3: https://lore.kernel.org/linux-arm-msm/20260117140959.879035-1= -xjdeng@buaa.edu.cn/T/#u v3: - Adjust the email format. - Link to v2: https://lore.kernel.org/linux-arm-msm/2026011650-gravitate-ha= ppily-5d0c@gregkh/T/#t v2: - Add Fixes: and Cc: stable@vger.kernel.org. - Link to v1: https://lore.kernel.org/linux-arm-msm/2026011227-casualty-rep= hrase-9381@gregkh/T/#t --- drivers/misc/fastrpc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index ee652ef01534..fb3b54e05928 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1370,6 +1370,7 @@ static int fastrpc_init_create_static_process(struct = fastrpc_user *fl, } err_map: fastrpc_buf_free(fl->cctx->remote_heap); + fl->cctx->remote_heap =3D NULL; err_name: kfree(name); err: --=20 2.25.1