Re: [PATCH] Derive stage2= from repo=nfsiso: correctly (#565885)

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

 



On 03/01/2010 05:34 PM, Radek Vykydal wrote:
> Prevents sigsegv on x86_64.

I would think this bug exists cross-platform, i.e. not just x86_64.
After all it was originally reported for s390x.

> ---
>  loader/method.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/loader/method.c b/loader/method.c
> index 5f3a7ce..219fd06 100644
> --- a/loader/method.c
> +++ b/loader/method.c
> @@ -516,6 +516,14 @@ void setStage2LocFromCmdline(char * arg, struct loaderData_s * ld) {
>                &(((struct nfsInstallData *)ld->stage2Data)->host),
>                &(((struct nfsInstallData *)ld->stage2Data)->directory),
>                &(((struct nfsInstallData *)ld->stage2Data)->mountOpts));
> +        } else if (!strncmp(arg, "nfsiso:", 7)) {
> +            ld->method = METHOD_NFS;
> +            ld->stage2Data = calloc(sizeof(struct nfsInstallData *), 1);
> +
> +            parseNfsHostPathOpts(arg + 7,
> +              &(((struct nfsInstallData *)ld->stage2Data)->host),
> +              &(((struct nfsInstallData *)ld->stage2Data)->directory),
> +              &(((struct nfsInstallData *)ld->stage2Data)->mountOpts));
>          } else if (!strncmp(arg, "ftp:", 4) || 
>                     !strncmp(arg, "http", 4)) {
>              ld->method = METHOD_URL;

This looks good for fixing the specific use case of specifying
repo=nfsiso:... without stage2=...

However, I fear ld->method will remain -1 or the like and ld->stage2Data
will remain without allocated memory whenever the user has a typo in his
repo method. Will loader still segfault when the user accidently
specified repo=vtp://... ? IMHO, anaconda should not break down on
invalid user input.

So
class = installMethods[validMethods[loaderData->method]].type;
in STEP_METHOD might access validMethods with an invalid index?

         } else if (!loaderData->stage2Data && loaderData->instRepo) {
             /* If no CD/DVD with a stage2 image was found and we were
given a
              * repo=/method= parameter, try to piece together a valid
setting
              * for the stage2= parameter based on that.

              */
             char *tmp;

             checked_asprintf(&tmp, "%s/images/install.img",
                              loaderData->instRepo);

             logMessage(INFO, "no stage2= given, assuming %s", tmp);
             setStage2LocFromCmdline(tmp, loaderData);
             free(tmp);

             /* If we had to infer a stage2= location, but the repo=
parameter
              * we based this guess on was wrong, we need to correct the
typo
              * in both places.  Unfortunately we can't really know what
the
              * user meant, so the best we can do is take the results of

              * running stage2= through the UI and chop off any
/images/whatever
              * path that's at the end of it.

              */

To me this sounds as if this should handle my above case but apparently
didn't which in turn led to the segfault?

             loaderData->inferredStage2 = 1;
             skipMethodDialog = 1;
         }

Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux