lkml.org 
[lkml]   [2014]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 2/4] uprobes: Change unregister/apply to WARN() if uprobe/consumer is gone
Date
On Fri, 27 Jun 2014 19:01:40 +0200, Oleg Nesterov wrote:
> Add WARN_ON's into uprobe_unregister() and uprobe_apply() to ensure
> that nobody tries to play with the dead uprobe/consumer. This helps
> to catch the bugs like the one fixed by the previous patch.
>
> In the longer term we should fix this poorly designed interface.
> uprobe_register() should return "struct uprobe *" which should be
> passed to apply/unregister. Plus other semantic changes, see the
> changelog in commit 41ccba029e94.
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> ---
> kernel/events/uprobes.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index c445e39..6f3254e 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -846,7 +846,7 @@ static void __uprobe_unregister(struct uprobe *uprobe, struct uprobe_consumer *u
> {
> int err;
>
> - if (!consumer_del(uprobe, uc)) /* WARN? */
> + if (WARN_ON(!consumer_del(uprobe, uc)))
> return;
>
> err = register_for_each_vma(uprobe, NULL);
> @@ -927,7 +927,7 @@ int uprobe_apply(struct inode *inode, loff_t offset,
> int ret = -ENOENT;
>
> uprobe = find_uprobe(inode, offset);
> - if (!uprobe)
> + if (WARN_ON(!uprobe))
> return ret;
>
> down_write(&uprobe->register_rwsem);
> @@ -952,7 +952,7 @@ void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consume
> struct uprobe *uprobe;
>
> uprobe = find_uprobe(inode, offset);
> - if (!uprobe)
> + if (WARN_ON(!uprobe))
> return;
>
> down_write(&uprobe->register_rwsem);


\
 
 \ /
  Last update: 2014-06-30 08:21    [W:0.193 / U:25.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site