Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp972213lqt; Fri, 7 Jun 2024 04:36:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU1co/ZZ1VDiz0s/7TJBg6ZN4RypC7/gmYUiCMJPRLF+sNUO8g9lFQwY7I11AccVDxnrQdcI1FmswrsJ5wsoN5DXDL/1KjchB1UYQFXlQ== X-Google-Smtp-Source: AGHT+IHEfJk7uJNq/8JaYN101C0TqXX4tSa9kqg+KYclCsI8fA2z/3Hy19/xFV+IoKiE6mRzsEeh X-Received: by 2002:ac8:7e86:0:b0:43a:712d:ad6f with SMTP id d75a77b69052e-44041c31501mr29067571cf.7.1717760197555; Fri, 07 Jun 2024 04:36:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717760197; cv=pass; d=google.com; s=arc-20160816; b=nrebD6xA+L6B1NBV/OzVRJTc6R22D+T6p78/kwppnJavoNBChy1tTR/m/UVVD6MLs9 wr66JUV6R/2HQKbmhltGP6B4usr1Q2If9tWYS/30rEZu7rE1cr1a9lht3SLCvUIjQLXx mbV3YdwBJeDAcej95Z+PEywhTHZ5zENVFRI1OHa/7oFtO2HdmfcIUtMzLAwlXdB+8xhx d6ArudhyvnZm4RO20IwqR2iCdXOjjGtWO9SWtYFBUbl78alfCEpK77qOdc2J6P8QBkiR /JJk3lkkGyS9Na4aK2iW2uodsh5Rw6s4n5RQ/7n22bAt0iK4tDfAl3EoAMoHwIRSzrYR VWiQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=H1mui+HBDxQUFLppGRIOuzCMTBMXzF+PVJZ3OkaVODY=; fh=9SFmFTxguvHsK0WvrLS+df3jSu1kBbfEPVszzWaUJ0c=; b=KNu9PXfJycq8UjZwIMx0B0kkwrtxNErXCKOfyVe/oV8JvtwWnrveki5G3Vjh08Ege4 mAIHSiW6zxr8o3DEJgGSIaqPnZActTluxDkYtZkZa5qBlp73XFpDit0TOd6mXfltRB+9 OYjSDyDxuxfkXE3MpfElA8O+fyzvJ49EZCTy5kPS3kCUn1S9tZp3ECIm1a6+epYoKomJ t90frZnF7WygjeFZtKrlFKJsfPe5fcsc+8KOGRFwf6yI32ENXXUsiAz+T/Sn9a6Ffqvp G9MH9gTFqimOGuwf8acRPEmE5BKruicNtxBOWCIvC4i6TkwDpBityIUoFOKtzVdA/t0l KHKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R1jDKiWt; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-205929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205929-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-44038b5fa5bsi38094081cf.540.2024.06.07.04.36.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 04:36:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R1jDKiWt; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-205929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205929-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 495571C2267D for ; Fri, 7 Jun 2024 11:36:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EE84188CD0; Fri, 7 Jun 2024 11:36:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="R1jDKiWt" Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1701B188CC0 for ; Fri, 7 Jun 2024 11:36:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717760188; cv=none; b=ty36KcUWTubd45LAnjs/kOeg+88CVvssPd1ZVwLHko48p8tY10a2PrQhxzcKmWQvx53LsiYpO13c9YWNw8mqrQ7Wnxg2DdLdpnRNewrbdm3xEr4sj77YVoIFlKaS0mGj3lzyWKFPrTZaNIks+HjurjWnhsErrJdreW1Fvx0acdU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717760188; c=relaxed/simple; bh=1igZTYjDPXjCcCgy+nI5U257Gn4g4WLUSFaInx/hv2Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GGyXA0MJHuWZalzU5ZWJTLmYij3Og6Q8pBXJg7mzLFcupTPDTFULGbfQQCF2TRM5VVeQk6ZUZ/eIH0EQxcfM+KSVgWa5GfxuQmXyegdrqPkz3LoHQQoliEfVCBotJp2iwNVxPVnCE9iCitjvsahv5yDdtSCR3TMoEXQ3uuP0ImU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=R1jDKiWt; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-52b93370ad0so2762637e87.2 for ; Fri, 07 Jun 2024 04:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717760185; x=1718364985; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=H1mui+HBDxQUFLppGRIOuzCMTBMXzF+PVJZ3OkaVODY=; b=R1jDKiWtU+lV54BMnt1Zcuivxy8lZEWiYbJ3kGCl1zjVP0y/YxHNd0479hzQ8IOkEM WrQVGMKKBYGI8XrB4TwfgSTpXfdu0BHHJr/FyB99YLK1Swr3i1MKBcFI4eF6am3eCC33 zzs7kXHXiQplThCVR4m0RManiE1NuzDBPx+Vp+HtZExGITKaI++RlpskRHZBdeHEV+/o VLTaoIilJgPH4tiIsjQ7uyP1LYCboJUOD1eYCPhoMAwKDLVwEBw6U08kXgsEBsrzyE/A 4+95MAVbi7RQvS2fLV4gfLSYCqrLQYvs7n2WRMnU103ATMFOdhj9OnxIQk7k8OlbKgw9 AFrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717760185; x=1718364985; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=H1mui+HBDxQUFLppGRIOuzCMTBMXzF+PVJZ3OkaVODY=; b=df0gImo5Q+ZVttj82Ze22AjTKcwkXTfkIjkHj3vJ46Is1SZHU75Y3SiNWPWJLOQfab k3hBHUCoh/twbZZxY9wMXU03h0NDVBhXHoXC68Y84WjmnT28vG22QzXL6WgVK/iEFJNm 3KFHb5uIxL2iOZYAUbi9s0xBuo5cgYeHgC9a0MwKwlNfKR460rX9G9xnR5LMZfaTfIM6 BcwvjpuifuMVBL/8D4QTT68PT0vFDyCP4BmgZCZXaTu6uw19U94HGloulHw5Xf9CsrYQ f+Sg5J99JFUXSf8lq0sNkwcnXzL73QYfAleTZWuak4DpMo4m5DIDKVMbpeeW2L9/h8F7 hGkw== X-Forwarded-Encrypted: i=1; AJvYcCV88dG2T7eLZOGitlzRGerb0iojW+JdK7uLfCmHLrTs6sd3BWfsfdNVAr7i6p37L+BWekXXE5ee+DTO9TCZtrSkg6JqU3G4VHmjI1lN X-Gm-Message-State: AOJu0YzgX3wS43FDLsWIR/QOLIMlezbx7NzLn+hYDgPgZGXO+buXECKf ZuK5+dXThkjP77fd4R1bFD6mv4ac0l41G/G64/Yr+6uDLvgfkZCXmb6KAQbb2Ok= X-Received: by 2002:a05:6512:1308:b0:521:cc8a:46dd with SMTP id 2adb3069b0e04-52bb9f6275fmr2450550e87.11.1717760185284; Fri, 07 Jun 2024 04:36:25 -0700 (PDT) Received: from eriador.lumag.spb.ru (dzdbxzyyyyyyyyyyyykxt-3.rev.dnainternet.fi. [2001:14ba:a0c3:3a00::227]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52bb41ee3eesm502556e87.74.2024.06.07.04.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 04:36:24 -0700 (PDT) Date: Fri, 7 Jun 2024 14:36:22 +0300 From: Dmitry Baryshkov To: Ekansh Gupta Cc: srinivas.kandagatla@linaro.org, linux-arm-msm@vger.kernel.org, gregkh@linuxfoundation.org, quic_bkumar@quicinc.com, linux-kernel@vger.kernel.org, quic_chennak@quicinc.com, stable Subject: Re: [PATCH v4 08/11] misc: fastrpc: Fix ownership reassignment of remote heap Message-ID: <7yogq6uxespor2vjzwu5fdw33aahhkep4dmpmjzkinke6deg4j@x6gmcyuotsex> References: <20240606165939.12950-1-quic_ekangupt@quicinc.com> <20240606165939.12950-9-quic_ekangupt@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240606165939.12950-9-quic_ekangupt@quicinc.com> On Thu, Jun 06, 2024 at 10:29:28PM +0530, Ekansh Gupta wrote: > Audio PD daemon will allocate memory for audio PD dynamic loading > usage when it is attaching for the first time to audio PD. As > part of this, the memory ownership is moved to the VM where > audio PD can use it. In case daemon process is killed without any > impact to DSP audio PD, the daemon process will retry to attach to > audio PD and in this case memory won't be reallocated. If the invoke > fails due to any reason, as part of err_invoke, the memory ownership > is getting reassigned to HLOS even when the memory was not allocated. > At this time the audio PD might still be using the memory and an > attemp of ownership reassignment would result in memory issue. > > Fixes: 0871561055e6 ("misc: fastrpc: Add support for audiopd") Fixes before functional changes. > Cc: stable > Signed-off-by: Ekansh Gupta > --- > drivers/misc/fastrpc.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c > index 3686b2d34741..68c1595446d5 100644 > --- a/drivers/misc/fastrpc.c > +++ b/drivers/misc/fastrpc.c > @@ -1334,6 +1334,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl, > u64 phys = 0, size = 0; > char *name; > int err; > + bool scm_done = false; > struct { > int pgid; > u32 namelen; > @@ -1398,6 +1399,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl, > phys, size, err); > goto err_map; > } > + scm_done = true; > } > } > > @@ -1439,7 +1441,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl, > > return 0; > err_invoke: > - if (fl->cctx->vmcount) { > + if (fl->cctx->vmcount && scm_done) { > u64 src_perms = 0; > struct qcom_scm_vmperm dst_perms; > u32 i; > -- > 2.43.0 > -- With best wishes Dmitry