Compare commits
180 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8df5312a77 | ||
|
|
7cbbab7246 | ||
|
|
28a85b8c2b | ||
|
|
3a8cfabe0c | ||
|
|
9cdc02be88 | ||
|
|
5625f5bc36 | ||
|
|
d94c59f7eb | ||
|
|
ac56d25361 | ||
|
|
5d01d05608 | ||
|
|
edda06c7b4 | ||
|
|
27677af27c | ||
|
|
6d94a6eca4 | ||
|
|
3d771602e9 | ||
|
|
910ac641cc | ||
|
|
e6bcfdfdba | ||
|
|
bf78cd3514 | ||
|
|
f402571b49 | ||
|
|
1da8cc1bbc | ||
|
|
1238a22316 | ||
|
|
8e89e1c337 | ||
|
|
fec2888ae5 | ||
|
|
3ad44fcd12 | ||
|
|
b8336ebab9 | ||
|
|
0c25ece262 | ||
|
|
2628ec9b37 | ||
|
|
95dc2f5257 | ||
|
|
3667693830 | ||
|
|
5af87620af | ||
|
|
f9ffdf8825 | ||
|
|
35e9edc3df | ||
|
|
b18e3eae94 | ||
|
|
dd79314de4 | ||
|
|
f4b3c35e03 | ||
|
|
526c1dd7ff | ||
|
|
7bd437cc9f | ||
|
|
2ba95d287e | ||
|
|
030fe10a41 | ||
|
|
8ae74cca9a | ||
|
|
2dcf46b079 | ||
|
|
0f07496f52 | ||
|
|
1f8d9f70c2 | ||
|
|
d37f8a60f0 | ||
|
|
d6bbfc8b52 | ||
|
|
b98bfd4e9b | ||
|
|
b20a95f181 | ||
|
|
ff6c312000 | ||
|
|
aba01f7350 | ||
|
|
2ed25124f6 | ||
|
|
6b1f2e6058 | ||
|
|
7b3ada8c6d | ||
|
|
e1d4612e0a | ||
|
|
401fe1a599 | ||
|
|
6ee6496d07 | ||
|
|
a7e915975f | ||
|
|
8e2201ea50 | ||
|
|
183e9843e1 | ||
|
|
a9eebf69f3 | ||
|
|
b9daff610e | ||
|
|
488751e1e5 | ||
|
|
b37a1e428a | ||
|
|
d3af501317 | ||
|
|
15d73a26b6 | ||
|
|
7b49c0b48a | ||
|
|
5faccaf025 | ||
|
|
2a9c2c0721 | ||
|
|
d5118bb511 | ||
|
|
1a30fe1621 | ||
|
|
b65550e0db | ||
|
|
77063bb76e | ||
|
|
b076243426 | ||
|
|
cffd5aeb69 | ||
|
|
7ebc51a57f | ||
|
|
f77708d4a5 | ||
|
|
2051edf381 | ||
|
|
1f0679f54d | ||
|
|
82c8170cd0 | ||
|
|
489fc23535 | ||
|
|
027950fc78 | ||
|
|
ad01cb514d | ||
|
|
c3c6cc95ee | ||
|
|
10c04b4ca3 | ||
|
|
983125007e | ||
|
|
302170d383 | ||
|
|
3ef8465cb8 | ||
|
|
08ad7a314d | ||
|
|
e38f355569 | ||
|
|
4c14dbf5db | ||
|
|
e884357fa9 | ||
|
|
c3bd1321de | ||
|
|
82fbd85747 | ||
|
|
4c1779ac2c | ||
|
|
cd262f59cb | ||
|
|
ed3c3048b8 | ||
|
|
fafe99b62d | ||
|
|
bfee12cec6 | ||
|
|
cc78f934a9 | ||
|
|
05062462f1 | ||
|
|
6b10354b3c | ||
|
|
4eba86820f | ||
|
|
c236071859 | ||
|
|
6bfde67581 | ||
|
|
1b5c116233 | ||
|
|
ca47026b7d | ||
|
|
cc0a54e332 | ||
|
|
ebafb746f0 | ||
|
|
0591348b3d | ||
|
|
f51d1c3b7c | ||
|
|
153a044c95 | ||
|
|
c15a039e62 | ||
|
|
02f9582e89 | ||
|
|
04474c7d22 | ||
|
|
99ab40c842 | ||
|
|
3a3ca3230f | ||
|
|
5c7225c26b | ||
|
|
8441794f9a | ||
|
|
a634830004 | ||
|
|
7c42a9b6b1 | ||
|
|
891bba8f77 | ||
|
|
ab9d1bf608 | ||
|
|
46c2674225 | ||
|
|
8004e3f2c6 | ||
|
|
d81a8a3e29 | ||
|
|
e1b62c85f5 | ||
|
|
8c6668f088 | ||
|
|
455ae024d5 | ||
|
|
b1eeb5dd2a | ||
|
|
b72b37d6ff | ||
|
|
471baf3f74 | ||
|
|
336aaedc9c | ||
|
|
e838957ad9 | ||
|
|
6b128326df | ||
|
|
97e9be4e3a | ||
|
|
85c4d374c2 | ||
|
|
83ce31d3d8 | ||
|
|
c280710d7a | ||
|
|
27dddb67c0 | ||
|
|
8623b58c1d | ||
|
|
e242125d71 | ||
|
|
84b74bcb0d | ||
|
|
66ba44c9ec | ||
|
|
b901563611 | ||
|
|
2152722bd3 | ||
|
|
c3337e8f48 | ||
|
|
d08a63770c | ||
|
|
022f3898b1 | ||
|
|
5d92949019 | ||
|
|
361b555672 | ||
|
|
1cbde3eb9c | ||
|
|
bd3b8480ab | ||
|
|
2777947a75 | ||
|
|
7863a8f302 | ||
|
|
daed78ab55 | ||
|
|
8f6debf633 | ||
|
|
72ddeffc09 | ||
|
|
70b73f6470 | ||
|
|
6e2e5d1bf8 | ||
|
|
f6f916b3e5 | ||
|
|
0e85ace840 | ||
|
|
45fefa0459 | ||
|
|
b0d99e32db | ||
|
|
22fe68643f | ||
|
|
2219b0258d | ||
|
|
0a9147be6a | ||
|
|
b9e685eed5 | ||
|
|
8179ac3dc1 | ||
|
|
6962c1e495 | ||
|
|
e6a7eacfea | ||
|
|
f65330d27d | ||
|
|
ab6addc95d | ||
|
|
f503bc3d25 | ||
|
|
506bfaa126 | ||
|
|
c89437e398 | ||
|
|
ea8f7d74ba | ||
|
|
79fd7593a2 | ||
|
|
3d3a933315 | ||
|
|
862a885103 | ||
|
|
05c858ff6a | ||
|
|
c1d19b37d5 | ||
|
|
dfd8c3bfdc | ||
|
|
69bc68b46b |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,6 +16,7 @@
|
||||
/overlay
|
||||
/package/feeds
|
||||
/package/openwrt-packages
|
||||
/*.patch
|
||||
key-build*
|
||||
*.orig
|
||||
*.rej
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
src-git packages https://git.openwrt.org/feed/packages.git^340d5ce71ee60c1d699e7e0ead9422bed6f8519f
|
||||
src-git luci https://git.openwrt.org/project/luci.git^bc17ef673f734ea8e7e696ba5735588da9111dcd
|
||||
src-git routing https://git.openwrt.org/feed/routing.git^c52779c05a4cf838c736327d8b042ee59f782331
|
||||
src-git telephony https://git.openwrt.org/feed/telephony.git^06a5323734038c3866f507787256581dba3d8522
|
||||
src-git packages https://git.openwrt.org/feed/packages.git^65e91999666573eac2d9d57ed4ecadac029cf8f3
|
||||
src-git luci https://git.openwrt.org/project/luci.git^ab22243b4928bd81936f56422970c10192cdad8e
|
||||
src-git routing https://git.openwrt.org/feed/routing.git^83f515d7ae76e5a7460c0eacadae806363df05a1
|
||||
src-git telephony https://git.openwrt.org/feed/telephony.git^8ecbdabc7c5cadbe571eb947f5cd333a5a785010
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
LINUX_RELEASE?=1
|
||||
|
||||
LINUX_VERSION-4.9 = .198
|
||||
LINUX_VERSION-4.14 = .151
|
||||
LINUX_VERSION-4.9 = .243
|
||||
LINUX_VERSION-4.14 = .206
|
||||
|
||||
LINUX_KERNEL_HASH-4.9.198 = 9572ebfa6ba0efcf9f1ec7b62c7b89baa36a621ab9fd4c5ad025196c549605ac
|
||||
LINUX_KERNEL_HASH-4.14.151 = ff519c428ee9bbb513a84db5ec32a7e3705cd8c23a57104b25b944cb79583fae
|
||||
LINUX_KERNEL_HASH-4.9.243 = d3aa189ca7fcc6e52d6c0333a0d7acd8789e9a492b32dbf9476e926ffaa73984
|
||||
LINUX_KERNEL_HASH-4.14.206 = 1c233efaa5063983293a02d4692acc9ced9c03e18857364855d4f612347086ac
|
||||
|
||||
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
|
||||
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
|
||||
|
||||
@@ -28,16 +28,9 @@ $(eval $(call TestHostCommand,proper-umask, \
|
||||
|
||||
$(eval $(call SetupHostCommand,gcc, \
|
||||
Please install the GNU C Compiler (gcc) 4.8 or later, \
|
||||
$(CC) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \
|
||||
gcc -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \
|
||||
gcc48 --version | grep gcc, \
|
||||
gcc49 --version | grep gcc, \
|
||||
gcc5 --version | grep gcc, \
|
||||
gcc6 --version | grep gcc, \
|
||||
gcc7 --version | grep gcc, \
|
||||
gcc8 --version | grep gcc, \
|
||||
gcc9 --version | grep gcc, \
|
||||
gcc --version | grep Apple.LLVM ))
|
||||
$(CC) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \
|
||||
gcc -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \
|
||||
gcc --version | grep -E 'Apple.(LLVM|clang)' ))
|
||||
|
||||
$(eval $(call TestHostCommand,working-gcc, \
|
||||
\nPlease reinstall the GNU C Compiler (4.8 or later) - \
|
||||
@@ -47,16 +40,9 @@ $(eval $(call TestHostCommand,working-gcc, \
|
||||
|
||||
$(eval $(call SetupHostCommand,g++, \
|
||||
Please install the GNU C++ Compiler (g++) 4.8 or later, \
|
||||
$(CXX) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \
|
||||
g++ -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \
|
||||
g++48 --version | grep g++, \
|
||||
g++49 --version | grep g++, \
|
||||
g++5 --version | grep g++, \
|
||||
g++6 --version | grep g++, \
|
||||
g++7 --version | grep g++, \
|
||||
g++8 --version | grep g++, \
|
||||
g++9 --version | grep g++, \
|
||||
g++ --version | grep Apple.LLVM ))
|
||||
$(CXX) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \
|
||||
g++ -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \
|
||||
g++ --version | grep -E 'Apple.(LLVM|clang)' ))
|
||||
|
||||
$(eval $(call TestHostCommand,working-g++, \
|
||||
\nPlease reinstall the GNU C++ Compiler (4.8 or later) - \
|
||||
@@ -141,10 +127,12 @@ $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \
|
||||
$(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
|
||||
perl --version | grep "perl.*v5"))
|
||||
|
||||
$(eval $(call CleanupPython3))
|
||||
|
||||
$(eval $(call SetupHostCommand,python,Please install Python 2.x, \
|
||||
python2.7 -V 2>&1 | grep Python, \
|
||||
python2 -V 2>&1 | grep Python, \
|
||||
python -V 2>&1 | grep Python))
|
||||
python2.7 -V 2>&1 | grep 'Python 2.7', \
|
||||
python2 -V 2>&1 | grep 'Python 2', \
|
||||
python -V 2>&1 | grep 'Python 2'))
|
||||
|
||||
$(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
|
||||
git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))
|
||||
|
||||
@@ -66,6 +66,18 @@ define RequireHeader
|
||||
$$(eval $$(call Require,$(1),$(2)))
|
||||
endef
|
||||
|
||||
define CleanupPython3
|
||||
define Require/python3-cleanup
|
||||
if [ -f "$(STAGING_DIR_HOST)/bin/python" ] && \
|
||||
$(STAGING_DIR_HOST)/bin/python -V 2>&1 | \
|
||||
grep -q 'Python 3'; then \
|
||||
rm $(STAGING_DIR_HOST)/bin/python; \
|
||||
fi
|
||||
endef
|
||||
|
||||
$$(eval $$(call Require,python3-cleanup))
|
||||
endef
|
||||
|
||||
define QuoteHostCommand
|
||||
'$(subst ','"'"',$(strip $(1)))'
|
||||
endef
|
||||
|
||||
@@ -26,13 +26,13 @@ PKG_CONFIG_DEPENDS += \
|
||||
sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
|
||||
|
||||
VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
|
||||
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),18.06.5)
|
||||
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),18.06.9)
|
||||
|
||||
VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
|
||||
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r7897-9d401013fc)
|
||||
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r8077-7cbbab7246)
|
||||
|
||||
VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
|
||||
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/releases/18.06.5)
|
||||
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/releases/18.06.9)
|
||||
|
||||
VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
|
||||
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
|
||||
|
||||
@@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
|
||||
include $(INCLUDE_DIR)/feeds.mk
|
||||
|
||||
PKG_NAME:=base-files
|
||||
PKG_RELEASE:=194.2
|
||||
PKG_RELEASE:=194.3
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
|
||||
|
||||
@@ -85,12 +85,16 @@ generate_network() {
|
||||
set network.$1.proto='none'
|
||||
EOF
|
||||
|
||||
[ -n "$macaddr" ] && uci -q batch <<-EOF
|
||||
delete network.$1_dev
|
||||
set network.$1_dev='device'
|
||||
set network.$1_dev.name='$ifname'
|
||||
set network.$1_dev.macaddr='$macaddr'
|
||||
EOF
|
||||
if [ -n "$macaddr" ]; then
|
||||
for name in $ifname; do
|
||||
uci -q batch <<-EOF
|
||||
delete network.$1_${name/./_}_dev
|
||||
set network.$1_${name/./_}_dev='device'
|
||||
set network.$1_${name/./_}_dev.name='$name'
|
||||
set network.$1_${name/./_}_dev.macaddr='$macaddr'
|
||||
EOF
|
||||
done
|
||||
fi
|
||||
|
||||
case "$protocol" in
|
||||
static)
|
||||
|
||||
@@ -183,7 +183,7 @@ if VERSIONOPT
|
||||
config VERSION_REPO
|
||||
string
|
||||
prompt "Release repository"
|
||||
default "http://downloads.openwrt.org/releases/18.06.5"
|
||||
default "http://downloads.openwrt.org/releases/18.06.9"
|
||||
help
|
||||
This is the repository address embedded in the image, it defaults
|
||||
to the trunk snapshot repo; the url may contain the following placeholders:
|
||||
|
||||
@@ -46,6 +46,7 @@ mr600v2|\
|
||||
mr900|\
|
||||
mr900v2|\
|
||||
n5q|\
|
||||
nbg6616|\
|
||||
nbg6716|\
|
||||
om5p|\
|
||||
om5p-ac|\
|
||||
@@ -57,7 +58,10 @@ sr3200|\
|
||||
t830|\
|
||||
tube2h|\
|
||||
wam250|\
|
||||
wndr3700|\
|
||||
wnr1000-v2|\
|
||||
wnr2000-v3|\
|
||||
wnr2200|\
|
||||
wnr612-v2|\
|
||||
xd3200)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
@@ -91,6 +95,12 @@ qihoo-c301)
|
||||
wi2a-ac200i)
|
||||
ubootenv_add_uci_config "/dev/mtd4" "0x0" "0x8000" "0x10000"
|
||||
;;
|
||||
wndr3700)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x10000"
|
||||
;;
|
||||
wndr4300)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
|
||||
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=i2c-gpio-custom
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
#define DRV_NAME "i2c-gpio-custom"
|
||||
#define DRV_DESC "Custom GPIO-based I2C driver"
|
||||
#define DRV_VERSION "0.1.1"
|
||||
#define DRV_VERSION "0.1.2"
|
||||
|
||||
#define PFX DRV_NAME ": "
|
||||
|
||||
@@ -96,7 +96,7 @@ static void i2c_gpio_custom_cleanup(void)
|
||||
|
||||
for (i = 0; i < nr_devices; i++)
|
||||
if (devices[i])
|
||||
platform_device_put(devices[i]);
|
||||
platform_device_unregister(devices[i]);
|
||||
}
|
||||
|
||||
static int __init i2c_gpio_custom_add_one(unsigned int id, unsigned int *params)
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ltq-ptm
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/ltq-ptm-$(BUILD_VARIANT)
|
||||
|
||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||
|
||||
@@ -334,6 +334,9 @@ static int ptm_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
dma_cache_wback((unsigned long)skb->data, skb->len);
|
||||
}
|
||||
|
||||
/* make the skb unowned */
|
||||
skb_orphan(skb);
|
||||
|
||||
*(struct sk_buff **)((unsigned int)skb->data - byteoff - sizeof(struct sk_buff *)) = skb;
|
||||
/* write back to physical memory */
|
||||
dma_cache_wback((unsigned long)skb->data - byteoff - sizeof(struct sk_buff *), skb->len + byteoff + sizeof(struct sk_buff *));
|
||||
|
||||
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
PKG_NAME:=mac80211
|
||||
|
||||
PKG_VERSION:=2017-11-01
|
||||
PKG_RELEASE:=10
|
||||
PKG_RELEASE:=11
|
||||
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
|
||||
PKG_HASH:=8437ab7886b988c8152e7a4db30b7f41009e49a3b2cb863edd05da1ecd7eb05a
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
From e3c57dd949835419cee8d3b45db38de58bf6ebd5 Mon Sep 17 00:00:00 2001
|
||||
From: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Date: Mon, 18 Nov 2019 01:13:37 +0100
|
||||
Subject: [PATCH] backports: Adapt to changes to skb_get_hash_perturb()
|
||||
|
||||
The skb_get_hash_perturb() function now takes a siphash_key_t instead of
|
||||
an u32. This was changed in commit 55667441c84f ("net/flow_dissector:
|
||||
switch to siphash"). Use the correct type in the fq header file
|
||||
depending on the kernel version.
|
||||
|
||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
---
|
||||
include/net/fq.h | 8 ++++++++
|
||||
include/net/fq_impl.h | 8 ++++++++
|
||||
2 files changed, 16 insertions(+)
|
||||
|
||||
--- a/include/net/fq.h
|
||||
+++ b/include/net/fq.h
|
||||
@@ -70,7 +70,15 @@ struct fq {
|
||||
struct list_head backlogs;
|
||||
spinlock_t lock;
|
||||
u32 flows_cnt;
|
||||
+#if LINUX_VERSION_IS_GEQ(5,3,10) || \
|
||||
+ LINUX_VERSION_IN_RANGE(4,19,83, 4,20,0) || \
|
||||
+ LINUX_VERSION_IN_RANGE(4,14,153, 4,15,0) || \
|
||||
+ LINUX_VERSION_IN_RANGE(4,9,200, 4,10,0) || \
|
||||
+ LINUX_VERSION_IN_RANGE(4,4,200, 4,5,0)
|
||||
+ siphash_key_t perturbation;
|
||||
+#else
|
||||
u32 perturbation;
|
||||
+#endif
|
||||
u32 limit;
|
||||
u32 memory_limit;
|
||||
u32 memory_usage;
|
||||
--- a/include/net/fq_impl.h
|
||||
+++ b/include/net/fq_impl.h
|
||||
@@ -118,7 +118,15 @@ static struct fq_flow *fq_flow_classify(
|
||||
|
||||
lockdep_assert_held(&fq->lock);
|
||||
|
||||
+#if LINUX_VERSION_IS_GEQ(5,3,10) || \
|
||||
+ LINUX_VERSION_IN_RANGE(4,19,83, 4,20,0) || \
|
||||
+ LINUX_VERSION_IN_RANGE(4,14,153, 4,15,0) || \
|
||||
+ LINUX_VERSION_IN_RANGE(4,9,200, 4,10,0) || \
|
||||
+ LINUX_VERSION_IN_RANGE(4,4,200, 4,5,0)
|
||||
+ hash = skb_get_hash_perturb(skb, &fq->perturbation);
|
||||
+#else
|
||||
hash = skb_get_hash_perturb(skb, fq->perturbation);
|
||||
+#endif
|
||||
idx = reciprocal_scale(hash, fq->flows_cnt);
|
||||
flow = &fq->flows[idx];
|
||||
|
||||
@@ -307,7 +315,15 @@ static int fq_init(struct fq *fq, int fl
|
||||
INIT_LIST_HEAD(&fq->backlogs);
|
||||
spin_lock_init(&fq->lock);
|
||||
fq->flows_cnt = max_t(u32, flows_cnt, 1);
|
||||
+#if LINUX_VERSION_IS_GEQ(5,3,10) || \
|
||||
+ LINUX_VERSION_IN_RANGE(4,19,83, 4,20,0) || \
|
||||
+ LINUX_VERSION_IN_RANGE(4,14,153, 4,15,0) || \
|
||||
+ LINUX_VERSION_IN_RANGE(4,9,200, 4,10,0) || \
|
||||
+ LINUX_VERSION_IN_RANGE(4,4,200, 4,5,0)
|
||||
+ get_random_bytes(&fq->perturbation, sizeof(fq->perturbation));
|
||||
+#else
|
||||
fq->perturbation = prandom_u32();
|
||||
+#endif
|
||||
fq->quantum = 300;
|
||||
fq->limit = 8192;
|
||||
fq->memory_limit = 16 << 20; /* 16 MBytes */
|
||||
@@ -0,0 +1,22 @@
|
||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
|
||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
|
||||
@@ -53,7 +53,9 @@ static const struct dmi_system_id dmi_pl
|
||||
.matches = {
|
||||
DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),
|
||||
DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
|
||||
+#if LINUX_VERSION_IS_GEQ(4,18,0)
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T8"),
|
||||
+#endif
|
||||
/* also match on somewhat unique bios-version */
|
||||
DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
|
||||
},
|
||||
@@ -64,7 +66,9 @@ static const struct dmi_system_id dmi_pl
|
||||
.matches = {
|
||||
DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),
|
||||
DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
|
||||
+#if LINUX_VERSION_IS_GEQ(4,18,0)
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T11"),
|
||||
+#endif
|
||||
/* also match on somewhat unique bios-version */
|
||||
DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
|
||||
},
|
||||
@@ -0,0 +1,42 @@
|
||||
From 1ec47ff0525c4a530dc7783cb28044179334a4cc Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Berg <johannes.berg@intel.com>
|
||||
Date: Thu, 26 Mar 2020 15:51:35 +0100
|
||||
Subject: [PATCH] mac80211: mark station unauthorized before key removal
|
||||
|
||||
commit b16798f5b907733966fd1a558fca823b3c67e4a1 upstream.
|
||||
|
||||
If a station is still marked as authorized, mark it as no longer
|
||||
so before removing its keys. This allows frames transmitted to it
|
||||
to be rejected, providing additional protection against leaking
|
||||
plain text data during the disconnection flow.
|
||||
|
||||
Cc: stable@vger.kernel.org
|
||||
Link: https://lore.kernel.org/r/20200326155133.ccb4fb0bb356.If48f0f0504efdcf16b8921f48c6d3bb2cb763c99@changeid
|
||||
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
net/mac80211/sta_info.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
--- a/net/mac80211/sta_info.c
|
||||
+++ b/net/mac80211/sta_info.c
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
|
||||
* Copyright 2013-2014 Intel Mobile Communications GmbH
|
||||
* Copyright (C) 2015 - 2017 Intel Deutschland GmbH
|
||||
+ * Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
@@ -976,6 +977,11 @@ static void __sta_info_destroy_part2(str
|
||||
might_sleep();
|
||||
lockdep_assert_held(&local->sta_mtx);
|
||||
|
||||
+ while (sta->sta_state == IEEE80211_STA_AUTHORIZED) {
|
||||
+ ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
|
||||
+ WARN_ON_ONCE(ret);
|
||||
+ }
|
||||
+
|
||||
/* now keys can no longer be reached */
|
||||
ieee80211_free_sta_keys(local, sta);
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From 07dc42ff9b9c38eae221b36acda7134ab8670af8 Mon Sep 17 00:00:00 2001
|
||||
From: Jouni Malinen <jouni@codeaurora.org>
|
||||
Date: Thu, 26 Mar 2020 15:51:34 +0100
|
||||
Subject: [PATCH] mac80211: Check port authorization in the
|
||||
ieee80211_tx_dequeue() case
|
||||
|
||||
commit ce2e1ca703071723ca2dd94d492a5ab6d15050da upstream.
|
||||
|
||||
mac80211 used to check port authorization in the Data frame enqueue case
|
||||
when going through start_xmit(). However, that authorization status may
|
||||
change while the frame is waiting in a queue. Add a similar check in the
|
||||
dequeue case to avoid sending previously accepted frames after
|
||||
authorization change. This provides additional protection against
|
||||
potential leaking of frames after a station has been disconnected and
|
||||
the keys for it are being removed.
|
||||
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
||||
Link: https://lore.kernel.org/r/20200326155133.ced84317ea29.I34d4c47cd8cc8a4042b38a76f16a601fbcbfd9b3@changeid
|
||||
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
net/mac80211/tx.c | 19 ++++++++++++++++++-
|
||||
1 file changed, 18 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/net/mac80211/tx.c
|
||||
+++ b/net/mac80211/tx.c
|
||||
@@ -3496,8 +3496,25 @@ begin:
|
||||
tx.sdata = vif_to_sdata(info->control.vif);
|
||||
tx.hdrlen = ieee80211_padded_hdrlen(hw, hdr->frame_control);
|
||||
|
||||
- if (txq->sta)
|
||||
+ if (txq->sta) {
|
||||
tx.sta = container_of(txq->sta, struct sta_info, sta);
|
||||
+ /*
|
||||
+ * Drop unicast frames to unauthorised stations unless they are
|
||||
+ * EAPOL frames from the local station.
|
||||
+ */
|
||||
+ if (unlikely(!ieee80211_vif_is_mesh(&tx.sdata->vif) &&
|
||||
+ tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
|
||||
+ !is_multicast_ether_addr(hdr->addr1) &&
|
||||
+ !test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) &&
|
||||
+ (!(info->control.flags &
|
||||
+ IEEE80211_TX_CTRL_PORT_CTRL_PROTO) ||
|
||||
+ !ether_addr_equal(tx.sdata->vif.addr,
|
||||
+ hdr->addr2)))) {
|
||||
+ I802_DEBUG_INC(local->tx_handlers_drop_unauth_port);
|
||||
+ ieee80211_free_txskb(&local->hw, skb);
|
||||
+ goto begin;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
/*
|
||||
* The key can be removed while the packet was queued, so need to call
|
||||
@@ -0,0 +1,34 @@
|
||||
From 8ad73f9e86bdb079043868e3543d302b57068b80 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Berg <johannes.berg@intel.com>
|
||||
Date: Sun, 29 Mar 2020 22:50:06 +0200
|
||||
Subject: [PATCH] mac80211: fix authentication with iwlwifi/mvm
|
||||
|
||||
commit be8c827f50a0bcd56361b31ada11dc0a3c2fd240 upstream.
|
||||
|
||||
The original patch didn't copy the ieee80211_is_data() condition
|
||||
because on most drivers the management frames don't go through
|
||||
this path. However, they do on iwlwifi/mvm, so we do need to keep
|
||||
the condition here.
|
||||
|
||||
Cc: stable@vger.kernel.org
|
||||
Fixes: ce2e1ca70307 ("mac80211: Check port authorization in the ieee80211_tx_dequeue() case")
|
||||
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
Cc: Woody Suwalski <terraluna977@gmail.com>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
net/mac80211/tx.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/net/mac80211/tx.c
|
||||
+++ b/net/mac80211/tx.c
|
||||
@@ -3502,7 +3502,8 @@ begin:
|
||||
* Drop unicast frames to unauthorised stations unless they are
|
||||
* EAPOL frames from the local station.
|
||||
*/
|
||||
- if (unlikely(!ieee80211_vif_is_mesh(&tx.sdata->vif) &&
|
||||
+ if (unlikely(ieee80211_is_data(hdr->frame_control) &&
|
||||
+ !ieee80211_vif_is_mesh(&tx.sdata->vif) &&
|
||||
tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
|
||||
!is_multicast_ether_addr(hdr->addr1) &&
|
||||
!test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) &&
|
||||
@@ -0,0 +1,31 @@
|
||||
From 5981fe5b0529ba25d95f37d7faa434183ad618c5 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Berg <johannes.berg@intel.com>
|
||||
Date: Mon, 3 Aug 2020 11:02:10 +0200
|
||||
Subject: [PATCH] mac80211: fix misplaced while instead of if
|
||||
|
||||
This never was intended to be a 'while' loop, it should've
|
||||
just been an 'if' instead of 'while'. Fix this.
|
||||
|
||||
I noticed this while applying another patch from Ben that
|
||||
intended to fix a busy loop at this spot.
|
||||
|
||||
Cc: stable@vger.kernel.org
|
||||
Fixes: b16798f5b907 ("mac80211: mark station unauthorized before key removal")
|
||||
Reported-by: Ben Greear <greearb@candelatech.com>
|
||||
Link: https://lore.kernel.org/r/20200803110209.253009ae41ff.I3522aad099392b31d5cf2dcca34cbac7e5832dde@changeid
|
||||
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
||||
---
|
||||
net/mac80211/sta_info.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/net/mac80211/sta_info.c
|
||||
+++ b/net/mac80211/sta_info.c
|
||||
@@ -977,7 +977,7 @@ static void __sta_info_destroy_part2(str
|
||||
might_sleep();
|
||||
lockdep_assert_held(&local->sta_mtx);
|
||||
|
||||
- while (sta->sta_state == IEEE80211_STA_AUTHORIZED) {
|
||||
+ if (sta->sta_state == IEEE80211_STA_AUTHORIZED) {
|
||||
ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
|
||||
WARN_ON_ONCE(ret);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 18 Nov 2019 11:52:41 +0100
|
||||
Subject: [PATCH FIX] brcmfmac: disable PCIe interrupts before bus reset
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Keeping interrupts on could result in brcmfmac freeing some resources
|
||||
and then IRQ handlers trying to use them. That was obviously a straight
|
||||
path for crashing a kernel.
|
||||
|
||||
Example:
|
||||
CPU0 CPU1
|
||||
---- ----
|
||||
brcmf_pcie_reset
|
||||
brcmf_pcie_bus_console_read
|
||||
brcmf_detach
|
||||
...
|
||||
brcmf_fweh_detach
|
||||
brcmf_proto_detach
|
||||
brcmf_pcie_isr_thread
|
||||
...
|
||||
brcmf_proto_msgbuf_rx_trigger
|
||||
...
|
||||
drvr->proto->pd
|
||||
brcmf_pcie_release_irq
|
||||
|
||||
[ 363.789218] Unable to handle kernel NULL pointer dereference at virtual address 00000038
|
||||
[ 363.797339] pgd = c0004000
|
||||
[ 363.800050] [00000038] *pgd=00000000
|
||||
[ 363.803635] Internal error: Oops: 17 [#1] SMP ARM
|
||||
(...)
|
||||
[ 364.029209] Backtrace:
|
||||
[ 364.031725] [<bf243838>] (brcmf_proto_msgbuf_rx_trigger [brcmfmac]) from [<bf2471dc>] (brcmf_pcie_isr_thread+0x228/0x274 [brcmfmac])
|
||||
[ 364.043662] r7:00000001 r6:c8ca0000 r5:00010000 r4:c7b4f800
|
||||
|
||||
Fixes: 4684997d9eea ("brcmfmac: reset PCIe bus on a firmware crash")
|
||||
Cc: stable@vger.kernel.org # v5.2+
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
|
||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
|
||||
@@ -1437,6 +1437,8 @@ static int brcmf_pcie_reset(struct devic
|
||||
struct brcmf_fw_request *fwreq;
|
||||
int err;
|
||||
|
||||
+ brcmf_pcie_intr_disable(devinfo);
|
||||
+
|
||||
brcmf_pcie_bus_console_read(devinfo, true);
|
||||
|
||||
brcmf_detach(dev);
|
||||
@@ -0,0 +1,30 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 18 Nov 2019 13:35:20 +0100
|
||||
Subject: [PATCH 5.5] brcmfmac: remove monitor interface when detaching
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This fixes a minor WARNING in the cfg80211:
|
||||
[ 130.658034] ------------[ cut here ]------------
|
||||
[ 130.662805] WARNING: CPU: 1 PID: 610 at net/wireless/core.c:954 wiphy_unregister+0xb4/0x198 [cfg80211]
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
|
||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
|
||||
@@ -1380,6 +1380,11 @@ void brcmf_detach(struct device *dev)
|
||||
brcmf_fweh_detach(drvr);
|
||||
brcmf_proto_detach(drvr);
|
||||
|
||||
+ if (drvr->mon_if) {
|
||||
+ brcmf_net_detach(drvr->mon_if->ndev, false);
|
||||
+ drvr->mon_if = NULL;
|
||||
+ }
|
||||
+
|
||||
/* make sure primary interface removed last */
|
||||
for (i = BRCMF_MAX_IFS - 1; i > -1; i--) {
|
||||
if (drvr->iflist[i])
|
||||
@@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
|
||||
|
||||
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
|
||||
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
|
||||
@@ -1481,6 +1481,7 @@ int __init brcmf_core_init(void)
|
||||
@@ -1486,6 +1486,7 @@ int __init brcmf_core_init(void)
|
||||
{
|
||||
if (!schedule_work(&brcmf_driver_work))
|
||||
return -EBUSY;
|
||||
|
||||
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=w1-gpio-custom
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=4
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
#define DRV_NAME "w1-gpio-custom"
|
||||
#define DRV_DESC "Custom GPIO-based W1 driver"
|
||||
#define DRV_VERSION "0.1.1"
|
||||
#define DRV_VERSION "0.1.2"
|
||||
|
||||
#define PFX DRV_NAME ": "
|
||||
|
||||
@@ -86,7 +86,7 @@ static void w1_gpio_custom_cleanup(void)
|
||||
|
||||
for (i = 0; i < nr_devices; i++)
|
||||
if (devices[i])
|
||||
platform_device_put(devices[i]);
|
||||
platform_device_unregister(devices[i]);
|
||||
}
|
||||
|
||||
static int __init w1_gpio_custom_add_one(unsigned int id, unsigned int *params)
|
||||
|
||||
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=json-c
|
||||
PKG_VERSION:=0.12.1
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=2.1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-nodoc.tar.gz
|
||||
PKG_SOURCE_URL:=https://s3.amazonaws.com/json-c_releases/releases/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -43,12 +43,6 @@
|
||||
@@ -43,12 +43,6 @@ AC_FUNC_MEMCMP
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_REALLOC
|
||||
AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf vasprintf open vsyslog strncasecmp setlocale)
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 77d935b7ae7871a1940cd827e850e6063044ec45 Mon Sep 17 00:00:00 2001
|
||||
From: Tobias Stoeckmann <tobias@stoeckmann.org>
|
||||
Date: Mon, 4 May 2020 19:46:45 +0200
|
||||
Subject: [PATCH 2/2] Prevent division by zero in linkhash.
|
||||
|
||||
If a linkhash with a size of zero is created, then modulo operations
|
||||
are prone to division by zero operations.
|
||||
|
||||
Purely protective measure against bad usage.
|
||||
---
|
||||
linkhash.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/linkhash.c
|
||||
+++ b/linkhash.c
|
||||
@@ -10,6 +10,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
+#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -431,6 +432,8 @@ struct lh_table* lh_table_new(int size,
|
||||
int i;
|
||||
struct lh_table *t;
|
||||
|
||||
+ /* Allocate space for elements to avoid divisions by zero. */
|
||||
+ assert(size > 0);
|
||||
t = (struct lh_table*)calloc(1, sizeof(struct lh_table));
|
||||
if(!t) lh_abort("lh_table_new: calloc failed\n");
|
||||
t->count = 0;
|
||||
@@ -0,0 +1,83 @@
|
||||
From d07b91014986900a3a75f306d302e13e005e9d67 Mon Sep 17 00:00:00 2001
|
||||
From: Tobias Stoeckmann <tobias@stoeckmann.org>
|
||||
Date: Mon, 4 May 2020 19:47:25 +0200
|
||||
Subject: [PATCH] Fix integer overflows.
|
||||
|
||||
The data structures linkhash and printbuf are limited to 2 GB in size
|
||||
due to a signed integer being used to track their current size.
|
||||
|
||||
If too much data is added, then size variable can overflow, which is
|
||||
an undefined behaviour in C programming language.
|
||||
|
||||
Assuming that a signed int overflow just leads to a negative value,
|
||||
like it happens on many sytems (Linux i686/amd64 with gcc), then
|
||||
printbuf is vulnerable to an out of boundary write on 64 bit systems.
|
||||
---
|
||||
linkhash.c | 7 +++++--
|
||||
printbuf.c | 19 ++++++++++++++++---
|
||||
2 files changed, 21 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/linkhash.c
|
||||
+++ b/linkhash.c
|
||||
@@ -498,7 +498,12 @@ int lh_table_insert(struct lh_table *t,
|
||||
unsigned long h, n;
|
||||
|
||||
t->inserts++;
|
||||
- if(t->count >= t->size * LH_LOAD_FACTOR) lh_table_resize(t, t->size * 2);
|
||||
+ if(t->count >= t->size * LH_LOAD_FACTOR) {
|
||||
+ /* Avoid signed integer overflow with large tables. */
|
||||
+ int new_size = (t->size > INT_MAX / 2) ? INT_MAX : (t->size * 2);
|
||||
+ if (t->size != INT_MAX)
|
||||
+ lh_table_resize(t, new_size);
|
||||
+ }
|
||||
|
||||
h = t->hash_fn(k);
|
||||
n = h % t->size;
|
||||
--- a/printbuf.c
|
||||
+++ b/printbuf.c
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
+#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -63,7 +64,16 @@ static int printbuf_extend(struct printb
|
||||
if (p->size >= min_size)
|
||||
return 0;
|
||||
|
||||
- new_size = json_max(p->size * 2, min_size + 8);
|
||||
+ /* Prevent signed integer overflows with large buffers. */
|
||||
+ if (min_size > INT_MAX - 8)
|
||||
+ return -1;
|
||||
+ if (p->size > INT_MAX / 2)
|
||||
+ new_size = min_size + 8;
|
||||
+ else {
|
||||
+ new_size = p->size * 2;
|
||||
+ if (new_size < min_size + 8)
|
||||
+ new_size = min_size + 8;
|
||||
+ }
|
||||
#ifdef PRINTBUF_DEBUG
|
||||
MC_DEBUG("printbuf_memappend: realloc "
|
||||
"bpos=%d min_size=%d old_size=%d new_size=%d\n",
|
||||
@@ -78,6 +88,9 @@ static int printbuf_extend(struct printb
|
||||
|
||||
int printbuf_memappend(struct printbuf *p, const char *buf, int size)
|
||||
{
|
||||
+ /* Prevent signed integer overflows with large buffers. */
|
||||
+ if (size > INT_MAX - p->bpos - 1)
|
||||
+ return -1;
|
||||
if (p->size <= p->bpos + size + 1) {
|
||||
if (printbuf_extend(p, p->bpos + size + 1) < 0)
|
||||
return -1;
|
||||
@@ -94,6 +107,9 @@ int printbuf_memset(struct printbuf *pb,
|
||||
|
||||
if (offset == -1)
|
||||
offset = pb->bpos;
|
||||
+ /* Prevent signed integer overflows with large buffers. */
|
||||
+ if (len > INT_MAX - offset)
|
||||
+ return -1;
|
||||
size_needed = offset + len;
|
||||
if (pb->size < size_needed)
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libubox
|
||||
PKG_RELEASE=2
|
||||
PKG_RELEASE=5
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 2acfe84e4c871fb994c38c9f2508eb9ebd296b74 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
|
||||
Date: Tue, 19 Nov 2019 17:34:25 +0100
|
||||
Subject: blobmsg_json: fix possible uninitialized struct member
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
clang-10 analyzer reports following:
|
||||
|
||||
blobmsg_json.c:285:2: warning: The expression is an uninitialized value. The computed value will also be garbage
|
||||
s->indent_level++;
|
||||
^~~~~~~~~~~~~~~~~
|
||||
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blobmsg_json.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/blobmsg_json.c
|
||||
+++ b/blobmsg_json.c
|
||||
@@ -316,7 +316,7 @@ static void setup_strbuf(struct strbuf *
|
||||
|
||||
char *blobmsg_format_json_with_cb(struct blob_attr *attr, bool list, blobmsg_json_format_t cb, void *priv, int indent)
|
||||
{
|
||||
- struct strbuf s;
|
||||
+ struct strbuf s = {0};
|
||||
bool array;
|
||||
char *ret;
|
||||
|
||||
@@ -350,7 +350,7 @@ char *blobmsg_format_json_with_cb(struct
|
||||
|
||||
char *blobmsg_format_json_value_with_cb(struct blob_attr *attr, blobmsg_json_format_t cb, void *priv, int indent)
|
||||
{
|
||||
- struct strbuf s;
|
||||
+ struct strbuf s = {0};
|
||||
char *ret;
|
||||
|
||||
setup_strbuf(&s, attr, cb, priv, indent);
|
||||
@@ -0,0 +1,39 @@
|
||||
From f27853d71a2cb99ec5de3881716a14611ada307c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
|
||||
Date: Sat, 23 Nov 2019 22:48:25 +0100
|
||||
Subject: jshn: fix off by one in jshn_parse_file
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fixes following error:
|
||||
|
||||
Invalid read of size 1
|
||||
at 0x4C32D04: strlen
|
||||
by 0x5043367: json_tokener_parse_ex
|
||||
by 0x5045316: json_tokener_parse_verbose
|
||||
by 0x504537D: json_tokener_parse
|
||||
by 0x401AB1: jshn_parse (jshn.c:179)
|
||||
by 0x40190D: jshn_parse_file (jshn.c:370)
|
||||
by 0x40190D: main (jshn.c:434)
|
||||
Address 0x5848c4c is 0 bytes after a block of size 1,036 alloc'd
|
||||
at 0x4C2FB0F: malloc
|
||||
by 0x4018E2: jshn_parse_file (jshn.c:357)
|
||||
by 0x4018E2: main (jshn.c:434)
|
||||
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
jshn.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/jshn.c
|
||||
+++ b/jshn.c
|
||||
@@ -384,7 +384,7 @@ int main(int argc, char **argv)
|
||||
close(fd);
|
||||
return 3;
|
||||
}
|
||||
- if (!(fbuf = malloc(sb.st_size))) {
|
||||
+ if (!(fbuf = calloc(1, sb.st_size+1))) {
|
||||
fprintf(stderr, "Error allocating memory for %s\n", optarg);
|
||||
close(fd);
|
||||
return 3;
|
||||
@@ -0,0 +1,97 @@
|
||||
From af2a074160e32692b570f8a3562b4370d38f34e7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
|
||||
Date: Mon, 9 Dec 2019 13:53:27 +0100
|
||||
Subject: blob: refactor attr parsing into separate function
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Making blob_parse easier to review.
|
||||
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blob.c | 61 +++++++++++++++++++++++++++++++++-------------------------
|
||||
1 file changed, 35 insertions(+), 26 deletions(-)
|
||||
|
||||
--- a/blob.c
|
||||
+++ b/blob.c
|
||||
@@ -217,44 +217,53 @@ blob_check_type(const void *ptr, unsigne
|
||||
return true;
|
||||
}
|
||||
|
||||
-int
|
||||
-blob_parse(struct blob_attr *attr, struct blob_attr **data, const struct blob_attr_info *info, int max)
|
||||
+static int
|
||||
+blob_parse_attr(struct blob_attr *attr, struct blob_attr **data, const struct blob_attr_info *info, int max)
|
||||
{
|
||||
- struct blob_attr *pos;
|
||||
int found = 0;
|
||||
- int rem;
|
||||
+ int id = blob_id(attr);
|
||||
+ size_t len = blob_len(attr);
|
||||
|
||||
- memset(data, 0, sizeof(struct blob_attr *) * max);
|
||||
- blob_for_each_attr(pos, attr, rem) {
|
||||
- int id = blob_id(pos);
|
||||
- int len = blob_len(pos);
|
||||
+ if (id >= max)
|
||||
+ return 0;
|
||||
|
||||
- if (id >= max)
|
||||
- continue;
|
||||
+ if (info) {
|
||||
+ int type = info[id].type;
|
||||
|
||||
- if (info) {
|
||||
- int type = info[id].type;
|
||||
+ if (type < BLOB_ATTR_LAST) {
|
||||
+ if (!blob_check_type(blob_data(attr), len, type))
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
- if (type < BLOB_ATTR_LAST) {
|
||||
- if (!blob_check_type(blob_data(pos), len, type))
|
||||
- continue;
|
||||
- }
|
||||
+ if (info[id].minlen && len < info[id].minlen)
|
||||
+ return 0;
|
||||
|
||||
- if (info[id].minlen && len < info[id].minlen)
|
||||
- continue;
|
||||
+ if (info[id].maxlen && len > info[id].maxlen)
|
||||
+ return 0;
|
||||
|
||||
- if (info[id].maxlen && len > info[id].maxlen)
|
||||
- continue;
|
||||
+ if (info[id].validate && !info[id].validate(&info[id], attr))
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
- if (info[id].validate && !info[id].validate(&info[id], pos))
|
||||
- continue;
|
||||
- }
|
||||
+ if (!data[id])
|
||||
+ found++;
|
||||
|
||||
- if (!data[id])
|
||||
- found++;
|
||||
+ data[id] = attr;
|
||||
+ return found;
|
||||
+}
|
||||
|
||||
- data[id] = pos;
|
||||
+int
|
||||
+blob_parse(struct blob_attr *attr, struct blob_attr **data, const struct blob_attr_info *info, int max)
|
||||
+{
|
||||
+ struct blob_attr *pos;
|
||||
+ int found = 0;
|
||||
+ size_t rem;
|
||||
+
|
||||
+ memset(data, 0, sizeof(struct blob_attr *) * max);
|
||||
+ blob_for_each_attr(pos, attr, rem) {
|
||||
+ found += blob_parse_attr(pos, data, info, max);
|
||||
}
|
||||
+
|
||||
return found;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
From b6a0a070f2e14808e835c2fcfa3820a55041902f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
|
||||
Date: Mon, 9 Dec 2019 14:11:45 +0100
|
||||
Subject: blob: introduce blob_parse_untrusted
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
blob_parse can be only used on trusted input as it has no possibility to
|
||||
check the length of the provided input buffer, which might lead to
|
||||
undefined behaviour and/or crashes when supplied with malformed,
|
||||
corrupted or otherwise specially crafted input.
|
||||
|
||||
So this introduces blob_parse_untrusted variant which expects additional
|
||||
input buffer length argument and thus should be able to process also
|
||||
inputs from untrusted sources.
|
||||
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blob.c | 24 ++++++++++++++++++++++++
|
||||
blob.h | 7 +++++++
|
||||
2 files changed, 31 insertions(+)
|
||||
|
||||
--- a/blob.c
|
||||
+++ b/blob.c
|
||||
@@ -253,6 +253,30 @@ blob_parse_attr(struct blob_attr *attr,
|
||||
}
|
||||
|
||||
int
|
||||
+blob_parse_untrusted(struct blob_attr *attr, size_t attr_len, struct blob_attr **data, const struct blob_attr_info *info, int max)
|
||||
+{
|
||||
+ struct blob_attr *pos;
|
||||
+ size_t len = 0;
|
||||
+ int found = 0;
|
||||
+ size_t rem;
|
||||
+
|
||||
+ if (!attr || attr_len < sizeof(struct blob_attr))
|
||||
+ return 0;
|
||||
+
|
||||
+ len = blob_raw_len(attr);
|
||||
+ if (len != attr_len)
|
||||
+ return 0;
|
||||
+
|
||||
+ memset(data, 0, sizeof(struct blob_attr *) * max);
|
||||
+ blob_for_each_attr_len(pos, attr, len, rem) {
|
||||
+ found += blob_parse_attr(pos, rem, data, info, max);
|
||||
+ }
|
||||
+
|
||||
+ return found;
|
||||
+}
|
||||
+
|
||||
+/* use only on trusted input, otherwise consider blob_parse_untrusted */
|
||||
+int
|
||||
blob_parse(struct blob_attr *attr, struct blob_attr **data, const struct blob_attr_info *info, int max)
|
||||
{
|
||||
struct blob_attr *pos;
|
||||
--- a/blob.h
|
||||
+++ b/blob.h
|
||||
@@ -199,6 +199,7 @@ extern void blob_nest_end(struct blob_bu
|
||||
extern struct blob_attr *blob_put(struct blob_buf *buf, int id, const void *ptr, unsigned int len);
|
||||
extern bool blob_check_type(const void *ptr, unsigned int len, int type);
|
||||
extern int blob_parse(struct blob_attr *attr, struct blob_attr **data, const struct blob_attr_info *info, int max);
|
||||
+extern int blob_parse_untrusted(struct blob_attr *attr, size_t attr_len, struct blob_attr **data, const struct blob_attr_info *info, int max);
|
||||
extern struct blob_attr *blob_memdup(struct blob_attr *attr);
|
||||
extern struct blob_attr *blob_put_raw(struct blob_buf *buf, const void *ptr, unsigned int len);
|
||||
|
||||
@@ -254,5 +255,11 @@ blob_put_u64(struct blob_buf *buf, int i
|
||||
(blob_pad_len(pos) >= sizeof(struct blob_attr)); \
|
||||
rem -= blob_pad_len(pos), pos = blob_next(pos))
|
||||
|
||||
+#define blob_for_each_attr_len(pos, attr, attr_len, rem) \
|
||||
+ for (rem = attr ? blob_len(attr) : 0, \
|
||||
+ pos = (struct blob_attr *) (attr ? blob_data(attr) : NULL); \
|
||||
+ rem >= sizeof(struct blob_attr) && rem < attr_len && (blob_pad_len(pos) <= rem) && \
|
||||
+ (blob_pad_len(pos) >= sizeof(struct blob_attr)); \
|
||||
+ rem -= blob_pad_len(pos), pos = blob_next(pos))
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
From 7425d421340594f50c717ff7129b6ee71280a447 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
|
||||
Date: Mon, 9 Dec 2019 15:27:16 +0100
|
||||
Subject: blob: fix OOB access in blob_check_type
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Found by fuzzer:
|
||||
|
||||
ERROR: AddressSanitizer: SEGV on unknown address 0x602100000455
|
||||
The signal is caused by a READ memory access.
|
||||
#0 in blob_check_type blob.c:214:43
|
||||
#1 in blob_parse_attr blob.c:234:9
|
||||
#2 in blob_parse_untrusted blob.c:272:12
|
||||
#3 in fuzz_blob_parse tests/fuzzer/test-blob-parse-fuzzer.c:34:2
|
||||
#4 in LLVMFuzzerTestOneInput tests/fuzzer/test-blob-parse-fuzzer.c:39:2
|
||||
|
||||
Caused by following line:
|
||||
|
||||
if (type == BLOB_ATTR_STRING && data[len - 1] != 0)
|
||||
|
||||
where len was pointing outside of the data buffer.
|
||||
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blob.c | 23 ++++++++++++++++++-----
|
||||
1 file changed, 18 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/blob.c
|
||||
+++ b/blob.c
|
||||
@@ -218,20 +218,33 @@ blob_check_type(const void *ptr, unsigne
|
||||
}
|
||||
|
||||
static int
|
||||
-blob_parse_attr(struct blob_attr *attr, struct blob_attr **data, const struct blob_attr_info *info, int max)
|
||||
+blob_parse_attr(struct blob_attr *attr, size_t attr_len, struct blob_attr **data, const struct blob_attr_info *info, int max)
|
||||
{
|
||||
+ int id;
|
||||
+ size_t len;
|
||||
int found = 0;
|
||||
- int id = blob_id(attr);
|
||||
- size_t len = blob_len(attr);
|
||||
+ size_t data_len;
|
||||
|
||||
+ if (!attr || attr_len < sizeof(struct blob_attr))
|
||||
+ return 0;
|
||||
+
|
||||
+ id = blob_id(attr);
|
||||
if (id >= max)
|
||||
return 0;
|
||||
|
||||
+ len = blob_raw_len(attr);
|
||||
+ if (len > attr_len || len < sizeof(struct blob_attr))
|
||||
+ return 0;
|
||||
+
|
||||
+ data_len = blob_len(attr);
|
||||
+ if (data_len > len)
|
||||
+ return 0;
|
||||
+
|
||||
if (info) {
|
||||
int type = info[id].type;
|
||||
|
||||
if (type < BLOB_ATTR_LAST) {
|
||||
- if (!blob_check_type(blob_data(attr), len, type))
|
||||
+ if (!blob_check_type(blob_data(attr), data_len, type))
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -285,7 +298,7 @@ blob_parse(struct blob_attr *attr, struc
|
||||
|
||||
memset(data, 0, sizeof(struct blob_attr *) * max);
|
||||
blob_for_each_attr(pos, attr, rem) {
|
||||
- found += blob_parse_attr(pos, data, info, max);
|
||||
+ found += blob_parse_attr(pos, rem, data, info, max);
|
||||
}
|
||||
|
||||
return found;
|
||||
@@ -0,0 +1,32 @@
|
||||
From 0773eef13674964d890420673d2501342979d8bf Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
|
||||
Date: Tue, 10 Dec 2019 12:02:40 +0100
|
||||
Subject: blobmsg: fix heap buffer overflow in blobmsg_parse
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fixes following error found by the fuzzer:
|
||||
|
||||
==29774==ERROR: AddressSanitizer: heap-buffer-overflow
|
||||
READ of size 1 at 0x6020004f1c56 thread T0
|
||||
#0 strcmp sanitizer_common_interceptors.inc:442:3
|
||||
#1 blobmsg_parse blobmsg.c:168:8
|
||||
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blobmsg.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/blobmsg.c
|
||||
+++ b/blobmsg.c
|
||||
@@ -52,6 +52,9 @@ bool blobmsg_check_attr(const struct blo
|
||||
|
||||
id = blob_id(attr);
|
||||
len = blobmsg_data_len(attr);
|
||||
+ if (len > blob_raw_len(attr))
|
||||
+ return false;
|
||||
+
|
||||
data = blobmsg_data(attr);
|
||||
|
||||
if (id > BLOBMSG_TYPE_LAST)
|
||||
@@ -0,0 +1,51 @@
|
||||
From cec3ed2550073abbfe0f1f6131c44f90c9d05aa8 Mon Sep 17 00:00:00 2001
|
||||
From: Tobias Schramm <tobleminer@gmail.com>
|
||||
Date: Wed, 28 Nov 2018 13:39:29 +0100
|
||||
Subject: Ensure blob_attr length check does not perform out of bounds reads
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Before there might have been as little as one single byte left which
|
||||
would result in 3 bytes of blob_attr->id_len being out of bounds.
|
||||
|
||||
Acked-by: Yousong Zhou <yszhou4tech@gmail.com>
|
||||
Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
|
||||
[line wrapped < 72 chars]
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blob.h | 4 ++--
|
||||
blobmsg.h | 2 +-
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/blob.h
|
||||
+++ b/blob.h
|
||||
@@ -243,7 +243,7 @@ blob_put_u64(struct blob_buf *buf, int i
|
||||
|
||||
#define __blob_for_each_attr(pos, attr, rem) \
|
||||
for (pos = (struct blob_attr *) attr; \
|
||||
- rem > 0 && (blob_pad_len(pos) <= rem) && \
|
||||
+ rem >= sizeof(struct blob_attr) && (blob_pad_len(pos) <= rem) && \
|
||||
(blob_pad_len(pos) >= sizeof(struct blob_attr)); \
|
||||
rem -= blob_pad_len(pos), pos = blob_next(pos))
|
||||
|
||||
@@ -251,7 +251,7 @@ blob_put_u64(struct blob_buf *buf, int i
|
||||
#define blob_for_each_attr(pos, attr, rem) \
|
||||
for (rem = attr ? blob_len(attr) : 0, \
|
||||
pos = (struct blob_attr *) (attr ? blob_data(attr) : NULL); \
|
||||
- rem > 0 && (blob_pad_len(pos) <= rem) && \
|
||||
+ rem >= sizeof(struct blob_attr) && (blob_pad_len(pos) <= rem) && \
|
||||
(blob_pad_len(pos) >= sizeof(struct blob_attr)); \
|
||||
rem -= blob_pad_len(pos), pos = blob_next(pos))
|
||||
|
||||
--- a/blobmsg.h
|
||||
+++ b/blobmsg.h
|
||||
@@ -266,7 +266,7 @@ int blobmsg_printf(struct blob_buf *buf,
|
||||
#define blobmsg_for_each_attr(pos, attr, rem) \
|
||||
for (rem = attr ? blobmsg_data_len(attr) : 0, \
|
||||
pos = (struct blob_attr *) (attr ? blobmsg_data(attr) : NULL); \
|
||||
- rem > 0 && (blob_pad_len(pos) <= rem) && \
|
||||
+ rem >= sizeof(struct blob_attr) && (blob_pad_len(pos) <= rem) && \
|
||||
(blob_pad_len(pos) >= sizeof(struct blob_attr)); \
|
||||
rem -= blob_pad_len(pos), pos = blob_next(pos))
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
From 8b6a401638317906b6d9039417c1c19ea8cfeab0 Mon Sep 17 00:00:00 2001
|
||||
From: Tobias Schramm <tobleminer@gmail.com>
|
||||
Date: Tue, 13 Nov 2018 04:16:12 +0100
|
||||
Subject: Replace use of blobmsg_check_attr by blobmsg_check_attr_len
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
blobmsg_check_attr_len adds a length limit specifying the max offset
|
||||
from attr that can be read safely.
|
||||
|
||||
Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
|
||||
[rebased and reworked, line wrapped commit message, _safe -> _len]
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blobmsg.c | 59 +++++++++++++++++++++++++++++++++++++++++++------------
|
||||
blobmsg.h | 2 ++
|
||||
2 files changed, 48 insertions(+), 13 deletions(-)
|
||||
|
||||
--- a/blobmsg.c
|
||||
+++ b/blobmsg.c
|
||||
@@ -33,37 +33,70 @@ blobmsg_namelen(const struct blobmsg_hdr
|
||||
|
||||
bool blobmsg_check_attr(const struct blob_attr *attr, bool name)
|
||||
{
|
||||
+ return blobmsg_check_attr_len(attr, name, blob_raw_len(attr));
|
||||
+}
|
||||
+
|
||||
+static bool blobmsg_check_name(const struct blob_attr *attr, size_t len, bool name)
|
||||
+{
|
||||
+ char *limit = (char *) attr + len;
|
||||
const struct blobmsg_hdr *hdr;
|
||||
- const char *data;
|
||||
- int id, len;
|
||||
|
||||
- if (blob_len(attr) < sizeof(struct blobmsg_hdr))
|
||||
+ hdr = blob_data(attr);
|
||||
+ if (name && !hdr->namelen)
|
||||
return false;
|
||||
|
||||
- hdr = (void *) attr->data;
|
||||
- if (!hdr->namelen && name)
|
||||
+ if ((char *) hdr->name + blobmsg_namelen(hdr) > limit)
|
||||
return false;
|
||||
|
||||
- if (blobmsg_namelen(hdr) > blob_len(attr) - sizeof(struct blobmsg_hdr))
|
||||
+ if (blobmsg_namelen(hdr) > (blob_len(attr) - sizeof(struct blobmsg_hdr)))
|
||||
return false;
|
||||
|
||||
if (hdr->name[blobmsg_namelen(hdr)] != 0)
|
||||
return false;
|
||||
|
||||
- id = blob_id(attr);
|
||||
- len = blobmsg_data_len(attr);
|
||||
- if (len > blob_raw_len(attr))
|
||||
- return false;
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+static const char* blobmsg_check_data(const struct blob_attr *attr, size_t len, size_t *data_len)
|
||||
+{
|
||||
+ char *limit = (char *) attr + len;
|
||||
+ const char *data;
|
||||
+
|
||||
+ *data_len = blobmsg_data_len(attr);
|
||||
+ if (*data_len > blob_raw_len(attr))
|
||||
+ return NULL;
|
||||
|
||||
data = blobmsg_data(attr);
|
||||
+ if (data + *data_len > limit)
|
||||
+ return NULL;
|
||||
|
||||
+ return data;
|
||||
+}
|
||||
+
|
||||
+bool blobmsg_check_attr_len(const struct blob_attr *attr, bool name, size_t len)
|
||||
+{
|
||||
+ const char *data;
|
||||
+ size_t data_len;
|
||||
+ int id;
|
||||
+
|
||||
+ if (len < sizeof(struct blob_attr))
|
||||
+ return false;
|
||||
+
|
||||
+ if (!blobmsg_check_name(attr, len, name))
|
||||
+ return false;
|
||||
+
|
||||
+ id = blob_id(attr);
|
||||
if (id > BLOBMSG_TYPE_LAST)
|
||||
return false;
|
||||
|
||||
if (!blob_type[id])
|
||||
return true;
|
||||
|
||||
- return blob_check_type(data, len, blob_type[id]);
|
||||
+ data = blobmsg_check_data(attr, len, &data_len);
|
||||
+ if (!data)
|
||||
+ return false;
|
||||
+
|
||||
+ return blob_check_type(data, data_len, blob_type[id]);
|
||||
}
|
||||
|
||||
int blobmsg_check_array(const struct blob_attr *attr, int type)
|
||||
@@ -114,7 +147,7 @@ int blobmsg_parse_array(const struct blo
|
||||
blob_id(attr) != policy[i].type)
|
||||
continue;
|
||||
|
||||
- if (!blobmsg_check_attr(attr, false))
|
||||
+ if (!blobmsg_check_attr_len(attr, false, len))
|
||||
return -1;
|
||||
|
||||
if (tb[i])
|
||||
@@ -161,7 +194,7 @@ int blobmsg_parse(const struct blobmsg_p
|
||||
if (blobmsg_namelen(hdr) != pslen[i])
|
||||
continue;
|
||||
|
||||
- if (!blobmsg_check_attr(attr, true))
|
||||
+ if (!blobmsg_check_attr_len(attr, true, len))
|
||||
return -1;
|
||||
|
||||
if (tb[i])
|
||||
--- a/blobmsg.h
|
||||
+++ b/blobmsg.h
|
||||
@@ -107,6 +107,8 @@ static inline int blobmsg_len(const stru
|
||||
bool blobmsg_check_attr(const struct blob_attr *attr, bool name);
|
||||
bool blobmsg_check_attr_list(const struct blob_attr *attr, int type);
|
||||
|
||||
+bool blobmsg_check_attr_len(const struct blob_attr *attr, bool name, size_t len);
|
||||
+
|
||||
/*
|
||||
* blobmsg_check_array: validate array/table and return size
|
||||
*
|
||||
@@ -0,0 +1,157 @@
|
||||
From ad29d0304983e283d4aec4ee5462942eaf5c03ac Mon Sep 17 00:00:00 2001
|
||||
From: Tobias Schramm <tobleminer@gmail.com>
|
||||
Date: Thu, 15 Nov 2018 03:42:48 +0100
|
||||
Subject: blobmsg: add _len variants for all attribute checking methods
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Introduce _len variants of blobmsg attribute checking functions which
|
||||
aims to provide safer implementation as those functions should limit all
|
||||
memory accesses performed on the blob to the range [attr, attr + len]
|
||||
(upper bound non inclusive) and thus should be suited for checking of
|
||||
untrusted blob attributes.
|
||||
|
||||
While at it add some comments in order to make it clear.
|
||||
|
||||
Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
|
||||
[_safe -> _len, blobmsg_check_array_len fix, commit subject/desc facelift]
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blobmsg.c | 21 ++++++++++++++++++---
|
||||
blobmsg.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 72 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/blobmsg.c
|
||||
+++ b/blobmsg.c
|
||||
@@ -101,11 +101,21 @@ bool blobmsg_check_attr_len(const struct
|
||||
|
||||
int blobmsg_check_array(const struct blob_attr *attr, int type)
|
||||
{
|
||||
+ return blobmsg_check_array_len(attr, type, blob_raw_len(attr));
|
||||
+}
|
||||
+
|
||||
+int blobmsg_check_array_len(const struct blob_attr *attr, int type, size_t len)
|
||||
+{
|
||||
struct blob_attr *cur;
|
||||
bool name;
|
||||
- int rem;
|
||||
int size = 0;
|
||||
|
||||
+ if (type > BLOBMSG_TYPE_LAST)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (!blobmsg_check_attr_len(attr, false, len))
|
||||
+ return -1;
|
||||
+
|
||||
switch (blobmsg_type(attr)) {
|
||||
case BLOBMSG_TYPE_TABLE:
|
||||
name = true;
|
||||
@@ -117,11 +127,11 @@ int blobmsg_check_array(const struct blo
|
||||
return -1;
|
||||
}
|
||||
|
||||
- blobmsg_for_each_attr(cur, attr, rem) {
|
||||
+ __blobmsg_for_each_attr(cur, attr, len) {
|
||||
if (type != BLOBMSG_TYPE_UNSPEC && blobmsg_type(cur) != type)
|
||||
return -1;
|
||||
|
||||
- if (!blobmsg_check_attr(cur, name))
|
||||
+ if (!blobmsg_check_attr_len(cur, name, len))
|
||||
return -1;
|
||||
|
||||
size++;
|
||||
@@ -135,6 +145,11 @@ bool blobmsg_check_attr_list(const struc
|
||||
return blobmsg_check_array(attr, type) >= 0;
|
||||
}
|
||||
|
||||
+bool blobmsg_check_attr_list_len(const struct blob_attr *attr, int type, size_t len)
|
||||
+{
|
||||
+ return blobmsg_check_array_len(attr, type, len) >= 0;
|
||||
+}
|
||||
+
|
||||
int blobmsg_parse_array(const struct blobmsg_policy *policy, int policy_len,
|
||||
struct blob_attr **tb, void *data, unsigned int len)
|
||||
{
|
||||
--- a/blobmsg.h
|
||||
+++ b/blobmsg.h
|
||||
@@ -104,19 +104,66 @@ static inline int blobmsg_len(const stru
|
||||
return blobmsg_data_len(attr);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * blobmsg_check_attr: validate a list of attributes
|
||||
+ *
|
||||
+ * This method may be used with trusted data only. Providing
|
||||
+ * malformed blobs will cause out of bounds memory access.
|
||||
+ */
|
||||
bool blobmsg_check_attr(const struct blob_attr *attr, bool name);
|
||||
-bool blobmsg_check_attr_list(const struct blob_attr *attr, int type);
|
||||
|
||||
+/*
|
||||
+ * blobmsg_check_attr_len: validate a list of attributes
|
||||
+ *
|
||||
+ * This method should be safer implementation of blobmsg_check_attr.
|
||||
+ * It will limit all memory access performed on the blob to the
|
||||
+ * range [attr, attr + len] (upper bound non inclusive) and is
|
||||
+ * thus suited for checking of untrusted blob attributes.
|
||||
+ */
|
||||
bool blobmsg_check_attr_len(const struct blob_attr *attr, bool name, size_t len);
|
||||
|
||||
/*
|
||||
+ * blobmsg_check_attr_list: validate a list of attributes
|
||||
+ *
|
||||
+ * This method may be used with trusted data only. Providing
|
||||
+ * malformed blobs will cause out of bounds memory access.
|
||||
+ */
|
||||
+bool blobmsg_check_attr_list(const struct blob_attr *attr, int type);
|
||||
+
|
||||
+/*
|
||||
+ * blobmsg_check_attr_list_len: validate a list of untrusted attributes
|
||||
+ *
|
||||
+ * This method should be safer implementation of blobmsg_check_attr_list.
|
||||
+ * It will limit all memory access performed on the blob to the
|
||||
+ * range [attr, attr + len] (upper bound non inclusive) and is
|
||||
+ * thus suited for checking of untrusted blob attributes.
|
||||
+ */
|
||||
+bool blobmsg_check_attr_list_len(const struct blob_attr *attr, int type, size_t len);
|
||||
+
|
||||
+/*
|
||||
* blobmsg_check_array: validate array/table and return size
|
||||
*
|
||||
* Checks if all elements of an array or table are valid and have
|
||||
* the specified type. Returns the number of elements in the array
|
||||
+ *
|
||||
+ * This method may be used with trusted data only. Providing
|
||||
+ * malformed blobs will cause out of bounds memory access.
|
||||
*/
|
||||
int blobmsg_check_array(const struct blob_attr *attr, int type);
|
||||
|
||||
+/*
|
||||
+ * blobmsg_check_array_len: validate untrusted array/table and return size
|
||||
+ *
|
||||
+ * Checks if all elements of an array or table are valid and have
|
||||
+ * the specified type. Returns the number of elements in the array.
|
||||
+ *
|
||||
+ * This method should be safer implementation of blobmsg_check_array.
|
||||
+ * It will limit all memory access performed on the blob to the
|
||||
+ * range [attr, attr + len] (upper bound non inclusive) and is
|
||||
+ * thus suited for checking of untrusted blob attributes.
|
||||
+ */
|
||||
+int blobmsg_check_array_len(const struct blob_attr *attr, int type, size_t len);
|
||||
+
|
||||
int blobmsg_parse(const struct blobmsg_policy *policy, int policy_len,
|
||||
struct blob_attr **tb, void *data, unsigned int len);
|
||||
int blobmsg_parse_array(const struct blobmsg_policy *policy, int policy_len,
|
||||
@@ -271,5 +318,11 @@ int blobmsg_printf(struct blob_buf *buf,
|
||||
rem >= sizeof(struct blob_attr) && (blob_pad_len(pos) <= rem) && \
|
||||
(blob_pad_len(pos) >= sizeof(struct blob_attr)); \
|
||||
rem -= blob_pad_len(pos), pos = blob_next(pos))
|
||||
+
|
||||
+#define __blobmsg_for_each_attr(pos, attr, rem) \
|
||||
+ for (pos = (struct blob_attr *) (attr ? blobmsg_data(attr) : NULL); \
|
||||
+ rem >= sizeof(struct blob_attr) && (blob_pad_len(pos) <= rem) && \
|
||||
+ (blob_pad_len(pos) >= sizeof(struct blob_attr)); \
|
||||
+ rem -= blob_pad_len(pos), pos = blob_next(pos))
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
From 44d9e85ef058fbb9981d53218cafdc451afa5535 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
|
||||
Date: Wed, 25 Dec 2019 10:27:59 +0100
|
||||
Subject: blobmsg: fix array out of bounds GCC 10 warning
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fixes following warning reported by GCC 10.0.0 20191203:
|
||||
|
||||
blobmsg.c:234:2: error: 'strcpy' offset 6 from the object at 'attr' is out of the bounds of referenced subobject 'name' with type 'uint8_t[0]' {aka 'unsigned char[0]'} at offset 6 [-Werror=array-bounds]
|
||||
234 | strcpy((char *) hdr->name, (const char *)name);
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
In file included from blobmsg.c:16:
|
||||
blobmsg.h:42:10: note: subobject 'name' declared here
|
||||
42 | uint8_t name[];
|
||||
| ^~~~
|
||||
|
||||
Reported-by: Khem Raj <raj.khem@gmail.com>
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blobmsg.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/blobmsg.c
|
||||
+++ b/blobmsg.c
|
||||
@@ -246,7 +246,10 @@ blobmsg_new(struct blob_buf *buf, int ty
|
||||
attr->id_len |= be32_to_cpu(BLOB_ATTR_EXTENDED);
|
||||
hdr = blob_data(attr);
|
||||
hdr->namelen = cpu_to_be16(namelen);
|
||||
- strcpy((char *) hdr->name, (const char *)name);
|
||||
+
|
||||
+ memcpy(hdr->name, name, namelen);
|
||||
+ hdr->name[namelen] = '\0';
|
||||
+
|
||||
pad_end = *data = blobmsg_data(attr);
|
||||
pad_start = (char *) &hdr->name[namelen];
|
||||
if (pad_start < pad_end)
|
||||
@@ -0,0 +1,38 @@
|
||||
From d0f05d5e6873b30315127d47abbf4ac9f3c8bfb7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
|
||||
Date: Sat, 28 Dec 2019 19:00:39 +0100
|
||||
Subject: blobmsg: fix wrong payload len passed from blobmsg_check_array
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fix incorrect use of blob_raw_len() on passed blobmsg to
|
||||
blobmsg_check_array_len() introduced in commit b0e21553ae8c ("blobmsg:
|
||||
add _len variants for all attribute checking methods") by using correct
|
||||
blobmsg_len().
|
||||
|
||||
This wrong (higher) length was then for example causing issues in
|
||||
procd's instance_config_parse_command() where blobmsg_check_attr_list()
|
||||
was failing sanity checking of service command, thus resulting in the
|
||||
startup failures of some services like collectd, nlbwmon and samba4.
|
||||
|
||||
Ref: http://lists.infradead.org/pipermail/openwrt-devel/2019-December/020840.html
|
||||
Fixes: b0e21553ae8c ("blobmsg: add _len variants for all attribute checking methods")
|
||||
Reported-by: Hannu Nyman <hannu.nyman@welho.com>
|
||||
Tested-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blobmsg.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/blobmsg.c
|
||||
+++ b/blobmsg.c
|
||||
@@ -101,7 +101,7 @@ bool blobmsg_check_attr_len(const struct
|
||||
|
||||
int blobmsg_check_array(const struct blob_attr *attr, int type)
|
||||
{
|
||||
- return blobmsg_check_array_len(attr, type, blob_raw_len(attr));
|
||||
+ return blobmsg_check_array_len(attr, type, blobmsg_len(attr));
|
||||
}
|
||||
|
||||
int blobmsg_check_array_len(const struct blob_attr *attr, int type, size_t len)
|
||||
@@ -0,0 +1,61 @@
|
||||
From 31778937b4153492955495e550435c8bbf7cfde8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
|
||||
Date: Tue, 14 Jan 2020 08:55:34 +0100
|
||||
Subject: jshn: prefer snprintf usage
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Better safe than sorry.
|
||||
|
||||
Reviewed-by: Jo-Philipp Wich <jo@mein.io>
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
jshn.c | 16 +++++++++-------
|
||||
1 file changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/jshn.c
|
||||
+++ b/jshn.c
|
||||
@@ -68,7 +68,7 @@ static int add_json_array(struct array_l
|
||||
int ret;
|
||||
|
||||
for (i = 0, len = array_list_length(a); i < len; i++) {
|
||||
- sprintf(seq, "%d", i);
|
||||
+ snprintf(seq, sizeof(seq), "%d", i);
|
||||
ret = add_json_element(seq, array_list_get_idx(a, i));
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -197,25 +197,27 @@ static char *getenv_avl(const char *key)
|
||||
static char *get_keys(const char *prefix)
|
||||
{
|
||||
char *keys;
|
||||
+ size_t len = var_prefix_len + strlen(prefix) + sizeof("K_") + 1;
|
||||
|
||||
- keys = alloca(var_prefix_len + strlen(prefix) + sizeof("K_") + 1);
|
||||
- sprintf(keys, "%sK_%s", var_prefix, prefix);
|
||||
+ keys = alloca(len);
|
||||
+ snprintf(keys, len, "%sK_%s", var_prefix, prefix);
|
||||
return getenv_avl(keys);
|
||||
}
|
||||
|
||||
static void get_var(const char *prefix, const char **name, char **var, char **type)
|
||||
{
|
||||
char *tmpname, *varname;
|
||||
+ size_t len = var_prefix_len + strlen(prefix) + 1 + strlen(*name) + 1 + sizeof("T_");
|
||||
|
||||
- tmpname = alloca(var_prefix_len + strlen(prefix) + 1 + strlen(*name) + 1 + sizeof("T_"));
|
||||
+ tmpname = alloca(len);
|
||||
|
||||
- sprintf(tmpname, "%s%s_%s", var_prefix, prefix, *name);
|
||||
+ snprintf(tmpname, len, "%s%s_%s", var_prefix, prefix, *name);
|
||||
*var = getenv_avl(tmpname);
|
||||
|
||||
- sprintf(tmpname, "%sT_%s_%s", var_prefix, prefix, *name);
|
||||
+ snprintf(tmpname, len, "%sT_%s_%s", var_prefix, prefix, *name);
|
||||
*type = getenv_avl(tmpname);
|
||||
|
||||
- sprintf(tmpname, "%sN_%s_%s", var_prefix, prefix, *name);
|
||||
+ snprintf(tmpname, len, "%sN_%s_%s", var_prefix, prefix, *name);
|
||||
varname = getenv_avl(tmpname);
|
||||
if (varname)
|
||||
*name = varname;
|
||||
@@ -0,0 +1,38 @@
|
||||
From 935bb933e4a74de7326a4373340fd50655712334 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
|
||||
Date: Tue, 14 Jan 2020 08:57:05 +0100
|
||||
Subject: blobmsg: blobmsg_vprintf: prefer vsnprintf
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Better safe than sorry and while at it add handling of possible
|
||||
*printf() failures.
|
||||
|
||||
Reviewed-by: Jo-Philipp Wich <jo@mein.io>
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blobmsg.c | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/blobmsg.c
|
||||
+++ b/blobmsg.c
|
||||
@@ -296,10 +296,17 @@ blobmsg_vprintf(struct blob_buf *buf, co
|
||||
len = vsnprintf(&cbuf, sizeof(cbuf), format, arg2);
|
||||
va_end(arg2);
|
||||
|
||||
+ if (len < 0)
|
||||
+ return -1;
|
||||
+
|
||||
sbuf = blobmsg_alloc_string_buffer(buf, name, len + 1);
|
||||
if (!sbuf)
|
||||
return -1;
|
||||
- ret = vsprintf(sbuf, format, arg);
|
||||
+
|
||||
+ ret = vsnprintf(sbuf, len + 1, format, arg);
|
||||
+ if (ret < 0)
|
||||
+ return -1;
|
||||
+
|
||||
blobmsg_add_string_buffer(buf);
|
||||
|
||||
return ret;
|
||||
@@ -0,0 +1,41 @@
|
||||
From 1cc755d7c3989b399bf0c60535a858d22819ca27 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
|
||||
Date: Sun, 12 Jan 2020 22:40:18 +0100
|
||||
Subject: blobmsg_json: fix int16 serialization
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
int16 blobmsg type is currently being serialized as uint16_t due to
|
||||
missing cast during JSON output.
|
||||
|
||||
Following blobmsg content:
|
||||
|
||||
bar-min: -32768 (i16)
|
||||
bar-max: 32767 (i16)
|
||||
|
||||
Produces following JSON:
|
||||
|
||||
{ "bar-min":32768,"bar-max":32767 }
|
||||
|
||||
Whereas one would expect:
|
||||
|
||||
{ "bar-min":-32768,"bar-max":32767 }
|
||||
|
||||
Reviewed-by: Jo-Philipp Wich <jo@mein.io>
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blobmsg_json.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/blobmsg_json.c
|
||||
+++ b/blobmsg_json.c
|
||||
@@ -250,7 +250,7 @@ static void blobmsg_format_element(struc
|
||||
sprintf(buf, "%s", *(uint8_t *)data ? "true" : "false");
|
||||
break;
|
||||
case BLOBMSG_TYPE_INT16:
|
||||
- sprintf(buf, "%d", be16_to_cpu(*(uint16_t *)data));
|
||||
+ sprintf(buf, "%d", (int16_t) be16_to_cpu(*(uint16_t *)data));
|
||||
break;
|
||||
case BLOBMSG_TYPE_INT32:
|
||||
sprintf(buf, "%d", (int32_t) be32_to_cpu(*(uint32_t *)data));
|
||||
@@ -0,0 +1,66 @@
|
||||
From 0e330ec3662795aea42ac36ecf7a9f32a249c36d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
|
||||
Date: Tue, 14 Jan 2020 09:05:02 +0100
|
||||
Subject: blobmsg_json: prefer snprintf usage
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Better safe than sorry and while at it prefer use of PRId16 and PRId32
|
||||
formatting constants as well.
|
||||
|
||||
Reviewed-by: Jo-Philipp Wich <jo@mein.io>
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blobmsg_json.c | 16 ++++++++--------
|
||||
1 file changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/blobmsg_json.c
|
||||
+++ b/blobmsg_json.c
|
||||
@@ -203,7 +203,7 @@ static void blobmsg_format_string(struct
|
||||
buf[1] = escape;
|
||||
|
||||
if (escape == 'u') {
|
||||
- sprintf(buf + 4, "%02x", (unsigned char) *p);
|
||||
+ snprintf(buf + 4, sizeof(buf) - 4, "%02x", (unsigned char) *p);
|
||||
len = 6;
|
||||
} else {
|
||||
len = 2;
|
||||
@@ -220,7 +220,7 @@ static void blobmsg_format_json_list(str
|
||||
static void blobmsg_format_element(struct strbuf *s, struct blob_attr *attr, bool without_name, bool head)
|
||||
{
|
||||
const char *data_str;
|
||||
- char buf[32];
|
||||
+ char buf[317];
|
||||
void *data;
|
||||
int len;
|
||||
|
||||
@@ -244,22 +244,22 @@ static void blobmsg_format_element(struc
|
||||
data_str = buf;
|
||||
switch(blob_id(attr)) {
|
||||
case BLOBMSG_TYPE_UNSPEC:
|
||||
- sprintf(buf, "null");
|
||||
+ snprintf(buf, sizeof(buf), "null");
|
||||
break;
|
||||
case BLOBMSG_TYPE_BOOL:
|
||||
- sprintf(buf, "%s", *(uint8_t *)data ? "true" : "false");
|
||||
+ snprintf(buf, sizeof(buf), "%s", *(uint8_t *)data ? "true" : "false");
|
||||
break;
|
||||
case BLOBMSG_TYPE_INT16:
|
||||
- sprintf(buf, "%d", (int16_t) be16_to_cpu(*(uint16_t *)data));
|
||||
+ snprintf(buf, sizeof(buf), "%" PRId16, (int16_t) be16_to_cpu(*(uint16_t *)data));
|
||||
break;
|
||||
case BLOBMSG_TYPE_INT32:
|
||||
- sprintf(buf, "%d", (int32_t) be32_to_cpu(*(uint32_t *)data));
|
||||
+ snprintf(buf, sizeof(buf), "%" PRId32, (int32_t) be32_to_cpu(*(uint32_t *)data));
|
||||
break;
|
||||
case BLOBMSG_TYPE_INT64:
|
||||
- sprintf(buf, "%" PRId64, (int64_t) be64_to_cpu(*(uint64_t *)data));
|
||||
+ snprintf(buf, sizeof(buf), "%" PRId64, (int64_t) be64_to_cpu(*(uint64_t *)data));
|
||||
break;
|
||||
case BLOBMSG_TYPE_DOUBLE:
|
||||
- sprintf(buf, "%lf", blobmsg_get_double(attr));
|
||||
+ snprintf(buf, sizeof(buf), "%lf", blobmsg_get_double(attr));
|
||||
break;
|
||||
case BLOBMSG_TYPE_STRING:
|
||||
blobmsg_format_string(s, data);
|
||||
@@ -0,0 +1,110 @@
|
||||
From 6289e2d29883d5d9510b6a15c18c597478967a42 Mon Sep 17 00:00:00 2001
|
||||
From: Juraj Vijtiuk <juraj.vijtiuk@sartura.hr>
|
||||
Date: Sun, 12 Jan 2020 12:26:18 +0100
|
||||
Subject: blobmsg: blobmsg_parse and blobmsg_parse_array oob read fixes
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fix out of bounds read in blobmsg_parse and blobmsg_check_name. The
|
||||
out of bounds read happens because blob_attr and blobmsg_hdr have
|
||||
flexible array members, whose size is 0 in the corresponding sizeofs.
|
||||
For example the __blob_for_each_attr macro checks whether rem >=
|
||||
sizeof(struct blob_attr). However, what LibFuzzer discovered was,
|
||||
if the input data was only 4 bytes, the data would be casted to blob_attr,
|
||||
and later on blob_data(attr) would be called even though attr->data was empty.
|
||||
The same issue could appear with data larger than 4 bytes, where data
|
||||
wasn't empty, but contained only the start of the blobmsg_hdr struct,
|
||||
and blobmsg_hdr name was empty. The bugs were discovered by fuzzing
|
||||
blobmsg_parse and blobmsg_array_parse with LibFuzzer.
|
||||
|
||||
CC: Luka Perkov <luka.perkov@sartura.hr>
|
||||
Reviewed-by: Jo-Philipp Wich <jo@mein.io>
|
||||
Signed-off-by: Juraj Vijtiuk <juraj.vijtiuk@sartura.hr>
|
||||
[refactored some checks, added fuzz inputs, adjusted unit test results]
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
blobmsg.c | 40 ++++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 32 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/blobmsg.c
|
||||
+++ b/blobmsg.c
|
||||
@@ -36,16 +36,38 @@ bool blobmsg_check_attr(const struct blo
|
||||
return blobmsg_check_attr_len(attr, name, blob_raw_len(attr));
|
||||
}
|
||||
|
||||
+static const struct blobmsg_hdr* blobmsg_hdr_from_blob(const struct blob_attr *attr, size_t len)
|
||||
+{
|
||||
+ if (len < sizeof(struct blob_attr) + sizeof(struct blobmsg_hdr))
|
||||
+ return NULL;
|
||||
+
|
||||
+ return blob_data(attr);
|
||||
+}
|
||||
+
|
||||
+static bool blobmsg_hdr_valid_namelen(const struct blobmsg_hdr *hdr, size_t len)
|
||||
+{
|
||||
+ if (len < sizeof(struct blob_attr) + sizeof(struct blobmsg_hdr) + blobmsg_namelen(hdr) + 1)
|
||||
+ return false;
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
static bool blobmsg_check_name(const struct blob_attr *attr, size_t len, bool name)
|
||||
{
|
||||
char *limit = (char *) attr + len;
|
||||
const struct blobmsg_hdr *hdr;
|
||||
|
||||
- hdr = blob_data(attr);
|
||||
+ hdr = blobmsg_hdr_from_blob(attr, len);
|
||||
+ if (!hdr)
|
||||
+ return false;
|
||||
+
|
||||
if (name && !hdr->namelen)
|
||||
return false;
|
||||
|
||||
- if ((char *) hdr->name + blobmsg_namelen(hdr) > limit)
|
||||
+ if (name && !blobmsg_hdr_valid_namelen(hdr, len))
|
||||
+ return false;
|
||||
+
|
||||
+ if ((char *) hdr->name + blobmsg_namelen(hdr) + 1 > limit)
|
||||
return false;
|
||||
|
||||
if (blobmsg_namelen(hdr) > (blob_len(attr) - sizeof(struct blobmsg_hdr)))
|
||||
@@ -79,9 +101,6 @@ bool blobmsg_check_attr_len(const struct
|
||||
size_t data_len;
|
||||
int id;
|
||||
|
||||
- if (len < sizeof(struct blob_attr))
|
||||
- return false;
|
||||
-
|
||||
if (!blobmsg_check_name(attr, len, name))
|
||||
return false;
|
||||
|
||||
@@ -176,11 +195,10 @@ int blobmsg_parse_array(const struct blo
|
||||
return 0;
|
||||
}
|
||||
|
||||
-
|
||||
int blobmsg_parse(const struct blobmsg_policy *policy, int policy_len,
|
||||
struct blob_attr **tb, void *data, unsigned int len)
|
||||
{
|
||||
- struct blobmsg_hdr *hdr;
|
||||
+ const struct blobmsg_hdr *hdr;
|
||||
struct blob_attr *attr;
|
||||
uint8_t *pslen;
|
||||
int i;
|
||||
@@ -197,7 +215,13 @@ int blobmsg_parse(const struct blobmsg_p
|
||||
}
|
||||
|
||||
__blob_for_each_attr(attr, data, len) {
|
||||
- hdr = blob_data(attr);
|
||||
+ hdr = blobmsg_hdr_from_blob(attr, len);
|
||||
+ if (!hdr)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (!blobmsg_hdr_valid_namelen(hdr, len))
|
||||
+ return -1;
|
||||
+
|
||||
for (i = 0; i < policy_len; i++) {
|
||||
if (!policy[i].name)
|
||||
continue;
|
||||
@@ -0,0 +1,33 @@
|
||||
From 75e300aeec25e032a9778bea34c713969960d1f0 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Nisbet <nischris@gmail.com>
|
||||
Date: Wed, 12 Feb 2020 21:00:31 +1300
|
||||
Subject: [PATCH] blobmsg: fix wrong payload len passed from
|
||||
blobmsg_check_array
|
||||
|
||||
Fix incorrect use of blobmsg_len() on passed blobmsg to
|
||||
blobmsg_check_array_len() introduced in commit 379cd33d1992
|
||||
("fix wrong payload len passed from blobmsg_check_array") by using correct
|
||||
blob_len().
|
||||
|
||||
By using blobmsg_len() a value too small was passed to blobmsg_check_array()
|
||||
which could lead to this function returning an error when there is none.
|
||||
|
||||
Fixes: 379cd33d1992 ("fix wrong payload len passed from blobmsg_check_array")
|
||||
Signed-off-by: Chris Nisbet <nischris@gmail.com>
|
||||
[add fixes tag, rewrap commit message]
|
||||
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
---
|
||||
blobmsg.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/blobmsg.c
|
||||
+++ b/blobmsg.c
|
||||
@@ -120,7 +120,7 @@ bool blobmsg_check_attr_len(const struct
|
||||
|
||||
int blobmsg_check_array(const struct blob_attr *attr, int type)
|
||||
{
|
||||
- return blobmsg_check_array_len(attr, type, blobmsg_len(attr));
|
||||
+ return blobmsg_check_array_len(attr, type, blob_len(attr));
|
||||
}
|
||||
|
||||
int blobmsg_check_array_len(const struct blob_attr *attr, int type, size_t len)
|
||||
@@ -0,0 +1,73 @@
|
||||
From 5e75160f48785464f9213c6bc8c72b9372c5318b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Sat, 23 May 2020 13:18:51 +0200
|
||||
Subject: [PATCH] blobmsg: fix attrs iteration in the blobmsg_check_array_len()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Starting with 75e300aeec25 ("blobmsg: fix wrong payload len passed from
|
||||
blobmsg_check_array") blobmsg_check_array_len() gets *blob* length
|
||||
passed as argument. It cannot be used with __blobmsg_for_each_attr()
|
||||
which expects *data* length.
|
||||
|
||||
Use blobmsg_for_each_attr() which calculates *data* length on its own.
|
||||
|
||||
The same bug was already reported in the past and there was fix attempt
|
||||
in the commit cd75136b1342 ("blobmsg: fix wrong payload len passed from
|
||||
blobmsg_check_array"). That change made blobmsg_check_attr_len() calls
|
||||
fail however.
|
||||
|
||||
This is hopefully the correct & complete fix:
|
||||
1. blobmsg_check_array_len() gets *blob* length
|
||||
2. It calls blobmsg_check_attr_len() which requires *blob* length
|
||||
3. It uses blobmsg_for_each_attr() which gets *data* length
|
||||
|
||||
This fixes iterating over random memory treated as attrs. That was
|
||||
resulting in check failing randomly for totally correct blobs. It's
|
||||
critical e.g. for procd project with its instance_fill_array() failing
|
||||
and procd not starting services.
|
||||
|
||||
Fixes: 75e300aeec25 ("blobmsg: fix wrong payload len passed from blobmsg_check_array")
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
blobmsg.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/blobmsg.c
|
||||
+++ b/blobmsg.c
|
||||
@@ -123,16 +123,18 @@ int blobmsg_check_array(const struct blo
|
||||
return blobmsg_check_array_len(attr, type, blob_len(attr));
|
||||
}
|
||||
|
||||
-int blobmsg_check_array_len(const struct blob_attr *attr, int type, size_t len)
|
||||
+int blobmsg_check_array_len(const struct blob_attr *attr, int type,
|
||||
+ size_t blob_len)
|
||||
{
|
||||
struct blob_attr *cur;
|
||||
+ size_t rem;
|
||||
bool name;
|
||||
int size = 0;
|
||||
|
||||
if (type > BLOBMSG_TYPE_LAST)
|
||||
return -1;
|
||||
|
||||
- if (!blobmsg_check_attr_len(attr, false, len))
|
||||
+ if (!blobmsg_check_attr_len(attr, false, blob_len))
|
||||
return -1;
|
||||
|
||||
switch (blobmsg_type(attr)) {
|
||||
@@ -146,11 +148,11 @@ int blobmsg_check_array_len(const struct
|
||||
return -1;
|
||||
}
|
||||
|
||||
- __blobmsg_for_each_attr(cur, attr, len) {
|
||||
+ blobmsg_for_each_attr(cur, attr, rem) {
|
||||
if (type != BLOBMSG_TYPE_UNSPEC && blobmsg_type(cur) != type)
|
||||
return -1;
|
||||
|
||||
- if (!blobmsg_check_attr_len(cur, name, len))
|
||||
+ if (!blobmsg_check_attr_len(cur, name, rem))
|
||||
return -1;
|
||||
|
||||
size++;
|
||||
@@ -0,0 +1,26 @@
|
||||
From c2fc622b771f679e8f55060ac60cfe02b9a80995 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Mon, 25 May 2020 13:44:20 +0200
|
||||
Subject: [PATCH] blobmsg: fix length in blobmsg_check_array
|
||||
|
||||
blobmsg_check_array_len expects the length of the full attribute buffer,
|
||||
not just the data length.
|
||||
Due to other missing length checks (fixed in the next commit), this did
|
||||
not show up as a test failure
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
blobmsg.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/blobmsg.c
|
||||
+++ b/blobmsg.c
|
||||
@@ -120,7 +120,7 @@ bool blobmsg_check_attr_len(const struct
|
||||
|
||||
int blobmsg_check_array(const struct blob_attr *attr, int type)
|
||||
{
|
||||
- return blobmsg_check_array_len(attr, type, blob_len(attr));
|
||||
+ return blobmsg_check_array_len(attr, type, blob_raw_len(attr));
|
||||
}
|
||||
|
||||
int blobmsg_check_array_len(const struct blob_attr *attr, int type,
|
||||
@@ -0,0 +1,47 @@
|
||||
From 639c29d19717616b809d9a1e9042461ab8024370 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Mon, 25 May 2020 14:49:35 +0200
|
||||
Subject: [PATCH] blobmsg: simplify and fix name length checks in
|
||||
blobmsg_check_name
|
||||
|
||||
blobmsg_hdr_valid_namelen was omitted when name==false
|
||||
The blob_len vs blobmsg_namelen changes were not taking into account
|
||||
potential padding between name and data
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
blobmsg.c | 13 ++++---------
|
||||
1 file changed, 4 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/blobmsg.c
|
||||
+++ b/blobmsg.c
|
||||
@@ -54,8 +54,8 @@ static bool blobmsg_hdr_valid_namelen(co
|
||||
|
||||
static bool blobmsg_check_name(const struct blob_attr *attr, size_t len, bool name)
|
||||
{
|
||||
- char *limit = (char *) attr + len;
|
||||
const struct blobmsg_hdr *hdr;
|
||||
+ uint16_t namelen;
|
||||
|
||||
hdr = blobmsg_hdr_from_blob(attr, len);
|
||||
if (!hdr)
|
||||
@@ -64,16 +64,11 @@ static bool blobmsg_check_name(const str
|
||||
if (name && !hdr->namelen)
|
||||
return false;
|
||||
|
||||
- if (name && !blobmsg_hdr_valid_namelen(hdr, len))
|
||||
+ namelen = blobmsg_namelen(hdr);
|
||||
+ if (blob_len(attr) < (size_t)blobmsg_hdrlen(namelen))
|
||||
return false;
|
||||
|
||||
- if ((char *) hdr->name + blobmsg_namelen(hdr) + 1 > limit)
|
||||
- return false;
|
||||
-
|
||||
- if (blobmsg_namelen(hdr) > (blob_len(attr) - sizeof(struct blobmsg_hdr)))
|
||||
- return false;
|
||||
-
|
||||
- if (hdr->name[blobmsg_namelen(hdr)] != 0)
|
||||
+ if (hdr->name[namelen] != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -0,0 +1,137 @@
|
||||
From 66195aee50424cbda0c2d858014e4cc58a2dc029 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Mon, 25 May 2020 12:40:04 +0200
|
||||
Subject: [PATCH] blobmsg: fix missing length checks
|
||||
|
||||
blobmsg_check_attr_len was calling blobmsg_check_data for some, but not all
|
||||
attribute types. These checks was missing for arrays and tables.
|
||||
|
||||
Additionally, the length check in blobmsg_check_data was a bit off, since
|
||||
it was comparing the blobmsg data length against the raw blob attr length.
|
||||
|
||||
Fix this by checking the raw blob length against the buffer length in
|
||||
blobmsg_hdr_from_blob
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
blobmsg.c | 66 +++++++++++++++++--------------------------------------
|
||||
1 file changed, 20 insertions(+), 46 deletions(-)
|
||||
|
||||
--- a/blobmsg.c
|
||||
+++ b/blobmsg.c
|
||||
@@ -36,31 +36,18 @@ bool blobmsg_check_attr(const struct blo
|
||||
return blobmsg_check_attr_len(attr, name, blob_raw_len(attr));
|
||||
}
|
||||
|
||||
-static const struct blobmsg_hdr* blobmsg_hdr_from_blob(const struct blob_attr *attr, size_t len)
|
||||
-{
|
||||
- if (len < sizeof(struct blob_attr) + sizeof(struct blobmsg_hdr))
|
||||
- return NULL;
|
||||
-
|
||||
- return blob_data(attr);
|
||||
-}
|
||||
-
|
||||
-static bool blobmsg_hdr_valid_namelen(const struct blobmsg_hdr *hdr, size_t len)
|
||||
-{
|
||||
- if (len < sizeof(struct blob_attr) + sizeof(struct blobmsg_hdr) + blobmsg_namelen(hdr) + 1)
|
||||
- return false;
|
||||
-
|
||||
- return true;
|
||||
-}
|
||||
-
|
||||
-static bool blobmsg_check_name(const struct blob_attr *attr, size_t len, bool name)
|
||||
+static bool blobmsg_check_name(const struct blob_attr *attr, bool name)
|
||||
{
|
||||
const struct blobmsg_hdr *hdr;
|
||||
uint16_t namelen;
|
||||
|
||||
- hdr = blobmsg_hdr_from_blob(attr, len);
|
||||
- if (!hdr)
|
||||
+ if (!blob_is_extended(attr))
|
||||
+ return !name;
|
||||
+
|
||||
+ if (blob_len(attr) < sizeof(struct blobmsg_hdr))
|
||||
return false;
|
||||
|
||||
+ hdr = (const struct blobmsg_hdr *)blob_data(attr);
|
||||
if (name && !hdr->namelen)
|
||||
return false;
|
||||
|
||||
@@ -74,29 +61,20 @@ static bool blobmsg_check_name(const str
|
||||
return true;
|
||||
}
|
||||
|
||||
-static const char* blobmsg_check_data(const struct blob_attr *attr, size_t len, size_t *data_len)
|
||||
-{
|
||||
- char *limit = (char *) attr + len;
|
||||
- const char *data;
|
||||
-
|
||||
- *data_len = blobmsg_data_len(attr);
|
||||
- if (*data_len > blob_raw_len(attr))
|
||||
- return NULL;
|
||||
-
|
||||
- data = blobmsg_data(attr);
|
||||
- if (data + *data_len > limit)
|
||||
- return NULL;
|
||||
-
|
||||
- return data;
|
||||
-}
|
||||
-
|
||||
bool blobmsg_check_attr_len(const struct blob_attr *attr, bool name, size_t len)
|
||||
{
|
||||
const char *data;
|
||||
size_t data_len;
|
||||
int id;
|
||||
|
||||
- if (!blobmsg_check_name(attr, len, name))
|
||||
+ if (len < sizeof(struct blob_attr))
|
||||
+ return false;
|
||||
+
|
||||
+ data_len = blob_raw_len(attr);
|
||||
+ if (data_len < sizeof(struct blob_attr) || data_len > len)
|
||||
+ return false;
|
||||
+
|
||||
+ if (!blobmsg_check_name(attr, name))
|
||||
return false;
|
||||
|
||||
id = blob_id(attr);
|
||||
@@ -106,9 +84,8 @@ bool blobmsg_check_attr_len(const struct
|
||||
if (!blob_type[id])
|
||||
return true;
|
||||
|
||||
- data = blobmsg_check_data(attr, len, &data_len);
|
||||
- if (!data)
|
||||
- return false;
|
||||
+ data = blobmsg_data(attr);
|
||||
+ data_len = blobmsg_data_len(attr);
|
||||
|
||||
return blob_check_type(data, data_len, blob_type[id]);
|
||||
}
|
||||
@@ -212,13 +189,13 @@ int blobmsg_parse(const struct blobmsg_p
|
||||
}
|
||||
|
||||
__blob_for_each_attr(attr, data, len) {
|
||||
- hdr = blobmsg_hdr_from_blob(attr, len);
|
||||
- if (!hdr)
|
||||
+ if (!blobmsg_check_attr_len(attr, false, len))
|
||||
return -1;
|
||||
|
||||
- if (!blobmsg_hdr_valid_namelen(hdr, len))
|
||||
- return -1;
|
||||
+ if (!blob_is_extended(attr))
|
||||
+ continue;
|
||||
|
||||
+ hdr = blob_data(attr);
|
||||
for (i = 0; i < policy_len; i++) {
|
||||
if (!policy[i].name)
|
||||
continue;
|
||||
@@ -230,9 +207,6 @@ int blobmsg_parse(const struct blobmsg_p
|
||||
if (blobmsg_namelen(hdr) != pslen[i])
|
||||
continue;
|
||||
|
||||
- if (!blobmsg_check_attr_len(attr, true, len))
|
||||
- return -1;
|
||||
-
|
||||
if (tb[i])
|
||||
continue;
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mbedtls
|
||||
PKG_VERSION:=2.16.3
|
||||
PKG_VERSION:=2.16.8
|
||||
PKG_RELEASE:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-gpl.tgz
|
||||
PKG_SOURCE_URL:=https://tls.mbed.org/download/
|
||||
PKG_HASH:=fd01fe4b289116df7781d05e1ef712b6c98823c5334f4a27404f13a8d066ef6a
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=fe9e3b15c3375943bdfebbbb20dd6b4f1147b3b5d926248bd835d73247407430
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_LICENSE:=GPL-2.0+
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/include/mbedtls/config.h
|
||||
+++ b/include/mbedtls/config.h
|
||||
@@ -633,14 +633,14 @@
|
||||
@@ -692,14 +692,14 @@
|
||||
*
|
||||
* Enable Output Feedback mode (OFB) for symmetric ciphers.
|
||||
*/
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_CIPHER_NULL_CIPHER
|
||||
@@ -750,19 +750,19 @@
|
||||
@@ -816,19 +816,19 @@
|
||||
*
|
||||
* Comment macros to disable the curve and functions for it
|
||||
*/
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_ECP_NIST_OPTIM
|
||||
@@ -811,7 +811,7 @@
|
||||
@@ -899,7 +899,7 @@
|
||||
*
|
||||
* Comment this macro to disable deterministic ECDSA.
|
||||
*/
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
|
||||
@@ -864,7 +864,7 @@
|
||||
@@ -952,7 +952,7 @@
|
||||
* See dhm.h for more details.
|
||||
*
|
||||
*/
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
|
||||
@@ -884,7 +884,7 @@
|
||||
@@ -972,7 +972,7 @@
|
||||
* MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA
|
||||
* MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA
|
||||
*/
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
|
||||
@@ -909,7 +909,7 @@
|
||||
@@ -997,7 +997,7 @@
|
||||
* MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA
|
||||
* MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA
|
||||
*/
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
|
||||
@@ -1043,7 +1043,7 @@
|
||||
@@ -1131,7 +1131,7 @@
|
||||
* MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
|
||||
* MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
|
||||
*/
|
||||
@@ -91,7 +91,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
|
||||
@@ -1067,7 +1067,7 @@
|
||||
@@ -1155,7 +1155,7 @@
|
||||
* MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256
|
||||
* MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384
|
||||
*/
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
||||
@@ -1171,7 +1171,7 @@
|
||||
@@ -1259,7 +1259,7 @@
|
||||
* This option is only useful if both MBEDTLS_SHA256_C and
|
||||
* MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used.
|
||||
*/
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_ENTROPY_NV_SEED
|
||||
@@ -1266,14 +1266,14 @@
|
||||
@@ -1354,14 +1354,14 @@
|
||||
* Uncomment this macro to disable the use of CRT in RSA.
|
||||
*
|
||||
*/
|
||||
@@ -126,7 +126,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SHA256_SMALLER
|
||||
@@ -1289,7 +1289,7 @@
|
||||
@@ -1377,7 +1377,7 @@
|
||||
*
|
||||
* Uncomment to enable the smaller implementation of SHA256.
|
||||
*/
|
||||
@@ -135,7 +135,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_ALL_ALERT_MESSAGES
|
||||
@@ -1427,7 +1427,7 @@
|
||||
@@ -1515,7 +1515,7 @@
|
||||
* configuration of this extension).
|
||||
*
|
||||
*/
|
||||
@@ -144,7 +144,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
|
||||
@@ -1602,7 +1602,7 @@
|
||||
@@ -1690,7 +1690,7 @@
|
||||
*
|
||||
* Comment this macro to disable support for SSL session tickets
|
||||
*/
|
||||
@@ -153,7 +153,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_EXPORT_KEYS
|
||||
@@ -1632,7 +1632,7 @@
|
||||
@@ -1720,7 +1720,7 @@
|
||||
*
|
||||
* Comment this macro to disable support for truncated HMAC in SSL
|
||||
*/
|
||||
@@ -162,7 +162,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT
|
||||
@@ -1691,7 +1691,7 @@
|
||||
@@ -1779,7 +1779,7 @@
|
||||
*
|
||||
* Comment this to disable run-time checking and save ROM space
|
||||
*/
|
||||
@@ -171,7 +171,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
|
||||
@@ -2021,7 +2021,7 @@
|
||||
@@ -2109,7 +2109,7 @@
|
||||
* MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
|
||||
* MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
|
||||
*/
|
||||
@@ -180,7 +180,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_ARIA_C
|
||||
@@ -2087,7 +2087,7 @@
|
||||
@@ -2175,7 +2175,7 @@
|
||||
* This module enables the AES-CCM ciphersuites, if other requisites are
|
||||
* enabled as well.
|
||||
*/
|
||||
@@ -189,7 +189,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_CERTS_C
|
||||
@@ -2099,7 +2099,7 @@
|
||||
@@ -2187,7 +2187,7 @@
|
||||
*
|
||||
* This module is used for testing (ssl_client/server).
|
||||
*/
|
||||
@@ -198,7 +198,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_CHACHA20_C
|
||||
@@ -2108,7 +2108,7 @@
|
||||
@@ -2196,7 +2196,7 @@
|
||||
*
|
||||
* Module: library/chacha20.c
|
||||
*/
|
||||
@@ -207,7 +207,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_CHACHAPOLY_C
|
||||
@@ -2119,7 +2119,7 @@
|
||||
@@ -2207,7 +2207,7 @@
|
||||
*
|
||||
* This module requires: MBEDTLS_CHACHA20_C, MBEDTLS_POLY1305_C
|
||||
*/
|
||||
@@ -216,7 +216,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_CIPHER_C
|
||||
@@ -2174,7 +2174,7 @@
|
||||
@@ -2266,7 +2266,7 @@
|
||||
*
|
||||
* This module provides debugging functions.
|
||||
*/
|
||||
@@ -225,7 +225,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_DES_C
|
||||
@@ -2203,7 +2203,7 @@
|
||||
@@ -2295,7 +2295,7 @@
|
||||
* \warning DES is considered a weak cipher and its use constitutes a
|
||||
* security risk. We recommend considering stronger ciphers instead.
|
||||
*/
|
||||
@@ -234,7 +234,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_DHM_C
|
||||
@@ -2366,7 +2366,7 @@
|
||||
@@ -2458,7 +2458,7 @@
|
||||
* This module adds support for the Hashed Message Authentication Code
|
||||
* (HMAC)-based key derivation function (HKDF).
|
||||
*/
|
||||
@@ -243,7 +243,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_HMAC_DRBG_C
|
||||
@@ -2380,7 +2380,7 @@
|
||||
@@ -2472,7 +2472,7 @@
|
||||
*
|
||||
* Uncomment to enable the HMAC_DRBG random number geerator.
|
||||
*/
|
||||
@@ -252,7 +252,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_NIST_KW_C
|
||||
@@ -2676,7 +2676,7 @@
|
||||
@@ -2768,7 +2768,7 @@
|
||||
*
|
||||
* This module enables abstraction of common (libc) functions.
|
||||
*/
|
||||
@@ -261,7 +261,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_POLY1305_C
|
||||
@@ -2686,7 +2686,7 @@
|
||||
@@ -2778,7 +2778,7 @@
|
||||
* Module: library/poly1305.c
|
||||
* Caller: library/chachapoly.c
|
||||
*/
|
||||
@@ -270,7 +270,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_RIPEMD160_C
|
||||
@@ -2697,7 +2697,7 @@
|
||||
@@ -2789,7 +2789,7 @@
|
||||
* Caller: library/md.c
|
||||
*
|
||||
*/
|
||||
@@ -279,7 +279,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_RSA_C
|
||||
@@ -2804,7 +2804,7 @@
|
||||
@@ -2896,7 +2896,7 @@
|
||||
*
|
||||
* Requires: MBEDTLS_CIPHER_C
|
||||
*/
|
||||
@@ -288,7 +288,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_CLI_C
|
||||
@@ -2904,7 +2904,7 @@
|
||||
@@ -2996,7 +2996,7 @@
|
||||
*
|
||||
* This module provides run-time version information.
|
||||
*/
|
||||
@@ -297,7 +297,7 @@
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_X509_USE_C
|
||||
@@ -3014,7 +3014,7 @@
|
||||
@@ -3106,7 +3106,7 @@
|
||||
* Module: library/xtea.c
|
||||
* Caller:
|
||||
*/
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
if(USE_SHARED_MBEDTLS_LIBRARY)
|
||||
add_library(mbedcrypto SHARED ${src_crypto})
|
||||
- set_target_properties(mbedcrypto PROPERTIES VERSION 2.16.3 SOVERSION 3)
|
||||
+ set_target_properties(mbedcrypto PROPERTIES VERSION 2.12.0 SOVERSION 1)
|
||||
- set_target_properties(mbedcrypto PROPERTIES VERSION 2.16.8 SOVERSION 3)
|
||||
+ set_target_properties(mbedcrypto PROPERTIES VERSION 2.16.8 SOVERSION 1)
|
||||
target_link_libraries(mbedcrypto ${libs})
|
||||
|
||||
add_library(mbedx509 SHARED ${src_x509})
|
||||
@@ -13,8 +13,8 @@
|
||||
target_link_libraries(mbedx509 ${libs} mbedcrypto)
|
||||
|
||||
add_library(mbedtls SHARED ${src_tls})
|
||||
- set_target_properties(mbedtls PROPERTIES VERSION 2.16.3 SOVERSION 12)
|
||||
+ set_target_properties(mbedtls PROPERTIES VERSION 2.12.0 SOVERSION 10)
|
||||
- set_target_properties(mbedtls PROPERTIES VERSION 2.16.8 SOVERSION 12)
|
||||
+ set_target_properties(mbedtls PROPERTIES VERSION 2.16.8 SOVERSION 10)
|
||||
target_link_libraries(mbedtls ${libs} mbedx509)
|
||||
|
||||
install(TARGETS mbedtls mbedx509 mbedcrypto
|
||||
|
||||
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=openssl
|
||||
PKG_BASE:=1.0.2
|
||||
PKG_BUGFIX:=t
|
||||
PKG_BUGFIX:=u
|
||||
PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX)
|
||||
PKG_RELEASE:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
@@ -24,7 +24,7 @@ PKG_SOURCE_URL:= \
|
||||
http://gd.tuwien.ac.at/infosys/security/openssl/source/ \
|
||||
http://www.openssl.org/source/ \
|
||||
http://www.openssl.org/source/old/$(PKG_BASE)/
|
||||
PKG_HASH:=14cb464efe7ac6b54799b34456bd69558a749a4931ecfd9cf9f71d7881cac7bc
|
||||
PKG_HASH:=ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16
|
||||
|
||||
PKG_LICENSE:=OpenSSL
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=firewall
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall3.git
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From c9f48cb3bd0e14fec8ad71c3baef7c280a390b4f Mon Sep 17 00:00:00 2001
|
||||
From: Yousong Zhou <yszhou4tech@gmail.com>
|
||||
Date: Fri, 24 Jul 2020 12:52:59 +0800
|
||||
Subject: [PATCH] zones: apply tcp mss clamping also on ingress path
|
||||
|
||||
Fixes FS#3231
|
||||
|
||||
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
||||
Acked-by: Jo-Philipp Wich <jo@mein.io>
|
||||
(cherry picked from commit e9b90dfac2225927c035f6a76277b850c282dc9a)
|
||||
---
|
||||
zones.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/zones.c b/zones.c
|
||||
index 505ab20..4656f88 100644
|
||||
--- a/zones.c
|
||||
+++ b/zones.c
|
||||
@@ -553,6 +553,14 @@ print_interface_rule(struct fw3_ipt_handle *handle, struct fw3_state *state,
|
||||
fw3_ipt_rule_target(r, "TCPMSS");
|
||||
fw3_ipt_rule_addarg(r, false, "--clamp-mss-to-pmtu", NULL);
|
||||
fw3_ipt_rule_replace(r, "FORWARD");
|
||||
+
|
||||
+ r = fw3_ipt_rule_create(handle, &tcp, dev, NULL, sub, NULL);
|
||||
+ fw3_ipt_rule_addarg(r, false, "--tcp-flags", "SYN,RST");
|
||||
+ fw3_ipt_rule_addarg(r, false, "SYN", NULL);
|
||||
+ fw3_ipt_rule_comment(r, "Zone %s MTU fixing", zone->name);
|
||||
+ fw3_ipt_rule_target(r, "TCPMSS");
|
||||
+ fw3_ipt_rule_addarg(r, false, "--clamp-mss-to-pmtu", NULL);
|
||||
+ fw3_ipt_rule_replace(r, "FORWARD");
|
||||
}
|
||||
}
|
||||
else if (handle->table == FW3_TABLE_RAW)
|
||||
@@ -0,0 +1,38 @@
|
||||
From 78d52a28c66ad0fd2af250038fdcf4239ad37bf2 Mon Sep 17 00:00:00 2001
|
||||
From: Remi NGUYEN VAN <remi.nguyenvan+openwrt@gmail.com>
|
||||
Date: Sat, 15 Aug 2020 13:50:27 +0900
|
||||
Subject: [PATCH] options: fix parsing of boolean attributes
|
||||
|
||||
Boolean attributes were parsed the same way as string attributes,
|
||||
so a value of { "bool_attr": "true" } would be parsed correctly, but
|
||||
{ "bool_attr": true } (without quotes) was parsed as false.
|
||||
|
||||
Fixes FS#3284
|
||||
|
||||
Signed-off-by: Remi NGUYEN VAN <remi.nguyenvan+openwrt@gmail.com>
|
||||
---
|
||||
options.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
--- a/options.c
|
||||
+++ b/options.c
|
||||
@@ -1170,6 +1170,9 @@ fw3_parse_blob_options(void *s, const st
|
||||
if (blobmsg_type(e) == BLOBMSG_TYPE_INT32) {
|
||||
snprintf(buf, sizeof(buf), "%d", blobmsg_get_u32(e));
|
||||
v = buf;
|
||||
+ } else if (blobmsg_type(o) == BLOBMSG_TYPE_BOOL) {
|
||||
+ snprintf(buf, sizeof(buf), "%d", blobmsg_get_bool(o));
|
||||
+ v = buf;
|
||||
} else {
|
||||
v = blobmsg_get_string(e);
|
||||
}
|
||||
@@ -1189,6 +1192,9 @@ fw3_parse_blob_options(void *s, const st
|
||||
if (blobmsg_type(o) == BLOBMSG_TYPE_INT32) {
|
||||
snprintf(buf, sizeof(buf), "%d", blobmsg_get_u32(o));
|
||||
v = buf;
|
||||
+ } else if (blobmsg_type(o) == BLOBMSG_TYPE_BOOL) {
|
||||
+ snprintf(buf, sizeof(buf), "%d", blobmsg_get_bool(o));
|
||||
+ v = buf;
|
||||
} else {
|
||||
v = blobmsg_get_string(o);
|
||||
}
|
||||
@@ -46,6 +46,8 @@ proto_dhcp_setup() {
|
||||
json_for_each_item proto_dhcp_add_sendopts sendopts dhcpopts
|
||||
|
||||
[ -z "$hostname" ] && hostname="$(cat /proc/sys/kernel/hostname)"
|
||||
[ "$hostname" = "*" ] && hostname=
|
||||
|
||||
[ "$defaultreqopts" = 0 ] && defaultreqopts="-o" || defaultreqopts=
|
||||
[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
|
||||
[ "$release" = 1 ] && release="-R" || release=
|
||||
|
||||
@@ -88,9 +88,6 @@ DRIVER_MAKEOPTS= \
|
||||
CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \
|
||||
CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
|
||||
|
||||
space :=
|
||||
space +=
|
||||
|
||||
ifeq ($(LOCAL_VARIANT),full)
|
||||
DRIVER_MAKEOPTS += CONFIG_IEEE80211W=$(CONFIG_DRIVER_11W_SUPPORT)
|
||||
endif
|
||||
|
||||
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ppp
|
||||
PKG_VERSION:=2.4.7
|
||||
PKG_RELEASE:=12
|
||||
PKG_RELEASE:=13
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://download.samba.org/pub/ppp/
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From 858976b1fc3107f1261aae337831959b511b83c2 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Mackerras <paulus@ozlabs.org>
|
||||
Date: Sat, 4 Jan 2020 12:01:32 +1100
|
||||
Subject: [PATCH] radius: Prevent buffer overflow in rc_mksid()
|
||||
|
||||
On some systems getpid() can return a value greater than 65535.
|
||||
Increase the size of buf[] to allow for this, and use slprintf()
|
||||
to make sure we never overflow it.
|
||||
|
||||
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
|
||||
---
|
||||
pppd/plugins/radius/util.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pppd/plugins/radius/util.c b/pppd/plugins/radius/util.c
|
||||
index 6f976a712951..740131e8377c 100644
|
||||
--- a/pppd/plugins/radius/util.c
|
||||
+++ b/pppd/plugins/radius/util.c
|
||||
@@ -73,9 +73,9 @@ void rc_mdelay(int msecs)
|
||||
char *
|
||||
rc_mksid (void)
|
||||
{
|
||||
- static char buf[15];
|
||||
+ static char buf[32];
|
||||
static unsigned short int cnt = 0;
|
||||
- sprintf (buf, "%08lX%04X%02hX",
|
||||
+ slprintf(buf, sizeof(buf), "%08lX%04X%02hX",
|
||||
(unsigned long int) time (NULL),
|
||||
(unsigned int) getpid (),
|
||||
cnt & 0xFF);
|
||||
@@ -0,0 +1,37 @@
|
||||
From 8d7970b8f3db727fe798b65f3377fe6787575426 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Mackerras <paulus@ozlabs.org>
|
||||
Date: Mon, 3 Feb 2020 15:53:28 +1100
|
||||
Subject: [PATCH] pppd: Fix bounds check in EAP code
|
||||
|
||||
Given that we have just checked vallen < len, it can never be the case
|
||||
that vallen >= len + sizeof(rhostname). This fixes the check so we
|
||||
actually avoid overflowing the rhostname array.
|
||||
|
||||
Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
|
||||
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
|
||||
---
|
||||
pppd/eap.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pppd/eap.c b/pppd/eap.c
|
||||
index 94407f56a336..1b93db01aebd 100644
|
||||
--- a/pppd/eap.c
|
||||
+++ b/pppd/eap.c
|
||||
@@ -1420,7 +1420,7 @@ int len;
|
||||
}
|
||||
|
||||
/* Not so likely to happen. */
|
||||
- if (vallen >= len + sizeof (rhostname)) {
|
||||
+ if (len - vallen >= sizeof (rhostname)) {
|
||||
dbglog("EAP: trimming really long peer name down");
|
||||
BCOPY(inp + vallen, rhostname, sizeof (rhostname) - 1);
|
||||
rhostname[sizeof (rhostname) - 1] = '\0';
|
||||
@@ -1846,7 +1846,7 @@ int len;
|
||||
}
|
||||
|
||||
/* Not so likely to happen. */
|
||||
- if (vallen >= len + sizeof (rhostname)) {
|
||||
+ if (len - vallen >= sizeof (rhostname)) {
|
||||
dbglog("EAP: trimming really long peer name down");
|
||||
BCOPY(inp + vallen, rhostname, sizeof (rhostname) - 1);
|
||||
rhostname[sizeof (rhostname) - 1] = '\0';
|
||||
@@ -0,0 +1,61 @@
|
||||
From 8d45443bb5c9372b4c6a362ba2f443d41c5636af Mon Sep 17 00:00:00 2001
|
||||
From: Paul Mackerras <paulus@ozlabs.org>
|
||||
Date: Mon, 3 Feb 2020 16:31:42 +1100
|
||||
Subject: [PATCH] pppd: Ignore received EAP messages when not doing EAP
|
||||
|
||||
This adds some basic checks to the subroutines of eap_input to check
|
||||
that we have requested or agreed to doing EAP authentication before
|
||||
doing any processing on the received packet. The motivation is to
|
||||
make it harder for a malicious peer to disrupt the operation of pppd
|
||||
by sending unsolicited EAP packets. Note that eap_success() already
|
||||
has a check that the EAP client state is reasonable, and does nothing
|
||||
(apart from possibly printing a debug message) if not.
|
||||
|
||||
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
|
||||
---
|
||||
pppd/eap.c | 18 ++++++++++++++++++
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
diff --git a/pppd/eap.c b/pppd/eap.c
|
||||
index 1b93db01aebd..082e95343120 100644
|
||||
--- a/pppd/eap.c
|
||||
+++ b/pppd/eap.c
|
||||
@@ -1328,6 +1328,12 @@ int len;
|
||||
int fd;
|
||||
#endif /* USE_SRP */
|
||||
|
||||
+ /*
|
||||
+ * Ignore requests if we're not open
|
||||
+ */
|
||||
+ if (esp->es_client.ea_state <= eapClosed)
|
||||
+ return;
|
||||
+
|
||||
/*
|
||||
* Note: we update es_client.ea_id *only if* a Response
|
||||
* message is being generated. Otherwise, we leave it the
|
||||
@@ -1736,6 +1742,12 @@ int len;
|
||||
u_char dig[SHA_DIGESTSIZE];
|
||||
#endif /* USE_SRP */
|
||||
|
||||
+ /*
|
||||
+ * Ignore responses if we're not open
|
||||
+ */
|
||||
+ if (esp->es_server.ea_state <= eapClosed)
|
||||
+ return;
|
||||
+
|
||||
if (esp->es_server.ea_id != id) {
|
||||
dbglog("EAP: discarding Response %d; expected ID %d", id,
|
||||
esp->es_server.ea_id);
|
||||
@@ -2047,6 +2059,12 @@ u_char *inp;
|
||||
int id;
|
||||
int len;
|
||||
{
|
||||
+ /*
|
||||
+ * Ignore failure messages if we're not open
|
||||
+ */
|
||||
+ if (esp->es_client.ea_state <= eapClosed)
|
||||
+ return;
|
||||
+
|
||||
if (!eap_client_active(esp)) {
|
||||
dbglog("EAP unexpected failure message in state %s (%d)",
|
||||
eap_state_name(esp->es_client.ea_state),
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=relayd
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/relayd.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2016-02-07
|
||||
PKG_SOURCE_VERSION:=ad0b25ad74345d367c62311e14b279f5ccb8ef13
|
||||
PKG_MIRROR_HASH:=8818e9da8cc056961f21f1569e06e63b840965d1453dfcef70a8d84ea76f84d7
|
||||
PKG_SOURCE_DATE:=2020-04-25
|
||||
PKG_SOURCE_VERSION:=f4d759be54ceb37714e9a6ca320d5b50c95e9ce9
|
||||
PKG_MIRROR_HASH:=b1ff6e99072867be0975ba0be52ba9da3a876c8b8da893d68301e8238243a51e
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=uhttpd
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git
|
||||
PKG_SOURCE_DATE:=2018-11-28
|
||||
PKG_SOURCE_VERSION:=cdfc902a4cb77bc538a729f9e1c8a8578454a0e5
|
||||
PKG_MIRROR_HASH:=6b21111547a4453355bd6c941a47f0116a652a77d87c1e05a035168b8ab2aa6f
|
||||
PKG_SOURCE_DATE:=2020-02-12
|
||||
PKG_SOURCE_VERSION:=2ee323c01079248baa9465969df9e25b5fb68cdf
|
||||
PKG_MIRROR_HASH:=ebec09286cf5f977cac893931a5a4f27ba891db88d5e44a9b0de9446ae431527
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=ISC
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/mdnsd.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2018-01-02
|
||||
PKG_SOURCE_VERSION:=78974417e182a3de8f78b7d73366ec0c98396b6c
|
||||
PKG_MIRROR_HASH:=a60f9eb9428ac3256cd7c3c6d4207c116cedf4d212b82e2f86c1bf7c7898fcbb
|
||||
PKG_SOURCE_DATE:=2020-04-25
|
||||
PKG_SOURCE_VERSION:=cdac0460ba50dc45735f0be2e19a5a8efc3dafe1
|
||||
PKG_MIRROR_HASH:=261cb929dfc03c1f293156cfdec8c2cd1541dcdc57ae42a323f9df5d26e6f7d2
|
||||
|
||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||
PKG_LICENSE:=LGPL-2.1
|
||||
@@ -30,7 +30,7 @@ define Package/umdns
|
||||
DEPENDS:=+libubox +libubus +libblobmsg-json
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -Wno-address-of-packed-member
|
||||
|
||||
define Package/umdns/conffiles
|
||||
/etc/config/umdns
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2016-2018 Jason A. Donenfeld <Jason@zx2c4.com>
|
||||
# Copyright (C) 2016-2019 Jason A. Donenfeld <Jason@zx2c4.com>
|
||||
# Copyright (C) 2016 Baptiste Jonglez <openwrt@bitsofnetworks.org>
|
||||
# Copyright (C) 2016-2017 Dan Luedtke <mail@danrl.com>
|
||||
#
|
||||
@@ -11,17 +11,17 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=wireguard
|
||||
|
||||
PKG_VERSION:=0.0.20190601
|
||||
PKG_VERSION:=1.0.20200611
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/
|
||||
PKG_HASH:=7528461824a0174bd7d4f15e68d8f0ce9a8ea318411502b80759438e8ef65568
|
||||
PKG_SOURCE:=wireguard-linux-compat-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-linux-compat/snapshot/
|
||||
PKG_HASH:=9b0478c3b1f3a7b488916e632e2fcbb1383bb1a2ef294489858ce2ba1da3246d
|
||||
|
||||
PKG_LICENSE:=GPL-2.0 Apache-2.0
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/WireGuard-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/wireguard-linux-compat-$(PKG_VERSION)
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
@@ -57,13 +57,8 @@ endef
|
||||
include $(INCLUDE_DIR)/kernel-defaults.mk
|
||||
include $(INCLUDE_DIR)/package-defaults.mk
|
||||
|
||||
# Used by Build/Compile/Default
|
||||
MAKE_PATH:=src/tools
|
||||
MAKE_VARS += PLATFORM=linux
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) $(KERNEL_MAKEOPTS) M="$(PKG_BUILD_DIR)/src" modules
|
||||
$(call Build/Compile/Default)
|
||||
endef
|
||||
|
||||
define Package/wireguard/install
|
||||
@@ -74,27 +69,6 @@ define Package/wireguard/description
|
||||
$(call Package/wireguard/Default/description)
|
||||
endef
|
||||
|
||||
define Package/wireguard-tools
|
||||
$(call Package/wireguard/Default)
|
||||
TITLE:=WireGuard userspace control program (wg)
|
||||
DEPENDS:=+libmnl +ip
|
||||
endef
|
||||
|
||||
define Package/wireguard-tools/description
|
||||
$(call Package/wireguard/Default/description)
|
||||
|
||||
This package provides the userspace control program for WireGuard,
|
||||
`wg(8)`, a netifd protocol helper, and a re-resolve watchdog script.
|
||||
endef
|
||||
|
||||
define Package/wireguard-tools/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/tools/wg $(1)/usr/bin/
|
||||
$(INSTALL_BIN) ./files/wireguard_watchdog $(1)/usr/bin/
|
||||
$(INSTALL_DIR) $(1)/lib/netifd/proto/
|
||||
$(INSTALL_BIN) ./files/wireguard.sh $(1)/lib/netifd/proto/
|
||||
endef
|
||||
|
||||
define KernelPackage/wireguard
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
@@ -112,5 +86,4 @@ define KernelPackage/wireguard/description
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,wireguard))
|
||||
$(eval $(call BuildPackage,wireguard-tools))
|
||||
$(eval $(call KernelPackage,wireguard))
|
||||
|
||||
@@ -23,7 +23,7 @@ PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
PKG_CONFIG_DEPENDS:=ETHTOOL_PRETTY_DUMP
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_ETHTOOL_PRETTY_DUMP
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
54
package/network/utils/wireguard-tools/Makefile
Normal file
54
package/network/utils/wireguard-tools/Makefile
Normal file
@@ -0,0 +1,54 @@
|
||||
#
|
||||
# Copyright (C) 2016-2019 Jason A. Donenfeld <Jason@zx2c4.com>
|
||||
# Copyright (C) 2016 Baptiste Jonglez <openwrt@bitsofnetworks.org>
|
||||
# Copyright (C) 2016-2017 Dan Luedtke <mail@danrl.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=wireguard-tools
|
||||
|
||||
PKG_VERSION:=1.0.20191226
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=wireguard-tools-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-tools/snapshot/
|
||||
PKG_HASH:=aa8af0fdc9872d369d8c890a84dbc2a2466b55795dccd5b47721b2d97644b04f
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/package-defaults.mk
|
||||
|
||||
MAKE_PATH:=src
|
||||
MAKE_VARS += PLATFORM=linux
|
||||
|
||||
define Package/wireguard-tools
|
||||
$(call Package/wireguard/Default)
|
||||
TITLE:=WireGuard userspace control program (wg)
|
||||
DEPENDS:=+libmnl +ip
|
||||
endef
|
||||
|
||||
define Package/wireguard-tools/description
|
||||
$(call Package/wireguard/Default/description)
|
||||
|
||||
This package provides the userspace control program for WireGuard,
|
||||
`wg(8)`, a netifd protocol helper, and a re-resolve watchdog script.
|
||||
endef
|
||||
|
||||
define Package/wireguard-tools/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wg $(1)/usr/bin/
|
||||
$(INSTALL_BIN) ./files/wireguard_watchdog $(1)/usr/bin/
|
||||
$(INSTALL_DIR) $(1)/lib/netifd/proto/
|
||||
$(INSTALL_BIN) ./files/wireguard.sh $(1)/lib/netifd/proto/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,wireguard-tools))
|
||||
@@ -7,14 +7,14 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ca-certificates
|
||||
PKG_VERSION:=20190110
|
||||
PKG_VERSION:=20200601
|
||||
PKG_RELEASE:=1
|
||||
PKG_MAINTAINER:=
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/c/ca-certificates
|
||||
PKG_HASH:=ee4bf0f4c6398005f5b5ca4e0b87b82837ac5c3b0280a1cb3a63c47555c3a675
|
||||
|
||||
PKG_HASH:=43766d5a436519503dfd65ab83488ae33ab4d4ca3d0993797b58c92eb9ed4e63
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/work
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fstools
|
||||
PKG_RELEASE:=5
|
||||
PKG_RELEASE:=6
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git
|
||||
|
||||
56
package/system/fstools/patches/000-fix-ntfs-uuid.patch
Normal file
56
package/system/fstools/patches/000-fix-ntfs-uuid.patch
Normal file
@@ -0,0 +1,56 @@
|
||||
From d05276dc1d6de119da518d62930b9a8ef55ef7e9 Mon Sep 17 00:00:00 2001
|
||||
From: Yousong Zhou <yszhou4tech@gmail.com>
|
||||
Date: Fri, 25 Oct 2019 10:48:47 +0000
|
||||
Subject: [PATCH] libblkid-tiny: ntfs: fix use-after-free
|
||||
|
||||
The memory pointed to by ns can be reallocated when checking mft records
|
||||
|
||||
Fixes FS#2129
|
||||
|
||||
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
||||
---
|
||||
libblkid-tiny/ntfs.c | 12 +++++++-----
|
||||
1 file changed, 7 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/libblkid-tiny/ntfs.c
|
||||
+++ b/libblkid-tiny/ntfs.c
|
||||
@@ -88,6 +88,7 @@ static int probe_ntfs(blkid_probe pr, co
|
||||
|
||||
uint32_t sectors_per_cluster, mft_record_size;
|
||||
uint16_t sector_size;
|
||||
+ uint64_t volume_serial;
|
||||
uint64_t nr_clusters, off; //, attr_off;
|
||||
unsigned char *buf_mft;
|
||||
|
||||
@@ -148,15 +149,16 @@ static int probe_ntfs(blkid_probe pr, co
|
||||
return 1;
|
||||
|
||||
|
||||
+ volume_serial = ns->volume_serial;
|
||||
off = le64_to_cpu(ns->mft_cluster_location) * sector_size *
|
||||
sectors_per_cluster;
|
||||
|
||||
DBG(LOWPROBE, ul_debug("NTFS: sector_size=%"PRIu16", mft_record_size=%"PRIu32", "
|
||||
"sectors_per_cluster=%"PRIu32", nr_clusters=%"PRIu64" "
|
||||
- "cluster_offset=%"PRIu64"",
|
||||
+ "cluster_offset=%"PRIu64", volume_serial=%"PRIu64"",
|
||||
sector_size, mft_record_size,
|
||||
sectors_per_cluster, nr_clusters,
|
||||
- off));
|
||||
+ off, volume_serial));
|
||||
|
||||
buf_mft = blkid_probe_get_buffer(pr, off, mft_record_size);
|
||||
if (!buf_mft)
|
||||
@@ -207,9 +209,9 @@ static int probe_ntfs(blkid_probe pr, co
|
||||
#endif
|
||||
|
||||
blkid_probe_sprintf_uuid(pr,
|
||||
- (unsigned char *) &ns->volume_serial,
|
||||
- sizeof(ns->volume_serial),
|
||||
- "%016" PRIX64, le64_to_cpu(ns->volume_serial));
|
||||
+ (unsigned char *) &volume_serial,
|
||||
+ sizeof(volume_serial),
|
||||
+ "%016" PRIX64, le64_to_cpu(volume_serial));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ PKG_FLAGS:=essential
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://git.openwrt.org/project/opkg-lede.git
|
||||
PKG_SOURCE_DATE:=2019-06-14
|
||||
PKG_SOURCE_VERSION:=dcbc142e51f5f5f2fb9e4e44657e013d3c36a52b
|
||||
PKG_MIRROR_HASH:=fca7e71dd06f0d5ee0af0d0a493d641d4d5d7e403d64c67879a462a020aa2299
|
||||
PKG_SOURCE_DATE:=2020-01-25
|
||||
PKG_SOURCE_VERSION:=c09fe2098718807ddbca13ee36e3e38801822946
|
||||
PKG_MIRROR_HASH:=b2fba519fb3bf2da2e325a33eee951b85c7c1886e48ebaac3892435a71ae33d5
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rpcd
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
|
||||
PKG_SOURCE_DATE:=2018-11-28
|
||||
PKG_SOURCE_VERSION:=3aa81d0dfae167eccc26203bd0c96f3e3450f253
|
||||
PKG_SOURCE_DATE:=2020-05-26
|
||||
PKG_SOURCE_VERSION:=7be1f17138f19d1d7a86e0c27b3662d3643ff296
|
||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
PKG_MIRROR_HASH:=1befc5e1793a687e7a37b4f4d611e5f95aef4b79ad4b288c4dcb4c74d212509b
|
||||
PKG_MIRROR_HASH:=b427b2be8ebd486edbc88f6e789d1890cbdda1b4f04dcfcc8751f568c3a82674
|
||||
|
||||
PKG_LICENSE:=ISC
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=uci
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uci.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
From a3e650911f5e6f67dcff09974df3775dfd615da6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
|
||||
Date: Sat, 3 Oct 2020 01:29:21 +0200
|
||||
Subject: [PATCH] file: uci_parse_package: fix heap use after free
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fixes following issue which is caused by usage of pointer which pointed
|
||||
to a reallocated address:
|
||||
|
||||
ERROR: AddressSanitizer: heap-use-after-free on address 0x619000000087 at pc 0x000000509aa7 bp 0x7ffd6b9c3c40 sp 0x7ffd6b9c3400
|
||||
READ of size 2 at 0x619000000087 thread T0
|
||||
#0 0x509aa6 in strdup (test-fuzz+0x509aa6)
|
||||
#1 0x7fc36d2a1636 in uci_strdup util.c:60:8
|
||||
#2 0x7fc36d29e1ac in uci_alloc_generic list.c:55:13
|
||||
#3 0x7fc36d29e241 in uci_alloc_package list.c:253:6
|
||||
#4 0x7fc36d2a0ba3 in uci_switch_config file.c:375:18
|
||||
#5 0x7fc36d2a09b8 in uci_parse_package file.c:397:2
|
||||
#6 0x7fc36d2a09b8 in uci_parse_line file.c:513:6
|
||||
#7 0x7fc36d2a09b8 in uci_import file.c:681:4
|
||||
|
||||
0x619000000087 is located 7 bytes inside of 1024-byte region [0x619000000080,0x619000000480)
|
||||
freed by thread T0 here:
|
||||
#0 0x51daa9 in realloc (test-fuzz+0x51daa9)
|
||||
#1 0x7fc36d2a1612 in uci_realloc util.c:49:8
|
||||
|
||||
previously allocated by thread T0 here:
|
||||
#0 0x51daa9 in realloc (test-fuzz+0x51daa9)
|
||||
#1 0x7fc36d2a1612 in uci_realloc util.c:49:8
|
||||
|
||||
Reported-by: Jeremy Galindo <jgalindo@datto.com>
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
file.c | 2 +-
|
||||
...sig-06,src-000079,time-22005942,op-ext_AO,pos-8 | Bin 0 -> 56 bytes
|
||||
2 files changed, 1 insertion(+), 1 deletion(-)
|
||||
create mode 100644 tests/fuzz/corpus/id-000000,sig-06,src-000079,time-22005942,op-ext_AO,pos-8
|
||||
|
||||
--- a/file.c
|
||||
+++ b/file.c
|
||||
@@ -387,8 +387,8 @@ static void uci_parse_package(struct uci
|
||||
pctx->pos += strlen(pctx_cur_str(pctx)) + 1;
|
||||
|
||||
ofs_name = next_arg(ctx, true, true, true);
|
||||
- name = pctx_str(pctx, ofs_name);
|
||||
assert_eol(ctx);
|
||||
+ name = pctx_str(pctx, ofs_name);
|
||||
if (single)
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
From eae126f66663e5c73e5d290b8e3134449489340f Mon Sep 17 00:00:00 2001
|
||||
From: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Date: Sun, 4 Oct 2020 17:14:49 +0200
|
||||
Subject: [PATCH] file: Check buffer size after strtok()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This fixes a heap overflow in the parsing of the uci line.
|
||||
|
||||
The line which is parsed and put into pctx->buf is null terminated and
|
||||
stored on the heap. In the uci_parse_line() function we use strtok() to
|
||||
split this string in multiple parts after divided by a space or tab.
|
||||
strtok() replaces these characters with a NULL byte. If the next byte is
|
||||
NULL we assume that this NULL byte was added by strtok() and try to
|
||||
parse the string after this NULL byte. If this NULL byte was not added
|
||||
by strtok(), but by fgets() to mark the end of the string we would read
|
||||
over this end of the string in uninitialized memory and later over the
|
||||
allocated buffer.
|
||||
|
||||
Fix this problem by storing how long the line we read was and check if
|
||||
we would read over the end of the string here.
|
||||
|
||||
This also adds the input which detected this crash to the corpus of the
|
||||
fuzzer.
|
||||
|
||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
[fixed merge conflict in tests]
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
file.c | 19 ++++++++++++++++---
|
||||
tests/cram/test-san_uci_import.t | 1 +
|
||||
tests/cram/test_uci_import.t | 1 +
|
||||
.../2e18ecc3a759dedc9357b1298e9269eccc5c5a6b | 1 +
|
||||
uci_internal.h | 1 +
|
||||
5 files changed, 20 insertions(+), 3 deletions(-)
|
||||
create mode 100644 tests/fuzz/corpus/2e18ecc3a759dedc9357b1298e9269eccc5c5a6b
|
||||
|
||||
--- a/file.c
|
||||
+++ b/file.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <glob.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
+#include <errno.h>
|
||||
|
||||
#include "uci.h"
|
||||
#include "uci_internal.h"
|
||||
@@ -63,6 +64,7 @@ __private void uci_getln(struct uci_cont
|
||||
return;
|
||||
|
||||
ofs += strlen(p);
|
||||
+ pctx->buf_filled = ofs;
|
||||
if (pctx->buf[ofs - 1] == '\n') {
|
||||
pctx->line++;
|
||||
return;
|
||||
@@ -120,6 +122,15 @@ static inline void addc(struct uci_conte
|
||||
*pos_src += 1;
|
||||
}
|
||||
|
||||
+static int uci_increase_pos(struct uci_parse_context *pctx, size_t add)
|
||||
+{
|
||||
+ if (pctx->pos + add > pctx->buf_filled)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ pctx->pos += add;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* parse a double quoted string argument from the command line
|
||||
*/
|
||||
@@ -384,7 +395,8 @@ static void uci_parse_package(struct uci
|
||||
char *name;
|
||||
|
||||
/* command string null-terminated by strtok */
|
||||
- pctx->pos += strlen(pctx_cur_str(pctx)) + 1;
|
||||
+ if (uci_increase_pos(pctx, strlen(pctx_cur_str(pctx)) + 1))
|
||||
+ uci_parse_error(ctx, "package without name");
|
||||
|
||||
ofs_name = next_arg(ctx, true, true, true);
|
||||
assert_eol(ctx);
|
||||
@@ -416,7 +428,8 @@ static void uci_parse_config(struct uci_
|
||||
}
|
||||
|
||||
/* command string null-terminated by strtok */
|
||||
- pctx->pos += strlen(pctx_cur_str(pctx)) + 1;
|
||||
+ if (uci_increase_pos(pctx, strlen(pctx_cur_str(pctx)) + 1))
|
||||
+ uci_parse_error(ctx, "config without name");
|
||||
|
||||
ofs_type = next_arg(ctx, true, false, false);
|
||||
type = pctx_str(pctx, ofs_type);
|
||||
@@ -466,7 +479,8 @@ static void uci_parse_option(struct uci_
|
||||
uci_parse_error(ctx, "option/list command found before the first section");
|
||||
|
||||
/* command string null-terminated by strtok */
|
||||
- pctx->pos += strlen(pctx_cur_str(pctx)) + 1;
|
||||
+ if (uci_increase_pos(pctx, strlen(pctx_cur_str(pctx)) + 1))
|
||||
+ uci_parse_error(ctx, "option without name");
|
||||
|
||||
ofs_name = next_arg(ctx, true, true, false);
|
||||
ofs_value = next_arg(ctx, false, false, false);
|
||||
--- a/uci_internal.h
|
||||
+++ b/uci_internal.h
|
||||
@@ -33,6 +33,7 @@ struct uci_parse_context
|
||||
const char *name;
|
||||
char *buf;
|
||||
int bufsz;
|
||||
+ size_t buf_filled;
|
||||
int pos;
|
||||
};
|
||||
#define pctx_pos(pctx) ((pctx)->pos)
|
||||
@@ -5,9 +5,9 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/usign.git
|
||||
PKG_SOURCE_DATE:=2019-08-06
|
||||
PKG_SOURCE_VERSION:=5a52b379902471cef495687547c7b568142f66d2
|
||||
PKG_MIRROR_HASH:=9779f6d6718a7f7cd3e28aa7feefc9b3f4b0c7a85cb58ff18afbeb6b4372177a
|
||||
PKG_SOURCE_DATE:=2020-05-23
|
||||
PKG_SOURCE_VERSION:=f1f65026a94137c91b5466b149ef3ea3f20091e9
|
||||
PKG_MIRROR_HASH:=3f6569a5e63fdfd032976ac0f79d736d3935101ac1b97fb370514b013c5e6bb6
|
||||
CMAKE_INSTALL:=1
|
||||
PKG_CHECK_FORMAT_SECURITY:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=e2fsprogs
|
||||
PKG_VERSION:=1.44.1
|
||||
PKG_HASH:=0ca164c1c87724df904c918b2d7051ef989b51de725db66c67514dbe6dd2b9ef
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
From 09fe1fd2a1f9efc3091b4fc61f1876d0785956a8 Mon Sep 17 00:00:00 2001
|
||||
From: Theodore Ts'o <tytso@mit.edu>
|
||||
Date: Sun, 1 Sep 2019 00:59:16 -0400
|
||||
Subject: libsupport: add checks to prevent buffer overrun bugs in quota code
|
||||
|
||||
A maliciously corrupted file systems can trigger buffer overruns in
|
||||
the quota code used by e2fsck. To fix this, add sanity checks to the
|
||||
quota header fields as well as to block number references in the quota
|
||||
tree.
|
||||
|
||||
Addresses: CVE-2019-5094
|
||||
Addresses: TALOS-2019-0887
|
||||
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
||||
(cherry picked from commit 8dbe7b475ec5e91ed767239f0e85880f416fc384)
|
||||
---
|
||||
lib/support/mkquota.c | 1 +
|
||||
lib/support/quotaio_tree.c | 71 ++++++++++++++++++++++++++++++----------------
|
||||
lib/support/quotaio_v2.c | 28 ++++++++++++++++++
|
||||
3 files changed, 76 insertions(+), 24 deletions(-)
|
||||
|
||||
--- a/lib/support/mkquota.c
|
||||
+++ b/lib/support/mkquota.c
|
||||
@@ -663,6 +663,7 @@ errcode_t quota_compare_and_update(quota
|
||||
err = qh.qh_ops->scan_dquots(&qh, scan_dquots_callback, &scan_data);
|
||||
if (err) {
|
||||
log_debug("Error scanning dquots");
|
||||
+ *usage_inconsistent = 1;
|
||||
goto out_close_qh;
|
||||
}
|
||||
|
||||
--- a/lib/support/quotaio_tree.c
|
||||
+++ b/lib/support/quotaio_tree.c
|
||||
@@ -540,6 +540,17 @@ struct dquot *qtree_read_dquot(struct qu
|
||||
return dquot;
|
||||
}
|
||||
|
||||
+static int check_reference(struct quota_handle *h, unsigned int blk)
|
||||
+{
|
||||
+ if (blk >= h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks) {
|
||||
+ log_err("Illegal reference (%u >= %u) in %s quota file",
|
||||
+ blk, h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks,
|
||||
+ quota_type2name(h->qh_type));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Scan all dquots in file and call callback on each
|
||||
*/
|
||||
@@ -558,7 +569,7 @@ static int report_block(struct dquot *dq
|
||||
int entries, i;
|
||||
|
||||
if (!buf)
|
||||
- return 0;
|
||||
+ return -1;
|
||||
|
||||
set_bit(bitmap, blk);
|
||||
read_blk(dquot->dq_h, blk, buf);
|
||||
@@ -580,23 +591,12 @@ static int report_block(struct dquot *dq
|
||||
return entries;
|
||||
}
|
||||
|
||||
-static void check_reference(struct quota_handle *h, unsigned int blk)
|
||||
-{
|
||||
- if (blk >= h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks)
|
||||
- log_err("Illegal reference (%u >= %u) in %s quota file. "
|
||||
- "Quota file is probably corrupted.\n"
|
||||
- "Please run e2fsck (8) to fix it.",
|
||||
- blk,
|
||||
- h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks,
|
||||
- quota_type2name(h->qh_type));
|
||||
-}
|
||||
-
|
||||
static int report_tree(struct dquot *dquot, unsigned int blk, int depth,
|
||||
char *bitmap,
|
||||
int (*process_dquot) (struct dquot *, void *),
|
||||
void *data)
|
||||
{
|
||||
- int entries = 0, i;
|
||||
+ int entries = 0, ret, i;
|
||||
dqbuf_t buf = getdqbuf();
|
||||
__le32 *ref = (__le32 *) buf;
|
||||
|
||||
@@ -607,22 +607,40 @@ static int report_tree(struct dquot *dqu
|
||||
if (depth == QT_TREEDEPTH - 1) {
|
||||
for (i = 0; i < QT_BLKSIZE >> 2; i++) {
|
||||
blk = ext2fs_le32_to_cpu(ref[i]);
|
||||
- check_reference(dquot->dq_h, blk);
|
||||
- if (blk && !get_bit(bitmap, blk))
|
||||
- entries += report_block(dquot, blk, bitmap,
|
||||
- process_dquot, data);
|
||||
+ if (check_reference(dquot->dq_h, blk)) {
|
||||
+ entries = -1;
|
||||
+ goto errout;
|
||||
+ }
|
||||
+ if (blk && !get_bit(bitmap, blk)) {
|
||||
+ ret = report_block(dquot, blk, bitmap,
|
||||
+ process_dquot, data);
|
||||
+ if (ret < 0) {
|
||||
+ entries = ret;
|
||||
+ goto errout;
|
||||
+ }
|
||||
+ entries += ret;
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < QT_BLKSIZE >> 2; i++) {
|
||||
blk = ext2fs_le32_to_cpu(ref[i]);
|
||||
if (blk) {
|
||||
- check_reference(dquot->dq_h, blk);
|
||||
- entries += report_tree(dquot, blk, depth + 1,
|
||||
- bitmap, process_dquot,
|
||||
- data);
|
||||
+ if (check_reference(dquot->dq_h, blk)) {
|
||||
+ entries = -1;
|
||||
+ goto errout;
|
||||
+ }
|
||||
+ ret = report_tree(dquot, blk, depth + 1,
|
||||
+ bitmap, process_dquot,
|
||||
+ data);
|
||||
+ if (ret < 0) {
|
||||
+ entries = ret;
|
||||
+ goto errout;
|
||||
+ }
|
||||
+ entries += ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
+errout:
|
||||
freedqbuf(buf);
|
||||
return entries;
|
||||
}
|
||||
@@ -642,6 +660,7 @@ int qtree_scan_dquots(struct quota_handl
|
||||
int (*process_dquot) (struct dquot *, void *),
|
||||
void *data)
|
||||
{
|
||||
+ int ret;
|
||||
char *bitmap;
|
||||
struct v2_mem_dqinfo *v2info = &h->qh_info.u.v2_mdqi;
|
||||
struct qtree_mem_dqinfo *info = &v2info->dqi_qtree;
|
||||
@@ -655,10 +674,14 @@ int qtree_scan_dquots(struct quota_handl
|
||||
ext2fs_free_mem(&dquot);
|
||||
return -1;
|
||||
}
|
||||
- v2info->dqi_used_entries = report_tree(dquot, QT_TREEOFF, 0, bitmap,
|
||||
- process_dquot, data);
|
||||
+ ret = report_tree(dquot, QT_TREEOFF, 0, bitmap, process_dquot, data);
|
||||
+ if (ret < 0)
|
||||
+ goto errout;
|
||||
+ v2info->dqi_used_entries = ret;
|
||||
v2info->dqi_data_blocks = find_set_bits(bitmap, info->dqi_blocks);
|
||||
+ ret = 0;
|
||||
+errout:
|
||||
ext2fs_free_mem(&bitmap);
|
||||
ext2fs_free_mem(&dquot);
|
||||
- return 0;
|
||||
+ return ret;
|
||||
}
|
||||
--- a/lib/support/quotaio_v2.c
|
||||
+++ b/lib/support/quotaio_v2.c
|
||||
@@ -175,6 +175,8 @@ static int v2_check_file(struct quota_ha
|
||||
static int v2_init_io(struct quota_handle *h)
|
||||
{
|
||||
struct v2_disk_dqinfo ddqinfo;
|
||||
+ struct v2_mem_dqinfo *info;
|
||||
+ __u64 filesize;
|
||||
|
||||
h->qh_info.u.v2_mdqi.dqi_qtree.dqi_entry_size =
|
||||
sizeof(struct v2r1_disk_dqblk);
|
||||
@@ -185,6 +187,32 @@ static int v2_init_io(struct quota_handl
|
||||
sizeof(ddqinfo)) != sizeof(ddqinfo))
|
||||
return -1;
|
||||
v2_disk2memdqinfo(&h->qh_info, &ddqinfo);
|
||||
+
|
||||
+ /* Check to make sure quota file info is sane */
|
||||
+ info = &h->qh_info.u.v2_mdqi;
|
||||
+ if (ext2fs_file_get_lsize(h->qh_qf.e2_file, &filesize))
|
||||
+ return -1;
|
||||
+ if ((filesize > (1U << 31)) ||
|
||||
+ (info->dqi_qtree.dqi_blocks >
|
||||
+ (filesize + QT_BLKSIZE - 1) >> QT_BLKSIZE_BITS)) {
|
||||
+ log_err("Quota inode %u corrupted: file size %llu; "
|
||||
+ "dqi_blocks %u", h->qh_qf.ino,
|
||||
+ filesize, info->dqi_qtree.dqi_blocks);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (info->dqi_qtree.dqi_free_blk >= info->dqi_qtree.dqi_blocks) {
|
||||
+ log_err("Quota inode %u corrupted: free_blk %u; dqi_blocks %u",
|
||||
+ h->qh_qf.ino, info->dqi_qtree.dqi_free_blk,
|
||||
+ info->dqi_qtree.dqi_blocks);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (info->dqi_qtree.dqi_free_entry >= info->dqi_qtree.dqi_blocks) {
|
||||
+ log_err("Quota inode %u corrupted: free_entry %u; "
|
||||
+ "dqi_blocks %u", h->qh_qf.ino,
|
||||
+ info->dqi_qtree.dqi_free_entry,
|
||||
+ info->dqi_qtree.dqi_blocks);
|
||||
+ return -1;
|
||||
+ }
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=lua
|
||||
PKG_VERSION:=5.1.5
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
diff --git a/src/lnum.c b/src/lnum.c
|
||||
index 1456b6a2ed23..b0632b04c2b7 100644
|
||||
--- a/src/lnum.c
|
||||
+++ b/src/lnum.c
|
||||
@@ -127,6 +127,8 @@ static int luaO_str2i (const char *s, lua_Integer *res, char **endptr_ref) {
|
||||
#else
|
||||
return 0; /* Reject the number */
|
||||
#endif
|
||||
+ } else if (v > LUA_INTEGER_MAX) {
|
||||
+ return TK_NUMBER;
|
||||
}
|
||||
} else if ((v > LUA_INTEGER_MAX) || (*endptr && (!isspace(*endptr)))) {
|
||||
return TK_NUMBER; /* not in signed range, or has '.', 'e' etc. trailing */
|
||||
@@ -310,3 +312,13 @@ int try_unmint( lua_Integer *r, lua_Integer ib ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#ifdef LONG_OVERFLOW_LUA_INTEGER
|
||||
+unsigned LUA_INTEGER lua_str2ul( const char *str, char **endptr, int base ) {
|
||||
+ unsigned long v= strtoul(str, endptr, base);
|
||||
+ if ( v > LUA_INTEGER_MAX ) {
|
||||
+ errno= ERANGE;
|
||||
+ v= ULONG_MAX;
|
||||
+ }
|
||||
+ return (unsigned LUA_INTEGER)v;
|
||||
+}
|
||||
+#endif
|
||||
diff --git a/src/lnum_config.h b/src/lnum_config.h
|
||||
index 19d7a4231a49..1092eead6629 100644
|
||||
--- a/src/lnum_config.h
|
||||
+++ b/src/lnum_config.h
|
||||
@@ -141,7 +141,12 @@
|
||||
#endif
|
||||
|
||||
#ifndef lua_str2ul
|
||||
-# define lua_str2ul (unsigned LUA_INTEGER)strtoul
|
||||
+# if LONG_MAX > LUA_INTEGER_MAX
|
||||
+# define LONG_OVERFLOW_LUA_INTEGER
|
||||
+ unsigned LUA_INTEGER lua_str2ul( const char *str, char **endptr, int base );
|
||||
+# else
|
||||
+# define lua_str2ul (unsigned LUA_INTEGER)strtoul
|
||||
+# endif
|
||||
#endif
|
||||
#ifndef LUA_INTEGER_MIN
|
||||
# define LUA_INTEGER_MIN (-LUA_INTEGER_MAX -1) /* -2^16|32 */
|
||||
--
|
||||
1.9.1
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
--- a/src/lnum.c
|
||||
+++ b/src/lnum.c
|
||||
@@ -127,6 +127,8 @@ static int luaO_str2i (const char *s, lu
|
||||
#else
|
||||
return 0; /* Reject the number */
|
||||
#endif
|
||||
+ } else if (v > LUA_INTEGER_MAX) {
|
||||
+ return TK_NUMBER;
|
||||
}
|
||||
} else if ((v > LUA_INTEGER_MAX) || (*endptr && (!isspace(*endptr)))) {
|
||||
return TK_NUMBER; /* not in signed range, or has '.', 'e' etc. trailing */
|
||||
@@ -310,3 +312,13 @@ int try_unmint( lua_Integer *r, lua_Inte
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#ifdef LONG_OVERFLOW_LUA_INTEGER
|
||||
+unsigned LUA_INTEGER lua_str2ul( const char *str, char **endptr, int base ) {
|
||||
+ unsigned long v= strtoul(str, endptr, base);
|
||||
+ if ( v > LUA_INTEGER_MAX ) {
|
||||
+ errno= ERANGE;
|
||||
+ v= ULONG_MAX;
|
||||
+ }
|
||||
+ return (unsigned LUA_INTEGER)v;
|
||||
+}
|
||||
+#endif
|
||||
--- a/src/lnum_config.h
|
||||
+++ b/src/lnum_config.h
|
||||
@@ -141,7 +141,12 @@
|
||||
#endif
|
||||
|
||||
#ifndef lua_str2ul
|
||||
-# define lua_str2ul (unsigned LUA_INTEGER)strtoul
|
||||
+# if LONG_MAX > LUA_INTEGER_MAX
|
||||
+# define LONG_OVERFLOW_LUA_INTEGER
|
||||
+ unsigned LUA_INTEGER lua_str2ul( const char *str, char **endptr, int base );
|
||||
+# else
|
||||
+# define lua_str2ul (unsigned LUA_INTEGER)strtoul
|
||||
+# endif
|
||||
#endif
|
||||
#ifndef LUA_INTEGER_MIN
|
||||
# define LUA_INTEGER_MIN (-LUA_INTEGER_MAX -1) /* -2^16|32 */
|
||||
@@ -197,6 +197,7 @@ foreach my $mirror (@ARGV) {
|
||||
push @mirrors, "https://mirror.netcologne.de/apache.org/$1";
|
||||
push @mirrors, "https://mirror.aarnet.edu.au/pub/apache/$1";
|
||||
push @mirrors, "https://mirror.csclub.uwaterloo.ca/apache/$1";
|
||||
push @mirrors, "https://archive.apache.org/dist/$1";
|
||||
push @mirrors, "http://mirror.cogentco.com/pub/apache/$1";
|
||||
push @mirrors, "http://mirror.navercorp.com/apache/$1";
|
||||
push @mirrors, "http://ftp.jaist.ac.jp/pub/apache/$1";
|
||||
|
||||
@@ -26,7 +26,7 @@ try_git() {
|
||||
*)
|
||||
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||
ORIGIN="$(git rev-parse --verify --symbolic-full-name ${BRANCH}@{u} 2>/dev/null)"
|
||||
[ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name master@{u} 2>/dev/null)"
|
||||
[ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name openwrt-18.06@{u} 2>/dev/null)"
|
||||
REV="$(git rev-list ${REBOOT}..$GET_REV | wc -l | awk '{print $1}')"
|
||||
|
||||
if [ -n "$ORIGIN" ]; then
|
||||
|
||||
@@ -67,7 +67,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -973,7 +973,7 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -969,7 +969,7 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
|
||||
sa->sa_command_1.bf.hash_crypto_offset = 0;
|
||||
pd->pd_ctl.w = ctx->pd_ctl;
|
||||
|
||||
@@ -18,7 +18,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -1125,7 +1125,9 @@ struct crypto4xx_alg_common crypto4xx_al
|
||||
@@ -1121,7 +1121,9 @@ struct crypto4xx_alg_common crypto4xx_al
|
||||
.cra_name = "cbc(aes)",
|
||||
.cra_driver_name = "cbc-aes-ppc4xx",
|
||||
.cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
|
||||
|
||||
@@ -14,7 +14,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -1090,7 +1090,6 @@ static void crypto4xx_bh_tasklet_cb(unsi
|
||||
@@ -1086,7 +1086,6 @@ static void crypto4xx_bh_tasklet_cb(unsi
|
||||
pd->pd_ctl.bf.pe_done = 0;
|
||||
crypto4xx_pd_done(core_dev->dev, tail);
|
||||
crypto4xx_put_pd_to_pdr(core_dev->dev, tail);
|
||||
|
||||
@@ -109,7 +109,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
#include <crypto/sha.h>
|
||||
#include "crypto4xx_reg_def.h"
|
||||
#include "crypto4xx_core.h"
|
||||
@@ -1144,6 +1145,103 @@ struct crypto4xx_alg_common crypto4xx_al
|
||||
@@ -1140,6 +1141,103 @@ struct crypto4xx_alg_common crypto4xx_al
|
||||
}
|
||||
}
|
||||
}},
|
||||
|
||||
@@ -27,7 +27,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
#include "crypto4xx_reg_def.h"
|
||||
#include "crypto4xx_core.h"
|
||||
#include "crypto4xx_sa.h"
|
||||
@@ -483,111 +484,44 @@ static inline struct ce_sd *crypto4xx_ge
|
||||
@@ -479,111 +480,44 @@ static inline struct ce_sd *crypto4xx_ge
|
||||
return (struct ce_sd *)(dev->sdr + sizeof(struct ce_sd) * idx);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
- dev->scatter_buffer_size * PPC4XX_NUM_SD,
|
||||
+ PPC4XX_SD_BUFFER_SIZE * PPC4XX_NUM_SD,
|
||||
&dev->scatter_buffer_pa, GFP_ATOMIC);
|
||||
if (!dev->scatter_buffer_va) {
|
||||
dma_free_coherent(dev->core_dev->device,
|
||||
@@ -412,7 +411,7 @@ static u32 crypto4xx_build_sdr(struct cr
|
||||
if (!dev->scatter_buffer_va)
|
||||
return -ENOMEM;
|
||||
@@ -408,7 +407,7 @@ static u32 crypto4xx_build_sdr(struct cr
|
||||
|
||||
for (i = 0; i < PPC4XX_NUM_SD; i++) {
|
||||
sd_array[i].ptr = dev->scatter_buffer_pa +
|
||||
@@ -38,7 +38,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -427,7 +426,7 @@ static void crypto4xx_destroy_sdr(struct
|
||||
@@ -423,7 +422,7 @@ static void crypto4xx_destroy_sdr(struct
|
||||
|
||||
if (dev->scatter_buffer_va)
|
||||
dma_free_coherent(dev->core_dev->device,
|
||||
|
||||
@@ -171,9 +171,9 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
|
||||
/* alloc memory for scatter descriptor ring */
|
||||
dev->sdr = dma_alloc_coherent(dev->core_dev->device,
|
||||
@@ -407,10 +403,8 @@ static u32 crypto4xx_build_sdr(struct cr
|
||||
@@ -403,10 +399,8 @@ static u32 crypto4xx_build_sdr(struct cr
|
||||
if (!dev->scatter_buffer_va)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
- sd_array = dev->sdr;
|
||||
-
|
||||
@@ -183,7 +183,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
PPC4XX_SD_BUFFER_SIZE * i;
|
||||
}
|
||||
|
||||
@@ -480,7 +474,7 @@ static inline struct ce_sd *crypto4xx_ge
|
||||
@@ -476,7 +470,7 @@ static inline struct ce_sd *crypto4xx_ge
|
||||
{
|
||||
*sd_dma = dev->sdr_pa + sizeof(struct ce_sd) * idx;
|
||||
|
||||
@@ -192,7 +192,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
}
|
||||
|
||||
static void crypto4xx_copy_pkt_to_dst(struct crypto4xx_device *dev,
|
||||
@@ -529,11 +523,10 @@ static u32 crypto4xx_copy_digest_to_dst(
|
||||
@@ -525,11 +519,10 @@ static u32 crypto4xx_copy_digest_to_dst(
|
||||
struct crypto4xx_ctx *ctx)
|
||||
{
|
||||
struct dynamic_sa_ctl *sa = (struct dynamic_sa_ctl *) ctx->sa_in;
|
||||
@@ -206,7 +206,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
SA_HASH_ALG_SHA1_DIGEST_SIZE);
|
||||
}
|
||||
|
||||
@@ -616,11 +609,9 @@ static u32 crypto4xx_ahash_done(struct c
|
||||
@@ -612,11 +605,9 @@ static u32 crypto4xx_ahash_done(struct c
|
||||
|
||||
static u32 crypto4xx_pd_done(struct crypto4xx_device *dev, u32 idx)
|
||||
{
|
||||
@@ -220,7 +220,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
if (crypto_tfm_alg_type(pd_uinfo->async_req->tfm) ==
|
||||
CRYPTO_ALG_TYPE_ABLKCIPHER)
|
||||
return crypto4xx_ablkcipher_done(dev, pd_uinfo, pd);
|
||||
@@ -721,7 +712,6 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -717,7 +708,6 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
unsigned long flags;
|
||||
struct pd_uinfo *pd_uinfo = NULL;
|
||||
unsigned int nbytes = datalen, idx;
|
||||
@@ -228,7 +228,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
u32 gd_idx = 0;
|
||||
|
||||
/* figure how many gd is needed */
|
||||
@@ -780,17 +770,15 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -776,17 +766,15 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->core_dev->lock, flags);
|
||||
|
||||
@@ -248,7 +248,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
if (ctx->direction == DIR_INBOUND)
|
||||
memcpy(sa, ctx->sa_in, ctx->sa_len * 4);
|
||||
else
|
||||
@@ -800,14 +788,15 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -796,14 +784,15 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
&pd_uinfo->sr_pa, 4);
|
||||
|
||||
if (iv_len)
|
||||
@@ -267,7 +267,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
}
|
||||
}
|
||||
pd->sa_len = ctx->sa_len;
|
||||
@@ -1015,9 +1004,8 @@ static void crypto4xx_bh_tasklet_cb(unsi
|
||||
@@ -1011,9 +1000,8 @@ static void crypto4xx_bh_tasklet_cb(unsi
|
||||
|
||||
while (core_dev->dev->pdr_head != core_dev->dev->pdr_tail) {
|
||||
tail = core_dev->dev->pdr_tail;
|
||||
|
||||
@@ -38,7 +38,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -1157,7 +1157,7 @@ struct crypto4xx_alg_common crypto4xx_al
|
||||
@@ -1153,7 +1153,7 @@ struct crypto4xx_alg_common crypto4xx_al
|
||||
.min_keysize = AES_MIN_KEY_SIZE,
|
||||
.max_keysize = AES_MAX_KEY_SIZE,
|
||||
.ivsize = AES_IV_SIZE,
|
||||
|
||||
@@ -56,7 +56,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
#include "crypto4xx_reg_def.h"
|
||||
#include "crypto4xx_core.h"
|
||||
#include "crypto4xx_sa.h"
|
||||
@@ -582,8 +583,10 @@ static u32 crypto4xx_ablkcipher_done(str
|
||||
@@ -578,8 +579,10 @@ static u32 crypto4xx_ablkcipher_done(str
|
||||
}
|
||||
|
||||
crypto4xx_ret_sg_desc(dev, pd_uinfo);
|
||||
@@ -69,7 +69,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -600,9 +603,10 @@ static u32 crypto4xx_ahash_done(struct c
|
||||
@@ -596,9 +599,10 @@ static u32 crypto4xx_ahash_done(struct c
|
||||
crypto4xx_copy_digest_to_dst(pd_uinfo,
|
||||
crypto_tfm_ctx(ahash_req->base.tfm));
|
||||
crypto4xx_ret_sg_desc(dev, pd_uinfo);
|
||||
@@ -83,7 +83,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -713,6 +717,7 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -709,6 +713,7 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
struct pd_uinfo *pd_uinfo = NULL;
|
||||
unsigned int nbytes = datalen, idx;
|
||||
u32 gd_idx = 0;
|
||||
@@ -91,7 +91,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
|
||||
/* figure how many gd is needed */
|
||||
num_gd = sg_nents_for_len(src, datalen);
|
||||
@@ -743,6 +748,31 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -739,6 +744,31 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
* already got must be return the original place.
|
||||
*/
|
||||
spin_lock_irqsave(&dev->core_dev->lock, flags);
|
||||
@@ -123,7 +123,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
if (num_gd) {
|
||||
fst_gd = crypto4xx_get_n_gd(dev, num_gd);
|
||||
if (fst_gd == ERING_WAS_FULL) {
|
||||
@@ -897,11 +927,12 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -893,11 +923,12 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
sa->sa_command_1.bf.hash_crypto_offset = 0;
|
||||
pd->pd_ctl.w = ctx->pd_ctl;
|
||||
pd->pd_ctl_len.w = 0x00400000 | datalen;
|
||||
@@ -138,7 +138,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1006,7 +1037,7 @@ static void crypto4xx_bh_tasklet_cb(unsi
|
||||
@@ -1002,7 +1033,7 @@ static void crypto4xx_bh_tasklet_cb(unsi
|
||||
tail = core_dev->dev->pdr_tail;
|
||||
pd_uinfo = &core_dev->dev->pdr_uinfo[tail];
|
||||
pd = &core_dev->dev->pdr[tail];
|
||||
|
||||
@@ -45,7 +45,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
ctx->is_hash = 0;
|
||||
--- a/drivers/crypto/amcc/crypto4xx_core.c
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_core.c
|
||||
@@ -623,42 +623,6 @@ static u32 crypto4xx_pd_done(struct cryp
|
||||
@@ -619,42 +619,6 @@ static u32 crypto4xx_pd_done(struct cryp
|
||||
return crypto4xx_ahash_done(dev, pd_uinfo);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
static void crypto4xx_stop_all(struct crypto4xx_core_device *core_dev)
|
||||
{
|
||||
crypto4xx_destroy_pdr(core_dev->dev);
|
||||
@@ -818,8 +782,8 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -814,8 +778,8 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
&pd_uinfo->sr_pa, 4);
|
||||
|
||||
if (iv_len)
|
||||
|
||||
@@ -263,7 +263,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
/**
|
||||
* alloc memory for the gather ring
|
||||
* no need to alloc buf for the ring
|
||||
@@ -520,18 +514,16 @@ static void crypto4xx_copy_pkt_to_dst(st
|
||||
@@ -516,18 +510,16 @@ static void crypto4xx_copy_pkt_to_dst(st
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
}
|
||||
|
||||
static void crypto4xx_ret_sg_desc(struct crypto4xx_device *dev,
|
||||
@@ -600,7 +592,7 @@ static u32 crypto4xx_ahash_done(struct c
|
||||
@@ -596,7 +588,7 @@ static u32 crypto4xx_ahash_done(struct c
|
||||
ahash_req = ahash_request_cast(pd_uinfo->async_req);
|
||||
ctx = crypto_tfm_ctx(ahash_req->base.tfm);
|
||||
|
||||
@@ -294,7 +294,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
crypto_tfm_ctx(ahash_req->base.tfm));
|
||||
crypto4xx_ret_sg_desc(dev, pd_uinfo);
|
||||
|
||||
@@ -660,17 +652,17 @@ static u32 get_next_sd(u32 current)
|
||||
@@ -656,17 +648,17 @@ static u32 get_next_sd(u32 current)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
struct ce_gd *gd;
|
||||
struct ce_pd *pd;
|
||||
u32 num_gd, num_sd;
|
||||
@@ -678,8 +670,9 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -674,8 +666,9 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
u32 fst_sd = 0xffffffff;
|
||||
u32 pd_entry;
|
||||
unsigned long flags;
|
||||
@@ -329,7 +329,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
u32 gd_idx = 0;
|
||||
bool is_busy;
|
||||
|
||||
@@ -693,7 +686,7 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -689,7 +682,7 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
num_gd = 0;
|
||||
|
||||
/* figure how many sd is needed */
|
||||
@@ -338,7 +338,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
num_sd = 0;
|
||||
} else {
|
||||
if (datalen > PPC4XX_SD_BUFFER_SIZE) {
|
||||
@@ -764,37 +757,27 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -760,37 +753,27 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->core_dev->lock, flags);
|
||||
|
||||
@@ -389,7 +389,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
/* get first gd we are going to use */
|
||||
gd_idx = fst_gd;
|
||||
pd_uinfo->first_gd = fst_gd;
|
||||
@@ -803,27 +786,30 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -799,27 +782,30 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
pd->src = gd_dma;
|
||||
/* enable gather */
|
||||
sa->sa_command_0.bf.gather = 1;
|
||||
@@ -430,7 +430,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
/*
|
||||
* Disable gather in sa command
|
||||
*/
|
||||
@@ -834,25 +820,24 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -830,25 +816,24 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
pd_uinfo->first_gd = 0xffffffff;
|
||||
pd_uinfo->num_gd = 0;
|
||||
}
|
||||
@@ -463,7 +463,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
u32 sd_idx = fst_sd;
|
||||
nbytes = datalen;
|
||||
sa->sa_command_0.bf.scatter = 1;
|
||||
@@ -866,7 +851,6 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -862,7 +847,6 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
sd->ctl.done = 0;
|
||||
sd->ctl.rdy = 1;
|
||||
/* sd->ptr should be setup by sd_init routine*/
|
||||
@@ -471,7 +471,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
if (nbytes >= PPC4XX_SD_BUFFER_SIZE)
|
||||
nbytes -= PPC4XX_SD_BUFFER_SIZE;
|
||||
else
|
||||
@@ -877,19 +861,23 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
@@ -873,19 +857,23 @@ u32 crypto4xx_build_pd(struct crypto_asy
|
||||
/* setup scatter descriptor */
|
||||
sd->ctl.done = 0;
|
||||
sd->ctl.rdy = 1;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user