* [PATCH] staging: gasket: Check the return value of gasket_get_bar_index()
@ 2020-05-01 15:51 ` Oscar Carter
0 siblings, 0 replies; 6+ messages in thread
From: Oscar Carter @ 2020-05-01 15:51 UTC (permalink / raw)
To: Rob Springer, Todd Poynor, Ben Chan, Richard Yeh
Cc: Greg Kroah-Hartman, Simon Que, John Joseph, devel, linux-kernel,
Oscar Carter
Check the return value of gasket_get_bar_index function as it can return
a negative one (-EINVAL). If this happens, a negative index is used in
the "gasket_dev->bar_data" array.
Addresses-Coverity-ID: 1438542 ("Negative array index read")
Fixes: 9a69f5087ccc2 ("drivers/staging: Gasket driver framework + Apex driver")
Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
---
drivers/staging/gasket/gasket_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
index 8e0575fcb4c8..67325fbaf760 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -925,6 +925,10 @@ do_map_region(const struct gasket_dev *gasket_dev, struct vm_area_struct *vma,
gasket_get_bar_index(gasket_dev,
(vma->vm_pgoff << PAGE_SHIFT) +
driver_desc->legacy_mmap_address_offset);
+
+ if (bar_index < 0)
+ return DO_MAP_REGION_INVALID;
+
phys_base = gasket_dev->bar_data[bar_index].phys_base + phys_offset;
while (mapped_bytes < map_length) {
/*
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] staging: gasket: Check the return value of gasket_get_bar_index()
@ 2020-05-01 15:51 ` Oscar Carter
0 siblings, 0 replies; 6+ messages in thread
From: Oscar Carter @ 2020-05-01 15:51 UTC (permalink / raw)
To: Rob Springer, Todd Poynor, Ben Chan, Richard Yeh
Cc: devel, Oscar Carter, Greg Kroah-Hartman, John Joseph,
linux-kernel, Simon Que
Check the return value of gasket_get_bar_index function as it can return
a negative one (-EINVAL). If this happens, a negative index is used in
the "gasket_dev->bar_data" array.
Addresses-Coverity-ID: 1438542 ("Negative array index read")
Fixes: 9a69f5087ccc2 ("drivers/staging: Gasket driver framework + Apex driver")
Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
---
drivers/staging/gasket/gasket_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
index 8e0575fcb4c8..67325fbaf760 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -925,6 +925,10 @@ do_map_region(const struct gasket_dev *gasket_dev, struct vm_area_struct *vma,
gasket_get_bar_index(gasket_dev,
(vma->vm_pgoff << PAGE_SHIFT) +
driver_desc->legacy_mmap_address_offset);
+
+ if (bar_index < 0)
+ return DO_MAP_REGION_INVALID;
+
phys_base = gasket_dev->bar_data[bar_index].phys_base + phys_offset;
while (mapped_bytes < map_length) {
/*
--
2.20.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] staging: gasket: Check the return value of gasket_get_bar_index()
[not found] ` <CANJCoRvCUFkRuSSM0egkMuAd5+kzve4CWvhQ3KkppZBSM8PGkw@mail.gmail.com>
@ 2020-05-03 7:47 ` Greg Kroah-Hartman
0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2020-05-03 7:47 UTC (permalink / raw)
To: Richard Yeh
Cc: Rob Springer, Todd Poynor, Ben Chan, Oscar Carter, Simon Que,
John Joseph, devel, linux-kernel
On Sat, May 02, 2020 at 05:59:18PM -0400, Richard Yeh wrote:
> Hi, as a new maintainer, I thought I would try to handle this one.
Great, as a start:
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
A: No.
Q: Should I include quotations after my reply?
http://daringfireball.net/2007/07/on_top
> This patch looks good to me. This new check properly protects against using
> a negative return value from gasket_get_bar_index() to index into a
> pointer. The gasket_get_bar_index function is called in two other places
> (old lines 845 and 1044) and both other places check the bar_index return
> value for negative values and return error values.
>
> What is the next step in the process? How do I test the patch? Does Greg
> K-H take these patches directly, or is there something else I should do
> (looking at
> https://github.com/gregkh/presentation-linux-maintainer/blob/master/maintainer.pdf
> page
> 5: clone from
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git, ...)?
Just send a "Reviewed-by:" to the patch and I can take it from there.
Also, I strongly suggest going and talking to your co-maintainers for
exactly how to do this, normally at this point in the process you
already know this as it is usually an experienced developer doing the
maintaining.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] staging: gasket: Check the return value of gasket_get_bar_index()
@ 2020-05-03 7:47 ` Greg Kroah-Hartman
0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2020-05-03 7:47 UTC (permalink / raw)
To: Richard Yeh
Cc: devel, Oscar Carter, John Joseph, linux-kernel, Simon Que,
Rob Springer, Todd Poynor
On Sat, May 02, 2020 at 05:59:18PM -0400, Richard Yeh wrote:
> Hi, as a new maintainer, I thought I would try to handle this one.
Great, as a start:
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
A: No.
Q: Should I include quotations after my reply?
http://daringfireball.net/2007/07/on_top
> This patch looks good to me. This new check properly protects against using
> a negative return value from gasket_get_bar_index() to index into a
> pointer. The gasket_get_bar_index function is called in two other places
> (old lines 845 and 1044) and both other places check the bar_index return
> value for negative values and return error values.
>
> What is the next step in the process? How do I test the patch? Does Greg
> K-H take these patches directly, or is there something else I should do
> (looking at
> https://github.com/gregkh/presentation-linux-maintainer/blob/master/maintainer.pdf
> page
> 5: clone from
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git, ...)?
Just send a "Reviewed-by:" to the patch and I can take it from there.
Also, I strongly suggest going and talking to your co-maintainers for
exactly how to do this, normally at this point in the process you
already know this as it is usually an experienced developer doing the
maintaining.
thanks,
greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] staging: gasket: Check the return value of gasket_get_bar_index()
2020-05-01 15:51 ` Oscar Carter
@ 2020-05-04 17:49 ` Richard Yeh
-1 siblings, 0 replies; 6+ messages in thread
From: Richard Yeh @ 2020-05-04 17:49 UTC (permalink / raw)
To: Oscar Carter
Cc: Rob Springer, Todd Poynor, Ben Chan, Greg Kroah-Hartman,
Simon Que, John Joseph, devel, linux-kernel
On Fri, May 01, 2020 at 05:51:18PM +0200, Oscar Carter wrote:
> Check the return value of gasket_get_bar_index function as it can return
> a negative one (-EINVAL). If this happens, a negative index is used in
> the "gasket_dev->bar_data" array.
>
> Addresses-Coverity-ID: 1438542 ("Negative array index read")
> Fixes: 9a69f5087ccc2 ("drivers/staging: Gasket driver framework + Apex driver")
> Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
> ---
> drivers/staging/gasket/gasket_core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
> index 8e0575fcb4c8..67325fbaf760 100644
> --- a/drivers/staging/gasket/gasket_core.c
> +++ b/drivers/staging/gasket/gasket_core.c
> @@ -925,6 +925,10 @@ do_map_region(const struct gasket_dev *gasket_dev, struct vm_area_struct *vma,
> gasket_get_bar_index(gasket_dev,
> (vma->vm_pgoff << PAGE_SHIFT) +
> driver_desc->legacy_mmap_address_offset);
> +
> + if (bar_index < 0)
> + return DO_MAP_REGION_INVALID;
> +
> phys_base = gasket_dev->bar_data[bar_index].phys_base + phys_offset;
> while (mapped_bytes < map_length) {
> /*
> --
> 2.20.1
>
Reviewed-by: Richard Yeh <rcy@google.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] staging: gasket: Check the return value of gasket_get_bar_index()
@ 2020-05-04 17:49 ` Richard Yeh
0 siblings, 0 replies; 6+ messages in thread
From: Richard Yeh @ 2020-05-04 17:49 UTC (permalink / raw)
To: Oscar Carter
Cc: devel, Greg Kroah-Hartman, John Joseph, linux-kernel, Simon Que,
Rob Springer, Todd Poynor
On Fri, May 01, 2020 at 05:51:18PM +0200, Oscar Carter wrote:
> Check the return value of gasket_get_bar_index function as it can return
> a negative one (-EINVAL). If this happens, a negative index is used in
> the "gasket_dev->bar_data" array.
>
> Addresses-Coverity-ID: 1438542 ("Negative array index read")
> Fixes: 9a69f5087ccc2 ("drivers/staging: Gasket driver framework + Apex driver")
> Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
> ---
> drivers/staging/gasket/gasket_core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
> index 8e0575fcb4c8..67325fbaf760 100644
> --- a/drivers/staging/gasket/gasket_core.c
> +++ b/drivers/staging/gasket/gasket_core.c
> @@ -925,6 +925,10 @@ do_map_region(const struct gasket_dev *gasket_dev, struct vm_area_struct *vma,
> gasket_get_bar_index(gasket_dev,
> (vma->vm_pgoff << PAGE_SHIFT) +
> driver_desc->legacy_mmap_address_offset);
> +
> + if (bar_index < 0)
> + return DO_MAP_REGION_INVALID;
> +
> phys_base = gasket_dev->bar_data[bar_index].phys_base + phys_offset;
> while (mapped_bytes < map_length) {
> /*
> --
> 2.20.1
>
Reviewed-by: Richard Yeh <rcy@google.com>
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-05-04 17:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-01 15:51 [PATCH] staging: gasket: Check the return value of gasket_get_bar_index() Oscar Carter
2020-05-01 15:51 ` Oscar Carter
[not found] ` <CANJCoRvCUFkRuSSM0egkMuAd5+kzve4CWvhQ3KkppZBSM8PGkw@mail.gmail.com>
2020-05-03 7:47 ` Greg Kroah-Hartman
2020-05-03 7:47 ` Greg Kroah-Hartman
2020-05-04 17:49 ` Richard Yeh
2020-05-04 17:49 ` Richard Yeh
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.