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 D13E533D6CE for ; Tue, 3 Feb 2026 12:08:27 +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=1770120509; cv=none; b=K1rI+LiXicv90W4lf9Hm1dYvjTj4NPB5oT5peGr324ECzwT+kJtCo1PhewNBcpSeMD9pe8YtblybDYKzJ6S1i1ane0L+YqQPNXdq5o7oaT6V4POtIZFItYulbIihr5AJAwTH3gwFsiBMGCL7Jv04NJOYVvsXWHlKQsxoPpbVBB4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770120509; c=relaxed/simple; bh=MCj4UzcWNYvU0euy+ML1A5R801sYbI+2J7fg5rHBXVY=; h=Message-ID:Date:MIME-Version:Subject:To:References:From:Cc: In-Reply-To:Content-Type; b=VTW7uC2TE6pCVa6G/pjGPPUdEG5B8Ikq164bs2Ow4fAl+m2zP8T6Rzx9M8r0c8zYljNxX6bOc5LUXeGdOqMQcDj4mgGyL/8S2bC8lFFSTtqbLF1LSYhI8g+durkkYR4LJ/ub2cX9rv7BuGDEZaxOPf0OT2j/q1YuElcYg4IQ37k= 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=Nl6YtP03; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=RLqR9fmi; 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="Nl6YtP03"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="RLqR9fmi" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6137PJvK1320551 for ; Tue, 3 Feb 2026 12:08:26 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= B7h20MCirN2R6w9UGWVeyGVzBsz4bKvBB1VWC/VSR0k=; b=Nl6YtP03sJmlmlWI NqhiqSHHqr2Fs9mO0HZyIujupk60wK48NPFS2lVwy68IfD69aVohvyccLBC7TzYw Aa0NpohjhVVepb8/SL5awQg2IlhioIe6jxcLQpIil2VweZWPeZtSAiTDf8uuVZha FvhuZ4TfyD4VP3+JI2G7dAaBpy9PcSyJWZqCKTorJ8ldXnW4419eI9EHRbPvV3kS 5BTHKlKqgBt5KtynGAsQpECtV5C2BmXGawvsfj0oD4iXF3TuN5m4l4mAN2sxMsm9 ezgSt8qQoXatu95irv9AH2weX0b1go6WyGAm0cy7S4RjJZ3W+ylXvojq6mP+z2g1 Pd1BpA== Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c3cm70uj3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 03 Feb 2026 12:08:26 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-82184c384aeso8026154b3a.1 for ; Tue, 03 Feb 2026 04:08:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770120506; x=1770725306; 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=B7h20MCirN2R6w9UGWVeyGVzBsz4bKvBB1VWC/VSR0k=; b=RLqR9fmitrPGODrR3H3AuunwLt1Bk5R0n6H/Oa0KYPFmqTJtJUyiPq7KfIKmA3X64A snNHYJUaPBr9YzSP123XbJis8NzKRv4l84076afgwqJu+xzNZAaq/cyoN/wA7X1mjtZE Y+0XI6mXnyZ237jgXgh4jXNh5qbs2k2EJ/MJEOwSJbU83IGm146QHVzkxpragjis15RB ewdI5gtbadgLMjAHpffwcDws4UVy70vV9VYzZr4OJOIq0H2UM++pFOFBFFD/+CmvO09r +SREi+L1tLJzBPSqx5LPlzvzp+HO1xepkLqESLraPVLle2iVDm9DkZgPt8BWZBye9p20 NULg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770120506; x=1770725306; 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=B7h20MCirN2R6w9UGWVeyGVzBsz4bKvBB1VWC/VSR0k=; b=vwIkDOMqngDF9lVI7Wr5ACx5QEE6ieQI0Y4XhZpGrYvp54oIk+YlcjorOj7xky8ODb IgE/77kSKuACjZTzAYdqq6zvPQbGvx2EUIqHLFSBIDU6PDWCCYypQj+R2mekbhJ4c/Fn baOJRC+gx2Izs5lCZ94YBMm72x/iANJtKf2xlbuq4FKmzRcZMbfJa+aUMi8V6ZiFOJKC ieQXFzFsIO6OU8xvjeiJT+IWvR5pz+F+rY54jzkJP0QINNR0i8m62vkG3Zp1flGdAbD2 ycTJm+QOhsC+AvLT/784RPuWJw2kMvr2TI/m1gKH5GNjQWP1cDdvGnRLnwkt5qDsPeTl 7RtA== X-Forwarded-Encrypted: i=1; AJvYcCUHOhrkZq4rFbUF4xCM0A5Gk8Ww6/8Wu6b/X95wyW2VOujxFAVuetP/aJ3uUBrBzvf9jTtG0c/qJHYnwHo=@vger.kernel.org X-Gm-Message-State: AOJu0YwpCapa7THVod3510sciZCvVojWXnZR0686ry6nFDJICcyR/Rvr V7APZ4QRWzoyp+oLPULTu1y7d32RDCwI5tQOKmpueYCMw7HgbNTCuSact3bCO5RtyYXEyAvGJIk GQi+Kgd5cz/cHaisSej0gg+clWm0w3fNNPECjit4ByGUhesrj/GmM1DX7HRq8YAEYZF4= X-Gm-Gg: AZuq6aJXzYyDFHgyeorwABDCNFT0eT9y+wYtQ9LADw6bvURL/JKoXrr2jr9MdDeShDk meKcmUc44mvgrNE9O8f1P5q101T23SzaQOhe+0W26q10PPACTNREuBX6Pdf0uI1V2pp/Wiyhz3p rEdnapOTCbGUVxl7VUSFqwdNZsvkdVWGrgJA+XGKo9AYul8Pk65xdeRFlfV7CNqJJBDayupqqkc ZuyllCoDKCi/MwefXCdgwN8+QAfUoxeK9uCnUXcWz77ceTJni3O2A+TIUpzl4oRGbc9HwzWd7yu zrV/EaAQtflFJR1JksaBr4gBLMZfwkUC4WHGsPu1P1llPUxolPYIIHTHYytnoH0Ol3P6jwS90rQ po7seb8mQt+PAM8A4CXQ9iNDP3yiPwiJMO1dCDkYBvMhxdzTduZGl3xrqIZH7O61SSofP+0oI0T TqvUU= X-Received: by 2002:a05:6a00:3a1d:b0:81f:adb3:21c7 with SMTP id d2e1a72fcca58-823ab684020mr14247661b3a.22.1770120505613; Tue, 03 Feb 2026 04:08:25 -0800 (PST) X-Received: by 2002:a05:6a00:3a1d:b0:81f:adb3:21c7 with SMTP id d2e1a72fcca58-823ab684020mr14247634b3a.22.1770120505146; Tue, 03 Feb 2026 04:08:25 -0800 (PST) Received: from [10.133.33.16] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82379c5a190sm22756121b3a.68.2026.02.03.04.08.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Feb 2026 04:08:24 -0800 (PST) Message-ID: <592129fa-cd8e-44b5-a18c-1fb6c6ed102b@oss.qualcomm.com> Date: Tue, 3 Feb 2026 20:08:16 +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@oss.qualcomm.com, 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-Spam-Details-Enc: AW1haW4tMjYwMjAzMDA5NiBTYWx0ZWRfX2PyruUn7TLvZ DBbtocATGCq+AReSg9j9Us3tp+r10vl474hh+b/hYex7UfTdfbYdPLg4Fd3WSszmN7PrXrhfIkO GrDbCJQuyL6otmK0NsDbEyE5L9N5sUXoO27Pg9AOIX0h4RqIQMOp4fhqKd2Kn7eIL+Sq7QDJRGL OGmx3ZfIKCYbVvN6vu2W+8BN0V8obWYhPLjFyNJOtTTE0GJPXZFPZ9sWmgiQuAlV+VCzjZDpftu EnI6iMrcG4rrRSfhchUu1qG9C/sQWx3Bdv/Ve3iyT0cbiCyJnsBN6VDUwMuMqMLTwxgxp3zAZPd dKg6dNJFPEz1dMAEsxm6zLOkaqLUomsuOQ7IHU9fsREhSqglYg7uyrhOMn2ocXcR8Zbq9q7xNoV ATjWTezd936FcQ7MFUqVHswE7C3owSqr9GRL5h951q9cirzLKGaYvLFT8MW4Qte0zE7V3oUGLhn BX/19mnLHWj9Q62WUXw== X-Proofpoint-ORIG-GUID: zAkxRUZArMqC9Wf1zOF2EA1Yok9O0QIX X-Authority-Analysis: v=2.4 cv=L4sQguT8 c=1 sm=1 tr=0 ts=6981e53a cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==: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=X5nBk1X44HCHp22wJVoA:9 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 X-Proofpoint-GUID: zAkxRUZArMqC9Wf1zOF2EA1Yok9O0QIX 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 adultscore=0 phishscore=0 malwarescore=0 spamscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 suspectscore=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-2602030096 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