msr-safe
msr-safe copied to clipboard
copy/paste bug checking X86_FEATURE_MSR on msr_batch open
Similar to #117 msr_open()
in msr_batch.c
assumes the minor device number is a cpu and checks if msrs are supported on that cpu. This has been working inadvertently until now.
This is separate from #117 in that we may well want to do a X86_FEATURE_MSR check, but it needs to be moved into where we parse the msr_batch_op array.
Here's the code.
static int msrbatch_open(struct inode *inode, struct file *file)
{
unsigned int cpu;
struct cpuinfo_x86 *c;
cpu = iminor(file->f_path.dentry->d_inode);
...
c = &cpu_data(cpu);
if (!cpu_has(c, X86_FEATURE_MSR))
{
pr_debug("cpu #%u does not have MSR feature.\n", cpu);
return -EIO; // MSR not supported
}