lkml.org 
[lkml]   [2015]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4] context_tracking: Protect against recursion
On Thu, May 07, 2015 at 11:58:32AM +0200, Ingo Molnar wrote:
>
> * Frederic Weisbecker <fweisbec@gmail.com> wrote:
>
> > @@ -75,6 +94,11 @@ void context_tracking_enter(enum ctx_state state)
> > WARN_ON_ONCE(!current->mm);
> >
> > local_irq_save(flags);
> > + if (!context_tracking_recursion_enter()) {
> > + local_irq_restore(flags);
> > + return;
> > + }
> > +
> > if ( __this_cpu_read(context_tracking.state) != state) {
> > if (__this_cpu_read(context_tracking.active)) {
> > /*
> > @@ -105,6 +129,7 @@ void context_tracking_enter(enum ctx_state state)
> > */
> > __this_cpu_write(context_tracking.state, state);
> > }
> > + context_tracking_recursion_exit();
>
> > local_irq_restore(flags);
> > }
>
> So why not add an 'out_irq_restore:' label and use goto instead of
> duplicating the return path in the recursion check?

Ah yeah. Sometimes people prefer that we just repeat the rollback code if
it's only one line. But I'm fine with the label as well.

>
> > NOKPROBE_SYMBOL(context_tracking_enter);
> > @@ -139,6 +164,10 @@ void context_tracking_exit(enum ctx_state state)
> > return;
> >
> > local_irq_save(flags);
> > + if (!context_tracking_recursion_enter()) {
> > + local_irq_restore(flags);
> > + return;
>
> Ditto.
>
> No need to resend, I fixed this up in the patch.
>
> Thanks,
>
> Ingo

Ah thanks a lot Ingo!


\
 
 \ /
  Last update: 2015-05-07 14:21    [W:0.062 / U:1.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site