From: Johan Hovold <johan@kernel.org>
To: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
Cc: Kees Cook <keescook@chromium.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, Johan Hovold <johan@kernel.org>,
Alex Elder <elder@kernel.org>,
greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org
Subject: Re: [PATCH v2] staging: greybus: Convert timers to use timer_setup()
Date: Mon, 30 Oct 2017 12:32:02 +0100 [thread overview]
Message-ID: <20171030113202.GB7223@localhost> (raw)
In-Reply-To: <55a6647a-8565-09e8-9f45-d9048c7dd916@linaro.org>
On Tue, Oct 24, 2017 at 04:54:59PM +0100, Bryan O'Donoghue wrote:
> On 24/10/17 15:49, Kees Cook wrote:
> > In preparation for unconditionally passing the struct timer_list pointer to
> > all timer callbacks, switch to using the new timer_setup() and from_timer()
> > to pass the timer pointer explicitly.
> >
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
> > Cc: Johan Hovold <johan@kernel.org>
> > Cc: Alex Elder <elder@kernel.org>
> > Cc: greybus-dev@lists.linaro.org
> > Cc: devel@driverdev.osuosl.org
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> > ---
> > v2: Added back "get" in timer code, thanks to Bryan. :)
> > ---
> > drivers/staging/greybus/loopback.c | 19 +++++++++----------
> > drivers/staging/greybus/operation.c | 7 +++----
> > 2 files changed, 12 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
> > index 08e255884206..1c0bafeb7ea5 100644
> > --- a/drivers/staging/greybus/loopback.c
> > +++ b/drivers/staging/greybus/loopback.c
> > @@ -572,16 +572,16 @@ static void gb_loopback_async_operation_work(struct work_struct *work)
> > gb_loopback_async_operation_put(op_async);
> > }
> >
> > -static void gb_loopback_async_operation_timeout(unsigned long data)
> > +static void gb_loopback_async_operation_timeout(struct timer_list *t)
> > {
> > - struct gb_loopback_async_operation *op_async;
> > - u16 id = data;
> > + struct gb_loopback_async_operation *op_async =
> > + from_timer(op_async, t, timer);
> > + unsigned long flags;
> > +
> > + spin_lock_irqsave(&gb_dev.lock, flags);
> > + gb_loopback_async_operation_get(op_async);
> > + spin_unlock_irqrestore(&gb_dev.lock, flags);
>
> Damnit I'm just wrong (I hate that).
>
> The pointer can already have gone away by the time the timer runs - my
> bad...
Hmm. Then something is really broken in this driver, you obviously must
never free the async operation which contains the timer while the timer
is active.
> see attached for update - with my Signed-off added.
The right thing to do here is to respin your patch from last year which
converts the loopback driver to use the timeout handling in greybus
core. Otherwise, I'm afraid you're not addressing the underlying bug.
Either way, Kees, please submit the operation.c conversion separately
from the loopback one, as the latter is non-trivial.
Thanks,
Johan
next prev parent reply other threads:[~2017-10-30 11:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-24 14:49 [PATCH v2] staging: greybus: Convert timers to use timer_setup() Kees Cook
2017-10-24 15:54 ` Bryan O'Donoghue
2017-10-30 11:32 ` Johan Hovold [this message]
2017-10-30 11:35 ` Bryan O'Donoghue
2017-10-30 11:38 ` Johan Hovold
2017-10-30 11:44 ` Bryan O'Donoghue
2017-10-30 11:48 ` Johan Hovold
2017-10-30 21:37 ` Kees Cook
2017-10-31 0:01 ` pure.logic
2017-10-31 0:05 ` Kees Cook
2017-11-03 20:21 ` Kees Cook
2017-11-03 21:49 ` Bryan O'Donoghue
2017-11-03 21:49 ` Kees Cook
2017-10-30 11:35 ` Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171030113202.GB7223@localhost \
--to=johan@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=devel@driverdev.osuosl.org \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox