Subject: CVE-2021-47201: iavf: free q_vectors before queues in iavf_disable_vf

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

iavf: free q_vectors before queues in iavf_disable_vf

iavf_free_queues() clears adapter->num_active_queues, which
iavf_free_q_vectors() relies on, so swap the order of these two function
calls in iavf_disable_vf(). This resolves a panic encountered when the
interface is disabled and then later brought up again after PF
communication is restored.

The Linux kernel CVE team has assigned CVE-2021-47201 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 4.13 with commit 65c7006f234c and fixed in 5.4.162 with commit 926e8c83d4c1
	Issue introduced in 4.13 with commit 65c7006f234c and fixed in 5.10.82 with commit 78638b471322
	Issue introduced in 4.13 with commit 65c7006f234c and fixed in 5.15.5 with commit 9ef6589cac9a
	Issue introduced in 4.13 with commit 65c7006f234c and fixed in 5.16 with commit 89f22f129696

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2021-47201
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/net/ethernet/intel/iavf/iavf_main.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/926e8c83d4c1c2dac0026637eb0d492df876489e
	https://git.kernel.org/stable/c/78638b47132244e3934dc5dc79f6372d5ce8e98c
	https://git.kernel.org/stable/c/9ef6589cac9a8c47f5544ccdf4c498093733bb3f
	https://git.kernel.org/stable/c/89f22f129696ab53cfbc608e0a2184d0fea46ac1