Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1968681ima; Thu, 25 Oct 2018 07:43:25 -0700 (PDT) X-Google-Smtp-Source: AJdET5du6pvkTCgB76i6PgSRVw6kty2zYFNhMeJ7N3pp4L2Ulq6imyGHVcqWITCunU1Pms2IDfPX X-Received: by 2002:a63:6dc8:: with SMTP id i191mr1671708pgc.215.1540478605509; Thu, 25 Oct 2018 07:43:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540478605; cv=none; d=google.com; s=arc-20160816; b=CRm1BW3ZSpZ3S+l63+XuGw53Hpod8fDEPlp+PeeSB7azH5k9noKiz2P6vE52aJnrM2 CVtG/SuHbQBr4Uaw77M7dUWEOy/iTVcraCC0pgQ7jW54dLZe/TNM2+mXuCJF4wx3eqdq ZATgFAap9EJqNSoXN9juqRvS0643cHjlZI7yvOBYK50UcQd+qErQitIq1pq4yO5fqLOL X/eBMuH7uTRlG87r8SfmiLhR0eyaVDiHut8HcUZCLd+J2y0o7a9sGyBYjeL7uHjAFJRC jDA9SoAi7L0ejhUT2xyw+HINA5A3coH09ngPgNCxBeutSrtzrTpB9X1VQ8l9Go1RfdD6 QWaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Onhb55SvEjXX4RYbHy8ZDRtiyNANy8SuOJG3Pxx0J3Y=; b=iMdouyAOUKiwIlzm9OXHkzGDoy756zFoCRjLdTlH9aJBCiSXd/cDgo+h3e/L9VSwz3 pYd0TwpyJSGWcyX6/qi2Dk0OitDAIFnQxw9vz3KQybGbVCVeg6CzrNZVZc+YjFupSpam VKJOaKmdaWr0+AqkTctz2n1mNNcU5W6eGUvH7lpsumtc4E9wSti1YQ9VarBKhVqHrlhA TEVZJJ/RhCf3atWHBeml7+eLQmYkowUD7OkRvfusNsjm8ET8k59sqZ1wo8IaYnI5NFiD G1q1Zh4g0+lKhXNoG/OUy5WHHOzqJpnHgU0biBRO6Fu0z8+q0yrQHdlRVD9WLaSlUmal IfJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qeqDWhYG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m20-v6si8303723pgk.579.2018.10.25.07.42.46; Thu, 25 Oct 2018 07:43:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qeqDWhYG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729103AbeJYWsl (ORCPT + 99 others); Thu, 25 Oct 2018 18:48:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:57450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729083AbeJYWsk (ORCPT ); Thu, 25 Oct 2018 18:48:40 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0764220870; Thu, 25 Oct 2018 14:15:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540476944; bh=y0g6lqdTWjtoM3K5HOOZoZ3p8dhRDToQlhmBaYskoEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qeqDWhYGQbuKuIFaE77p+bDwZptuMipTaVku+0b7Ov6pTejKV/DK7Ay+5Z8/sTqlT 6MZXMQ8pzY+mAFdo4GDqp69p39cXckki1TGtfcxEdYkv5FRHR/Cudg47qVHSYdkyU7 GnfW2NXemtZhQ7ATh7So9tZg6/bOvapaHaljdRPU= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Aditya Shankar , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH AUTOSEL 4.9 54/98] staging: wilc1000: Fix problem with wrong vif index Date: Thu, 25 Oct 2018 10:13:39 -0400 Message-Id: <20181025141423.213774-54-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141423.213774-1-sashal@kernel.org> References: <20181025141423.213774-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aditya Shankar [ Upstream commit 0e490657c7214cce33fbca3d88227298c5c968ae ] The vif->idx value is always 0 for two interfaces. wl->vif_num = 0; loop { ... vif->idx = wl->vif_num; ... wl->vif_num = i; .... i++; ... } At present, vif->idx is assigned the value of wl->vif_num at the beginning of this block and device is initialized based on this index value. In the next iteration, wl->vif_num is still 0 as it is only updated later but gets assigned to vif->idx in the beginning. This causes problems later when we try to reference a particular interface and also while configuring the firmware. This patch moves the assignment to vif->idx from the beginning of the block to after wl->vif_num is updated with latest value of i. Fixes: commit 735bb39ca3be ("staging: wilc1000: simplify vif[i]->ndev accesses") Cc: Signed-off-by: Aditya Shankar Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/wilc1000/linux_wlan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 07d6e4824a9d..2e5e3b368532 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1260,11 +1260,12 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, else strcpy(ndev->name, "p2p%d"); - vif->idx = wl->vif_num; vif->wilc = *wilc; vif->ndev = ndev; wl->vif[i] = vif; wl->vif_num = i; + vif->idx = wl->vif_num; + ndev->netdev_ops = &wilc_netdev_ops; { -- 2.17.1