Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp635232pxv; Thu, 15 Jul 2021 12:05:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxR8+Ou+Thht/MnOIsF+96fb7CzCTWKfavAUqbW0Ygsq5qdQOiiO0GmM/HWfD7WWa03grUo X-Received: by 2002:a92:dc4a:: with SMTP id x10mr3628004ilq.166.1626375919125; Thu, 15 Jul 2021 12:05:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375919; cv=none; d=google.com; s=arc-20160816; b=BhueAonKiazj2UZ1na9rnHGgQvltw1eJZFqgDJGWVsBYhLOYsZgYd1ztcoYAwLO5GH t0hww0kvS77YQ22fLHjul4E3pgzDeHIK+B+4qIvsB2l0+U8pXHq60Yk67YbTOYl6MYCT 3mn/M6bCqyudg43ZuKGdy2GHDvTWyX/IRfMkDvvLR699S1p1sDOXz6ZrD30IjgckdP9+ khjngJKSEtK+GhFYfWbbxt7UCLSFSIt9K5NCnUZOEYEdHxl4mthlu8xKN4a9eJvEZtEm IrpIz2cE/bmWtvPFV8iczltDPycXkEu/cCXXw6IHRYTevAsHCHYOZ1QisVD5JZUO1hUX IygA== 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=QX/o1SU5Pe6gYBKvRKjgQ4Fqrdvt/j8eY7wFcEcAqhwlfOUeyu3GZLUpxVx7A1DbHq x98zE/mxT1NRyrw60OXTOyzKytcRFtDf+5mwREnMs4i2ycF8Q6zCMlUsilxh4NFkJ4MT Fbhf2QhHRbpaGOYm6QGlkS9w5wDjpXOqQfFGvVQ409vvvdy1QBkCAKOlFnhlue/cypSL rULIeITNzG5OCtu/sp8tRKl6DtU4MXuI7POdR4Vjcyzv8YSXxrFrCmYaMgTZArxWNN6y bUroDZzJ7uW8LIKWFZ/w8I+2MTZ2kHtosBkk/CS33SBYOa6fOcnwR1QYhS/Spany6njp f9gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uWGlOHNC; 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 z9si7712759ilu.28.2021.07.15.12.05.06; Thu, 15 Jul 2021 12:05:19 -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=uWGlOHNC; 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 S242987AbhGOTGJ (ORCPT + 99 others); Thu, 15 Jul 2021 15:06:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:60992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241896AbhGOS4M (ORCPT ); Thu, 15 Jul 2021 14:56:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6B007613CC; Thu, 15 Jul 2021 18:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375197; bh=nA0u2vSnDAToGgwNOLeswbRytUAFyY7uC47mcXzBRyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uWGlOHNC11Vh5rqPG8rENPPQNWgseYEw28Cc1BGo9GlVuyFIO/S9JkadW8FjNmTYb orB4WFDpJFoN5bfajjTTTIbreMiejWvPgNN79ZfIpQA5ZH99gYpwED8dfRYeptLTtZ Ogxm45b64SCZhwnEj+srZaigWfABxgC23D1eyMIE= 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.10 202/215] media: dtv5100: fix control-request directions Date: Thu, 15 Jul 2021 20:39:34 +0200 Message-Id: <20210715182634.861456233@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 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,