Received: by 10.223.164.221 with SMTP id h29csp2479164wrb; Mon, 30 Oct 2017 04:51:40 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RIxt2xb5cdpm6jWSvOsKk57tDuSfKP+4dDzLm/CFBp9kjse20gaOtVoclO4kE/jFyvAZdc X-Received: by 10.84.217.206 with SMTP id d14mr7233064plj.196.1509364300468; Mon, 30 Oct 2017 04:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509364300; cv=none; d=google.com; s=arc-20160816; b=bGUlGkrZhqIxm2H4RweGJg8pdx0ovBtHsJFvdpylutis95RCq7xWmji9kwZcCE6Nlj U6R/fKxlZSYCaXJ/kpa1SS7EUwSKQvkAx3JCyAdQd1PEnoBTn5o4FLZu7/YphSdj8QtA zBkxefJpuyesDF9XdOxxUwqbvwPO69eVJEzQ1W6tavB/8oq73df0oH5Wc6RiwcTC9j1X wBo4ratHPkXodeUVbxX79FBVq1jk4FO7cMVWP3fUYP7BRv3Qmd5eZaKepYdUOlKvOeHy hmRK1snibMMCwqs8LAcNce9fAmb9ulP4E4/oSGtG6LACRa9RcHnCXFI7BHq244kN6cGB W5JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=en/GJtVKJP7VEJ89oiaAwBNpZ5LhsvTbpcw5zpSWzlE=; b=0inSVQ9/gjsuyLRgLxbf9+AhddQMAYNCn0ItIS2IVIZxFwePRZkuEjrSj2+CIeIq9M NFHx/MFXb8H2vzSrSno77w3A4sfuO/ORJ1lSv4h7PPCNqkbkm5RgHoNpfMTcNuX7MWmN MIx/8UhMnztdVAgza5TCdRQn/fpn6VHw6GAgbgSyMRmN1mm3HmylhefhBNb5hNKawVxJ lRFs70woUuP9A9jMOQ9QZ0RmEs6fOvWuZG65wSM/v6uRG6miHjYpUnof2sEMJtDCZc+a oC6KzjkfwIvcqUi/dekwGUc1gSuwqQKBoIvLCyx2pL3kZeU6JmiCj82+sxlCy1iUvQ4e 2l+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=KBymVX8D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x81si10720314pfk.539.2017.10.30.04.51.27; Mon, 30 Oct 2017 04:51:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=KBymVX8D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753099AbdJ3LcG (ORCPT + 99 others); Mon, 30 Oct 2017 07:32:06 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:54857 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752536AbdJ3LcE (ORCPT ); Mon, 30 Oct 2017 07:32:04 -0400 Received: by mail-lf0-f67.google.com with SMTP id a2so14510635lfh.11 for ; Mon, 30 Oct 2017 04:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=en/GJtVKJP7VEJ89oiaAwBNpZ5LhsvTbpcw5zpSWzlE=; b=KBymVX8DLJBHMcA0GX834FYDgUXxPYeBsk3VBpXPy+rFAermV64/Lms9Hrhs0qkZoQ q1b4Yo5KsnqJgp11U675h9BaRnxNB/kLUhICXopoQJZ86EmNWHlz6yUTiKUWSvooBU4r V2fIkHsYh3uWDUZSb5M/dvJutvkX4bW7rycGK7PDvBbQ+cukiyG1TlkxddFVQ0+QCgcq 4bU24EFuebcRiClcd3DFkVOODr6h5DdCUX140ByF2W6CJwtcyt/JP9nSoAjsLZ1CIrcl l8FfHposlM+seK76QIOq/3dXYBwiCdV9LjcaoI7WXfnrwX9/MfS2oAzAnjl2C7A64W8c veQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=en/GJtVKJP7VEJ89oiaAwBNpZ5LhsvTbpcw5zpSWzlE=; b=kjpgdvrVMdHw7yrpKavE8IZS36t+HyPPrN1dI3TCf8GIS+yySMX3Q7/O13oADTtYJQ PcVblb3b3j+OCasTvupKAv2j5MswIT+TKCYR/GGWjoCLgng5X2O/u4WxhGfwf39KFhN+ bChBtwYa822llm/E0sVDqqSlQpk8KQwUYf/Kv/ZJa1ea7hnv5/OEYWLEeCFJ14STOetr K0t7QKb2pw0/P6n7YR1299ImU2CuIYrJFebXqxnT7jCfUAh+IXcUjB+iyt0q6w+k9aNA eVpCY1QZcNOaNjc9anftkd2GGQ3GmjtEEBXPbhRHwMwtgLU22OSX8DG4oWTQigRS9F08 RtAQ== X-Gm-Message-State: AMCzsaWkR+LH3VCjNFfvsQJDwMTDNyYeGYsk0SPhSP2bmlA5TmEbN659 TyAmLkGncsye6R09Vmq1CxY= X-Received: by 10.25.222.202 with SMTP id i71mr3183446lfl.177.1509363123385; Mon, 30 Oct 2017 04:32:03 -0700 (PDT) Received: from xi.terra (c-fab8e655.07-184-6d6c6d4.cust.bredbandsbolaget.se. [85.230.184.250]) by smtp.gmail.com with ESMTPSA id 11sm3323743lje.96.2017.10.30.04.32.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Oct 2017 04:32:02 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.89) (envelope-from ) id 1e98IU-0002oV-1p; Mon, 30 Oct 2017 12:32:02 +0100 Date: Mon, 30 Oct 2017 12:32:02 +0100 From: Johan Hovold To: Bryan O'Donoghue Cc: Kees Cook , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Johan Hovold , Alex Elder , greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org Subject: Re: [PATCH v2] staging: greybus: Convert timers to use timer_setup() Message-ID: <20171030113202.GB7223@localhost> References: <20171024144938.GA41224@beast> <55a6647a-8565-09e8-9f45-d9048c7dd916@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55a6647a-8565-09e8-9f45-d9048c7dd916@linaro.org> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 > > Cc: "Bryan O'Donoghue" > > Cc: Johan Hovold > > Cc: Alex Elder > > Cc: greybus-dev@lists.linaro.org > > Cc: devel@driverdev.osuosl.org > > Signed-off-by: Kees Cook > > --- > > 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 From 1582683161350186831@xxx Mon Oct 30 11:51:21 +0000 2017 X-GM-THRID: 1582126742408023281 X-Gmail-Labels: Inbox,Category Forums