Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1706966 > unrolled thread

[PATCH] kmod: test_kmod: Correctly lock reg_dev_mutex

Started byDaniel Mentz <danielmentz@google.com>
First post2017-08-09 01:40 +0200
Last post2017-08-10 00:40 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] kmod: test_kmod: Correctly lock reg_dev_mutex Daniel Mentz <danielmentz@google.com> - 2017-08-09 01:40 +0200
    Re: [PATCH] kmod: test_kmod: Correctly lock reg_dev_mutex "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-08-09 21:30 +0200
      Re: [PATCH] kmod: test_kmod: Correctly lock reg_dev_mutex Daniel Mentz <danielmentz@google.com> - 2017-08-10 00:00 +0200
        Re: [PATCH] kmod: test_kmod: Correctly lock reg_dev_mutex "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-08-10 00:40 +0200

#1706966 — [PATCH] kmod: test_kmod: Correctly lock reg_dev_mutex

FromDaniel Mentz <danielmentz@google.com>
Date2017-08-09 01:40 +0200
Subject[PATCH] kmod: test_kmod: Correctly lock reg_dev_mutex
Message-ID<ucmgp-76Q-7@gated-at.bofh.it>
It appears that, in the preamble of register_test_dev_kmod(),
mutex_lock() has been confused with mutex_unlock().

Previously, register_test_dev_kmod() never called mutex_lock() but
instead, it called mutex_unlock() twice.

Signed-off-by: Daniel Mentz <danielmentz@google.com>
Cc: Luis R. Rodriguez <mcgrof@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 lib/test_kmod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index 6c1d678bcf8b..f458130a5e65 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -1146,7 +1146,7 @@ static struct kmod_test_device *register_test_dev_kmod(void)
 	struct kmod_test_device *test_dev = NULL;
 	int ret;
 
-	mutex_unlock(&reg_dev_mutex);
+	mutex_lock(&reg_dev_mutex);
 
 	/* int should suffice for number of devices, test for wrap */
 	if (unlikely(num_test_devs + 1) < 0) {
-- 
2.14.0.434.g98096fd7a8-goog

[toc] | [next] | [standalone]


#1707765

From"Luis R. Rodriguez" <mcgrof@kernel.org>
Date2017-08-09 21:30 +0200
Message-ID<ucEQ2-39z-3@gated-at.bofh.it>
In reply to#1706966
On Tue, Aug 08, 2017 at 04:27:33PM -0700, Daniel Mentz wrote:
> It appears that, in the preamble of register_test_dev_kmod(),
> mutex_lock() has been confused with mutex_unlock().
> 
> Previously, register_test_dev_kmod() never called mutex_lock() but
> instead, it called mutex_unlock() twice.
> 
> Signed-off-by: Daniel Mentz <danielmentz@google.com>
> Cc: Luis R. Rodriguez <mcgrof@kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> ---

Thanks Daniel but someone beat you to the fix, I've sent this to Andrew
and he's integrated into his -mm tree. See:

http://lkml.kernel.org/r/20170802211450.27928-5-mcgrof@kernel.org

This series had other fixes:

https://marc.info/?l=linux-kernel&m=150170850624962&w=2

I'll CC you on other kmod / test_kmod changes.

 Luis

[toc] | [prev] | [next] | [standalone]


#1707999

FromDaniel Mentz <danielmentz@google.com>
Date2017-08-10 00:00 +0200
Message-ID<ucHbd-4yf-41@gated-at.bofh.it>
In reply to#1707765
OK. While we're here: I think there's a spelling error in usage() in
tools/testing/selftests/kmod/kmod.sh

echo "    -c      Run test ID once"
echo "    -s      Run test ID x test-count number of times"

I believe that "-c" and "-s" are swapped. "c" probably stands for
count and "s" for single.

[toc] | [prev] | [next] | [standalone]


#1708039

From"Luis R. Rodriguez" <mcgrof@kernel.org>
Date2017-08-10 00:40 +0200
Message-ID<ucHNT-57N-7@gated-at.bofh.it>
In reply to#1707999
On Wed, Aug 09, 2017 at 02:56:52PM -0700, Daniel Mentz wrote:
> OK. While we're here: I think there's a spelling error in usage() in
> tools/testing/selftests/kmod/kmod.sh
> 
> echo "    -c      Run test ID once"
> echo "    -s      Run test ID x test-count number of times"
> 
> I believe that "-c" and "-s" are swapped. "c" probably stands for
> count and "s" for single.

Indeed, will send a fix. Thanks!

  Luis

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web