Skip to content

Commit c70d681

Browse files
sf-hgkdavem330
authored andcommitted
sfc: don't read beyond unicast address list
If we have more than 32 unicast MAC addresses assigned to an interface we will read beyond the end of the address table in the driver when adding filters. The next 256 entries store multicast addresses, so we will end up attempting to insert duplicate filters, which is mostly harmless. If we add more than 288 unicast addresses we will then read past the multicast address table, which is likely to be more exciting. Fixes: 12fb0da ("sfc: clean fallbacks between promisc/normal in efx_ef10_filter_sync_rx_mode") Signed-off-by: Bert Kenward <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 07b8a7c commit c70d681

File tree

1 file changed

+3
-5
lines changed
  • drivers/net/ethernet/sfc

1 file changed

+3
-5
lines changed

drivers/net/ethernet/sfc/ef10.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5034,12 +5034,9 @@ static void efx_ef10_filter_uc_addr_list(struct efx_nic *efx)
50345034
struct efx_ef10_filter_table *table = efx->filter_state;
50355035
struct net_device *net_dev = efx->net_dev;
50365036
struct netdev_hw_addr *uc;
5037-
int addr_count;
50385037
unsigned int i;
50395038

5040-
addr_count = netdev_uc_count(net_dev);
50415039
table->uc_promisc = !!(net_dev->flags & IFF_PROMISC);
5042-
table->dev_uc_count = 1 + addr_count;
50435040
ether_addr_copy(table->dev_uc_list[0].addr, net_dev->dev_addr);
50445041
i = 1;
50455042
netdev_for_each_uc_addr(uc, net_dev) {
@@ -5050,19 +5047,20 @@ static void efx_ef10_filter_uc_addr_list(struct efx_nic *efx)
50505047
ether_addr_copy(table->dev_uc_list[i].addr, uc->addr);
50515048
i++;
50525049
}
5050+
5051+
table->dev_uc_count = i;
50535052
}
50545053

50555054
static void efx_ef10_filter_mc_addr_list(struct efx_nic *efx)
50565055
{
50575056
struct efx_ef10_filter_table *table = efx->filter_state;
50585057
struct net_device *net_dev = efx->net_dev;
50595058
struct netdev_hw_addr *mc;
5060-
unsigned int i, addr_count;
5059+
unsigned int i;
50615060

50625061
table->mc_overflow = false;
50635062
table->mc_promisc = !!(net_dev->flags & (IFF_PROMISC | IFF_ALLMULTI));
50645063

5065-
addr_count = netdev_mc_count(net_dev);
50665064
i = 0;
50675065
netdev_for_each_mc_addr(mc, net_dev) {
50685066
if (i >= EFX_EF10_FILTER_DEV_MC_MAX) {

0 commit comments

Comments
 (0)