Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3743993pxk; Tue, 29 Sep 2020 05:19:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgBFY5SYtETl44EcH9mxIL0e8b/iVblJvxAsPPhq9aj9zNlTC9RGQmbx3bku6tGoFH4Jx+ X-Received: by 2002:a17:907:72c2:: with SMTP id du2mr3715456ejc.512.1601381972174; Tue, 29 Sep 2020 05:19:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601381972; cv=none; d=google.com; s=arc-20160816; b=Xpl4SRlik3mGkmFGwUDGuzO7CtHJ7SZzFkp8DlwkSTDcL9oVeMFheU5UMMmK66sUqt Gi2UGw5gxFEpi0r6sG4Y2IM34O3eRhDGVN8iru/JfYYE86ac+hn5jrHiNrGpxyEUjo8s F8rAbQgmu6+V7pm4k4+Fdz37eWIC/Ic+9lXQhjWso4AbAefLeNjuhh4tF115K5NzquAF Jxj8RjBWe5g3oNUJW8XxadP9hCxlk592PvSxlFtu8gQHYLvEXCvyyvI30Cs7HPc6VTJB aRe7BxLK4OUsh3CsIK4T/e+CgDKEKnB0n86LNXzXvspoEF79xM+PdQI7DIRZunIarn8G YKVQ== 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=pQO4NZ951Akz7MrA/qz4w95YWM0Aj5jPgujxrL2pDX0=; b=o03PhIJgtuxLHrC0+5hYE8pC3aTSQzlDdPsg9zWt9mFhMZRrVyz1aTsRgbm6Q1HJTk TtdtZuBcHHpR3o3xtXeh1U/4rbriv8o7oDSC6KTzTNMjSZA6EeZz1UA3hWV3AO8cvhrc FhF7JMeNXA/qqanufM9vARgrYvZBUngj5IA1CtsViGfOPqLAPxthQF7kdhQaCraiUwk/ OVzrj8/IQC9hyehakfYramJApREtAit6cvc0b/gbIfNMrVZG9ZcgrMvCAqVwAg/hVgbe KslDe5yC189WXIzuFU9GGssZfGh+pLxpx1dLi6TVQjAwnU4MXb0E/g90d42FO4YIag91 EeaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wwtQHEAX; 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 o18si2776298edr.51.2020.09.29.05.19.08; Tue, 29 Sep 2020 05:19:32 -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=wwtQHEAX; 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 S1732211AbgI2MSM (ORCPT + 99 others); Tue, 29 Sep 2020 08:18:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:49162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729977AbgI2LgW (ORCPT ); Tue, 29 Sep 2020 07:36:22 -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 355C223A6A; Tue, 29 Sep 2020 11:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379099; bh=nkzm/jJZVRuK3E2FPK9wmfAxR5FlQ2fiP4Og6qKQ/AA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wwtQHEAXXCPFLZiS+m0hgt15QGvjHTFcUDusxQvm1dmx61nXUR7BIrQxv9OCJiGyJ 8Eu2pJ4XLrJxF+wSkzjCQsDkYtJG+KpGWka4R2K5Ox/WaarLN6kPS9svvEC8RnxaZe sO0XcGFsHW7PIqF3C9zPbJk9EW3bHmXe7wdrIAl0= 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 5.4 014/388] scsi: aacraid: fix illegal IO beyond last LBA Date: Tue, 29 Sep 2020 12:55:45 +0200 Message-Id: <20200929110011.171601284@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929110010.467764689@linuxfoundation.org> References: <20200929110010.467764689@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 0ed3f806ace54..2388143d59f5d 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -2467,13 +2467,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", @@ -2559,13 +2559,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