Compare commits
10 Commits
ea2c05ced4
...
0147195042
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0147195042 | ||
|
|
ba5d74937f | ||
|
|
573550fda7 | ||
|
|
fc4e622100 | ||
|
|
a55f47f97a | ||
|
|
40480ab251 | ||
|
|
353ae8e87b | ||
|
|
d0c5a48a2a | ||
|
|
91aabaef77 | ||
|
|
9613706ce2 |
122
backport-0001-CVE-2022-2347.patch
Normal file
122
backport-0001-CVE-2022-2347.patch
Normal file
@ -0,0 +1,122 @@
|
||||
From fbce985e28eaca3af82afecc11961aadaf971a7e Mon Sep 17 00:00:00 2001
|
||||
From: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
|
||||
Date: Thu, 3 Nov 2022 09:37:48 +0530
|
||||
Subject: [PATCH] usb: gadget: dfu: Fix the unchecked length field
|
||||
|
||||
DFU implementation does not bound the length field in USB
|
||||
DFU download setup packets, and it does not verify that
|
||||
the transfer direction. Fixing the length and transfer
|
||||
direction.
|
||||
|
||||
CVE-2022-2347
|
||||
|
||||
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
|
||||
Reviewed-by: Marek Vasut <marex@denx.de>
|
||||
---
|
||||
drivers/usb/gadget/f_dfu.c | 56 ++++++++++++++++++++++++--------------
|
||||
1 file changed, 37 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
|
||||
index e9340ff5cb4d..33ef62f8babe 100644
|
||||
--- a/drivers/usb/gadget/f_dfu.c
|
||||
+++ b/drivers/usb/gadget/f_dfu.c
|
||||
@@ -321,21 +321,29 @@ static int state_dfu_idle(struct f_dfu *f_dfu,
|
||||
u16 len = le16_to_cpu(ctrl->wLength);
|
||||
int value = 0;
|
||||
|
||||
+ len = len > DFU_USB_BUFSIZ ? DFU_USB_BUFSIZ : len;
|
||||
+
|
||||
switch (ctrl->bRequest) {
|
||||
case USB_REQ_DFU_DNLOAD:
|
||||
- if (len == 0) {
|
||||
- f_dfu->dfu_state = DFU_STATE_dfuERROR;
|
||||
- value = RET_STALL;
|
||||
- break;
|
||||
+ if (ctrl->bRequestType == USB_DIR_OUT) {
|
||||
+ if (len == 0) {
|
||||
+ f_dfu->dfu_state = DFU_STATE_dfuERROR;
|
||||
+ value = RET_STALL;
|
||||
+ break;
|
||||
+ }
|
||||
+ f_dfu->dfu_state = DFU_STATE_dfuDNLOAD_SYNC;
|
||||
+ f_dfu->blk_seq_num = w_value;
|
||||
+ value = handle_dnload(gadget, len);
|
||||
}
|
||||
- f_dfu->dfu_state = DFU_STATE_dfuDNLOAD_SYNC;
|
||||
- f_dfu->blk_seq_num = w_value;
|
||||
- value = handle_dnload(gadget, len);
|
||||
break;
|
||||
case USB_REQ_DFU_UPLOAD:
|
||||
- f_dfu->dfu_state = DFU_STATE_dfuUPLOAD_IDLE;
|
||||
- f_dfu->blk_seq_num = 0;
|
||||
- value = handle_upload(req, len);
|
||||
+ if (ctrl->bRequestType == USB_DIR_IN) {
|
||||
+ f_dfu->dfu_state = DFU_STATE_dfuUPLOAD_IDLE;
|
||||
+ f_dfu->blk_seq_num = 0;
|
||||
+ value = handle_upload(req, len);
|
||||
+ if (value >= 0 && value < len)
|
||||
+ f_dfu->dfu_state = DFU_STATE_dfuIDLE;
|
||||
+ }
|
||||
break;
|
||||
case USB_REQ_DFU_ABORT:
|
||||
/* no zlp? */
|
||||
@@ -426,11 +432,15 @@ static int state_dfu_dnload_idle(struct f_dfu *f_dfu,
|
||||
u16 len = le16_to_cpu(ctrl->wLength);
|
||||
int value = 0;
|
||||
|
||||
+ len = len > DFU_USB_BUFSIZ ? DFU_USB_BUFSIZ : len;
|
||||
+
|
||||
switch (ctrl->bRequest) {
|
||||
case USB_REQ_DFU_DNLOAD:
|
||||
- f_dfu->dfu_state = DFU_STATE_dfuDNLOAD_SYNC;
|
||||
- f_dfu->blk_seq_num = w_value;
|
||||
- value = handle_dnload(gadget, len);
|
||||
+ if (ctrl->bRequestType == USB_DIR_OUT) {
|
||||
+ f_dfu->dfu_state = DFU_STATE_dfuDNLOAD_SYNC;
|
||||
+ f_dfu->blk_seq_num = w_value;
|
||||
+ value = handle_dnload(gadget, len);
|
||||
+ }
|
||||
break;
|
||||
case USB_REQ_DFU_ABORT:
|
||||
f_dfu->dfu_state = DFU_STATE_dfuIDLE;
|
||||
@@ -513,13 +523,17 @@ static int state_dfu_upload_idle(struct f_dfu *f_dfu,
|
||||
u16 len = le16_to_cpu(ctrl->wLength);
|
||||
int value = 0;
|
||||
|
||||
+ len = len > DFU_USB_BUFSIZ ? DFU_USB_BUFSIZ : len;
|
||||
+
|
||||
switch (ctrl->bRequest) {
|
||||
case USB_REQ_DFU_UPLOAD:
|
||||
- /* state transition if less data then requested */
|
||||
- f_dfu->blk_seq_num = w_value;
|
||||
- value = handle_upload(req, len);
|
||||
- if (value >= 0 && value < len)
|
||||
- f_dfu->dfu_state = DFU_STATE_dfuIDLE;
|
||||
+ if (ctrl->bRequestType == USB_DIR_IN) {
|
||||
+ /* state transition if less data then requested */
|
||||
+ f_dfu->blk_seq_num = w_value;
|
||||
+ value = handle_upload(req, len);
|
||||
+ if (value >= 0 && value < len)
|
||||
+ f_dfu->dfu_state = DFU_STATE_dfuIDLE;
|
||||
+ }
|
||||
break;
|
||||
case USB_REQ_DFU_ABORT:
|
||||
f_dfu->dfu_state = DFU_STATE_dfuIDLE;
|
||||
@@ -595,6 +609,8 @@ dfu_handle(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
|
||||
int value = 0;
|
||||
u8 req_type = ctrl->bRequestType & USB_TYPE_MASK;
|
||||
|
||||
+ len = len > DFU_USB_BUFSIZ ? DFU_USB_BUFSIZ : len;
|
||||
+
|
||||
debug("w_value: 0x%x len: 0x%x\n", w_value, len);
|
||||
debug("req_type: 0x%x ctrl->bRequest: 0x%x f_dfu->dfu_state: 0x%x\n",
|
||||
req_type, ctrl->bRequest, f_dfu->dfu_state);
|
||||
@@ -614,7 +630,7 @@ dfu_handle(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
|
||||
value = dfu_state[f_dfu->dfu_state] (f_dfu, ctrl, gadget, req);
|
||||
|
||||
if (value >= 0) {
|
||||
- req->length = value;
|
||||
+ req->length = value > DFU_USB_BUFSIZ ? DFU_USB_BUFSIZ : value;
|
||||
req->zero = value < len;
|
||||
value = usb_ep_queue(gadget->ep0, req, 0);
|
||||
if (value < 0) {
|
||||
40
backport-0001-CVE-2024-57258.patch
Normal file
40
backport-0001-CVE-2024-57258.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From 0a10b49206a29b4aa2f80233a3e53ca0466bb0b3 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Weinberger <richard@nod.at>
|
||||
Date: Fri, 2 Aug 2024 12:08:45 +0200
|
||||
Subject: [PATCH] dlmalloc: Fix integer overflow in sbrk()
|
||||
|
||||
Make sure that the new break is within mem_malloc_start
|
||||
and mem_malloc_end before making progress.
|
||||
ulong new = old + increment; can overflow for extremely large
|
||||
increment values and memset() can get wrongly called.
|
||||
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
---
|
||||
common/dlmalloc.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
|
||||
index 48e83da6cbce..8e201ac0dc59 100644
|
||||
--- a/common/dlmalloc.c
|
||||
+++ b/common/dlmalloc.c
|
||||
@@ -581,6 +581,9 @@ void *sbrk(ptrdiff_t increment)
|
||||
ulong old = mem_malloc_brk;
|
||||
ulong new = old + increment;
|
||||
|
||||
+ if ((new < mem_malloc_start) || (new > mem_malloc_end))
|
||||
+ return (void *)MORECORE_FAILURE;
|
||||
+
|
||||
/*
|
||||
* if we are giving memory back make sure we clear it out since
|
||||
* we set MORECORE_CLEARS to 1
|
||||
@@ -588,9 +591,6 @@ void *sbrk(ptrdiff_t increment)
|
||||
if (increment < 0)
|
||||
memset((void *)new, 0, -increment);
|
||||
|
||||
- if ((new < mem_malloc_start) || (new > mem_malloc_end))
|
||||
- return (void *)MORECORE_FAILURE;
|
||||
-
|
||||
mem_malloc_brk = new;
|
||||
|
||||
return (void *)old;
|
||||
59
backport-0002-CVE-2022-2347.patch
Normal file
59
backport-0002-CVE-2022-2347.patch
Normal file
@ -0,0 +1,59 @@
|
||||
From 14dc0ab138988a8e45ffa086444ec8db48b3f103 Mon Sep 17 00:00:00 2001
|
||||
From: Hugo SIMELIERE <hsimeliere.opensource@witekio.com>
|
||||
Date: Wed, 30 Nov 2022 09:29:16 +0100
|
||||
Subject: [PATCH] usb: gadget: dfu: Fix check of transfer direction
|
||||
|
||||
Commit fbce985e28eaca3af82afecc11961aadaf971a7e to fix CVE-2022-2347
|
||||
blocks DFU usb requests.
|
||||
The verification of the transfer direction was done by an equality
|
||||
but it is a bit mask.
|
||||
|
||||
Signed-off-by: Hugo SIMELIERE <hsimeliere.opensource@witekio.com>
|
||||
Reviewed-by: Fabio Estevam <festevam@denx.de>
|
||||
Reviewed-by: Sultan Qasim Khan <sultan.qasimkhan@nccgroup.com>
|
||||
Reviewed-by: Marek Vasut <marex@denx.de>
|
||||
Tested-by: Marek Vasut <marex@denx.de>
|
||||
---
|
||||
drivers/usb/gadget/f_dfu.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
|
||||
index 33ef62f8babe..44877df4ec6b 100644
|
||||
--- a/drivers/usb/gadget/f_dfu.c
|
||||
+++ b/drivers/usb/gadget/f_dfu.c
|
||||
@@ -325,7 +325,7 @@ static int state_dfu_idle(struct f_dfu *f_dfu,
|
||||
|
||||
switch (ctrl->bRequest) {
|
||||
case USB_REQ_DFU_DNLOAD:
|
||||
- if (ctrl->bRequestType == USB_DIR_OUT) {
|
||||
+ if (!(ctrl->bRequestType & USB_DIR_IN)) {
|
||||
if (len == 0) {
|
||||
f_dfu->dfu_state = DFU_STATE_dfuERROR;
|
||||
value = RET_STALL;
|
||||
@@ -337,7 +337,7 @@ static int state_dfu_idle(struct f_dfu *f_dfu,
|
||||
}
|
||||
break;
|
||||
case USB_REQ_DFU_UPLOAD:
|
||||
- if (ctrl->bRequestType == USB_DIR_IN) {
|
||||
+ if (ctrl->bRequestType & USB_DIR_IN) {
|
||||
f_dfu->dfu_state = DFU_STATE_dfuUPLOAD_IDLE;
|
||||
f_dfu->blk_seq_num = 0;
|
||||
value = handle_upload(req, len);
|
||||
@@ -436,7 +436,7 @@ static int state_dfu_dnload_idle(struct f_dfu *f_dfu,
|
||||
|
||||
switch (ctrl->bRequest) {
|
||||
case USB_REQ_DFU_DNLOAD:
|
||||
- if (ctrl->bRequestType == USB_DIR_OUT) {
|
||||
+ if (!(ctrl->bRequestType & USB_DIR_IN)) {
|
||||
f_dfu->dfu_state = DFU_STATE_dfuDNLOAD_SYNC;
|
||||
f_dfu->blk_seq_num = w_value;
|
||||
value = handle_dnload(gadget, len);
|
||||
@@ -527,7 +527,7 @@ static int state_dfu_upload_idle(struct f_dfu *f_dfu,
|
||||
|
||||
switch (ctrl->bRequest) {
|
||||
case USB_REQ_DFU_UPLOAD:
|
||||
- if (ctrl->bRequestType == USB_DIR_IN) {
|
||||
+ if (ctrl->bRequestType & USB_DIR_IN) {
|
||||
/* state transition if less data then requested */
|
||||
f_dfu->blk_seq_num = w_value;
|
||||
value = handle_upload(req, len);
|
||||
36
backport-0002-CVE-2024-57258.patch
Normal file
36
backport-0002-CVE-2024-57258.patch
Normal file
@ -0,0 +1,36 @@
|
||||
From 8642b2178d2c4002c99a0b69a845a48f2ae2706f Mon Sep 17 00:00:00 2001
|
||||
From: Richard Weinberger <richard@nod.at>
|
||||
Date: Fri, 2 Aug 2024 12:08:44 +0200
|
||||
Subject: [PATCH] dlmalloc: Fix integer overflow in request2size()
|
||||
|
||||
req is of type size_t, casting it to long opens the door
|
||||
for an integer overflow.
|
||||
Values between LONG_MAX - (SIZE_SZ + MALLOC_ALIGN_MASK) - 1 and LONG_MAX
|
||||
cause and overflow such that request2size() returns MINSIZE.
|
||||
|
||||
Fix by removing the cast.
|
||||
The origin of the cast is unclear, it's in u-boot and ppcboot since ever
|
||||
and predates the CVS history.
|
||||
Doug Lea's original dlmalloc implementation also doesn't have it.
|
||||
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
---
|
||||
common/dlmalloc.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
|
||||
index 1e1602a24dec..48e83da6cbce 100644
|
||||
--- a/common/dlmalloc.c
|
||||
+++ b/common/dlmalloc.c
|
||||
@@ -386,8 +386,8 @@ nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
/* pad request bytes into a usable size */
|
||||
|
||||
#define request2size(req) \
|
||||
- (((long)((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) < \
|
||||
- (long)(MINSIZE + MALLOC_ALIGN_MASK)) ? MINSIZE : \
|
||||
+ ((((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) < \
|
||||
+ (MINSIZE + MALLOC_ALIGN_MASK)) ? MINSIZE : \
|
||||
(((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) & ~(MALLOC_ALIGN_MASK)))
|
||||
|
||||
/* Check if m has acceptable alignment */
|
||||
33
backport-0003-CVE-2024-57258.patch
Normal file
33
backport-0003-CVE-2024-57258.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From c17b2a05dd50a3ba437e6373093a0d6a359cdee0 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Weinberger <richard@nod.at>
|
||||
Date: Fri, 2 Aug 2024 12:08:43 +0200
|
||||
Subject: [PATCH] x86: Fix ptrdiff_t for x86_64
|
||||
|
||||
sbrk() assumes ptrdiff_t is large enough to enlarge/shrink the heap
|
||||
by LONG_MIN/LONG_MAX.
|
||||
So, use the long type, also to match the rest of the Linux ecosystem.
|
||||
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
---
|
||||
arch/x86/include/asm/posix_types.h | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/x86/include/asm/posix_types.h b/arch/x86/include/asm/posix_types.h
|
||||
index dbcea7f47ff9..e1ed9bcabc76 100644
|
||||
--- a/arch/x86/include/asm/posix_types.h
|
||||
+++ b/arch/x86/include/asm/posix_types.h
|
||||
@@ -20,11 +20,12 @@ typedef unsigned short __kernel_gid_t;
|
||||
#if defined(__x86_64__)
|
||||
typedef unsigned long __kernel_size_t;
|
||||
typedef long __kernel_ssize_t;
|
||||
+typedef long __kernel_ptrdiff_t;
|
||||
#else
|
||||
typedef unsigned int __kernel_size_t;
|
||||
typedef int __kernel_ssize_t;
|
||||
-#endif
|
||||
typedef int __kernel_ptrdiff_t;
|
||||
+#endif
|
||||
typedef long __kernel_time_t;
|
||||
typedef long __kernel_suseconds_t;
|
||||
typedef long __kernel_clock_t;
|
||||
44
backport-CVE-2022-30767.patch
Normal file
44
backport-CVE-2022-30767.patch
Normal file
@ -0,0 +1,44 @@
|
||||
From bdbf7a05e26f3c5fd437c99e2755ffde186ddc80 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea zi0Black Cappa <zi0Black@protonmail.com>
|
||||
Date: Wed, 18 May 2022 16:30:08 +0000
|
||||
Subject: [PATCH] net: nfs: Fix CVE-2022-30767 (old CVE-2019-14196)
|
||||
|
||||
This patch mitigates the vulnerability identified via CVE-2019-14196.
|
||||
|
||||
The previous patch was bypassed/ineffective, and now the vulnerability
|
||||
is identified via CVE-2022-30767. The patch removes the sanity check
|
||||
introduced to mitigate CVE-2019-14196 since it's ineffective.
|
||||
filefh3_length is changed to unsigned type integer, preventing negative
|
||||
numbers from being used during comparison with positive values during
|
||||
size sanity checks.
|
||||
|
||||
Signed-off-by: Andrea zi0Black Cappa <zi0Black@protonmail.com>
|
||||
---
|
||||
net/nfs.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/net/nfs.c b/net/nfs.c
|
||||
index 3c01cebd96..9152ab742e 100644
|
||||
--- a/net/nfs.c
|
||||
+++ b/net/nfs.c
|
||||
@@ -52,7 +52,7 @@ static const ulong nfs_timeout = CONFIG_NFS_TIMEOUT;
|
||||
|
||||
static char dirfh[NFS_FHSIZE]; /* NFSv2 / NFSv3 file handle of directory */
|
||||
static char filefh[NFS3_FHSIZE]; /* NFSv2 / NFSv3 file handle */
|
||||
-static int filefh3_length; /* (variable) length of filefh when NFSv3 */
|
||||
+static unsigned int filefh3_length; /* (variable) length of filefh when NFSv3 */
|
||||
|
||||
static enum net_loop_state nfs_download_state;
|
||||
static struct in_addr nfs_server_ip;
|
||||
@@ -573,8 +573,6 @@ static int nfs_lookup_reply(uchar *pkt, unsigned len)
|
||||
filefh3_length = ntohl(rpc_pkt.u.reply.data[1]);
|
||||
if (filefh3_length > NFS3_FHSIZE)
|
||||
filefh3_length = NFS3_FHSIZE;
|
||||
- if (((uchar *)&(rpc_pkt.u.reply.data[0]) - (uchar *)(&rpc_pkt) + filefh3_length) > len)
|
||||
- return -NFS_RPC_DROP;
|
||||
memcpy(filefh, rpc_pkt.u.reply.data + 2, filefh3_length);
|
||||
}
|
||||
|
||||
--
|
||||
GitLab
|
||||
|
||||
118
backport-CVE-2022-34835.patch
Normal file
118
backport-CVE-2022-34835.patch
Normal file
@ -0,0 +1,118 @@
|
||||
From 8f8c04bf1ebbd2f72f1643e7ad9617dafa6e5409 Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Iooss <nicolas.iooss+uboot@ledger.fr>
|
||||
Date: Fri, 10 Jun 2022 14:50:25 +0000
|
||||
Subject: [PATCH] i2c: fix stack buffer overflow vulnerability in i2c md
|
||||
command
|
||||
|
||||
When running "i2c md 0 0 80000100", the function do_i2c_md parses the
|
||||
length into an unsigned int variable named length. The value is then
|
||||
moved to a signed variable:
|
||||
|
||||
int nbytes = length;
|
||||
#define DISP_LINE_LEN 16
|
||||
int linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
|
||||
ret = dm_i2c_read(dev, addr, linebuf, linebytes);
|
||||
|
||||
On systems where integers are 32 bits wide, 0x80000100 is a negative
|
||||
value to "nbytes > DISP_LINE_LEN" is false and linebytes gets assigned
|
||||
0x80000100 instead of 16.
|
||||
|
||||
The consequence is that the function which reads from the i2c device
|
||||
(dm_i2c_read or i2c_read) is called with a 16-byte stack buffer to fill
|
||||
but with a size parameter which is too large. In some cases, this could
|
||||
trigger a crash. But with some i2c drivers, such as drivers/i2c/nx_i2c.c
|
||||
(used with "nexell,s5pxx18-i2c" bus), the size is actually truncated to
|
||||
a 16-bit integer. This is because function i2c_transfer expects an
|
||||
unsigned short length. In such a case, an attacker who can control the
|
||||
response of an i2c device can overwrite the return address of a function
|
||||
and execute arbitrary code through Return-Oriented Programming.
|
||||
|
||||
Fix this issue by using unsigned integers types in do_i2c_md. While at
|
||||
it, make also alen unsigned, as signed sizes can cause vulnerabilities
|
||||
when people forgot to check that they can be negative.
|
||||
|
||||
Signed-off-by: Nicolas Iooss <nicolas.iooss+uboot@ledger.fr>
|
||||
Reviewed-by: Heiko Schocher <hs@denx.de>
|
||||
---
|
||||
cmd/i2c.c | 24 ++++++++++++------------
|
||||
1 file changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/cmd/i2c.c b/cmd/i2c.c
|
||||
index 9050b2b8d27a..bd04b14024be 100644
|
||||
--- a/cmd/i2c.c
|
||||
+++ b/cmd/i2c.c
|
||||
@@ -200,10 +200,10 @@ void i2c_init_board(void)
|
||||
*
|
||||
* Returns the address length.
|
||||
*/
|
||||
-static uint get_alen(char *arg, int default_len)
|
||||
+static uint get_alen(char *arg, uint default_len)
|
||||
{
|
||||
- int j;
|
||||
- int alen;
|
||||
+ uint j;
|
||||
+ uint alen;
|
||||
|
||||
alen = default_len;
|
||||
for (j = 0; j < 8; j++) {
|
||||
@@ -247,7 +247,7 @@ static int do_i2c_read(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
{
|
||||
uint chip;
|
||||
uint devaddr, length;
|
||||
- int alen;
|
||||
+ uint alen;
|
||||
u_char *memaddr;
|
||||
int ret;
|
||||
#if CONFIG_IS_ENABLED(DM_I2C)
|
||||
@@ -301,7 +301,7 @@ static int do_i2c_write(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
{
|
||||
uint chip;
|
||||
uint devaddr, length;
|
||||
- int alen;
|
||||
+ uint alen;
|
||||
u_char *memaddr;
|
||||
int ret;
|
||||
#if CONFIG_IS_ENABLED(DM_I2C)
|
||||
@@ -469,8 +469,8 @@ static int do_i2c_md(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
{
|
||||
uint chip;
|
||||
uint addr, length;
|
||||
- int alen;
|
||||
- int j, nbytes, linebytes;
|
||||
+ uint alen;
|
||||
+ uint j, nbytes, linebytes;
|
||||
int ret;
|
||||
#if CONFIG_IS_ENABLED(DM_I2C)
|
||||
struct udevice *dev;
|
||||
@@ -589,9 +589,9 @@ static int do_i2c_mw(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
{
|
||||
uint chip;
|
||||
ulong addr;
|
||||
- int alen;
|
||||
+ uint alen;
|
||||
uchar byte;
|
||||
- int count;
|
||||
+ uint count;
|
||||
int ret;
|
||||
#if CONFIG_IS_ENABLED(DM_I2C)
|
||||
struct udevice *dev;
|
||||
@@ -676,8 +676,8 @@ static int do_i2c_crc(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
{
|
||||
uint chip;
|
||||
ulong addr;
|
||||
- int alen;
|
||||
- int count;
|
||||
+ uint alen;
|
||||
+ uint count;
|
||||
uchar byte;
|
||||
ulong crc;
|
||||
ulong err;
|
||||
@@ -985,7 +985,7 @@ static int do_i2c_loop(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
uint chip;
|
||||
- int alen;
|
||||
+ uint alen;
|
||||
uint addr;
|
||||
uint length;
|
||||
u_char bytes[16];
|
||||
44
backport-CVE-2024-57256.patch
Normal file
44
backport-CVE-2024-57256.patch
Normal file
@ -0,0 +1,44 @@
|
||||
From 35f75d2a46e5859138c83a75cd2f4141c5479ab9 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Weinberger <richard@nod.at>
|
||||
Date: Fri, 9 Aug 2024 11:54:28 +0200
|
||||
Subject: [PATCH] ext4: Fix integer overflow in ext4fs_read_symlink()
|
||||
|
||||
While zalloc() takes a size_t type, adding 1 to the le32 variable
|
||||
will overflow.
|
||||
A carefully crafted ext4 filesystem can exhibit an inode size of 0xffffffff
|
||||
and as consequence zalloc() will do a zero allocation.
|
||||
|
||||
Later in the function the inode size is again used for copying data.
|
||||
So an attacker can overwrite memory.
|
||||
|
||||
Avoid the overflow by using the __builtin_add_overflow() helper.
|
||||
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
---
|
||||
fs/ext4/ext4_common.c | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
|
||||
index 7cf0160c408d..76f7102456e3 100644
|
||||
--- a/fs/ext4/ext4_common.c
|
||||
+++ b/fs/ext4/ext4_common.c
|
||||
@@ -2181,13 +2181,18 @@ static char *ext4fs_read_symlink(struct ext2fs_node *node)
|
||||
struct ext2fs_node *diro = node;
|
||||
int status;
|
||||
loff_t actread;
|
||||
+ size_t alloc_size;
|
||||
|
||||
if (!diro->inode_read) {
|
||||
status = ext4fs_read_inode(diro->data, diro->ino, &diro->inode);
|
||||
if (status == 0)
|
||||
return NULL;
|
||||
}
|
||||
- symlink = zalloc(le32_to_cpu(diro->inode.size) + 1);
|
||||
+
|
||||
+ if (__builtin_add_overflow(le32_to_cpu(diro->inode.size), 1, &alloc_size))
|
||||
+ return NULL;
|
||||
+
|
||||
+ symlink = zalloc(alloc_size);
|
||||
if (!symlink)
|
||||
return NULL;
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
|
||||
Name: uboot-tools
|
||||
Version: 2020.07
|
||||
Release: 4
|
||||
Release: 9
|
||||
Summary: tools for U-Boot
|
||||
License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+
|
||||
License: GPL-2.0-or-later and Public Domain and GPL-2.0-only
|
||||
URL: http://www.denx.de/wiki/U-Boot
|
||||
Source0: https://ftp.denx.de/pub/u-boot/u-boot-%{version}.tar.bz2
|
||||
Source1: arm-boards
|
||||
@ -34,6 +34,14 @@ Patch0012: backport-0002-CVE-2021-27097.patch
|
||||
Patch0013: backport-0003-CVE-2021-27097.patch
|
||||
Patch0014: backport-0001-CVE-2021-27138.patch
|
||||
Patch0015: backport-0002-CVE-2021-27138.patch
|
||||
Patch0016: backport-CVE-2022-34835.patch
|
||||
Patch0017: backport-CVE-2022-30767.patch
|
||||
Patch0018: backport-0001-CVE-2022-2347.patch
|
||||
Patch0019: backport-0002-CVE-2022-2347.patch
|
||||
Patch0020: backport-CVE-2024-57256.patch
|
||||
Patch0021: backport-0001-CVE-2024-57258.patch
|
||||
Patch0022: backport-0002-CVE-2024-57258.patch
|
||||
Patch0023: backport-0003-CVE-2024-57258.patch
|
||||
|
||||
BuildRequires: bc dtc gcc make flex bison git-core openssl-devel gdb
|
||||
BuildRequires: python-unversioned-command python3-devel python3-setuptools
|
||||
@ -256,6 +264,21 @@ cp -p board/warp7/README builds/docs/README.warp7
|
||||
%{_mandir}/man1/mkimage.1*
|
||||
|
||||
%changelog
|
||||
* Wed Feb 19 2025 lingsheng <lingsheng1@h-partners.com> - 2020.07-9
|
||||
- fix CVE-2024-57256 CVE-2024-57258
|
||||
|
||||
* Tue Sep 24 2024 lingsheng <lingsheng1@h-partners.com> -2020.07-8
|
||||
- fix CVE-2022-2347
|
||||
|
||||
* Wed Sep 28 2022 zhouwenpei <zhouwenpei1@h-partners.com> -2020.07-7
|
||||
- fix CVE-2022-30767
|
||||
|
||||
* Tue Jul 12 2022 zhouwenpei <zhouwenpei1@h-partners.com> -2020.07-6
|
||||
- fix CVE-2022-34835
|
||||
|
||||
* Fri May 13 2022 liuyumeng <liuyumeng5@h-partners.com> -2020.07-5
|
||||
- fix license error
|
||||
|
||||
* Mon Apr 19 2021 liuyumeng<liuyumeng@huawei.com> - 2020.07.-4
|
||||
- Compilation optimization
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user