Received: by 10.223.185.116 with SMTP id b49csp822786wrg; Sat, 10 Feb 2018 21:13:03 -0800 (PST) X-Google-Smtp-Source: AH8x226q1EQnjdoAEtUNa9Gj8jhSbZUOPTOHPiVWto0RIwe9yYlCZlOGNmvfqrVWVb1pqlqHGHre X-Received: by 10.101.74.4 with SMTP id s4mr6661188pgq.105.1518325982978; Sat, 10 Feb 2018 21:13:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518325982; cv=none; d=google.com; s=arc-20160816; b=GTWzoLCSk8b7esBOrMI9IW2m8WBNRh2eloQF3Ez294DC1orNhMsScuG/zqxQVQ7Mum Ul05kUdCgBzcS6rdUlueWS7V3kQngbhP+SMKcy6a8eH6sdYtGfkPW8x+03Svy6OdtsXb qQUlQqmSte5Gq3kb06kLurb8lnAkoQ5T5v/rSwh9IxqVSdbdqn04WXHP6e40qETewEm6 YBsajLd6o5aUIhjo6yX3+l0kBuYyJzrXmQIObsFIDVDlTBiWcTkGEVHZzpEuXILxgQY4 Uc/MhX2T6Yuz3cW6gsEn0xdpgcNEzgqd24WsVZ6TZDCiZR8wUssoaBmAikTSIHf2enPD QS2w== 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=23IuacyE36IKhSjZ6blbAIF4COFxBgZLsP4HVh3rmrI=; b=xllJM/tmg2tICdQGVO4gl4RTF/lHHq0PqI5C2jsmmMywovJko3/Ytk3RKKHxLrNP0O 4bBvyMpaagPNNIr0BUjhFFiAMD1n44E+AQpgCOAzo802V3vU/3g4hqF6RaV/DJlf144G bmLxPIBV3a9GiXuujqWr/OFhwVhawfZ+0gsGdXPVS9rY/6Xl2krfZP5JRRe9xZlh6QQo 6eLDQsDm9RqhfoxjiIWOCnN2EkpRtFQPw2VTrQKVXpGCudVxda0O5hlnGn7CeMcGnQSY 0uclMDsAsyiHKLI1qhFRUNY0jeWf/0b3MRzB1TyuYVBaBVNNVMHu7bAzdiLkreoo5wOk 4AWA== 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 23si4332348pfs.322.2018.02.10.21.12.49; Sat, 10 Feb 2018 21:13:02 -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 S1752702AbeBKEdm (ORCPT + 99 others); Sat, 10 Feb 2018 23:33:42 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41322 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752436AbeBKEdk (ORCPT ); Sat, 10 Feb 2018 23:33:40 -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 1ekjKc-0002hH-AE; Sun, 11 Feb 2018 04:33:38 +0000 Received: from ben by deadeye with local (Exim 4.90) (envelope-from ) id 1ekjKX-0004Rz-4L; Sun, 11 Feb 2018 04:33:33 +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, "Sean Young" , "Mauro Carvalho Chehab" Date: Sun, 11 Feb 2018 04:20:06 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 07/79] media: rc: check for integer overflow 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.2.99-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Sean Young commit 3e45067f94bbd61dec0619b1c32744eb0de480c8 upstream. The ioctl LIRC_SET_REC_TIMEOUT would set a timeout of 704ns if called with a timeout of 4294968us. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab [bwh: Backported to 3.2: open-code U32_MAX] Signed-off-by: Ben Hutchings --- drivers/media/rc/ir-lirc-codec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c @@ -255,11 +255,14 @@ static long ir_lirc_ioctl(struct file *f if (!dev->max_timeout) return -ENOSYS; + /* Check for multiply overflow */ + if (val > (u32)(-1) / 1000) + return -EINVAL; + tmp = val * 1000; - if (tmp < dev->min_timeout || - tmp > dev->max_timeout) - return -EINVAL; + if (tmp < dev->min_timeout || tmp > dev->max_timeout) + return -EINVAL; dev->timeout = tmp; break;