diff options
author | Suma Hegde <suma.hegde@amd.com> | 2024-11-12 15:04:50 +0300 |
---|---|---|
committer | Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> | 2024-11-13 16:36:33 +0300 |
commit | 8560b2775a08bf511576a18922c3bde920e69494 (patch) | |
tree | 2494c3386c7e4faed8f2c7dd6ba77e27405ceb0f /drivers/platform/x86/amd | |
parent | 996b318e6fce255035efd555837d1250433bb0e7 (diff) | |
download | linux-8560b2775a08bf511576a18922c3bde920e69494.tar.xz |
platform/x86/amd/hsmp: Change the error type
When file is opened in WRITE only mode, then GET messages are not allowed
and when file is opened in READ only mode, SET messages are not allowed.
In these scenerios, return error EPERM to userspace instead of EINVAL.
Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20241112120450.2407125-2-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/amd')
-rw-r--r-- | drivers/platform/x86/amd/hsmp/hsmp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/platform/x86/amd/hsmp/hsmp.c b/drivers/platform/x86/amd/hsmp/hsmp.c index ce91b2cefca2..f29dd93fbf0b 100644 --- a/drivers/platform/x86/amd/hsmp/hsmp.c +++ b/drivers/platform/x86/amd/hsmp/hsmp.c @@ -262,7 +262,7 @@ long hsmp_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) * Execute only set/configure commands */ if (hsmp_msg_desc_table[msg.msg_id].type != HSMP_SET) - return -EINVAL; + return -EPERM; break; case FMODE_READ: /* @@ -270,7 +270,7 @@ long hsmp_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) * Execute only get/monitor commands */ if (hsmp_msg_desc_table[msg.msg_id].type != HSMP_GET) - return -EINVAL; + return -EPERM; break; case FMODE_READ | FMODE_WRITE: /* @@ -279,7 +279,7 @@ long hsmp_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) */ break; default: - return -EINVAL; + return -EPERM; } ret = hsmp_send_message(&msg); |