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 95EB83E49F7 for ; Thu, 23 Jul 2026 10:09:57 +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=1784801398; cv=none; b=Fjo4sp2l3aBzvENav4ce+dkuMpiN8fA8pJQ+jvcufFlHi6XsvVnBhdK5OkYJC2UZt/ckqeUmZhcu/4/CjQSSbPWaVRSgBLmxf3ngP2ZOz2nXi9UYYFLteOQglcvNP6AxQjyZSc8fI86PnkOV8cJNsdLvjdZOXoALblMnUmAgS08= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784801398; c=relaxed/simple; bh=Uhpw/sOGbPgyk6zHgw0gj4dANVenbbfQw/w2YbnKZbg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=FO1lmhUM1f6H8jA817/sf1nBNVjWdWWUaz10MKu9yQLAjh6LnivvrAWxIPh/pELd+xmn8lJeNECOzi7sJzDQaHERY6Vl7sJRggqFTgsJerpafXs1iD5/PUpliNEGzt9DHPIJnyTZTWuyzPk6Og3drGb04JZfe6yCBxDi1ZfFKnM= 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=fIBZYsQY; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=fOIUCB81; 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="fIBZYsQY"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="fOIUCB81" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66N8qXZD3648567 for ; Thu, 23 Jul 2026 10:09:57 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= ZgAG5bdkbs/HZTriNmw/0laeMZHWbWmUNNNMH2lX+w4=; b=fIBZYsQYBUCrGO4T yLsgvxZtN2YOfj/xkEskqj4Vc5nQfJ0t5ejvLQ2kdDIuebx2xtPBmjWptcj1n8WD Amu4iXaUVOnGQaPBBgMT/BF27sCnNhqeC6mvm5ODmhiivZ6+jh4vjEJO3TLNbs2/ rewUjKhrlcl35i+YkKNsjl3/8K2wWN3lQpQ+aLSV1rHVN5XrJ+D/OG6hing7l75M KIyb1kwOdID5pA+Ly1s6nSYcOXqmaL+ptxSJlU2CrndBy+r1CSZl0BjXmwoD1mN+ eqh1+EBIarj8hsxJ94Fhf9/fEXkDF1mBl/VwthYOSE91XSmtpVdNEl9eJTMmBzS7 KPoaZg== Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fk6c7jf9x-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 23 Jul 2026 10:09:56 +0000 (GMT) Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-51c15c77619so2011361cf.1 for ; Thu, 23 Jul 2026 03:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784801396; x=1785406196; 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=ZgAG5bdkbs/HZTriNmw/0laeMZHWbWmUNNNMH2lX+w4=; b=fOIUCB81U3apDcW2Q9BeWr89913RWN0HLxCGnWKppHowA79u1g60LWwAKb/Zazbu4p G7SarLcWTF2biq9mBhtfckaIadIYZQJ+7MmOeFa65ix3nKsKtMb7XMQ6npDqFqxZFLtQ /1qaNVkrgFksp0AtqErPcUsROk/W7FgewT+tmnJGf0GjAVOuZhEYC5CHWQ8AuboayiN9 qUsxHmp7uSCt36s+cIj5Xy/KKNWRjsHa4jGtevDDaEnDMeL06beRiu+rHeZDqJgYtHD4 WvhFG2r2Y/x6W04ywX14kpn5RlodOqAD431TY5W55Mdpr+Lk7LX85OMjDbbGnM5Qr6a7 /PQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784801396; x=1785406196; 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=ZgAG5bdkbs/HZTriNmw/0laeMZHWbWmUNNNMH2lX+w4=; b=WbsTgCb2ee2JZ4UId4qkf1TweJkt/vFpcJn/YYSNfmyX0P3szUIKrwiaQLRJgms4qf g/A7v4t1wXa+gcF1n5YsNA6fTZ/Dw4EPFn6MGC2r/0q6eKeqazRZulJavE20M82DIrfO jFJ7gjc1KSYrX+iviyZPzu/kIPG8R2RMmngbuVwS6ulLTRyqVhDeKBxmA4otK8s2QbL1 uJi7faOQ2urQC1KNlDbztl+iHKwsR61epWGTT0nLN27M5NwiDeuHDqXyc1awQYHqJMLg oBQ86h18QWSCp6qTzL2buuMcPt/EbCB0NEUKeBDfVPxZvMxOKSsSPm/j5zBVV6+fvStg CxOA== X-Forwarded-Encrypted: i=1; AHgh+RpAow34mtPppRZzV36ph+lZtrKH9EMLt00PBidvzooDm4oJhCul+T22P/1vDCcr82aL7VcdgPxD/D+Gi38=@vger.kernel.org X-Gm-Message-State: AOJu0YxsQRodRvGxJg87Z43TiJp+OCfKOsLCAwAd08/1YzAHp8EtmRde PYkB1zbC4F2fVjD6LQJCqNlQ6gUK1Ik/a9djSahLx/7qXfGZxNvxaprUhKaPSIl89qcKMfd++dq MaU8H4HswSUeYkTUPe2K1+RuxkkSvjjlbKh3j5FnqRsiQ1XBvWDyNk7tpnDBsN4NeIBs= X-Gm-Gg: AR+sD11whvswE2w5A1RCcN/ijv0zeIhsh1CwBpjAjgpjMrirEKXbP6GSd1vTUg4DGmm PBU3raapXhCWMcgDtDT1QYfa6LkacjV/vYHKAe2MxzoTYByCK8vUKAcVCJGEFzWUhW0faiYFoSg umhshrMSiDMUKekPXsjJsVeQRQIznCv4OHX3rWIAFPFOynBl56tibG4X1+P8p2z88xhJ+n6Zfvp ToHqRNPlReLwh6z6DE5Qhf/UikPQU8cbT8fwxmB8Cs1lIvC7GPaD5KU1hEbI+f2ybrpAiGM9OGW 0CkohNHxHUSVuf4wM3rSMk/23oQeg4bxfvwsQ3ge0D+DCDsHUmbos1rQwzjYqijlwY3GDjke73T +St9FU+gxmI5VSYaTFoD7bpZF X-Received: by 2002:a05:622a:a9c7:20b0:528:1a5e:8c9d with SMTP id d75a77b69052e-5283dfe25f5mr11796491cf.8.1784801395862; Thu, 23 Jul 2026 03:09:55 -0700 (PDT) X-Received: by 2002:a05:622a:a9c7:20b0:528:1a5e:8c9d with SMTP id d75a77b69052e-5283dfe25f5mr11796281cf.8.1784801395335; Thu, 23 Jul 2026 03:09:55 -0700 (PDT) Received: from [192.168.120.193] ([178.235.128.140]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-69f34b9b064sm2091360a12.11.2026.07.23.03.09.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jul 2026 03:09:54 -0700 (PDT) Message-ID: Date: Thu, 23 Jul 2026 12:09:52 +0200 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 2/3] remoteproc: Prevent crash handling to race with rproc_del() To: Bjorn Andersson , Bjorn Andersson , Mathieu Poirier , Shengjiu Wang , Fernando Guzman Lugo , Ohad Ben-Cohen Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260723-rproc-rmmod-not-crashing-v1-0-546dfd5de0e6@oss.qualcomm.com> <20260723-rproc-rmmod-not-crashing-v1-2-546dfd5de0e6@oss.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <20260723-rproc-rmmod-not-crashing-v1-2-546dfd5de0e6@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: o-z0c8375u1XFhiD0AoTv8JIwsM4zgRz X-Proofpoint-ORIG-GUID: o-z0c8375u1XFhiD0AoTv8JIwsM4zgRz X-Authority-Analysis: v=2.4 cv=baZbluPB c=1 sm=1 tr=0 ts=6a61e874 cx=c_pps a=JbAStetqSzwMeJznSMzCyw==:117 a=PRfkaYvzSr8QmIIGAkY2Sg==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=MqoP1CXxSDz6cHBbW3oA:9 a=QEXdDO2ut3YA:10 a=uxP6HrT_eTzRwkO_Te1X:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIzMDA5OSBTYWx0ZWRfX7yzpS2/acM9D 4DR3DztOkQ8sRphkf5bTPy6E2E93AopGORtAzPk3MQzYZtF6aDU6hnDCEdzMQGz+TZAFjk6oqgO RaXugktorgdsA2V7vcrbF2x/1fD02OM= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIzMDA5OSBTYWx0ZWRfX2i/OFabuHhfg Rh7qlEpGL7mn9FBQRhFSA/t8xOIIN2FV1EzFf7xUwQU6Nv0WHJu0oyfBCX91PiRWwxzjHB7H0Qh Bv3vyjM0PLQ+A/jEbn/BCS1L4q967zCqPWj0GFTJg90oWOXblveff23kY1czEsFJyqkoynFciVy vASP9HCP3NP91/X/E7ZNN6QjXESGbFAkSecuAJdyyIY3mQwYekwEZg57j4N7JKKRG5WyvMEYR8e wDOqzQqsW3J1ZiJ6gKGwoxN/w0JS0fWfUc0xCasX2wt6oWj8YcJpJwLKCy2upFy4jy7IKaFRLzp ZXPoL791mMtVxRwVrepY1NQtfJf+B9GnASd+vo1svUN5lD/uN0ayqBP+xs3jMwQpvicwHuktlGE q+BDiUwsk1NXUWFtg+nOOD/um32WRai/VxmGccl3PcLpq5WgAf0QiVDR99jBo6yip4vtcSJC5UF JtWpURM3tVsij1RX2Aw== 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-23_03,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 adultscore=0 impostorscore=0 priorityscore=1501 bulkscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607230099 On 7/23/26 5:52 AM, Bjorn Andersson wrote: > There's no synchronization between rproc_crash_handler_work() and > rproc_del(), as such it's possible for a driver to be removed while > crash-handler work is scheduled, or even executing - resulting in > use-after-free issues. [...] > + spin_lock_irqsave(&rproc->crash_handler_lock, flags); > + if (READ_ONCE(rproc->deleting)) { > + spin_unlock_irqrestore(&rproc->crash_handler_lock, flags); > + return; > + } > + > /* Prevent suspend while the remoteproc is being recovered */ > pm_stay_awake(rproc->dev.parent); > + queue_work(rproc_recovery_wq, &rproc->crash_handler); > + spin_unlock_irqrestore(&rproc->crash_handler_lock, flags); > > dev_err(&rproc->dev, "crash detected in %s: type %s\n", > rproc->name, rproc_crash_to_string(type)); GPT reported that the rproc may be gone/deleting at the time of this print since it's outside the lock, so it's not a given that rproc->dev and rproc->name are valid (although the window is pretty slim..) Konrad