Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3953711imm; Sun, 13 May 2018 23:52:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZra/9xx+15KC6kQ8Q1L25oB8jJ56+m7r6y/Eeyz/fgUZYz4Df5UBSmR1FQ5t3CzxYvSV3Mq X-Received: by 2002:a17:902:1c8:: with SMTP id b66-v6mr8424261plb.156.1526280738789; Sun, 13 May 2018 23:52:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526280738; cv=none; d=google.com; s=arc-20160816; b=xKmWfr9auRHuqGUGLKDQsuAC1fOhkVW4+ngqiW9u4hwRc7wSFPqAc3sPHsCYLfPXDk coHVp6hsp7LnqNZbCwPrh4FJ+OZOvD0GqqYBjmLsxo/Hbs7xL+5o/iaRGv5gxiuGLDwM 2miuxukoa5pArOCsXb86VLrXG/2/N8tXUVaygBflBLmtNb21h/Vltm0MtnNzXJ9dXysW xaiaDZdsSAMDo/qcNxTvq9KnPM1DpfvCPLubX9ZB28A1IuIt5VZJEZqdOTyTlKMAgcpl CzyqJdL0KXyepTwgkT5yqXy4L96102B1sjXtAr2tMMlmQzkBo+AQMjArDhTcBP6/cB4N +F0Q== 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=fZVXLC3VDJls9S/qd7Jx3lALqc0HkS3A4mf+JG7aeMw=; b=Ye1AqxLBqyRwG6XKUSR6t3l5F6DKZfE6tdo1Jh61XRXFA5iNLktc0MBG7WqCEjBHxo OQY6obqDEKjL2m91ke/5KG0Rab5cGrapxzyZn2iL3bHKSga62otsJDWvDwyi9LxDOtQU vs1Mi9nu32HSJKX6wJo8GHuXCiGkKZVGMfVf2DVvdsRjpcy+yllcHgteRP51VS9fCYbf NBpEShXSxo1wIm77IzhpVkhFsu1YAOVtYdoP0EsY1Bl1B50BgA+UJv1aOWBH46vn6XuX gXP5xnjmJcpXeEFvXSkalxUA3g6PkmuHyctn0jslw/uQL8RQv31uVVQ2SsnwWVaG3bGe bJ4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FAC6DATL; 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 l70-v6si9010031pfk.129.2018.05.13.23.52.04; Sun, 13 May 2018 23:52:18 -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=FAC6DATL; 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 S1752326AbeENGuw (ORCPT + 99 others); Mon, 14 May 2018 02:50:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:57570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752290AbeENGut (ORCPT ); Mon, 14 May 2018 02:50:49 -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 2E8E820834; Mon, 14 May 2018 06:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526280649; bh=or9X7Kkqs0185ROzhjLjjJQ+N8NSZbpG1jheOxbjfqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FAC6DATLiOUVOLxpEjBonYP8UyK3z/AiW2EDAQgu8h9lab5CDoIUVY/QutTghaaSF SQz+I/SSLogykj06bpR0pFgGiGPW84y+bVj5G2vRKxA4Di/tU8viA6XZ5A6RbWODx+ jsXUy3KPYDGXcNMJHNrzHoKq5UKVuyz9H6VME8ac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heikki Krogerus , Johan Hovold , Johannes Berg Subject: [PATCH 3.18 19/23] rfkill: gpio: fix memory leak in probe error path Date: Mon, 14 May 2018 08:48:48 +0200 Message-Id: <20180514064704.856469248@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180514064704.046463679@linuxfoundation.org> References: <20180514064704.046463679@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 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 4bf01ca21e2e0e4561d1a03c48c3d740418702db upstream. Make sure to free the rfkill device in case registration fails during probe. Fixes: 5e7ca3937fbe ("net: rfkill: gpio: convert to resource managed allocation") Cc: stable # 3.13 Cc: Heikki Krogerus Signed-off-by: Johan Hovold Reviewed-by: Heikki Krogerus Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/rfkill/rfkill-gpio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c @@ -134,13 +134,18 @@ static int rfkill_gpio_probe(struct plat ret = rfkill_register(rfkill->rfkill_dev); if (ret < 0) - return ret; + goto err_destroy; platform_set_drvdata(pdev, rfkill); dev_info(&pdev->dev, "%s device registered.\n", rfkill->name); return 0; + +err_destroy: + rfkill_destroy(rfkill->rfkill_dev); + + return ret; } static int rfkill_gpio_remove(struct platform_device *pdev)