Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3755214pxk; Tue, 29 Sep 2020 05:35:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaz3RUCtKmSeb317USXgrgkcc9BYyDnFCIjcNpXvqVDUskLZbcJLyPkT9LqMhvC8fRmD6Y X-Received: by 2002:a17:906:c007:: with SMTP id e7mr939494ejz.55.1601382956918; Tue, 29 Sep 2020 05:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601382956; cv=none; d=google.com; s=arc-20160816; b=nyGiqBykd6F7kOpGRioD6CUPS2QU4vV5pAzzJwL2OaxwuNJ1qwCrL5cqdbQloLSPQf wl8uGFdxcPNBcef8EQOXCP+Xg2Ibc8OtOY06B3PEGzrTnA77r5j06nWotYKdMh1lumlk FNqt0zFtj9bxj2r9I4mTVa8/qrWeQkpXssXqoiRysmWok7WJ+NjKyoz8/I4OTmL/LaGU Qx+GXWJt8FIoj77WIj0o7E6A4uEp1F7e8HW6PUn40Q5Pt0c8Hu8HoKmAHijo6wfZdbMt tu2wIP9SOAe++KQ2YddNIwnmwIB5T0vaTKAV/xoJpNK6pJ5Bk1Y+dhB6NctNbUpZ2hLT XVxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r8FixQzkg/XhMbVmUp1JMZI7HWbBA5CIdjUIbdaipQU=; b=EwCAvGiYlxMiVRLM+180VfTuLU0bsrPxIx+gDAvhAaNCYrwszBWVzfbVPfRu4uKSyD VeEz8eoGUae3xHkpeeY36FNTWnaSZoceEEmeQCOWxvd230Z2QyqBFZcWhL5IOoh0ssP5 5qWhe9n2G6rapKlZfmS6FaMyJEVZKz5xjc6mtBgQWJ8TMiKzD4uZzbTIuVPtdZM4hoL9 FhaKWeHQFas9FFK2N4BGJYmFOShewPo+tbHNFaplTweJd+BATCLZLgMHgXLmLXIPhopL LIhRxXWSmEuuzzFU1oolW2GVtpmjRG7hhznVbf3C0t7GhyZrEPIUd3aRJHJHqbCMLQs2 qJkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MxWruyjH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h21si2533764edq.257.2020.09.29.05.35.33; Tue, 29 Sep 2020 05:35:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MxWruyjH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732902AbgI2Mcf (ORCPT + 99 others); Tue, 29 Sep 2020 08:32:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:39500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729090AbgI2LW6 (ORCPT ); Tue, 29 Sep 2020 07:22:58 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 4097421D7F; Tue, 29 Sep 2020 11:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378440; bh=R0cYLuCf/RXxmg0SWDR4nzFewjhj6tgTJf0VaNdYvKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MxWruyjHFfqCMu529eCZ0NRV2mtqLZjKN25LjwFC21buUASgtMe6iumLDO72hKIOn ZN7ukhT8lLhq3a+EJZkyyewrdXX93OVYsD7giKkJV+hYXyQwlyZ3lC2REe+MJBNfjh OPWpPUFOop92XRiM5OnIDr25EeTaH2OoTorO5hTU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Balsundar P , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 007/245] scsi: aacraid: fix illegal IO beyond last LBA Date: Tue, 29 Sep 2020 12:57:38 +0200 Message-Id: <20200929105947.344854342@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105946.978650816@linuxfoundation.org> References: <20200929105946.978650816@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Balsundar P [ Upstream commit c86fbe484c10b2cd1e770770db2d6b2c88801c1d ] The driver fails to handle data when read or written beyond device reported LBA, which triggers kernel panic Link: https://lore.kernel.org/r/1571120524-6037-2-git-send-email-balsundar.p@microsemi.com Signed-off-by: Balsundar P Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/aacraid/aachba.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 6e356325d8d98..54717fb84a54c 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -2481,13 +2481,13 @@ static int aac_read(struct scsi_cmnd * scsicmd) scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; set_sense(&dev->fsa_dev[cid].sense_data, - HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE, + ILLEGAL_REQUEST, SENCODE_LBA_OUT_OF_RANGE, ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0); memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data), SCSI_SENSE_BUFFERSIZE)); scsicmd->scsi_done(scsicmd); - return 1; + return 0; } dprintk((KERN_DEBUG "aac_read[cpu %d]: lba = %llu, t = %ld.\n", @@ -2573,13 +2573,13 @@ static int aac_write(struct scsi_cmnd * scsicmd) scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; set_sense(&dev->fsa_dev[cid].sense_data, - HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE, + ILLEGAL_REQUEST, SENCODE_LBA_OUT_OF_RANGE, ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0); memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data), SCSI_SENSE_BUFFERSIZE)); scsicmd->scsi_done(scsicmd); - return 1; + return 0; } dprintk((KERN_DEBUG "aac_write[cpu %d]: lba = %llu, t = %ld.\n", -- 2.25.1