From patchwork Sat Sep 5 22:46:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Klimov X-Patchwork-Id: 53156 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id 6E51F20A78 for ; Sat, 5 Sep 2015 22:47:44 +0000 (UTC) Received: by wicmn1 with SMTP id mn1sf16066911wic.1 for ; Sat, 05 Sep 2015 15:47:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=I0tJssye+LCWUgdLMt66lkRa8VFKkE2eR8UjZJjIOho=; b=GldijVizJka82zqLta2pOe8h1k0phoWNCevouukbWQbRD2TMck7v4Cn8SxszbflbLl YlaiOvH5tObSa5briUvMYoFcbOFX7AOUfZVIPZVMtRZWuCyJWY7Pm+dKkysXtMrpDiN0 rH21yxD/miuVSRmpbv9rtHTEJkYNraW6lxsxIMwTAIfPPN6dJWTvc9nlYKTfMbpDpMj8 Y60rm0PnqXQMAKCG7xpYO9Y7oOdHdCQ1mRKzGKws4wqWGj0p6634ijefFwC5gCFIZLU2 vlhbT6B2Nof0YctRXEeUSYPfu6/deAEzj+WjkdQwWfScG1B09XNfg/JkvpNY2J6+9yjx ALWg== X-Gm-Message-State: ALoCoQkMn23NnZYT9GdVhQQB5cTXIKugKSjoD1BSqO2qymefOZSfmtbVM3jAKWdXYLKxB9XyJju5 X-Received: by 10.152.224.129 with SMTP id rc1mr2930793lac.10.1441493263428; Sat, 05 Sep 2015 15:47:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.65 with SMTP id r1ls468477lag.31.gmail; Sat, 05 Sep 2015 15:47:43 -0700 (PDT) X-Received: by 10.112.219.165 with SMTP id pp5mr10372857lbc.23.1441493263070; Sat, 05 Sep 2015 15:47:43 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id rg9si1234312lbb.79.2015.09.05.15.47.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Sep 2015 15:47:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lanb10 with SMTP id b10so32030843lan.3 for ; Sat, 05 Sep 2015 15:47:43 -0700 (PDT) X-Received: by 10.152.178.165 with SMTP id cz5mr10231485lac.29.1441493262938; Sat, 05 Sep 2015 15:47:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.164.42 with SMTP id yn10csp713065lbb; Sat, 5 Sep 2015 15:47:41 -0700 (PDT) X-Received: by 10.66.232.102 with SMTP id tn6mr26209763pac.47.1441493261727; Sat, 05 Sep 2015 15:47:41 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pi9si12087307pdb.48.2015.09.05.15.47.40; Sat, 05 Sep 2015 15:47:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752589AbbIEWrJ (ORCPT + 1 other); Sat, 5 Sep 2015 18:47:09 -0400 Received: from mail-la0-f48.google.com ([209.85.215.48]:33961 "EHLO mail-la0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751848AbbIEWrI (ORCPT ); Sat, 5 Sep 2015 18:47:08 -0400 Received: by laeb10 with SMTP id b10so32663610lae.1 for ; Sat, 05 Sep 2015 15:47:06 -0700 (PDT) X-Received: by 10.112.144.69 with SMTP id sk5mr10317126lbb.6.1441493226348; Sat, 05 Sep 2015 15:47:06 -0700 (PDT) Received: from localhost.localdomain ([46.39.50.164]) by smtp.gmail.com with ESMTPSA id qy6sm1729828lbc.26.2015.09.05.15.47.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 05 Sep 2015 15:47:05 -0700 (PDT) From: Alexey Klimov To: linux@roeck-us.net, linux-spi@vger.kernel.org, broonie@kernel.org Cc: linux-kernel@vger.kernel.org, djkurtz@chromium.org, klimov.linux@gmail.com, Alexey Klimov , Uwe Kleine-Koenig Subject: [PATCH RESEND 1/1] Revert "spi/doc: spi_master_put must be followed up by kfree" Date: Sun, 6 Sep 2015 01:46:54 +0300 Message-Id: <1441493214-12994-1-git-send-email-alexey.klimov@linaro.org> X-Mailer: git-send-email 2.1.4 Sender: linux-spi-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alexey.klimov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Guenter Roeck 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. Link to patch and concerns: https://lkml.org/lkml/2012/9/3/269 or http://lkml.iu.edu/hypermail/linux/kernel/1209.0/00790.html Alexey Klimov: This revert becomes valid after 94c69f765f1b4a658d96905ec59928e3e3e07e6a when spi-imx.c has been fixed and there is no need to call kfree() so comment for spi_alloc_master() should be fixed. Cc: Uwe Kleine-Koenig Signed-off-by: Guenter Roeck Signed-off-by: Alexey Klimov --- 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 3abb390..a5f53de 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1610,8 +1610,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) {