Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2020716imm; Thu, 24 May 2018 04:38:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrKBpU1O4SXqQLiZv88XjUKRR4lejQpm6aZB0sN0Md9e1Em6yEdGf+mN8G+swBhzydczudh X-Received: by 2002:a65:510c:: with SMTP id f12-v6mr5485192pgq.385.1527161926135; Thu, 24 May 2018 04:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527161926; cv=none; d=google.com; s=arc-20160816; b=OHH/kLRKgIq+5RUHqtn9Pbob+ArKAkhuinAgNKLKyFfIf4vmvo35+YzxA+2jVzkc3v tWpu5GzUM+2MFuEmaz7PJTsshclLjWltEUJGy805AF+laiRQ3hOVvMpjkaAB15+I0tQJ WzxZYftY4rMgpwmXTiqCPAkvohjiQSaKEGzrzQeBb8567oxssdLyJe+hlCE1Gy0XpWDy cM5wQ4M6nAQGa/6U+xb+Y8p/tVgo5RAiONFdEMDrY65DYhou4V6WCMtVj7AEtndxYUPx 9UQ9QdHkOEYJtp8UKcnK8eY2vsUQovkpX64JLqx0iwP8/HLqZKXft12q2Hzm8I495Mz2 BYyw== 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=nqfNy5VkPAB6cKv3O0BS36Hg08Lo6yCedqe94sjAn90=; b=J894V3gQYcpcLcZCOPZ2W/8SEhYhlz8op86VnAL/Jjzaw5TdOsu7HvNdwLLfoPj8Du 1E6tRrVsyc2qteUMWdxPKkfGOlc+4cKqdct4m0Hgur9axfSVrZCCc1VQwo469rzLrA/t 9W1gmoixUh4PZ7BOZBqxWDEBdJcpRKUGiF/9HnZP9s7izk85gky9mzqRx/X+QUfuv3Q3 AjvDn9PY8QGlLaCokBFKhGedeecJXUi91RDet22q/kYtaDSiYTV4njcdGDdA6hTXhZAW okKV3Q0gwWBoNyFnfOGIW166thsIklA+VR15gGimnLNUaY3ts+17QsAP2Vm0SDZTsEC3 ZySQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qoMof33e; 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 e1-v6si16702814pgr.167.2018.05.24.04.38.31; Thu, 24 May 2018 04:38:46 -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=qoMof33e; 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 S967386AbeEXJtZ (ORCPT + 99 others); Thu, 24 May 2018 05:49:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:37400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967350AbeEXJtR (ORCPT ); Thu, 24 May 2018 05:49:17 -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 E79A520870; Thu, 24 May 2018 09:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155356; bh=iY3gfqaBJrb0PtHwj3sSq3PoHAMmqfvATiOVZObN078=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qoMof33e0dtxjJn8U+aErq9nXwNBeUJB+saKJhRavMN+/f/9ie7EC7NEDvNVbs6oe gBtWolVLdpv0gC3vQyPWh5wjpcuEd5vuh6MJlE3OJvvfm2KtEPul9tRHzg8me8eqmK XaZSgenNxD4lbu1E6w6XTTkMtevnBGwbKgs6jw6o= 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.9 55/96] scsi: mptfusion: Add bounds check in mptctl_hp_targetinfo() Date: Thu, 24 May 2018 11:38:38 +0200 Message-Id: <20180524093608.662126741@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093605.602125311@linuxfoundation.org> References: <20180524093605.602125311@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.9-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));