Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp635656pxv; Thu, 15 Jul 2021 12:05:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUAtpOgxZLKun6WGJa/sQXZNJRjyY88l8TEpshwRVgYfMR7FmhL82YidEo19o4FerBhpJx X-Received: by 2002:a17:906:69b:: with SMTP id u27mr7111551ejb.338.1626375951760; Thu, 15 Jul 2021 12:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375951; cv=none; d=google.com; s=arc-20160816; b=DWZ71eQC6qX8iiAfKglNAyKGFEXY2zqjSRbbH3gJReT6fQjzvWWV9BjlZmb3e/u9S6 1EeOCyBXaGrqHEm6Ytsn4454b5K0ZmuW3P9KcnJt0d7K4/pPTjs5+CwhW6sMyxISkl5k fr/n+RDn7+agQsVISSvrhX/M/QsYqSFsIemzWrGwiFV0KIKRaGwZfnnCduq9kBFRdDAr VFFEYEMK4k/on3QKgbUGmvsza3sypcUG3uzc+7bDuyG0VSu1Vy4PFEk5ODer/WcDhiCK 6aQCmdioel3G165Z22yLyPdWmY8XgbFKyC420nTaoCFU/5Q1gdsnorbfK8nQts2/RDEc kxHQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vFL1jJD7LqjXueeDfpztG2FPqeN7ziFCl/SN8TaZxKg=; b=MEfMtz5V5CoA6iVph+4F/lULwz2G6YuJDce537Xc3Ol0bobMF2Nt2YxD3lnhpLsExT O1xmkntwstJvs1oz6Mwck33B+Y2OKID8ozmkOtaYiQiypj7FMYA9s/RdySM+BVi3LjmU rlcGDRZWQ0B3Kru9gPLgGt6EcmLQe3ZbvDuV1toSWZYmnCvkpkJpBuDaGWMD0tTTESXT RudM6nDAwFHa1v5PBZHPbAhp3JXocvcfLdrll1YwkwYwotskMGJC7YGDJt2Ce+sZK5gm jANsagAkwOJ25vqiMUNX2aurbQk+GyjEAvxVCmt8PvUJK+472FE7Lm2T4RU1PjNu2oPl WHlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nP8ZqDBP; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d26si7790152ejc.620.2021.07.15.12.05.27; Thu, 15 Jul 2021 12:05:51 -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=@linuxfoundation.org header.s=korg header.b=nP8ZqDBP; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241900AbhGOTG0 (ORCPT + 99 others); Thu, 15 Jul 2021 15:06:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:60204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241518AbhGOS4U (ORCPT ); Thu, 15 Jul 2021 14:56:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B0F3E613DA; Thu, 15 Jul 2021 18:53:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375207; bh=PTmuQ+jgb47AOA2Ebl+Ynrr6Y303UUE+WJIg1P24iZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nP8ZqDBP8o8xNxncQn+2+6Uv4b1jde9S+bDUmfdk7X4T0dtQK5xKzQ0ij0m2PAuUF RTLkZgp8aGiKkKfxM+PaGjJsiAHOQwwH+5pmMvnTWJhV2xXeg7yiGhIRY/rkY6p/jE mRW7+sXcN/6YM4xjgikC+57LCwzOdv4u3hz0slNA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+faf11bbadc5a372564da@syzkaller.appspotmail.com, Antti Palosaari , Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.10 206/215] media: rtl28xxu: fix zero-length control request Date: Thu, 15 Jul 2021 20:39:38 +0200 Message-Id: <20210715182635.577718563@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182558.381078833@linuxfoundation.org> References: <20210715182558.381078833@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold commit 25d5ce3a606a1eb23a9265d615a92a876ff9cb5f 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 zero-length i2c-read request used for type detection by attempting to read a single byte instead. Reported-by: syzbot+faf11bbadc5a372564da@syzkaller.appspotmail.com Fixes: d0f232e823af ("[media] rtl28xxu: add heuristic to detect chip type") Cc: stable@vger.kernel.org # 4.0 Cc: Antti Palosaari Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c @@ -612,8 +612,9 @@ static int rtl28xxu_read_config(struct d static int rtl28xxu_identify_state(struct dvb_usb_device *d, const char **name) { struct rtl28xxu_dev *dev = d_to_priv(d); + u8 buf[1]; int ret; - struct rtl28xxu_req req_demod_i2c = {0x0020, CMD_I2C_DA_RD, 0, NULL}; + struct rtl28xxu_req req_demod_i2c = {0x0020, CMD_I2C_DA_RD, 1, buf}; dev_dbg(&d->intf->dev, "\n");