From: Yousef Alhouseen <alhouseenyousef@gmail.com>
To: Alexander Graf <graf@amazon.com>
Cc: The AWS Nitro Enclaves Team <aws-nitro-enclaves-devel@amazon.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org,
Yousef Alhouseen <alhouseenyousef@gmail.com>
Subject: [PATCH] virtio: nsm: fix raw ioctl copy error path
Date: Wed, 24 Jun 2026 19:35:01 +0200 [thread overview]
Message-ID: <20260624173501.4094-1-alhouseenyousef@gmail.com> (raw)
nsm_dev_ioctl() uses a common exit path which unlocks nsm->lock.
A failed copy_from_user() reaches that path before the mutex is locked.
Return -EFAULT directly for that pre-lock failure.
Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
---
drivers/misc/nsm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/misc/nsm.c b/drivers/misc/nsm.c
index ef7b32742..e39ff0071 100644
--- a/drivers/misc/nsm.c
+++ b/drivers/misc/nsm.c
@@ -365,9 +365,8 @@ static long nsm_dev_ioctl(struct file *file, unsigned int cmd,
return -EINVAL;
/* Copy user argument struct to kernel argument struct */
- r = -EFAULT;
if (copy_from_user(&raw, argp, _IOC_SIZE(cmd)))
- goto out;
+ return -EFAULT;
mutex_lock(&nsm->lock);
--
2.54.0
next reply other threads:[~2026-06-24 17:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 17:35 Yousef Alhouseen [this message]
2026-06-25 5:40 ` Arnd Bergmann
2026-07-17 11:14 ` Greg Kroah-Hartman
2026-07-18 12:20 ` Yousef Alhouseen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260624173501.4094-1-alhouseenyousef@gmail.com \
--to=alhouseenyousef@gmail.com \
--cc=arnd@arndb.de \
--cc=aws-nitro-enclaves-devel@amazon.com \
--cc=graf@amazon.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®