Skip to content

Commit

Permalink
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/davem/net-2.6

* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
  [AF_KEY]: suppress a warning for 64k pages.
  [TIPC]: Fix headercheck wrt. tipc_config.h
  [COMPAT]: Fix build on COMPAT platforms when CONFIG_NET is disabled.
  [CONNECTOR]: Fix a spurious kfree_skb() call
  [COMPAT]: Fix new dev_ifname32 returning -EFAULT
  [NET]: Fix incorrect sg_mark_end() calls.
  [IPVS]: Remove /proc/net/ip_vs_lblcr
  [IPV6]: remove duplicate call to proc_net_remove
  [NETNS]: fix net released by rcu callback
  [NET]: Fix free_netdev on register_netdev failure.
  [WAN]: fix drivers/net/wan/lmc/ compilation
  • Loading branch information
Linus Torvalds committed Oct 31, 2007
2 parents a3634d7 + 298bb62 commit dd13810
Show file tree
Hide file tree
Showing 18 changed files with 111 additions and 173 deletions.
5 changes: 1 addition & 4 deletions drivers/connector/connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static void cn_rx_skb(struct sk_buff *__skb)
skb->len < nlh->nlmsg_len ||
nlh->nlmsg_len > CONNECTOR_MAX_MSG_SIZE) {
kfree_skb(skb);
goto out;
return;
}

len = NLMSG_ALIGN(nlh->nlmsg_len);
Expand All @@ -229,9 +229,6 @@ static void cn_rx_skb(struct sk_buff *__skb)
if (err < 0)
kfree_skb(skb);
}

out:
kfree_skb(__skb);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wan/lmc/lmc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
sc->lmc_xinfo.Magic1 = 0xDEADBEEF;

if (copy_to_user(ifr->ifr_data, &sc->lmc_xinfo,
sizeof(struct lmc_xinfo))) {
sizeof(struct lmc_xinfo)))
ret = -EFAULT;
else
ret = 0;
Expand Down
2 changes: 1 addition & 1 deletion fs/compat_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ static int dev_ifname32(unsigned int fd, unsigned int cmd, unsigned long arg)
int err;

uifr = compat_alloc_user_space(sizeof(struct ifreq));
if (copy_in_user(uifr, compat_ptr(arg), sizeof(struct ifreq32)));
if (copy_in_user(uifr, compat_ptr(arg), sizeof(struct ifreq32)))
return -EFAULT;

err = sys_ioctl(fd, SIOCGIFNAME, (unsigned long)uifr);
Expand Down
1 change: 1 addition & 0 deletions include/linux/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ unifdef-y += sonypi.h
unifdef-y += soundcard.h
unifdef-y += stat.h
unifdef-y += stddef.h
unifdef-y += string.h
unifdef-y += synclink.h
unifdef-y += sysctl.h
unifdef-y += tcp.h
Expand Down
12 changes: 3 additions & 9 deletions include/linux/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@

/* We don't want strings.h stuff being user by user stuff by accident */

#ifdef __KERNEL__
#ifndef __KERNEL__
#include <string.h>
#else

#include <linux/compiler.h> /* for inline */
#include <linux/types.h> /* for size_t */
#include <linux/stddef.h> /* for NULL */

#ifdef __cplusplus
extern "C" {
#endif

extern char *strndup_user(const char __user *, long);

/*
Expand Down Expand Up @@ -111,9 +109,5 @@ extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
extern void argv_free(char **argv);

#ifdef __cplusplus
}
#endif

#endif
#endif /* _LINUX_STRING_H_ */
4 changes: 4 additions & 0 deletions kernel/sys_ni.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ cond_syscall(sys_recvfrom);
cond_syscall(sys_recv);
cond_syscall(sys_socket);
cond_syscall(sys_setsockopt);
cond_syscall(compat_sys_setsockopt);
cond_syscall(sys_getsockopt);
cond_syscall(compat_sys_getsockopt);
cond_syscall(sys_shutdown);
cond_syscall(sys_sendmsg);
cond_syscall(compat_sys_sendmsg);
cond_syscall(sys_recvmsg);
cond_syscall(compat_sys_recvmsg);
cond_syscall(sys_socketcall);
cond_syscall(sys_futex);
cond_syscall(compat_sys_futex);
Expand Down
112 changes: 59 additions & 53 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3496,6 +3496,60 @@ static void net_set_todo(struct net_device *dev)
spin_unlock(&net_todo_list_lock);
}

static void rollback_registered(struct net_device *dev)
{
BUG_ON(dev_boot_phase);
ASSERT_RTNL();

/* Some devices call without registering for initialization unwind. */
if (dev->reg_state == NETREG_UNINITIALIZED) {
printk(KERN_DEBUG "unregister_netdevice: device %s/%p never "
"was registered\n", dev->name, dev);

WARN_ON(1);
return;
}

BUG_ON(dev->reg_state != NETREG_REGISTERED);

/* If device is running, close it first. */
dev_close(dev);

/* And unlink it from device chain. */
unlist_netdevice(dev);

dev->reg_state = NETREG_UNREGISTERING;

synchronize_net();

/* Shutdown queueing discipline. */
dev_shutdown(dev);


/* Notify protocols, that we are about to destroy
this device. They should clean all the things.
*/
call_netdevice_notifiers(NETDEV_UNREGISTER, dev);

/*
* Flush the unicast and multicast chains
*/
dev_addr_discard(dev);

if (dev->uninit)
dev->uninit(dev);

/* Notifier chain MUST detach us from master device. */
BUG_TRAP(!dev->master);

/* Remove entries from kobject tree */
netdev_unregister_kobject(dev);

synchronize_net();

dev_put(dev);
}

/**
* register_netdevice - register a network device
* @dev: device to register
Expand Down Expand Up @@ -3633,8 +3687,10 @@ int register_netdevice(struct net_device *dev)
/* Notify protocols, that a new device appeared. */
ret = call_netdevice_notifiers(NETDEV_REGISTER, dev);
ret = notifier_to_errno(ret);
if (ret)
unregister_netdevice(dev);
if (ret) {
rollback_registered(dev);
dev->reg_state = NETREG_UNREGISTERED;
}

out:
return ret;
Expand Down Expand Up @@ -3911,59 +3967,9 @@ void synchronize_net(void)

void unregister_netdevice(struct net_device *dev)
{
BUG_ON(dev_boot_phase);
ASSERT_RTNL();

/* Some devices call without registering for initialization unwind. */
if (dev->reg_state == NETREG_UNINITIALIZED) {
printk(KERN_DEBUG "unregister_netdevice: device %s/%p never "
"was registered\n", dev->name, dev);

WARN_ON(1);
return;
}

BUG_ON(dev->reg_state != NETREG_REGISTERED);

/* If device is running, close it first. */
dev_close(dev);

/* And unlink it from device chain. */
unlist_netdevice(dev);

dev->reg_state = NETREG_UNREGISTERING;

synchronize_net();

/* Shutdown queueing discipline. */
dev_shutdown(dev);


/* Notify protocols, that we are about to destroy
this device. They should clean all the things.
*/
call_netdevice_notifiers(NETDEV_UNREGISTER, dev);

/*
* Flush the unicast and multicast chains
*/
dev_addr_discard(dev);

if (dev->uninit)
dev->uninit(dev);

/* Notifier chain MUST detach us from master device. */
BUG_TRAP(!dev->master);

/* Remove entries from kobject tree */
netdev_unregister_kobject(dev);

rollback_registered(dev);
/* Finish processing unregister after unlock */
net_set_todo(dev);

synchronize_net();

dev_put(dev);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions net/core/net_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ static int setup_net(struct net *net)
if (ops->exit)
ops->exit(net);
}

rcu_barrier();
goto out;
}

Expand Down
16 changes: 13 additions & 3 deletions net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -2028,8 +2028,8 @@ void __init skb_init(void)
* Fill the specified scatter-gather list with mappings/pointers into a
* region of the buffer space attached to a socket buffer.
*/
int
skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
static int
__skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
{
int start = skb_headlen(skb);
int i, copy = start - offset;
Expand Down Expand Up @@ -2078,7 +2078,8 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
if ((copy = end - offset) > 0) {
if (copy > len)
copy = len;
elt += skb_to_sgvec(list, sg+elt, offset - start, copy);
elt += __skb_to_sgvec(list, sg+elt, offset - start,
copy);
if ((len -= copy) == 0)
return elt;
offset += copy;
Expand All @@ -2090,6 +2091,15 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
return elt;
}

int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
{
int nsg = __skb_to_sgvec(skb, sg, offset, len);

__sg_mark_end(&sg[nsg - 1]);

return nsg;
}

/**
* skb_cow_data - Check that a socket buffer's data buffers are writable
* @skb: The socket buffer to check.
Expand Down
12 changes: 7 additions & 5 deletions net/ipv4/esp4.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
goto unlock;
}
sg_init_table(sg, nfrags);
sg_mark_end(sg, skb_to_sgvec(skb, sg, esph->enc_data +
esp->conf.ivlen -
skb->data, clen));
skb_to_sgvec(skb, sg,
esph->enc_data +
esp->conf.ivlen -
skb->data, clen);
err = crypto_blkcipher_encrypt(&desc, sg, sg, clen);
if (unlikely(sg != &esp->sgbuf[0]))
kfree(sg);
Expand Down Expand Up @@ -205,8 +206,9 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
goto out;
}
sg_init_table(sg, nfrags);
sg_mark_end(sg, skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen,
elen));
skb_to_sgvec(skb, sg,
sizeof(*esph) + esp->conf.ivlen,
elen);
err = crypto_blkcipher_decrypt(&desc, sg, sg, elen);
if (unlikely(sg != &esp->sgbuf[0]))
kfree(sg);
Expand Down
Loading

0 comments on commit dd13810

Please sign in to comment.