Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2443302imm; Mon, 28 May 2018 08:10:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLWe7xKaOYIEV4jbsWDXOv0o/5cgXHb5ShLwQbaQAX7ywEWC8eK5XL1OzKk6vFzY2YLerf7 X-Received: by 2002:a17:902:566:: with SMTP id 93-v6mr3696132plf.385.1527520258066; Mon, 28 May 2018 08:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527520258; cv=none; d=google.com; s=arc-20160816; b=hr+pM/1PmFJx4muvk1DoG7gqqIJWhC92MvKb9avo0/kxnWj8iPK4rEQxTr/7h/LMJX prkOxrfxbc/Fxpz0EEp/1BMxKRp7rZmcmqHTgZx6VVjkM0LfwOCIhEOQgrgSjXT2a8fv WZc+h5utCNf1eAY6xN1GX7L0paiyh19xEKKaDxabauIroJk2iHD2xMGIN3GJWjTFFsI1 5cd/nTB5YrmDvORYQw7rVxdapPCtYtlPuSe/YA11km4A2nhjcb27VQ2N3o2Ovu3lFvHV 6MU685ubLk2Q6sGade2SvpKUCxL7Ju4qUuAH8kyFBv3fxcLTX9zC5bgvC3etaFqZ3/UM eOcQ== 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=iGYGWRRTIl5EJOEKLgAZu1797elnR07VyBPvMsI4d3A=; b=nG+VqSXqCRIIOtErA7ypMoCTAczAoMSqAO0piUt6le0XdxLVvoOp11T2Nq6FGuK9VF 3a8Hdo8vQOO6mk+WFcngRrrvri/MbbVUI7YtnMwq5uPivcC7CIeKzM2L59s0GzNpHA/9 Tf2LCVL02nnH9kYF+DssmTyV80p80sUymINXYaioO+Q0TkF+msIT7VEonnJbzxnPEPyy yDOrwk1JQ6NnJlHt+vtz2ynFgc0ZCsTwvzCAUZuQexTp/RDUDuMPo+6eM0sbK7rqXfrm WtVACefK9PvT7mof+Ci1Z9E3pHAxBOKqPBd2YgYHdtzTaca8sppM9VTThPusEA+f+E4s hFoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wPSxRIhe; 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 a98-v6si30261532pla.239.2018.05.28.08.10.43; Mon, 28 May 2018 08:10:58 -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=wPSxRIhe; 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 S1165993AbeE1PKH (ORCPT + 99 others); Mon, 28 May 2018 11:10:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:43560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033758AbeE1KYP (ORCPT ); Mon, 28 May 2018 06:24:15 -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 C2D462088E; Mon, 28 May 2018 10:24:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527503055; bh=qW1sg0SEEQIc0u38evr7TO9Iy1s/o0gVlNiVWR+xdF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wPSxRIhej40pRYViKorL8hVvSSQB62wRYL4/cuoUNbtHeqhQIIxr3klScOjkh+aB6 LgNuxnqnRCfdqOI5OtE7hhHciIZ4Faw3MIBVmALOcbJFhBH4m62FAMb6FNdPyflGff ItlshhPkDcIixbkdwsi+SxZnyWRMPrCep8l8VKis= 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.4 227/268] ALSA: vmaster: Propagate slave error Date: Mon, 28 May 2018 12:03:21 +0200 Message-Id: <20180528100228.669965564@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100202.045206534@linuxfoundation.org> References: <20180528100202.045206534@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.4-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 */