Compare commits
122 Commits
v18.06.6
...
openwrt-18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f2a40c72f | ||
|
|
0e25552dd8 | ||
|
|
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 |
@@ -1,4 +1,4 @@
|
||||
src-git packages https://git.openwrt.org/feed/packages.git^b0df5d33652220a384593d7b52a8453b022b8f9b
|
||||
src-git luci https://git.openwrt.org/project/luci.git^868abc1a564ca8366bbb018a967923cbdc5ee27a
|
||||
src-git routing https://git.openwrt.org/feed/routing.git^9fa2b249cc286176f07efe343fd9518b383462fc
|
||||
src-git telephony https://git.openwrt.org/feed/telephony.git^8ecbdabc7c5cadbe571eb947f5cd333a5a785010
|
||||
src-git packages https://git.openwrt.org/feed/packages.git;openwrt-18.06
|
||||
src-git luci https://git.openwrt.org/project/luci.git;openwrt-18.06
|
||||
src-git routing https://git.openwrt.org/feed/routing.git;openwrt-18.06
|
||||
src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-18.06
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
LINUX_RELEASE?=1
|
||||
|
||||
LINUX_VERSION-4.9 = .208
|
||||
LINUX_VERSION-4.14 = .162
|
||||
LINUX_VERSION-4.9 = .243
|
||||
LINUX_VERSION-4.14 = .206
|
||||
|
||||
LINUX_KERNEL_HASH-4.9.208 = b7ad1c9841d671d026c55a4c91c77205f8b488ca5f980f838591c68662e0525a
|
||||
LINUX_KERNEL_HASH-4.14.162 = f65170224cd4359ce8b2793b492bd8127abdd0b91350484e001bce13f0c98b4b
|
||||
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) - \
|
||||
|
||||
@@ -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.6)
|
||||
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),18.06-SNAPSHOT)
|
||||
|
||||
VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
|
||||
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r7957-d81a8a3e29)
|
||||
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
|
||||
|
||||
VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
|
||||
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/releases/18.06.6)
|
||||
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/releases/18.06-SNAPSHOT)
|
||||
|
||||
VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
|
||||
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
|
||||
|
||||
@@ -183,7 +183,7 @@ if VERSIONOPT
|
||||
config VERSION_REPO
|
||||
string
|
||||
prompt "Release repository"
|
||||
default "http://downloads.openwrt.org/releases/18.06.6"
|
||||
default "http://downloads.openwrt.org/releases/18.06-SNAPSHOT"
|
||||
help
|
||||
This is the repository address embedded in the image, it defaults
|
||||
to the trunk snapshot repo; the url may contain the following placeholders:
|
||||
@@ -259,7 +259,7 @@ if VERSIONOPT
|
||||
config VERSION_CODE_FILENAMES
|
||||
bool
|
||||
prompt "Revision code in filenames"
|
||||
default n
|
||||
default y
|
||||
help
|
||||
Enable this to include the revision identifier or the configured
|
||||
version code into the firmware image, SDK- and Image Builder archive
|
||||
|
||||
@@ -46,6 +46,7 @@ mr600v2|\
|
||||
mr900|\
|
||||
mr900v2|\
|
||||
n5q|\
|
||||
nbg6616|\
|
||||
nbg6716|\
|
||||
om5p|\
|
||||
om5p-ac|\
|
||||
|
||||
@@ -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,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);
|
||||
}
|
||||
@@ -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:=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);
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -12,9 +12,9 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git
|
||||
PKG_SOURCE_DATE:=2019-12-22
|
||||
PKG_SOURCE_VERSION:=5f9ae5738372aaa3a6be2f0a278933563d3f191a
|
||||
PKG_MIRROR_HASH:=16977c2d7e68f6db3241f874df625af9bd3bafa06fe4499ecb3561c825321e5d
|
||||
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
|
||||
|
||||
@@ -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 */
|
||||
@@ -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
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
From 6e88098ca43a3d80ae86908f7badba683c8a0d84 Mon Sep 17 00:00:00 2001
|
||||
From: Corentin Labbe <clabbe@baylibre.com>
|
||||
Date: Wed, 23 Jan 2019 11:24:18 +0000
|
||||
Subject: [PATCH 07/15] crypto: crypto4xx - Fix wrong
|
||||
ppc4xx_trng_probe()/ppc4xx_trng_remove() arguments
|
||||
|
||||
When building without CONFIG_HW_RANDOM_PPC4XX, I hit the following build failure:
|
||||
drivers/crypto/amcc/crypto4xx_core.c: In function 'crypto4xx_probe':
|
||||
drivers/crypto/amcc/crypto4xx_core.c:1407:20: error: passing argument 1 of 'ppc4xx_trng_probe' from incompatible pointer type [-Werror=incompatible-pointer-types]
|
||||
In file included from drivers/crypto/amcc/crypto4xx_core.c:50:0:
|
||||
drivers/crypto/amcc/crypto4xx_trng.h:28:20: note: expected 'struct crypto4xx_device *' but argument is of type 'struct crypto4xx_core_device *'
|
||||
drivers/crypto/amcc/crypto4xx_core.c: In function 'crypto4xx_remove':
|
||||
drivers/crypto/amcc/crypto4xx_core.c:1434:21: error: passing argument 1 of 'ppc4xx_trng_remove' from incompatible pointer type [-Werror=incompatible-pointer-types]
|
||||
In file included from drivers/crypto/amcc/crypto4xx_core.c:50:0:
|
||||
drivers/crypto/amcc/crypto4xx_trng.h:30:20: note: expected 'struct crypto4xx_device *' but argument is of type 'struct crypto4xx_core_device *'
|
||||
|
||||
This patch fix the needed argument of ppc4xx_trng_probe()/ppc4xx_trng_remove() in that case.
|
||||
|
||||
Fixes: 5343e674f32f ("crypto4xx: integrate ppc4xx-rng into crypto4xx")
|
||||
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
drivers/crypto/amcc/crypto4xx_trng.h | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/crypto/amcc/crypto4xx_trng.h
|
||||
+++ b/drivers/crypto/amcc/crypto4xx_trng.h
|
||||
@@ -26,9 +26,9 @@ void ppc4xx_trng_probe(struct crypto4xx_
|
||||
void ppc4xx_trng_remove(struct crypto4xx_core_device *core_dev);
|
||||
#else
|
||||
static inline void ppc4xx_trng_probe(
|
||||
- struct crypto4xx_device *dev __maybe_unused) { }
|
||||
+ struct crypto4xx_core_device *dev __maybe_unused) { }
|
||||
static inline void ppc4xx_trng_remove(
|
||||
- struct crypto4xx_device *dev __maybe_unused) { }
|
||||
+ struct crypto4xx_core_device *dev __maybe_unused) { }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/arch/powerpc/platforms/4xx/pci.c
|
||||
+++ b/arch/powerpc/platforms/4xx/pci.c
|
||||
@@ -1905,9 +1905,9 @@ static void __init ppc4xx_configure_pcie
|
||||
@@ -1903,9 +1903,9 @@ static void __init ppc4xx_configure_pcie
|
||||
* if it works
|
||||
*/
|
||||
out_le32(mbase + PECFG_PIM0LAL, 0x00000000);
|
||||
|
||||
@@ -44,7 +44,7 @@ Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
|
||||
|
||||
#include "xhci.h"
|
||||
#include "xhci-trace.h"
|
||||
@@ -266,6 +268,458 @@ static void xhci_pme_acpi_rtd3_enable(st
|
||||
@@ -276,6 +278,458 @@ static void xhci_pme_acpi_rtd3_enable(st
|
||||
static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) { }
|
||||
#endif /* CONFIG_ACPI */
|
||||
|
||||
@@ -503,7 +503,7 @@ Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
|
||||
/* called during probe() after chip reset completes */
|
||||
static int xhci_pci_setup(struct usb_hcd *hcd)
|
||||
{
|
||||
@@ -301,6 +755,22 @@ static int xhci_pci_probe(struct pci_dev
|
||||
@@ -314,6 +768,22 @@ static int xhci_pci_probe(struct pci_dev
|
||||
struct hc_driver *driver;
|
||||
struct usb_hcd *hcd;
|
||||
|
||||
@@ -526,7 +526,7 @@ Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
|
||||
driver = (struct hc_driver *)id->driver_data;
|
||||
|
||||
/* For some HW implementation, a XHCI reset is just not enough... */
|
||||
@@ -365,6 +835,16 @@ static void xhci_pci_remove(struct pci_d
|
||||
@@ -375,6 +845,16 @@ static void xhci_pci_remove(struct pci_d
|
||||
{
|
||||
struct xhci_hcd *xhci;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ produce a noisy warning.
|
||||
|
||||
--- a/drivers/usb/host/xhci-pci.c
|
||||
+++ b/drivers/usb/host/xhci-pci.c
|
||||
@@ -219,7 +219,7 @@ static void xhci_pci_quirks(struct devic
|
||||
@@ -225,7 +225,7 @@ static void xhci_pci_quirks(struct devic
|
||||
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
|
||||
if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
|
||||
pdev->device == 0x0015)
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
config ATH25
|
||||
bool "Atheros AR231x/AR531x SoC support"
|
||||
@@ -1007,6 +1007,7 @@ config MIPS_PARAVIRT
|
||||
@@ -1008,6 +1008,7 @@ config MIPS_PARAVIRT
|
||||
endchoice
|
||||
|
||||
source "arch/mips/alchemy/Kconfig"
|
||||
|
||||
@@ -237,6 +237,8 @@ ar71xx_setup_interfaces()
|
||||
"0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
|
||||
;;
|
||||
archer-c25-v1|\
|
||||
archer-c60-v1|\
|
||||
archer-c60-v2|\
|
||||
rb-750-r2|\
|
||||
rb-750p-pbr2|\
|
||||
rb-750up-r2|\
|
||||
@@ -253,12 +255,6 @@ ar71xx_setup_interfaces()
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
|
||||
;;
|
||||
archer-c60-v1|\
|
||||
archer-c60-v2)
|
||||
ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth1" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
|
||||
;;
|
||||
arduino-yun|\
|
||||
dir-505-a1|\
|
||||
tl-wa801nd-v3)
|
||||
|
||||
@@ -178,7 +178,7 @@ case "$FIRMWARE" in
|
||||
ath10kcal_extract "art" 20480 12064
|
||||
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
||||
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
|
||||
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -1)
|
||||
;;
|
||||
cf-e385ac)
|
||||
ath10kcal_extract "art" 20480 12064
|
||||
|
||||
@@ -14,8 +14,7 @@ board=$(board_name)
|
||||
case "$board" in
|
||||
archer-c58-v1|\
|
||||
archer-c59-v1|\
|
||||
archer-c60-v1|\
|
||||
archer-c60-v2)
|
||||
archer-c60-v1)
|
||||
echo $(macaddr_add $(mtd_get_mac_binary mac 8) $(($PHYNBR - 1)) ) > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
*)
|
||||
|
||||
@@ -216,6 +216,7 @@ platform_check_image() {
|
||||
archer-c60-v2|\
|
||||
archer-c7-v4|\
|
||||
archer-c7-v5|\
|
||||
arduino-yun|\
|
||||
bullet-m|\
|
||||
c-55|\
|
||||
carambola2|\
|
||||
@@ -343,7 +344,6 @@ platform_check_image() {
|
||||
ap152|\
|
||||
ap91-5g|\
|
||||
ap96|\
|
||||
arduino-yun|\
|
||||
bhr-4grv2|\
|
||||
bxu2000n-2-a1|\
|
||||
db120|\
|
||||
|
||||
@@ -157,8 +157,8 @@ static void __init archer_c60_v1_setup(void)
|
||||
ath79_register_mdio(0, 0x0);
|
||||
ath79_register_mdio(1, 0x0);
|
||||
|
||||
ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
|
||||
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
|
||||
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
|
||||
ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
|
||||
|
||||
/* WAN port */
|
||||
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
|
||||
@@ -199,8 +199,8 @@ static void __init archer_c60_v2_setup(void)
|
||||
ath79_register_mdio(0, 0x0);
|
||||
ath79_register_mdio(1, 0x0);
|
||||
|
||||
ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
|
||||
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
|
||||
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
|
||||
ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
|
||||
|
||||
/* WAN port */
|
||||
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
|
||||
|
||||
@@ -117,8 +117,7 @@ static void __init ds_setup(void)
|
||||
ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
|
||||
AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
|
||||
AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
|
||||
AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
|
||||
AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
|
||||
AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN);
|
||||
|
||||
//Disable the Function for some pins to have GPIO functionality active
|
||||
// GPIO6-7-8 and GPIO11
|
||||
|
||||
@@ -47,7 +47,7 @@ static struct gpio_keys_button dorin_gpio_keys[] __initdata = {
|
||||
.code = KEY_WPS_BUTTON,
|
||||
.debounce_interval = DORIN_KEYS_DEBOUNCE_INTERVAL,
|
||||
.gpio = DORIN_GPIO_BTN_JUMPSTART,
|
||||
.active_low = 1,
|
||||
.active_low = 0,
|
||||
},
|
||||
{
|
||||
.desc = "reset button",
|
||||
|
||||
@@ -198,11 +198,11 @@ static struct gpio_keys_button nbg6616_gpio_keys[] __initdata = {
|
||||
},
|
||||
{
|
||||
.desc = "RFKILL button",
|
||||
.type = EV_KEY,
|
||||
.type = EV_SW,
|
||||
.code = KEY_RFKILL,
|
||||
.debounce_interval = NBG6716_KEYS_DEBOUNCE_INTERVAL,
|
||||
.gpio = NBG6716_GPIO_BTN_RFKILL,
|
||||
.active_low = 1,
|
||||
.active_low = 0,
|
||||
},
|
||||
{
|
||||
.desc = "WPS button",
|
||||
|
||||
@@ -206,10 +206,7 @@ __rb_get_wlan_data(u16 id)
|
||||
u8 *erd_data;
|
||||
u16 erd_len;
|
||||
|
||||
if (id == 0)
|
||||
goto err_free;
|
||||
|
||||
err = routerboot_find_tag(tag, tag_len, id,
|
||||
err = routerboot_find_tag(tag, tag_len, 0x1,
|
||||
&erd_data, &erd_len);
|
||||
if (err) {
|
||||
pr_err("no ERD data found for id %u\n", id);
|
||||
@@ -224,9 +221,6 @@ __rb_get_wlan_data(u16 id)
|
||||
goto err_free;
|
||||
}
|
||||
} else {
|
||||
if (id != 0)
|
||||
goto err_free;
|
||||
|
||||
err = rle_decode((char *) tag, tag_len, buf, RB_ART_SIZE,
|
||||
&src_done, &dst_done);
|
||||
if (err) {
|
||||
|
||||
@@ -1562,7 +1562,7 @@ ar934x_nfc_remove(struct platform_device *pdev)
|
||||
nfc = platform_get_drvdata(pdev);
|
||||
if (nfc) {
|
||||
mtd = ar934x_nfc_to_mtd(nfc);
|
||||
nand_release(mtd);
|
||||
nand_release(&nfc->nand_chip);
|
||||
ar934x_nfc_free_buf(nfc);
|
||||
free_irq(nfc->irq, nfc);
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ static int rb4xx_nand_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
|
||||
err_release_nand:
|
||||
nand_release(mtd);
|
||||
nand_release(&info->chip);
|
||||
err_set_drvdata:
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
err_free_info:
|
||||
@@ -352,7 +352,7 @@ static int rb4xx_nand_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct rb4xx_nand_info *info = platform_get_drvdata(pdev);
|
||||
|
||||
nand_release(rbinfo_to_mtd(info));
|
||||
nand_release(&info->chip);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
kfree(info);
|
||||
gpio_free(RB4XX_NAND_GPIO_NCE);
|
||||
|
||||
@@ -389,7 +389,7 @@ static int rb750_nand_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
|
||||
err_release_nand:
|
||||
nand_release(mtd);
|
||||
nand_release(&info->chip);
|
||||
err_set_drvdata:
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
err_free_info:
|
||||
@@ -401,7 +401,7 @@ static int rb750_nand_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct rb750_nand_info *info = platform_get_drvdata(pdev);
|
||||
|
||||
nand_release(rbinfo_to_mtd(info));
|
||||
nand_release(&info->chip);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
kfree(info);
|
||||
|
||||
|
||||
@@ -430,7 +430,7 @@ static int rb91x_nand_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
|
||||
err_release_nand:
|
||||
nand_release(mtd);
|
||||
nand_release(&rbni->chip);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ static int rb91x_nand_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct rb91x_nand_info *info = platform_get_drvdata(pdev);
|
||||
|
||||
nand_release(rbinfo_to_mtd(info));
|
||||
nand_release(&info->chip);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1084,7 +1084,7 @@ define Device/NBG6616
|
||||
BOARDNAME := NBG6616
|
||||
KERNEL_SIZE := 2048k
|
||||
IMAGE_SIZE := 15323k
|
||||
MTDPARTS := spi0.0:192k(u-boot)ro,64k(env)ro,64k(RFdata)ro,384k(zyxel_rfsd),384k(romd),64k(header),2048k(kernel),13184k(rootfs),15232k@0x120000(firmware)
|
||||
MTDPARTS := spi0.0:192k(u-boot)ro,64k(env),64k(RFdata)ro,384k(zyxel_rfsd),384k(romd),64k(header),2048k(kernel),13184k(rootfs),15232k@0x120000(firmware)
|
||||
CMDLINE += mem=128M
|
||||
IMAGES := sysupgrade.bin
|
||||
KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 boot/vmlinux.lzma.uImage
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||
@@ -1637,7 +1637,7 @@ static int __xipram do_write_oneword(str
|
||||
@@ -1636,7 +1636,7 @@ static int __xipram do_write_oneword(str
|
||||
}
|
||||
|
||||
if (chip_good(map, adr, datum))
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
/* Latency issues. Drop the lock, wait a while and retry */
|
||||
UDELAY(map, chip, adr, 1);
|
||||
@@ -1654,6 +1654,8 @@ static int __xipram do_write_oneword(str
|
||||
@@ -1653,6 +1653,8 @@ static int __xipram do_write_oneword(str
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
xip_enable(map, chip, adr);
|
||||
op_done:
|
||||
if (mode == FL_OTP_WRITE)
|
||||
@@ -2232,7 +2234,6 @@ static int cfi_amdstd_panic_write(struct
|
||||
@@ -2235,7 +2237,6 @@ static int cfi_amdstd_panic_write(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/*
|
||||
* Handle devices with one erase region, that only implement
|
||||
* the chip erase command.
|
||||
@@ -2300,7 +2301,7 @@ static int __xipram do_erase_chip(struct
|
||||
@@ -2303,7 +2304,7 @@ static int __xipram do_erase_chip(struct
|
||||
}
|
||||
|
||||
if (chip_good(map, adr, map_word_ff(map)))
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
if (time_after(jiffies, timeo)) {
|
||||
printk(KERN_WARNING "MTD %s(): software timeout\n",
|
||||
@@ -2324,6 +2325,7 @@ static int __xipram do_erase_chip(struct
|
||||
@@ -2327,6 +2328,7 @@ static int __xipram do_erase_chip(struct
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
chip->state = FL_READY;
|
||||
xip_enable(map, chip, adr);
|
||||
DISABLE_VPP(map);
|
||||
@@ -2397,7 +2399,7 @@ static int __xipram do_erase_oneblock(st
|
||||
@@ -2400,7 +2402,7 @@ static int __xipram do_erase_oneblock(st
|
||||
|
||||
if (chip_good(map, adr, map_word_ff(map))) {
|
||||
xip_enable(map, chip, adr);
|
||||
@@ -52,7 +52,7 @@
|
||||
}
|
||||
|
||||
if (time_after(jiffies, timeo)) {
|
||||
@@ -2423,6 +2425,7 @@ static int __xipram do_erase_oneblock(st
|
||||
@@ -2426,6 +2428,7 @@ static int __xipram do_erase_oneblock(st
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
/* Atmel chips don't use the same PRI format as AMD chips */
|
||||
static void fixup_convert_atmel_pri(struct mtd_info *mtd)
|
||||
@@ -1796,6 +1800,7 @@ static int cfi_amdstd_write_words(struct
|
||||
@@ -1795,6 +1799,7 @@ static int cfi_amdstd_write_words(struct
|
||||
/*
|
||||
* FIXME: interleaved mode not tested, and probably not supported!
|
||||
*/
|
||||
@@ -43,7 +43,7 @@
|
||||
static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
|
||||
unsigned long adr, const u_char *buf,
|
||||
int len)
|
||||
@@ -1924,7 +1929,6 @@ static int __xipram do_write_buffer(stru
|
||||
@@ -1927,7 +1932,6 @@ static int __xipram do_write_buffer(stru
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
size_t *retlen, const u_char *buf)
|
||||
{
|
||||
@@ -1999,6 +2003,7 @@ static int cfi_amdstd_write_buffers(stru
|
||||
@@ -2002,6 +2006,7 @@ static int cfi_amdstd_write_buffers(stru
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/drivers/gpio/Kconfig
|
||||
+++ b/drivers/gpio/Kconfig
|
||||
@@ -1214,4 +1214,12 @@ config GPIO_VIPERBOARD
|
||||
@@ -1215,4 +1215,12 @@ config GPIO_VIPERBOARD
|
||||
|
||||
endmenu
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
+#endif
|
||||
--- a/drivers/gpio/Kconfig
|
||||
+++ b/drivers/gpio/Kconfig
|
||||
@@ -1155,7 +1155,6 @@ menu "SPI GPIO expanders"
|
||||
@@ -1156,7 +1156,6 @@ menu "SPI GPIO expanders"
|
||||
|
||||
config GPIO_74X164
|
||||
tristate "74x164 serial-in/parallel-out 8-bits shift register"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/drivers/gpio/Kconfig
|
||||
+++ b/drivers/gpio/Kconfig
|
||||
@@ -1221,4 +1221,9 @@ config GPIO_NXP_74HC153
|
||||
@@ -1222,4 +1222,9 @@ config GPIO_NXP_74HC153
|
||||
Platform driver for NXP 74HC153 Dual 4-input Multiplexer. This
|
||||
provides a GPIO interface supporting input mode only.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/drivers/usb/host/ehci-hcd.c
|
||||
+++ b/drivers/usb/host/ehci-hcd.c
|
||||
@@ -252,6 +252,37 @@ int ehci_reset(struct ehci_hcd *ehci)
|
||||
@@ -253,6 +253,37 @@ int ehci_reset(struct ehci_hcd *ehci)
|
||||
command |= CMD_RESET;
|
||||
dbg_cmd (ehci, "reset", command);
|
||||
ehci_writel(ehci, command, &ehci->regs->command);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -1152,6 +1152,9 @@ config MIPS_MSC
|
||||
@@ -1153,6 +1153,9 @@ config MIPS_MSC
|
||||
config MIPS_NILE4
|
||||
bool
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@
|
||||
case IPV6_2292HOPOPTS:
|
||||
--- a/net/ipv6/ip6_gre.c
|
||||
+++ b/net/ipv6/ip6_gre.c
|
||||
@@ -397,7 +397,7 @@ static void ip6gre_err(struct sk_buff *s
|
||||
@@ -400,7 +400,7 @@ static void ip6gre_err(struct sk_buff *s
|
||||
return;
|
||||
ipv6h = (const struct ipv6hdr *)skb->data;
|
||||
greh = (const struct gre_base_hdr *)(skb->data + offset);
|
||||
@@ -316,7 +316,7 @@
|
||||
for (p = *head; p; p = p->next) {
|
||||
--- a/net/ipv4/route.c
|
||||
+++ b/net/ipv4/route.c
|
||||
@@ -461,7 +461,7 @@ static struct neighbour *ipv4_neigh_look
|
||||
@@ -460,7 +460,7 @@ static struct neighbour *ipv4_neigh_look
|
||||
else if (skb)
|
||||
pkey = &ip_hdr(skb)->daddr;
|
||||
|
||||
@@ -795,7 +795,7 @@
|
||||
|
||||
--- a/net/ipv4/tcp_input.c
|
||||
+++ b/net/ipv4/tcp_input.c
|
||||
@@ -3926,14 +3926,16 @@ static bool tcp_parse_aligned_timestamp(
|
||||
@@ -3935,14 +3935,16 @@ static bool tcp_parse_aligned_timestamp(
|
||||
{
|
||||
const __be32 *ptr = (const __be32 *)(th + 1);
|
||||
|
||||
@@ -869,7 +869,7 @@
|
||||
* No flags defined yet.
|
||||
--- a/net/core/utils.c
|
||||
+++ b/net/core/utils.c
|
||||
@@ -321,8 +321,14 @@ void inet_proto_csum_replace16(__sum16 *
|
||||
@@ -338,8 +338,14 @@ void inet_proto_csum_replace16(__sum16 *
|
||||
bool pseudohdr)
|
||||
{
|
||||
__be32 diff[] = {
|
||||
@@ -888,7 +888,7 @@
|
||||
*sum = csum_fold(csum_partial(diff, sizeof(diff),
|
||||
--- a/drivers/net/vxlan.c
|
||||
+++ b/drivers/net/vxlan.c
|
||||
@@ -1800,15 +1800,15 @@ static int vxlan_build_skb(struct sk_buf
|
||||
@@ -1808,15 +1808,15 @@ static int vxlan_build_skb(struct sk_buf
|
||||
goto out_free;
|
||||
|
||||
vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh));
|
||||
|
||||
@@ -39,6 +39,7 @@ CONFIG_CRYPTO_NULL2=y
|
||||
CONFIG_CRYPTO_RNG2=y
|
||||
CONFIG_CRYPTO_WORKQUEUE=y
|
||||
CONFIG_DCACHE_WORD_ACCESS=y
|
||||
CONFIG_DMADEVICES=y
|
||||
CONFIG_DTC=y
|
||||
CONFIG_EDAC_SUPPORT=y
|
||||
CONFIG_EXT4_FS=y
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user