From patchwork Mon Sep 3 20:26:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 1400951 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork2.kernel.org (Postfix) with ESMTP id 3BB61DF2AB for ; Mon, 3 Sep 2012 20:26:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1T8dEM-0007mD-Hp; Mon, 03 Sep 2012 20:26:46 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1T8dEK-0007m8-M9 for spi-devel-general@lists.sourceforge.net; Mon, 03 Sep 2012 20:26:44 +0000 X-ACL-Warn: Received: from mail.active-venture.com ([67.228.131.205]) by sog-mx-2.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1T8dEJ-0001ic-Ia for spi-devel-general@lists.sourceforge.net; Mon, 03 Sep 2012 20:26:44 +0000 Received: (qmail 33646 invoked by uid 399); 3 Sep 2012 20:26:38 -0000 X-Virus-Scan: Scanned by ClamAV 0.97.2 (no viruses); Mon, 03 Sep 2012 15:26:38 -0500 Received: from unknown (HELO localhost) (guenter@roeck-us.net@108.223.40.66) by mail.active-venture.com with ESMTPAM; 3 Sep 2012 20:26:37 -0000 X-Originating-IP: 108.223.40.66 X-Sender: guenter@roeck-us.net From: Guenter Roeck To: spi-devel-general@lists.sourceforge.net Subject: [PATCH] Revert "spi/doc: spi_master_put must be followed up by kfree" Date: Mon, 3 Sep 2012 13:26:26 -0700 Message-Id: <1346703986-7849-1-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 1.7.9.7 X-Spam-Score: 0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 AWL AWL: From: address is in the auto white-list X-Headers-End: 1T8dEJ-0001ic-Ia Cc: Mark Brown , linux-kernel@vger.kernel.org, Guenter Roeck , Uwe Kleine-Koenig X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net Actually, spi_master_put() after spi_alloc_master() must _not_ be followed by kfree(). The memory is already freed with the call to spi_master_put() through spi_master_class, which registers a release function. Calling both spi_master_put() and kfree() results in often nasty (and delayed) crashes elsewhere in the kernel, often in the networking stack. This reverts commit eb4af0f5349235df2e4a5057a72fc8962d00308a. Cc: Uwe Kleine-Koenig Signed-off-by: Guenter Roeck --- drivers/spi/spi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 2d9b5bb..6470750 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1082,8 +1082,7 @@ static struct class spi_master_class = { * * The caller is responsible for assigning the bus number and initializing * the master's methods before calling spi_register_master(); and (after errors - * adding the device) calling spi_master_put() and kfree() to prevent a memory - * leak. + * adding the device) calling spi_master_put() to prevent a memory leak. */ struct spi_master *spi_alloc_master(struct device *dev, unsigned size) {