From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 F36F024676D for ; Fri, 31 Jul 2026 06:57:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785481061; cv=none; b=cs72cZcvJ6+2Js4WutSVhRzJ+0CegCX960fDl0ZXYIvRC3osTdmTh8U7DqHounHPdAoSfreNARDcYWk76I0tGWbMOdi9otKh6UQLRxwkG53jx/+PaXTFQsmOxmvmgZiNNySV2p7Rkax8goryaBRM+fBvngsnESORpvojU+R+q3o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785481061; c=relaxed/simple; bh=59ZmUVP0cwQan1rzg1L4emztWLU5wPZlD7KY7rl98Ac=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dQsugBbUQhvU6OpKYwnVMC4oOgds/rXafAO4N73UIS0OsQJsXH+lxVGFS22PQ6S+z/69z5g28iVbu7IjO+HvNiZ4aB8JcmAw9JIASecBzPBKFArcT+Cz/lN2q8WtbQnWcEQpyTaN3JB3Z0VJxNpQUhf8e3ejsVY/mngTYoN0Tuk= 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=Ks8/RlLZ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=SezgBEo+; arc=none smtp.client-ip=205.220.168.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="Ks8/RlLZ"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="SezgBEo+" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66V6gl0q3140222 for ; Fri, 31 Jul 2026 06:57:39 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= yeoMnG3I9e/DLxw1trT1m1DMzEITRAh6vsr1I63XEME=; b=Ks8/RlLZStJh8O9T tSegNnRWHOzwPt/+CXHVQsf8PTbIJ99+WEqirjvxRAytKTf+hUEjrzAnG8jrVbzO ynnEu3jEijDFiqOFmDM+BdtVCYujicwyCoSC6clITur2RzgIW+lR4cSakGUYpBtN uFHbv37Q1OJtwkDusN5LvGNKzpuooEkW+a7ULGDPITKlsQ8PD6VYMw6BXIqihlIn pTiBQn0p2WWzkPN4OpCO1zaJVi4EJcPYBipI1z5+sCglrA4pvf8ldERqsAX62jrD 036LrJ3whTyrhEuofOWOhwctfCVGJ1UfkE+Tc3LICsmMlDcxxB6mwAwxcdIk5Yxz fWanPw== Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4frpp701t9-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 31 Jul 2026 06:57:39 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-84e13b57b2cso999743b3a.1 for ; Thu, 30 Jul 2026 23:57:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785481058; x=1786085858; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=yeoMnG3I9e/DLxw1trT1m1DMzEITRAh6vsr1I63XEME=; b=SezgBEo+SXbfluOa+MPA1YS3i75KPXQySNlQg6EOCvRv+Vp+63CHciD/OngoT2aAWL ykmh2UeUG+s/XGOd9e94EuLCbdDmu1bc/OwLiHRBss8mWxlhkEUmkghPadKvcZBBHvRf QlYlFNFj8WO/HoK0RbWPM7eFXnPoj2tYkhrVKbcUixczTMzWKTZthVSwCk83X5M6iMG6 RmM+cNQSHnfSvi9UC14UUpoKE/eYgAwI1DpJAjetDMme5c+k1K2pS6V1dy4bFyOkkbLX yUPoopqx5aKMVOnJwi57TwDr9WYM90n4cXvpWdndp7y9ARaxnxK8WS5OCrjRdLtJiLCL SAvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785481058; x=1786085858; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc: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:content-type; bh=yeoMnG3I9e/DLxw1trT1m1DMzEITRAh6vsr1I63XEME=; b=fV0ChLBJxrJQruFu7vGH7htQg7K3swQ0RrpQYYcCKVv5FfpLYpnpDtGQ7xHJrBAEOa naeoQzmib2+LJT+qdfTV7eHavD75Bhwp6b2OEqgh8gJslGswy0GFgIA71yfl5Un1rlzM obJQRM2X9IkMdME1T+6anlGb/owxkJp2MSSIcVXxb6Crt0R15ZIDCKB1Tfbf3pLH47Jl 4kE6g9BItYLEDJy17PO2HkqW5Wp82F4T5hK3U8AfGIu8QJBlBokqk+G+Dc7YdUuzjxmQ 3XrUK8zQJQXZAa+h0uHrSR/pL5q4AL2ZAP7FPaYwsAVa6jlwRhvWGyg5ZIe+qZK2buTh TPNQ== X-Forwarded-Encrypted: i=1; AHgh+Rr1gMiKiScPI1oGzQO2fg+Jcx6tqiUFNgYfHDWDYT30M1eQXhK8Uu19YuDqnSWuaRrFk5g4L+Y/EVNthYA=@vger.kernel.org X-Gm-Message-State: AOJu0YyFbhrL0HnrtVoPWYirL9xVLQIDJDi15A3ruVFtxWWULIM+479b NJMgtgUxo2qyY9wnHtKkhpm64OJ3SOf0ykJrC5FyRAgMJI4BM9jr604Yxiv1WYy3R24xMUbqE2L Ee/A36MfPzjQjbpmdlS4aJWHOl+b/el59ENWoil9gki17CQM2cOetgoQeI4hPEL1IvnU= X-Gm-Gg: AR+sD103LoofAWs6luP60GXf+wOFYSSW3GPwx9ICkKy98JEz/ziJSmBbxdR0CxZd08k nierteVqgDKmIsIh1wd8nv8fO0FRcyFYU+OkfvtLD7dnEOg7bZzbJSatvZ6id8ygfFIoAV8UYYT lgdmYbltj2lzL8ROhEycEiednakr9+304OAkPjCm5UxTSTFNzk7NcOLrKStKhtHzxBvLSYeXRQ/ YY6AGATFkg4ZUA8XDt862gm76PriejbLNaEUMy+S5Ew3AIXlEclTregMDSEBiiZz6GMaUukfZYs u5ueFZ2t7vMNxEPmNz98dbQdOLqhTBijNSqaG9xtA2DcnlGOSxU78f3yFqDApxwXUig08IZrn7h 0B/VTIDa2P7cwO14FJlhlisFjeXtMsQ== X-Received: by 2002:a05:6a00:b8b:b0:848:57f3:8f8f with SMTP id d2e1a72fcca58-84ed71df47cmr706025b3a.51.1785481058368; Thu, 30 Jul 2026 23:57:38 -0700 (PDT) X-Received: by 2002:a05:6a00:b8b:b0:848:57f3:8f8f with SMTP id d2e1a72fcca58-84ed71df47cmr706014b3a.51.1785481057758; Thu, 30 Jul 2026 23:57:37 -0700 (PDT) Received: from [10.204.78.242] ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84edbd35a76sm43031b3a.6.2026.07.30.23.57.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jul 2026 23:57:37 -0700 (PDT) Message-ID: <7150bcc5-c378-4b18-85df-cf9ae705f7e7@oss.qualcomm.com> Date: Fri, 31 Jul 2026 12:27:33 +0530 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] misc: fastrpc: initialize invoke refcount before publish To: Yousef Alhouseen , Srinivas Kandagatla , Amol Maheshwari Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20260624185427.1451-1-alhouseenyousef@gmail.com> Content-Language: en-US From: Ekansh Gupta In-Reply-To: <20260624185427.1451-1-alhouseenyousef@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMxMDA0NyBTYWx0ZWRfX4pHrfVsKMaeE JqHU0esx4p2ZZGYUjrzjH3xm8i+TAAi0yUpWo2TvQCKRlHC2ZPGegHYV6Rh2KuR5tnhAMJmyxMe cdGcLpEIazvH/JwkjlszP9ftEHjMZG5FwYWxUoWHT/BgpnYb32wbyMUX5kSL2gJThiqXbZA3GcL G92k44jUeJnEfy0i6mbFF6b+PDlHvpXc6wCNn2zaWmwACCOW2H+Wk8UauIc/0AqERod1Gy0UeHr 2qcVLCZw1Dm980jVB0U7yhA9HOj9M0PsqyGj+BzqC1Bt8BJUk3lifSjjcQ2OKBfo2GdNwAphrpd wsi0MBoSJYtUD67o7VAgMco/SJo4qsoB3Nx/KePdf0jTyuzmDGmF8i6iZJm+xlZ/zBCNBs6ldVk LzBBKIr5A4Dbo3hxqvs+oC20NkrieQCKoEJx8pf+fwXz7nCV2dvP+zMxvqvYKTMbOJOdq2XULAu qbRWKVcxKiJ4qL2oEkw== X-Proofpoint-ORIG-GUID: m_xrZ_bKPyLBTPEjb7cQ9NxjwXMjehma X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMxMDA0NyBTYWx0ZWRfXyAjDI6pyOhLj wFMGFW1NSjTdk40+q5T54Oc5Gq9PQq+ieUOC4gl3yocLJ+E8CpDWcRRxxEe2X0zsQIwWwLlKj9/ 96DHUPwyMEqpTXZ6g9vOZv+LPp+98lo= X-Proofpoint-GUID: m_xrZ_bKPyLBTPEjb7cQ9NxjwXMjehma X-Authority-Analysis: v=2.4 cv=AsXeGu9P c=1 sm=1 tr=0 ts=6a6c4763 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=WQc7OmQVWAu9uTwc-zgA:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-31_02,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 spamscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 adultscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607310047 On 25-06-2026 00:24, Yousef Alhouseen wrote: > fastrpc_context_alloc() adds a new invoke context to the pending list > and the channel IDR before initializing its refcount. > > A racing DSP response can find that context by ID and drop a reference > before kref_init() has run. Initialize the refcount before publishing the > context. > Please add Fixes: tag to this. https://www.kernel.org/doc/html/latest/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes > Signed-off-by: Yousef Alhouseen > --- > drivers/misc/fastrpc.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c > index 6ced210ca..42fc128e1 100644 > --- a/drivers/misc/fastrpc.c > +++ b/drivers/misc/fastrpc.c > @@ -703,6 +703,7 @@ static struct fastrpc_invoke_ctx *fastrpc_context_alloc( > ctx->cctx = cctx; > init_completion(&ctx->work); > INIT_WORK(&ctx->put_work, fastrpc_context_put_wq); > + kref_init(&ctx->refcount); > > spin_lock(&user->lock); > list_add_tail(&ctx->node, &user->pending); > @@ -718,8 +719,6 @@ static struct fastrpc_invoke_ctx *fastrpc_context_alloc( > ctx->ctxid = ret << 4; > spin_unlock_irqrestore(&cctx->lock, flags); > > - kref_init(&ctx->refcount); > - > return ctx; > err_idr: > spin_lock(&user->lock);