projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9b1cd82
)
wifi: mwifiex: handle possible sscanf() errors
author
Dmitry Antipov
<dmantipov@yandex.ru>
Wed, 2 Aug 2023 16:07:17 +0000
(19:07 +0300)
committer
Kalle Valo
<kvalo@kernel.org>
Mon, 21 Aug 2023 15:56:27 +0000
(18:56 +0300)
Return -EINVAL on possible 'sscanf()' errors in
'mwifiex_regrdwr_write()' and 'mwifiex_rdeeprom_write()'.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link:
https://lore.kernel.org/r/20230802160726.85545-3-dmantipov@yandex.ru
drivers/net/wireless/marvell/mwifiex/debugfs.c
patch
|
blob
|
history
diff --git
a/drivers/net/wireless/marvell/mwifiex/debugfs.c
b/drivers/net/wireless/marvell/mwifiex/debugfs.c
index 0cdd6c50c1c0881d124d9e5a8d2149d6ca655e82..f9c9fec7c792a39cc1db52bc8a0db461aff60ff4 100644
(file)
--- a/
drivers/net/wireless/marvell/mwifiex/debugfs.c
+++ b/
drivers/net/wireless/marvell/mwifiex/debugfs.c
@@
-425,7
+425,10
@@
mwifiex_regrdwr_write(struct file *file,
if (IS_ERR(buf))
return PTR_ERR(buf);
- sscanf(buf, "%u %x %x", ®_type, ®_offset, ®_value);
+ if (sscanf(buf, "%u %x %x", ®_type, ®_offset, ®_value) != 3) {
+ ret = -EINVAL;
+ goto done;
+ }
if (reg_type == 0 || reg_offset == 0) {
ret = -EINVAL;
@@
-691,7
+694,10
@@
mwifiex_rdeeprom_write(struct file *file,
if (IS_ERR(buf))
return PTR_ERR(buf);
- sscanf(buf, "%d %d", &offset, &bytes);
+ if (sscanf(buf, "%d %d", &offset, &bytes) != 2) {
+ ret = -EINVAL;
+ goto done;
+ }
if (offset == -1 || bytes == -1) {
ret = -EINVAL;