* [PATCH] remoteproc: Fix count check in rproc_coredump_write()
@ 2022-01-19 23:21 Alistair Delva
2022-01-20 0:24 ` Bjorn Andersson
2022-02-08 3:28 ` Bjorn Andersson
0 siblings, 2 replies; 3+ messages in thread
From: Alistair Delva @ 2022-01-19 23:21 UTC (permalink / raw)
To: linux-kernel
Cc: Rishabh Bhatnagar, stable, Ohad Ben-Cohen, Bjorn Andersson,
Mathieu Poirier, Sibi Sankar, linux-remoteproc, kernel-team
Check count for 0, to avoid a potential underflow. Make the check the
same as the one in rproc_recovery_write().
Fixes: 3afdc59e4390 ("remoteproc: Add coredump debugfs entry")
Signed-off-by: Alistair Delva <adelva@google.com>
Cc: Rishabh Bhatnagar <rishabhb@codeaurora.org>
Cc: stable@vger.kernel.org
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Sibi Sankar <sibis@codeaurora.org>
Cc: linux-remoteproc@vger.kernel.org
Cc: kernel-team@android.com
---
drivers/remoteproc/remoteproc_debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c
index b5a1e3b697d9..581930483ef8 100644
--- a/drivers/remoteproc/remoteproc_debugfs.c
+++ b/drivers/remoteproc/remoteproc_debugfs.c
@@ -76,7 +76,7 @@ static ssize_t rproc_coredump_write(struct file *filp,
int ret, err = 0;
char buf[20];
- if (count > sizeof(buf))
+ if (count < 1 || count > sizeof(buf))
return -EINVAL;
ret = copy_from_user(buf, user_buf, count);
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] remoteproc: Fix count check in rproc_coredump_write()
2022-01-19 23:21 [PATCH] remoteproc: Fix count check in rproc_coredump_write() Alistair Delva
@ 2022-01-20 0:24 ` Bjorn Andersson
2022-02-08 3:28 ` Bjorn Andersson
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2022-01-20 0:24 UTC (permalink / raw)
To: Alistair Delva
Cc: linux-kernel, Rishabh Bhatnagar, stable, Ohad Ben-Cohen,
Mathieu Poirier, Sibi Sankar, linux-remoteproc, kernel-team
On Wed 19 Jan 15:21 PST 2022, Alistair Delva wrote:
> Check count for 0, to avoid a potential underflow. Make the check the
> same as the one in rproc_recovery_write().
>
> Fixes: 3afdc59e4390 ("remoteproc: Add coredump debugfs entry")
> Signed-off-by: Alistair Delva <adelva@google.com>
> Cc: Rishabh Bhatnagar <rishabhb@codeaurora.org>
> Cc: stable@vger.kernel.org
> Cc: Ohad Ben-Cohen <ohad@wizery.com>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: Sibi Sankar <sibis@codeaurora.org>
> Cc: linux-remoteproc@vger.kernel.org
> Cc: kernel-team@android.com
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Regards,
Bjorn
> ---
> drivers/remoteproc/remoteproc_debugfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c
> index b5a1e3b697d9..581930483ef8 100644
> --- a/drivers/remoteproc/remoteproc_debugfs.c
> +++ b/drivers/remoteproc/remoteproc_debugfs.c
> @@ -76,7 +76,7 @@ static ssize_t rproc_coredump_write(struct file *filp,
> int ret, err = 0;
> char buf[20];
>
> - if (count > sizeof(buf))
> + if (count < 1 || count > sizeof(buf))
> return -EINVAL;
>
> ret = copy_from_user(buf, user_buf, count);
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] remoteproc: Fix count check in rproc_coredump_write()
2022-01-19 23:21 [PATCH] remoteproc: Fix count check in rproc_coredump_write() Alistair Delva
2022-01-20 0:24 ` Bjorn Andersson
@ 2022-02-08 3:28 ` Bjorn Andersson
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2022-02-08 3:28 UTC (permalink / raw)
To: Alistair Delva, linux-kernel
Cc: linux-remoteproc, Ohad Ben-Cohen, Mathieu Poirier,
Rishabh Bhatnagar, stable, Sibi Sankar, kernel-team
On Wed, 19 Jan 2022 23:21:39 +0000, Alistair Delva wrote:
> Check count for 0, to avoid a potential underflow. Make the check the
> same as the one in rproc_recovery_write().
>
>
Applied, thanks!
[1/1] remoteproc: Fix count check in rproc_coredump_write()
commit: 09dc6efba9088a84ac00bd25be36c50d0a01a4df
Best regards,
--
Bjorn Andersson <bjorn.andersson@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-08 3:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 23:21 [PATCH] remoteproc: Fix count check in rproc_coredump_write() Alistair Delva
2022-01-20 0:24 ` Bjorn Andersson
2022-02-08 3:28 ` Bjorn Andersson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.