aboutsummaryrefslogtreecommitdiffstats
path: root/net/can
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-05-08 22:03:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-08 22:03:26 -0400
commit28a4acb48586dc21d2d14a75a7aab7be78b7c83b (patch)
tree1e95503037a68286ba732dbc0a844dbf0f826223 /net/can
parent89f92d6425b099538932e9b881588f87ef9f3184 (diff)
parente46b66bc42b6b1430b04cc5c207ecb2b2f4553dc (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (32 commits) net: Added ASSERT_RTNL() to dev_open() and dev_close(). can: Fix can_send() handling on dev_queue_xmit() failures netns: Fix arbitrary net_device-s corruptions on net_ns stop. netfilter: Kconfig: default DCCP/SCTP conntrack support to the protocol config values netfilter: nf_conntrack_sip: restrict RTP expect flushing on error to last request macvlan: Fix memleak on device removal/crash on module removal net/ipv4: correct RFC 1122 section reference in comment tcp FRTO: SACK variant is errorneously used with NewReno e1000e: don't return half-read eeprom on error ucc_geth: Don't use RX clock as TX clock. cxgb3: Use CAP_SYS_RAWIO for firmware pcnet32: delete non NAPI code from driver. fs_enet: Fix a memory leak in fs_enet_mdio_probe [netdrvr] eexpress: IPv6 fails - multicast problems 3c59x: use netstats in net_device structure 3c980-TX needs EXTRA_PREAMBLE fix warning in drivers/net/appletalk/cops.c e1000e: Add support for BM PHYs on ICH9 uli526x: fix endianness issues in the setup frame uli526x: initialize the hardware prior to requesting interrupts ...
Diffstat (limited to 'net/can')
-rw-r--r--net/can/af_can.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 2759b76f731c..7e8ca2836452 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -208,6 +208,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol)
208 */ 208 */
209int can_send(struct sk_buff *skb, int loop) 209int can_send(struct sk_buff *skb, int loop)
210{ 210{
211 struct sk_buff *newskb = NULL;
211 int err; 212 int err;
212 213
213 if (skb->dev->type != ARPHRD_CAN) { 214 if (skb->dev->type != ARPHRD_CAN) {
@@ -244,8 +245,7 @@ int can_send(struct sk_buff *skb, int loop)
244 * If the interface is not capable to do loopback 245 * If the interface is not capable to do loopback
245 * itself, we do it here. 246 * itself, we do it here.
246 */ 247 */
247 struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC); 248 newskb = skb_clone(skb, GFP_ATOMIC);
248
249 if (!newskb) { 249 if (!newskb) {
250 kfree_skb(skb); 250 kfree_skb(skb);
251 return -ENOMEM; 251 return -ENOMEM;
@@ -254,7 +254,6 @@ int can_send(struct sk_buff *skb, int loop)
254 newskb->sk = skb->sk; 254 newskb->sk = skb->sk;
255 newskb->ip_summed = CHECKSUM_UNNECESSARY; 255 newskb->ip_summed = CHECKSUM_UNNECESSARY;
256 newskb->pkt_type = PACKET_BROADCAST; 256 newskb->pkt_type = PACKET_BROADCAST;
257 netif_rx(newskb);
258 } 257 }
259 } else { 258 } else {
260 /* indication for the CAN driver: no loopback required */ 259 /* indication for the CAN driver: no loopback required */
@@ -266,11 +265,20 @@ int can_send(struct sk_buff *skb, int loop)
266 if (err > 0) 265 if (err > 0)
267 err = net_xmit_errno(err); 266 err = net_xmit_errno(err);
268 267
268 if (err) {
269 if (newskb)
270 kfree_skb(newskb);
271 return err;
272 }
273
274 if (newskb)
275 netif_rx(newskb);
276
269 /* update statistics */ 277 /* update statistics */
270 can_stats.tx_frames++; 278 can_stats.tx_frames++;
271 can_stats.tx_frames_delta++; 279 can_stats.tx_frames_delta++;
272 280
273 return err; 281 return 0;
274} 282}
275EXPORT_SYMBOL(can_send); 283EXPORT_SYMBOL(can_send);
276 284