From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 923EA2BEFF5 for ; Mon, 2 Feb 2026 06:33:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770014036; cv=none; b=Mr8Pra+RvhlXZODQPyrl9asTudM93zzJ6SMXLisyCukb1u6aHRunA+Swy1MTVmGsjZAVr1KnBu/vdXDKZcqQlqotHvF/LuthQLfhfA0aJFQAobdTQHpkOD5yVIrRuG/mNyPEpFrOaKF5Ja1XkeY6uFVhz1shDQ5B4z3wL2Wic0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770014036; c=relaxed/simple; bh=5A8MkJi0Ij6IEGxQSCWOeS9alDTiAmt2QDnFwYsFduI=; h=Message-ID:Date:MIME-Version:Subject:To:References:Cc:From: In-Reply-To:Content-Type; b=Iqgg17BQB21+WuMCR5CNuFqmkUqOzePjq6+Fe26A7OOnjKKenTdRzxKY6V5z/jKbcYqeTv+gHPDPcOkFJ34E+wJXGKNBk9kg4Ipt9srE/u7HG4oLnCNo4XbKvXBC2pGmUWC9j7rQu9D2E+z7nNDkXqMiSMp0/BUo159oJVsqnik= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=b/whkhJQ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=I+pIhGdj; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="b/whkhJQ"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="I+pIhGdj" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 611MqajL1870630 for ; Mon, 2 Feb 2026 06:33:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= SmudMRzI4gMTA4iimv99L9nomB2MGIhNGyeIOMqavVQ=; b=b/whkhJQ/csK2XSk dp69c0L3RKpWtoiQOYci4aoVNd0WplVf6npNfxyeHyTHIns1Li0UatUe+1ApAWTJ lZqQzUvM0iSobXYymulYseDqiGanKI26KD+zrA8y85d6swR1RHtcXHNInECiSAw9 Ad8Dg1r3YRbTpLWeoeFT6q0O7dxf4C7okk2UFovm9hgxZh4ZBycsEBpmhojVueLU dCGZlrhiDH9iKFkqc5lT0Y2hX3kQxa7Sl/CfngiBxIvLiwI7zxVPwwLW7xlUl2qF NPNswd4CVwwyO5dZwFEpKpB3bLAzIY8WEg5qgaMjchGy5yIbKImD7tQm3Hr1QamG eGJFMg== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c1avnm7xq-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 02 Feb 2026 06:33:54 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-b630b4d8d52so2824583a12.3 for ; Sun, 01 Feb 2026 22:33:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770014033; x=1770618833; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:cc:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=SmudMRzI4gMTA4iimv99L9nomB2MGIhNGyeIOMqavVQ=; b=I+pIhGdjCMo6WXmK7utkjuGB1zMBbCjhBCm8RsL9vF7MCHYaQo10hF/8Xb+bheWl76 fnmIDaFcTqDoZy787VsjHJxynM44veHEc0y3aCQRrjSlH+HkpnScpz7egIi4/bodRaLa 8osPKuZVFmsIgRwFzHicslUu7Hx+EnFeQbs0v+JImyUuLDy7h730mktWz0G7TKNaAZw0 bGI1UucCeR7AY5dh4VP0FYhGi7qR0WIOOcBjUAicfNjJ+GTg1U18tFpUOmf0XIjZqp89 9SO+DZVqOSEuRoPlh9vw08nX4onZvUwRP1Vm2Jrcyk0zWadxDGAaXNBW8QkT9QHIbCOL QHCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770014033; x=1770618833; h=content-transfer-encoding:in-reply-to:from:cc:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SmudMRzI4gMTA4iimv99L9nomB2MGIhNGyeIOMqavVQ=; b=nSzizV13NCys4ByWnohCEsz3s+VnmHv74MZcBYFi1fTsqyuE5O49cnSxI2NrqDZq0v viJ94iQyntbY7nQA6c9WxnZ/GyI6gpVWzfEVBKKwmRMEE7KTPzprSVwUpeQDwdaJa/Kg y6GNmiLXmXz6VFt6nk6/pWvz7Q8c11465LgRC53DFXHPS8q/RxGEOXUIfwenajgB9RLP B86Sh2hp3QUKAEbZGvJ/mRkNuyPmWREAOlnSEvT/wLQ4Z8pHSadqtl165W5piErkLVJY Ua6rpD5mLgzPQG8FV7Yod+oJHqNUCO7Z+zD48scWqs+bDmVUC5lRD27Y50gLVzUMKhxP 46iQ== X-Forwarded-Encrypted: i=1; AJvYcCU3d4BAgb9MZPZaHWCHn4E7GZ7tNCvY4yVVWDZajf8jfw/tQ1BjctDwbBJTT+JDn+jVJOHNo9cv5dWVFMc=@vger.kernel.org X-Gm-Message-State: AOJu0Yxm2v1wZOlwuDQV9IPDqmvTEqg2b2ruPsS0+dQfAVKwznQSYBML CP4uB2dxA16pcKUOyhAeNNjGqqBGvx5dcTLeGqvZusjunjlA+a7d9SSLN6X0PlxX4PY2AA/nLaA fOu1NqC2/vznKBafZo5dyl47JTDhsTJTKdHl7q3dgtK3BCGbTpdXtgn2ww3q7GRqGi88= X-Gm-Gg: AZuq6aIaFjR9iZ1dlaV+FeeqqQiDS9fJfQuBea/Gw0vQQBKiKjBemn1n++XyhKpmHPp 0k6Ko6oN1wxVlI2KHaJnpQcQFCUnX8YNhfhkFVi2gXuAKF3nz4UZfn9q5kbbtLwN8bXTARSQuu0 7GzmCmNEmAOHSlYmL4I5qqG9AWQYFtu7SZcOFQxVAAcSPZH9EsFFh9VgU9X4kmGdgyUQSMIfLfh cz7XH0qT1PxCxF6MrcH1ePCQJ65k8wS9kgPyoZhWm1iSektKDjVgWhKdaq5Bl39cuIGdz+Ukr7u 1XovGryP8ctUpzeMM/MnC4ehN+K8YvvXFuRzbys2P3di5dJos+kY1ED7NXZb8bWB1evPH1+oiB8 kavB1mAlrI/f+ZaPs4S5M/YadyTJQ1fON4fJBrQGmBtSMmQdPtzQCbV6bbITrQMMD3k+/y7lsc5 Pdoh52 X-Received: by 2002:a05:6300:404c:b0:38d:e87c:48c2 with SMTP id adf61e73a8af0-392e015baabmr10217881637.58.1770014033354; Sun, 01 Feb 2026 22:33:53 -0800 (PST) X-Received: by 2002:a05:6300:404c:b0:38d:e87c:48c2 with SMTP id adf61e73a8af0-392e015baabmr10217852637.58.1770014032879; Sun, 01 Feb 2026 22:33:52 -0800 (PST) Received: from [10.133.33.100] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a88b4c3d2bsm143216935ad.53.2026.02.01.22.33.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Feb 2026 22:33:52 -0800 (PST) Message-ID: <9572d8a9-de90-45ca-903c-a11bc69d0213@oss.qualcomm.com> Date: Mon, 2 Feb 2026 14:33:45 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/4] misc: fastrpc: Add NULL check to fastrpc_buf_free to prevent crash To: Dmitry Baryshkov References: <20260115082851.570-1-jianping.li@oss.qualcomm.com> <20260115082851.570-2-jianping.li@oss.qualcomm.com> <6usjefc55acdchitwe3usqtkr6ca4rtaen3at5knwygakdkze7@caqxdadvnz44> Content-Language: en-US Cc: srini@kernel.org, amahesh@qti.qualcomm.com, arnd@arndb.de, gregkh@linuxfoundation.org, linux-arm-msm@vger.kernel.org, thierry.escande@linaro.org, abelvesa@kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Ekansh Gupta , quic_chennak@quicinc.com, stable@kernel.org From: Jianping In-Reply-To: <6usjefc55acdchitwe3usqtkr6ca4rtaen3at5knwygakdkze7@caqxdadvnz44> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-ORIG-GUID: Z9991L4QWj7566vzsQwu0y90yk2KdRQI X-Authority-Analysis: v=2.4 cv=bPMb4f+Z c=1 sm=1 tr=0 ts=69804552 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=VwQbUJbxAAAA:8 a=erMO1dRUYXsmLKenB8oA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-GUID: Z9991L4QWj7566vzsQwu0y90yk2KdRQI X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAyMDA1NSBTYWx0ZWRfX2BHjsn/g2SSq eGVJGt2+CEJbwZZBANrnxIhsj8qxxhpXzBQBqaIWlpo6j2F1eP8cLL1OIw0tceLJB+tH4pCAYVI MjoFLYSG/J+xCxh/IXGZR26w3ViFMaPC6IdYVd3vhDEtTEBnL5KPALI7oPyS3yDeGl101GFEHKf C+gpwm3D6AZTE7seex/SpyUWHENBuiHxtAG1jKTJCZ1xr0Gie+3MVEq6iJCCky3t7i9G9LpXs9x x311OphFJoV1cVzGc9rbTnwiACQ2vs33EglgiaEsN+pl80bD1OZh9cWn5JE71Q8jUmadQI6JQIW 6ANxswasaOwfzOP0LRPPY/qpLiz/QfDfYvvzn6BOiSPU80TSUYAosA5/cbdtNSu/FFgXUWDv1nE 5shWjz1oF9n0dvIM4dJaVSOy7KgkWzmoNaklGm21iKv5JBCPOBQmo2fT70BNSIo9sY7b8uYsoHu ew3AJp1xDYWr5Ko0+Yg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-02_02,2026-01-30_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 malwarescore=0 suspectscore=0 bulkscore=0 phishscore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602020055 On 1/16/2026 4:43 AM, Dmitry Baryshkov wrote: > On Thu, Jan 15, 2026 at 04:28:48PM +0800, Jianping Li wrote: >> From: Ekansh Gupta >> >> The fastrpc_buf_free function currently does not handle the case where >> the input buffer pointer (buf) is NULL. This can lead to a null pointer >> dereference, causing a crash or undefined behavior when the function >> attempts to access members of the buf structure. Add a NULL check to >> ensure safe handling of NULL pointers and prevent potential crashes. > > When does it happen? Do you have a backtrace or is it a safety coding? > Do you pass NULL buffer pointers to the function? Thanks, Dmitry. Yes, this change is mainly for safety‑coding purposes. This is reachable on during remove/deinit sequences when a buffer was never allocated or allocation failed part‑way and cleanup proceeds. It's a saftety coding: to eliminate NULL checks on the caller side, as we do in a lot of other kernel API. At the same time, there is a possibility that this buffer passes NULL, and during verification, this can cause the kernel to crash. The patch makes fastrpc_buf_free() NULL‑tolerant and simplifies callers by removing duplicated if (ptr) checks, reducing the chance of future omissions. > >> >> Fixes: c68cfb718c8f9 ("misc: fastrpc: Add support for context Invoke method") >> Cc: stable@kernel.org >> Co-developed-by: Ekansh Gupta >> Signed-off-by: Ekansh Gupta >> Signed-off-by: Jianping Li >> --- >> drivers/misc/fastrpc.c | 12 ++++++------ >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >