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]
Message-ID: <20230609204329.105189-1-raymondhackley@protonmail.com>
Date: Fri, 09 Jun 2023 20:44:00 +0000
From: Raymond Hackley <raymondhackley@...tonmail.com>
To: krzysztof.kozlowski@...aro.org
Cc: broonie@...nel.org, davem@...emloft.net, devicetree@...r.kernel.org, edumazet@...gle.com, jk@...econstruct.com.au, kuba@...nel.org, lgirdwood@...il.com, linux-kernel@...r.kernel.org, michael@...le.cc, netdev@...r.kernel.org, pabeni@...hat.com, raymondhackley@...tonmail.com, robh+dt@...nel.org, u.kleine-koenig@...gutronix.de
Subject: Re: [PATCH v2 2/2] NFC: nxp-nci: Add pad supply voltage pvdd-supply

Hi Krzysztof,

On Friday, June 9th, 2023 at 7:29 PM, Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org> wrote:

> > > Why do you need these checks? This should be called in correct context,
> > > so when regulator is valid and enabled. If you have such checks it
> > > suggests that code is buggy and this is being called in wrong contexts.
> > 
> > First condition !IS_ERR(pvdd) is to check if pvdd exists.
> > Some devices, msm8916-samsung-serranove for example, doesn't need pvdd or
> > have it bound in the device tree:
> 
> 
> If regulator is missing you should get a dummy.
> 
> But anyway the code will not be executed if you don't get proper regulator.
> 

The current patch set is using devm_regulator_get_optional() instead of
devm_regulator_get(), which doesn't get a dummy regulator.

> > https://github.com/torvalds/linux/commit/ab0f0987e035f908d670fed7d86efa6fac66c0bb
> > 
> > Without !IS_ERR(pvdd), checking it with regulator_is_enabled(pvdd):
> > 
> > [ 50.161882] 8<--- cut here ---
> > [ 50.161906] Unable to handle kernel paging request at virtual address fffffff9 when read
> > [ 50.161916] [fffffff9] *pgd=affff841, *pte=00000000, *ppte=00000000
> > [ 50.161938] Internal error: Oops: 27 [#1] PREEMPT SMP ARM
> > 
> > Or disabling it directly with regulator_disable(pvdd):
> > 
> > [ 69.439827] 8<--- cut here ---
> > [ 69.439841] Unable to handle kernel NULL pointer dereference at virtual address 00000045 when read
> > [ 69.439852] [00000045] *pgd=00000000
> > [ 69.439864] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
> > 
> > Second condition regulator_is_enabled(pvdd) is to make sure that pvdd is
> > disabled with balance.
> 
> 
> So you have buggy code and to hide the bug you add checks? No, make the
> code correct so the check is not needed.
> 

Do you mean that I should use devm_regulator_get() instead in order to get
a dummy regulator, so that it can disable pvdd without unnecessary checks?
Actually there is v4 with those buggy codes and checks dropped.
Please do let me know if I am understanding and doing it correctly. I would
send it after proper period of cooldown.

Regards,
Raymond


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ