bnx2x: fix possible overrun of VFPF multicast addresses array
authorMichal Schmidt <mschmidt@redhat.com>
Fri, 3 Mar 2017 16:08:30 +0000 (17:08 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Dec 2017 08:28:20 +0000 (09:28 +0100)
commitf73fcb25f4bba5c8df9de1693ea382f21f8f6818
treee70c3bb211216375bd26f2b8a887faae535fdbaf
parentae6b3452faf741c4127288c71d6edd0f23d6b0bb
bnx2x: fix possible overrun of VFPF multicast addresses array

[ Upstream commit 22118d861cec5da6ed525aaf12a3de9bfeffc58f ]

It is too late to check for the limit of the number of VF multicast
addresses after they have already been copied to the req->multicast[]
array, possibly overflowing it.

Do the check before copying.

Also fix the error path to not skip unlocking vf2pf_mutex.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c