Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1977624pxb; Fri, 5 Mar 2021 04:37:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJyN/v2bny6H3Wpn/Gi6IQl44AuzXpdWSF2dF5t2UwktBJh284VxAlmHKg22PVFZzR2uHakP X-Received: by 2002:aa7:cc03:: with SMTP id q3mr8969736edt.366.1614947823154; Fri, 05 Mar 2021 04:37:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614947823; cv=none; d=google.com; s=arc-20160816; b=e9ZJPbMRX0tf80U+5MA7UHGACyftpOr0Ue7E5RgX+ev8WtZmvPCfN7L0RcgOGO/7k2 MsW6Xzs9/aq6ISw9AxIDETUxZHcUmV2D+/Vb8ypomIZsBlGY0F5sXEOkSW3A1SPSVGeT nMQ1gJXjV2L2erLsleNo9FZsjClz+m9rYbPgBBmBt9waHjXdWZoviofg3Ut7gk0yfM7Q XB7nmuSUlryivla3VNffT0sn6iXxclzwkou5jlMoyvqyhS8pHfy0jWdQ5TAXBvb6zu2V vCBEtggWu6N9DRBfsj0gJlj84QxGLSIJ092JKKrw3gTdsWzoZ/uEm5yCzh8ErEz4fC3b sg4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5dE035eoz1cWeR4mefX4kW1oItwRTJ/4Wo1k6UvLFNI=; b=Df5/5Rff1ecVe22B8K5ebEvEtbAL1KHvaRHooudWN6QWEzSWETwEMlX2fImCUm5oXQ mNDWOzf4ntIIyDeMBKOv3SFgcXT6e91s1quVAWGBEeJQh2WNgkJuDYQX2q6uqcBKxMbw FDKeERc4riENLI1dLObHSE961tz/dtnWWNrBfz/FwOQzB77oyp++KQZSPm5Etvu4RreU UISl3kuwjB7IibCQxNfP6QURCfLMN9mKL/jkua1/cQXvFitvmlZksjzfpOMKMcnnsWMY M+OmMNyAONpWjdUWW/ZjWe1C3XwEE/C5T4dRw3K36QFurP1jV49NnQOjm1hw9r7T8+/4 +Qpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JsGipbIr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si1474664edp.277.2021.03.05.04.36.40; Fri, 05 Mar 2021 04:37:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JsGipbIr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232239AbhCEMeo (ORCPT + 99 others); Fri, 5 Mar 2021 07:34:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:45004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232553AbhCEMdy (ORCPT ); Fri, 5 Mar 2021 07:33:54 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id ABFD164F23; Fri, 5 Mar 2021 12:33:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947634; bh=vYgvXoN3wwVVvtoQQCIDTzL+fYUc0nyf9MK/GhmMJdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JsGipbIrMjRNu67nINbW2jw/30ZQ66Ah+YtRGFzeVbEUWabinppVQM4E/8+tlQxR5 ToEbCn1GVNKIwblFwKYet/2VhhBSHXsPfcvSqtl5bnHLLCcPXwaLzaHisSrEqlsCUr 43v4QbMy/RudMgXkIoNM2rFnY0xHx9+Zn5S6wG54= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+6d31bf169a8265204b8d@syzkaller.appspotmail.com, Sean Young , Mauro Carvalho Chehab Subject: [PATCH 5.4 09/72] media: mceusb: sanity check for prescaler value Date: Fri, 5 Mar 2021 13:21:11 +0100 Message-Id: <20210305120857.804316145@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120857.341630346@linuxfoundation.org> References: <20210305120857.341630346@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Young commit 9dec0f48a75e0dadca498002d25ef4e143e60194 upstream. prescaler larger than 8 would mean the carrier is at most 152Hz, which does not make sense for IR carriers. Reported-by: syzbot+6d31bf169a8265204b8d@syzkaller.appspotmail.com Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/rc/mceusb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -701,11 +701,18 @@ static void mceusb_dev_printdata(struct data[0], data[1]); break; case MCE_RSP_EQIRCFS: + if (!data[0] && !data[1]) { + dev_dbg(dev, "%s: no carrier", inout); + break; + } + // prescaler should make sense + if (data[0] > 8) + break; period = DIV_ROUND_CLOSEST((1U << data[0] * 2) * (data[1] + 1), 10); if (!period) break; - carrier = (1000 * 1000) / period; + carrier = USEC_PER_SEC / period; dev_dbg(dev, "%s carrier of %u Hz (period %uus)", inout, carrier, period); break;