Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp883396pxk; Thu, 17 Sep 2020 20:16:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqRa1Vc+XjJPx41djOl4VKvrabh63xMc5WyadaEDZb4Xl1D1fwJI32qa98ZFiBHfw4HJwJ X-Received: by 2002:a17:906:390d:: with SMTP id f13mr33347607eje.86.1600398990391; Thu, 17 Sep 2020 20:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398990; cv=none; d=google.com; s=arc-20160816; b=lIrqkU9WFeWsa7+ZgFp4rc+kUnG4z0mKmOpDf50ucxZRIXJssIIsA28mCCWxLdkBBQ EW0IhGflwVqk6slUTM35RYxFHi56CUtTdrvjvPi35d9eTsTeh4N1bUEaWBnMaH3REcJZ vYceH6fZWURAn8wwtH3bN0fwncFpYBycXcqqC2bBkY4j2zpWzoNGjvlDUrIkcJxrY3F7 N0+BnsDaBPoFy4PWrIAxsse6q0DAn2dSnDfsTF17LgBbfPeTeSGdTWhbHGby5bU2INgL b9j6Pdcz1k2Arnxfwz3HWe50YD4r6r9ebeGL1K+IwL2KyLx1hRbqexgfCRq3zvjE6PlG 7+0Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pQO4NZ951Akz7MrA/qz4w95YWM0Aj5jPgujxrL2pDX0=; b=HGnrDGNOabvDrHHVdGr3jYWMOV0PLNJCZz1CtkwpY9Rl6gpfKqRtqJojemeM5xH0bf kE/6iYuyZDQTb9+3sMEc67n1PRN62gnLDD4g2SIun4gdegrk3xmY4Ew2g4WheJG2Kadc QIxxcDR/f49scAoTTo98DpyAcwGYifUtFTvYNeScp84LYWbLu/6sxlBtKOFslmQ2BWqA UP/nfZwOVfsqZp9A3k6pnY+m0lEwCk0Dqu1NS0xsoxXYI1tUN20uxa0XvK7oPXtm8Km4 fOaQ4oQdO+gQWMC6AMoBLXEAbfeVRIuja9krTaAmrnbbw1aUVNSObgo2+yNsG3D4ZbmJ HPXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TCPjbUtG; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v9si1214058eds.46.2020.09.17.20.16.07; Thu, 17 Sep 2020 20:16:30 -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=TCPjbUtG; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730557AbgIRDPO (ORCPT + 99 others); Thu, 17 Sep 2020 23:15:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:45856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726380AbgIRCBa (ORCPT ); Thu, 17 Sep 2020 22:01:30 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1E32C21707; Fri, 18 Sep 2020 02:01:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394489; bh=nkzm/jJZVRuK3E2FPK9wmfAxR5FlQ2fiP4Og6qKQ/AA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TCPjbUtGP1zqLA8lH4UP5kkJLZ7bkaq6p4rq01w8kuOhp2KPRhoZr2FBo7+YkqJBN RpYUlzGLngjpgF4IUHZKuuG6IlcyTiWCT4rql+pxJYVXUl55MQjN3GS2sCs7nZwmXJ m19dF5sRDrtX1+tAlmMT6f//4B5/XWqK9kKdfu8U= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Balsundar P , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 015/330] scsi: aacraid: fix illegal IO beyond last LBA Date: Thu, 17 Sep 2020 21:55:55 -0400 Message-Id: <20200918020110.2063155-15-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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