From patchwork Thu Jul 22 08:55:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 113533 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6M8ujrY021526 for ; Thu, 22 Jul 2010 08:56:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758949Ab0GVI4m (ORCPT ); Thu, 22 Jul 2010 04:56:42 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:40551 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758998Ab0GVI4j (ORCPT ); Thu, 22 Jul 2010 04:56:39 -0400 Received: by fxm14 with SMTP id 14so4104416fxm.19 for ; Thu, 22 Jul 2010 01:56:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=tZ2WNSZyJNlH3lZaJI0vMYZwa70ON7yqFje/GeeibRY=; b=coXuNgQXarasrkdi4uC73MnDQAm9JiUTknnDY5Gen2mbjkZelakO82FWaED9GY/Nag moeAkS1Bncy1dj++wro/qSYWT/svd9Kh19V1qvuGunv8UT1RbqiAHHl5apVSd2gT+vu4 DSusXOqhAS68D8DLg7rvBK5FQPKifwUXX1bcA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=Q+GzuAPbh7saQF3Yhugdnzu7JLwo3MJGaguNY7LHfitcRFURo3WsOj8zXnVh7bJBhK Xn8Wr88HMcrDuxlZWrWB/EXTrl5zIwNfa71SGjg1uLxmbE/9DP+96j85H6IDwinGSRJs Oz9xlgoOejOxcSTIM9KKEecIQlAS7hat0tPbQ= Received: by 10.223.119.203 with SMTP id a11mr1514574far.42.1279788997980; Thu, 22 Jul 2010 01:56:37 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id f11sm1832677fak.20.2010.07.22.01.56.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 22 Jul 2010 01:56:37 -0700 (PDT) Date: Thu, 22 Jul 2010 10:55:52 +0200 From: Dan Carpenter To: Dmitry Torokhov Cc: Mike Frysinger , Michael Hennerich , Chris Verges , Luotao Fu , linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch -next] input: adxl34x: fix leak and use after free Message-ID: <20100722085552.GW17585@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 22 Jul 2010 08:56:45 +0000 (UTC) diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c index bb9c10f..e925d12 100644 --- a/drivers/input/misc/adxl34x.c +++ b/drivers/input/misc/adxl34x.c @@ -709,7 +709,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq, input_dev = input_allocate_device(); if (!ac || !input_dev) { err = -ENOMEM; - goto err_out; + goto err_free_mem; } ac->fifo_delay = fifo_delay_default; @@ -904,9 +904,9 @@ int adxl34x_remove(struct adxl34x *ac) sysfs_remove_group(&ac->dev->kobj, &adxl34x_attr_group); free_irq(ac->irq, ac); input_unregister_device(ac->input); + dev_dbg(ac->dev, "unregistered accelerometer\n"); kfree(ac); - dev_dbg(ac->dev, "unregistered accelerometer\n"); return 0; } EXPORT_SYMBOL_GPL(adxl34x_remove);