enic: check dma_mapping_error
This patch checks for pci_dma_mapping_error() after dma mapping the data. If the dma mapping fails we remove the previously queued frags and return NETDEV_TX_OK. Reported-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
5e32066d00
commit
065df159ec
@@ -242,6 +242,18 @@ static inline unsigned int enic_msix_notify_intr(struct enic *enic)
|
||||
return enic->rq_count + enic->wq_count + 1;
|
||||
}
|
||||
|
||||
static inline int enic_dma_map_check(struct enic *enic, dma_addr_t dma_addr)
|
||||
{
|
||||
if (unlikely(pci_dma_mapping_error(enic->pdev, dma_addr))) {
|
||||
net_warn_ratelimited("%s: PCI dma mapping failed!\n",
|
||||
enic->netdev->name);
|
||||
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void enic_reset_addr_lists(struct enic *enic);
|
||||
int enic_sriov_enabled(struct enic *enic);
|
||||
int enic_is_valid_vf(struct enic *enic, int vf);
|
||||
|
Reference in New Issue
Block a user