Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [8021Q]: vlan_ioctl_handler: fix return value
  [GENETLINK]: Correctly report errors while registering a multicast group
  [GENETLINK]: Fix adjustment of number of multicast groups
  [GENETLINK]: Fix race in genl_unregister_mc_groups()
  [NETFILTER]: Clean up duplicate includes in net/netfilter/
  [NETFILTER]: Clean up duplicate includes in net/bridge/
  [NETFILTER]: Fix logging regression
  [TCPv6] MD5SIG: Ensure to reset allocation count to avoid panic.
This commit is contained in:
Linus Torvalds 2007-07-24 15:57:12 -07:00
commit 03746bad30
11 changed files with 29 additions and 34 deletions

View File

@ -810,6 +810,7 @@ static int vlan_ioctl_handler(void __user *arg)
err = -EINVAL; err = -EINVAL;
break; break;
case GET_VLAN_REALDEV_NAME_CMD: case GET_VLAN_REALDEV_NAME_CMD:
err = 0;
vlan_dev_get_realdev_name(dev, args.u.device2); vlan_dev_get_realdev_name(dev, args.u.device2);
if (copy_to_user(arg, &args, if (copy_to_user(arg, &args,
sizeof(struct vlan_ioctl_args))) { sizeof(struct vlan_ioctl_args))) {
@ -818,6 +819,7 @@ static int vlan_ioctl_handler(void __user *arg)
break; break;
case GET_VLAN_VID_CMD: case GET_VLAN_VID_CMD:
err = 0;
vlan_dev_get_vid(dev, &vid); vlan_dev_get_vid(dev, &vid);
args.u.VID = vid; args.u.VID = vid;
if (copy_to_user(arg, &args, if (copy_to_user(arg, &args,

View File

@ -9,7 +9,6 @@
* *
*/ */
#include <linux/in.h>
#include <linux/netfilter_bridge/ebtables.h> #include <linux/netfilter_bridge/ebtables.h>
#include <linux/netfilter_bridge/ebt_log.h> #include <linux/netfilter_bridge/ebt_log.h>
#include <linux/netfilter.h> #include <linux/netfilter.h>
@ -196,10 +195,8 @@ static int __init ebt_log_init(void)
ret = ebt_register_watcher(&log); ret = ebt_register_watcher(&log);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = nf_log_register(PF_BRIDGE, &ebt_log_logger); nf_log_register(PF_BRIDGE, &ebt_log_logger);
if (ret < 0 && ret != -EEXIST) return 0;
ebt_unregister_watcher(&log);
return ret;
} }
static void __exit ebt_log_fini(void) static void __exit ebt_log_fini(void)

View File

@ -36,7 +36,6 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/netlink.h> #include <linux/netlink.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/module.h>
#include <linux/netfilter_bridge/ebtables.h> #include <linux/netfilter_bridge/ebtables.h>
#include <linux/netfilter_bridge/ebt_ulog.h> #include <linux/netfilter_bridge/ebt_ulog.h>
#include <net/sock.h> #include <net/sock.h>
@ -308,12 +307,8 @@ static int __init ebt_ulog_init(void)
else if ((ret = ebt_register_watcher(&ulog))) else if ((ret = ebt_register_watcher(&ulog)))
sock_release(ebtulognl->sk_socket); sock_release(ebtulognl->sk_socket);
if (nf_log_register(PF_BRIDGE, &ebt_ulog_logger) < 0) { if (ret == 0)
printk(KERN_WARNING "ebt_ulog: not logging via ulog " nf_log_register(PF_BRIDGE, &ebt_ulog_logger);
"since somebody else already registered for PF_BRIDGE\n");
/* we cannot make module load fail here, since otherwise
* ebtables userspace would abort */
}
return ret; return ret;
} }

View File

@ -479,10 +479,8 @@ static int __init ipt_log_init(void)
ret = xt_register_target(&ipt_log_reg); ret = xt_register_target(&ipt_log_reg);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = nf_log_register(PF_INET, &ipt_log_logger); nf_log_register(PF_INET, &ipt_log_logger);
if (ret < 0 && ret != -EEXIST) return 0;
xt_unregister_target(&ipt_log_reg);
return ret;
} }
static void __exit ipt_log_fini(void) static void __exit ipt_log_fini(void)

View File

@ -493,10 +493,8 @@ static int __init ip6t_log_init(void)
ret = xt_register_target(&ip6t_log_reg); ret = xt_register_target(&ip6t_log_reg);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = nf_log_register(PF_INET6, &ip6t_logger); nf_log_register(PF_INET6, &ip6t_logger);
if (ret < 0 && ret != -EEXIST) return 0;
xt_unregister_target(&ip6t_log_reg);
return ret;
} }
static void __exit ip6t_log_fini(void) static void __exit ip6t_log_fini(void)

View File

@ -633,6 +633,7 @@ static int tcp_v6_md5_do_del(struct sock *sk, struct in6_addr *peer)
if (tp->md5sig_info->entries6 == 0) { if (tp->md5sig_info->entries6 == 0) {
kfree(tp->md5sig_info->keys6); kfree(tp->md5sig_info->keys6);
tp->md5sig_info->keys6 = NULL; tp->md5sig_info->keys6 = NULL;
tp->md5sig_info->alloced6 = 0;
tcp_free_md5sig_pool(); tcp_free_md5sig_pool();

View File

@ -8,7 +8,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/netfilter.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/in.h> #include <linux/in.h>
#include <linux/tcp.h> #include <linux/tcp.h>

View File

@ -9,7 +9,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/netfilter.h>
#include <linux/udp.h> #include <linux/udp.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>

View File

@ -10,7 +10,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/netfilter.h>
#include <linux/udp.h> #include <linux/udp.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>

View File

@ -13,7 +13,6 @@
#include <linux/netfilter_bridge.h> #include <linux/netfilter_bridge.h>
#include <linux/netfilter/xt_physdev.h> #include <linux/netfilter/xt_physdev.h>
#include <linux/netfilter/x_tables.h> #include <linux/netfilter/x_tables.h>
#include <linux/netfilter_bridge.h>
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>"); MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>");

View File

@ -184,7 +184,7 @@ int genl_register_mc_group(struct genl_family *family,
} }
err = netlink_change_ngroups(genl_sock, err = netlink_change_ngroups(genl_sock,
sizeof(unsigned long) * NETLINK_GENERIC); mc_groups_longs * BITS_PER_LONG);
if (err) if (err)
goto out; goto out;
@ -196,10 +196,22 @@ int genl_register_mc_group(struct genl_family *family,
genl_ctrl_event(CTRL_CMD_NEWMCAST_GRP, grp); genl_ctrl_event(CTRL_CMD_NEWMCAST_GRP, grp);
out: out:
genl_unlock(); genl_unlock();
return 0; return err;
} }
EXPORT_SYMBOL(genl_register_mc_group); EXPORT_SYMBOL(genl_register_mc_group);
static void __genl_unregister_mc_group(struct genl_family *family,
struct genl_multicast_group *grp)
{
BUG_ON(grp->family != family);
netlink_clear_multicast_users(genl_sock, grp->id);
clear_bit(grp->id, mc_groups);
list_del(&grp->list);
genl_ctrl_event(CTRL_CMD_DELMCAST_GRP, grp);
grp->id = 0;
grp->family = NULL;
}
/** /**
* genl_unregister_mc_group - unregister a multicast group * genl_unregister_mc_group - unregister a multicast group
* *
@ -217,14 +229,8 @@ EXPORT_SYMBOL(genl_register_mc_group);
void genl_unregister_mc_group(struct genl_family *family, void genl_unregister_mc_group(struct genl_family *family,
struct genl_multicast_group *grp) struct genl_multicast_group *grp)
{ {
BUG_ON(grp->family != family);
genl_lock(); genl_lock();
netlink_clear_multicast_users(genl_sock, grp->id); __genl_unregister_mc_group(family, grp);
clear_bit(grp->id, mc_groups);
list_del(&grp->list);
genl_ctrl_event(CTRL_CMD_DELMCAST_GRP, grp);
grp->id = 0;
grp->family = NULL;
genl_unlock(); genl_unlock();
} }
@ -232,8 +238,10 @@ static void genl_unregister_mc_groups(struct genl_family *family)
{ {
struct genl_multicast_group *grp, *tmp; struct genl_multicast_group *grp, *tmp;
genl_lock();
list_for_each_entry_safe(grp, tmp, &family->mcast_groups, list) list_for_each_entry_safe(grp, tmp, &family->mcast_groups, list)
genl_unregister_mc_group(family, grp); __genl_unregister_mc_group(family, grp);
genl_unlock();
} }
/** /**