Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen
2022-12-08 01:35:38 +08:00
34 changed files with 830 additions and 318 deletions
+4 -1
View File
@@ -150,7 +150,7 @@ menu "Target Images"
bool "squashfs"
default y if USES_SQUASHFS
help
Build a squashfs-lzma root filesystem.
Build a squashfs root filesystem.
config TARGET_SQUASHFS_BLOCK_SIZE
int "Block size (in KiB)"
@@ -158,6 +158,9 @@ menu "Target Images"
default 64 if LOW_MEMORY_FOOTPRINT
default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT)
default 256
help
Select squashfs block size, must be one of:
4, 8, 16, 32, 64, 128, 256, 512, 1024
menuconfig TARGET_ROOTFS_UBIFS
bool "ubifs"
+1
View File
@@ -53,6 +53,7 @@ define Build/append-image-stage
cp "$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)" "$@.stripmeta"
fwtool -s /dev/null -t "$@.stripmeta" || :
fwtool -i /dev/null -t "$@.stripmeta" || :
mkdir -p "$(STAGING_DIR_IMAGE)"
dd if="$@.stripmeta" of="$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1)"
dd if="$@.stripmeta" >> "$@"
rm "$@.stripmeta"
+3
View File
@@ -149,6 +149,9 @@ $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \
gstat -c%s $(TOPDIR)/Makefile, \
stat -c%s $(TOPDIR)/Makefile))
$(eval $(call SetupHostCommand,gzip,Please install 'gzip', \
gzip --version </dev/null))
$(eval $(call SetupHostCommand,unzip,Please install 'unzip', \
unzip 2>&1 | grep zipfile, \
unzip))
+1
View File
@@ -81,6 +81,7 @@ define Build/Compile/Trusted-Firmware-A
$(if $(DTC),DTC="$(DTC)") \
PLAT=$(PLAT) \
BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \
$(if $(CONFIG_BINUTILS_VERSION_2_39),LDFLAGS="-no-warn-rwx-segments") \
$(TFA_MAKE_FLAGS)
endef
+3 -3
View File
@@ -9,9 +9,9 @@ PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall4.git
PKG_SOURCE_DATE:=2022-10-18
PKG_SOURCE_VERSION:=7ae5e14bbd7265cc67ec870c3bb0c8e197bb7ca9
PKG_MIRROR_HASH:=ce190e526df915df65b40aa24fadf2a1b5badc57ab4e564d5f44575b11d18e26
PKG_SOURCE_DATE:=2022-11-29
PKG_SOURCE_VERSION:=700a925fd9c1f1ff404e6b125cd5347ad7c45668
PKG_MIRROR_HASH:=18fb7a27399bf2e9e094a4cbacd4e859448c1c9194b6da4a78c9f37a642d1703
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_LICENSE:=ISC
@@ -75,6 +75,22 @@
"finalize": "AT+CGDATA=\\\"M-MBIM\\\",${profile},1",
"disconnect": "AT+CGACT=0,${profile}"
},
"quectel": {
"initialize": [
"AT+CFUN=1"
],
"configure": [
"at+qicsgp=${profile},${context_type},\\\"${apn}\\\",\\\"${username}\\\",\\\"${password}\\\",0"
],
"modes": {
"lte": "AT+QCFG=\\\"nwscanmode\\\",3",
"umts": "AT+QCFG=\\\"nwscanmode\\\",2",
"gsm": "AT+QCFG=\\\"nwscanmode\\\",1",
"auto": "AT+QCFG=\\\"nwscanmode\\\",0"
},
"connect": "AT+qnetdevctl=1,${profile},1",
"disconnect": "AT+qnetdevctl=0,${profile},0"
},
"\"zte": {
"initialize": [
"AT+CFUN=1"
+6
View File
@@ -31,6 +31,8 @@ proto_ncm_setup() {
local device ifname apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
json_get_vars device ifname apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
local context_type
[ "$metric" = "" ] && metric="0"
[ -n "$profile" ] || profile=1
@@ -38,6 +40,10 @@ proto_ncm_setup() {
pdptype=$(echo "$pdptype" | awk '{print toupper($0)}')
[ "$pdptype" = "IP" -o "$pdptype" = "IPV6" -o "$pdptype" = "IPV4V6" ] || pdptype="IP"
[ "$pdptype" = "IPV4V6" ] && context_type=3
[ -z "$context_type" -a "$pdptype" = "IPV6" ] && context_type=2
[ -n "$context_type" ] || context_type=1
[ -n "$ctl_device" ] && device=$ctl_device
[ -n "$device" ] || {
+1 -1
View File
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=e2fsprogs
PKG_VERSION:=1.46.5
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/
@@ -0,0 +1,50 @@
From ab51d587bb9b229b1fade1afd02e1574c1ba5c76 Mon Sep 17 00:00:00 2001
From: Lukas Czerner <lczerner@redhat.com>
Date: Thu, 21 Apr 2022 19:31:48 +0200
Subject: libext2fs: add sanity check to extent manipulation
It is possible to have a corrupted extent tree in such a way that a leaf
node contains zero extents in it. Currently if that happens and we try
to traverse the tree we can end up accessing wrong data, or possibly
even uninitialized memory. Make sure we don't do that.
Additionally make sure that we have a sane number of bytes passed to
memmove() in ext2fs_extent_delete().
Note that e2fsck is currently unable to spot and fix such corruption in
pass1.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Nils Bars <nils_bars@t-online.de>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2068113
Addresses: CVE-2022-1304
Addresses-Debian-Bug: #1010263
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/ext2fs/extent.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/lib/ext2fs/extent.c
+++ b/lib/ext2fs/extent.c
@@ -495,6 +495,10 @@ retry:
ext2fs_le16_to_cpu(eh->eh_entries);
newpath->max_entries = ext2fs_le16_to_cpu(eh->eh_max);
+ /* Make sure there is at least one extent present */
+ if (newpath->left <= 0)
+ return EXT2_ET_EXTENT_NO_DOWN;
+
if (path->left > 0) {
ix++;
newpath->end_blk = ext2fs_le32_to_cpu(ix->ei_block);
@@ -1630,6 +1634,10 @@ errcode_t ext2fs_extent_delete(ext2_exte
cp = path->curr;
+ /* Sanity check before memmove() */
+ if (path->left < 0)
+ return EXT2_ET_EXTENT_LEAF_BAD;
+
if (path->left) {
memmove(cp, cp + sizeof(struct ext3_extent_idx),
path->left * sizeof(struct ext3_extent_idx));
@@ -73,21 +73,18 @@ static uint8_t readbuf[TFFS_SECTOR_SIZE];
static uint8_t oobbuf[TFFS_SECTOR_OOB_SIZE];
static uint32_t blocksize;
static int mtdfd;
struct tffs_sectors *sectors;
struct tffs_sectors {
uint32_t num_sectors;
uint8_t sectors[0];
};
static uint32_t num_sectors;
static uint8_t *sectors;
static uint32_t *sector_ids;
static inline void sector_mark_bad(int num)
{
sectors->sectors[num / 8] &= ~(0x80 >> (num % 8));
sectors[num / 8] &= ~(0x80 >> (num % 8));
};
static inline uint8_t sector_get_good(int num)
{
return sectors->sectors[num / 8] & 0x80 >> (num % 8);
return sectors[num / 8] & 0x80 >> (num % 8);
};
struct tffs_entry_segment {
@@ -139,6 +136,8 @@ static int read_sector(off_t pos)
return -1;
}
sector_ids[pos / TFFS_SECTOR_SIZE] = read_uint32(readbuf, 0x00);
return 0;
}
@@ -176,25 +175,39 @@ static int find_entry(uint32_t id, struct tffs_entry *entry)
off_t pos = 0;
uint8_t block_end = 0;
for (uint32_t sector = 0; sector < sectors->num_sectors; sector++, pos += TFFS_SECTOR_SIZE) {
for (uint32_t sector = 0; sector < num_sectors; sector++, pos += TFFS_SECTOR_SIZE) {
if (block_end) {
if (pos % blocksize == 0) {
block_end = 0;
}
} else if (sector_get_good(sector)) {
if (sector_ids[sector]) {
if (sector_ids[sector] == TFFS_ID_END) {
/* no more entries in this block */
block_end = 1;
continue;
}
if (sector_ids[sector] != id)
continue;
}
if (read_sectoroob(pos) || read_sector(pos)) {
fprintf(stderr, "ERROR: sector isn't readable, but has been previously!\n");
exit(EXIT_FAILURE);
}
uint32_t oob_id = read_uint32(oobbuf, 0x02);
uint32_t oob_len = read_uint32(oobbuf, 0x06);
uint32_t oob_rev = read_uint32(oobbuf, 0x0a);
uint32_t read_id = read_uint32(readbuf, 0x00);
uint32_t read_len = read_uint32(readbuf, 0x04);
uint32_t read_rev = read_uint32(readbuf, 0x0c);
if (read_oob_sector_health && (oob_id != read_id || oob_len != read_len || oob_rev != read_rev)) {
fprintf(stderr, "Warning: sector has inconsistent metadata\n");
continue;
if (read_oob_sector_health) {
uint32_t oob_id = read_uint32(oobbuf, 0x02);
uint32_t oob_len = read_uint32(oobbuf, 0x06);
uint32_t oob_rev = read_uint32(oobbuf, 0x0a);
if (oob_id != read_id || oob_len != read_len || oob_rev != read_rev) {
fprintf(stderr, "Warning: sector has inconsistent metadata\n");
continue;
}
}
if (read_id == TFFS_ID_END) {
/* no more entries in this block */
@@ -414,13 +427,14 @@ static int scan_mtd(void)
blocksize = info.erasesize;
sectors = malloc(sizeof(*sectors) + (info.size / TFFS_SECTOR_SIZE + 7) / 8);
if (sectors == NULL) {
num_sectors = info.size / TFFS_SECTOR_SIZE;
sectors = malloc((num_sectors + 7) / 8);
sector_ids = calloc(num_sectors, sizeof(uint32_t));
if (!sectors || !sector_ids) {
fprintf(stderr, "ERROR: memory allocation failed!\n");
exit(EXIT_FAILURE);
}
sectors->num_sectors = info.size / TFFS_SECTOR_SIZE;
memset(sectors->sectors, 0xff, (info.size / TFFS_SECTOR_SIZE + 7) / 8);
memset(sectors, 0xff, (num_sectors + 7) / 8);
uint32_t sector = 0, valid_blocks = 0;
uint8_t block_ok = 0;
@@ -564,6 +578,7 @@ int main(int argc, char *argv[])
out_free_entry:
free(name_table.val);
out_free_sectors:
free(sector_ids);
free(sectors);
out_close:
close(mtdfd);
+3 -3
View File
@@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/jow-/ucode.git
PKG_SOURCE_DATE:=2022-10-18
PKG_SOURCE_VERSION:=00af065057a0e9c10ce6a6475acc47920790c2a9
PKG_MIRROR_HASH:=58077503b6cabe70334fca8f33f0e443c60de31a1aaadef7079d5d103c547fe1
PKG_SOURCE_DATE:=2022-12-02
PKG_SOURCE_VERSION:=46d93c9cc5da6fce581df86159bd0fc4357de41c
PKG_MIRROR_HASH:=970a47f1bef719f056d40d17398db492bd4de92b98ef9aba4582cb18b4c9b270
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_LICENSE:=ISC
@@ -181,8 +181,8 @@
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&macaddr_caldata_c>;
nvmem-cell-names = "mac-address";
nvmem-cells = <&cal_ath10k>, <&macaddr_caldata_c>;
nvmem-cell-names = "calibration", "mac-address";
};
};
@@ -201,7 +201,8 @@
&wmac {
status = "okay";
mtd-cal-data = <&caldata 0x1000>;
nvmem-cells = <&cal_ath9k>;
nvmem-cell-names = "calibration";
};
&caldata {
@@ -209,6 +210,14 @@
#address-cells = <1>;
#size-cells = <1>;
cal_ath9k: calibration@1000 {
reg = <0x1000 0x440>;
};
cal_ath10k: calibration@5000 {
reg = <0x5000 0x844>;
};
macaddr_caldata_0: macaddr@0 {
reg = <0x0 0x6>;
};
+7 -11
View File
@@ -230,7 +230,7 @@ define Device/linksys_ea4500-v3
endef
TARGET_DEVICES += linksys_ea4500-v3
# fake rootfs is mandatory, pad-offset 129 equals (2 * uimage_header + 0xff)
# fake rootfs is mandatory, pad-offset 64 equals (1 * uimage_header)
define Device/netgear_ath79_nand
DEVICE_VENDOR := NETGEAR
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
@@ -238,15 +238,12 @@ define Device/netgear_ath79_nand
BLOCKSIZE := 128k
PAGESIZE := 2048
IMAGE_SIZE := 25600k
KERNEL := kernel-bin | append-dtb | lzma -d20 | \
pad-offset $$(KERNEL_SIZE) 129 | uImage lzma | \
append-string -e '\xff' | \
append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC)
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | uImage lzma
KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | \
pad-offset $$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC)
IMAGES := sysupgrade.bin factory.img
IMAGE/factory.img := append-kernel | append-ubi | netgear-dni | \
check-size
IMAGE/sysupgrade.bin := sysupgrade-tar | check-size | append-metadata
IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | \
append-ubi | check-size | netgear-dni
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
UBINIZE_OPTS := -E 5
endef
@@ -262,8 +259,7 @@ define Device/netgear_pgzng1
IMAGE_SIZE := 83968k
PAGESIZE := 2048
BLOCKSIZE := 128k
KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
IMAGE/sysupgrade.bin := sysupgrade-tar | check-size | append-metadata
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += netgear_pgzng1
@@ -18,9 +18,6 @@ case "$FIRMWARE" in
caldata_extract "art" 0x5000 0x844
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) 1)
;;
netgear,r6100)
caldata_extract "caldata" 0x5000 0x844
;;
zyxel,emg2926-q10a|\
zyxel,nbg6716)
caldata_extract "art" 0x5000 0x844
@@ -0,0 +1,30 @@
From 1e24c54da257ab93cff5826be8a793b014a5dc9c Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Mon, 21 Nov 2022 01:22:01 +0100
Subject: ca8210: Fix crash by zero initializing data
The struct cas_control embeds multiple generic SPI structures and we
have to make sure these structures are initialized to default values.
This driver does not set all attributes. When using kmalloc before some
attributes were not initialized and contained random data which caused
random crashes at bootup.
Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Link: https://lore.kernel.org/r/20221121002201.1339636-1-hauke@hauke-m.de
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
---
drivers/net/ieee802154/ca8210.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -926,7 +926,7 @@ static int ca8210_spi_transfer(
dev_dbg(&spi->dev, "%s called\n", __func__);
- cas_ctl = kmalloc(sizeof(*cas_ctl), GFP_ATOMIC);
+ cas_ctl = kzalloc(sizeof(*cas_ctl), GFP_ATOMIC);
if (!cas_ctl)
return -ENOMEM;
@@ -0,0 +1,30 @@
From 1e24c54da257ab93cff5826be8a793b014a5dc9c Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Mon, 21 Nov 2022 01:22:01 +0100
Subject: ca8210: Fix crash by zero initializing data
The struct cas_control embeds multiple generic SPI structures and we
have to make sure these structures are initialized to default values.
This driver does not set all attributes. When using kmalloc before some
attributes were not initialized and contained random data which caused
random crashes at bootup.
Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Link: https://lore.kernel.org/r/20221121002201.1339636-1-hauke@hauke-m.de
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
---
drivers/net/ieee802154/ca8210.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -927,7 +927,7 @@ static int ca8210_spi_transfer(
dev_dbg(&spi->dev, "%s called\n", __func__);
- cas_ctl = kmalloc(sizeof(*cas_ctl), GFP_ATOMIC);
+ cas_ctl = kzalloc(sizeof(*cas_ctl), GFP_ATOMIC);
if (!cas_ctl)
return -ENOMEM;
@@ -0,0 +1,96 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include "mt7622-ruijie-rg-ew3200.dtsi"
/ {
model = "reyee AX3200 E5";
compatible = "reyee,ax3200-e5", "mediatek,mt7622";
};
&nor_flash {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi_nor_pins>;
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "Preloader";
reg = <0x0 0x20000>;
read-only;
};
partition@20000 {
label = "ATF";
reg = <0x20000 0x30000>;
read-only;
};
partition@30000 {
label = "u-boot";
reg = <0x30000 0x80000>;
read-only;
};
partition@80000 {
label = "u-boot-env";
reg = <0x80000 0x90000>;
};
factory: partition@90000 {
label = "Factory";
reg = <0x90000 0xd0000>;
read-only;
};
partition@d0000 {
label = "product_info";
reg = <0xd0000 0xe0000>;
read-only;
};
partition@e0000 {
label = "kdump";
reg = <0xe0000 0xf0000>;
read-only;
};
partition@f0000 {
compatible = "denx,fit";
label = "firmware";
reg = <0xf0000 0x1000000>;
};
};
};
};
&wmac {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&epa_elna_pins>;
mediatek,mtd-eeprom = <&factory 0x0>;
};
&slot0 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x5000>;
ieee80211-freq-limit = <5000000 6000000>;
mediatek,disable-radar-background;
};
};
@@ -0,0 +1,241 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include "mt7622.dtsi"
#include "mt6380.dtsi"
/ {
aliases {
ethernet0 = &gmac0;
label-mac-device = &gmac0;
led-boot = &led_system;
led-failsafe = &led_system;
led-running = &led_system;
led-upgrade = &led_system;
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:115200n1";
bootargs = "console=ttyS0,115200n1 swiotlb=512";
};
cpus {
cpu@0 {
proc-supply = <&mt6380_vcpu_reg>;
sram-supply = <&mt6380_vm_reg>;
};
cpu@1 {
proc-supply = <&mt6380_vcpu_reg>;
sram-supply = <&mt6380_vm_reg>;
};
};
gpio-keys {
compatible = "gpio-keys";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
};
wps {
label = "wps";
linux,code = <KEY_WPS_BUTTON>;
gpios = <&pio 102 GPIO_ACTIVE_LOW>;
};
};
gpio-leds {
compatible = "gpio-leds";
mesh_green {
label = "green:mesh";
gpios = <&pio 79 GPIO_ACTIVE_LOW>;
};
mesh_red {
label = "red:mesh";
gpios = <&pio 82 GPIO_ACTIVE_LOW>;
};
led_system: system_blue {
label = "blue:system";
gpios = <&pio 81 GPIO_ACTIVE_LOW>;
default-state = "on";
};
};
memory {
reg = <0 0x40000000 0 0x40000000>;
};
};
&eth {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&eth_pins>;
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-connection-type = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
switch@0 {
compatible = "mediatek,mt7531";
reg = <0>;
reset-gpios = <&pio 54 GPIO_ACTIVE_HIGH>;
interrupt-controller;
#interrupt-cells = <2>;
interrupt-parent = <&pio>;
interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "lan1";
};
port@1 {
reg = <1>;
label = "lan2";
};
port@2 {
reg = <2>;
label = "lan3";
};
port@3 {
reg = <3>;
label = "lan4";
};
wan: port@4 {
reg = <4>;
label = "wan";
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
};
};
};
};
&pcie0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pcie0_pins>;
};
&pio {
epa_elna_pins: epa-elna-pins {
mux {
function = "antsel";
groups = "antsel0", "antsel1", "antsel2", "antsel3",
"antsel4", "antsel5", "antsel6", "antsel7",
"antsel8", "antsel9", "antsel12", "antsel13",
"antsel14", "antsel15", "antsel16", "antsel17";
};
};
eth_pins: eth-pins {
mux {
function = "eth";
groups = "mdc_mdio", "rgmii_via_gmac2";
};
};
pcie0_pins: pcie0-pins {
mux {
function = "pcie";
groups = "pcie0_pad_perst",
"pcie0_0_waken",
"pcie0_0_clkreq";
};
};
pmic_bus_pins: pmic-bus-pins {
mux {
function = "pmic";
groups = "pmic_bus";
};
};
spi_nor_pins: spi-nor-pins {
mux {
function = "flash";
groups = "spi_nor";
};
};
uart0_pins: uart0-pins {
mux {
function = "uart";
groups = "uart0_0_tx_rx";
};
};
watchdog_pins: watchdog-pins {
mux {
function = "watchdog";
groups = "watchdog";
};
};
};
&pwrap {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pmic_bus_pins>;
};
&rtc {
status = "disabled";
};
&uart0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins>;
};
&watchdog {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&watchdog_pins>;
};
@@ -1,239 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include "mt7622.dtsi"
#include "mt6380.dtsi"
#include "mt7622-ruijie-rg-ew3200.dtsi"
/ {
model = "Ruijie RG-EW3200GX PRO";
compatible = "ruijie,rg-ew3200gx-pro", "mediatek,mt7622";
aliases {
ethernet0 = &gmac0;
label-mac-device = &gmac0;
led-boot = &led_system;
led-failsafe = &led_system;
led-running = &led_system;
led-upgrade = &led_system;
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:115200n1";
bootargs = "console=ttyS0,115200n1 swiotlb=512";
};
cpus {
cpu@0 {
proc-supply = <&mt6380_vcpu_reg>;
sram-supply = <&mt6380_vm_reg>;
};
cpu@1 {
proc-supply = <&mt6380_vcpu_reg>;
sram-supply = <&mt6380_vm_reg>;
};
};
gpio-keys {
compatible = "gpio-keys";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
};
wps {
label = "wps";
linux,code = <KEY_WPS_BUTTON>;
gpios = <&pio 102 GPIO_ACTIVE_LOW>;
};
};
gpio-leds {
compatible = "gpio-leds";
mesh_green {
label = "green:mesh";
gpios = <&pio 79 GPIO_ACTIVE_LOW>;
};
mesh_red {
label = "red:mesh";
gpios = <&pio 82 GPIO_ACTIVE_LOW>;
};
led_system: system_blue {
label = "blue:system";
gpios = <&pio 81 GPIO_ACTIVE_LOW>;
default-state = "on";
};
};
memory {
reg = <0 0x40000000 0 0x40000000>;
};
};
&eth {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&eth_pins>;
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-connection-type = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
switch@0 {
compatible = "mediatek,mt7531";
reg = <0>;
reset-gpios = <&pio 54 GPIO_ACTIVE_HIGH>;
interrupt-controller;
#interrupt-cells = <2>;
interrupt-parent = <&pio>;
interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "lan1";
};
port@1 {
reg = <1>;
label = "lan2";
};
port@2 {
reg = <2>;
label = "lan3";
};
port@3 {
reg = <3>;
label = "lan4";
};
wan: port@4 {
reg = <4>;
label = "wan";
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
};
};
};
};
&pcie0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pcie0_pins>;
};
&slot0 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x5000>;
ieee80211-freq-limit = <5000000 6000000>;
mediatek,disable-radar-background;
};
};
&pio {
epa_elna_pins: epa-elna-pins {
mux {
function = "antsel";
groups = "antsel0", "antsel1", "antsel2", "antsel3",
"antsel4", "antsel5", "antsel6", "antsel7",
"antsel8", "antsel9", "antsel12", "antsel13",
"antsel14", "antsel15", "antsel16", "antsel17";
};
};
eth_pins: eth-pins {
mux {
function = "eth";
groups = "mdc_mdio", "rgmii_via_gmac2";
};
};
pcie0_pins: pcie0-pins {
mux {
function = "pcie";
groups = "pcie0_pad_perst",
"pcie0_0_waken",
"pcie0_0_clkreq";
};
};
pmic_bus_pins: pmic-bus-pins {
mux {
function = "pmic";
groups = "pmic_bus";
};
};
spi_nor_pins: spi-nor-pins {
mux {
function = "flash";
groups = "spi_nor";
};
};
uart0_pins: uart0-pins {
mux {
function = "uart";
groups = "uart0_0_tx_rx";
};
};
watchdog_pins: watchdog-pins {
mux {
function = "watchdog";
groups = "watchdog";
};
};
};
&pwrap {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pmic_bus_pins>;
};
&nor_flash {
@@ -302,24 +74,6 @@
};
};
&rtc {
status = "disabled";
};
&uart0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins>;
};
&watchdog {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&watchdog_pins>;
};
&wmac {
status = "okay";
@@ -327,3 +81,13 @@
pinctrl-0 = <&epa_elna_pins>;
mediatek,mtd-eeprom = <&factory 0x0>;
};
&slot0 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x5000>;
ieee80211-freq-limit = <5000000 6000000>;
mediatek,disable-radar-background;
};
};
+9
View File
@@ -237,6 +237,15 @@ define Device/ruijie_rg-ew3200gx-pro
endef
TARGET_DEVICES += ruijie_rg-ew3200gx-pro
define Device/reyee_ax3200-e5
DEVICE_VENDOR := reyee
DEVICE_MODEL := AX3200 E5
DEVICE_DTS := mt7622-reyee-ax3200-e5
DEVICE_DTS_DIR := ../dts
DEVICE_PACKAGES := kmod-mt7915e
endef
TARGET_DEVICES += reyee_ax3200-e5
define Device/totolink_a8000ru
DEVICE_VENDOR := TOTOLINK
DEVICE_MODEL := A8000RU
+1 -1
View File
@@ -29,7 +29,7 @@ $(eval $(call KernelPackage,btmtkuart))
define KernelPackage/iio-mt6577-auxadc
TITLE:=Mediatek AUXADC driver
DEPENDS:=@(TARGET_mediatek_mt7622||TARGET_mediatek_mt7623||TARGET_mediatek_filogic)
DEPENDS:=@(TARGET_mediatek_mt7622||TARGET_mediatek_filogic)
KCONFIG:=CONFIG_MEDIATEK_MT6577_AUXADC
FILES:= \
$(LINUX_DIR)/drivers/iio/adc/mt6577_auxadc.ko
@@ -14,6 +14,7 @@ mediatek_setup_interfaces()
linksys,e8450-ubi|\
mediatek,mt7622-rfb1|\
mediatek,mt7622-rfb1-ubi|\
reyee,ax3200-e5|\
ruijie,rg-ew3200gx-pro)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan
;;
@@ -53,6 +54,7 @@ mediatek_setup_macs()
local label_mac=""
case $board in
reyee,ax3200-e5|\
ruijie,rg-ew3200gx-pro)
lan_mac=$(macaddr_add $(get_mac_label) 1)
;;
@@ -13,6 +13,7 @@ case "$board" in
bananapi,bpi-r64)
[ "$PHYNBR" = "0" ] && macaddr_add $(cat /sys/class/net/eth0/address) 2 > /sys${DEVPATH}/macaddress
;;
reyee,ax3200-e5|\
ruijie,rg-ew3200gx-pro)
[ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 3 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 2 > /sys${DEVPATH}/macaddress
+2
View File
@@ -266,6 +266,7 @@ CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MT65XX=y
CONFIG_ICPLUS_PHY=y
CONFIG_IIO=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_INPUT=y
CONFIG_INPUT_EVDEV=y
@@ -320,6 +321,7 @@ CONFIG_MDIO_DEVICE=y
CONFIG_MDIO_DEVRES=y
CONFIG_MDIO_GPIO=y
CONFIG_MEDIATEK_GE_PHY=y
CONFIG_MEDIATEK_MT6577_AUXADC=y
CONFIG_MEDIATEK_WATCHDOG=y
CONFIG_MEMFD_CREATE=y
CONFIG_MEMORY=y
@@ -49,6 +49,7 @@
status = "okay";
label = "sfp";
phy-mode = "rgmii-rxid";
phy-handle = <&ephy7>;
};
@@ -0,0 +1,184 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "mt7621.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
compatible = "wavlink,ws-wn572hp3-4g", "mediatek,mt7621-soc";
model = "Wavlink WS-WN572HP3 4G";
chosen {
bootargs = "console=ttyS0,115200";
};
aliases {
label-mac-device = &wifi1;
led-boot = &led_status_blue;
led-failsafe = &led_status_blue;
led-running = &led_status_blue;
led-upgrade = &led_status_blue;
};
keys {
compatible = "gpio-keys";
reset {
label = "Reset Button";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
leds {
compatible = "gpio-leds";
rssihigh {
label = "blue:rssihigh";
gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
};
rssimedium {
label = "blue:rssimedium";
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
};
rssilow {
label = "blue:rssilow";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
};
led_status_blue: status_blue {
label = "blue:status";
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
};
// gpio 15 would be Quectels PWRKEY if used
};
};
&spi0 {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <40000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "config";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
compatible = "denx,fit";
label = "firmware";
reg = <0x50000 0xf30000>;
};
partition@f00000 {
label = "vendor";
reg = <0xf80000 0x80000>;
read-only;
};
};
};
};
&pcie {
status = "okay";
};
&pcie0 {
wifi0: mt76@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0>;
};
};
&pcie1 {
wifi1: mt76@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x8000>;
};
};
&gmac0 {
nvmem-cells = <&macaddr_factory_e000>;
nvmem-cell-names = "mac-address";
};
&gmac1 {
status = "okay";
label = "wan";
phy-handle = <&ethphy4>;
nvmem-cells = <&macaddr_factory_e006>;
nvmem-cell-names = "mac-address";
};
&mdio {
ethphy4: ethernet-phy@4 {
reg = <4>;
};
};
&switch0 {
ports {
port@1 {
status = "okay";
label = "lan";
};
};
};
&state_default {
gpio {
groups = "wdt";
function = "gpio";
};
};
&factory {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_factory_e000: macaddr@e000 {
reg = <0xe000 0x6>;
};
macaddr_factory_e006: macaddr@e006 {
reg = <0xe006 0x6>;
};
};
&wifi0{
ieee80211-freq-limit = <2400000 2500000>;
};
&wifi1{
ieee80211-freq-limit = <5000000 6000000>;
};
+24 -20
View File
@@ -49,23 +49,6 @@ define Build/haier-sim_wr1800k-factory
$(CP) $(1) $(BIN_DIR)/
endef
define Build/iodata-factory
$(eval fw_size=$(word 1,$(1)))
$(eval fw_type=$(word 2,$(1)))
$(eval product=$(word 3,$(1)))
$(eval factory_bin=$(word 4,$(1)))
if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(fw_size)" ]; then \
$(CP) $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) $(factory_bin); \
$(STAGING_DIR_HOST)/bin/mksenaofw \
-r 0x30a -p $(product) -t $(fw_type) \
-e $(factory_bin) -o $(factory_bin).new; \
mv $(factory_bin).new $(factory_bin); \
$(CP) $(factory_bin) $(BIN_DIR)/; \
else \
echo "WARNING: initramfs kernel image too big, cannot generate factory image (actual $$(stat -c%s $@); max $(fw_size))" >&2; \
fi
endef
define Build/iodata-mstc-header
( \
data_size_crc="$$(dd if=$@ ibs=64 skip=1 2>/dev/null | gzip -c | \
@@ -973,10 +956,11 @@ define Device/iodata_wn-ax1167gr
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)
IMAGE_SIZE := 15552k
KERNEL_INITRAMFS := $$(KERNEL) | \
iodata-factory 7864320 4 0x1055 $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.bin
DEVICE_VENDOR := I-O DATA
DEVICE_MODEL := WN-AX1167GR
ARTIFACTS := initramfs-factory.bin
ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \
check-size 7680k | senao-header -r 0x30a -p 0x1055 -t 4
DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2
endef
TARGET_DEVICES += iodata_wn-ax1167gr
@@ -1681,6 +1665,7 @@ TARGET_DEVICES += netgear_wndr3700-v5
define Device/netis_wf2881
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)
BLOCKSIZE := 128k
PAGESIZE := 2048
FILESYSTEMS := squashfs
@@ -1688,7 +1673,7 @@ define Device/netis_wf2881
IMAGE_SIZE := 129280k
UBINIZE_OPTS := -E 5
UIMAGE_NAME := WF2881_0.0.00
KERNEL_INITRAMFS := $(KERNEL_DTB) | netis-tail WF2881 | uImage lzma
KERNEL_INITRAMFS := $$(KERNEL) | netis-tail WF2881
IMAGES += factory.bin
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
@@ -2080,6 +2065,7 @@ define Device/ubnt_unifi-flexhd
DEVICE_VENDOR := Ubiquiti
DEVICE_MODEL := UniFi FlexHD
DEVICE_DTS_CONFIG := config@2
DEVICE_DTS_LOADADDR := 0x87000000
KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware kmod-leds-ubnt-ledbar
IMAGE_SIZE := 15552k
@@ -2100,6 +2086,7 @@ define Device/ubnt_usw-flex
DEVICE_VENDOR := Ubiquiti
DEVICE_MODEL := UniFi Switch Flex
DEVICE_DTS_CONFIG := config@1
DEVICE_DTS_LOADADDR := 0x87000000
KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
IMAGE_SIZE := 7360k
endef
@@ -2159,6 +2146,23 @@ define Device/wavlink_wl-wn533a8
endef
TARGET_DEVICES += wavlink_wl-wn533a8
define Device/wavlink_ws-wn572hp3-4g
$(Device/dsa-migration)
BLOCKSIZE := 64k
DEVICE_VENDOR := Wavlink
DEVICE_MODEL := WS-WN572HP3
DEVICE_VARIANT := 4G
IMAGE_SIZE := 15040k
KERNEL_LOADADDR := 0x82000000
KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
append-rootfs | pad-rootfs | check-size | append-metadata
DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \
kmod-usb3 kmod-usb-net-rndis comgt-ncm
endef
TARGET_DEVICES += wavlink_ws-wn572hp3-4g
define Device/wevo_11acnas
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)
@@ -50,6 +50,7 @@ ramips_setup_interfaces()
;;
asiarf,ap7621-001|\
humax,e10|\
wavlink,ws-wn572hp3-4g|\
winstars,ws-wn583a6)
ucidef_set_interfaces_lan_wan "lan" "wan"
;;
+2 -2
View File
@@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=cmake
PKG_VERSION:=3.24.2
PKG_VERSION:=3.25.1
PKG_VERSION_MAJOR:=$(word 1,$(subst ., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION)))
PKG_RELEASE:=1
PKG_CPE_ID:=cpe:/a:kitware:cmake
@@ -15,7 +15,7 @@ PKG_CPE_ID:=cpe:/a:kitware:cmake
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \
https://cmake.org/files/v$(PKG_VERSION_MAJOR)/
PKG_HASH:=0d9020f06f3ddf17fb537dc228e1a56c927ee506b486f55fe2dc19f69bf0c8db
PKG_HASH:=1c511d09516af493694ed9baf13c55947a36389674d657a2d5e0ccedc6b291d8
HOST_BUILD_PARALLEL:=1
HOST_CONFIGURE_PARALLEL:=1
@@ -20,7 +20,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
---
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -594,6 +594,14 @@ if(CURL_USE_OPENSSL)
@@ -611,6 +611,14 @@ if(CURL_USE_OPENSSL)
endif()
set(SSL_ENABLED ON)
set(USE_OPENSSL ON)
@@ -1,6 +1,6 @@
--- a/bootstrap
+++ b/bootstrap
@@ -1441,7 +1441,10 @@ int main(){ printf("1%c", (char)0x0a); r
@@ -1449,7 +1449,10 @@ int main(){ printf("1%c", (char)0x0a); r
' > "test.c"
cmake_original_make_flags="${cmake_make_flags}"
if test "x${cmake_parallel_make}" != "x"; then
@@ -1,6 +1,6 @@
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -630,8 +630,13 @@ IF(ENABLE_ZSTD)
@@ -632,8 +632,13 @@ IF(ENABLE_ZSTD)
SET(ZSTD_FIND_QUIETLY TRUE)
ENDIF (ZSTD_INCLUDE_DIR)
+1 -1
View File
@@ -11,7 +11,7 @@ PKG_NAME:=e2fsprogs
PKG_CPE_ID:=cpe:/a:e2fsprogs_project:e2fsprogs
PKG_VERSION:=1.46.5
PKG_HASH:=2f16c9176704cf645dc69d5b15ff704ae722d665df38b2ed3cfc249757d8d81e
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/
@@ -0,0 +1,50 @@
From ab51d587bb9b229b1fade1afd02e1574c1ba5c76 Mon Sep 17 00:00:00 2001
From: Lukas Czerner <lczerner@redhat.com>
Date: Thu, 21 Apr 2022 19:31:48 +0200
Subject: libext2fs: add sanity check to extent manipulation
It is possible to have a corrupted extent tree in such a way that a leaf
node contains zero extents in it. Currently if that happens and we try
to traverse the tree we can end up accessing wrong data, or possibly
even uninitialized memory. Make sure we don't do that.
Additionally make sure that we have a sane number of bytes passed to
memmove() in ext2fs_extent_delete().
Note that e2fsck is currently unable to spot and fix such corruption in
pass1.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Nils Bars <nils_bars@t-online.de>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2068113
Addresses: CVE-2022-1304
Addresses-Debian-Bug: #1010263
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/ext2fs/extent.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/lib/ext2fs/extent.c
+++ b/lib/ext2fs/extent.c
@@ -495,6 +495,10 @@ retry:
ext2fs_le16_to_cpu(eh->eh_entries);
newpath->max_entries = ext2fs_le16_to_cpu(eh->eh_max);
+ /* Make sure there is at least one extent present */
+ if (newpath->left <= 0)
+ return EXT2_ET_EXTENT_NO_DOWN;
+
if (path->left > 0) {
ix++;
newpath->end_blk = ext2fs_le32_to_cpu(ix->ei_block);
@@ -1630,6 +1634,10 @@ errcode_t ext2fs_extent_delete(ext2_exte
cp = path->curr;
+ /* Sanity check before memmove() */
+ if (path->left < 0)
+ return EXT2_ET_EXTENT_LEAF_BAD;
+
if (path->left) {
memmove(cp, cp + sizeof(struct ext3_extent_idx),
path->left * sizeof(struct ext3_extent_idx));