* [PATCH] ACPI/IORT: Fix iort_get_platform_device_domain() uninitialized pointer value
@ 2018-11-29 9:55 ` Lorenzo Pieralisi
0 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Pieralisi @ 2018-11-29 9:55 UTC (permalink / raw)
To: linux-arm-kernel, linux-acpi
Cc: Rafael J. Wysocki, Lorenzo Pieralisi, Catalin Marinas,
Will Deacon, Patrick Bellasi, Hanjun Guo, Sudeep Holla
Running the Clang static analyzer on IORT code detected the following
error:
Logic error: Branch condition evaluates to a garbage value
in
iort_get_platform_device_domain()
If the named component associated with a given device has no IORT
mappings, iort_get_platform_device_domain() exits its MSI mapping loop
with msi_parent pointer containing garbage, which can lead to erroneous
code path execution.
Initialize the msi_parent pointer, fixing the bug.
Fixes: d4f54a186667 ("ACPI: platform: setup MSI domain for ACPI based
platform device")
Reported-by: Patrick Bellasi <patrick.bellasi@arm.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Hanjun Guo <hanjun.guo@linaro.org>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
---
drivers/acpi/arm64/iort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 2a361e22d38d..70f4e80b9246 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -700,7 +700,7 @@ static void iort_set_device_domain(struct device *dev,
*/
static struct irq_domain *iort_get_platform_device_domain(struct device *dev)
{
- struct acpi_iort_node *node, *msi_parent;
+ struct acpi_iort_node *node, *msi_parent = NULL;
struct fwnode_handle *iort_fwnode;
struct acpi_iort_its_group *its;
int i;
--
2.19.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] ACPI/IORT: Fix iort_get_platform_device_domain() uninitialized pointer value
@ 2018-11-29 9:55 ` Lorenzo Pieralisi
0 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Pieralisi @ 2018-11-29 9:55 UTC (permalink / raw)
To: linux-arm-kernel
Running the Clang static analyzer on IORT code detected the following
error:
Logic error: Branch condition evaluates to a garbage value
in
iort_get_platform_device_domain()
If the named component associated with a given device has no IORT
mappings, iort_get_platform_device_domain() exits its MSI mapping loop
with msi_parent pointer containing garbage, which can lead to erroneous
code path execution.
Initialize the msi_parent pointer, fixing the bug.
Fixes: d4f54a186667 ("ACPI: platform: setup MSI domain for ACPI based
platform device")
Reported-by: Patrick Bellasi <patrick.bellasi@arm.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Hanjun Guo <hanjun.guo@linaro.org>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
---
drivers/acpi/arm64/iort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 2a361e22d38d..70f4e80b9246 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -700,7 +700,7 @@ static void iort_set_device_domain(struct device *dev,
*/
static struct irq_domain *iort_get_platform_device_domain(struct device *dev)
{
- struct acpi_iort_node *node, *msi_parent;
+ struct acpi_iort_node *node, *msi_parent = NULL;
struct fwnode_handle *iort_fwnode;
struct acpi_iort_its_group *its;
int i;
--
2.19.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ACPI/IORT: Fix iort_get_platform_device_domain() uninitialized pointer value
2018-11-29 9:55 ` Lorenzo Pieralisi
(?)
@ 2018-11-29 11:34 ` Hanjun Guo
2018-11-29 16:49 ` Lorenzo Pieralisi
-1 siblings, 1 reply; 7+ messages in thread
From: Hanjun Guo @ 2018-11-29 11:34 UTC (permalink / raw)
To: Lorenzo Pieralisi, linux-arm-kernel, linux-acpi
Cc: Catalin Marinas, Rafael J. Wysocki, Will Deacon, Patrick Bellasi,
Hanjun Guo, Sudeep Holla
On 2018/11/29 17:55, Lorenzo Pieralisi wrote:
> Running the Clang static analyzer on IORT code detected the following
> error:
>
> Logic error: Branch condition evaluates to a garbage value
>
> in
>
> iort_get_platform_device_domain()
>
> If the named component associated with a given device has no IORT
> mappings, iort_get_platform_device_domain() exits its MSI mapping loop
> with msi_parent pointer containing garbage, which can lead to erroneous
> code path execution.
Not sure if we have such use cases that named component associated with
a given device has no IORT mappings, but this patch still make sense to
me,
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Thanks
Hanjun
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ACPI/IORT: Fix iort_get_platform_device_domain() uninitialized pointer value
2018-11-29 11:34 ` Hanjun Guo
@ 2018-11-29 16:49 ` Lorenzo Pieralisi
0 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Pieralisi @ 2018-11-29 16:49 UTC (permalink / raw)
To: Hanjun Guo
Cc: Rafael J. Wysocki, Catalin Marinas, Will Deacon, Patrick Bellasi,
linux-acpi, Hanjun Guo, Sudeep Holla, linux-arm-kernel
On Thu, Nov 29, 2018 at 07:34:40PM +0800, Hanjun Guo wrote:
> On 2018/11/29 17:55, Lorenzo Pieralisi wrote:
> > Running the Clang static analyzer on IORT code detected the following
> > error:
> >
> > Logic error: Branch condition evaluates to a garbage value
> >
> > in
> >
> > iort_get_platform_device_domain()
> >
> > If the named component associated with a given device has no IORT
> > mappings, iort_get_platform_device_domain() exits its MSI mapping loop
> > with msi_parent pointer containing garbage, which can lead to erroneous
> > code path execution.
>
> Not sure if we have such use cases that named component associated with
> a given device has no IORT mappings, but this patch still make sense to
> me,
Yes, it is to make the kernel more robust against questionable (but valid)
firmware bindings.
Thanks,
Lorenzo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ACPI/IORT: Fix iort_get_platform_device_domain() uninitialized pointer value
@ 2018-11-29 16:49 ` Lorenzo Pieralisi
0 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Pieralisi @ 2018-11-29 16:49 UTC (permalink / raw)
To: Hanjun Guo
Cc: Rafael J. Wysocki, Catalin Marinas, Will Deacon, Patrick Bellasi,
linux-acpi, Hanjun Guo, Sudeep Holla, linux-arm-kernel
On Thu, Nov 29, 2018 at 07:34:40PM +0800, Hanjun Guo wrote:
> On 2018/11/29 17:55, Lorenzo Pieralisi wrote:
> > Running the Clang static analyzer on IORT code detected the following
> > error:
> >
> > Logic error: Branch condition evaluates to a garbage value
> >
> > in
> >
> > iort_get_platform_device_domain()
> >
> > If the named component associated with a given device has no IORT
> > mappings, iort_get_platform_device_domain() exits its MSI mapping loop
> > with msi_parent pointer containing garbage, which can lead to erroneous
> > code path execution.
>
> Not sure if we have such use cases that named component associated with
> a given device has no IORT mappings, but this patch still make sense to
> me,
Yes, it is to make the kernel more robust against questionable (but valid)
firmware bindings.
Thanks,
Lorenzo
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ACPI/IORT: Fix iort_get_platform_device_domain() uninitialized pointer value
2018-11-29 9:55 ` Lorenzo Pieralisi
@ 2018-11-30 13:21 ` Will Deacon
-1 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2018-11-30 13:21 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Catalin Marinas, Rafael J. Wysocki, Patrick Bellasi, linux-acpi,
Hanjun Guo, Sudeep Holla, linux-arm-kernel
On Thu, Nov 29, 2018 at 09:55:59AM +0000, Lorenzo Pieralisi wrote:
> Running the Clang static analyzer on IORT code detected the following
> error:
>
> Logic error: Branch condition evaluates to a garbage value
>
> in
>
> iort_get_platform_device_domain()
>
> If the named component associated with a given device has no IORT
> mappings, iort_get_platform_device_domain() exits its MSI mapping loop
> with msi_parent pointer containing garbage, which can lead to erroneous
> code path execution.
>
> Initialize the msi_parent pointer, fixing the bug.
>
> Fixes: d4f54a186667 ("ACPI: platform: setup MSI domain for ACPI based
> platform device")
> Reported-by: Patrick Bellasi <patrick.bellasi@arm.com>
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Hanjun Guo <hanjun.guo@linaro.org>
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> ---
> drivers/acpi/arm64/iort.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Will Deacon <will.deacon@arm.com>
Looks like one for 4.20.
Will
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index 2a361e22d38d..70f4e80b9246 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -700,7 +700,7 @@ static void iort_set_device_domain(struct device *dev,
> */
> static struct irq_domain *iort_get_platform_device_domain(struct device *dev)
> {
> - struct acpi_iort_node *node, *msi_parent;
> + struct acpi_iort_node *node, *msi_parent = NULL;
> struct fwnode_handle *iort_fwnode;
> struct acpi_iort_its_group *its;
> int i;
> --
> 2.19.2
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ACPI/IORT: Fix iort_get_platform_device_domain() uninitialized pointer value
@ 2018-11-30 13:21 ` Will Deacon
0 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2018-11-30 13:21 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Catalin Marinas, Rafael J. Wysocki, Patrick Bellasi, linux-acpi,
Hanjun Guo, Sudeep Holla, linux-arm-kernel
On Thu, Nov 29, 2018 at 09:55:59AM +0000, Lorenzo Pieralisi wrote:
> Running the Clang static analyzer on IORT code detected the following
> error:
>
> Logic error: Branch condition evaluates to a garbage value
>
> in
>
> iort_get_platform_device_domain()
>
> If the named component associated with a given device has no IORT
> mappings, iort_get_platform_device_domain() exits its MSI mapping loop
> with msi_parent pointer containing garbage, which can lead to erroneous
> code path execution.
>
> Initialize the msi_parent pointer, fixing the bug.
>
> Fixes: d4f54a186667 ("ACPI: platform: setup MSI domain for ACPI based
> platform device")
> Reported-by: Patrick Bellasi <patrick.bellasi@arm.com>
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Hanjun Guo <hanjun.guo@linaro.org>
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> ---
> drivers/acpi/arm64/iort.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Will Deacon <will.deacon@arm.com>
Looks like one for 4.20.
Will
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index 2a361e22d38d..70f4e80b9246 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -700,7 +700,7 @@ static void iort_set_device_domain(struct device *dev,
> */
> static struct irq_domain *iort_get_platform_device_domain(struct device *dev)
> {
> - struct acpi_iort_node *node, *msi_parent;
> + struct acpi_iort_node *node, *msi_parent = NULL;
> struct fwnode_handle *iort_fwnode;
> struct acpi_iort_its_group *its;
> int i;
> --
> 2.19.2
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-11-30 13:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 9:55 [PATCH] ACPI/IORT: Fix iort_get_platform_device_domain() uninitialized pointer value Lorenzo Pieralisi
2018-11-29 9:55 ` Lorenzo Pieralisi
2018-11-29 11:34 ` Hanjun Guo
2018-11-29 16:49 ` Lorenzo Pieralisi
2018-11-29 16:49 ` Lorenzo Pieralisi
2018-11-30 13:21 ` Will Deacon
2018-11-30 13:21 ` Will Deacon
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.