Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp233704ybl; Thu, 22 Aug 2019 23:31:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVC5+V0qbJSpD6bc9jBSqjDN6R2O738W6y5SataSDkq3UAxOvqO1asiEVURXsBqljKpS/+ X-Received: by 2002:a63:460d:: with SMTP id t13mr2477768pga.205.1566541907941; Thu, 22 Aug 2019 23:31:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566541907; cv=none; d=google.com; s=arc-20160816; b=XSVotEP7OgkdMwWhnkxBDfsFQ83AVcig7QQwQidys8i6ThuVYBwJFsHH8o0dvl+stW v0ngbnOeKnNgXl/4brMd3SD0feho9lUM/Kj40E/sOJWkSZfyJ4SwxJt0on9sUwInnqXG zFxe+qEYHwB4tqREKnasHqhzEBlEHy4ovG+wcmGiTXbmXxQWi74tNOWBg6UQsYNMWcWz fVmU6Stad8sNoNiLjeion9oJTxnh1pcgkBLI6tDRiP3pODwZ2KYshvwCU4Y2jHDnx+Wn N5xoH4VkEAwmDUt2GVvnD5+ehL/hizv8wJ1/lW/Z55cx3KMBgy+NvjVSyYJS57+If5Ex RSVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qU4EVFzEL7CrzMsmAyQ0+DORi7LOLUt3WjMHvVKo6Ak=; b=GZgByCmpkZovWHDoj8tbWaHtdJxuwRva8No3j1/mgv4TaTTdRl6kTpNNHCKcTsfk9+ gCtTYI2y5Ru9TE3H+323A+xCqH7K50/PYYs644I8kPtAMzBm8EGd4KmslQ3VfkrBJz9L 4FQrQrC6DbOANuB6sBuJizt2U+uYu39AuyPHJsXVLYKw9njdjJVyahINWK+ZkT20XjCW yPIjGCneLvnz/p5tHE8GAmBgTDrfj9pCP1DFSAWXoe2+c5cPdQEQNG1egDq5dowtZj4N 4P7UNvYhaQhxzYRXjWycNaw2ABtGBls3JX1pT8wBdjh2etWieFos5pUM3V5t5pBoj+dp GzWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="bz6LeGy/"; 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 c11si1685511pfd.165.2019.08.22.23.31.33; Thu, 22 Aug 2019 23:31:47 -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="bz6LeGy/"; 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 S2405125AbfHVRlP (ORCPT + 99 others); Thu, 22 Aug 2019 13:41:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:44842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391775AbfHVRX7 (ORCPT ); Thu, 22 Aug 2019 13:23:59 -0400 Received: from localhost (wsip-184-188-36-2.sd.sd.cox.net [184.188.36.2]) (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 A3BE023400; Thu, 22 Aug 2019 17:23:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566494638; bh=xOV+gfsvhKxuTMaRavsJgT56mMrub52ODkJUQy0F564=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bz6LeGy/LIi/w7Ejw+5xFIIqu7ZHuPbiJLAcm4kbJJhkYD3mxZeiqQKnnyFGHBbxA m0B6KN7TvWkr5soTUi2xJPktAnn2fk0BZMJD7uH5WUsPIbLcaCOM09S9f49VEaKpwy 2irGwtRBZtst8ruW7EF04n8AlbVnupHSkcLVR8g8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeffrin Jose T , Nick Desaulniers , Kees Cook , Jens Axboe , Sasha Levin Subject: [PATCH 4.9 072/103] libata: zpodd: Fix small read overflow in zpodd_get_mech_type() Date: Thu, 22 Aug 2019 10:19:00 -0700 Message-Id: <20190822171731.819218616@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190822171728.445189830@linuxfoundation.org> References: <20190822171728.445189830@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 71d6c505b4d9e6f76586350450e785e3d452b346 ] Jeffrin reported a KASAN issue: BUG: KASAN: global-out-of-bounds in ata_exec_internal_sg+0x50f/0xc70 Read of size 16 at addr ffffffff91f41f80 by task scsi_eh_1/149 ... The buggy address belongs to the variable: cdb.48319+0x0/0x40 Much like commit 18c9a99bce2a ("libata: zpodd: small read overflow in eject_tray()"), this fixes a cdb[] buffer length, this time in zpodd_get_mech_type(): We read from the cdb[] buffer in ata_exec_internal_sg(). It has to be ATAPI_CDB_LEN (16) bytes long, but this buffer is only 12 bytes. Reported-by: Jeffrin Jose T Fixes: afe759511808c ("libata: identify and init ZPODD devices") Link: https://lore.kernel.org/lkml/201907181423.E808958@keescook/ Tested-by: Jeffrin Jose T Reviewed-by: Nick Desaulniers Signed-off-by: Kees Cook Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/ata/libata-zpodd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/libata-zpodd.c b/drivers/ata/libata-zpodd.c index 7017a81d53cf2..083856272e92a 100644 --- a/drivers/ata/libata-zpodd.c +++ b/drivers/ata/libata-zpodd.c @@ -55,7 +55,7 @@ static enum odd_mech_type zpodd_get_mech_type(struct ata_device *dev) unsigned int ret; struct rm_feature_desc *desc; struct ata_taskfile tf; - static const char cdb[] = { GPCMD_GET_CONFIGURATION, + static const char cdb[ATAPI_CDB_LEN] = { GPCMD_GET_CONFIGURATION, 2, /* only 1 feature descriptor requested */ 0, 3, /* 3, removable medium feature */ 0, 0, 0,/* reserved */ -- 2.20.1