From: Takashi Iwai Subject: Re: [PATCH] ak4117: Do not free priv until timer handler hasn't actually stopped using it Date: Fri, 14 Feb 2014 14:17:18 +0100 Message-ID: References: <1392378477.5384.29.camel@tkhai> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id A6922261703 for ; Fri, 14 Feb 2014 14:17:20 +0100 (CET) In-Reply-To: <1392378477.5384.29.camel@tkhai> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Kirill Tkhai Cc: tkhai@yandex.ru, alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Fri, 14 Feb 2014 15:47:57 +0400, Kirill Tkhai wrote: > > Function del_timer() does not guarantee that timer was really deleted. > If the timer handler is beeing executed at the moment, the function > does nothing. So, it's possible to use already freed memory in the handler: > > [ref: Documentation/DocBook/kernel-locking.tmpl] > > This was found using grep and compile-tested only. Thanks, applied. Takashi > > Signed-off-by: Kirill Tkhai > CC: Jaroslav Kysela > CC: Takashi Iwai > --- > sound/i2c/other/ak4117.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/i2c/other/ak4117.c b/sound/i2c/other/ak4117.c > index 40e33c9..88452e8 100644 > --- a/sound/i2c/other/ak4117.c > +++ b/sound/i2c/other/ak4117.c > @@ -62,7 +62,7 @@ static void reg_dump(struct ak4117 *ak4117) > > static void snd_ak4117_free(struct ak4117 *chip) > { > - del_timer(&chip->timer); > + del_timer_sync(&chip->timer); > kfree(chip); > } > > > >