Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp712283pxv; Thu, 15 Jul 2021 14:10:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKQYqRNDCFw1dLxe+C30yj4WQbvCYwtNeT9AF3ADVSXlkCchiF7YoL6n9Tv+mu4Lz/ZMtB X-Received: by 2002:a17:906:2450:: with SMTP id a16mr7565628ejb.137.1626383438522; Thu, 15 Jul 2021 14:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383438; cv=none; d=google.com; s=arc-20160816; b=f+rUDxXK8sqs5LJh3HrN5CoYzHsxwgsIOMJpJ3u+sZZRCx8R5kfWShPAN82ooJiCCd uQ+40y7krM222bHWl0t8tozkSC2x+iFHsEUerDCi7rIFIguXuryZmIDqtYPjqCiYw5/I BORQHGvaTzN0nzSDCoq2OhrMOe7KwBVcx3c3fWYB5iQx7ku9NDOIXwokzuEU6S0+d2yL f7LSSwfgn+IH1kAza/UWy5hOLPnwEvTWnoZWnSIolol5lZQ4vJB99IPgS5ZNwGRgy4DI taFac+7TxyI0Bj45W9uMYztwSKnYMEMSR/BU9HqEsUgiOaBw9sKzjGLzRhg0U+eE3S/K 2MJA== 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=3G7ggLUsOSn+9avD7adHu2MIt3Sc62t6QUlp97CNH6Q=; b=Pi9DpK5EnoMV+EzMTHpa0ivVcMMPaxFwILJvOoObQef8KQvl///TZdYP/HQ4RxTAEN +c/IFIrv61DbBuaFiEeHnI60lG22P0qc9RMnG1Z9P2KtfZ3SSPB2Ibm0i/2xn07SyiGo Ku1mWEQhzgpAEgdQtFbVgov7LuHAC2m8LQXXCaowdugcYLrGD2pxOZaL8clf5O9S8p8T fgLT8AVtrnTy8+Cl8hHs8zymVyE6GoKPgG5OXmBO9/PVlfvaG4iNFIx9fLXNjGjBtmNt OjZRkAitmFmB0Jm4CsL+Ejn6R4qQ6yA3sZ01Ss5C8Z1xjMbn6Yoa3N+0QuTdgDgMXucW Whdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KRvGWvKq; 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 w5si8280929edc.581.2021.07.15.14.10.15; Thu, 15 Jul 2021 14:10:38 -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=KRvGWvKq; 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 S244364AbhGOTWz (ORCPT + 99 others); Thu, 15 Jul 2021 15:22:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:45648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239286AbhGOTGW (ORCPT ); Thu, 15 Jul 2021 15:06:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CF6B36141E; Thu, 15 Jul 2021 19:02:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375757; bh=nA0u2vSnDAToGgwNOLeswbRytUAFyY7uC47mcXzBRyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KRvGWvKqLA5dI+QQrxVg+yApIQ3kqEdffETBzS9Y/zzJg9RbTvYghgiwpG77uGECI SLJYTfnzeQcap+SiEptXeUu0xfBPqr6AVH5se0ycrwQht9vByh9cg90y39+iIpDdn5 6MQ5po5L9YMgYVSAAN5Ei4ZsgvGQabGkx6wIqyrU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.12 223/242] media: dtv5100: fix control-request directions Date: Thu, 15 Jul 2021 20:39:45 +0200 Message-Id: <20210715182632.248506194@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 8c8b9a9be2afa8bd6a72ad1130532baab9fab89d 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. Fix the control requests which erroneously used usb_rcvctrlpipe(). Fixes: 8466028be792 ("V4L/DVB (8734): Initial support for AME DTV-5100 USB2.0 DVB-T") Cc: stable@vger.kernel.org # 2.6.28 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/dtv5100.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/media/usb/dvb-usb/dtv5100.c +++ b/drivers/media/usb/dvb-usb/dtv5100.c @@ -26,6 +26,7 @@ static int dtv5100_i2c_msg(struct dvb_us u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) { struct dtv5100_state *st = d->priv; + unsigned int pipe; u8 request; u8 type; u16 value; @@ -34,6 +35,7 @@ static int dtv5100_i2c_msg(struct dvb_us switch (wlen) { case 1: /* write { reg }, read { value } */ + pipe = usb_rcvctrlpipe(d->udev, 0); request = (addr == DTV5100_DEMOD_ADDR ? DTV5100_DEMOD_READ : DTV5100_TUNER_READ); type = USB_TYPE_VENDOR | USB_DIR_IN; @@ -41,6 +43,7 @@ static int dtv5100_i2c_msg(struct dvb_us break; case 2: /* write { reg, value } */ + pipe = usb_sndctrlpipe(d->udev, 0); request = (addr == DTV5100_DEMOD_ADDR ? DTV5100_DEMOD_WRITE : DTV5100_TUNER_WRITE); type = USB_TYPE_VENDOR | USB_DIR_OUT; @@ -54,7 +57,7 @@ static int dtv5100_i2c_msg(struct dvb_us memcpy(st->data, rbuf, rlen); msleep(1); /* avoid I2C errors */ - return usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), request, + return usb_control_msg(d->udev, pipe, request, type, value, index, st->data, rlen, DTV5100_USB_TIMEOUT); } @@ -141,7 +144,7 @@ static int dtv5100_probe(struct usb_inte /* initialize non qt1010/zl10353 part? */ for (i = 0; dtv5100_init[i].request; i++) { - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), dtv5100_init[i].request, USB_TYPE_VENDOR | USB_DIR_OUT, dtv5100_init[i].value,