Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2319865imm; Mon, 28 May 2018 06:02:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJDx7Pcq3iy0MdlxGtW7dz1zG7H2M/QoY+2EE84UGoulDK9NiVVaKUvShOInaHD8DFJk8rp X-Received: by 2002:a62:a054:: with SMTP id r81-v6mr8613142pfe.10.1527512530334; Mon, 28 May 2018 06:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527512530; cv=none; d=google.com; s=arc-20160816; b=0DOQ3q23UB60rBOp9DvM4cbHmNEwhVSyI0xZGJrGzw1lFenokxmJPBZjjgLDL1jBmh XX7UHjFbejWazTLVDdpemETseJttImem6a8djWd+lLfstfLdfeYIRsXzwNZ3R2pl7UMO pQm+pWGlPFU7y4K53AkPCDOekF7h2JPwKkGbL2vU06iKH1H/x6bR3rwoShg8TeNTh386 SqCe5SDfbDfFQMevVH3kRhOu7TRt4BFJgvZibQSHuZYG0spl8TbtMPvCt8mVcN3MUwUh bVsL6VDe1F4Fu7e7P3s9yN2Ar3RiwzVko26iAmAEMgBesijJD8kE9jxtiOOkqqOTk4J5 4yGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=RIyF+SOHhr5bahzZaVQCKBoTf6tv9O5EjDA5n54n0cE=; b=pKMCfy2RmXeJD2BoBQ7LgYBxJO/OCaL0OZo8AdnLV3WTEl93qySupSaUmGdrf2d/A6 eUsqk8Lq9YDRg1PInjf1K+0xiqY6ikJMkPcg9fYCL50zfKhNW/0V70O9wslHAQ8yTAw6 ZPa3sZrxVUeUylXSjTi75kWf7Nphi3uclTFnMDp3yAZQ/sYbf2/CVkI4Id8BKIPC39Yp zGSoC5EP7gfrr/EkrQ2faJMvsKnTcFRfu4U5wrQsc3oC8iKlrRyZtfE6f7OBYsznmCnk EShkHqqbVBuKzLWXbhEQ7sRifhARJi/S0nH0Ibia1EgVY9wNuxKQwNMKZzoj7owzAGkO DjGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B4ZJ3ACX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k2-v6si30162534plt.374.2018.05.28.06.01.49; Mon, 28 May 2018 06:02:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B4ZJ3ACX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1165104AbeE1NBH (ORCPT + 99 others); Mon, 28 May 2018 09:01:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:42696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163591AbeE1Kxf (ORCPT ); Mon, 28 May 2018 06:53:35 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4F6A12075C; Mon, 28 May 2018 10:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504814; bh=N5RbGGy7vwLVY1eQC6mFY+jDPgsT72+YoGlPGlWEEP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B4ZJ3ACXRfaxOjRH2t39WuxqkcEOuVKv17ePTlU1Yi36oZJ3oBjGvQMDsovQgYgnA XgUMfRotf2IjBxp2NaZTKKaHMIjuNyP4vTSwlXv0Dib2hhWhpJ8VbEpvYDhKLUX091 F/EX574puhULsN20WWPtz1wGP4nWo7xqaQMqrfNA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arvind Yadav , Tejun Heo , Sasha Levin Subject: [PATCH 4.14 246/496] workqueue: use put_device() instead of kfree() Date: Mon, 28 May 2018 12:00:31 +0200 Message-Id: <20180528100330.261720481@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arvind Yadav [ Upstream commit 537f4146c53c95aac977852b371bafb9c6755ee1 ] Never directly free @dev after calling device_register(), even if it returned an error! Always use put_device() to give up the reference initialized in this function instead. Signed-off-by: Arvind Yadav Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- kernel/workqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5350,7 +5350,7 @@ int workqueue_sysfs_register(struct work ret = device_register(&wq_dev->dev); if (ret) { - kfree(wq_dev); + put_device(&wq_dev->dev); wq->wq_dev = NULL; return ret; }