Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933421AbdIXUyG (ORCPT ); Sun, 24 Sep 2017 16:54:06 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60780 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933283AbdIXUmb (ORCPT ); Sun, 24 Sep 2017 16:42:31 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kashyap Desai , Shivasharan S , Hannes Reinecke , Tomas Henzl , "Martin K. Petersen" Subject: [PATCH 4.13 062/109] scsi: megaraid_sas: Check valid aen class range to avoid kernel panic Date: Sun, 24 Sep 2017 22:33:23 +0200 Message-Id: <20170924203355.582228224@linuxfoundation.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170924203353.104695385@linuxfoundation.org> References: <20170924203353.104695385@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1308 Lines: 37 4.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shivasharan S commit 91b3d9f0069c8307d0b3a4c6843b65a439183318 upstream. Signed-off-by: Kashyap Desai Signed-off-by: Shivasharan S Reviewed-by: Hannes Reinecke Reviewed-by: Tomas Henzl Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/megaraid/megaraid_sas_base.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5650,6 +5650,14 @@ megasas_register_aen(struct megasas_inst prev_aen.word = le32_to_cpu(instance->aen_cmd->frame->dcmd.mbox.w[1]); + if ((curr_aen.members.class < MFI_EVT_CLASS_DEBUG) || + (curr_aen.members.class > MFI_EVT_CLASS_DEAD)) { + dev_info(&instance->pdev->dev, + "%s %d out of range class %d send by application\n", + __func__, __LINE__, curr_aen.members.class); + return 0; + } + /* * A class whose enum value is smaller is inclusive of all * higher values. If a PROGRESS (= -1) was previously