Patchwork [NEXT,06/10] qlcnic: fix panic while using eth_hdr

login
register
mail settings
Submitter amit salecha
Date Aug. 31, 2010, 2:29 p.m.
Message ID <1283264980-25881-7-git-send-email-amit.salecha@qlogic.com>
Download mbox | patch
Permalink /patch/63262/
State Superseded
Delegated to: David Miller
Headers show

Comments

amit salecha - Aug. 31, 2010, 2:29 p.m.
From: Rajesh Borundia <rajesh.borundia@qlogic.com>

o skb->mac_header is not set, so machine panics while using function eth_hdr.

Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic_main.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch

diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 9a3ebb8..789fe81 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -1991,6 +1991,7 @@  qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 	struct qlcnic_skb_frag *buffrag;
 	struct cmd_desc_type0 *hwdesc, *first_desc;
 	struct pci_dev *pdev;
+	struct ethhdr *phdr;
 	int i, k;
 
 	u32 producer;
@@ -2003,7 +2004,8 @@  qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 	}
 
 	if (adapter->flags & QLCNIC_MACSPOOF) {
-		if (compare_ether_addr(eth_hdr(skb)->h_source,
+		phdr = (struct ethhdr *)skb->data;
+		if (compare_ether_addr(phdr->h_source,
 					adapter->mac_addr))
 			goto drop_packet;
 	}