Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4326098ybi; Tue, 30 Jul 2019 00:00:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxbzX/VD4omY5NgerhyvEUhfUMLYdCaOXt0aLmrFO7kNPoZyPLFmfEudWY/RLHiUTGbPrW X-Received: by 2002:a17:902:bd06:: with SMTP id p6mr116811430pls.189.1564470036592; Tue, 30 Jul 2019 00:00:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564470036; cv=none; d=google.com; s=arc-20160816; b=zkYoPpx0oK5998c7qTFBEmmMvDyxwrA5E/CzRJhuXql7ydihzK6WNuQktx8guukfZd YlFRIp7tJSXHRl96UyrMFUff1l6ufn4IZa35yz366++DH199GfiPzmtWTvbJXpS8HnUi G/JLV6xwUOnTIbozszy4gvkZaxEjQrEomyMylLH18vvSckNX63C80zGYL7q7VvwY27EO D6Q54b/dNeJg5LAQyB6bYK4X1V8UjTQ1bdZlMa/VPfKiL+x7lcTPzBiJXpV2ymfU2UQI 2TwQ7b7Oi9KwusGWdJO5voHfVJDvo9NyWgWOTkb8q74rew7Hchmvluuw1SpaHovhnmFK Tl8g== 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=lXuylMq4TaK5Fa0xiD/szU0H37q7wY1/76M4fR5F89k=; b=xJU0wmO67D9WDP16L5KWL9PL1JsCsHNPN6t9EVH9zbXmyGm0nf9rSX+vzi77y6F6mf 2QThr4ZIpThBUqsMBSkbxxepJnLa5KT+koGcTy3zAnHStN6osJkOfI29vzaDJMyBtzhk vLRAnml/3G69TC2Z9CtWvhhG/Keu4kstyy9ZwPV0nTt23CRbsw7r8qb3NaUQYNtE0qKV N2qo9/ITAC5tKEF5njPDamjJBFhntay7tmg+IBcA4rbvoGQkPTck0ANMKbXQtnRSlDKP xriTAKA0wSKNgTDYFo4ZBlJCVKDFZptnZSj4dtOrVS5ko7TtLGX9hcCdXzYbwWshtLds KnUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zcUvpz0h; 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 b92si25775095pjc.17.2019.07.30.00.00.18; Tue, 30 Jul 2019 00:00:36 -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=zcUvpz0h; 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 S2390766AbfG2Tyt (ORCPT + 99 others); Mon, 29 Jul 2019 15:54:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:47442 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404109AbfG2Tyr (ORCPT ); Mon, 29 Jul 2019 15:54:47 -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 BE19C217D4; Mon, 29 Jul 2019 19:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564430086; bh=g9+3tq7GHZg1jHvz0me+UF46Jac2M0bJEWaDcS19MQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zcUvpz0hVGloEuQhyzdadXBADtPaJhaHbo+9a54pw8WXUw/jytERWhHGdVkWrVqbT 5lwEAiUHscSWypDg8JB8Z7cyS/w1Y7lLc1xdxcpgTRajGq2/ECrg9LDeOG1sJjugHw o8/+2MXhp9k3KcjYOJcC/SvsCZTwI4oxtS4Y0vj4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ding Xiang , Takashi Iwai Subject: [PATCH 5.2 191/215] ALSA: ac97: Fix double free of ac97_codec_device Date: Mon, 29 Jul 2019 21:23:07 +0200 Message-Id: <20190729190813.075531827@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@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 @@ -122,17 +122,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,