Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4082077ybi; Mon, 29 Jul 2019 18:52:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQGO7iO1kIhzuWeJiSyaaYLA+8XEMCzjZMX83+BGZF5F1qQlfm9Q1scMwCPS5q7ferfCMj X-Received: by 2002:a17:90a:7d04:: with SMTP id g4mr115665169pjl.41.1564451538162; Mon, 29 Jul 2019 18:52:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564451538; cv=none; d=google.com; s=arc-20160816; b=oP+L0RPeQp3FVjhoEmTjnSuwxv9BXBSzvmeEqMsTDo+i7LGC9mNN1r2+5XLzYgE3Y2 1k0Fc4Sti+uJ1FcYoPiJHD61UmYwOTGXPYFT0yfXHHA+Ir4Uih66x1RGMRPNfp1uKHvX /p+Iv+eSOIDlHVpoJ3LWv0ya+9AVC5eKfD9bJJUeHzfomrzGuLOe6Zrm+9mkBld3MMEZ kSSlZHtDI6heCTHtWgv8cUV7HHAdNkBnbSsZrEmbczHa1wWfSegNp9rWNe6gpISZc8jq Ag9QscS1TIlbDiD6rKaEi3afEYhUsyOGocICXvHw8/9NZ5U7xJBqAYI4RUehoclFi407 JUuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d915NENnZ7Nxcrjb2zihLQ4KTcUfCRr7Xcb8CMojmYo=; b=Jalg6x9KOshuXmHeaF+ACe8RxA0hQbZCCmulE6lV18cpinfH2mkbJkaTatsww3GOz5 h3jE9OaJcEsQBbxmcBkbSz89J+tj6Hp+ISw8XHfLMN3bkzrjcURcLHxdjiKeATm/3opE QYWj1nEO4VS21xFSFeVPw/4KIi6ZskKA7YeZ6USp7j5WiRtT9I+seDoRHJ1SMJVseyb6 pDlMHcFgqxrJXA0/CqmzVPdPJKh4m584xRICSBe98njbT+Ge3knA9by6KdjDhaFloX0e bdtbU41FaXkL+NeXrS+ysaIbu0fa/DIaV4tzGfVbn8WCh1Y+5eT1BoG7Id86Cx0+6Tnc 4Law== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Alwqy12g; 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 v13si29409808pfe.217.2019.07.29.18.52.03; Mon, 29 Jul 2019 18: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=Alwqy12g; 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 S2389555AbfG2Toj (ORCPT + 99 others); Mon, 29 Jul 2019 15:44:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:33090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389793AbfG2Toa (ORCPT ); Mon, 29 Jul 2019 15:44:30 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 46BF02054F; Mon, 29 Jul 2019 19:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429469; bh=Yf2qTam8zLu9PWEOf5/AZhz52ovvkQIAeWVI3Uu/gME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Alwqy12gEn08i29mm9hF+rNttZqIyD2ckWoyIYu0djNiN++G7c8InNPUI/lbxwjo1 TGs3iR/SQrtfQYIzMX2EJr8eEuZZXWnkpzX/Z+haiQ44i856NvMOu9F9BD95GsqNVl UGa1Klm4M1TUboeB6cGeYvMxBp+Wrd1ReFAqX4BI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ding Xiang , Takashi Iwai Subject: [PATCH 4.19 107/113] ALSA: ac97: Fix double free of ac97_codec_device Date: Mon, 29 Jul 2019 21:23:14 +0200 Message-Id: <20190729190720.814115267@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190655.455345569@linuxfoundation.org> References: <20190729190655.455345569@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ding Xiang commit 607975b30db41aad6edc846ed567191aa6b7d893 upstream. put_device will call ac97_codec_release to free ac97_codec_device and other resources, so remove the kfree and other redundant code. Fixes: 74426fbff66e ("ALSA: ac97: add an ac97 bus") Signed-off-by: Ding Xiang Cc: Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/ac97/bus.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) --- a/sound/ac97/bus.c +++ b/sound/ac97/bus.c @@ -125,17 +125,12 @@ static int ac97_codec_add(struct ac97_co vendor_id); ret = device_add(&codec->dev); - if (ret) - goto err_free_codec; + if (ret) { + put_device(&codec->dev); + return ret; + } return 0; -err_free_codec: - of_node_put(codec->dev.of_node); - put_device(&codec->dev); - kfree(codec); - ac97_ctrl->codecs[idx] = NULL; - - return ret; } unsigned int snd_ac97_bus_scan_one(struct ac97_controller *adrv,