* [PATCH] locktorture: fix wrong parameter handling
@ 2015-10-09 12:14 Christian Borntraeger
2015-10-09 14:46 ` Paul E. McKenney
0 siblings, 1 reply; 4+ messages in thread
From: Christian Borntraeger @ 2015-10-09 12:14 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: linux-kernel, Christian Borntraeger
Calling locktorture with a wrong parameter makes it
unusable:
$ modprobe locktorture torture_type=help
modprobe: ERROR: could not insert 'locktorture': Invalid argument
$ modprobe locktorture torture_type=spin_lock
modprobe: ERROR: could not insert 'locktorture': Device or resource busy
$ dmesg
[...]
torture_init_begin: refusing spin_lock init: help running
We can easily do the checking before call into the torture framework.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
kernel/locking/locktorture.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 3224418..f5f66a6 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -645,9 +645,6 @@ static int __init lock_torture_init(void)
&rwsem_lock_ops,
};
- if (!torture_init_begin(torture_type, verbose, &torture_runnable))
- return -EBUSY;
-
/* Process args and tell the world that the torturer is on the job. */
for (i = 0; i < ARRAY_SIZE(torture_ops); i++) {
cxt.cur_ops = torture_ops[i];
@@ -661,9 +658,12 @@ static int __init lock_torture_init(void)
for (i = 0; i < ARRAY_SIZE(torture_ops); i++)
pr_alert(" %s", torture_ops[i]->name);
pr_alert("\n");
- torture_init_end();
return -EINVAL;
}
+
+ if (!torture_init_begin(torture_type, verbose, &torture_runnable))
+ return -EBUSY;
+
if (cxt.cur_ops->init)
cxt.cur_ops->init(); /* no "goto unwind" prior to this point!!! */
--
2.4.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] locktorture: fix wrong parameter handling
2015-10-09 12:14 [PATCH] locktorture: fix wrong parameter handling Christian Borntraeger
@ 2015-10-09 14:46 ` Paul E. McKenney
2015-10-09 14:53 ` Christian Borntraeger
0 siblings, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2015-10-09 14:46 UTC (permalink / raw)
To: Christian Borntraeger; +Cc: linux-kernel
On Fri, Oct 09, 2015 at 02:14:45PM +0200, Christian Borntraeger wrote:
> Calling locktorture with a wrong parameter makes it
> unusable:
>
> $ modprobe locktorture torture_type=help
> modprobe: ERROR: could not insert 'locktorture': Invalid argument
>
> $ modprobe locktorture torture_type=spin_lock
> modprobe: ERROR: could not insert 'locktorture': Device or resource busy
>
> $ dmesg
> [...]
> torture_init_begin: refusing spin_lock init: help running
>
> We can easily do the checking before call into the torture framework.
>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Good catch, thank you!
Could you please port this to rcu/next in the -rcu tree? Also, please
capitalize the word following the ":" in the subject line, as in "[PATCH]
locktorture: Fix wrong parameter handling".
Also, would you be interested in sending a separate patch to fix what
looks like a similar issue in kernel/locking/locktorture.c?
Thanx, Paul
> ---
> kernel/locking/locktorture.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
> index 3224418..f5f66a6 100644
> --- a/kernel/locking/locktorture.c
> +++ b/kernel/locking/locktorture.c
> @@ -645,9 +645,6 @@ static int __init lock_torture_init(void)
> &rwsem_lock_ops,
> };
>
> - if (!torture_init_begin(torture_type, verbose, &torture_runnable))
> - return -EBUSY;
> -
> /* Process args and tell the world that the torturer is on the job. */
> for (i = 0; i < ARRAY_SIZE(torture_ops); i++) {
> cxt.cur_ops = torture_ops[i];
> @@ -661,9 +658,12 @@ static int __init lock_torture_init(void)
> for (i = 0; i < ARRAY_SIZE(torture_ops); i++)
> pr_alert(" %s", torture_ops[i]->name);
> pr_alert("\n");
> - torture_init_end();
> return -EINVAL;
> }
> +
> + if (!torture_init_begin(torture_type, verbose, &torture_runnable))
> + return -EBUSY;
> +
> if (cxt.cur_ops->init)
> cxt.cur_ops->init(); /* no "goto unwind" prior to this point!!! */
>
> --
> 2.4.3
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] locktorture: fix wrong parameter handling
2015-10-09 14:46 ` Paul E. McKenney
@ 2015-10-09 14:53 ` Christian Borntraeger
2015-10-09 15:44 ` Paul E. McKenney
0 siblings, 1 reply; 4+ messages in thread
From: Christian Borntraeger @ 2015-10-09 14:53 UTC (permalink / raw)
To: paulmck; +Cc: linux-kernel
Am 09.10.2015 um 16:46 schrieb Paul E. McKenney:
> On Fri, Oct 09, 2015 at 02:14:45PM +0200, Christian Borntraeger wrote:
>> Calling locktorture with a wrong parameter makes it
>> unusable:
>>
>> $ modprobe locktorture torture_type=help
>> modprobe: ERROR: could not insert 'locktorture': Invalid argument
>>
>> $ modprobe locktorture torture_type=spin_lock
>> modprobe: ERROR: could not insert 'locktorture': Device or resource busy
>>
>> $ dmesg
>> [...]
>> torture_init_begin: refusing spin_lock init: help running
>>
>> We can easily do the checking before call into the torture framework.
>>
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>
> Good catch, thank you!
>
> Could you please port this to rcu/next in the -rcu tree? Also, please
> capitalize the word following the ":" in the subject line, as in "[PATCH]
> locktorture: Fix wrong parameter handling".
Hmmm, seems that this is already fixed in rcu/next with
commit a36a99618b1adb2d6ca0b7e08e3a656a04e477fe
Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
AuthorDate: Sun Aug 30 20:01:48 2015 -0700
Commit: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
CommitDate: Tue Oct 6 11:28:44 2015 -0700
locktorture: Fix module unwind when bad torture_type specified
No need to respin a patch it seems :-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] locktorture: fix wrong parameter handling
2015-10-09 14:53 ` Christian Borntraeger
@ 2015-10-09 15:44 ` Paul E. McKenney
0 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2015-10-09 15:44 UTC (permalink / raw)
To: Christian Borntraeger; +Cc: linux-kernel
On Fri, Oct 09, 2015 at 04:53:49PM +0200, Christian Borntraeger wrote:
> Am 09.10.2015 um 16:46 schrieb Paul E. McKenney:
> > On Fri, Oct 09, 2015 at 02:14:45PM +0200, Christian Borntraeger wrote:
> >> Calling locktorture with a wrong parameter makes it
> >> unusable:
> >>
> >> $ modprobe locktorture torture_type=help
> >> modprobe: ERROR: could not insert 'locktorture': Invalid argument
> >>
> >> $ modprobe locktorture torture_type=spin_lock
> >> modprobe: ERROR: could not insert 'locktorture': Device or resource busy
> >>
> >> $ dmesg
> >> [...]
> >> torture_init_begin: refusing spin_lock init: help running
> >>
> >> We can easily do the checking before call into the torture framework.
> >>
> >> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> >
> > Good catch, thank you!
> >
> > Could you please port this to rcu/next in the -rcu tree? Also, please
> > capitalize the word following the ":" in the subject line, as in "[PATCH]
> > locktorture: Fix wrong parameter handling".
>
> Hmmm, seems that this is already fixed in rcu/next with
>
> commit a36a99618b1adb2d6ca0b7e08e3a656a04e477fe
> Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> AuthorDate: Sun Aug 30 20:01:48 2015 -0700
> Commit: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> CommitDate: Tue Oct 6 11:28:44 2015 -0700
>
> locktorture: Fix module unwind when bad torture_type specified
>
>
> No need to respin a patch it seems :-)
Works for me! ;-)
Thanx, Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-09 15:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-09 12:14 [PATCH] locktorture: fix wrong parameter handling Christian Borntraeger
2015-10-09 14:46 ` Paul E. McKenney
2015-10-09 14:53 ` Christian Borntraeger
2015-10-09 15:44 ` Paul E. McKenney
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.