Commit e73d4376 authored by Al Viro's avatar Al Viro

convert sgx_set_attribute() to fdget()/fdput()

Reviewed-by: default avatarChristian Brauner <brauner@kernel.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 281117cc
...@@ -892,20 +892,19 @@ static struct miscdevice sgx_dev_provision = { ...@@ -892,20 +892,19 @@ static struct miscdevice sgx_dev_provision = {
int sgx_set_attribute(unsigned long *allowed_attributes, int sgx_set_attribute(unsigned long *allowed_attributes,
unsigned int attribute_fd) unsigned int attribute_fd)
{ {
struct file *file; struct fd f = fdget(attribute_fd);
file = fget(attribute_fd); if (!f.file)
if (!file)
return -EINVAL; return -EINVAL;
if (file->f_op != &sgx_provision_fops) { if (f.file->f_op != &sgx_provision_fops) {
fput(file); fdput(f);
return -EINVAL; return -EINVAL;
} }
*allowed_attributes |= SGX_ATTR_PROVISIONKEY; *allowed_attributes |= SGX_ATTR_PROVISIONKEY;
fput(file); fdput(f);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(sgx_set_attribute); EXPORT_SYMBOL_GPL(sgx_set_attribute);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment