Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3598845pxv; Mon, 28 Jun 2021 08:16:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYopxGDosmER14MjVihlHy8KqJYCfdwvDkfO9eiDJrB29rNhLi45LFtNPeZBEbXy+7RHwx X-Received: by 2002:a17:906:f8da:: with SMTP id lh26mr24307885ejb.243.1624893382128; Mon, 28 Jun 2021 08:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624893382; cv=none; d=google.com; s=arc-20160816; b=egIPPHGfvArG01VxiQo9tsh5AefhfD1kTfM4BfwkCEugt0xmt9m7ycKWe/i2WDxTiL 9cVvzKFNp0MP7+y02mJg4U/TIHrQYR+VVK48/Kn5cELEnNhC3EjnZBdbjWYR7AsK3/ra sq6R2WuoagJdUjXN6AZCZCGE7nt3cAGhZC2M6m2myXLdMEsG5vEt6jlXv2IHgnRdfGML J3/cVyVKTT/ujBTCEoy97zIJQkMwN4443qvjCmbIylZEd4IhSyywYdW+JvUPdeNiO0uE oIIpFkIsD6TMRhMP3gLV92u56zcmI/NIbkRusaN3c4K0/WMpPweSWuFYfJ4GYm37Q1g5 o3AQ== 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=bvYTNc4H7jQ96vxUVmB1FcfKAV76fZ1fjWJ5LNOM7QQ=; b=wRj2qmhGD/Xr1IwMZ6Gx2nEF9WJK+MQzfDHVz0wbuERU7hRhrCPjaPk8hdkB/H6Z5d 3b8kT/4ILhr2TaJniX6aFQKWiHojHNTD8WzPs1aMatz/SrrrsxAeLmWrRA1u8IwV5thW njZt4aesONHLMf2EXk70xAaVPPhSep6K9UYwk4nesrI/7hNF4ON4RDH22z8jY6b1GfQP ltKWfle3yeoTI1X7CkKafrusFgRy9uPogAnXxpJ77pqqzSRrXc2eT8t5OWG8i1e/VEBF lzTGH1JJTmlqizvDElROJsa0FqEP80kW3pAAtYzkxcR+u4pb29jr83rxDZFY11OatyYG tRlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U8Upno6R; 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 f4si13753176edv.30.2021.06.28.08.15.57; Mon, 28 Jun 2021 08:16:22 -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=k20201202 header.b=U8Upno6R; 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 S236230AbhF1PQx (ORCPT + 99 others); Mon, 28 Jun 2021 11:16:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:57924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236291AbhF1OzP (ORCPT ); Mon, 28 Jun 2021 10:55:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1F94261C9F; Mon, 28 Jun 2021 14:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891064; bh=soKdrIrjGWFd8GretO+M1IOS6fwcavIuqIpdqdH9hdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U8Upno6RnHJQ629jGqw3khWmyl96OoeKehpD05LOdRpSAO4XOlqo1ZNvYXdxUXgaf FeepTDXsGRQslfFubMYUAPqnI8M4s21iZfWC4SmGt66KWh20cgrgfqoOi+oNKGL7iq QuunIHmt2Bh4hmTOhE9X9a8+xfKbfGpql79VaiH1E2GyFwq+Ftjj3sNoRIs86Dd6wI e4kgc5cHzsYahbLIx8lPDOggGXglH8C5wQuJ244AzG3fWtG3pTq4jfrmsgJfIk0alB +Bh0GF8a8HT8w8PFEtYVgEtap6NcCwmUr3bkpvfHcPcwT5zwbhG9yC+GYIh0Mmwo7W q9mu3jF4n5yqQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johan Hovold , syzbot+9d7dadd15b8819d73f41@syzkaller.appspotmail.com, Wolfram Sang , Greg Kroah-Hartman Subject: [PATCH 4.14 87/88] i2c: robotfuzz-osif: fix control-request directions Date: Mon, 28 Jun 2021 10:36:27 -0400 Message-Id: <20210628143628.33342-88-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628143628.33342-1-sashal@kernel.org> References: <20210628143628.33342-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.238-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.14.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.14.238-rc1 X-KernelTest-Deadline: 2021-06-30T14:36+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold commit 4ca070ef0dd885616ef294d269a9bf8e3b258e1a upstream. The direction of the pipe argument must match the request-type direction bit or control requests may fail depending on the host-controller-driver implementation. Control transfers without a data stage are treated as OUT requests by the USB stack and should be using usb_sndctrlpipe(). Failing to do so will now trigger a warning. Fix the OSIFI2C_SET_BIT_RATE and OSIFI2C_STOP requests which erroneously used the osif_usb_read() helper and set the IN direction bit. Reported-by: syzbot+9d7dadd15b8819d73f41@syzkaller.appspotmail.com Fixes: 83e53a8f120f ("i2c: Add bus driver for for OSIF USB i2c device.") Cc: stable@vger.kernel.org # 3.14 Signed-off-by: Johan Hovold Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-robotfuzz-osif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-robotfuzz-osif.c b/drivers/i2c/busses/i2c-robotfuzz-osif.c index 9c0f52b7ff7e..b9b4758c6be7 100644 --- a/drivers/i2c/busses/i2c-robotfuzz-osif.c +++ b/drivers/i2c/busses/i2c-robotfuzz-osif.c @@ -89,7 +89,7 @@ static int osif_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, } } - ret = osif_usb_read(adapter, OSIFI2C_STOP, 0, 0, NULL, 0); + ret = osif_usb_write(adapter, OSIFI2C_STOP, 0, 0, NULL, 0); if (ret) { dev_err(&adapter->dev, "failure sending STOP\n"); return -EREMOTEIO; @@ -159,7 +159,7 @@ static int osif_probe(struct usb_interface *interface, * Set bus frequency. The frequency is: * 120,000,000 / ( 16 + 2 * div * 4^prescale). * Using dev = 52, prescale = 0 give 100KHz */ - ret = osif_usb_read(&priv->adapter, OSIFI2C_SET_BIT_RATE, 52, 0, + ret = osif_usb_write(&priv->adapter, OSIFI2C_SET_BIT_RATE, 52, 0, NULL, 0); if (ret) { dev_err(&interface->dev, "failure sending bit rate"); -- 2.30.2