forked from armbian/build
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add general 2024.07 patches to nanopi-r5c u-boot (armbian#7056)
- Loading branch information
Showing
4 changed files
with
197 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
patch/u-boot/v2024.07/board_nanopi-r5c/general-btrfs-fix-out-of-bounds-write.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
From ee1941e4fec601a8444f49c7dad04ad700d501a6 Mon Sep 17 00:00:00 2001 | ||
From: Alex Shumsky <[email protected]> | ||
Date: Wed, 19 Jun 2024 00:41:38 +0300 | ||
Subject: [PATCH] fs: btrfs: fix out of bounds write | ||
|
||
Fix btrfs_read/read_and_truncate_page write out of bounds of destination | ||
buffer. Old behavior break bootstd malloc'd buffers of exact file size. | ||
Previously this OOB write have not been noticed because distroboot usually | ||
read files into huge static memory areas. | ||
|
||
Signed-off-by: Alex Shumsky <[email protected]> | ||
Fixes: e342718 ("fs: btrfs: Implement btrfs_file_read()") | ||
Reviewed-by: Qu Wenruo <[email protected]> | ||
--- | ||
fs/btrfs/inode.c | 8 ++++++-- | ||
1 file changed, 6 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c | ||
index 4691612eda33..3998ffc2c819 100644 | ||
--- a/fs/btrfs/inode.c | ||
+++ b/fs/btrfs/inode.c | ||
@@ -640,7 +640,11 @@ static int read_and_truncate_page(struct btrfs_path *path, | ||
extent_type = btrfs_file_extent_type(leaf, fi); | ||
if (extent_type == BTRFS_FILE_EXTENT_INLINE) { | ||
ret = btrfs_read_extent_inline(path, fi, buf); | ||
- memcpy(dest, buf + page_off, min(page_len, ret)); | ||
+ if (ret < 0) { | ||
+ free(buf); | ||
+ return ret; | ||
+ } | ||
+ memcpy(dest, buf + page_off, min3(page_len, ret, len)); | ||
free(buf); | ||
return len; | ||
} | ||
@@ -652,7 +656,7 @@ static int read_and_truncate_page(struct btrfs_path *path, | ||
free(buf); | ||
return ret; | ||
} | ||
- memcpy(dest, buf + page_off, page_len); | ||
+ memcpy(dest, buf + page_off, min(page_len, len)); | ||
free(buf); | ||
return len; | ||
} |
53 changes: 53 additions & 0 deletions
53
patch/u-boot/v2024.07/board_nanopi-r5c/general-dw-hdmi-disable.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Paolo Sabatino <[email protected]> | ||
Date: Sun, 30 Jun 2024 17:36:02 +0200 | ||
Subject: add dw_hdmi_disable() function to DW-HDMI driver | ||
|
||
--- | ||
drivers/video/dw_hdmi.c | 17 ++++++++++ | ||
include/dw_hdmi.h | 1 + | ||
2 files changed, 18 insertions(+) | ||
|
||
diff --git a/drivers/video/dw_hdmi.c b/drivers/video/dw_hdmi.c | ||
index 111111111111..222222222222 100644 | ||
--- a/drivers/video/dw_hdmi.c | ||
+++ b/drivers/video/dw_hdmi.c | ||
@@ -1025,6 +1025,23 @@ int dw_hdmi_enable(struct dw_hdmi *hdmi, const struct display_timing *edid) | ||
return 0; | ||
} | ||
|
||
+int dw_hdmi_disable(struct dw_hdmi *hdmi) | ||
+{ | ||
+ uint clkdis; | ||
+ | ||
+ /* disable pixel clock and tmds data path */ | ||
+ clkdis = 0x7f; | ||
+ hdmi_write(hdmi, clkdis, HDMI_MC_CLKDIS); | ||
+ | ||
+ /* disable phy */ | ||
+ hdmi_phy_sel_interface_control(hdmi, 0); | ||
+ hdmi_phy_enable_tmds(hdmi, 0); | ||
+ hdmi_phy_enable_power(hdmi, 0); | ||
+ | ||
+ return 0; | ||
+ | ||
+} | ||
+ | ||
static const struct dw_hdmi_phy_ops dw_hdmi_synopsys_phy_ops = { | ||
.phy_set = dw_hdmi_phy_cfg, | ||
}; | ||
diff --git a/include/dw_hdmi.h b/include/dw_hdmi.h | ||
index 111111111111..222222222222 100644 | ||
--- a/include/dw_hdmi.h | ||
+++ b/include/dw_hdmi.h | ||
@@ -562,6 +562,7 @@ int dw_hdmi_phy_wait_for_hpd(struct dw_hdmi *hdmi); | ||
void dw_hdmi_phy_init(struct dw_hdmi *hdmi); | ||
|
||
int dw_hdmi_enable(struct dw_hdmi *hdmi, const struct display_timing *edid); | ||
+int dw_hdmi_disable(struct dw_hdmi *hdmi); | ||
int dw_hdmi_read_edid(struct dw_hdmi *hdmi, u8 *buf, int buf_size); | ||
void dw_hdmi_init(struct dw_hdmi *hdmi); | ||
int dw_hdmi_detect_hpd(struct dw_hdmi *hdmi); | ||
-- | ||
Armbian | ||
|
56 changes: 56 additions & 0 deletions
56
patch/u-boot/v2024.07/board_nanopi-r5c/general-dwc-otg-usb-fix.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Paolo Sabatino <[email protected]> | ||
Date: Fri, 12 Mar 2021 20:20:12 +0000 | ||
Subject: [ARCHEOLOGY] Changes and fixes to rk322x uboot and kernel config | ||
|
||
> X-Git-Archeology: > recovered message: > - Enabled nfc on rk322x-dev and disable on rk322x-current (need further development) | ||
> X-Git-Archeology: > recovered message: > - Tidied up rk322x-current device tree | ||
> X-Git-Archeology: > recovered message: > - enabled nfc rockchip driver enabled in rk322x-dev kernel config | ||
> X-Git-Archeology: > recovered message: > - Enabled EHCI controller in u-boot (added patch for inno-phy, device tree and config bits), better device detection for dwc2 usb otg port | ||
> X-Git-Archeology: > recovered message: > - Removed SPL_FIT_GENERATOR from u-boot configuration, fixed .its file to use binman | ||
> X-Git-Archeology: > recovered message: > - fixed rk322x its file (now includes dtb), reverted u-boot to v2020.10 and changed dev_* into log_debug() calls | ||
> X-Git-Archeology: - Revision 95425c27b9d3bbb96e7936cc531638c9150538f9: https://github.com/armbian/build/commit/95425c27b9d3bbb96e7936cc531638c9150538f9 | ||
> X-Git-Archeology: Date: Fri, 12 Mar 2021 20:20:12 +0000 | ||
> X-Git-Archeology: From: Paolo Sabatino <[email protected]> | ||
> X-Git-Archeology: Subject: Changes and fixes to rk322x uboot and kernel config | ||
> X-Git-Archeology: | ||
> X-Git-Archeology: - Revision 5130cc32fd9b18ecf71d5d26b688859ede0ffe03: https://github.com/armbian/build/commit/5130cc32fd9b18ecf71d5d26b688859ede0ffe03 | ||
> X-Git-Archeology: Date: Mon, 20 Jun 2022 08:35:13 +0200 | ||
> X-Git-Archeology: From: Paolo Sabatino <[email protected]> | ||
> X-Git-Archeology: Subject: rockchip64: fix u-boot USB OTG patch name | ||
> X-Git-Archeology: | ||
> X-Git-Archeology: - Revision d4daf41404853fc13813dc4eb9f6cad76f95945c: https://github.com/armbian/build/commit/d4daf41404853fc13813dc4eb9f6cad76f95945c | ||
> X-Git-Archeology: Date: Mon, 20 Jun 2022 08:35:13 +0200 | ||
> X-Git-Archeology: From: Paolo Sabatino <[email protected]> | ||
> X-Git-Archeology: Subject: rockchip64: add sdmmc_ext node, mmc reset properties and otg usb fix to u-boot | ||
> X-Git-Archeology: | ||
> X-Git-Archeology: - Revision efee17f217e58a93e795c165e303bfd0a2a0a32a: https://github.com/armbian/build/commit/efee17f217e58a93e795c165e303bfd0a2a0a32a | ||
> X-Git-Archeology: Date: Mon, 22 Apr 2024 12:39:09 +0200 | ||
> X-Git-Archeology: From: Paolo Sabatino <[email protected]> | ||
> X-Git-Archeology: Subject: rockchip64: bump rk3318-box uboot to v2024.01 | ||
> X-Git-Archeology: | ||
> X-Git-Archeology: - Revision 7876017d0b77bbfefbb3d112045b32d9b50db928: https://github.com/armbian/build/commit/7876017d0b77bbfefbb3d112045b32d9b50db928 | ||
> X-Git-Archeology: Date: Tue, 02 Jul 2024 23:31:50 +0000 | ||
> X-Git-Archeology: From: Paolo <[email protected]> | ||
> X-Git-Archeology: Subject: Bump rk322x-box and rk3318-box to u-boot v2024.07-rc5 (#6855) | ||
> X-Git-Archeology: | ||
--- | ||
drivers/usb/host/dwc2.c | 2 ++ | ||
1 file changed, 2 insertions(+) | ||
|
||
diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c | ||
index 111111111111..222222222222 100644 | ||
--- a/drivers/usb/host/dwc2.c | ||
+++ b/drivers/usb/host/dwc2.c | ||
@@ -441,6 +441,8 @@ static void dwc_otg_core_init(struct udevice *dev) | ||
|
||
writel(usbcfg, ®s->gusbcfg); | ||
|
||
+ mdelay(10); | ||
+ | ||
/* Program the GAHBCFG Register. */ | ||
switch (readl(®s->ghwcfg2) & DWC2_HWCFG2_ARCHITECTURE_MASK) { | ||
case DWC2_HWCFG2_ARCHITECTURE_SLAVE_ONLY: | ||
-- | ||
Armbian | ||
|
45 changes: 45 additions & 0 deletions
45
patch/u-boot/v2024.07/board_nanopi-r5c/general-fix-inno-phy-macro.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Paolo Sabatino <[email protected]> | ||
Date: Sun, 16 Jun 2024 18:07:03 +0200 | ||
Subject: fix inno_poll macro | ||
|
||
--- | ||
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 8 ++++---- | ||
1 file changed, 4 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | ||
index 111111111111..222222222222 100644 | ||
--- a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | ||
+++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | ||
@@ -432,8 +432,8 @@ static inline void inno_update_bits(struct inno_hdmi_phy *inno, u8 reg, | ||
inno_write(inno, reg, tmp); | ||
} | ||
|
||
-#define inno_poll(reg, val, cond, sleep_us, timeout_us) \ | ||
- readl_poll_sleep_timeout((reg) * 4, val, cond, sleep_us, timeout_us) | ||
+#define inno_poll(inno, reg, val, cond, sleep_us, timeout_us) \ | ||
+ readl_poll_sleep_timeout(inno->regs + (reg * 4), val, cond, sleep_us, timeout_us) | ||
|
||
static unsigned long inno_hdmi_phy_get_tmdsclk(struct inno_hdmi_phy *inno, | ||
unsigned long rate) | ||
@@ -575,7 +575,7 @@ inno_hdmi_phy_rk3328_clk_set_rate(struct phy *phy, | ||
inno_update_bits(inno, 0xa0, RK3328_PRE_PLL_POWER_DOWN, 0); | ||
|
||
/* Wait for Pre-PLL lock */ | ||
- ret = inno_poll(0xa9, val, val & RK3328_PRE_PLL_LOCK_STATUS, | ||
+ ret = inno_poll(inno, 0xa9, val, val & RK3328_PRE_PLL_LOCK_STATUS, | ||
1000, 10000); | ||
if (ret) { | ||
dev_err(phy->dev, "Pre-PLL locking failed\n"); | ||
@@ -674,7 +674,7 @@ inno_hdmi_phy_rk3328_power_on(struct phy *phy, | ||
RK3328_TMDS_DRIVER_ENABLE); | ||
|
||
/* Wait for post PLL lock */ | ||
- ret = inno_poll(0xaf, v, v & RK3328_POST_PLL_LOCK_STATUS, | ||
+ ret = inno_poll(inno, 0xaf, v, v & RK3328_POST_PLL_LOCK_STATUS, | ||
1000, 10000); | ||
if (ret) { | ||
dev_err(phy->dev, "Post-PLL locking failed\n"); | ||
-- | ||
Armbian | ||
|