Re: [libgpiod] segfaults in gpiodetect and gpioinfo

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

 



On Thu, May 20, 2021 at 4:59 AM Frank Zago <frank@xxxxxxxx> wrote:
>
> Hello,
>
> If a user doesn't have permission, both gpiodetect and gpioinfo
> will segfault when run.
>
> $ ./gpiodetect
> gpiochip0 Permission denied
> zsh: segmentation fault (core dumped)  ./gpiodetect
>
> The problem is there:
>                         if (!chip) {
>                                 if (errno == EACCES)
>                                         printf("%s Permission denied\n",
>                                                entries[i]->d_name);
>                                 else
>                                         die_perror("unable to open %s",
>                                                    entries[i]->d_name);
>                         }
>
> chip is NULL, but is later dereferenced.
>
> I'm not submitting a fix as there are 2 possibilities that I can see,
> and I don't know which one would be best:
>
>   - add a continue after the die_perror line
>   - replace the printf above with die_perror()
>
> Regards,
>   Frank.

Hi Frank!

Thanks for the report. This only happens in the master branch which
currently undergoes a huge API overhaul. In the API v2 patch I sent
this problem is fixed.

Bartosz



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux