Received: by 10.223.185.116 with SMTP id b49csp6359532wrg; Wed, 28 Feb 2018 08:08:39 -0800 (PST) X-Google-Smtp-Source: AH8x226g5fRwMHqfj9tpw/qfU5uWYVWavA4C+B5Z9OuLy/QQeywwX8CHDUh6627FX/u434UShcZo X-Received: by 2002:a17:902:b787:: with SMTP id e7-v6mr18752801pls.317.1519834118928; Wed, 28 Feb 2018 08:08:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519834118; cv=none; d=google.com; s=arc-20160816; b=wqUz+xMONy3SSZJUQXdVkUxQaSOU7UALZ46VNNCn5di2VJ6QKp9tII3uZFhDiXoQTg idxg/3XTS9twRtnaRcz0BVXpTf1lRHSGUUA9OCl54/BTVcS5WoWgGBs8dpW004iumeOl JKaZ7Iylz/OOKAuGVEGBPsHMYrAj8VH+ZTUmYFW4xfqz+uPMmYcb8WDGJhIB29rB0tE9 HxPx5iYCTKxGIYJUoa71ybfwfbDI6HZYk/w0IhXo9jlYiT957RnVT71KRqH4PV0HGnEB N72iHgCN2PRrBkbOBqiWjKsJYLfr2WwoygZMgrFlv03CjNR8fKayMKeDO8gkFvKpu+9+ 1eXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=MHTYMAWVDsOsY1G61cTo7Q0XzjsWJV1a3FqNPTlVSpI=; b=QAffDtx1ReHOokHMFdBKtC9BLjVQRkUTX2YNTmXlwnvO40ByV+dfeikoQuYq4zwTpc qD1E9tAB4vw9CAHDkf71Ewog0dwFfo////tnHyLMlMNwISY1SaFlzp3ziE3G+7AxRl8i SDGaMOFi74eWaliGpBpMjlG3Q/a5a2DwJ6Uxol56+sRoEOmdfmqQIrmeqmiM2GQ8ppW8 VUjlZFzUgUP9nytTLJlXJfT6FlTH0CQZoltwNo3qgUpw5Wr7fXzIJ2y3Fs9lzGssxvef bDG5Hhg3frWVUmLLOM+T+Ip7P5kfnD+qk9GKOl8v7WeoyBxssNmcdMZavqLTebnof9Hm n03g== ARC-Authentication-Results: i=1; mx.google.com; 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 y86si1395454pfi.19.2018.02.28.08.08.23; Wed, 28 Feb 2018 08:08:38 -0800 (PST) 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; 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 S934407AbeB1QHI (ORCPT + 99 others); Wed, 28 Feb 2018 11:07:08 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34884 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932383AbeB1QFY (ORCPT ); Wed, 28 Feb 2018 11:05:24 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yr-0006Xc-Bq; Wed, 28 Feb 2018 15:22:29 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yi-0000BQ-Cf; Wed, 28 Feb 2018 15:22:20 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Takashi Iwai" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 163/254] ALSA: pcm: Add missing error checks in OSS emulation plugin builder In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Takashi Iwai commit 6708913750344a900f2e73bfe4a4d6dbbce4fe8d upstream. In the OSS emulation plugin builder where the frame size is parsed in the plugin chain, some places miss the possible errors returned from the plugin src_ or dst_frames callback. This patch papers over such places. Signed-off-by: Takashi Iwai Signed-off-by: Ben Hutchings --- sound/core/oss/pcm_plugin.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/sound/core/oss/pcm_plugin.c +++ b/sound/core/oss/pcm_plugin.c @@ -591,18 +591,26 @@ snd_pcm_sframes_t snd_pcm_plug_write_tra snd_pcm_sframes_t frames = size; plugin = snd_pcm_plug_first(plug); - while (plugin && frames > 0) { + while (plugin) { + if (frames <= 0) + return frames; if ((next = plugin->next) != NULL) { snd_pcm_sframes_t frames1 = frames; - if (plugin->dst_frames) + if (plugin->dst_frames) { frames1 = plugin->dst_frames(plugin, frames); + if (frames1 <= 0) + return frames1; + } if ((err = next->client_channels(next, frames1, &dst_channels)) < 0) { return err; } if (err != frames1) { frames = err; - if (plugin->src_frames) + if (plugin->src_frames) { frames = plugin->src_frames(plugin, frames1); + if (frames <= 0) + return frames; + } } } else dst_channels = NULL;