From patchwork Mon Dec 13 09:29:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 524224 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30483C433FE for ; Mon, 13 Dec 2021 09:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233778AbhLMJca (ORCPT ); Mon, 13 Dec 2021 04:32:30 -0500 Received: from sin.source.kernel.org ([145.40.73.55]:57518 "EHLO sin.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233779AbhLMJc3 (ORCPT ); Mon, 13 Dec 2021 04:32:29 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 37144CE0E29; Mon, 13 Dec 2021 09:32:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3FE2C341CA; Mon, 13 Dec 2021 09:32:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1639387946; bh=/yzIR4UxhfMvrtQBlgcvC6E7RIV0N4jGrlKuKpdnoPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y57FMvzbpLEFIoh65Kai9XuL1pgtsoVtVVYwFQ4rI/K8I0JhwF9NVXMnUlB/HpZAl tS51pWp5aUJnAHTsuIL+ipRdjGgAYzZ3+caLD8UWapIA8gzaGVo3mcLXeWagiyx/5I Jv+S153iGfF6P6NIDUhfsNxMmhFWDbxe8oXWC2cY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.4 14/37] ALSA: pcm: oss: Handle missing errors in snd_pcm_oss_change_params*() Date: Mon, 13 Dec 2021 10:29:52 +0100 Message-Id: <20211213092925.835955514@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211213092925.380184671@linuxfoundation.org> References: <20211213092925.380184671@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Takashi Iwai commit 6665bb30a6b1a4a853d52557c05482ee50e71391 upstream. A couple of calls in snd_pcm_oss_change_params_locked() ignore the possible errors. Catch those errors and abort the operation for avoiding further problems. Cc: Link: https://lore.kernel.org/r/20211201073606.11660-4-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/core/oss/pcm_oss.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -909,8 +909,15 @@ static int snd_pcm_oss_change_params_loc err = -EINVAL; goto failure; } - choose_rate(substream, sparams, runtime->oss.rate); - snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_CHANNELS, runtime->oss.channels, NULL); + + err = choose_rate(substream, sparams, runtime->oss.rate); + if (err < 0) + goto failure; + err = snd_pcm_hw_param_near(substream, sparams, + SNDRV_PCM_HW_PARAM_CHANNELS, + runtime->oss.channels, NULL); + if (err < 0) + goto failure; format = snd_pcm_oss_format_from(runtime->oss.format);