From patchwork Mon Dec 14 15:16:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 7845241 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EFC919F32E for ; Mon, 14 Dec 2015 15:15:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8513A2041A for ; Mon, 14 Dec 2015 15:15:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C56FA2034C for ; Mon, 14 Dec 2015 15:15:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752095AbbLNPPt (ORCPT ); Mon, 14 Dec 2015 10:15:49 -0500 Received: from mail-lb0-f179.google.com ([209.85.217.179]:36418 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752431AbbLNPPs (ORCPT ); Mon, 14 Dec 2015 10:15:48 -0500 Received: by lbblt2 with SMTP id lt2so108922106lbb.3; Mon, 14 Dec 2015 07:15:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=BQZCgf6VpgyG8txP9T5YR+0gw6iVN27BL6tfLXsSqxc=; b=XkanwiWwDpR7bna5iL9OrXkN2Vvwz4oAic3jE5PtB+nigwDZYCk5veRdCfCtlVcAM4 WOJB6TQ+7nVPv1aC6+cQ4aQVz+TM4AtO5fZIQCbyZgqEOXj9fIVn4aEePzCksOYO1kdz l+T0c8Y6r/tycJDiOCmV65IF53yDQtou+YqDA3ukcxPwipKIaw2azqjc8TUo0lC9uusF od0HXFD/TOW1DzuA4Q3em3RcCqxXHM+kIbrMPEZRRl73GJWhuy2ak4y+bnDnz19deEnU jlLpzdp063YGxOhVqjU9xH6VDshFHYR4gBCf10g9cvNoxLv9V+QY63NG8Sk3Bz6B/Js9 ZOKw== X-Received: by 10.112.13.5 with SMTP id d5mr13178631lbc.7.1450106146359; Mon, 14 Dec 2015 07:15:46 -0800 (PST) Received: from xi.terra ([84.216.64.23]) by smtp.gmail.com with ESMTPSA id a190sm5573751lfa.32.2015.12.14.07.15.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Dec 2015 07:15:45 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.85) (envelope-from ) id 1a8UrR-0007CC-LQ; Mon, 14 Dec 2015 16:16:26 +0100 From: Johan Hovold To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH] spi: fix parent-device reference leak Date: Mon, 14 Dec 2015 16:16:19 +0100 Message-Id: <1450106179-27623-1-git-send-email-johan@kernel.org> X-Mailer: git-send-email 2.4.10 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix parent-device reference leak due to SPI-core taking an unnecessary reference to the parent when allocating the master structure, a reference that was never released. Note that driver core takes its own reference to the parent when the master device is registered. Fixes: 49dce689ad4e ("spi doesn't need class_device") Cc: stable # v2.6.24 Signed-off-by: Johan Hovold --- drivers/spi/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 2b0a8ec3affb..dee1cb87d24f 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1705,7 +1705,7 @@ struct spi_master *spi_alloc_master(struct device *dev, unsigned size) master->bus_num = -1; master->num_chipselect = 1; master->dev.class = &spi_master_class; - master->dev.parent = get_device(dev); + master->dev.parent = dev; spi_master_set_devdata(master, &master[1]); return master;