grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] efidisk: prevent errors from diskfilter scan of removable dr


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: [PATCH] efidisk: prevent errors from diskfilter scan of removable drives
Date: Fri, 12 Feb 2016 15:29:05 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0

On 05.02.2016 17:56, Andrei Borzenkov wrote:
> Map EFI_NO_MEDIA to GRUB_ERR_OUT_OF_RANGE that is ignored by diskfilter. This
> actually matches pretty close (we obviously attempt to read outside of media)
> and avoids adding more error codes.
> 
> This affects only internally initiated scans. If read/write from removable is
> explicitly requested, we still return an error and text explanation is more
> clear for user than generic error.
> 
> Reported and tested by Andreas Loew <address@hidden>
> 
I feel like we should be fixing diskfilter. Consider another case: dead
disk dangling on cable and returning mostly I/O errors
> ---
>  grub-core/disk/efi/efidisk.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
> index 1c00e3e..ea75344 100644
> --- a/grub-core/disk/efi/efidisk.c
> +++ b/grub-core/disk/efi/efidisk.c
> @@ -547,7 +547,9 @@ grub_efidisk_read (struct grub_disk *disk, 
> grub_disk_addr_t sector,
>  
>    status = grub_efidisk_readwrite (disk, sector, size, buf, 0);
>  
> -  if (status != GRUB_EFI_SUCCESS)
> +  if (status == GRUB_EFI_NO_MEDIA)
> +    return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("no media in `%s'", 
> disk->name));
> +  else if (status != GRUB_EFI_SUCCESS)
>      return grub_error (GRUB_ERR_READ_ERROR,
>                      N_("failure reading sector 0x%llx from `%s'"),
>                      (unsigned long long) sector,
> @@ -568,7 +570,9 @@ grub_efidisk_write (struct grub_disk *disk, 
> grub_disk_addr_t sector,
>  
>    status = grub_efidisk_readwrite (disk, sector, size, (char *) buf, 1);
>  
> -  if (status != GRUB_EFI_SUCCESS)
> +  if (status == GRUB_EFI_NO_MEDIA)
> +    return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("no media in `%s'", 
> disk->name));
> +  else if (status != GRUB_EFI_SUCCESS)
>      return grub_error (GRUB_ERR_WRITE_ERROR,
>                      N_("failure writing sector 0x%llx to `%s'"),
>                      (unsigned long long) sector, disk->name);
> 


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]