Commit 7dde4154 authored by Alexey V. Vissarionov's avatar Alexey V. Vissarionov Committed by liwei
Browse files

PCI/IOV: Enlarge virtfn sysfs name buffer

mainline inclusion
from mainline-v6.3-rc1
commit ea0b5aa5
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9JNPZ
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ea0b5aa5f184cf8293c93163f0fb00505190d431

------------------------------------------------------

The sysfs link name "virtfn%u" constructed by pci_iov_sysfs_link() requires
17 bytes to contain the longest possible string.  Increase VIRTFN_ID_LEN to
accommodate that.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

[bhelgaas: commit log, comment at #define]
Fixes: dd7cc44d ("PCI: add SR-IOV API for Physical Function driver")
Link: https://lore.kernel.org/r/20221218033347.23743-1-gremlin@altlinux.org


Signed-off-by: default avatarAlexey V. Vissarionov <gremlin@altlinux.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Signed-off-by: default avatarliwei <liwei728@huawei.com>
parent a37954d8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
#include <linux/delay.h>
#include "pci.h"

#define VIRTFN_ID_LEN	16
#define VIRTFN_ID_LEN	17	/* "virtfn%u\0" for 2^32 - 1 */

static DEFINE_MUTEX(pci_sriov_numvfs_lock);