Skip to content

Commit 8560b27

Browse files
sumachidanandij-intel
authored andcommitted
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>
1 parent 996b318 commit 8560b27

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • drivers/platform/x86/amd/hsmp

drivers/platform/x86/amd/hsmp/hsmp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,15 @@ long hsmp_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
262262
* Execute only set/configure commands
263263
*/
264264
if (hsmp_msg_desc_table[msg.msg_id].type != HSMP_SET)
265-
return -EINVAL;
265+
return -EPERM;
266266
break;
267267
case FMODE_READ:
268268
/*
269269
* Device is opened in O_RDONLY mode
270270
* Execute only get/monitor commands
271271
*/
272272
if (hsmp_msg_desc_table[msg.msg_id].type != HSMP_GET)
273-
return -EINVAL;
273+
return -EPERM;
274274
break;
275275
case FMODE_READ | FMODE_WRITE:
276276
/*
@@ -279,7 +279,7 @@ long hsmp_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
279279
*/
280280
break;
281281
default:
282-
return -EINVAL;
282+
return -EPERM;
283283
}
284284

285285
ret = hsmp_send_message(&msg);

0 commit comments

Comments
 (0)