]> git.baikalelectronics.ru Git - kernel.git/commit
x86/intel_rdt: Return error for incorrect resource names in schemata
authorVikas Shivappa <vikas.shivappa@linux.intel.com>
Wed, 19 Apr 2017 23:50:04 +0000 (16:50 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 20 Apr 2017 13:57:59 +0000 (15:57 +0200)
commita2b72623fb35a34076314ba367870e3cb21577b9
tree492d523c4e644e22fbca5cc6ea93734d33881c8e
parente30119387c3ddea3e909af5db7b6e717dcb137e5
x86/intel_rdt: Return error for incorrect resource names in schemata

When schemata parses the resource names it does not return an error if it
detects incorrect resource names and fails quietly.

This happens because for_each_enabled_rdt_resource(r) leaves "r" pointing
beyond the end of the rdt_resources_all[] array, and the check for !r->name
results in an out of bounds access.

Split the resource parsing part into a helper function to avoid the issue.

[ tglx: Made it readable by splitting the parser loop out into a function ]

Reported-by: Prakhya, Sai Praneeth <sai.praneeth.prakhya@intel.com>
Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com>
Tested-by: Prakhya, Sai Praneeth <sai.praneeth.prakhya@intel.com>
Cc: fenghua.yu@intel.com
Cc: tony.luck@intel.com
Cc: ravi.v.shankar@intel.com
Cc: vikas.shivappa@intel.com
Link: http://lkml.kernel.org/r/1492645804-17465-4-git-send-email-vikas.shivappa@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/cpu/intel_rdt_schemata.c