From: Dan Carpenter <dan.carpenter@linaro.org>
To: Nuno Das Neves <nunodasneves@linux.microsoft.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
Anirudh Rayabharam <anrayabh@linux.microsoft.com>,
Praveen K Paladugu <prapal@linux.microsoft.com>,
Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH next] Drivers: hv: mshv: Prevent potential NULL dereference
Date: Fri, 21 Mar 2025 17:35:51 +0300 [thread overview]
Message-ID: <9fee7658-1981-48b1-b909-fb2b78894077@stanley.mountain> (raw)
Move the NULL check on "partition" before the dereference.
Fixes: f5288d14069b ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/hv/mshv_synic.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/hv/mshv_synic.c b/drivers/hv/mshv_synic.c
index a3daedd680ff..88949beb5e37 100644
--- a/drivers/hv/mshv_synic.c
+++ b/drivers/hv/mshv_synic.c
@@ -151,13 +151,12 @@ static bool mshv_async_call_completion_isr(struct hv_message *msg)
rcu_read_lock();
partition = mshv_partition_find(partition_id);
- partition->async_hypercall_status = async_msg->status;
-
if (unlikely(!partition)) {
pr_debug("failed to find partition %llu\n", partition_id);
goto unlock_out;
}
+ partition->async_hypercall_status = async_msg->status;
complete(&partition->async_hypercall);
handled = true;
--
2.47.2
next reply other threads:[~2025-03-21 14:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 14:35 Dan Carpenter [this message]
2025-03-21 16:53 ` [PATCH next] Drivers: hv: mshv: Prevent potential NULL dereference Nuno Das Neves
2025-03-21 18:24 ` Wei Liu
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=9fee7658-1981-48b1-b909-fb2b78894077@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=anrayabh@linux.microsoft.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nunodasneves@linux.microsoft.com \
--cc=prapal@linux.microsoft.com \
--cc=skinsburskii@linux.microsoft.com \
--cc=wei.liu@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