From: Takashi Iwai Subject: Re: [PATCH] ALSA: pcm: Check for integer overflow during multiplication Date: Tue, 28 May 2019 07:47:35 +0200 Message-ID: References: <1559021223-28674-1-git-send-email-bgoswami@codeaurora.org> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id EDD23F808F6 for ; Tue, 28 May 2019 07:47:37 +0200 (CEST) In-Reply-To: <1559021223-28674-1-git-send-email-bgoswami@codeaurora.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" To: bgoswami@codeaurora.org Cc: alsa-devel@alsa-project.org, plai@codeaurora.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, Phani Kumar Uppalapati List-Id: alsa-devel@alsa-project.org On Tue, 28 May 2019 07:27:03 +0200, wrote: > > From: Phani Kumar Uppalapati > > Channel info data structure is parsed from userspace and if > the number of channels is not set correctly, it could lead > to integer overflow when the number of channels is multiplied > with pcm bit width. Add a condition to check for integer > overflow during the multiplication operationi, and return error > if overflow detected. > > Signed-off-by: Phani Kumar Uppalapati > Signed-off-by: Banajit Goswami Did you really hit this? The info->channel value is already checked in snd_pcm_channel_info() before calling the ioctl ops, to the upper bound runtime->channels. So it shouldn't overflow at the point you suggested. thanks, Takashi