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: <iyraiattza5sogq4ysmmds2uvenlhnccrdw7vhoizgsu462db3@ouuwrbrznct6>
Date: Thu, 23 Jan 2025 22:26:18 +0900
From: Koichiro Den <koichiro.den@...onical.com>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: linux-kselftest@...r.kernel.org, linux-gpio@...r.kernel.org, 
	bamv2005@...il.com, shuah@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftests: gpio: gpio-sim: Fix missing chip disablements

On Wed, Jan 22, 2025 at 10:26:27AM GMT, Bartosz Golaszewski wrote:
> On Wed, Jan 22, 2025 at 5:33 AM Koichiro Den <koichiro.den@...onical.com> wrote:
> >
> > Since upstream commit 8bd76b3d3f3a ("gpio: sim: lock up configfs that an
> > instantiated device depends on"), rmdir for an active virtual devices
> > been prohibited.
> >
> > Update gpio-sim selftest to align with the change.
> >
> > Reported-by: kernel test robot <oliver.sang@...el.com>
> > Closes: https://lore.kernel.org/oe-lkp/202501221006.a1ca5dfa-lkp@intel.com
> > Signed-off-by: Koichiro Den <koichiro.den@...onical.com>
> > ---
> >  tools/testing/selftests/gpio/gpio-sim.sh | 31 +++++++++++++++++++-----
> >  1 file changed, 25 insertions(+), 6 deletions(-)
> >
> > diff --git a/tools/testing/selftests/gpio/gpio-sim.sh b/tools/testing/selftests/gpio/gpio-sim.sh
> > index 6fb66a687f17..bbc29ed9c60a 100755
> > --- a/tools/testing/selftests/gpio/gpio-sim.sh
> > +++ b/tools/testing/selftests/gpio/gpio-sim.sh
> > @@ -46,12 +46,6 @@ remove_chip() {
> >         rmdir $CONFIGFS_DIR/$CHIP || fail "Unable to remove the chip"
> >  }
> >
> > -configfs_cleanup() {
> > -       for CHIP in `ls $CONFIGFS_DIR/`; do
> > -               remove_chip $CHIP
> > -       done
> > -}
> > -
> >  create_chip() {
> >         local CHIP=$1
> >
> > @@ -105,6 +99,13 @@ disable_chip() {
> >         echo 0 > $CONFIGFS_DIR/$CHIP/live || fail "Unable to disable the chip"
> >  }
> >
> > +configfs_cleanup() {
> > +       for CHIP in `ls $CONFIGFS_DIR/`; do
> > +               disable_chip $CHIP
> > +               remove_chip $CHIP
> > +       done
> > +}
> > +
> >  configfs_chip_name() {
> >         local CHIP=$1
> >         local BANK=$2
> > @@ -181,6 +182,7 @@ create_chip chip
> >  create_bank chip bank
> >  enable_chip chip
> >  test -n `cat $CONFIGFS_DIR/chip/bank/chip_name` || fail "chip_name doesn't work"
> > +disable_chip chip
> >  remove_chip chip
> >
> 
> Hi! Thanks for addressing it.
> 
> Is there any place in this file where we'd call remove_chip() without
> calling disable_chip() first? Maybe we can fold disable_chip() into
> remove_chip() and make the patch much smaller?

My aplogies for being late.

Yes, there are five places where I intentionally omitted disable_chip()
calls before remove_chip() because the chip wasn't enabled in thoses cases.
I scattered disable_chip() calls only where truly necessary. I also think
explicit enable_chip()/disable_chip() pairing look more clean and readable.

That being said, I'm fine with your suggestion.

-Koichiro Den

> 
> Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ