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 30CA938F255 for ; Thu, 5 Feb 2026 09:07:11 +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=1770282432; cv=none; b=ikAc36LLusXXc8sZ1Ij70XBtwt0GIh1dXwKhh2IEeFI66u+C6JF7Ft2VVbhoCHiqn0cN3rEP9aLmIbPW+LRB4/x3533fa3hX/XbyaB6y8cQ9EWaojxMVNZXX6rkFzvpUUl90fYcxZjOUyhmwGud487znsxrjVXlz3+frLKobHvU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770282432; c=relaxed/simple; bh=GYGam5smJv/Krnf9ZKb7zadPP9DaMPRHvjxWIheLJ6o=; h=Message-ID:Date:MIME-Version:Subject:To:References:From:Cc: In-Reply-To:Content-Type; b=VfmtdY088YBiLF3nZtbsNCwKbVA4DqNqVht96HdcoEYVUPTJFzW2QLnIs/63jwypfaBOHVejuesieRfmQZIKh8L98YTRNSaB6SBp5pTQqPWVOO0i86WbvWdhMcdGa1se+2+azxhH8EeF5cP5V8w7FfIejBTOvZVE2flV3UChsQw= 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=mHT74PHt; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=R8O/rtem; 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="mHT74PHt"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="R8O/rtem" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6153dreX2103207 for ; Thu, 5 Feb 2026 09:07:11 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= +5xOzbjY5n//2YI4Dvmh3UhyPEnWdJUEu8SsC0/t6bg=; b=mHT74PHtlYZNN/Nw 3tp1IuaDFlDV2fjzoTN2yrqEvhO3tMdhXl7Z4fv/1q2m2q9gylsXjs1xGM7G68Ax dR0geiPoU67gUya+pHe1uULVJs+4Y9/jbDnRcDoMKWXkRnNgH+mVwNJAs89DA10m UtRfIidzF4Ck7qSeuKCtTYKfscod92dqmButriRx1K5fFxOhCcKTGeK1Jwd+/G6x axudXvmyTVVrL5+7wDMekS377suhIXoCasL43EWusBQFhQ7wr1H92WV+HEDTK/iG wbst1nOcGHnOucXWxt+T5Dig2XsacO/n1nKdZ6XJYde/xtxvdSGm/08i5EZ0+9S0 fGjd0w== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c44xjkpmy-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 05 Feb 2026 09:07:10 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-8243767ce2aso108282b3a.2 for ; Thu, 05 Feb 2026 01:07:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770282430; x=1770887230; 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=+5xOzbjY5n//2YI4Dvmh3UhyPEnWdJUEu8SsC0/t6bg=; b=R8O/rtemwpv5K6LlzApHVqsXObzE7E6dZmAaOYDwOfcRRt/7wgpbLB4NJxaoIMeNPO a93qfm8P+Swbc52NaopcYUNj0XQVgkxmcu7EITx4w6MHNTCnc/s6KoMlEHVww0Amrl68 s+5cMvv51EOa02ldtkbUHnh9gXB2BHuKfcFEsrC0bJhleS0R2ggbab2ioKS2wUeyJfa+ i0L7aeXMb39JvYhUS25zLoVt91Ucg9eMqaKfaaKxB75Gl4RAlMiT8D+xq5+7Hxo5HAui ksmPh90vv4wTDLtBWW/mdoM2OrOlNCIFdKvZTHyFC4ePAxx/OGsYXc+iiVWKU8enRD9k fl0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770282430; x=1770887230; 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=+5xOzbjY5n//2YI4Dvmh3UhyPEnWdJUEu8SsC0/t6bg=; b=oqbaLHscjJxxnyGqSLisk8nTtwdDzeB7eZ1jBPupp0xdXfx5bxi7XeIkQd6nWdpIrs TS0ISzsqK889lUbRfX1TQzEoJmpliuCU709UofIiVKsKbfU9uGJoVgRKc0aMc6fLqVb8 PpRbTZ/xs4teY7Og49W/nrWMOhiNDKKeMOLj/ZVUfr4jnMxvNZbsfg++ZY60Tu3G8E2x vu2bctKfIsaxweFqoF9guebLLPxC0vIMFzq5ttQDsmzm3eCWBIBzsOp9YVzH6Kf+Wkp7 hQuhyk6Ywkh6tWtiaycxAUWH7ScS0/5ULMWo9swWmP0esJdWIJhAFWCZvw0qH54+DK7T J7RQ== X-Forwarded-Encrypted: i=1; AJvYcCUzRhSNQYGBgyqlzwZBn53s74XT2ELne0qHVgmBfjjDGJ7TJo0wnYTXh8vRIIuoNNzNfIUpGd2vkGH6VPY=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+i3O7yuR4PwhIikkIGj/jcQQyYTnr+YfZkbGGkepKH8f27+xz EJs6JO6ZqbvH6fIIzxjU6CSNcd4e3AWU51I1IHOON984DcVmYWfZJiaPVAw7VCOntnBZiUCqhF5 TUUDlPt5UcPbtrfb87DNjK3uJmr0hEXLt4LyXd1124u+lv39RV2ELpyOhMIqfd/Hsfk8= X-Gm-Gg: AZuq6aLCXsbr9QMyi8ewXKxEtoDFpZcQmJjbGtQikrnrk8wM81ruipwj9QyMxMV0DgR WlBPFKJE7hU0TL35ns5sO9bWoSreWiC3+6OfyYYE2vUa+zjl1H86WBd4X6PvnkTRd8Vh3Xf9q8j hRGfhsDKX3fSUpUNz7W8KnD+r0d91Tjt5aFWfTKEeMv5uQ5yXmbQWJCLKH3mKkcfB/NqPw8JyRZ Q0nPBRZeu3CxVtQYRH4wbu/Xrnj7rpg/wwh+GNmH+/+Mzv+DRaYI5fc9Hr8tOZI88fI4gDOsd/v X3kKkWONNmJXLrWKzJjZnZs22sJ79Y7eu+Tyera9rsPZZG14+XacWzxaCiEJL9+HKYu0gdC3lUh GSdEMKh/30i7RJ+tC/gHX0jJFy8S9+Ci3d666uGVooIvtwltBbFrUI0h0lGXXQzPcfwkZ99YEEV E6JIV9 X-Received: by 2002:a05:6a00:a907:b0:81f:3c7c:8591 with SMTP id d2e1a72fcca58-8241c645c19mr5011468b3a.50.1770282429908; Thu, 05 Feb 2026 01:07:09 -0800 (PST) X-Received: by 2002:a05:6a00:a907:b0:81f:3c7c:8591 with SMTP id d2e1a72fcca58-8241c645c19mr5011450b3a.50.1770282429436; Thu, 05 Feb 2026 01:07:09 -0800 (PST) Received: from [10.133.33.108] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8241d1c08e8sm5361366b3a.22.2026.02.05.01.07.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Feb 2026 01:07:09 -0800 (PST) Message-ID: Date: Thu, 5 Feb 2026 17:07:03 +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: Bjorn Andersson 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> <592129fa-cd8e-44b5-a18c-1fb6c6ed102b@oss.qualcomm.com> Content-Language: en-US From: Jianping Cc: Greg KH , 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: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=DtpbOW/+ c=1 sm=1 tr=0 ts=69845dbe cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=uBvRbRIBWN_UjP92ZHQA:9 a=QEXdDO2ut3YA:10 a=OpyuDcXvxspvyRM73sMx:22 X-Proofpoint-GUID: wemiHKueB53TTjRExtXrYM0n-A8cUh1G X-Proofpoint-ORIG-GUID: wemiHKueB53TTjRExtXrYM0n-A8cUh1G X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDA2NSBTYWx0ZWRfX+oKDQs47+/YH Gky0pIZQ/5RtGOsVk2WD6xaYyLMRqRk/dWCQZ259TwpT4kvU+2v9WadNgqFjue+SkhpCIyXPXNt +8HCZW/QN62puRZFbYgKa+tiKPwt+STjQ4TFPo1FYC+FADXO9FrEwrJWQAW/3HrtGV1lbEoiRRj 2OU6qTMtWfOzUY/Zf5wIRzmGgLMfO2PDt32PKFx1ZtQImAWhw0knvhsUbe1VkNjp/0d4rBMheKo gSUQGq6Qvm6qph2cu2JNYtxEhzT6hBdXoTa7CVavg/RBrKsZql1vZaGMm3+HQHfPMIzvJ0e2I1I 6Tgny2Jf/7GUSJeWrZFRJUPGbqqOBR/lZ/nxEviA0nNL+VlV0JddIMhbwfjHDWxPbgKp/Whnr+q qK6nFyZFkEl+ZF5stLpAmTIPzo/vzf72Nl+e573an4rPRq4fL7A6ZH2rRfSY41G4fqkabo2ts0Z hpISrzipXPVLLdEPqOQ== 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-05_01,2026-02-05_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 bulkscore=0 phishscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050065 On 2/4/2026 5:32 AM, Bjorn Andersson wrote: > On Tue, Feb 03, 2026 at 08:08:16PM +0800, Jianping wrote: >> >> >> 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. >> > > You should then also drop Cc: stable and Fixes:, as this is no longer a > bug fix. And make sure you don't put actual bug fixes after this one in > the series (i.e. it probably shouldn't be patch 1/4). > > Regards, > Bjorn Thank Bjorn for the reminder, I will adjust the order of my patch. > >>> >>> thanks, >>> >>> greg k-h >> >>