From patchwork Tue Dec 10 11:44:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11281995 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 EB99315AB for ; Tue, 10 Dec 2019 11:45:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C98E620836 for ; Tue, 10 Dec 2019 11:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575978321; bh=fdlzGZUtU2XiWRM/+oZVZ81jIqcjYgrX+MflMMtnQsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=g+CvwbyShcAVwTOkbcJwgexHtcPprgMLM7isrpgCqCUjIyRarMzI/SUKYGWYxQkcj LltjbGnRmYZzNEnTxCksJm0b4s8RReoHQcocav/hoiqEhBP4L5ZgXLG3QeC9r2bqed d/1TAyTII7UtQe4JlxLaEVkLokmGLe9Fg3GtFkDU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727773AbfLJLow (ORCPT ); Tue, 10 Dec 2019 06:44:52 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:37418 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727750AbfLJLot (ORCPT ); Tue, 10 Dec 2019 06:44:49 -0500 Received: by mail-lj1-f195.google.com with SMTP id u17so19512504lja.4; Tue, 10 Dec 2019 03:44:47 -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=mVv+98+Q/wUUkUyC3i7eT9Xaj/qNxPXqvi+D40LBxA8=; b=AT516+M1D0z38nsihUQaSLomQPXc7jErJf1yTvIh7l1jB3NGdeLF+f5TO7+vhAno/t AgLWcVqM2Pb4+ltOXx/s6I9mpcaLJsLgu1ES7eG1mYFZ0YIdYo9jSxGKpLZTmWEh1qVq hVJYlK4CGfgsK073vpNc/Jp6sWCXVGV9meXsEidAC2V/23dZOj/5xRXhXQUYw/54I/N9 X6dkxDZQtVs4pMkP90FOsqa5e0eeeB2bkMsE+8VgClVeRm5RVPyj9eGEz4m+mO5kUwmG U36PedmtIxZLJCAC+nmqgrZbP5c0kg03Nap2MCbrpDiJ3LTCPU8R4Zv3vLT336S7OLKN lIyQ== X-Gm-Message-State: APjAAAWrTyXnc0S7MhZ/Tu9pPZ+ssPEoGch+eOXV2MN2mbFZse6aU6AD M0X1nxd9VYMg1ShGP55x1m0= X-Google-Smtp-Source: APXvYqzNFa+fn53W1Aqp5M1Cpv1wJ6sddSRmDkbQiSSYG/sew6XIoKADsYtUfOLhzdKYpYDnENl+pw== X-Received: by 2002:a2e:3a13:: with SMTP id h19mr20770639lja.16.1575978287183; Tue, 10 Dec 2019 03:44:47 -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 q10sm1583883ljj.60.2019.12.10.03.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 03:44:43 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iedwa-0001ID-QQ; Tue, 10 Dec 2019 12:44:44 +0100 From: Johan Hovold To: Kalle Valo Cc: QCA ath9k Development , Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Jes Sorensen , Amitkumar Karwar , Siva Rebbagondla , Daniel Drake , Ulrich Kunitz , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable , Fariya Fatima Subject: [PATCH 6/7] rsi_91x_usb: fix interface sanity check Date: Tue, 10 Dec 2019 12:44:25 +0100 Message-Id: <20191210114426.4713-7-johan@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210114426.4713-1-johan@kernel.org> References: <20191210114426.4713-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: dad0d04fa7ba ("rsi: Add RS9113 wireless driver") Cc: stable # 3.15 Cc: Fariya Fatima Signed-off-by: Johan Hovold --- drivers/net/wireless/rsi/rsi_91x_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c index a37a436df5fb..c3ba38ed0dd0 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -117,7 +117,7 @@ static int rsi_find_bulk_in_and_out_endpoints(struct usb_interface *interface, __le16 buffer_size; int ii, bin_found = 0, bout_found = 0; - iface_desc = &(interface->altsetting[0]); + iface_desc = interface->cur_altsetting; for (ii = 0; ii < iface_desc->desc.bNumEndpoints; ++ii) { endpoint = &(iface_desc->endpoint[ii].desc);