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 ED433314A7A for ; Tue, 3 Feb 2026 11:00:30 +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=1770116432; cv=none; b=cun/CjtqrcJXTKUPqbStgHhO0xxoIxo1cRdD29W5sMLImSFAiykJ/pD64YH4viAU+saJK2fYEa1FQwrovZUyUG410uitoEb7jomVdtE84Ub+mTGSKv051i1AjA0BH4W03q4RrT7sLF4jGQFtV4Q0Nd76E5k+a9FdCqz+aQUENaQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770116432; c=relaxed/simple; bh=s8kd7B8nGOXVT9/T863Ij748peQ8U+2YLjiIBuPLaHk=; h=Message-ID:Date:MIME-Version:Subject:To:References:From:Cc: In-Reply-To:Content-Type; b=Qcjhxh+9HW2TW4U4VvQ/ECqnTAI69h54Ykpc0YzviYBCRvt26YJFcg8IwuRnHyqEnVKnUSwtIAgYi6/E6Hv0lR66j4jx0rPhCHfqBKl3NdAgMxs4regl/ym3bdxpKSrcXMCYrCBOcfkWZuXoq7g8nN87ZAih0LwpRlZuJmNNA24= 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=ovCclxQZ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=O6fiZcnm; 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="ovCclxQZ"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="O6fiZcnm" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6139t32I3388099 for ; Tue, 3 Feb 2026 11:00:29 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= oQkZfToFq8BT06VP1uFHEcrlVvgBQYb05e9o8S8pTFg=; b=ovCclxQZfTBJZHCj kvFChiXP97GakvAnTtA0UXKk0axdw2C6A/HEH5S/6SIPfoHT7qm8+Enh3DVjS7P0 zVr5M24ui5l6c4TqD/NiVaBKrrhsMxZ/Qh8iinaRLc74DBlaFe5sfWpSJG9PIWq/ LeSfugWP2yFY24hDDfwOhznjON2sPRNzF9UQsShXTkmNdz6DtdbiIDNuSUlkdtVL ZVaI+Lmmjo2W0U2lZ2La1A8DIkPCIQ7UTSHx5p/VE1QpxkwRtGGwlo2gUTxWhU/S VrzPqrr9sTnvN/Nt9xevL+JpzIcMJ4ryxdJ65SOYoQSvOlbgsVjFDBVFUKj/gTk9 qGnYfA== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c2xvbu6qe-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 03 Feb 2026 11:00:29 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2a0f47c0e60so18130935ad.3 for ; Tue, 03 Feb 2026 03:00:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770116429; x=1770721229; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:cc:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=oQkZfToFq8BT06VP1uFHEcrlVvgBQYb05e9o8S8pTFg=; b=O6fiZcnmrbJd82gN1SA1R2qAy0gMc2To3b5i2N9hAaDAJVln6WIqbprZjnoxFv1FK9 86HWxq+QAqMQsAodEkybqIdkmhW/uYQSKwEzNGwqiirEcCWqMICNaI34QaLjG6LwE9xl cGRLp2i9xcmo3d2/cpAL1JHTkBswti28dIvpv/vUrYmE7jmHL3gMiTMGOR3puul9UBsH QTz3YLrxWCRLScy1AIVEr6iUcO/dVnWHknoDeDs+IeG0jYyrGaVsF1c3jCbc2XkifVNI 7AjH5X7Ftq347GfBgT0G5H9kMZvMp9ZLsGO8zCrQCCyUQcmzEOArssk6/pKAReTYAtBb x8cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770116429; x=1770721229; h=content-transfer-encoding:in-reply-to:cc:from: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=oQkZfToFq8BT06VP1uFHEcrlVvgBQYb05e9o8S8pTFg=; b=t6tlwmlgJFGVxak6RvyoTMhicvWcVQiyzVcydRxaZWO9A/CWhTSVnRiODBVoEdKr0V 74k8rle4xeW8UvE2F+ew/6AMTxgsBReZmDxQ9t8AV+4DpLZ83Q9oldHq68jrEWCDUUNH 7pHdbYafT6rJnChfJizla4UgPEJobp7JVSKC6sEgyY2o6joxjWx4yLXZhwsV0QoQbau1 Zq4JMg4G+uk/s4TmRiBI6jk4T9QiKGcY2M3m2h+A/OMyfdWZw2yHO7Fbd5dvsNHweFaJ k+pBkI+7hdt09guMvRTa5wEEuPh34xH/4p1LCdaSuzIAlHZ4RM/Ag45ZDaQFe0ZEbOnk Kr6A== X-Forwarded-Encrypted: i=1; AJvYcCWJ8Wq973TpwUCjcFTjXtBS0MG/y416j6A9LBKMBSlaIfN1eWLh+HOKHKSG/BJt04hE8iIb/KlSmIgnTfk=@vger.kernel.org X-Gm-Message-State: AOJu0YzBnv6N6WV3OAsBTLjlnZoBTQS5Dg/6uBDDaQ1HfPv8RiKc6Jx0 pNUbZfJqNWsTAX9SRBaJAfu4CxpkXkPY1u7DO0CZVjc9h2kB+5juPvaASYMd2wch2rjLg8hbHCC ul9rpDKFNH/8CBI3EjyKGqcF/139QBhJadfEnxXB0PJTjluET5M/rGDGVtkpy6Gp/lUM= X-Gm-Gg: AZuq6aJ5funbHc1cqkQ0XhP7qOOllsqi5X5J/ZMh8WtttdAuA/FuyXNe5XmrNZFwg0e Wvy6bQB+H8XrIpEAG/c9dg7qhAphVGJrCwx1KTm1UJoK0bfqoTGdES8EFLwAOyefgUp3mVsobBW NvMDTmCGaD2LGjv1RQX3g6BjSM7A0842cJ4wCO8ViqmZ5Se3y/Q4ScTeEwj54foA0R7Gye2C2mE GYZ0JgJdNtPtte//qHrWlJ8bekbLj3gRADKIeurFed6r09Yn+8GuByUpJV/HDOQSP4lZY4dEXX1 9GAQVxkrgBWMJlx3sah+Sr5rP2U7UlJLgloybuZQPibOYNKp61MqheKhJM2OgILZ6oNH+Bz6/2K STMCEWvDhBvpYFNbA410os/oUZXv9V47u+w== X-Received: by 2002:a17:903:2ec8:b0:2a1:388c:ca63 with SMTP id d9443c01a7336-2a8d9919665mr138993175ad.31.1770116428361; Tue, 03 Feb 2026 03:00:28 -0800 (PST) X-Received: by 2002:a17:903:2ec8:b0:2a1:388c:ca63 with SMTP id d9443c01a7336-2a8d9919665mr138992885ad.31.1770116427866; Tue, 03 Feb 2026 03:00:27 -0800 (PST) Received: from [10.64.69.250] ([114.94.8.21]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a88b4c3db4sm180801255ad.50.2026.02.03.03.00.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Feb 2026 03:00:27 -0800 (PST) Message-ID: Date: Tue, 3 Feb 2026 19:00:17 +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: Greg KH References: <20260115082851.570-1-jianping.li@oss.qualcomm.com> <20260115082851.570-2-jianping.li@oss.qualcomm.com> <2026011621-fang-moneywise-d6b2@gregkh> <2255b500-f4fd-4d7a-a5d9-5b4fb55c78b2@oss.qualcomm.com> <2026020245-catalog-outburst-f805@gregkh> Content-Language: en-US From: Jianping Cc: srini@kernel.org, amahesh@qti.qualcomm.com, arnd@arndb.de, linux-arm-msm@vger.kernel.org, Ekansh Gupta , thierry.escande@linaro.org, abelvesa@kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, quic_chennak@quicinc.com, stable@kernel.org In-Reply-To: <2026020245-catalog-outburst-f805@gregkh> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: mekQGqKfBCYt-z_aJ95UkemkOPIW_ysz X-Proofpoint-ORIG-GUID: mekQGqKfBCYt-z_aJ95UkemkOPIW_ysz X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAzMDA4NyBTYWx0ZWRfX9ZkfO957c5gW yPuxbGRGgSHLqpaoWO/Qpf6IxC3FjI4zaPn+NE4KQBMzHZVNt9ehW0KRB7N2aNucZ7kfNoaj5vx QqsW3pV3pTXDManmOsYkIbzL4SifJrTn6lDqoct6AY7M/yni2in6CT4aG3D5LjuFHu3SjQhEofW l/ucA1tRDmo9zBQ9+UFiyPvpOhNzEAhLpqIeEfglPP26qCW86qL+KGQQS0b90LM/eTO0VSk3riL 7dWLdWxhOA0gSI5DKPARvhilR/l0tIGbHpgYZyXh6wGhd5qziNPcvCwbo4+hgNNRAik/ogsCLr7 QSpq8OSxcMey6bwK2ftZoatZ4FTwC/8mAWdSgkUyVfIaBtFoELWTN58Kfo6KXlsF4Lw7N3pAFEu 7FGgYu5inIesxFesi4PaBS83BO3zTHntAaQ/LdWZ+BbYnkDJ7mrOOjFgfNqm6isSVNItwdLuLqO 9WfVfXSL3SyGUXLKXVg== X-Authority-Analysis: v=2.4 cv=AurjHe9P c=1 sm=1 tr=0 ts=6981d54d cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=Uz3yg00KUFJ2y2WijEJ4bw==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=X5nBk1X44HCHp22wJVoA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 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-03_03,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 malwarescore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602030087 On 2/2/2026 4:41 PM, Greg KH wrote: > On Mon, Feb 02, 2026 at 03:13:10PM +0800, Jianping wrote: >> >> >> On 1/16/2026 10:49 PM, Greg KH 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. >>> >>> What caller passes in NULL here? I did a quick look, and see where the >>> callers check this properly if it could be NULL, otherwise it all looks >>> sane to me. What in-kernel user is causing a crash here? Why not fix >>> the caller up instead? >>> >>> thanks, >>> >>> greg k-h >> >> It's a saftety coding: to eliminate NULL checks on the caller side, as we do >> in a lot of other kernel API. > > But you do not do that for all functions in the kernel, otherwise the > kernel would be full of checks that are never hit at all. To clarify the intention: this change was not triggered by any real crash in current callers. The motivation came from the v1 review discussion [1], where it was suggested that a NULL check in fastrpc_buf_free() would allow simplifying some of the caller paths. [1]https://lore.kernel.org/all/c80c48a1-f1b6-4520-9d7c-3a83915c7717@oss.qualcomm.com/ > >> And it was pointed out in the v1 patch discussion that this change was >> needed: >> https://lore.kernel.org/all/c80c48a1-f1b6-4520-9d7c-3a83915c7717@oss.qualcomm.com/ > > Were the checks removed from the caller side like was asked for? Currently, I have placed the check inside the API and removed all the checks outside the API. > > Also, your changelog makes it sound like this is a real bugfix for > something, when it is not at all, which is what I object to the most. > Don't make scary changelogs for things that are not actually happening. You are correct, I will modify the commit text that caused the misunderstanding. > > thanks, > > greg k-h