Commit 2631b953 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] arcnet oops fix

From: Dipankar Sarma <dipankar@in.ibm.com>

Forward-port of a fix Alan merged into 2.4.21-pre.  It fixes arcnet oopses
with raw sockets.
parent 78820703
......@@ -37,8 +37,8 @@
static void rx(struct net_device *dev, int bufnum,
struct archdr *pkthdr, int length);
static int build_header(struct sk_buff *skb, unsigned short type,
uint8_t daddr);
static int build_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, uint8_t daddr);
static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
int bufnum);
......@@ -131,10 +131,9 @@ static void rx(struct net_device *dev, int bufnum,
* Create the ARCnet hard/soft headers for raw mode.
* There aren't any soft headers in raw mode - not even the protocol id.
*/
static int build_header(struct sk_buff *skb, unsigned short type,
uint8_t daddr)
static int build_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, uint8_t daddr)
{
struct net_device *dev = skb->dev;
int hdr_size = ARC_HDR_SIZE;
struct archdr *pkt = (struct archdr *) skb_push(skb, hdr_size);
......
......@@ -57,8 +57,8 @@
/* "do nothing" functions for protocol drivers */
static void null_rx(struct net_device *dev, int bufnum,
struct archdr *pkthdr, int length);
static int null_build_header(struct sk_buff *skb, unsigned short type,
uint8_t daddr);
static int null_build_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, uint8_t daddr);
static int null_prepare_tx(struct net_device *dev, struct archdr *pkt,
int length, int bufnum);
......@@ -479,7 +479,7 @@ static int arcnet_header(struct sk_buff *skb, struct net_device *dev,
arc_bcast_proto->suffix);
proto = arc_bcast_proto;
}
return proto->build_header(skb, type, _daddr);
return proto->build_header(skb, dev, type, _daddr);
}
......@@ -495,6 +495,7 @@ static int arcnet_rebuild_header(struct sk_buff *skb)
int status = 0; /* default is failure */
unsigned short type;
uint8_t daddr=0;
struct ArcProto *proto;
if (skb->nh.raw - skb->mac.raw != 2) {
BUGMSG(D_NORMAL,
......@@ -523,7 +524,8 @@ static int arcnet_rebuild_header(struct sk_buff *skb)
return 0;
/* add the _real_ header this time! */
arc_proto_map[lp->default_proto[daddr]]->build_header(skb, type, daddr);
proto = arc_proto_map[lp->default_proto[daddr]];
proto->build_header(skb, dev, type, daddr);
return 1; /* success */
}
......@@ -952,10 +954,9 @@ static void null_rx(struct net_device *dev, int bufnum,
}
static int null_build_header(struct sk_buff *skb, unsigned short type,
uint8_t daddr)
static int null_build_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, uint8_t daddr)
{
struct net_device *dev = skb->dev;
struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
BUGMSG(D_PROTO,
......
......@@ -37,8 +37,8 @@
static unsigned short type_trans(struct sk_buff *skb, struct net_device *dev);
static void rx(struct net_device *dev, int bufnum,
struct archdr *pkthdr, int length);
static int build_header(struct sk_buff *skb, unsigned short type,
uint8_t daddr);
static int build_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, uint8_t daddr);
static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
int bufnum);
......@@ -163,10 +163,9 @@ static void rx(struct net_device *dev, int bufnum,
/*
* Create the ARCnet hard/soft headers for RFC1051.
*/
static int build_header(struct sk_buff *skb, unsigned short type,
uint8_t daddr)
static int build_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, uint8_t daddr)
{
struct net_device *dev = skb->dev;
struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE;
struct archdr *pkt = (struct archdr *) skb_push(skb, hdr_size);
......
......@@ -36,8 +36,8 @@
static unsigned short type_trans(struct sk_buff *skb, struct net_device *dev);
static void rx(struct net_device *dev, int bufnum,
struct archdr *pkthdr, int length);
static int build_header(struct sk_buff *skb, unsigned short type,
uint8_t daddr);
static int build_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, uint8_t daddr);
static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
int bufnum);
static int continue_tx(struct net_device *dev, int bufnum);
......@@ -370,10 +370,9 @@ static void rx(struct net_device *dev, int bufnum,
/* Create the ARCnet hard/soft headers for RFC1201. */
static int build_header(struct sk_buff *skb, unsigned short type,
uint8_t daddr)
static int build_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, uint8_t daddr)
{
struct net_device *dev = skb->dev;
struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
int hdr_size = ARC_HDR_SIZE + RFC1201_HDR_SIZE;
struct archdr *pkt = (struct archdr *) skb_push(skb, hdr_size);
......
......@@ -190,8 +190,8 @@ struct ArcProto {
void (*rx) (struct net_device * dev, int bufnum,
struct archdr * pkthdr, int length);
int (*build_header) (struct sk_buff * skb, unsigned short ethproto,
uint8_t daddr);
int (*build_header) (struct sk_buff * skb, struct net_device *dev,
unsigned short ethproto, uint8_t daddr);
/* these functions return '1' if the skb can now be freed */
int (*prepare_tx) (struct net_device * dev, struct archdr * pkt, int length,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment