[PATCH] drivers/base: cacheinfo: validate device node for all the caches
Sudeep Holla
sudeep.holla at arm.com
Mon Feb 23 07:45:06 PST 2015
On 23/02/15 15:14, Mark Rutland wrote:
> On Mon, Feb 16, 2015 at 02:10:16PM +0000, Sudeep Holla wrote:
>> On architectures that depend on DT for obtaining cache hierarcy, we need
>> to validate the device node for all the cache indices, failing to do so
>> might result in wrong information being exposed to the userspace.
>>
>> This is quite possible on initial/incomplete versions of the device
>> trees. In such cases, it's better to bail out if all the required device
>> nodes are not present.
>>
>> This patch adds checks for the validation of device node for all the
>> caches and doesn't initialise the cacheinfo if there's any error.
>>
>> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
>> Reported-by: Mark Rutland <mark.rutland at arm.com>
>> Signed-off-by: Sudeep Holla <sudeep.holla at arm.com>
>> ---
>> drivers/base/cacheinfo.c | 12 ++++++++++--
>> 1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
>> index 6e64563361f0..7015bf05c828 100644
>> --- a/drivers/base/cacheinfo.c
>> +++ b/drivers/base/cacheinfo.c
[...]
>> @@ -189,8 +195,10 @@ static int detect_cache_attributes(unsigned int cpu)
>> * will be set up here only if they are not populated already
>> */
>> ret = cache_shared_cpu_map_setup(cpu);
>> - if (ret)
>> + if (ret) {
>> + pr_err("failed to setup cache hierarcy from DT\n");
>
> It would probably be better if this were something like:
>
> pr_warn("Unable to detect cache hierarcy from DT for CPU %d\n",
> cpu);
>
Agreed, will update and send v2.
> Otherwise, this looks sane to me, and it would be nice to have this in
> ASAP so as to avoid exposing erroneous information to userspace. So:
>
> Acked-by: Mark Rutland <mark.rutland at arm.com>
>
Thanks.
Regards,
Sudeep
More information about the linux-arm-kernel
mailing list