]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bnxt_en: Fix the 'Invalid VF' id check in bnxt_vf_ndo_prep routine.
authorVenkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Thu, 4 Jan 2018 23:46:55 +0000 (18:46 -0500)
committerJack Vogel <jack.vogel@oracle.com>
Fri, 9 Mar 2018 05:03:45 +0000 (21:03 -0800)
commit271213d17c7fc485575a86b1deb489d1a88ce177
treeddb6d93f1735b22ec777347a0350e51bbc14a304
parent15bf9b5ae9c801b90a8a1e52b27354ef36b7a894
bnxt_en: Fix the 'Invalid VF' id check in bnxt_vf_ndo_prep routine.

Orabug: 2764835527648339

In bnxt_vf_ndo_prep (which is called by bnxt_get_vf_config ndo), there is a
check for "Invalid VF id". Currently, the check is done against max_vfs.
However, the user doesn't always create max_vfs. So, the check should be
against the created number of VFs. The number of bnxt_vf_info structures
that are allocated in bnxt_alloc_vf_resources routine is the "number of
requested VFs". So, if an "invalid VF id" falls between the requested
number of VFs and the max_vfs, the driver will be dereferencing an invalid
pointer.

Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.")
Signed-off-by: Venkat Devvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 78f300049335ae81a5cc6b4b232481dc5e1f9d41)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c