Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp456603yba; Wed, 15 May 2019 04:26:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxoVbFS98WE83MAUYaV7dHfxf903ZK8hgTNne96nmlNJOpv1zP6+o3Unk7ZbvTCfpeaXepY X-Received: by 2002:a62:30c2:: with SMTP id w185mr46783577pfw.175.1557919562475; Wed, 15 May 2019 04:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557919562; cv=none; d=google.com; s=arc-20160816; b=L5x7RCek640icldRkf6C2AMBr+s9bINsd5Ib7TnKDy3sKPG15BHpbgJdqK+C3+g2OZ Pwnaic05cSiohKUQtm2R88PKAMhIEFK1jIc4n3WPfVToeVL55d1kSVpA1ArgsHPbZCP6 UhvmHafUhRG+/IgD3LQI9FeiyK0zSeiv9NfbpULnQlUzHW3xR6POBuUYsI827w4s35kb ZvObdPeqB5rOloGvpHpqzfK2Rx0T38a3v0RMsk4Q8jw96RWQujrkaiYKjmbp/EblCzIN HLd9cEfVLzut4CvGzm4lSxRTRQbPA3HrPj6M2PC5QeYZrV6V4wpeyTC4+ivQ0oBm9EY/ U+fw== 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=qay1dIkoDzBeWHH6cFrmdl5gZg8G5NdMGjBo/VG+bwM=; b=uY+FKowKNf0eGROW/VlMeVQZTjygnIj5keLaxt/rP72qrzvZXZpFGBg2PYzq0fVzMA FW5K2BxS9FLmrzx8OeESyQOCmflLhBHsHsMt4Eh8eSFutsdVHHFpq228Q4rjI37mNKGK W8mYXcCwJr2wZ/g39kVG0xsV/QS1xejgJk7kawYS21Vmu734y0TjAWRCmMPS8DTCsa2I 1is+qQ/GYceGlPciiyHs7CY2ANWwS0340jC3pnyGldBJrvGVWv0O/CVthVzIqmo5ZXC/ 5I5ogxKfj88CCvxfvI6Z2Gh9tBPzOXLatIFEXuhCFpwfVoQZQFLItWszMOIleBwAClLy is4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KLX96Xkn; 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 l190si1658947pga.255.2019.05.15.04.25.47; Wed, 15 May 2019 04:26:02 -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=KLX96Xkn; 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 S1731800AbfEOLYY (ORCPT + 99 others); Wed, 15 May 2019 07:24:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:34862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731783AbfEOLYR (ORCPT ); Wed, 15 May 2019 07:24:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 4F589217D8; Wed, 15 May 2019 11:24:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557919456; bh=7V09QRjt60ZoGduRDcBVlYnjKvUofVsyA/iKeUO4JdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KLX96XknAXzCKbJ2achNFKEjTafwNRVI9sQGXWYNL/BcG9/DV58gWagttUAOlmSu8 aaNnHnPopsQtrQQK6XIVZRq8NTV9+s7h/aPT5qw2EFmR2IJQ0lBgBCQOTLRR0xx6f/ gewJxhxSqjJXUSXQu7XST3e68fQfkgJmowxTB0/s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 080/113] nfc: nci: Potential off by one in ->pipes[] array Date: Wed, 15 May 2019 12:56:11 +0200 Message-Id: <20190515090659.690377978@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090652.640988966@linuxfoundation.org> References: <20190515090652.640988966@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 6491d698396fd5da4941980a35ca7c162a672016 ] This is similar to commit e285d5bfb7e9 ("NFC: Fix the number of pipes") where we changed NFC_HCI_MAX_PIPES from 127 to 128. As the comment next to the define explains, the pipe identifier is 7 bits long. The highest possible pipe is 127, but the number of possible pipes is 128. As the code is now, then there is potential for an out of bounds array access: net/nfc/nci/hci.c:297 nci_hci_cmd_received() warn: array off by one? 'ndev->hci_dev->pipes[pipe]' '0-127 == 127' Fixes: 11f54f228643 ("NFC: nci: Add HCI over NCI protocol support") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/net/nfc/nci_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h index 87499b6b35d6d..df5c69db68afc 100644 --- a/include/net/nfc/nci_core.h +++ b/include/net/nfc/nci_core.h @@ -166,7 +166,7 @@ struct nci_conn_info { * According to specification 102 622 chapter 4.4 Pipes, * the pipe identifier is 7 bits long. */ -#define NCI_HCI_MAX_PIPES 127 +#define NCI_HCI_MAX_PIPES 128 struct nci_hci_gate { u8 gate; -- 2.20.1