From patchwork Tue Dec 10 11:47:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11282039 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2C72112B for ; Tue, 10 Dec 2019 11:48:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 911642077B for ; Tue, 10 Dec 2019 11:48:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575978514; bh=8d0SrljTHsF+EaguAIGZIxPZ5IZZN2GfwLBZI3M/vBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=bWWq0sVeI2uZXKT8O8fWfJxX6fKzrkKXwH08ewixAwIKyBczOrdirlVKo9lC6vg4p Tt5J7OQfbRxvHP1q41jjaLGihTDvn/8ge/fqt2v+eStnbD7c2FQts97PHSGoQ59wG8 /QvbgYcQDhEQpPQHaJRp9kB9uTxKzvtiPFfhEKp4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727701AbfLJLsa (ORCPT ); Tue, 10 Dec 2019 06:48:30 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:44717 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727411AbfLJLsB (ORCPT ); Tue, 10 Dec 2019 06:48:01 -0500 Received: by mail-lf1-f67.google.com with SMTP id v201so13420924lfa.11; Tue, 10 Dec 2019 03:48:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5C4SF4dYqrrVgr3TXUeoZ9GHkn69qJJjE9pwXzPrJrg=; b=Si+8ZLYo0AA6ktzMy5qnifeF6iHPmhrrKQGZFW+MWFY6p3HBdRO6AKtVTNG0zHD5dg bcZLhSRdbuzF4Rv3BepQJd4sdJJqGofcdq9wlfhwfJutBsa63y0/3F2EvyZKGJ4fczM4 BkCEPKFxvHSDX18Q1Z14EZKyBosjGND3taU4OYOa9bqNQKKPYL2tW7cdTHPxNnqT1EJP nFv9srB69i88zdPrUN7hfgjqCBdXfxbcQC6NN4y21C9dWl6qVDvQnUO5xPn4HUwXH/7I LRmQiczx04H1jWpczSBm5EAqIJcOeLGdnpcj0reRCvAMQn3OWKkk/lNSGHZCEHA5NoPJ v8zw== X-Gm-Message-State: APjAAAXnB9NGsgq0Exur1ctRlVzJAkeWNpsTniEYVHC6KW9LB9J/ntCC 7/pVcZ0aja8WVHBmlB7W5tZVhGf7 X-Google-Smtp-Source: APXvYqxzDhvpXC8Gs8pOUopECbJJEaJy4ZsNQJ3HROeJjafJrIC0HjKI+nYfNFhmf3ZJhA1OTxsboA== X-Received: by 2002:ac2:4476:: with SMTP id y22mr18829851lfl.169.1575978479262; Tue, 10 Dec 2019 03:47:59 -0800 (PST) Received: from xi.terra (c-14b8e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.184.20]) by smtp.gmail.com with ESMTPSA id i1sm1640753lji.71.2019.12.10.03.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 03:47:58 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iedzk-0001LQ-Ej; Tue, 10 Dec 2019 12:48:00 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Larry Finger , Florian Schilhabel , devel@driverdev.osuosl.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH 1/2] staging: rtl8188eu: fix interface sanity check Date: Tue, 10 Dec 2019 12:47:50 +0100 Message-Id: <20191210114751.5119-2-johan@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210114751.5119-1-johan@kernel.org> References: <20191210114751.5119-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Make sure to use the current alternate setting when verifying the interface descriptors to avoid binding to an invalid interface. Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on. Fixes: c2478d39076b ("staging: r8188eu: Add files for new driver - part 20") Cc: stable # 3.12 Signed-off-by: Johan Hovold --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 4fac9dca798e..a7cac0719b8b 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -70,7 +70,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) phost_conf = pusbd->actconfig; pconf_desc = &phost_conf->desc; - phost_iface = &usb_intf->altsetting[0]; + phost_iface = usb_intf->cur_altsetting; piface_desc = &phost_iface->desc; pdvobjpriv->NumInterfaces = pconf_desc->bNumInterfaces; From patchwork Tue Dec 10 11:47:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11282037 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B67214E3 for ; Tue, 10 Dec 2019 11:48:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 49D20207FF for ; Tue, 10 Dec 2019 11:48:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575978509; bh=g6sIOZ8Wv8FguCrQfPTFtqza/3QfY70NtsgL5VZM+8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=GEknMbILucNoZqN0eRkiL0JUwPvcqk6H6Mds7Qd8aefXUebTNnwmJ9D/4A9RFFtcN 2jjPw9yJfY3SClJo9Zmhjvd2HbTloqqdTXr7u790jB+r4R8N+9gscc0jGpJ+8ploOI 503rnDG5DEulJZ4YhTJI3glYh+3NZVMGqTf9gnCQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727242AbfLJLsY (ORCPT ); Tue, 10 Dec 2019 06:48:24 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:38385 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727426AbfLJLsC (ORCPT ); Tue, 10 Dec 2019 06:48:02 -0500 Received: by mail-lj1-f193.google.com with SMTP id k8so19479933ljh.5; Tue, 10 Dec 2019 03:48:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SomisIKYrhnGM9uPCjPrNcYhFDkrQCYHEW6V1huhmgY=; b=qn5jd9tvsiOoC2AVcE9GGC8YV8C749WT8BQmBs5YCcvAWZU5idSrHjXmjoo5x08UkC zGMt9CYuHflcd2ZYTwbzoMI8ZeKU78OQO6wsG5MHGbuY6DygKs0mO/W/Im955lsPgJJl Xo0mkm7/X9Ye/6FxGbdNcrkWwEBbCl4XUPGAS7iDfPljhcPUTsQPmaQqHiwOdO477+6H DXEHNiSK/n97xIT9jBhxNL/xoXJkHXF+PVdOZXNb07zV4C7AtdwT06lIPQzSItUtkrQ8 cUVQmSPUlhBzFTdtqWYUkrDn+Q0avIYfppvSfJD82+HxfWddUeuMRSgutlrq9z8oSHq9 JCSA== X-Gm-Message-State: APjAAAVAdjaZBb5k4h7K6MmlfLfKicf0kOs6gH5KRzY2MWZDOTglj5OL r23g5Xi8Iv11qw8DB41moi0= X-Google-Smtp-Source: APXvYqzhnW9ewIEAdaW6Atd0gX1aWXfA2az8JTi5RDAus4VEAcywwZw8M/TtqqPMRQXyUn67c8Vs2g== X-Received: by 2002:a05:651c:112d:: with SMTP id e13mr17386635ljo.99.1575978479806; Tue, 10 Dec 2019 03:47:59 -0800 (PST) Received: from xi.terra (c-14b8e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.184.20]) by smtp.gmail.com with ESMTPSA id a9sm1441410lfk.23.2019.12.10.03.47.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 03:47:58 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iedzk-0001LV-HT; Tue, 10 Dec 2019 12:48:00 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Larry Finger , Florian Schilhabel , devel@driverdev.osuosl.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH 2/2] staging: rtl8712: fix interface sanity check Date: Tue, 10 Dec 2019 12:47:51 +0100 Message-Id: <20191210114751.5119-3-johan@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210114751.5119-1-johan@kernel.org> References: <20191210114751.5119-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Make sure to use the current alternate setting when verifying the interface descriptors to avoid binding to an invalid interface. Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on. Fixes: 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel") Cc: stable # 2.6.37 Signed-off-by: Johan Hovold --- drivers/staging/rtl8712/usb_intf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c index ba1288297ee4..a87562f632a7 100644 --- a/drivers/staging/rtl8712/usb_intf.c +++ b/drivers/staging/rtl8712/usb_intf.c @@ -247,7 +247,7 @@ static uint r8712_usb_dvobj_init(struct _adapter *padapter) pdvobjpriv->padapter = padapter; padapter->eeprom_address_size = 6; - phost_iface = &pintf->altsetting[0]; + phost_iface = pintf->cur_altsetting; piface_desc = &phost_iface->desc; pdvobjpriv->nr_endpoint = piface_desc->bNumEndpoints; if (pusbd->speed == USB_SPEED_HIGH) {