Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2242811imm; Mon, 28 May 2018 04:37:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpJ85TWx3OQLnPWKaLYgFiESDl+bNuqrst1XKjGNFOtFnTT3++Zzcqb9wje8eDaYFarLZmT X-Received: by 2002:a17:902:bd98:: with SMTP id q24-v6mr10427720pls.105.1527507474997; Mon, 28 May 2018 04:37:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527507474; cv=none; d=google.com; s=arc-20160816; b=tE4JBgdK+UDRLzEYo2fgEU53UZaAiZ+WpRvWIqgCG/KtOmUg149hW4HfeKIdZhYWC8 IyNWR8zdHoFgQOugMKHc9/UnlJJDBebmZjMiM1c6X3eAUNilpCCP6Nzi3JssJdzHVzEd X84qVKKWv+Yzf7AQVH6xRh6jIHHrxmB1hMGuC/zL3ThT2o6sPr8GvApbsUDkrR4y10sq nyV95JTvJ70ujuPuA3B7agDbuU7DwdBvKSwXZxLEmaEK8KXtaOYNqhYWQou2hXwSFKmi T6b/v512cl4LmUsu+P0ckrvlJE5WRnRmgpARKCy6O5eoE9LHUlkiRdUbH5pPdFtuU5eE zoaA== 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=F8jrA6iESwCN4KG3KOuUyzwZopCVV5ndFTcML1jRYUg=; b=kg7YmzHkCNJ/Gr48swbZC+1+XFx3nSZ0wXWGErtgT0DNvG/C+ZUZgX25vCz8ZpTOA0 Ki4TXU7nH9vgNkveH1C30KTndGYlE7hgWDxYsai899jg2LLoULNi5i9DI2sj4Tu/BZkf vwIMrAy1YcxO9EFTRRRNMsluiVvtfK8bPVA/c2ir5O3DLJcrxA4jySrURYK2b93awcWT D6trpxneJx6YIYnv6S5qf14du9LVlsro1yYbKAOFMfVineK2PuuRKQQIHtgNJzxzBlTT zJSAXM+At5x5e9Ih95aNsfKMiZ3bVCEKj5FLktzpAQ9p+Z7KH5haKe8XNn3U43h/tgmN E13g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gSKbNJMQ; 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 x2-v6si23644210pgp.298.2018.05.28.04.37.39; Mon, 28 May 2018 04:37:54 -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=gSKbNJMQ; 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 S1424187AbeE1Lgk (ORCPT + 99 others); Mon, 28 May 2018 07:36:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:60740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423669AbeE1LNG (ORCPT ); Mon, 28 May 2018 07:13:06 -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 1DB4820845; Mon, 28 May 2018 11:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527505985; bh=K5afQSqMWunnVBLQ0L2Z5V7VJKPcIBgzLzbpncIU4x4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gSKbNJMQyd8Q51ZSlYuECcUskYMgcZWy0oXim8HdheJdsF4fVne4UHbtp8NYwnCvM zeXbDfUg2VzKlwMaJiGecijOwjgP06oADURP8Bqvr85cm6wWBtMOr7sPU/lkKzrjsi LWfsnCNBoyHVNK2u2bW10P7EnNB+T6SMjWAR+4qs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 4.16 200/272] ALSA: vmaster: Propagate slave error Date: Mon, 28 May 2018 12:03:53 +0200 Message-Id: <20180528100257.379696348@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100240.256525891@linuxfoundation.org> References: <20180528100240.256525891@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.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Takashi Iwai [ Upstream commit 2e2c177ca84aff092c3c96714b0f6a12900f3946 ] In slave_update() of vmaster code ignores the error from the slave get() callback and copies the values. It's not only about the missing error code but also that this may potentially lead to a leak of uninitialized variables when the slave get() don't clear them. This patch fixes slave_update() not to copy the potentially uninitialized values when an error is returned from the slave get() callback, and to propagate the error value properly. Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- sound/core/vmaster.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c @@ -68,10 +68,13 @@ static int slave_update(struct link_slav return -ENOMEM; uctl->id = slave->slave.id; err = slave->slave.get(&slave->slave, uctl); + if (err < 0) + goto error; for (ch = 0; ch < slave->info.count; ch++) slave->vals[ch] = uctl->value.integer.value[ch]; + error: kfree(uctl); - return 0; + return err < 0 ? err : 0; } /* get the slave ctl info and save the initial values */