diff options
Diffstat (limited to 'net/irda')
-rw-r--r-- | net/irda/irlap_frame.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c index f17b65af9c9b..2562ebc1b22c 100644 --- a/net/irda/irlap_frame.c +++ b/net/irda/irlap_frame.c | |||
@@ -1325,6 +1325,7 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1325 | struct irlap_cb *self; | 1325 | struct irlap_cb *self; |
1326 | int command; | 1326 | int command; |
1327 | __u8 control; | 1327 | __u8 control; |
1328 | int ret = -1; | ||
1328 | 1329 | ||
1329 | if (!net_eq(dev_net(dev), &init_net)) | 1330 | if (!net_eq(dev_net(dev), &init_net)) |
1330 | goto out; | 1331 | goto out; |
@@ -1333,25 +1334,21 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1333 | self = (struct irlap_cb *) dev->atalk_ptr; | 1334 | self = (struct irlap_cb *) dev->atalk_ptr; |
1334 | 1335 | ||
1335 | /* If the net device is down, then IrLAP is gone! */ | 1336 | /* If the net device is down, then IrLAP is gone! */ |
1336 | if (!self || self->magic != LAP_MAGIC) { | 1337 | if (!self || self->magic != LAP_MAGIC) |
1337 | dev_kfree_skb(skb); | 1338 | goto err; |
1338 | return -1; | ||
1339 | } | ||
1340 | 1339 | ||
1341 | /* We are no longer an "old" protocol, so we need to handle | 1340 | /* We are no longer an "old" protocol, so we need to handle |
1342 | * share and non linear skbs. This should never happen, so | 1341 | * share and non linear skbs. This should never happen, so |
1343 | * we don't need to be clever about it. Jean II */ | 1342 | * we don't need to be clever about it. Jean II */ |
1344 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { | 1343 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { |
1345 | IRDA_ERROR("%s: can't clone shared skb!\n", __func__); | 1344 | IRDA_ERROR("%s: can't clone shared skb!\n", __func__); |
1346 | dev_kfree_skb(skb); | 1345 | goto err; |
1347 | return -1; | ||
1348 | } | 1346 | } |
1349 | 1347 | ||
1350 | /* Check if frame is large enough for parsing */ | 1348 | /* Check if frame is large enough for parsing */ |
1351 | if (!pskb_may_pull(skb, 2)) { | 1349 | if (!pskb_may_pull(skb, 2)) { |
1352 | IRDA_ERROR("%s: frame too short!\n", __func__); | 1350 | IRDA_ERROR("%s: frame too short!\n", __func__); |
1353 | dev_kfree_skb(skb); | 1351 | goto err; |
1354 | return -1; | ||
1355 | } | 1352 | } |
1356 | 1353 | ||
1357 | command = skb->data[0] & CMD_FRAME; | 1354 | command = skb->data[0] & CMD_FRAME; |
@@ -1442,7 +1439,9 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1442 | break; | 1439 | break; |
1443 | } | 1440 | } |
1444 | out: | 1441 | out: |
1442 | ret = 0; | ||
1443 | err: | ||
1445 | /* Always drop our reference on the skb */ | 1444 | /* Always drop our reference on the skb */ |
1446 | dev_kfree_skb(skb); | 1445 | dev_kfree_skb(skb); |
1447 | return 0; | 1446 | return ret; |
1448 | } | 1447 | } |