git: 0f39272b883a - stable/13 - stand/uboot: setup archsw before probing devices
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 19 Jul 2022 09:57:52 UTC
The branch stable/13 has been updated by kd: URL: https://cgit.FreeBSD.org/src/commit/?id=0f39272b883aafd2a47a65f7c20afc1d2c0bbc2f commit 0f39272b883aafd2a47a65f7c20afc1d2c0bbc2f Author: Albert Jakiela <aja@semihalf.com> AuthorDate: 2022-06-28 15:28:35 +0000 Commit: Kornel Dulęba <kd@FreeBSD.org> CommitDate: 2022-07-19 09:37:10 +0000 stand/uboot: setup archsw before probing devices In some cases ubldr would try to mount a disk device before the archsw struct was filled with functions pointers. This would result in a NULL pointer derefrence of the arch_getdev field. Fix that filling the archsw functions earlier. Note that this matches the EFI behavoiur. Reviewed by: imp, mw Sponsored by: Stormshield Obtained from: Semihalf MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35670 (cherry picked from commit 1323f0aa9cb0392d2946226bd76f14463e875a60) --- stand/uboot/common/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/stand/uboot/common/main.c b/stand/uboot/common/main.c index 85ddf5db1f90..6648dc607c11 100644 --- a/stand/uboot/common/main.c +++ b/stand/uboot/common/main.c @@ -475,6 +475,13 @@ main(int argc, char **argv) meminfo(); + archsw.arch_loadaddr = uboot_loadaddr; + archsw.arch_getdev = uboot_getdev; + archsw.arch_copyin = uboot_copyin; + archsw.arch_copyout = uboot_copyout; + archsw.arch_readin = uboot_readin; + archsw.arch_autoload = uboot_autoload; + /* Set up currdev variable to have hooks in place. */ env_setenv("currdev", EV_VOLATILE, "", uboot_setcurrdev, env_nounset); @@ -538,13 +545,6 @@ do_interact: setenv("usefdt", "1", 1); #endif - archsw.arch_loadaddr = uboot_loadaddr; - archsw.arch_getdev = uboot_getdev; - archsw.arch_copyin = uboot_copyin; - archsw.arch_copyout = uboot_copyout; - archsw.arch_readin = uboot_readin; - archsw.arch_autoload = uboot_autoload; - interact(); /* doesn't return */ return (0);