From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D89FC4360F for ; Wed, 3 Apr 2019 14:06:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D9EB2084C for ; Wed, 3 Apr 2019 14:06:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="fI9dv0ZQ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="bticyajC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726790AbfDCOG5 (ORCPT ); Wed, 3 Apr 2019 10:06:57 -0400 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:41561 "EHLO wout1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726168AbfDCOG5 (ORCPT ); Wed, 3 Apr 2019 10:06:57 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 562A162EC; Wed, 3 Apr 2019 10:06:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 03 Apr 2019 10:06:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=FDbZvvy3ULwwG/IvyLkmeS6n+3I msT57kf0dzH4LVmQ=; b=fI9dv0ZQ/GRBhMvySfnHcnDVdJo1DFbJpPNX7dJ80hq /4/Rx4Wr8t4TuOoKVZ5ca1+ruqKJ0V1yE9K/zGDsls00TW2JzYO+yRnE0i6PyMQi PYdG6ZRpyRCjY1LoZbBQNIZjo5KxDzdh6NMEBdUs3XGUioYSyt32C8rX3ob97NIB 0No1XYE70+6VYD7Kxjuqjm0vZMJX9X+ZBzpoBfF+ZmHTm0MFgJepAa6f2VzBKIqk 3+Dcsg0jzmonB3riSz57pg1BeMBwyWxD16PMKUjeAV0Yl7q43c17E3tH4fa54Zel gc2kU+SSBBksRdRpgWgO7Af4EZJyAEVLJplSU0GLdpQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=FDbZvv y3ULwwG/IvyLkmeS6n+3ImsT57kf0dzH4LVmQ=; b=bticyajCWz3LE0u0wILn81 6Rj5bmxD/iU5h7kxd1TLcuRZcDQuDeGB3KuAHyycyvBahbRZUj3qHL9x3Gp0PbR0 vlT0v0sPCSNEHlpttaeROmPzQeSKk+XAlTERQoQTirHc/i02jqXwHRq53ELmsNYK GONOf7aQLb4rrAkQG5qIrnSR2NWNNbahVsijqHmBPN0q8HyACtiFOgZSpzCjaY01 lCf80X2ZfZP/ZmTdldp88Imgd1Ya+3gcTZZ4M7RohwlTxtbOX8eW7QzMboRf6riW QoqnGZ2U3T/jQZTOUmcXckWYXZZpOL+V2GCUX5jhxlEuiI1xkuXLqvziN+TNFvBg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrtdefgdegieculddtuddrgedutddrtddtmd cutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvuffkfhggtggujggfsehttdertddtredv necuhfhrohhmpefirhgvghcumffjuceoghhrvghgsehkrhhorghhrdgtohhmqeenucfkph epvddujedruddtuddrudektddrudefieenucfrrghrrghmpehmrghilhhfrhhomhepghhr vghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgepud X-ME-Proxy: Received: from localhost (217-101-180-136.cable.dynamic.v4.ziggo.nl [217.101.180.136]) by mail.messagingengine.com (Postfix) with ESMTPA id 99FDFE49E6; Wed, 3 Apr 2019 10:06:54 -0400 (EDT) Date: Wed, 3 Apr 2019 16:06:52 +0200 From: Greg KH To: Connor O'Brien Cc: stable@vger.kernel.org, Jeremy Compostella , Wolfram Sang , stable@kernel.org Subject: Re: [PATCH] i2c: core-smbus: prevent stack corruption on read I2C_BLOCK_DATA Message-ID: <20190403140652.GF8633@kroah.com> References: <20190401205441.65245-1-connoro@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190401205441.65245-1-connoro@google.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Apr 01, 2019 at 01:54:41PM -0700, Connor O'Brien wrote: > From: Jeremy Compostella > > commit 89c6efa61f5709327ecfa24bff18e57a4e80c7fa upstream. > > On a I2C_SMBUS_I2C_BLOCK_DATA read request, if data->block[0] is > greater than I2C_SMBUS_BLOCK_MAX + 1, the underlying I2C driver writes > data out of the msgbuf1 array boundary. > > It is possible from a user application to run into that issue by > calling the I2C_SMBUS ioctl with data.block[0] greater than > I2C_SMBUS_BLOCK_MAX + 1. > > This patch makes the code compliant with > Documentation/i2c/dev-interface by raising an error when the requested > size is larger than 32 bytes. > > Call Trace: > [] dump_stack+0x67/0x92 > [] panic+0xc5/0x1eb > [] ? vprintk_default+0x1f/0x30 > [] ? i2cdev_ioctl_smbus+0x303/0x320 > [] __stack_chk_fail+0x1b/0x20 > [] i2cdev_ioctl_smbus+0x303/0x320 > [] i2cdev_ioctl+0x4d/0x1e0 > [] do_vfs_ioctl+0x2ba/0x490 > [] ? security_file_ioctl+0x43/0x60 > [] SyS_ioctl+0x79/0x90 > [] entry_SYSCALL_64_fastpath+0x12/0x6a > > Signed-off-by: Jeremy Compostella > Signed-off-by: Wolfram Sang > Cc: stable@kernel.org > [connoro@google.com: 4.9 backport: adjust filename] > Signed-off-by: Connor O'Brien > --- > drivers/i2c/i2c-core.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) Thanks for these, now applied. greg k-h