From: Suma Hegde Date: Tue, 12 Nov 2024 12:04:50 +0000 (+0000) Subject: platform/x86/amd/hsmp: Change the error type X-Git-Tag: v6.13-rc1~147^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8560b2775a08bf511576a18922c3bde920e69494;p=thirdparty%2Fkernel%2Flinux.git 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 Reviewed-by: Naveen Krishna Chatradhi Link: https://lore.kernel.org/r/20241112120450.2407125-2-suma.hegde@amd.com Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen --- diff --git a/drivers/platform/x86/amd/hsmp/hsmp.c b/drivers/platform/x86/amd/hsmp/hsmp.c index ce91b2cefca2c..f29dd93fbf0b4 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);