提交 4ad9a64f 编写于 作者: A Andy King 提交者: David S. Miller

VMXNET3: Check for map error in vmxnet3_set_mc

We should check if the map of the table actually succeeds, and also free
resources accordingly.

Version bumped to 1.2.1.0
Acked-by: NShelley Gong <shelleygong@vmware.com>
Acked-by: NBhavesh Davda <bhavesh@vmware.com>
Signed-off-by: NAndy King <acking@vmware.com>
Reported-by: NTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 c5eba0b6
...@@ -2056,7 +2056,6 @@ vmxnet3_set_mc(struct net_device *netdev) ...@@ -2056,7 +2056,6 @@ vmxnet3_set_mc(struct net_device *netdev)
if (!netdev_mc_empty(netdev)) { if (!netdev_mc_empty(netdev)) {
new_table = vmxnet3_copy_mc(netdev); new_table = vmxnet3_copy_mc(netdev);
if (new_table) { if (new_table) {
new_mode |= VMXNET3_RXM_MCAST;
rxConf->mfTableLen = cpu_to_le16( rxConf->mfTableLen = cpu_to_le16(
netdev_mc_count(netdev) * ETH_ALEN); netdev_mc_count(netdev) * ETH_ALEN);
new_table_pa = dma_map_single( new_table_pa = dma_map_single(
...@@ -2064,15 +2063,18 @@ vmxnet3_set_mc(struct net_device *netdev) ...@@ -2064,15 +2063,18 @@ vmxnet3_set_mc(struct net_device *netdev)
new_table, new_table,
rxConf->mfTableLen, rxConf->mfTableLen,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
}
if (new_table_pa) {
new_mode |= VMXNET3_RXM_MCAST;
rxConf->mfTablePA = cpu_to_le64(new_table_pa); rxConf->mfTablePA = cpu_to_le64(new_table_pa);
} else { } else {
netdev_info(netdev, "failed to copy mcast list" netdev_info(netdev,
", setting ALL_MULTI\n"); "failed to copy mcast list, setting ALL_MULTI\n");
new_mode |= VMXNET3_RXM_ALL_MULTI; new_mode |= VMXNET3_RXM_ALL_MULTI;
} }
} }
if (!(new_mode & VMXNET3_RXM_MCAST)) { if (!(new_mode & VMXNET3_RXM_MCAST)) {
rxConf->mfTableLen = 0; rxConf->mfTableLen = 0;
rxConf->mfTablePA = 0; rxConf->mfTablePA = 0;
...@@ -2091,11 +2093,10 @@ vmxnet3_set_mc(struct net_device *netdev) ...@@ -2091,11 +2093,10 @@ vmxnet3_set_mc(struct net_device *netdev)
VMXNET3_CMD_UPDATE_MAC_FILTERS); VMXNET3_CMD_UPDATE_MAC_FILTERS);
spin_unlock_irqrestore(&adapter->cmd_lock, flags); spin_unlock_irqrestore(&adapter->cmd_lock, flags);
if (new_table) { if (new_table_pa)
dma_unmap_single(&adapter->pdev->dev, new_table_pa, dma_unmap_single(&adapter->pdev->dev, new_table_pa,
rxConf->mfTableLen, PCI_DMA_TODEVICE); rxConf->mfTableLen, PCI_DMA_TODEVICE);
kfree(new_table); kfree(new_table);
}
} }
void void
......
...@@ -69,10 +69,10 @@ ...@@ -69,10 +69,10 @@
/* /*
* Version numbers * Version numbers
*/ */
#define VMXNET3_DRIVER_VERSION_STRING "1.2.0.0-k" #define VMXNET3_DRIVER_VERSION_STRING "1.2.1.0-k"
/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
#define VMXNET3_DRIVER_VERSION_NUM 0x01020000 #define VMXNET3_DRIVER_VERSION_NUM 0x01020100
#if defined(CONFIG_PCI_MSI) #if defined(CONFIG_PCI_MSI)
/* RSS only makes sense if MSI-X is supported. */ /* RSS only makes sense if MSI-X is supported. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册