Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp713360pxv; Thu, 15 Jul 2021 14:12:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbuOnzKvJT9qA5d9AEX46zzyxvUPMX1SMly/rUWvtysDUVLEo58LQANWhz4OntJAduVejv X-Received: by 2002:a05:6402:19a:: with SMTP id r26mr9664777edv.230.1626383542408; Thu, 15 Jul 2021 14:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383542; cv=none; d=google.com; s=arc-20160816; b=kaei7M9S03yVDNTPShINfd3qmjPvhJaXOr5ufAbb+LoSGqkhUo3Ma8Ieyaz8xReK62 Z9y0QPByxJMutSlmfMRLsvbi+r6Q3tUeHo5IQOut/rlcQT6yOoXi9rY4syfCjbEN7u+o eu5UnMSMkdxyUNr0RDs9AN9K1K7wjjU8zr3WMDSjAERE1OX805Q6mTNWm5yMvZVIEfSK rBeLh+Adwj1ugmq/gjIvxCuas3Isju0C67eZ3zPRntGGUxMsqPMj2ve7w7rw4lUvY4RK ZnauavgyRE8SKPgBRGwdWKSb/K/ug7D7bCgFjtURXMprLx9hYjoa1AbTOXkg1MsRxJEh fmGA== 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=0+N53OCKKBe27IClyhwtK89kf0lhfJbJqzhBDg0DWThxGnAqdxprqy9qC00rZ5nnf+ pXkomEJZzHM0q5mMLrJVJCvIyvJrz6ZbmqUjnIw7bKnFZhiwP8cnUNezCoSVl5NlzgJn OgofGVBup6aAmXbdB0MHx0zM2xUb752ETohYXMx277/pe7phr5JvANgECa4vxhxVCm3Q UhJaXKoiyql76V5QCKjgbkxbuAkJG4Ywv9ZQpjFkJcOm0ew2LXUHmdmJGplkzBcL/8bz dS4saN1AakL0Be5w8oAwNuwNGFjnrWnAZiZUVbGIyp+smcm2OxVjZEBUtq39Bkhpccw1 XV6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tKsvPRVZ; 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 ka15si8082359ejc.148.2021.07.15.14.11.58; Thu, 15 Jul 2021 14:12: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=@linuxfoundation.org header.s=korg header.b=tKsvPRVZ; 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 S243511AbhGOTXN (ORCPT + 99 others); Thu, 15 Jul 2021 15:23:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:46196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241950AbhGOTGq (ORCPT ); Thu, 15 Jul 2021 15:06:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8A676613FB; Thu, 15 Jul 2021 19:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375769; bh=PTmuQ+jgb47AOA2Ebl+Ynrr6Y303UUE+WJIg1P24iZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tKsvPRVZphFHaR7SADfDI0O0/3sxD721ajlnU8xggd/jQFu2sSZolRIrMgxHZ49P3 OQgNokDt7Mr0jVR7ID1Q9PN8Ut9oab0Fnj8GqELTl8zzAFQ9FeTu19FHy3Fxq9SUgq 2NnI4Y8RDsiARuiOg2PO2trVnBOQKuK3abXXccxA= 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.12 228/242] media: rtl28xxu: fix zero-length control request Date: Thu, 15 Jul 2021 20:39:50 +0200 Message-Id: <20210715182633.025050739@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@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");