Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1979966imm; Thu, 24 May 2018 03:59:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpRJi1HxyemVL+pUZt21OYXtF6efK8C3OuB/fZ9UckftiDgUQuxEzQ4Usi9lzxx5OokWoFz X-Received: by 2002:a17:902:a5c7:: with SMTP id t7-v6mr6930947plq.360.1527159549529; Thu, 24 May 2018 03:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527159549; cv=none; d=google.com; s=arc-20160816; b=FE40EJ8A4q+tkkWEC3DaRX1Pa1SCAIzv2epvlFI7mnfqns143T/iQf/typE6LGAUzZ tBzv1DMOe0IKjjczKozLZg9YiV5PqW6uZH6h3IH5UILuxlrckle85mb/UhxMkDZHRenV FJBLlpp1Omc47ZYL/9rPshBkmrp5xMujdkM9Z8Z7e5AhfUY3lFUiaOj++7/B4dnEtVr8 zSsOyEyrpPeDKLbVRj9lHd3uhlxj92EuFqwkYVXXycy1nJtAGQ2PUochV3bWibRiSEjv Ud6sDJboMI+nsyrUpyHLgTAd7gjz/anlmehBYXyTwq9rK/KSyBco+XIutG+F3i6Sj8rz JnyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=bOWxQkWRi2jM4zY5ebfVfGZRVq0Y2j/ITmoslkGvVpA=; b=06EYhABcR37Lw0b9RpDUviUtR1Sk172zpM+hZQVb8VH8VJ0LvSYOce4zK3haCsUQBZ wniHHf4Li/lspVxtUa1uu3yweP+Q9Q24nw7qb+0WVIakIag5VMPj5EwwZi+UEM/acM+n yIlCuDKlvuOTU/yVMY3xynjOm3It1XrHM6zsugULgNofu2LgjSDchGsFPWxdj5yis1eb ezXQv0pWtVuUQzPPB6dBuZ743qj6zXkZ6+r37bgKBtVNh0NNYY2ue/kOiYKIqBw3whOf FHGTjBXw0bgnooeI4SMh5UEaXfIlQfHAkQfUO2iupV2yEO5IoIrFz+Z+RvWxqw3mJXep wpQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VJx6D7o9; 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 x61-v6si20483151plb.560.2018.05.24.03.58.54; Thu, 24 May 2018 03:59:09 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=VJx6D7o9; 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 S1030230AbeEXJ4A (ORCPT + 99 others); Thu, 24 May 2018 05:56:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:35924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030210AbeEXJzy (ORCPT ); Thu, 24 May 2018 05:55:54 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 141AC208A0; Thu, 24 May 2018 09:55:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155753; bh=C5R6Iqo5BBxrmSrNzT0eh9N6h8iMxvH1GPn5LA9GUpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VJx6D7o9m5ZNQWpqzmPti6Ipu3ZxNgJT7s1E5PaQAgOvmGvJtvMjkjSPHv20EjE+D jTC0+3NTrJXZId4kyRU1lLHE9hokP/8GBGJnv3bfQdOmNQSlwCcTEJ6L5YgfClJv4A fcbezHVtAkEtvAvIFkocOidhBJDtkTh2wASP2ls4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Johannes Thumshirn , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 104/165] scsi: mptfusion: Add bounds check in mptctl_hp_targetinfo() Date: Thu, 24 May 2018 11:38:30 +0200 Message-Id: <20180524093626.225525353@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit a7043e9529f3c367cc4d82997e00be034cbe57ca ] My static checker complains about an out of bounds read: drivers/message/fusion/mptctl.c:2786 mptctl_hp_targetinfo() error: buffer overflow 'hd->sel_timeout' 255 <= u32max. It's true that we probably should have a bounds check here. Signed-off-by: Dan Carpenter Reviewed-by: Johannes Thumshirn Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/message/fusion/mptctl.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -2698,6 +2698,8 @@ mptctl_hp_targetinfo(unsigned long arg) __FILE__, __LINE__, iocnum); return -ENODEV; } + if (karg.hdr.id >= MPT_MAX_FC_DEVICES) + return -EINVAL; dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n", ioc->name));