From nobody Sun Dec 14 12:02:54 2025 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.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 BD6F215356B for ; Fri, 28 Jun 2024 11:46:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719575180; cv=none; b=JheAZSDTNU+EVeRTLHOjmsNiwWMtWuOCUVaNdupZTLzhJXQm+F4TdG2BMVfLwIB4f2Nndp8Q681RGAHSgRXUF76ETiSCsm2ZORiGnv1QrKadqGlo9CX5grmBreL5eYPUjptIbih0USbAOwKtAFW81vK8IlwEAuxOsJzzqoICaNc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719575180; c=relaxed/simple; bh=hHHgBVyTFPrXFKNO1WIxKzgSQAzSoyDktUjq0O4p8xc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nWXDGjmJhj6glN7ns+q6BCnB/UksN5xlpoivDcr0MWKNyQbSAa3Juq7QqHSNvO9P1KnKhf+j88gHAqGmBjznCMiYO6ljEHhIAQbU8Q5NjPZNzv1arWVH6Arg2oGUFjUzbBwJx3/WaySUlyUYGpM/+vWVYq4UsjTTK/UMap9F/2U= 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=uu58518w; arc=none smtp.client-ip=209.85.128.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uu58518w" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4256aee6e4dso3997285e9.1 for ; Fri, 28 Jun 2024 04:46:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719575177; x=1720179977; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hdkWxGqkeTxNpF5y9bzC5FsO8WLu7OXUf3lFpoSXqjo=; b=uu58518w4JshcRtgSKN790ekM3d2mSLNW3VWRXJUlNXhQov37GrU3zC/GysOhhvjCD FrhU2nWTioRtCz6M9Q8kJgnLPtCM1tZ9JJe0jcAIO+1f6EAzBF39kzTa9qgvX32eF+IO e0FGUPvPIyQYeauR7CfMGq51DuFQ/gzx8OXbJGJuP4npnbOdmV4FQv/XAk14cryqw5HI S0SnkvtGbMv8vfRS+3n3YiNIH+GYJqjc+dL2QT96sFE2QhMyEq07rz3ynYNzf5vcAbsi eFrMpEgEEmBaVRt1+ub73mGqsgJIod76Hn5/3jTvlXzDeNH8PrpLkzWtsAM3vJ191aHv y92w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719575177; x=1720179977; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hdkWxGqkeTxNpF5y9bzC5FsO8WLu7OXUf3lFpoSXqjo=; b=skYZSa2AtMgOIQmu+NfJofxIgtBaD+gfdWYFzoEDBv6K6kgAuz5cHAvIYzFDpIhhuU pz2JnqrH7+DnQmW278J6nc6r1VIaGCd7VkSn+m+cp/8cwqduZSBXqDlZQuzsa6Ku9Wkm wYKdOFAqyflk4sh5oDTJK2Jz4MXH86YQWBK/C6NWEpsjL/VBEYH7o/FIsGH/O4htiGP4 +yHvSo44cHSpcCg1ZppvxqTk170t+NgsVqQzdCX16ez+NTNollYQ/zguULhvBhPkRogH 19DpD/r2VfBiQd5xAcoLrxM9m/QTlczX4cs3q0+Vdj3w4MRfGY0CxHx1AmPjLr/Snhdj IfmA== X-Gm-Message-State: AOJu0Yw0cC1PDQ6pAq2p0yHacSRqWIRr1/6nBwiIEiQOCovhI2LlwMBh bdDmId23lrSL7hhC+M96zueFnOULxJJscpX8FChF/ec3nkkN4YTzNaTU960pi+I= X-Google-Smtp-Source: AGHT+IEDsDd8hZ4X2baaApk+xrmIwModpVB4wFarHOh7tb6zecGXmlvkgQ7IlFTc7P6CAM5VwPd6jQ== X-Received: by 2002:a05:600c:5118:b0:424:a56d:83a with SMTP id 5b1f17b1804b1-424a56d08fbmr78294215e9.0.1719575177163; Fri, 28 Jun 2024 04:46:17 -0700 (PDT) Received: from srini-hackbase.lan ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af389b3sm32721345e9.1.2024.06.28.04.46.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 04:46:16 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Ekansh Gupta , stable , Dmitry Baryshkov , Caleb Connolly , Srinivas Kandagatla Subject: [PATCH 1/6] misc: fastrpc: Fix DSP capabilities request Date: Fri, 28 Jun 2024 12:44:56 +0100 Message-Id: <20240628114501.14310-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240628114501.14310-1-srinivas.kandagatla@linaro.org> References: <20240628114501.14310-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2577; i=srinivas.kandagatla@linaro.org; h=from:subject; bh=KeCAEHnS23lE51AdVj5TAaXEZY6ywQEeJjqF6bxCBIM=; b=owEBbQGS/pANAwAKAXqh/VnHNFU3AcsmYgBmfqI9qop85OUzqD5DCIyF33nzKsv1GcvPzD5jN htkzM3nGymJATMEAAEKAB0WIQQi509axvzi9vce3Y16of1ZxzRVNwUCZn6iPQAKCRB6of1ZxzRV NxhVCAC1/WL3R4l6cOJ/88a/kVE+yO3PXzBR6tTp5xvamPMljUrVMLpEkM5VgQjWphJaEf/bm/a BJvITKq2yyDZARMl0p9/4DpfonCO98tmglMVcBeeGCQ5HzKxzltbw3XIa4u/jnDiKf8kqFfZpSq yj+8dage+pJEKYL85G6BTCPynds1g+7yEx5WDLyO1b3JLCKTGaqTPTWhV4uSVE2xMxZeNg4hWAV qVxyquRIDD+YG+bOiyuhLQb/rMjicW+hEhra9bIVHWmXBKBkmgpqh8eYmFL3J7YUGj6MZmEuyeN sNBmUnBrWEbO7GDx09xqfSd0cOPiJ7EeeM+hWv4R4037JVkU X-Developer-Key: i=srinivas.kandagatla@linaro.org; a=openpgp; fpr=ED6472765AB36EC43B3EF97AD77E3FC0562560D6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ekansh Gupta The DSP capability request call expects 2 arguments. First is the information about the total number of attributes to be copied from DSP and second is the information about the buffer where the DSP needs to copy the information. The current design is passing the information about the size to be copied from DSP which would be considered as a bad argument to the call by DSP causing a failure suggesting the same. The second argument carries the information about the buffer where the DSP needs to copy the capability information and the size to be copied. As the first entry of capability attribute is getting skipped, same should also be considered while sending the information to DSP. Add changes to pass proper arguments to DSP. Fixes: 6c16fd8bdd40 ("misc: fastrpc: Add support to get DSP capabilities") Cc: stable Signed-off-by: Ekansh Gupta Reviewed-by: Dmitry Baryshkov Reviewed-by: Caleb Connolly Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 4c67e2c5a82e..82ce4f58d70f 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1693,14 +1693,19 @@ static int fastrpc_get_info_from_dsp(struct fastrpc= _user *fl, uint32_t *dsp_attr { struct fastrpc_invoke_args args[2] =3D { 0 }; =20 - /* Capability filled in userspace */ + /* + * Capability filled in userspace. This carries the information + * about the remoteproc support which is fetched from the remoteproc + * sysfs node by userspace. + */ dsp_attr_buf[0] =3D 0; + dsp_attr_buf_len -=3D 1; =20 args[0].ptr =3D (u64)(uintptr_t)&dsp_attr_buf_len; args[0].length =3D sizeof(dsp_attr_buf_len); args[0].fd =3D -1; args[1].ptr =3D (u64)(uintptr_t)&dsp_attr_buf[1]; - args[1].length =3D dsp_attr_buf_len; + args[1].length =3D dsp_attr_buf_len * sizeof(u32); args[1].fd =3D -1; fl->pd =3D USER_PD; =20 @@ -1730,7 +1735,7 @@ static int fastrpc_get_info_from_kernel(struct fastrp= c_ioctl_capability *cap, if (!dsp_attributes) return -ENOMEM; =20 - err =3D fastrpc_get_info_from_dsp(fl, dsp_attributes, FASTRPC_MAX_DSP_ATT= RIBUTES_LEN); + err =3D fastrpc_get_info_from_dsp(fl, dsp_attributes, FASTRPC_MAX_DSP_ATT= RIBUTES); if (err =3D=3D DSP_UNSUPPORTED_API) { dev_info(&cctx->rpdev->dev, "Warning: DSP capabilities not supported on domain: %d\n", domain); --=20 2.25.1 From nobody Sun Dec 14 12:02:54 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 41B501581FF for ; Fri, 28 Jun 2024 11:46:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719575181; cv=none; b=lZeGwLVeIG8936gozByLSIDFtRJqHUXlngGs9Rx2rhe6CywK/TNSq34G4VNklcz9BXsQotkN8+ZIHW1MSc3lqgQ9c7x5GImfyMaGOK/p6IgDh1xIYLxR+P9EUuLgL26wfbWALdkHfhgFeuRmKWaA+7zn7jeDdlwEFNoslymu80g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719575181; c=relaxed/simple; bh=8T2HsxEc3rlQEVkxbqa8/uR13uANxuY8M03QJt4E5W8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PY9QAQPUEk0BEiov35tcebvSrm/yITQ9lTHn6RAXPLrkkHc2rtMY51A0bM59yTQeEld9uCXwTu2Rjp6il0viTuAbCuqWO3NAuKVlzRr5CXpb2om2I/kzrGtaa4DiNJBfaZH2+IeyoaKCL59akiLHTQCvkBzkp9W8E8h2WV6pSOo= 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=UDOdMVrc; arc=none smtp.client-ip=209.85.128.51 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UDOdMVrc" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-42561c16ffeso4405125e9.3 for ; Fri, 28 Jun 2024 04:46:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719575178; x=1720179978; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lQHysEdsy93bM62CH5I1Dfy0jGOUqiM4lFaeQ8Tg4Hw=; b=UDOdMVrcp10KRzX0VJ1hj+5GFKZ/C9R+9uoH32FXtK7sHk95VxbVPrRd3krQVpZSYq EWnq0JHz/trC7HZHbwiAQLzPBdBrUWbFgQ5zL3KhrlG1SZxjjzh/lsODPccUFS+TltXv +SihqVGtKFsQtvyzhNbR9szAUNtaN5pok4aLI+Cw5+YOHrPmuUEKVf/Eigusr57u+cXh S+Wk/5YezNXk6xChlkmpAnipYodzVLHIQ9ybAzPJlib4P7ces5OlM4hQsWcmNFoh4J8m C2jc6Cy6Vq9I7o44OGOioOxxM6kMnBoLUB/TQFdDn59BGvuitY3DYNrGBYuRoeqR0Jqe saUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719575178; x=1720179978; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lQHysEdsy93bM62CH5I1Dfy0jGOUqiM4lFaeQ8Tg4Hw=; b=Wa2Azx+U/+Uf8CGkP2OBXds+iUF3HXS3txjyxOTSK/YvTgA1unt4ciBH0qjA+Si1Dd NiBdODpxi9RwsvHaLrileI+f7D8vwcpTjd2yrx7DTwCfe6tIza/5OS9D/Ns4NEHi9UGn bOA2JUyWAu4UVaE2sJbpFE3dfs8heMIqlGBnPiZARag3D86Xm3BDnoLHjbxjPsqL18G1 MXB0N6R7fh5IYPBsyxckj9mHXxRiw6P4B8OnP4zpquaD1y8WT/4yMEtcevo1Ytcu81oO BaZaVztw7uEMxtdazoRCmr1hQbRvRuLgD3xSi9hbaQLO2Keoa/7DCK4kyDDUMLZWayM9 s6+A== X-Gm-Message-State: AOJu0YyAaiC7XTCzrj+uZZi7H7P4OW2mPuCEjDbzuwxcko6nXA0hrTId 03obXPOUzX9B3VFAeyoGAfcqnM+lA8/fKLGOxTTgoLq4OPzfwth4g7jJ23DZUWA= X-Google-Smtp-Source: AGHT+IHwe/jQPkC8fWoEHmIctqYoLrTMAxpOK7lES0uUc0DLRll+BGVIUjfkLhokhIREvpH+P6XBMw== X-Received: by 2002:a05:600c:12c5:b0:425:5fe5:f273 with SMTP id 5b1f17b1804b1-4255fe5f3d0mr50153915e9.26.1719575178736; Fri, 28 Jun 2024 04:46:18 -0700 (PDT) Received: from srini-hackbase.lan ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af389b3sm32721345e9.1.2024.06.28.04.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 04:46:17 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Ekansh Gupta , stable , Dmitry Baryshkov , Caleb Connolly , Srinivas Kandagatla Subject: [PATCH 2/6] misc: fastrpc: Copy the complete capability structure to user Date: Fri, 28 Jun 2024 12:44:57 +0100 Message-Id: <20240628114501.14310-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240628114501.14310-1-srinivas.kandagatla@linaro.org> References: <20240628114501.14310-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1412; i=srinivas.kandagatla@linaro.org; h=from:subject; bh=2dRGG+LCOSOerYGULNCCFlsN5B7XVPw8Os2Q9OTMxG0=; b=owEBbQGS/pANAwAKAXqh/VnHNFU3AcsmYgBmfqI9zkTQrg7h4q2xkPQJ1k/3FBer8WBikUxCL +Mq3pE3/TiJATMEAAEKAB0WIQQi509axvzi9vce3Y16of1ZxzRVNwUCZn6iPQAKCRB6of1ZxzRV N6e7B/0Vx1fSTePraR3H3TvBZ8oom5sysGNgZDl4LYT5CW2b+X/QWjvY4XIRDvGyNxvud4415Kz r79kpiKQJ8UdNqjUGiEqZikE7Qe0ueStkf0m3hJA9YyBxwAi3PpmR10zqMWakUct+muhDKvEbyo WDf416sYEn6FZbo/Z5QTOEoIBZhJ2jUUtR2Nq6+kVnHrQ9XIZWJSzbwH5HKUr7fKSJ0LtpOda2l 3WekMefHCShfRRqk6UobTixU9zT4NXayRY5KDv+fKIHjnUi0NozPiiB23mowddWTyBTt6ffjwYS s4iDjwZmwleVuxG6jKvya1MWsUCgpM+CHY/CZsqMmIWA5aXa X-Developer-Key: i=srinivas.kandagatla@linaro.org; a=openpgp; fpr=ED6472765AB36EC43B3EF97AD77E3FC0562560D6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ekansh Gupta User is passing capability ioctl structure(argp) to get DSP capabilities. This argp is copied to a local structure to get domain and attribute_id information. After getting the capability, only capability value is getting copied to user argp which will not be useful if the use is trying to get the capability by checking the capability member of fastrpc_ioctl_capability structure. Copy the complete capability structure so that user can get the capability value from the expected member of the structure. Fixes: 6c16fd8bdd40 ("misc: fastrpc: Add support to get DSP capabilities") Cc: stable Signed-off-by: Ekansh Gupta Reviewed-by: Dmitry Baryshkov Reviewed-by: Caleb Connolly Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 82ce4f58d70f..30b93012877f 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1788,7 +1788,7 @@ static int fastrpc_get_dsp_info(struct fastrpc_user *= fl, char __user *argp) if (err) return err; =20 - if (copy_to_user(argp, &cap.capability, sizeof(cap.capability))) + if (copy_to_user(argp, &cap, sizeof(cap))) return -EFAULT; =20 return 0; --=20 2.25.1 From nobody Sun Dec 14 12:02:54 2025 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 333B2158845 for ; Fri, 28 Jun 2024 11:46:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719575183; cv=none; b=LZB8BswgEXJqUXAmrKzEUIqNnZNZLULDsp51E1bd8Ln4b2sdHlDyusjxhIsHZdXF40ZC1Y3QoAm+bd5v93i8e2fQyn+y3q3oq0lVdQSF4J+rtxNg6B2t9Xv1Fz1KMeEHDEl9M3tCQJV0mEjn7dm6gWroXHwSfcbqZNuS73dO+So= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719575183; c=relaxed/simple; bh=6g9UiIZEdVKxbWh4F8n7gJeFwdD4NlgvUF252NhJ/+o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OZigu+eHEn86sQJj1olMbqXjzskcMW90CM8FGvmKCChhZ4tugoHVt60hIst1divL2bBGMXN4yFkiidFFqQ/FEYZf3gf6SxzKamn1vXgkEXTHJLy1ysV4hDt7NaVz7ynn3men8fHp/IrdvAEsznjzUHA9WEFJkXdRiBKhoONPWAY= 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=Js62zKyV; arc=none smtp.client-ip=209.85.208.173 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Js62zKyV" Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2ec5fad1984so6655121fa.0 for ; Fri, 28 Jun 2024 04:46:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719575180; x=1720179980; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fBtK7paKPhfq7zwpsh+mBHknmAH54FUcre0qQXSrQtk=; b=Js62zKyV0dF9+P0lKuyhBUucCsoeU0/Uig+mpjEOJzpZRdE95OY/wghmfLA+rmyj94 9uiP3I75sk60rjahtNZy1ipmL5uPsoT4BcGfkOg3ksYgkUtxbV30exjQyKPCCoC3LUoP /tRRxhIWGUgG6BifK7WhxsuXlnK7sGWBWpC4OZZxbgIid6/xOrd/9VcQ1vNh9c8K2DQk bxVpW8zW181FMsnQ09fDw5b4oMT2B73sr8BWuyFrYXWbXZpwdKqIaBkUSJFt0Vd6nXjR ZzyHBHYxgPOZiwr1cvnyFiDysf+w9/vo4sA/osqx6OayfxZjS14WFPZUcTwCEUU9LOcs jHtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719575180; x=1720179980; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fBtK7paKPhfq7zwpsh+mBHknmAH54FUcre0qQXSrQtk=; b=X8/bRaItKN1hc5rEiguhiwFN7yGv8gto6bGre9QSIspTbRDJHavkQSyk2yx7himBGF 82s6e+xmx/hFAAm1/gAqDk0Gm4z7xGNmCMwwoXQTtl81w+mYukQMfiqNM8akes7a6MWm DP9ESLfxDlbiU0DV/673r6YEwPPGOMlULcCkdGgYamtm1cUNpn/kMU0I7ff9XEySHPlY tgZI8fJAwkUAGeEAB5E08V0FIPmI6rsce35MM3Vm0ICDqdIUhzaZUoP7VxyTxN6wUmQ8 6AYQMVV8dHtao9/JZDGPnGyvIm1v2kn2D14bXwMgtrfyF8IynheBbEIPOQAByI8EdKj/ J+3w== X-Gm-Message-State: AOJu0Yxq8PWJ8y5yodztPTa1dvHBim/ZgfLlpO0iq4V5HbEyLGb8U8iZ Hk7mlRO0vQzRhF8bph+a7w1VxJ+80a87BOKABSufT+zemSiyfKRC3O1xamnPkK7xfZ7gSD4bQrK bHOI= X-Google-Smtp-Source: AGHT+IEmeDnTVu2xMxUnXBGnRXw1GCBA9y5aFVxOvTYb0U3V/dI/2sxYwOK8gtwzRsHueMp9Puq4JA== X-Received: by 2002:a05:6512:467:b0:52c:da39:87a7 with SMTP id 2adb3069b0e04-52ce1843951mr12479896e87.41.1719575180312; Fri, 28 Jun 2024 04:46:20 -0700 (PDT) Received: from srini-hackbase.lan ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af389b3sm32721345e9.1.2024.06.28.04.46.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 04:46:19 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Ekansh Gupta , stable , Caleb Connolly , Srinivas Kandagatla Subject: [PATCH 3/6] misc: fastrpc: Avoid updating PD type for capability request Date: Fri, 28 Jun 2024 12:44:58 +0100 Message-Id: <20240628114501.14310-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240628114501.14310-1-srinivas.kandagatla@linaro.org> References: <20240628114501.14310-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1345; i=srinivas.kandagatla@linaro.org; h=from:subject; bh=niskVdv1eY7bhTkNIrP3OiXHlYz6PMSZRBavdNmw8Tc=; b=owEBbQGS/pANAwAKAXqh/VnHNFU3AcsmYgBmfqI9mjGfDD8BF5zl9IQ2S4Wcpi72ShoFAQxIl kMyKyvPyU6JATMEAAEKAB0WIQQi509axvzi9vce3Y16of1ZxzRVNwUCZn6iPQAKCRB6of1ZxzRV N8KhB/oCKthSZJ6qRSGHRd6Wg3UGNc+hjIKiZ4huBvwpiOpfgkuQ9hKRJx+v+P8WNg2n7qBKcX0 RoJog4Y4tASpdeWHxsul7yqjccWJ6BEP8tWycdXvWPyb1j1ye3oiw8WEpEDAUGR2zhp63B/IIlI jIlDXn0a6mVejs11hjO26dGk0tRch2yY+cTpxLddgdN/rr7Xte75N6EhnGht8tU37VAIlHzgPTh j6dqrd1ejpQ1OxHPChs1z10x67ut+pYI8F52gbcJhtruwyDzgrX86LHy4ckWs9vSRteVVNHlhcA oX+VGVswAEnIb5Eb8g9G74idQe2MkpNhnS5FvR+6RHC6VnTA X-Developer-Key: i=srinivas.kandagatla@linaro.org; a=openpgp; fpr=ED6472765AB36EC43B3EF97AD77E3FC0562560D6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ekansh Gupta When user is requesting for DSP capability, the process pd type is getting updated to USER_PD which is incorrect as DSP will assume the process which is making the request is a user PD and this will never get updated back to the original value. The actual PD type should not be updated for capability request and it should be serviced by the respective PD on DSP side. Don't change process's PD type for DSP capability request. Fixes: 6c16fd8bdd40 ("misc: fastrpc: Add support to get DSP capabilities") Cc: stable Signed-off-by: Ekansh Gupta Reviewed-by: Caleb Connolly Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 30b93012877f..3fef3eecb88c 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1707,7 +1707,6 @@ static int fastrpc_get_info_from_dsp(struct fastrpc_u= ser *fl, uint32_t *dsp_attr args[1].ptr =3D (u64)(uintptr_t)&dsp_attr_buf[1]; args[1].length =3D dsp_attr_buf_len * sizeof(u32); args[1].fd =3D -1; - fl->pd =3D USER_PD; =20 return fastrpc_internal_invoke(fl, true, FASTRPC_DSP_UTILITIES_HANDLE, FASTRPC_SCALARS(0, 1, 1), args); --=20 2.25.1 From nobody Sun Dec 14 12:02:54 2025 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 698DB158868 for ; Fri, 28 Jun 2024 11:46:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719575185; cv=none; b=RaDwWcyOEBLs0D9lLEi1gmVnWIWoTuJcXguPX1la0pYmLpM0jcs++dqWy1APOCl0i8ztUq/EYKezxPBea5ZFWh9BcQZW8nDJK1A504zHCrY+T8iftsYInBBrlnlG1by03bpjpb/sfp3dlBxrlqndzlhVOeR0O1Rp2dyMsAD7thc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719575185; c=relaxed/simple; bh=vEmfiAne+KiyRDNj/Ak3IyzdvfzPeulyHZoEEcDhrpM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F5VgEX5DGaKxJs82rxE2BJJ/fxOJzsO7yE7HFO80r3D8HfmYVbTfRlVgPLj1+p2TuSFMmrsFgRhgJ4IvgxdEYUWPE4UzqzMEwlWWqd+kNbRPzHU9QJzvtRZLGM3/9/l3tvWUHIKvU6M51gtCXzyy2yb0UqMjxk2ZpjnSjhisknI= 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=S1Neeqin; arc=none smtp.client-ip=209.85.167.47 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="S1Neeqin" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-52db11b1d31so739264e87.0 for ; Fri, 28 Jun 2024 04:46:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719575182; x=1720179982; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QAh6YJurawpdJpQCh05sfaX1aygIRQvrJqh39cFL9CA=; b=S1NeeqinostdNZN3VUNkN7VWWuXAAPAX/mTnq+grA0b8abjuqHGQahVvpdUnhCCwo0 Srbq6pYO67F7iDpZsHNQbg2bTU2KnNTEXRtXdXve+lidoQxAYDVg5Tv93OVaKHgydggQ lROIOgUIx4/ey6bMu6+jfFqm2pvF96RqX4WrW1Y1E73XehcIXo6wz6FI/nZElUncVRvq /t3Ze6Da56aDOmvqXzj5icGo7uUSj2sykMnOWDKb671koS/YWeE/c8zFjPYubxsHXx+A 0AIkDqhDZ5UBqesXcGHplSb1iER3xwOXtG3pvR3xBZgrVZl+Eiwra9KDpx2BlpXytoxR kIAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719575182; x=1720179982; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QAh6YJurawpdJpQCh05sfaX1aygIRQvrJqh39cFL9CA=; b=uwe2TO/O1z0rip/kBFTJ7jVGmmuiNkTQj0PtNayGOCKarS5Atr/m+ZpczUNgvYuu0D pV+KyUfK+BOWgRo6KDEOua9ymrQR91hl8lko7Wd4knW6goikGrmODESYyi+V+Msqma/s Oes4PgaHa+KlBt4r4J9pPhCjbBcyRJJeq463lVKJiuRCGL1sI7jEIGl/VkuOET4tcC2u 0RT3FJG3hv57xX07wMANA++KaAgMTvvslEO84YyXBe65ZnmLPfC1rJ+JdA6RdaqKm+4R tLXxyCKyH744O2hHZRqdYvrnTHR0BK2ndFGBMq9mcnGgynA8JYEPFwQ/IaKfCO7XN0Tt oBrg== X-Gm-Message-State: AOJu0YyNusaBwIF2K6kl7y0eEEQ2MAYOmzNulTC5VzgF+hUGvjOa1wJq E8jXEUgr69eqf1/MeiYmbsSt8Co1HI13cTEv2C6buc7P0Qmr+iiO/SvWDxyWbis= X-Google-Smtp-Source: AGHT+IFQzaKHtbdyPVLmhhs+ndV7Msu7/7CKnByqlEuHg4e/gYuGli+et9+ae2RloelwpikS4MN9Pg== X-Received: by 2002:a19:a413:0:b0:52c:dc4d:acbe with SMTP id 2adb3069b0e04-52cdf82094bmr10669099e87.45.1719575181812; Fri, 28 Jun 2024 04:46:21 -0700 (PDT) Received: from srini-hackbase.lan ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af389b3sm32721345e9.1.2024.06.28.04.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 04:46:20 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Ekansh Gupta , stable , Dmitry Baryshkov , Srinivas Kandagatla Subject: [PATCH 4/6] misc: fastrpc: Fix memory leak in audio daemon attach operation Date: Fri, 28 Jun 2024 12:44:59 +0100 Message-Id: <20240628114501.14310-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240628114501.14310-1-srinivas.kandagatla@linaro.org> References: <20240628114501.14310-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=949; i=srinivas.kandagatla@linaro.org; h=from:subject; bh=CvPcYqEU0+U/QHHokAP76ysndTMG1WzJfZje+PK0MFY=; b=owEBbQGS/pANAwAKAXqh/VnHNFU3AcsmYgBmfqI9Ml5beaATGm6wYQujunlhS3CiU1fa5ouhA cv0lzqCVDOJATMEAAEKAB0WIQQi509axvzi9vce3Y16of1ZxzRVNwUCZn6iPQAKCRB6of1ZxzRV N/s3B/90LVXZ6HiWD+ofIR4+oUoDSIWvEpsIOwcUjj/YdKohf2UcoMbJYpGYaiPFlt8E9fZC+6P zWkbQRMHxUzoh2cH14ImhulGrX7kNdqhYuf3mS3PIa9kYNvz7i5/82FgDgF/vrfQBN7InENOzv8 JhCOLM0+Lk+CZ1E4xnlWkFo9y9LxEouOOCg0+Qtu1sWW2D83WVeXZD3zJl8dhAS8C0zNPr/o5MU E1eH63suyVZ0UEaTBLif1IECAByReVMA9C+amPhMVSswl/Cs+wuupwehaPoUsx6b270Fk6IVuUI v+Bikp1AXWEPHWt+T/9byf7Gx7Ux/jK1dacwthdeuDiTXkjm X-Developer-Key: i=srinivas.kandagatla@linaro.org; a=openpgp; fpr=ED6472765AB36EC43B3EF97AD77E3FC0562560D6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ekansh Gupta Audio PD daemon send the name as part of the init IOCTL call. This name needs to be copied to kernel for which memory is allocated. This memory is never freed which might result in memory leak. Free the memory when it is not needed. Fixes: 0871561055e6 ("misc: fastrpc: Add support for audiopd") Cc: stable Signed-off-by: Ekansh Gupta Reviewed-by: Dmitry Baryshkov Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 3fef3eecb88c..11d53b9322f1 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1320,6 +1320,7 @@ static int fastrpc_init_create_static_process(struct = fastrpc_user *fl, goto err_invoke; =20 kfree(args); + kfree(name); =20 return 0; err_invoke: --=20 2.25.1 From nobody Sun Dec 14 12:02:54 2025 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 068DD158A17 for ; Fri, 28 Jun 2024 11:46:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719575186; cv=none; b=dUwfCSYcVjDwQvYuKq1ok1GlLMrX8bX/K7F5kp/O7+M1e9y/Q5J8U7UrkI2PKG3JiGOwEBjAzgN3uOL8VyEjQOKVm36NRFvSMLQZNzUvJkREQ+84Qh9li+NnX/vsTvxt3yBpwhZ3pgYxDAe+y2I9gdFxc1WlCIaXwR8W2eaLZkw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719575186; c=relaxed/simple; bh=DXhEa8mGqiWV/qQK7qT+F73a5TFS4VUjTrj4t5Gaa2Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=f3BKYGETEvBgZxW6EyM8NJSAutdM/4jUfpDUrdf72xU33XQLpWwoImzbSgoYZAq7glFRpCPLe2yqJBIZz8o7rpPaqUd2RTtziYxg0CyW/qru+hvGOIX8GzFZshPWkYjBpemwhEhx4H55g0usgf7OWIKS9jsN0pfMr55AurFHaHM= 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=O4djO/7j; arc=none smtp.client-ip=209.85.128.41 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="O4djO/7j" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4256f102e89so2913195e9.0 for ; Fri, 28 Jun 2024 04:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719575183; x=1720179983; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LPLR0Po0Ek7N4GOPdSb9qWqsRn4oLprs4RXHqoMld2Y=; b=O4djO/7jSx0T9wCHFyB4GXITb1SmoI+wdEhds8jrZwvtHDhcVPeUCz30THMDV/ldY5 P1+TVAqwoMgILhsWvX/YZtfe9DVkaPRMXb61F8ZGI3ZI5l5oWoYvD0kfPbjA8Sw1+PP/ a7VNK/x70TyzqeyDvvLYlWCufqCQDgFEQ7pRkdtK0o9JbZszGerGHpKbdRHjCtFhxx9u jIM3W5xm1usS/GOkLzzP021Zbo5H0hYr20VfoMuyHJEO+JozXiCNSnG5JVOYEbpdWdna KwkLvctE1Rd1rHHzV75X7HvvlZwevDY2Ykvu7o7JAglLgvKxbG0s9UF7HkLrHTb+rc4O WezA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719575183; x=1720179983; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LPLR0Po0Ek7N4GOPdSb9qWqsRn4oLprs4RXHqoMld2Y=; b=QKEG9ZAmLSxld0O+N/v94y9vMWjzjWkRa4s+5OtIjGnRxrEfc0z1R9O85och/qLHZL kfowbaUCvCM7SvEGUPbT81vBU10KmCdaSjULF9WG1peKns7RxKs4jcH85KmrB/E8ivJZ +e3L7hlyXCoLBYcvABgWnX2T9HD/6hi+/OvF/sLFqchAsmbHxlFQ2MiYQJUDCRzwsyIu mblvDNi9+nnmRzBYa7ByopdRLC30PBOL461YId5plllVDdo/MIIUu2mhhbqu7a5Bfy2c o4vcwgeCfICZHaXuQSX8LdsOm97ZwOdPcuax763DAMssmlRDxFlHKIQAYiKIVS2TlC5v aMTA== X-Gm-Message-State: AOJu0YwBW/6wgn8qFNI0qlenrSR+J+d91i+WG5HwZ8FTWORnJZSAYe/z aOY8c61m0c8NL0qsZ/k9DiruwTA9gidTcgbr3f9+skzWjVYFoxb2anYguZf6Ctc= X-Google-Smtp-Source: AGHT+IG5N34XjI0I2joDx58QWWB42JCMq6eFPMOUJ11iQz5fyZCm20rSBGIP/5XIpTNwbdzQu32C3w== X-Received: by 2002:a05:600c:929:b0:425:65c5:79b4 with SMTP id 5b1f17b1804b1-42565c57b9amr34256995e9.26.1719575183503; Fri, 28 Jun 2024 04:46:23 -0700 (PDT) Received: from srini-hackbase.lan ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af389b3sm32721345e9.1.2024.06.28.04.46.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 04:46:22 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Ekansh Gupta , stable , Srinivas Kandagatla Subject: [PATCH 5/6] misc: fastrpc: Fix ownership reassignment of remote heap Date: Fri, 28 Jun 2024 12:45:00 +0100 Message-Id: <20240628114501.14310-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240628114501.14310-1-srinivas.kandagatla@linaro.org> References: <20240628114501.14310-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1876; i=srinivas.kandagatla@linaro.org; h=from:subject; bh=+lScpHOuKGC7U0+MQ0TMTpr+mO1mgPe8J9pSX6cDz8U=; b=owEBbQGS/pANAwAKAXqh/VnHNFU3AcsmYgBmfqI93u/zuGpO+NZ+wA6IQ1XiH8XehXjFjUJoF 700+9jcrXSJATMEAAEKAB0WIQQi509axvzi9vce3Y16of1ZxzRVNwUCZn6iPQAKCRB6of1ZxzRV NwsGB/4xJjR7nINyR8hB0K/jNNiHQbzO6lOnzYCfFpZlfbs9JzY2SgUlrtHaEoZz41knCYARxc9 LW9XscIn1tgH3sC0xeFi/Gs2mrb0cRQehLZ5ZOQ2xwSM4EIrS03rrHYFtVIFAvE8ZmtziHFMV57 umsoiN3rUqVSALlY+otkafirD1PkuNZ+QAGpAqedIBN19OdEQPlcdzVPtt8Vknjga/u0MWtKkYQ fUENzBqnbnrz46wbvoGgIHAOSEVdmazfbl0qoppSazfmeYAUh6xwcVrbKDVm1o5A5VFSk7cECss HO+BNBd8Hkk5/ROcrQxr+w1dyYjmwafp30dY/2wObIHC3gKH X-Developer-Key: i=srinivas.kandagatla@linaro.org; a=openpgp; fpr=ED6472765AB36EC43B3EF97AD77E3FC0562560D6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ekansh Gupta 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") Cc: stable Signed-off-by: Ekansh Gupta Signed-off-by: Srinivas Kandagatla --- 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 11d53b9322f1..5680856c0fb8 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1238,6 +1238,7 @@ static int fastrpc_init_create_static_process(struct = fastrpc_user *fl, struct fastrpc_phy_page pages[1]; char *name; int err; + bool scm_done =3D false; struct { int pgid; u32 namelen; @@ -1289,6 +1290,7 @@ static int fastrpc_init_create_static_process(struct = fastrpc_user *fl, fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err); goto err_map; } + scm_done =3D true; } } =20 @@ -1324,7 +1326,7 @@ static int fastrpc_init_create_static_process(struct = fastrpc_user *fl, =20 return 0; err_invoke: - if (fl->cctx->vmcount) { + if (fl->cctx->vmcount && scm_done) { u64 src_perms =3D 0; struct qcom_scm_vmperm dst_perms; u32 i; --=20 2.25.1 From nobody Sun Dec 14 12:02:54 2025 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 9F8E3158D63 for ; Fri, 28 Jun 2024 11:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719575188; cv=none; b=h0t6vBoWv1Hcc+Ib/fwlCkZONzlLnYwIKTqowGfzK/eGeJ6JB1JzHY7YzNxEpXsfmXq+BqgGZh4R8R3mh+fsFzyqxKtdpzkP3wKrljJQ7FHBYhMsj/L80dl7ro9pKeQxjK/27H7XdOPgbcMBjDN/F8M9R+S8E8bDlu2BYwE8xww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719575188; c=relaxed/simple; bh=kXZvliVkK+p8c4vpFnhafDUylYzkJROmCl4Pfwa9a80=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Er2eo8DD/4lWQ73HgNTQvJ92KS7vtmHJJ6BA713tflt+AvdO7slDdjX8QVeUcwklrvwnqR2j760M/HSCIve+b1capxC7hD6SJWnOEd1NZa57u0WZhO/kv2F+mK0fdo68ExoEddJsx2KGMk5WCzcizjQhKfVQ6yEjq382s4zJh8Y= 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=BC0plK5w; arc=none smtp.client-ip=209.85.128.54 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BC0plK5w" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4255fa23f7bso4104835e9.2 for ; Fri, 28 Jun 2024 04:46:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719575184; x=1720179984; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pNmFK4pvQcIw4zFblPnZBX7k9CkJ/GPmsU3zxTOL/ZM=; b=BC0plK5wy+bMZ5M7QZxX+hG1wBJenqMS4xaSQLSk5EZuziQmzcQNWH6UuPMFHFKWMf RWiuRI5g3wM9WOF9/dkza5TRK+tsZKdqLADWLPTtZx8mGcWZ4C55EQsdCMeh7lw0b77z jmUshkYIdhqHPAqiHTeMo1973DOoQ8lEFBelZ/HyrNwoUag5GhSIhOFMEKaSgiVFxdzj zWIUvDNde2E/isjFRands/r2pYEvWi/CpC/wwUkaRFsBg/h3THzPnp1Fw/wyA72hpffS RBeFDADAf0CiBmkM5MUNc9TXVc1XboVjzM9kuBsiWrL2f2d0/vTWVMNncuTC03gYSGLy MSyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719575184; x=1720179984; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pNmFK4pvQcIw4zFblPnZBX7k9CkJ/GPmsU3zxTOL/ZM=; b=fFOFFDX8vj3+eogdvLsiy3Oybusb6I7HfWQozx3o2fZCJ++HykaqWFyn2hhhGz6Im7 OpJ7HqVAuzkMI0vgxdanwJ3MX5DjdDXi1gY3QbZe8Bf2extvvB60VxGmo3p7WSdP7DA8 hCJPSEEAdS3wcZHWqDzQRfgBBoOLS4W7x3ixIyv1kHgA6q2+FoTj0nx+CnV/GBDpExWM neA/ASdBZeN+O5gJn5nxcq8fIQojmilk9rKckfSPTKiXITJXlgo2K4vgVaOPYd2RcLGq YdZnRTU8EXcjKscB7DDpwwzcr+ql277zd5PDItUAPxkX5hD7Jbf3cKyedahvHc5KKqVr Okgw== X-Gm-Message-State: AOJu0YzX+0Hmf/HiwqpQTr8pfo8ZwskzOnTwlf2q+DKnDMyYwop4LYiR kBqYjX1Ojwb5SMvXWZsO3P0GuMj3AuraR005j+s+GXJaSwFG0yuCxh/P8AevDiA= X-Google-Smtp-Source: AGHT+IEMwW00lv5n9+UpT2TegQvsGdCLHhZBFtHnGVRb8dK4sf3Qm/foB9VXo773voPPdVvJwmSOWA== X-Received: by 2002:a05:600c:a29f:b0:425:5ea6:236 with SMTP id 5b1f17b1804b1-4255ea60371mr49980105e9.28.1719575184504; Fri, 28 Jun 2024 04:46:24 -0700 (PDT) Received: from srini-hackbase.lan ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af389b3sm32721345e9.1.2024.06.28.04.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 04:46:23 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Ekansh Gupta , stable , Dmitry Baryshkov , Srinivas Kandagatla Subject: [PATCH 6/6] misc: fastrpc: Restrict untrusted app to attach to privileged PD Date: Fri, 28 Jun 2024 12:45:01 +0100 Message-Id: <20240628114501.14310-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240628114501.14310-1-srinivas.kandagatla@linaro.org> References: <20240628114501.14310-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3465; i=srinivas.kandagatla@linaro.org; h=from:subject; bh=66mOb8nUCsQyE0p1sX3pHFEKCb+HnHXXgJMDva6n2lM=; b=owEBbQGS/pANAwAKAXqh/VnHNFU3AcsmYgBmfqI9c0ruHOvc/UCsq0lfLS4sC2pklJ3nRf7pS oZ1RnIphXSJATMEAAEKAB0WIQQi509axvzi9vce3Y16of1ZxzRVNwUCZn6iPQAKCRB6of1ZxzRV N7RuB/9s3KAL58mhGeKvZmwEFw9ARLDI5TjcZm/9TfvF/+cmakONiwO5fR+VXS+mjtvP5liL1PP 8mNsrFSAueH4R85cItifdu3WSClT+kkjYfS73PQz2t67hJ2rgooUq9FbM4ca/FkLnWYIi42o++5 qOZiDy1MvOvyWVuhgyllLGIvEdz9Et1Cq3dbdj/DRgloAtxUyEK9ts80Cghh4lmpuFqd6VhVsEL 1HFewxgtmMqXR/4WYY1hPXa39ljEO8Ud4iDAbHRcYm5bcSywO0WBHIKaJPtv4SPD/RuUXefAdHl wO+UESYFlF0u5TykgfimjIGAg0/9buRnM34GCRaCpBP9o+mm X-Developer-Key: i=srinivas.kandagatla@linaro.org; a=openpgp; fpr=ED6472765AB36EC43B3EF97AD77E3FC0562560D6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ekansh Gupta Untrusted application with access to only non-secure fastrpc device node can attach to root_pd or static PDs if it can make the respective init request. This can cause problems as the untrusted application can send bad requests to root_pd or static PDs. Add changes to reject attach to privileged PDs if the request is being made using non-secure fastrpc device node. Fixes: 0871561055e6 ("misc: fastrpc: Add support for audiopd") Cc: stable Signed-off-by: Ekansh Gupta Reviewed-by: Dmitry Baryshkov Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 22 +++++++++++++++++++--- include/uapi/misc/fastrpc.h | 3 +++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 5680856c0fb8..a7a2bcedb37e 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -2087,6 +2087,16 @@ static int fastrpc_req_mem_map(struct fastrpc_user *= fl, char __user *argp) return err; } =20 +static int is_attach_rejected(struct fastrpc_user *fl) +{ + /* Check if the device node is non-secure */ + if (!fl->is_secure_dev) { + dev_dbg(&fl->cctx->rpdev->dev, "untrusted app trying to attach to privil= eged DSP PD\n"); + return -EACCES; + } + return 0; +} + static long fastrpc_device_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { @@ -2099,13 +2109,19 @@ static long fastrpc_device_ioctl(struct file *file,= unsigned int cmd, err =3D fastrpc_invoke(fl, argp); break; case FASTRPC_IOCTL_INIT_ATTACH: - err =3D fastrpc_init_attach(fl, ROOT_PD); + err =3D is_attach_rejected(fl); + if (!err) + err =3D fastrpc_init_attach(fl, ROOT_PD); break; case FASTRPC_IOCTL_INIT_ATTACH_SNS: - err =3D fastrpc_init_attach(fl, SENSORS_PD); + err =3D is_attach_rejected(fl); + if (!err) + err =3D fastrpc_init_attach(fl, SENSORS_PD); break; case FASTRPC_IOCTL_INIT_CREATE_STATIC: - err =3D fastrpc_init_create_static_process(fl, argp); + err =3D is_attach_rejected(fl); + if (!err) + err =3D fastrpc_init_create_static_process(fl, argp); break; case FASTRPC_IOCTL_INIT_CREATE: err =3D fastrpc_init_create_process(fl, argp); diff --git a/include/uapi/misc/fastrpc.h b/include/uapi/misc/fastrpc.h index f33d914d8f46..91583690bddc 100644 --- a/include/uapi/misc/fastrpc.h +++ b/include/uapi/misc/fastrpc.h @@ -8,11 +8,14 @@ #define FASTRPC_IOCTL_ALLOC_DMA_BUFF _IOWR('R', 1, struct fastrpc_alloc_dm= a_buf) #define FASTRPC_IOCTL_FREE_DMA_BUFF _IOWR('R', 2, __u32) #define FASTRPC_IOCTL_INVOKE _IOWR('R', 3, struct fastrpc_invoke) +/* This ioctl is only supported with secure device nodes */ #define FASTRPC_IOCTL_INIT_ATTACH _IO('R', 4) #define FASTRPC_IOCTL_INIT_CREATE _IOWR('R', 5, struct fastrpc_init_create) #define FASTRPC_IOCTL_MMAP _IOWR('R', 6, struct fastrpc_req_mmap) #define FASTRPC_IOCTL_MUNMAP _IOWR('R', 7, struct fastrpc_req_munmap) +/* This ioctl is only supported with secure device nodes */ #define FASTRPC_IOCTL_INIT_ATTACH_SNS _IO('R', 8) +/* This ioctl is only supported with secure device nodes */ #define FASTRPC_IOCTL_INIT_CREATE_STATIC _IOWR('R', 9, struct fastrpc_init= _create_static) #define FASTRPC_IOCTL_MEM_MAP _IOWR('R', 10, struct fastrpc_mem_map) #define FASTRPC_IOCTL_MEM_UNMAP _IOWR('R', 11, struct fastrpc_mem_unmap) --=20 2.25.1