From: Aleksandr Mishin <amishin@t-argos.ru>
To: Martyn Welch <martyn.welch@gefanuc.com>
Cc: Aleksandr Mishin <amishin@t-argos.ru>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Soumya Negi <soumya.negi97@gmail.com>,
Michael Straube <straube.linux@gmail.com>,
<linux-kernel@vger.kernel.org>, <linux-staging@lists.linux.dev>,
<lvc-project@linuxtesting.org>
Subject: [PATCH] staging: vme_user: Validate geoid used for VME window address
Date: Fri, 21 Jun 2024 13:42:46 +0300 [thread overview]
Message-ID: <20240621104246.11292-1-amishin@t-argos.ru> (raw)
In tsi148_crcsr_init() value of vme_base used as 3rd parameter in
tsi148_master_set() call is calculated as 'vstat * 0x80000'. vstat value
can be set from module parameter "geoid" which can be any. In this case
the value of an arithmetic expression 'vstat * 0x80000' is a subject to
overflow because its operands are not cast to a larger data type before
performing arithmetic.
Add geoid validation to prevent overflow.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: d22b8ed9a3b0 ("Staging: vme: add Tundra TSI148 VME-PCI Bridge driver")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
---
drivers/staging/vme_user/vme_tsi148.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/vme_user/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c
index 2ec9c2904404..b601d2b20bed 100644
--- a/drivers/staging/vme_user/vme_tsi148.c
+++ b/drivers/staging/vme_user/vme_tsi148.c
@@ -2119,7 +2119,7 @@ static int tsi148_slot_get(struct vme_bridge *tsi148_bridge)
slot = ioread32be(bridge->base + TSI148_LCSR_VSTAT);
slot = slot & TSI148_LCSR_VSTAT_GA_M;
} else {
- slot = geoid;
+ slot = geoid & TSI148_LCSR_VSTAT_GA_M;
}
return (int)slot;
--
2.30.2
next reply other threads:[~2024-06-21 10:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 10:42 Aleksandr Mishin [this message]
2024-06-21 11:10 ` Dan Carpenter
2024-06-25 9:58 ` [PATCH v2] staging: vme_user: Validate geoid value " Aleksandr Mishin
2024-07-01 14:21 ` 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=20240621104246.11292-1-amishin@t-argos.ru \
--to=amishin@t-argos.ru \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=lvc-project@linuxtesting.org \
--cc=martyn.welch@gefanuc.com \
--cc=soumya.negi97@gmail.com \
--cc=straube.linux@gmail.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
all inboxes | Powered by JetHome®