Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2525059imm; Mon, 28 May 2018 09:44:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrH9wIjNJPlDV/rKdvH6vN9mUOMdwTvL1WRqdJUg+AK2Jp8KeE/WCgUd2bjeU+6zpndRv8K X-Received: by 2002:a62:e04c:: with SMTP id f73-v6mr14239348pfh.88.1527525862447; Mon, 28 May 2018 09:44:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527525862; cv=none; d=google.com; s=arc-20160816; b=wJY9UxLEmusadgIVR+K7jWdlE+vuwks5fWl0u32SEdThtrSNM+zrI2e5SYrI+6acH5 xoiuLzzgvvk4lWkCyJh1JDA1WvEbGbe/6RIbnJEl5aIn4i4B8cIZ0VNEMDUTvDgyrWw/ LsKUhbXshC2jwYEKdHaoM57uvJ9BJrPQIlQ3dGCMyShV37swgztwZ2a3YCqC+5EmGUR0 0HgRmZ2fI5pGM85ZdTiM1nh7LrwrhWW6Wz5mkcl+LSh1lElCq9t+zQz6OI0toItkK8/I VcaFmfHYQ0GkHkWhYE2RRKZWc3ju1g/GIyc0y4sXHecszSUaD9dgN4kB4KR3Soo8oc8l eCwQ== 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=RJyevXcessWb6oJJu5nef2BzzPPY26YuUBW9/8D1UKo=; b=ratfFsMZwpp88XlWLuSLF4ajTYLRWWvzBwpQ0zcUTtTrNlcSuZ4x6LWkOh3C0BdHGO hTWYJgZQruPV9fET9D9ZzXuAeOTxzH16VFRi04ZLEY23BHQC+WFT4XV13A84yXhTQsUB 24Z+z6QovLsC929+0BYr7eqmhbgMn3yBZ2FIHlpR4nA0eeebu/CALfDFwotk5GPA1Vfn hj6kIp4K/V2/2YVoxrdrYEhZp+0n+FUtjbS0EM8pqNU07BSZLnUbIfDfvuBj8VGey1a9 odxYPOYXeNnaVymeciZZCyv359YIb2J3iduDIHUMxkQu+rawJNvzrR56siND0gAC37DL 9a0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lfkz39pq; 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 x133-v6si30796373pfd.124.2018.05.28.09.44.07; Mon, 28 May 2018 09:44:22 -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=lfkz39pq; 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 S940432AbeE1Qmw (ORCPT + 99 others); Mon, 28 May 2018 12:42:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:55784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933542AbeE1KHp (ORCPT ); Mon, 28 May 2018 06:07:45 -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 7500420876; Mon, 28 May 2018 10:07:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502065; bh=RxuQ7JoAyJeimWWId9BQoe2KM18iI1z55ceqiOdQ9xQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lfkz39pq5NlJIf/fNLbnfW+X8mvtL4x/2wzf8F6tLX22ACiMXLVbU4ZDRi7zyjKR+ rskIL5qoLfDEkz/iAi67HsvJOq5qimQwZRA8AYstYudD+sBK+4LYZGgzXPGRUHDeU5 dKD52cau6Ws4caw4VpLtneecUrd8yY+PJQ+Iric0= 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 3.18 049/185] scsi: mptfusion: Add bounds check in mptctl_hp_targetinfo() Date: Mon, 28 May 2018 12:01:30 +0200 Message-Id: <20180528100055.087697854@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100050.700971285@linuxfoundation.org> References: <20180528100050.700971285@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 3.18-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 @@ -2694,6 +2694,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));