OSDN Git Service

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>
Sat, 16 Dec 2017 09:33:53 +0000 (10:33 +0100)
commit871e4b11eba2be14d146834863ac39431c1614ff
tree9f07eb91fab666ca545178c3780cea3608108383
parent1aead0538b89f3c69457ea9fa50b7baca5894ef5
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