Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
authorDavid S. Miller <davem@davemloft.net>
Wed, 3 Dec 2008 03:50:27 +0000 (19:50 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 3 Dec 2008 03:50:27 +0000 (19:50 -0800)
Conflicts:

drivers/net/ixgbe/ixgbe_main.c
drivers/net/smc91x.c

1  2 
MAINTAINERS
drivers/media/dvb/dm1105/dm1105.c
drivers/net/Kconfig
drivers/net/macvlan.c
drivers/net/smc911x.c
drivers/net/smc91x.c
drivers/net/xen-netfront.c
net/unix/af_unix.c
net/unix/garbage.c

diff --combined MAINTAINERS
@@@ -742,7 -742,7 +742,7 @@@ M: jirislaby@gmail.co
  P:    Nick Kossifidis
  M:    mickflemm@gmail.com
  P:    Luis R. Rodriguez
 -M:    mcgrof@gmail.com
 +M:    lrodriguez@atheros.com
  P:    Bob Copeland
  M:    me@bobcopeland.com
  L:    linux-wireless@vger.kernel.org
@@@ -779,6 -779,7 +779,7 @@@ AT
  P:    Chas Williams
  M:    chas@cmf.nrl.navy.mil
  L:    linux-atm-general@lists.sourceforge.net (subscribers-only)
+ L:    netdev@vger.kernel.org
  W:    http://linux-atm.sourceforge.net
  S:    Maintained
  
@@@ -1606,6 -1607,11 +1607,6 @@@ L:     acpi4asus-user@lists.sourceforge.ne
  W:    http://sourceforge.net/projects/acpi4asus
  S:    Maintained
  
 -EEPRO100 NETWORK DRIVER
 -P:    Andrey V. Savochkin
 -M:    saw@saw.sw.com.sg
 -S:    Maintained
 -
  EFS FILESYSTEM
  W:    http://aeschi.ch.eu.org/efs/
  S:    Orphan
@@@ -3608,26 -3614,16 +3609,26 @@@ L:   linux-hams@vger.kernel.or
  W:    http://www.linux-ax25.org/
  S:    Maintained
  
 -RTL818X WIRELESS DRIVER
 -P:    Michael Wu
 -M:    flamingice@sourmilk.net
 -P:    Andrea Merello
 -M:    andreamrl@tiscali.it
 +RTL8180 WIRELESS DRIVER
 +P:    John W. Linville
 +M:    linville@tuxdriver.com
  L:    linux-wireless@vger.kernel.org
  W:    http://linuxwireless.org/
 -T:    git kernel.org:/pub/scm/linux/kernel/git/mwu/mac80211-drivers.git
 +T:    git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-testing.git
  S:    Maintained
  
 +RTL8187 WIRELESS DRIVER
 +P:     Herton Ronaldo Krzesinski
 +M:      herton@mandriva.com.br
 +P:      Hin-Tak Leung
 +M       htl10@users.sourceforge.net
 +P:      Larry Finger
 +M:      Larry.Finger@lwfinger.net
 +L:      linux-wireless@vger.kernel.org
 +W:      http://linuxwireless.org/
 +T:      git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-testing.git
 +S:      Maintained
 +
  S3 SAVAGE FRAMEBUFFER DRIVER
  P:    Antonino Daplas
  M:    adaplas@gmail.com
@@@ -3908,12 -3904,6 +3909,12 @@@ M:    mhoffman@lightlink.co
  L:    lm-sensors@lm-sensors.org
  S:    Maintained
  
 +SMSC911x ETHERNET DRIVER
 +P:    Steve Glendinning
 +M:    steve.glendinning@smsc.com
 +L:    netdev@vger.kernel.org
 +S:    Supported
 +
  SMX UIO Interface
  P:    Ben Nizette
  M:    bn@niasdigital.com
@@@ -4246,7 -4236,7 +4247,7 @@@ M:      dedekind@infradead.or
  P:    Adrian Hunter
  M:    ext-adrian.hunter@nokia.com
  L:    linux-mtd@lists.infradead.org
- T:    git git://git.infradead.org/~dedekind/ubifs-2.6.git
+ T:    git git://git.infradead.org/ubifs-2.6.git
  W:    http://www.linux-mtd.infradead.org/doc/ubifs.html
  S:    Maintained
  
@@@ -4300,7 -4290,7 +4301,7 @@@ P:      Artem Bityutski
  M:    dedekind@infradead.org
  W:    http://www.linux-mtd.infradead.org/
  L:    linux-mtd@lists.infradead.org
- T:    git git://git.infradead.org/~dedekind/ubi-2.6.git
+ T:    git git://git.infradead.org/ubi-2.6.git
  S:    Maintained
  
  USB ACM DRIVER
@@@ -376,7 -376,7 +376,7 @@@ static void dm1105dvb_dma_unmap(struct 
        pci_free_consistent(dm1105dvb->pdev, 6*DM1105_DMA_BYTES, dm1105dvb->ts_buf, dm1105dvb->dma_addr);
  }
  
- static void __devinit dm1105dvb_enable_irqs(struct dm1105dvb *dm1105dvb)
+ static void dm1105dvb_enable_irqs(struct dm1105dvb *dm1105dvb)
  {
        outb(INTMAK_ALLMASK, dm_io_mem(DM1105_INTMAK));
        outb(1, dm_io_mem(DM1105_CR));
@@@ -697,7 -697,8 +697,7 @@@ static void __devinit dm1105dvb_read_ma
        };
  
        dm1105_i2c_xfer(&dm1105dvb->i2c_adap, msg , 2);
 -      dev_info(&dm1105dvb->pdev->dev, "MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
 -                      mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
 +      dev_info(&dm1105dvb->pdev->dev, "MAC %pM\n", mac);
  }
  
  static int __devinit dm1105_probe(struct pci_dev *pdev,
diff --combined drivers/net/Kconfig
@@@ -61,7 -61,6 +61,7 @@@ config DUMM
  config BONDING
        tristate "Bonding driver support"
        depends on INET
 +      depends on IPV6 || IPV6=n
        ---help---
          Say 'Y' or 'M' if you wish to be able to 'bond' multiple Ethernet
          Channels together. This is called 'Etherchannel' by Cisco,
@@@ -979,20 -978,6 +979,20 @@@ config SMC911
          called smc911x.  If you want to compile it as a module, say M 
          here and read <file:Documentation/kbuild/modules.txt>
  
 +config SMSC911X
 +      tristate "SMSC LAN911x/LAN921x families embedded ethernet support"
 +      depends on ARM || SUPERH
 +      select CRC32
 +      select MII
 +      select PHYLIB
 +      ---help---
 +        Say Y here if you want support for SMSC LAN911x and LAN921x families
 +        of ethernet controllers.
 +
 +        To compile this driver as a module, choose M here and read
 +        <file:Documentation/networking/net-modules.txt>. The module
 +        will be called smsc911x.
 +
  config NET_VENDOR_RACAL
        bool "Racal-Interlan (Micom) NI cards"
        depends on ISA
@@@ -1429,6 -1414,19 +1429,6 @@@ config TC3581
        depends on NET_PCI && PCI && MIPS
        select PHYLIB
  
 -config EEPRO100
 -      tristate "EtherExpressPro/100 support (eepro100, original Becker driver)"
 -      depends on NET_PCI && PCI
 -      select MII
 -      help
 -        If you have an Intel EtherExpress PRO/100 PCI network (Ethernet)
 -        card, say Y and read the Ethernet-HOWTO, available from
 -        <http://www.tldp.org/docs.html#howto>.
 -
 -        To compile this driver as a module, choose M here. The module
 -        will be called eepro100.
 -
 -
  config E100
        tristate "Intel(R) PRO/100+ support"
        depends on NET_PCI && PCI
@@@ -1827,9 -1825,10 +1827,10 @@@ config FEC
  
  config FEC_MPC52xx
        tristate "MPC52xx FEC driver"
-       depends on PPC_MPC52xx && PPC_BESTCOMM_FEC
+       depends on PPC_MPC52xx && PPC_BESTCOMM
        select CRC32
        select PHYLIB
+       select PPC_BESTCOMM_FEC
        ---help---
          This option enables support for the MPC5200's on-chip
          Fast Ethernet Controller
@@@ -1982,10 -1981,10 +1983,10 @@@ config IP100
          will be called ipg.  This is recommended.
  
  config IGB
 -       tristate "Intel(R) 82575 PCI-Express Gigabit Ethernet support"
 +       tristate "Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support"
         depends on PCI
         ---help---
 -         This driver supports Intel(R) 82575 gigabit ethernet family of
 +         This driver supports Intel(R) 82575/82576 gigabit ethernet family of
           adapters.  For more information on how to identify your adapter, go
           to the Adapter & Driver ID Guide at:
  
@@@ -2451,16 -2450,6 +2452,16 @@@ config IXGBE_DC
          driver.  DCA is a method for warming the CPU cache before data
          is used, with the intent of lessening the impact of cache misses.
  
 +config IXGBE_DCB
 +      bool "Data Center Bridging (DCB) Support"
 +      default n
 +      depends on IXGBE && DCB
 +      ---help---
 +        Say Y here if you want to use Data Center Bridging (DCB) in the
 +        driver.
 +
 +        If unsure, say N.
 +
  config IXGB
        tristate "Intel(R) PRO/10GbE support"
        depends on PCI
diff --combined drivers/net/macvlan.c
@@@ -70,6 -70,9 +70,9 @@@ static void macvlan_broadcast(struct sk
        struct sk_buff *nskb;
        unsigned int i;
  
+       if (skb->protocol == htons(ETH_P_PAUSE))
+               return;
        for (i = 0; i < MACVLAN_HASH_SIZE; i++) {
                hlist_for_each_entry_rcu(vlan, n, &port->vlan_hash[i], hlist) {
                        dev = vlan->dev;
@@@ -84,6 -87,7 +87,6 @@@
                        dev->stats.rx_bytes += skb->len + ETH_HLEN;
                        dev->stats.rx_packets++;
                        dev->stats.multicast++;
 -                      dev->last_rx = jiffies;
  
                        nskb->dev = dev;
                        if (!compare_ether_addr(eth->h_dest, dev->broadcast))
@@@ -132,6 -136,7 +135,6 @@@ static struct sk_buff *macvlan_handle_f
  
        dev->stats.rx_bytes += skb->len + ETH_HLEN;
        dev->stats.rx_packets++;
 -      dev->last_rx = jiffies;
  
        skb->dev = dev;
        skb->pkt_type = PACKET_HOST;
        return NULL;
  }
  
 -static int macvlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 +static int macvlan_start_xmit(struct sk_buff *skb, struct net_device *dev)
  {
        const struct macvlan_dev *vlan = netdev_priv(dev);
        unsigned int len = skb->len;
@@@ -331,53 -336,24 +334,53 @@@ static u32 macvlan_ethtool_get_rx_csum(
        return lowerdev->ethtool_ops->get_rx_csum(lowerdev);
  }
  
 +static int macvlan_ethtool_get_settings(struct net_device *dev,
 +                                      struct ethtool_cmd *cmd)
 +{
 +      const struct macvlan_dev *vlan = netdev_priv(dev);
 +      struct net_device *lowerdev = vlan->lowerdev;
 +
 +      if (!lowerdev->ethtool_ops->get_settings)
 +              return -EOPNOTSUPP;
 +
 +      return lowerdev->ethtool_ops->get_settings(lowerdev, cmd);
 +}
 +
 +static u32 macvlan_ethtool_get_flags(struct net_device *dev)
 +{
 +      const struct macvlan_dev *vlan = netdev_priv(dev);
 +      struct net_device *lowerdev = vlan->lowerdev;
 +
 +      if (!lowerdev->ethtool_ops->get_flags)
 +              return 0;
 +      return lowerdev->ethtool_ops->get_flags(lowerdev);
 +}
 +
  static const struct ethtool_ops macvlan_ethtool_ops = {
        .get_link               = ethtool_op_get_link,
 +      .get_settings           = macvlan_ethtool_get_settings,
        .get_rx_csum            = macvlan_ethtool_get_rx_csum,
        .get_drvinfo            = macvlan_ethtool_get_drvinfo,
 +      .get_flags              = macvlan_ethtool_get_flags,
 +};
 +
 +static const struct net_device_ops macvlan_netdev_ops = {
 +      .ndo_init               = macvlan_init,
 +      .ndo_open               = macvlan_open,
 +      .ndo_stop               = macvlan_stop,
 +      .ndo_start_xmit         = macvlan_start_xmit,
 +      .ndo_change_mtu         = macvlan_change_mtu,
 +      .ndo_change_rx_flags    = macvlan_change_rx_flags,
 +      .ndo_set_mac_address    = macvlan_set_mac_address,
 +      .ndo_set_multicast_list = macvlan_set_multicast_list,
 +      .ndo_validate_addr      = eth_validate_addr,
  };
  
  static void macvlan_setup(struct net_device *dev)
  {
        ether_setup(dev);
  
 -      dev->init               = macvlan_init;
 -      dev->open               = macvlan_open;
 -      dev->stop               = macvlan_stop;
 -      dev->change_mtu         = macvlan_change_mtu;
 -      dev->change_rx_flags    = macvlan_change_rx_flags;
 -      dev->set_mac_address    = macvlan_set_mac_address;
 -      dev->set_multicast_list = macvlan_set_multicast_list;
 -      dev->hard_start_xmit    = macvlan_hard_start_xmit;
 +      dev->netdev_ops         = &macvlan_netdev_ops;
        dev->destructor         = free_netdev;
        dev->header_ops         = &macvlan_hard_header_ops,
        dev->ethtool_ops        = &macvlan_ethtool_ops;
diff --combined drivers/net/smc911x.c
@@@ -439,6 -439,7 +439,6 @@@ static inline void  smc911x_rcv(struct 
  
                DBG(SMC_DEBUG_PKTS, "%s: Received packet\n", dev->name);
                PRINT_PKT(data, ((pkt_len - 4) <= 64) ? pkt_len - 4 : 64);
 -              dev->last_rx = jiffies;
                skb->protocol = eth_type_trans(skb, dev);
                netif_rx(skb);
                dev->stats.rx_packets++;
@@@ -1230,6 -1231,7 +1230,6 @@@ smc911x_rx_dma_irq(int dma, void *data
        BUG_ON(skb == NULL);
        lp->current_rx_skb = NULL;
        PRINT_PKT(skb->data, skb->len);
 -      dev->last_rx = jiffies;
        skb->protocol = eth_type_trans(skb, dev);
        dev->stats.rx_packets++;
        dev->stats.rx_bytes += skb->len;
@@@ -1733,7 -1735,7 +1733,7 @@@ static const struct ethtool_ops smc911x
   * This routine has a simple purpose -- make the SMC chip generate an
   * interrupt, so an auto-detect routine can detect it, and find the IRQ,
   */
- static int __init smc911x_findirq(struct net_device *dev)
+ static int __devinit smc911x_findirq(struct net_device *dev)
  {
        struct smc911x_local *lp = netdev_priv(dev);
        int timeout = 20;
   * o  actually GRAB the irq.
   * o  GRAB the region
   */
- static int __init smc911x_probe(struct net_device *dev)
+ static int __devinit smc911x_probe(struct net_device *dev)
  {
        struct smc911x_local *lp = netdev_priv(dev);
        int i, retval;
@@@ -2046,7 -2048,7 +2046,7 @@@ err_out
   *     0 --> there is a device
   *     anything else, error
   */
- static int smc911x_drv_probe(struct platform_device *pdev)
+ static int __devinit smc911x_drv_probe(struct platform_device *pdev)
  {
  #ifdef SMC_DYNAMIC_BUS_CONFIG
        struct smc911x_platdata *pd = pdev->dev.platform_data;
@@@ -2122,7 -2124,7 +2122,7 @@@ out
        return ret;
  }
  
- static int smc911x_drv_remove(struct platform_device *pdev)
+ static int __devexit smc911x_drv_remove(struct platform_device *pdev)
  {
        struct net_device *ndev = platform_get_drvdata(pdev);
        struct smc911x_local *lp = netdev_priv(ndev);
@@@ -2193,7 -2195,7 +2193,7 @@@ static int smc911x_drv_resume(struct pl
  
  static struct platform_driver smc911x_driver = {
        .probe           = smc911x_drv_probe,
-       .remove  = smc911x_drv_remove,
+       .remove  = __devexit_p(smc911x_drv_remove),
        .suspend         = smc911x_drv_suspend,
        .resume  = smc911x_drv_resume,
        .driver  = {
diff --combined drivers/net/smc91x.c
@@@ -518,6 -518,7 +518,6 @@@ static inline void  smc_rcv(struct net_
  
                PRINT_PKT(data, packet_len - 4);
  
 -              dev->last_rx = jiffies;
                skb->protocol = eth_type_trans(skb, dev);
                netif_rx(skb);
                dev->stats.rx_packets++;
@@@ -1695,7 -1696,7 +1695,7 @@@ static const struct ethtool_ops smc_eth
   * I just deleted auto_irq.c, since it was never built...
   *   --jgarzik
   */
- static int __init smc_findirq(struct smc_local *lp)
+ static int __devinit smc_findirq(struct smc_local *lp)
  {
        void __iomem *ioaddr = lp->base;
        int timeout = 20;
   * o  actually GRAB the irq.
   * o  GRAB the region
   */
- static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr,
+ static int __devinit smc_probe(struct net_device *dev, void __iomem *ioaddr,
                            unsigned long irq_flags)
  {
        struct smc_local *lp = netdev_priv(dev);
        int retval;
        unsigned int val, revision_register;
        const char *version_string;
 -      DECLARE_MAC_BUF(mac);
  
        DBG(2, "%s: %s\n", CARDNAME, __func__);
  
                               "set using ifconfig\n", dev->name);
                } else {
                        /* Print the Ethernet address */
 -                      printk("%s: Ethernet addr: %s\n",
 -                             dev->name, print_mac(mac, dev->dev_addr));
 +                      printk("%s: Ethernet addr: %pM\n",
 +                             dev->name, dev->dev_addr);
                }
  
                if (lp->phy_type == 0) {
@@@ -2124,7 -2126,7 +2124,7 @@@ static void smc_release_datacs(struct p
   *    0 --> there is a device
   *    anything else, error
   */
- static int __init smc_drv_probe(struct platform_device *pdev)
+ static int __devinit smc_drv_probe(struct platform_device *pdev)
  {
        struct smc91x_platdata *pd = pdev->dev.platform_data;
        struct smc_local *lp;
        return ret;
  }
  
- static int smc_drv_remove(struct platform_device *pdev)
+ static int __devexit smc_drv_remove(struct platform_device *pdev)
  {
        struct net_device *ndev = platform_get_drvdata(pdev);
        struct smc_local *lp = netdev_priv(ndev);
@@@ -2303,7 -2305,7 +2303,7 @@@ static int smc_drv_resume(struct platfo
  
  static struct platform_driver smc_driver = {
        .probe          = smc_drv_probe,
-       .remove         = smc_drv_remove,
+       .remove         = __devexit_p(smc_drv_remove),
        .suspend        = smc_drv_suspend,
        .resume         = smc_drv_resume,
        .driver         = {
@@@ -841,6 -841,7 +841,6 @@@ static int handle_incoming_queue(struc
  
                /* Pass it up. */
                netif_receive_skb(skb);
 -              dev->last_rx = jiffies;
        }
  
        return packets_dropped;
@@@ -1784,7 -1785,7 +1784,7 @@@ static int __devexit xennet_remove(stru
        return 0;
  }
  
- static struct xenbus_driver netfront = {
+ static struct xenbus_driver netfront_driver = {
        .name = "vif",
        .owner = THIS_MODULE,
        .ids = netfront_ids,
@@@ -1804,7 -1805,7 +1804,7 @@@ static int __init netif_init(void
  
        printk(KERN_INFO "Initialising Xen virtual ethernet driver.\n");
  
-       return xenbus_register_frontend(&netfront);
+       return xenbus_register_frontend(&netfront_driver);
  }
  module_init(netif_init);
  
@@@ -1814,7 -1815,7 +1814,7 @@@ static void __exit netif_exit(void
        if (xen_initial_domain())
                return;
  
-       xenbus_unregister_driver(&netfront);
+       xenbus_unregister_driver(&netfront_driver);
  }
  module_exit(netif_exit);
  
diff --combined net/unix/af_unix.c
@@@ -164,7 -164,7 +164,7 @@@ static inline int unix_our_peer(struct 
  
  static inline int unix_may_send(struct sock *sk, struct sock *osk)
  {
 -      return (unix_peer(osk) == NULL || unix_our_peer(sk, osk));
 +      return unix_peer(osk) == NULL || unix_our_peer(sk, osk);
  }
  
  static inline int unix_recvq_full(struct sock const *sk)
@@@ -197,7 -197,7 +197,7 @@@ static inline void unix_release_addr(st
   *            - if started by zero, it is abstract name.
   */
  
 -static int unix_mkname(struct sockaddr_un * sunaddr, int len, unsigned *hashp)
 +static int unix_mkname(struct sockaddr_un *sunaddr, int len, unsigned *hashp)
  {
        if (len <= sizeof(short) || len > sizeof(*sunaddr))
                return -EINVAL;
                 * we are guaranteed that it is a valid memory location in our
                 * kernel address buffer.
                 */
 -              ((char *)sunaddr)[len]=0;
 +              ((char *)sunaddr)[len] = 0;
                len = strlen(sunaddr->sun_path)+1+sizeof(short);
                return len;
        }
  
 -      *hashp = unix_hash_fold(csum_partial((char*)sunaddr, len, 0));
 +      *hashp = unix_hash_fold(csum_partial(sunaddr, len, 0));
        return len;
  }
  
@@@ -295,7 -295,8 +295,7 @@@ static struct sock *unix_find_socket_by
                if (!net_eq(sock_net(s), net))
                        continue;
  
 -              if(dentry && dentry->d_inode == i)
 -              {
 +              if (dentry && dentry->d_inode == i) {
                        sock_hold(s);
                        goto found;
                }
@@@ -353,7 -354,7 +353,7 @@@ static void unix_sock_destructor(struc
        WARN_ON(!sk_unhashed(sk));
        WARN_ON(sk->sk_socket);
        if (!sock_flag(sk, SOCK_DEAD)) {
 -              printk("Attempt to release alive unix socket: %p\n", sk);
 +              printk(KERN_INFO "Attempt to release alive unix socket: %p\n", sk);
                return;
        }
  
                unix_release_addr(u->addr);
  
        atomic_dec(&unix_nr_socks);
 +      local_bh_disable();
 +      sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
 +      local_bh_enable();
  #ifdef UNIX_REFCNT_DEBUG
 -      printk(KERN_DEBUG "UNIX %p is destroyed, %d are still alive.\n", sk, atomic_read(&unix_nr_socks));
 +      printk(KERN_DEBUG "UNIX %p is destroyed, %d are still alive.\n", sk,
 +              atomic_read(&unix_nr_socks));
  #endif
  }
  
 -static int unix_release_sock (struct sock *sk, int embrion)
 +static int unix_release_sock(struct sock *sk, int embrion)
  {
        struct unix_sock *u = unix_sk(sk);
        struct dentry *dentry;
  
        wake_up_interruptible_all(&u->peer_wait);
  
 -      skpair=unix_peer(sk);
 +      skpair = unix_peer(sk);
  
 -      if (skpair!=NULL) {
 +      if (skpair != NULL) {
                if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) {
                        unix_state_lock(skpair);
                        /* No more writes */
        /* Try to flush out this socket. Throw out buffers at least */
  
        while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
 -              if (state==TCP_LISTEN)
 +              if (state == TCP_LISTEN)
                        unix_release_sock(skb->sk, 1);
                /* passed fds are erased in the kfree_skb hook        */
                kfree_skb(skb);
@@@ -456,11 -453,11 +456,11 @@@ static int unix_listen(struct socket *s
        struct unix_sock *u = unix_sk(sk);
  
        err = -EOPNOTSUPP;
 -      if (sock->type!=SOCK_STREAM && sock->type!=SOCK_SEQPACKET)
 -              goto out;                       /* Only stream/seqpacket sockets accept */
 +      if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET)
 +              goto out;       /* Only stream/seqpacket sockets accept */
        err = -EINVAL;
        if (!u->addr)
 -              goto out;                       /* No listens on an unbound socket */
 +              goto out;       /* No listens on an unbound socket */
        unix_state_lock(sk);
        if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN)
                goto out_unlock;
@@@ -569,9 -566,9 +569,9 @@@ static const struct proto_ops unix_seqp
  };
  
  static struct proto unix_proto = {
 -      .name     = "UNIX",
 -      .owner    = THIS_MODULE,
 -      .obj_size = sizeof(struct unix_sock),
 +      .name                   = "UNIX",
 +      .owner                  = THIS_MODULE,
 +      .obj_size               = sizeof(struct unix_sock),
  };
  
  /*
   */
  static struct lock_class_key af_unix_sk_receive_queue_lock_key;
  
 -static struct sock * unix_create1(struct net *net, struct socket *sock)
 +static struct sock *unix_create1(struct net *net, struct socket *sock)
  {
        struct sock *sk = NULL;
        struct unix_sock *u;
        if (!sk)
                goto out;
  
 -      sock_init_data(sock,sk);
 +      sock_init_data(sock, sk);
        lockdep_set_class(&sk->sk_receive_queue.lock,
                                &af_unix_sk_receive_queue_lock_key);
  
  out:
        if (sk == NULL)
                atomic_dec(&unix_nr_socks);
 +      else {
 +              local_bh_disable();
 +              sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
 +              local_bh_enable();
 +      }
        return sk;
  }
  
@@@ -638,7 -630,7 +638,7 @@@ static int unix_create(struct net *net
                 *      nothing uses it.
                 */
        case SOCK_RAW:
 -              sock->type=SOCK_DGRAM;
 +              sock->type = SOCK_DGRAM;
        case SOCK_DGRAM:
                sock->ops = &unix_dgram_ops;
                break;
@@@ -661,7 -653,7 +661,7 @@@ static int unix_release(struct socket *
  
        sock->sk = NULL;
  
 -      return unix_release_sock (sk, 0);
 +      return unix_release_sock(sk, 0);
  }
  
  static int unix_autobind(struct socket *sock)
        struct net *net = sock_net(sk);
        struct unix_sock *u = unix_sk(sk);
        static u32 ordernum = 1;
 -      struct unix_address * addr;
 +      struct unix_address *addr;
        int err;
  
        mutex_lock(&u->readlock);
  
  retry:
        addr->len = sprintf(addr->name->sun_path+1, "%05x", ordernum) + 1 + sizeof(short);
 -      addr->hash = unix_hash_fold(csum_partial((void*)addr->name, addr->len, 0));
 +      addr->hash = unix_hash_fold(csum_partial(addr->name, addr->len, 0));
  
        spin_lock(&unix_table_lock);
        ordernum = (ordernum+1)&0xFFFFF;
@@@ -744,14 -736,14 +744,14 @@@ static struct sock *unix_find_other(str
  
                path_put(&path);
  
 -              err=-EPROTOTYPE;
 +              err = -EPROTOTYPE;
                if (u->sk_type != type) {
                        sock_put(u);
                        goto fail;
                }
        } else {
                err = -ECONNREFUSED;
 -              u=unix_find_socket_byname(net, sunname, len, type, hash);
 +              u = unix_find_socket_byname(net, sunname, len, type, hash);
                if (u) {
                        struct dentry *dentry;
                        dentry = unix_sk(u)->dentry;
  put_fail:
        path_put(&path);
  fail:
 -      *error=err;
 +      *error = err;
        return NULL;
  }
  
@@@ -775,8 -767,8 +775,8 @@@ static int unix_bind(struct socket *soc
        struct sock *sk = sock->sk;
        struct net *net = sock_net(sk);
        struct unix_sock *u = unix_sk(sk);
 -      struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;
 -      struct dentry * dentry = NULL;
 +      struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr;
 +      struct dentry *dentry = NULL;
        struct nameidata nd;
        int err;
        unsigned hash;
        if (sunaddr->sun_family != AF_UNIX)
                goto out;
  
 -      if (addr_len==sizeof(short)) {
 +      if (addr_len == sizeof(short)) {
                err = unix_autobind(sock);
                goto out;
        }
@@@ -883,8 -875,8 +883,8 @@@ out_mknod_unlock
        mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
        path_put(&nd.path);
  out_mknod_parent:
 -      if (err==-EEXIST)
 -              err=-EADDRINUSE;
 +      if (err == -EEXIST)
 +              err = -EADDRINUSE;
        unix_release_addr(addr);
        goto out_up;
  }
@@@ -919,7 -911,7 +919,7 @@@ static int unix_dgram_connect(struct so
  {
        struct sock *sk = sock->sk;
        struct net *net = sock_net(sk);
 -      struct sockaddr_un *sunaddr=(struct sockaddr_un*)addr;
 +      struct sockaddr_un *sunaddr = (struct sockaddr_un *)addr;
        struct sock *other;
        unsigned hash;
        int err;
                        goto out;
  
  restart:
 -              other=unix_find_other(net, sunaddr, alen, sock->type, hash, &err);
 +              other = unix_find_other(net, sunaddr, alen, sock->type, hash, &err);
                if (!other)
                        goto out;
  
         */
        if (unix_peer(sk)) {
                struct sock *old_peer = unix_peer(sk);
 -              unix_peer(sk)=other;
 +              unix_peer(sk) = other;
                unix_state_double_unlock(sk, other);
  
                if (other != old_peer)
                        unix_dgram_disconnected(sk, old_peer);
                sock_put(old_peer);
        } else {
 -              unix_peer(sk)=other;
 +              unix_peer(sk) = other;
                unix_state_double_unlock(sk, other);
        }
        return 0;
@@@ -1012,7 -1004,7 +1012,7 @@@ static long unix_wait_for_peer(struct s
  static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
                               int addr_len, int flags)
  {
 -      struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;
 +      struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr;
        struct sock *sk = sock->sk;
        struct net *net = sock_net(sk);
        struct unix_sock *u = unix_sk(sk), *newu, *otheru;
  
  static int unix_socketpair(struct socket *socka, struct socket *sockb)
  {
 -      struct sock *ska=socka->sk, *skb = sockb->sk;
 +      struct sock *ska = socka->sk, *skb = sockb->sk;
  
        /* Join our sockets back to back */
        sock_hold(ska);
        sock_hold(skb);
 -      unix_peer(ska)=skb;
 -      unix_peer(skb)=ska;
 +      unix_peer(ska) = skb;
 +      unix_peer(skb) = ska;
        ska->sk_peercred.pid = skb->sk_peercred.pid = task_tgid_vnr(current);
        ska->sk_peercred.uid = skb->sk_peercred.uid = current->euid;
        ska->sk_peercred.gid = skb->sk_peercred.gid = current->egid;
@@@ -1215,7 -1207,7 +1215,7 @@@ static int unix_accept(struct socket *s
        int err;
  
        err = -EOPNOTSUPP;
 -      if (sock->type!=SOCK_STREAM && sock->type!=SOCK_SEQPACKET)
 +      if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET)
                goto out;
  
        err = -EINVAL;
@@@ -1254,7 -1246,7 +1254,7 @@@ static int unix_getname(struct socket *
  {
        struct sock *sk = sock->sk;
        struct unix_sock *u;
 -      struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;
 +      struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr;
        int err = 0;
  
        if (peer) {
@@@ -1294,7 -1286,7 +1294,7 @@@ static void unix_detach_fds(struct scm_
        skb->destructor = sock_wfree;
        UNIXCB(skb).fp = NULL;
  
 -      for (i=scm->fp->count-1; i>=0; i--)
 +      for (i = scm->fp->count-1; i >= 0; i--)
                unix_notinflight(scm->fp->fp[i]);
  }
  
@@@ -1323,7 -1315,7 +1323,7 @@@ static int unix_attach_fds(struct scm_c
        if (!UNIXCB(skb).fp)
                return -ENOMEM;
  
 -      for (i=scm->fp->count-1; i>=0; i--)
 +      for (i = scm->fp->count-1; i >= 0; i--)
                unix_inflight(scm->fp->fp[i]);
        skb->destructor = unix_destruct_fds;
        return 0;
@@@ -1340,7 -1332,7 +1340,7 @@@ static int unix_dgram_sendmsg(struct ki
        struct sock *sk = sock->sk;
        struct net *net = sock_net(sk);
        struct unix_sock *u = unix_sk(sk);
 -      struct sockaddr_un *sunaddr=msg->msg_name;
 +      struct sockaddr_un *sunaddr = msg->msg_name;
        struct sock *other = NULL;
        int namelen = 0; /* fake GCC */
        int err;
  
        if (NULL == siocb->scm)
                siocb->scm = &tmp_scm;
+       wait_for_unix_gc();
        err = scm_send(sock, msg, siocb->scm);
        if (err < 0)
                return err;
                goto out;
  
        skb = sock_alloc_send_skb(sk, len, msg->msg_flags&MSG_DONTWAIT, &err);
 -      if (skb==NULL)
 +      if (skb == NULL)
                goto out;
  
        memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
        unix_get_secdata(siocb->scm, skb);
  
        skb_reset_transport_header(skb);
 -      err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
 +      err = memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len);
        if (err)
                goto out_free;
  
@@@ -1407,7 -1400,7 +1408,7 @@@ restart
  
                other = unix_find_other(net, sunaddr, namelen, sk->sk_type,
                                        hash, &err);
 -              if (other==NULL)
 +              if (other == NULL)
                        goto out_free;
        }
  
                err = 0;
                unix_state_lock(sk);
                if (unix_peer(sk) == other) {
 -                      unix_peer(sk)=NULL;
 +                      unix_peer(sk) = NULL;
                        unix_state_unlock(sk);
  
                        unix_dgram_disconnected(sk, other);
@@@ -1493,14 -1486,15 +1494,15 @@@ static int unix_stream_sendmsg(struct k
        struct sock_iocb *siocb = kiocb_to_siocb(kiocb);
        struct sock *sk = sock->sk;
        struct sock *other = NULL;
 -      struct sockaddr_un *sunaddr=msg->msg_name;
 -      int err,size;
 +      struct sockaddr_un *sunaddr = msg->msg_name;
 +      int err, size;
        struct sk_buff *skb;
 -      int sent=0;
 +      int sent = 0;
        struct scm_cookie tmp_scm;
  
        if (NULL == siocb->scm)
                siocb->scm = &tmp_scm;
+       wait_for_unix_gc();
        err = scm_send(sock, msg, siocb->scm);
        if (err < 0)
                return err;
        if (sk->sk_shutdown & SEND_SHUTDOWN)
                goto pipe_err;
  
 -      while(sent < len)
 -      {
 +      while (sent < len) {
                /*
                 *      Optimisation for the fact that under 0.01% of X
                 *      messages typically need breaking up.
                 *      Grab a buffer
                 */
  
 -              skb=sock_alloc_send_skb(sk,size,msg->msg_flags&MSG_DONTWAIT, &err);
 +              skb = sock_alloc_send_skb(sk, size, msg->msg_flags&MSG_DONTWAIT,
 +                                        &err);
  
 -              if (skb==NULL)
 +              if (skb == NULL)
                        goto out_err;
  
                /*
                        }
                }
  
 -              if ((err = memcpy_fromiovec(skb_put(skb,size), msg->msg_iov, size)) != 0) {
 +              err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
 +              if (err) {
                        kfree_skb(skb);
                        goto out_err;
                }
                skb_queue_tail(&other->sk_receive_queue, skb);
                unix_state_unlock(other);
                other->sk_data_ready(other, size);
 -              sent+=size;
 +              sent += size;
        }
  
        scm_destroy(siocb->scm);
@@@ -1593,8 -1586,8 +1595,8 @@@ pipe_err_free
        unix_state_unlock(other);
        kfree_skb(skb);
  pipe_err:
 -      if (sent==0 && !(msg->msg_flags&MSG_NOSIGNAL))
 -              send_sig(SIGPIPE,current,0);
 +      if (sent == 0 && !(msg->msg_flags&MSG_NOSIGNAL))
 +              send_sig(SIGPIPE, current, 0);
        err = -EPIPE;
  out_err:
        scm_destroy(siocb->scm);
@@@ -1684,10 -1677,13 +1686,10 @@@ static int unix_dgram_recvmsg(struct ki
        siocb->scm->creds = *UNIXCREDS(skb);
        unix_set_secdata(siocb->scm, skb);
  
 -      if (!(flags & MSG_PEEK))
 -      {
 +      if (!(flags & MSG_PEEK)) {
                if (UNIXCB(skb).fp)
                        unix_detach_fds(siocb->scm, skb);
 -      }
 -      else
 -      {
 +      } else {
                /* It is questionable: on PEEK we could:
                   - do not return fds - good, but too simple 8)
                   - return fds, and do not return them on read (old strategy,
        scm_recv(sock, msg, siocb->scm, flags);
  
  out_free:
 -      skb_free_datagram(sk,skb);
 +      skb_free_datagram(sk, skb);
  out_unlock:
        mutex_unlock(&u->readlock);
  out:
   *    Sleep until data has arrive. But check for races..
   */
  
 -static long unix_stream_data_wait(struct sock * sk, long timeo)
 +static long unix_stream_data_wait(struct sock *sk, long timeo)
  {
        DEFINE_WAIT(wait);
  
@@@ -1757,7 -1753,7 +1759,7 @@@ static int unix_stream_recvmsg(struct k
        struct scm_cookie tmp_scm;
        struct sock *sk = sock->sk;
        struct unix_sock *u = unix_sk(sk);
 -      struct sockaddr_un *sunaddr=msg->msg_name;
 +      struct sockaddr_un *sunaddr = msg->msg_name;
        int copied = 0;
        int check_creds = 0;
        int target;
  
        mutex_lock(&u->readlock);
  
 -      do
 -      {
 +      do {
                int chunk;
                struct sk_buff *skb;
  
                unix_state_lock(sk);
                skb = skb_dequeue(&sk->sk_receive_queue);
 -              if (skb==NULL)
 -              {
 +              if (skb == NULL) {
                        if (copied >= target)
                                goto unlock;
  
                         *      POSIX 1003.1g mandates this order.
                         */
  
 -                      if ((err = sock_error(sk)) != 0)
 +                      err = sock_error(sk);
 +                      if (err)
                                goto unlock;
                        if (sk->sk_shutdown & RCV_SHUTDOWN)
                                goto unlock;
  
                if (check_creds) {
                        /* Never glue messages from different writers */
 -                      if (memcmp(UNIXCREDS(skb), &siocb->scm->creds, sizeof(siocb->scm->creds)) != 0) {
 +                      if (memcmp(UNIXCREDS(skb), &siocb->scm->creds,
 +                                 sizeof(siocb->scm->creds)) != 0) {
                                skb_queue_head(&sk->sk_receive_queue, skb);
                                break;
                        }
                }
  
                /* Copy address just once */
 -              if (sunaddr)
 -              {
 +              if (sunaddr) {
                        unix_copy_addr(msg, skb->sk);
                        sunaddr = NULL;
                }
                size -= chunk;
  
                /* Mark read part of skb as used */
 -              if (!(flags & MSG_PEEK))
 -              {
 +              if (!(flags & MSG_PEEK)) {
                        skb_pull(skb, chunk);
  
                        if (UNIXCB(skb).fp)
                                unix_detach_fds(siocb->scm, skb);
  
                        /* put the skb back if we didn't use it up.. */
 -                      if (skb->len)
 -                      {
 +                      if (skb->len) {
                                skb_queue_head(&sk->sk_receive_queue, skb);
                                break;
                        }
  
                        if (siocb->scm->fp)
                                break;
 -              }
 -              else
 -              {
 +              } else {
                        /* It is questionable, see note in unix_dgram_recvmsg.
                         */
                        if (UNIXCB(skb).fp)
@@@ -1902,7 -1903,7 +1904,7 @@@ static int unix_shutdown(struct socket 
        if (mode) {
                unix_state_lock(sk);
                sk->sk_shutdown |= mode;
 -              other=unix_peer(sk);
 +              other = unix_peer(sk);
                if (other)
                        sock_hold(other);
                unix_state_unlock(sk);
  static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
  {
        struct sock *sk = sock->sk;
 -      long amount=0;
 +      long amount = 0;
        int err;
  
 -      switch(cmd)
 -      {
 -              case SIOCOUTQ:
 -                      amount = atomic_read(&sk->sk_wmem_alloc);
 -                      err = put_user(amount, (int __user *)arg);
 -                      break;
 -              case SIOCINQ:
 +      switch (cmd) {
 +      case SIOCOUTQ:
 +              amount = atomic_read(&sk->sk_wmem_alloc);
 +              err = put_user(amount, (int __user *)arg);
 +              break;
 +      case SIOCINQ:
                {
                        struct sk_buff *skb;
  
                        } else {
                                skb = skb_peek(&sk->sk_receive_queue);
                                if (skb)
 -                                      amount=skb->len;
 +                                      amount = skb->len;
                        }
                        spin_unlock(&sk->sk_receive_queue.lock);
                        err = put_user(amount, (int __user *)arg);
                        break;
                }
  
 -              default:
 -                      err = -ENOIOCTLCMD;
 -                      break;
 +      default:
 +              err = -ENOIOCTLCMD;
 +              break;
        }
        return err;
  }
  
 -static unsigned int unix_poll(struct file * file, struct socket *sock, poll_table *wait)
 +static unsigned int unix_poll(struct file *file, struct socket *sock, poll_table *wait)
  {
        struct sock *sk = sock->sk;
        unsigned int mask;
                mask |= POLLIN | POLLRDNORM;
  
        /* Connection-based need to check for termination and startup */
 -      if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) && sk->sk_state == TCP_CLOSE)
 +      if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) &&
 +          sk->sk_state == TCP_CLOSE)
                mask |= POLLHUP;
  
        /*
@@@ -2095,7 -2096,6 +2097,7 @@@ struct unix_iter_state 
        struct seq_net_private p;
        int i;
  };
 +
  static struct sock *unix_seq_idx(struct seq_file *seq, loff_t pos)
  {
        struct unix_iter_state *iter = seq->private;
        return NULL;
  }
  
 -
  static void *unix_seq_start(struct seq_file *seq, loff_t *pos)
        __acquires(unix_table_lock)
  {
@@@ -2191,6 -2192,7 +2193,6 @@@ static const struct seq_operations unix
        .show   = unix_seq_show,
  };
  
 -
  static int unix_seq_open(struct inode *inode, struct file *file)
  {
        return seq_open_net(inode, file, &unix_seq_ops,
diff --combined net/unix/garbage.c
@@@ -80,6 -80,7 +80,7 @@@
  #include <linux/file.h>
  #include <linux/proc_fs.h>
  #include <linux/mutex.h>
+ #include <linux/wait.h>
  
  #include <net/sock.h>
  #include <net/af_unix.h>
@@@ -91,6 -92,7 +92,7 @@@
  static LIST_HEAD(gc_inflight_list);
  static LIST_HEAD(gc_candidates);
  static DEFINE_SPINLOCK(unix_gc_lock);
+ static DECLARE_WAIT_QUEUE_HEAD(unix_gc_wait);
  
  unsigned int unix_tot_inflight;
  
@@@ -104,8 -106,8 +106,8 @@@ static struct sock *unix_get_socket(str
         *      Socket ?
         */
        if (S_ISSOCK(inode->i_mode)) {
 -              struct socket * sock = SOCKET_I(inode);
 -              struct sock * s = sock->sk;
 +              struct socket *sock = SOCKET_I(inode);
 +              struct sock *s = sock->sk;
  
                /*
                 *      PF_UNIX ?
  void unix_inflight(struct file *fp)
  {
        struct sock *s = unix_get_socket(fp);
 -      if(s) {
 +      if (s) {
                struct unix_sock *u = unix_sk(s);
                spin_lock(&unix_gc_lock);
                if (atomic_long_inc_return(&u->inflight) == 1) {
  void unix_notinflight(struct file *fp)
  {
        struct sock *s = unix_get_socket(fp);
 -      if(s) {
 +      if (s) {
                struct unix_sock *u = unix_sk(s);
                spin_lock(&unix_gc_lock);
                BUG_ON(list_empty(&u->link));
  
  static inline struct sk_buff *sock_queue_head(struct sock *sk)
  {
 -      return (struct sk_buff *) &sk->sk_receive_queue;
 +      return (struct sk_buff *)&sk->sk_receive_queue;
  }
  
  #define receive_queue_for_each_skb(sk, next, skb) \
@@@ -266,12 -268,16 +268,16 @@@ static void inc_inflight_move_tail(stru
                list_move_tail(&u->link, &gc_candidates);
  }
  
- /* The external entry point: unix_gc() */
+ static bool gc_in_progress = false;
  
- void unix_gc(void)
+ void wait_for_unix_gc(void)
  {
-       static bool gc_in_progress = false;
+       wait_event(unix_gc_wait, gc_in_progress == false);
+ }
  
+ /* The external entry point: unix_gc() */
+ void unix_gc(void)
+ {
        struct unix_sock *u;
        struct unix_sock *next;
        struct sk_buff_head hitlist;
         */
        skb_queue_head_init(&hitlist);
        list_for_each_entry(u, &gc_candidates, link)
 -              scan_children(&u->sk, inc_inflight, &hitlist);
 +      scan_children(&u->sk, inc_inflight, &hitlist);
  
        spin_unlock(&unix_gc_lock);
  
        /* All candidates should have been detached by now. */
        BUG_ON(!list_empty(&gc_candidates));
        gc_in_progress = false;
+       wake_up(&unix_gc_wait);
  
   out:
        spin_unlock(&unix_gc_lock);