On Mon, 12 Oct 2026 22:25:06 +0200, Igor Opaniuk 
<[email protected]> wrote:

Hi Igor,


general comment , perhaps i miss somehting but  if i do a fastboot flash
userdate or anyother partition with lock at true fastboot flash function
don't check lock state.

>
> diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
> index 18d86988f4c9..9bf012645ef2 100644
> --- a/drivers/fastboot/fb_command.c
> +++ b/drivers/fastboot/fb_command.c
> @@ -589,3 +611,100 @@ static void __maybe_unused oem_board(char 
> *cmd_parameter, char *response)
> [ ... skip 40 lines ... ]
> + * @response: fastboot response buffer, filled on failure
> + * Return: 0 on success, -1 when userdata could not be erased
> + */
> +static int flashing_wipe_userdata(char *response)
> +{
> +     fastboot_mmc_erase("userdata", response);

what append if we use CONFIG_FASTBOOT_FLASH_NAND or
CONFIG_FASTBOOT_FLASH_BLOCK ?
it could be better to call generic function which are backend support

> [ ... skip 11 lines ... ]
> + *
> + * Verification errors stop the boot afterwards. The AVB TA resets the
> + * rollback indexes on a state change.
> + */
> +static void flashing_lock(char *cmd_parameter, char *response)
> +{

you don't check unlock_ability

> [ ... skip 10 lines ... ]
> + * flashing_unlock() - unlock the device
> + *
> + * The unlock is refused if userdata cannot be erased.
> + */
> +static void flashing_unlock(char *cmd_parameter, char *response)
> +{

same here

> [ ... skip 14 lines ... ]
> + * unlocking is always possible.
> + */
> +static void flashing_get_unlock_ability(char *cmd_parameter, char *response)
> +{
> +     fastboot_okay("1", response);
> +}

this ability should not be common with android status ?
if we boot in bootloader fastboot mode we can disable lock mode without
action from developer setting in android no ?

>
> diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
> index e8aa0e09aa63..92c8e702a0b5 100644
> --- a/drivers/fastboot/fb_getvar.c
> +++ b/drivers/fastboot/fb_getvar.c
> @@ -88,6 +89,10 @@ static const struct {
>               .dispatch = getvar_partition_size,
>               .list = false
>  #endif
> +     }, {
> +             .variable = "unlocked",
> +             .dispatch = CONFIG_IS_ENABLED(FASTBOOT_CMD_FLASHING, 
> (getvar_unlocked), (NULL)),
> +             .list = CONFIG_IS_ENABLED(FASTBOOT_CMD_FLASHING)

with this when FASTBOOT_CMD_FLASHING not defined unlocked value  not return on 
fastboot getvar 
all but if we do a fastboot getvar unlocked dispatch will be null.
do same as other or do a getvar_unlocked to return unsupported or
something like that

> @@ -346,3 +351,32 @@ void fastboot_getvar(char *cmd_parameter, char *response)
>               fastboot_fail("Variable not implemented", response);
>       }
>  }
> +
> +#if CONFIG_IS_ENABLED(FASTBOOT_CMD_FLASHING)
> +#include <avb_verify.h>

include should be on top of file .

> [ ... skip 20 lines ... ]
> +}
> +#else
> +static void __maybe_unused getvar_unlocked(char *var_parameter, char 
> *response)
> +{
> +}
> +#endif

/> @@ -53,6 +53,9 @@ enum {

-- 
Guillaume La Roque <[email protected]>

Reply via email to