From: Dan Carpenter <error27@gmail.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>,
nvdimm@lists.linux.dev, linux-acpi@vger.kernel.org,
kernel-janitors@vger.kernel.org,
cip-dev <cip-dev@lists.cip-project.org>,
Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Subject: [PATCH v2] ACPI: NFIT: prevent underflow in acpi_nfit_ctl()
Date: Thu, 19 Jan 2023 18:09:54 +0300 [thread overview]
Message-ID: <Y8ldQn1v4r5i5WLX@kadam> (raw)
The concern here would be that "family" is negative and we pass a
negative value to test_bit() resulting in an out of bounds read
and potentially a crash.
This patch is based on static analysis and not on testing.
Fixes: 9a7e3d7f0568 ("ACPI: NFIT: Fix input validation of bus-family")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
v2: add missing close parens ) in subject
drivers/acpi/nfit/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index f1cc5ec6a3b6..da0739f04c98 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -446,10 +446,10 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
const char *cmd_name, *dimm_name;
unsigned long cmd_mask, dsm_mask;
u32 offset, fw_status = 0;
+ unsigned int family = 0;
acpi_handle handle;
const guid_t *guid;
int func, rc, i;
- int family = 0;
if (cmd_rc)
*cmd_rc = -EINVAL;
--
2.35.1
next reply other threads:[~2023-01-19 15:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-19 15:09 Dan Carpenter [this message]
2023-01-19 16:21 ` [PATCH v2] ACPI: NFIT: prevent underflow in acpi_nfit_ctl() Jeff Moyer
2023-01-20 5:22 ` Dan Carpenter
2023-03-28 14:55 ` Dan Carpenter
2023-03-28 14:57 ` Dan Carpenter
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=Y8ldQn1v4r5i5WLX@kadam \
--to=error27@gmail.com \
--cc=cip-dev@lists.cip-project.org \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=harshit.m.mogalapalli@oracle.com \
--cc=ira.weiny@intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=rafael@kernel.org \
--cc=vishal.l.verma@intel.com \
/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