提交 9092c658 编写于 作者: E Eric Dumazet 提交者: David S. Miller

net: illegal_highdma() fix

Followup to commit 5acbbd42
(net: change illegal_highdma to use dma_mask)

If dev->dev.parent is NULL, we should not try to dereference it.

Dont force inline illegal_highdma() as its pretty big now.
Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ba343c77
...@@ -1801,7 +1801,7 @@ EXPORT_SYMBOL(netdev_rx_csum_fault); ...@@ -1801,7 +1801,7 @@ EXPORT_SYMBOL(netdev_rx_csum_fault);
* 2. No high memory really exists on this machine. * 2. No high memory really exists on this machine.
*/ */
static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb) static int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
{ {
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
int i; int i;
...@@ -1814,6 +1814,8 @@ static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb) ...@@ -1814,6 +1814,8 @@ static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
if (PCI_DMA_BUS_IS_PHYS) { if (PCI_DMA_BUS_IS_PHYS) {
struct device *pdev = dev->dev.parent; struct device *pdev = dev->dev.parent;
if (!pdev)
return 0;
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
dma_addr_t addr = page_to_phys(skb_shinfo(skb)->frags[i].page); dma_addr_t addr = page_to_phys(skb_shinfo(skb)->frags[i].page);
if (!pdev->dma_mask || addr + PAGE_SIZE - 1 > *pdev->dma_mask) if (!pdev->dma_mask || addr + PAGE_SIZE - 1 > *pdev->dma_mask)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册