Commit Graph

35269 Commits

Author SHA1 Message Date
Joel Stanley
44cd706c96 Revert "jffs2: Fix possible null-pointer dereferences in jffs2_add_frag_to_fragtree()"
This reverts commit f2538f999345405f7d2e1194c0c8efa4e11f7b3a. The patch
stopped JFFS2 from being able to mount an existing filesystem with the
following errors:

 jffs2: error: (77) jffs2_build_inode_fragtree: Add node to tree failed -22
 jffs2: error: (77) jffs2_do_read_inode_internal: Failed to build final fragtree for inode #5377: error -22

Fixes: f2538f999345 ("jffs2: Fix possible null-pointer dereferences...")
Cc: stable@vger.kernel.org
Suggested-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Richard Weinberger <richard@nod.at>
2022-06-20 13:25:32 +02:00
Wenwen Wang
e1a5720264 jffs2: Fix memory leak in jffs2_scan_eraseblock() error path
In jffs2_scan_eraseblock(), 'sumptr' is allocated through kmalloc() if
'sumlen' is larger than 'buf_size'. However, it is not deallocated in the
following execution if jffs2_fill_scan_buf() fails, leading to a memory
leak bug. To fix this issue, free 'sumptr' before returning the error.

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: Richard Weinberger <richard@nod.at>
2022-06-20 13:25:32 +02:00
Christoph Hellwig
cdac3ca64a jffs2: Remove jffs2_gc_fetch_page and jffs2_gc_release_page
Merge these two helpers into the only callers to get rid of some
amazingly bad calling conventions.

Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
2022-06-20 13:25:32 +02:00
Jia-Ju Bai
9d9bfe5948 jffs2: Fix possible null-pointer dereferences in jffs2_add_frag_to_fragtree()
In jffs2_add_frag_to_fragtree(), there is an if statement on line 223 to
check whether "this" is NULL:
    if (this)

When "this" is NULL, it is used at several places, such as on line 249:
    if (this->node)
and on line 260:
    if (newfrag->ofs > this->ofs)

Thus possible null-pointer dereferences may occur.

To fix these bugs, -EINVAL is returned when "this" is NULL.

These bugs are found by a static analysis tool STCheck written by us.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
2022-06-20 13:25:32 +02:00
Masahiro Yamada
b33c3d4b67 jffs2: Remove C++ style comments from uapi header
Linux kernel tolerates C++ style comments these days. Actually, the
SPDX License tags for .c files start with //.

On the other hand, uapi headers are written in more strict C, where
the C++ comment style is forbidden.

I simply dropped these lines instead of fixing the comment style.

This code has been always commented out since it was added around
Linux 2.4.9 (i.e. commented out for more than 17 years).

'Maybe later...' will never happen.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
2022-06-20 13:25:32 +02:00
Al Viro
22e83b00f5 jffs2: fix use-after-free on symlink traversal
free the symlink body after the same RCU delay we have for freeing the
struct inode itself, so that traversal during RCU pathwalk wouldn't step
into freed memory.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2022-06-20 13:25:32 +02:00
Matthew Wilcox
55529cf3d0 Convert jffs2 acl to struct_size
Need to tell the compiler that the acl entries follow the acl header.

Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
2022-06-20 13:25:32 +02:00
Sebastian Huber
f44ecd0ea9 jffs2: Use RTEMS_CONTAINER_OF 2022-06-20 13:25:32 +02:00
Chris Johns
e70384d3f4 aarch64/gicv3: Remove accesses to secure registers
RTEMS runs at EL1 and the removed register accesses are for
EL3 or the TF-A. This change aligns our driver with the Linux
and FreeBSD ones.
2022-06-16 10:21:46 +10:00
Chris Johns
4f6c90f40d bsps/versal: Support a 64bit RAM base
Set the constraint to be 64bits to allow the complete address range.
2022-06-16 10:21:46 +10:00
Chris Johns
bfc99a6e70 bsp/aarch64: Flush the cache before invalidating it
- Any page tables need to be flushed if the cache is enabled.
  Disabling the cache may only be available in secure mode.
2022-06-16 10:21:46 +10:00
Joel Sherrill
d6ebf4067e bsps/shared/*: Change license to BSD-2
Updates #3053.
2022-06-15 12:35:18 -05:00
Chris Johns
cb52e37464 bsps/arm: MP core timer setting off by one 2022-06-15 13:15:15 +10:00
Chris Johns
acc32a8e5c cpukit: Fixes for GCC 12 warnings
Updates #6442
2022-06-15 13:01:03 +10:00
Chris Johns
0cf0914efe cpukit: Change _COMPILING_NEWLIB to _LIBC for helper functions decls
Updates #4662
2022-06-15 13:00:48 +10:00
Chris Johns
5262b9c2ab score/cpu: Silence ARM and AARCH64 GCC 12 false trigger array warning
The false trigger is covered in:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578

GCC 11 and 12 has been patched for constant pointer casts above
4K. This code casts a constant pointer within the first 4K
page. As a result the patch disables the warning.

Updates #4662
2022-06-15 12:57:28 +10:00
Joel Sherrill
1f23640a9b sptests/spglobalcon01/init.cc: Change license to BSD-2
Updates #3053.
2022-06-14 10:31:39 -05:00
Joel Sherrill
3a22252782 samples/iostream/init.cc: Change license to BSD-2
Updates #3053.
2022-06-14 10:31:39 -05:00
Joel Sherrill
59a79edb95 sptests/*/*.doc: Change license to BSD-2
Updates #3053.
2022-06-14 10:31:39 -05:00
Joel Sherrill
7c6ff958e9 mptests/*/*.doc: Change license to BSD-2
Updates #3053.
2022-06-14 10:31:39 -05:00
Joel Sherrill
031f8fbcdc smptests/*/*.doc: Change license to BSD-2
Updates #3053.
2022-06-14 10:31:39 -05:00
Joel Sherrill
dcbba7c0e6 psxtmtests/*/*.doc: Change license to BSD-2
Updates #3053.
2022-06-14 10:31:39 -05:00
Joel Sherrill
731607b3b3 samples/*/*.doc: Change license to BSD-2
Updates #3053.
2022-06-14 10:31:39 -05:00
Joel Sherrill
f98b739119 smptests/*/*.py: Change license to BSD-2
Manually adjusted location of SPDX annotation so #! remains first line.

Updates #3053.
2022-06-14 10:31:39 -05:00
Christian Mauderer
b60d8327ac bsps/atsam: Fix type of options (part 2)
The patch "bsps/atsam: Fix type of options" missed to adapt some parts
of the yml. With that a custom value works well. But if no value is set,
configure doesn't fall back to the default value but instead just causes
an error. This patch fixes that.
2022-06-14 08:14:39 +02:00
Chris Johns
66dc06efce bsp/aarch64: Fix array warning
Updates #4664
2022-06-11 12:08:49 +10:00
Karel Gardas
ae2367c505 bsps/stm32h7: remove external memory initialization from nucleo-h743zi BSP
Nucleo board does not provide any external memory so code does not have
any function here anyway.

Sponsored-By:	Precidata
2022-06-10 11:17:17 +02:00
Karel Gardas
e5e1c00491 bsps/stm32h7: move BSP start hooks into boards subdirectories
The idea here is to prepare for better per-board specialization
of the hooks function code.

Sponsored-By:	Precidata
2022-06-10 11:17:17 +02:00
Karel Gardas
d7f3918d13 bsps/arm: fix installation of core_cm4.h 2022-06-10 11:15:08 +02:00
Gabriel Moyano
11621c9c52 kern_tc.c: Update pps_event() for uniprocessor configurations
Since pps->capgen equal to zero is not a special value in uniprocessor configurations, there is no need to check for this condition.

Update #2349
2022-06-10 11:12:03 +02:00
Christian Mauderer
7ba1503661 bsps/imx: Enable clock of ETH2 2022-06-09 09:04:40 +02:00
Matt Joyce
4152157e10 Newlib01: Add tests for rand() and lrand48()
Check that the state of rand() and lrand48() is thread-specific,
that they are properly initialized, and return the expected
sequence of pseudo-random numbers for default seed values.
2022-06-09 08:10:19 +02:00
Chris Johns
80aea6aee1 testsuite/libtests: Add exit03 to test exit() with C++
Updates #4661
2022-06-09 11:41:21 +10:00
Sebastian Huber
75af80a682 arm/lpc32xx: Implement new interrupt directives 2022-06-08 10:25:41 +02:00
Sebastian Huber
8d6190129a bsp/lpc32xx: bsp_interrupt_vector_enable()
The interrupt enables are used to implement a priority scheme in
bsp_interrupt_dispatch().  Enable interrupts through
bsp_interrupt_vector_enable() only if they are not already enabled to
not interfere with the priority scheme while
bsp_interrupt_vector_enable() is called during interrupt dispatching.
2022-06-08 10:25:41 +02:00
Sebastian Huber
4d0d7d5413 bsp/lpc32xx: bsp_interrupt_is_valid_vector()
Provide custom bsp_interrupt_is_valid_vector() implementation since
several interrupt vectors are reserved.
2022-06-08 10:25:41 +02:00
Sebastian Huber
88a53ca682 bsp/lpc32xx: Use standard timer 2 for tm27.h
This helps to run the validation tests of the Interrupt Manager
directives.
2022-06-08 10:25:37 +02:00
Sebastian Huber
5dc5ab5650 arm/lpc32xx: Hide MLC details 2022-06-08 09:33:20 +02:00
Sebastian Huber
bb29f8b5ff bsp/lpc32xx: Fix FIQ interrupt support
Do not sporadically service interrupts configured as FIQ by the IRQ
interrupt dispatch.
2022-06-08 09:33:20 +02:00
Sebastian Huber
9a69e43083 validation: Fix CallWithinISR()
Some BSPs require that Clear_tm27_intr() is called in the interrupt
service routine.

Update #3269.
2022-06-08 09:33:20 +02:00
Sebastian Huber
c93f0f01e5 arm: Fix PMSA regions for contiguous sections
Sections with identical attributes may be contiguous with a respective
begin and end address which is not on a minimum region boundary.  The
begin address is aligned down to the region base address.  The end
address is aligned up to the region end address.  Account for this in
the check for contiguous sections.

Update #4202.
2022-06-08 09:10:20 +02:00
Sebastian Huber
0b9497a6dd arm: Fix PMSA region mapping with 0x0 end address
A section may span up to the end of the address range.  In this case the
end address is zero.  Use the base address to check if a region should
be before another region.

Update #4202.
2022-06-08 09:10:12 +02:00
Sebastian Huber
ed51fad53a build: Assert value properties only if not None 2022-06-08 09:08:26 +02:00
Christian Mauderer
8beb1d2fb0 bsps/atsam: Fix type of options
ATSAM_CONSOLE_DEVICE_INDEX and ATSAM_CONSOLE_DEVICE_TYPE have to be
integers like suggested by their description. Otherwise it's not
possible to select (for example) USART2 as console device.
2022-06-07 08:31:26 +02:00
Sebastian Huber
a26b9936ff arm: Fix typo 2022-06-03 08:37:14 +02:00
Karel Gardas
c3ad1e3c27 bsps/stm32h7: set SDRAM 1 size to 0 by default on nucleo-h743zi BSP
Nucleo does not have any SDRAM, so 0 size is the only possible right
choice here.

Sponsored-By:	Precidata
2022-06-02 10:44:30 +02:00
Karel Gardas
925bcdb8e8 bsps/stm32h7: set default linkage to flash for nucleo-h743zi BSP
Nucleo does not have any SDRAM so default linkage to SDRAM does not make
any sense here.

Sponsored-By:	Precidata
2022-06-02 10:44:30 +02:00
Karel Gardas
5a1f87a071 bsps/stm32h7: set default printk instance on nucleo-h743zi BSP to USART3
This is the default configuration of the board out of the box.
Any other possible/supported configuration requires soldering,
so definitely not out of the box experience.

Sponsored-By:	Precidata
2022-06-02 10:44:30 +02:00
Karel Gardas
f2cf15b82a bsps/stm32h7: add stm32h747i-disco-m4 BSP variant
This patch adds stm32h747i-disco-m4 BSP variant and puts it in sync
with the stm32h747i-disco BSP variant hardware support. That means,
only USART 1, 2 and UART 8 are enabled. Also SDRAM 2 is set to 32MB,
SDRAM 1 size is set to 0.

Sponsored-By:	Precidata
2022-06-02 10:44:30 +02:00
Karel Gardas
8604b46ab6 bsps/stm32h7: set default SDRAM x sizes on stm32h747i-disco BSP
This means:

SDRAM 1: 0
SDRAM 2: 32 MB

Sponsored-By:	Precidata
2022-06-01 15:49:19 +02:00