Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp663691pxv; Thu, 15 Jul 2021 12:51:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCKpgthtg2JOE40+SRYp3qCTwkpY32XPJ2h3a6JAWXKOR7kWriMKtLrsP6xI6+sloN3+g8 X-Received: by 2002:a17:907:f8e:: with SMTP id kb14mr7259990ejc.40.1626378664790; Thu, 15 Jul 2021 12:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626378664; cv=none; d=google.com; s=arc-20160816; b=xC8HTKOOGkTv+x+UXtUpjOMxUBI3z3jvQRaHC5ksZOrIs+yQi6mTNrjUVhfJKsc8bI uW4cb82wy+OXwfvSEOEVb+u9cWiP+h9VyLQUGWYbp26R/g+I8+bW8RsjDQZytE8NSgQN EbXirGFQGykVnt/Hnhp/JyM3l8CaDgZ0LRAU8seaEYnBCtrM8dE0+FNHLsAU8J6B2O4b f645vcFSievaCm2ja0ATU74F4pjwmqdPizb7DvtmlrCPq76hJjy0Vg06dbke+4DGNh8x V2f/pEhyq1b0NBX1Rc2P1C+2/K4p0H7U5dvZl85DcGu7GSTE8ALLOSY9y1k9t9t/sh8w DMGQ== 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=jd3m6lLyRC0noxK8+WmBe9Bsa0akLk6QVVYNYfnHbtUeLhNmuOG/pg4Y/3sVRzlCT8 2MZwg3dN5hXoVsy8TEfBa6RghCzPa3pPxrwnQ+QT6Ky4A4n6yHWjgC/aGBUaREYuErky V0sCqHekCZJIfJ/ya6VUgfQ5lhrPppMAycT/j/wHxlRo/XAwGbNhErsah/HG3d+fN3gl KvCxnrHZHzIp+S65Ebh5GRze1FsW7mzANgWsRe16ccDPuJpMbU1qutwQaXUmhlr9CHHc 321PluV2yBf0XoQRlCVfgy3FLTNQAUQ1OzSZmOgA3Q3HRkLN+3SL44zEBrQegzkx4c4I l6bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J9KfGH4k; 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 y17si8404935edv.241.2021.07.15.12.50.40; Thu, 15 Jul 2021 12:51:04 -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=J9KfGH4k; 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 S1344596AbhGOTtm (ORCPT + 99 others); Thu, 15 Jul 2021 15:49:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:58954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242779AbhGOTSI (ORCPT ); Thu, 15 Jul 2021 15:18:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A603961405; Thu, 15 Jul 2021 19:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376386; bh=nA0u2vSnDAToGgwNOLeswbRytUAFyY7uC47mcXzBRyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J9KfGH4k8y/LoAUUvVga3cIodNnngi1o2wZfUUfkyvDf21KVuNiAgfvUU5akN5ybs pHkUG5/peZXUcIZwqvX8YBaGakAKvdgxzPzRZLNeurSOOKaaXMWfNc+grRh4rwpcGB u87T6TDlwxIdZQSTzsKK5/yuhnFRHWD+cRiAnLpc= 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.13 247/266] media: dtv5100: fix control-request directions Date: Thu, 15 Jul 2021 20:40:02 +0200 Message-Id: <20210715182651.763605884@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 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,