Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2503422imm; Mon, 28 May 2018 09:18:16 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo68XgXgjnjFbxiblmKy9l6Ep5MmOpPyb5WKCQ/OdaY9kpchqPi6G9LrdBB4qU2yviO4Sea X-Received: by 2002:a17:902:76c3:: with SMTP id j3-v6mr13899913plt.15.1527524296385; Mon, 28 May 2018 09:18:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527524296; cv=none; d=google.com; s=arc-20160816; b=Y+qnmVrkZfwiM/1GreTB3CKWQleb/qMe6hfvWcx12ZUpreO+HccwxJ22bRsok4+6sl m10U0pW4rueSZ6fuBw15fVACkP8bsKYuht7P87uKw0QyOLbETJw4Pgm8skJm6iFInPVP m6BseWNZrGfsmGuiqyjeC8uJoBuvWcDN9HBFXjzFBZb7MKX+O8lfbker9xZJzoxo04Fp yJ/mkz6mApROmE4J3LkdZkISxHoU1cHPp7U6i9ogJRDA6QJag1HFzlbTBgxTjg3Rx0Ov sGIbT5xezWNacNTpwcFUJpRHoVQnjQi/86uPUjln9S68AClGjefrUUULgntypTJxUfDm eeqA== 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=lHM4xM15/B7SRIztSfRRhGvXs2F2q27vjDoHwVL44cM=; b=LfMLMgJpktttu++b4tbIG8DwfXd4cQjO+LQ63uefaV5G84N34Mux4YZ8v9eLHluqc5 JVvUi9hSnvR7zrGbLCLwVeZ0qbiRQKXIBwoAbU+UD2GciJmRYC2rcwLVdJiBQjW3WtzK a+8z4kGAQPiyshWAmPdI0RdQlVKylHEU+d05KLI0iD3nJsj4zwm11pqxEqmNmYIUgAzE 7NZUigLkpSxSVHfN/VEORn00qbvDbtVoyfRd6JgFlm3dANojQhBTN7LWQEeFoH5I4Qzc Oo2Sbgprg2YuVUjBnV3/s5Phwg/KGQqHWtvvwKBQHIjkGN1/+GOK3/QMgTjmxcwjkjWZ t8Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rHjEYvek; 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 j10-v6si30311493plg.396.2018.05.28.09.18.01; Mon, 28 May 2018 09:18:16 -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=rHjEYvek; 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 S939954AbeE1QR3 (ORCPT + 99 others); Mon, 28 May 2018 12:17:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:60868 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965064AbeE1KMp (ORCPT ); Mon, 28 May 2018 06:12:45 -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 3A2692086D; Mon, 28 May 2018 10:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502364; bh=9ef9IacynJj3SEuqp7IJ57ZBUeZ+rrynJqZPWA1/jUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rHjEYvekRNuviEcp58p2fS9LylkQscMEEji2l1cLYvNOnj0IJr2BRAdkymvib3r8G UnJyhxCoExDbpnztlbdcgP/Niou3fCb33cn1QWuzAY/le5SmhR+slf0Cfq2RFdxmMN Xgh3Rhyx+FGciVk+CnWV7CjJg+zFC7kmpwj41Ghw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 3.18 159/185] ALSA: vmaster: Propagate slave error Date: Mon, 28 May 2018 12:03:20 +0200 Message-Id: <20180528100111.271339579@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100050.700971285@linuxfoundation.org> References: <20180528100050.700971285@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: 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 */