ad1ebbe5cea8 - main - loader: create local copy of mode list provided by vbeinfoblock

Toomas Soome tsoome at me.com
Tue Jan 19 06:25:34 UTC 2021



> On 19. Jan 2021, at 03:24, Ravi Pokala <rpokala at freebsd.org> wrote:
> 
> Hi Toomas,
> 
> -----Original Message-----
> From: <owner-src-committers at freebsd.org> on behalf of Toomas Soome <tsoome at FreeBSD.org>
> Date: 2021-01-16, Saturday at 00:23
> To: <src-committers at FreeBSD.org>, <dev-commits-src-all at FreeBSD.org>, <dev-commits-src-main at FreeBSD.org>
> Subject: git: ad1ebbe5cea8 - main - loader: create local copy of mode list provided by vbeinfoblock
> 
>    The branch main has been updated by tsoome:
> 
>    URL: https://cgit.FreeBSD.org/src/commit/?id=ad1ebbe5cea8ffac0037966990ddf0f80faa55d5
> 
>    commit ad1ebbe5cea8ffac0037966990ddf0f80faa55d5
>    Author:     Toomas Soome <tsoome at FreeBSD.org>
>    AuthorDate: 2021-01-16 10:18:32 +0000
>    Commit:     Toomas Soome <tsoome at FreeBSD.org>
>    CommitDate: 2021-01-16 10:23:22 +0000
> 
>        loader: create local copy of mode list provided by vbeinfoblock
> 
>        Apparently some systems do corrupt mode list memory area, so we need
>        to use local copy instead.
> 
> ...
> 
>    +	vbe_mode_list_size = (uintptr_t)p - (uintptr_t)ml;
>    +	vbe_mode_list = malloc(vbe_mode_list_size);
>    +	if (vbe_mode_list == NULL) {
>    +		free(vbe);
>    +		vbe = NULL;
>    +		free(vbe_mode);
>    +		vbe_mode = NULL;
>    +	}
>    +	bcopy(ml, vbe_mode_list, vbe_mode_list_size);
>    +
>    +	/* reset VideoModePtr, so we will not have chance to use bad data. */
>    +	vbe->VideoModePtr = 0;
> 
> If allocation of vbe_mode_list failed, you're freeing things that were allocated before it, but then you're continuing on. The very next thing you do is the bcopy(), which dereferences vbe_mode_list, which is NULL because of the allocation failure.
> 
> That doesn't seem right.
> 
> Thanks,
> 
> Ravi (rpokala@)
> 
> 


yes, thanks! I do have fix waiting for any additional comments (Yuri Pankov was very kind to provide review feedback). So the update will be posted soon.

thanks,
toomas



More information about the dev-commits-src-all mailing list