Message ID | 20210602073851.1005607-2-sudeep.holla@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [RESEND,1/2] firmware: arm_scpi: Add compatibility checks for shmem node | expand |
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Tested-by: Cristian Marussi <cristian.marussi@arm.com> Cristian On Wed, Jun 02, 2021 at 08:38:51AM +0100, Sudeep Holla wrote: > The shared memory node used for communication between the firmware and > the OS should be compatible with "arm,scmi-shmem". Add the check for the > same while parsing the node before fetching the memory regions. > > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Cristian Marussi <cristian.marussi@arm.com> > Cc: Florian Fainelli <f.fainelli@gmail.com> > Cc: Jim Quinlan <jim2101024@gmail.com> > Cc: Etienne Carriere <etienne.carriere@linaro.org> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> > --- > drivers/firmware/arm_scmi/mailbox.c | 3 +++ > drivers/firmware/arm_scmi/smc.c | 3 +++ > 2 files changed, 6 insertions(+) > > diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c > index 4626404be541..e3dcb58314ae 100644 > --- a/drivers/firmware/arm_scmi/mailbox.c > +++ b/drivers/firmware/arm_scmi/mailbox.c > @@ -69,6 +69,9 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, > return -ENOMEM; > > shmem = of_parse_phandle(cdev->of_node, "shmem", idx); > + if (!of_device_is_compatible(shmem, "arm,scmi-shmem")) > + return -ENXIO; > + > ret = of_address_to_resource(shmem, 0, &res); > of_node_put(shmem); > if (ret) { > diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c > index fcbe2677f84b..bed5596c7209 100644 > --- a/drivers/firmware/arm_scmi/smc.c > +++ b/drivers/firmware/arm_scmi/smc.c > @@ -76,6 +76,9 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, > return -ENOMEM; > > np = of_parse_phandle(cdev->of_node, "shmem", 0); > + if (!of_device_is_compatible(np, "arm,scmi-shmem")) > + return -ENXIO; > + > ret = of_address_to_resource(np, 0, &res); > of_node_put(np); > if (ret) { > -- > 2.25.1 >
On 6/2/2021 12:38 AM, Sudeep Holla wrote: > The shared memory node used for communication between the firmware and > the OS should be compatible with "arm,scmi-shmem". Add the check for the > same while parsing the node before fetching the memory regions. > > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Cristian Marussi <cristian.marussi@arm.com> > Cc: Florian Fainelli <f.fainelli@gmail.com> > Cc: Jim Quinlan <jim2101024@gmail.com> > Cc: Etienne Carriere <etienne.carriere@linaro.org> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Tested-by: Florian Fainelli <f.fainelli@gmail.com>
diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c index 4626404be541..e3dcb58314ae 100644 --- a/drivers/firmware/arm_scmi/mailbox.c +++ b/drivers/firmware/arm_scmi/mailbox.c @@ -69,6 +69,9 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, return -ENOMEM; shmem = of_parse_phandle(cdev->of_node, "shmem", idx); + if (!of_device_is_compatible(shmem, "arm,scmi-shmem")) + return -ENXIO; + ret = of_address_to_resource(shmem, 0, &res); of_node_put(shmem); if (ret) { diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c index fcbe2677f84b..bed5596c7209 100644 --- a/drivers/firmware/arm_scmi/smc.c +++ b/drivers/firmware/arm_scmi/smc.c @@ -76,6 +76,9 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, return -ENOMEM; np = of_parse_phandle(cdev->of_node, "shmem", 0); + if (!of_device_is_compatible(np, "arm,scmi-shmem")) + return -ENXIO; + ret = of_address_to_resource(np, 0, &res); of_node_put(np); if (ret) {
The shared memory node used for communication between the firmware and the OS should be compatible with "arm,scmi-shmem". Add the check for the same while parsing the node before fetching the memory regions. Cc: Rob Herring <robh+dt@kernel.org> Cc: Cristian Marussi <cristian.marussi@arm.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Jim Quinlan <jim2101024@gmail.com> Cc: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> --- drivers/firmware/arm_scmi/mailbox.c | 3 +++ drivers/firmware/arm_scmi/smc.c | 3 +++ 2 files changed, 6 insertions(+)