Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp664126pxv; Thu, 15 Jul 2021 12:51:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0W+2d62VZ7MjybMwfWD4wDhovLaPP0Vqq0gy+8kmPfgrKAC3zRpOdpihHN05p/ws3p0Ou X-Received: by 2002:a92:d251:: with SMTP id v17mr3614973ilg.283.1626378704969; Thu, 15 Jul 2021 12:51:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626378704; cv=none; d=google.com; s=arc-20160816; b=xb5u6EWMoDjko83hioYitfkvRFqGtBWrTpaKWPjZgG66XLUYW3kOaTC3RZAsYTA6sm 3ybxT1e3uq+T2aVAw2e68P/Kdx3UvukO4YFT/NTXQKkvgkHkpoitp+8P8f3+8nhbT/kd nD7cefCRJqx6tBUEcJwnj7HaKsi9ujG7H9XdUA4RrCOhrXuA19mlljNFWZtut9R7jImC S1e7xDiJynWiP6KllS1U4QITKDJGdypU+edkjmxIeYg6i2OcDJeR49oBiPATOsJnLXqJ mv7dTyKue1dUVAEtpeHFwppshKnIM8bq2yEZD0bfcCctREwQl/qnoQpJfC5GGPmKJLY6 yplw== 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=oCIvSzRYq0jwPCcoZvRLGqx0PqFpXT7lhTEbmzLnkXlUKGYIOl7rriKnAgy4UauRzJ 5Dw6gqN60ZU5EXIZ7XAjVlO/bvyygjVxOUnx8TCsjZ+Goby6YFMk5L2BV7NgNPab890A 78Eevm21ln0vBwstHYyXlA4nmyrvvsrQh+Wc98V65UrgI++Ir/bKr2a8I0KELJfYxhlU IuawBS7InUy7hV2FZmy9ohLjGvIMWgNIgEXDUzLpU/woD8A2RB6PKigRX1V7s/2mTd7Q BaPn+jA1baaUKzTiRI2JCz8srzg9Wa3pV2Ty1xqL1LfLDCUoA3T8ngQeHIfk57X4mMMG kpMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rZ5YtOHg; 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 k9si8038093jav.118.2021.07.15.12.51.32; Thu, 15 Jul 2021 12:51:44 -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=rZ5YtOHg; 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 S241006AbhGOTxf (ORCPT + 99 others); Thu, 15 Jul 2021 15:53:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:58840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245010AbhGOTTI (ORCPT ); Thu, 15 Jul 2021 15:19:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 344E761400; Thu, 15 Jul 2021 19:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376428; bh=PTmuQ+jgb47AOA2Ebl+Ynrr6Y303UUE+WJIg1P24iZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rZ5YtOHg+l1pMm45ei+Lr6p2FhqPIGKar1jTw6shjOlaXyBSBF+fZNK5b5Wb6hpBr GHFVwpFaLJH9uHGV3lHuZ2KqH9bkXpPHW9tGd06aq0sCNVAyNvFl5B9cdGPBpFCfdT M+6aQYyHqTyqavWD2UmBkpzGtmpaskLONXBNrjII= 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.13 252/266] media: rtl28xxu: fix zero-length control request Date: Thu, 15 Jul 2021 20:40:07 +0200 Message-Id: <20210715182652.248759867@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@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");