lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 30 Aug 2012 20:24:15 +0200
From:	Rabin Vincent <rabin@....in>
To:	Laxman Dewangan <ldewangan@...dia.com>
Cc:	lrg@...com, broonie@...nsource.wolfsonmicro.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] regulator: disable supply regulator if it is enabled
 for boot-on

2012/8/29 Laxman Dewangan <ldewangan@...dia.com>:
> @@ -3614,8 +3615,11 @@ static int __init regulator_init_complete(void)
>
>                 mutex_lock(&rdev->mutex);
>
> -               if (rdev->use_count)
> +               if (rdev->use_count) {
> +                       if (rdev->supply && c->boot_on)
> +                               supply_disable = true;
>                         goto unlock;
> +               }
>
>                 /* If we can't read the status assume it's on. */
>                 if (ops->is_enabled)
> @@ -3634,6 +3638,8 @@ static int __init regulator_init_complete(void)
>                         if (ret != 0) {
>                                 rdev_err(rdev, "couldn't disable: %d\n", ret);
>                         }
> +                       if (rdev->supply)
> +                               supply_disable = true;
>                 } else {
>                         /* The intention is that in future we will
>                          * assume that full constraints are provided

This does not handle the case where a regulator is not set boot_on but
is considered on (for example, because of the lack of an is_enabled
callback), and is later actually enabled by a consumer before
regulator_init_complete().  In this case, the supply's use count will
still be one more than it should be, because the "&& c->boot_on"
condition above will fail.

To fix this, you should probably note which regulators' supplies you
enable in regulator_register() and use that information in the above two
checks here in regulator_init_complete().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ