]> err.no Git - linux-2.6/commitdiff
Merge branch 'davem-fixes' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
authorDavid S. Miller <davem@davemloft.net>
Tue, 10 Jun 2008 23:21:55 +0000 (16:21 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 Jun 2008 23:21:55 +0000 (16:21 -0700)
18 files changed:
drivers/atm/eni.h
drivers/isdn/hardware/eicon/divasmain.c
drivers/isdn/hardware/eicon/divasproc.c
drivers/isdn/hysdn/hysdn_procconf.c
drivers/net/pppoe.c
drivers/net/pppol2tp.c
include/linux/ipv6.h
include/linux/rtnetlink.h
include/net/inet_sock.h
include/net/tcp.h
net/dccp/ipv4.c
net/dccp/ipv6.c
net/ipv4/fib_semantics.c
net/ipv4/syncookies.c
net/ipv4/tcp_ipv4.c
net/ipv6/syncookies.c
net/ipv6/tcp_ipv6.c
net/key/af_key.c

index d04fefb0841f6e7ce7c67cef84ba6199db97faac..e4c9525e60b3deaccb13fd053431393c7df8db84 100644 (file)
@@ -18,7 +18,6 @@
 #include "midway.h"
 
 
-#define KERNEL_OFFSET  0xC0000000      /* kernel 0x0 is at phys 0xC0000000 */
 #define DEV_LABEL      "eni"
 
 #define UBR_BUFFER     (128*1024)      /* UBR buffer size */
index 5fcbdccd7a5359aeac614524f37506785f47b59d..16a874bb15614bcd0a0bd58b27ecc3dd7edb7d15 100644 (file)
@@ -806,7 +806,6 @@ static int DIVA_INIT_FUNCTION divas_init(void)
 
        if (!create_divas_proc()) {
 #ifdef MODULE
-               remove_divas_proc();
                divas_unregister_chrdev();
                divasfunc_exit();
 #endif
index fae895828a1713317a0286d21f17a4fe6b051a38..040827288ec91ea43d3eb71b3cac194fa3adf4f9 100644 (file)
@@ -125,8 +125,8 @@ static const struct file_operations divas_fops = {
 
 int create_divas_proc(void)
 {
-       proc_create(divas_proc_name, S_IFREG | S_IRUGO, proc_net_eicon,
-                   &divas_fops);
+       divas_proc_entry = proc_create(divas_proc_name, S_IFREG | S_IRUGO,
+                                       proc_net_eicon, &divas_fops);
        if (!divas_proc_entry)
                return (0);
 
index 15906d005b05de9f6371f75b6ca5b92617c0f4a3..484299b031f82d49b91dfeb303099a1920824933 100644 (file)
@@ -207,30 +207,17 @@ hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t
 /* read conf file -> output card info data */
 /*******************************************/
 static ssize_t
-hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t * off)
+hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t *off)
 {
        char *cp;
-       int i;
 
-       if (file->f_mode & FMODE_READ) {
-               if (!(cp = file->private_data))
-                       return (-EFAULT);       /* should never happen */
-               i = strlen(cp); /* get total string length */
-               if (*off < i) {
-                       /* still bytes to transfer */
-                       cp += *off;     /* point to desired data offset */
-                       i -= *off;      /* remaining length */
-                       if (i > count)
-                               i = count;      /* limit length to transfer */
-                       if (copy_to_user(buf, cp, i))
-                               return (-EFAULT);       /* copy error */
-                       *off += i;      /* adjust offset */
-               } else
-                       return (0);
-       } else
-               return (-EPERM);        /* no permission to read */
-
-       return (i);
+       if (!(file->f_mode & FMODE_READ))
+               return -EPERM;  /* no permission to read */
+
+       if (!(cp = file->private_data))
+               return -EFAULT; /* should never happen */
+
+       return simple_read_from_buffer(buf, count, off, cp, strlen(cp));
 }                              /* hysdn_conf_read */
 
 /******************/
index 58a26a47af29a1ee3764968dda5e7497752c9e7a..bafb69b6f7cbdeb26ea7975a2d46d2f04f7bdb24 100644 (file)
@@ -341,12 +341,6 @@ static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb)
        struct pppox_sock *relay_po;
 
        if (sk->sk_state & PPPOX_BOUND) {
-               struct pppoe_hdr *ph = pppoe_hdr(skb);
-               int len = ntohs(ph->length);
-               skb_pull_rcsum(skb, sizeof(struct pppoe_hdr));
-               if (pskb_trim_rcsum(skb, len))
-                       goto abort_kfree;
-
                ppp_input(&po->chan, skb);
        } else if (sk->sk_state & PPPOX_RELAY) {
                relay_po = get_item_by_addr(&po->pppoe_relay);
@@ -357,7 +351,6 @@ static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb)
                if ((sk_pppox(relay_po)->sk_state & PPPOX_CONNECTED) == 0)
                        goto abort_put;
 
-               skb_pull(skb, sizeof(struct pppoe_hdr));
                if (!__pppoe_xmit(sk_pppox(relay_po), skb))
                        goto abort_put;
        } else {
@@ -388,6 +381,7 @@ static int pppoe_rcv(struct sk_buff *skb,
 {
        struct pppoe_hdr *ph;
        struct pppox_sock *po;
+       int len;
 
        if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
                goto out;
@@ -399,10 +393,21 @@ static int pppoe_rcv(struct sk_buff *skb,
                goto drop;
 
        ph = pppoe_hdr(skb);
+       len = ntohs(ph->length);
+
+       skb_pull_rcsum(skb, sizeof(*ph));
+       if (skb->len < len)
+               goto drop;
 
        po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
-       if (po != NULL)
-               return sk_receive_skb(sk_pppox(po), skb, 0);
+       if (!po)
+               goto drop;
+
+       if (pskb_trim_rcsum(skb, len))
+               goto drop;
+
+       return sk_receive_skb(sk_pppox(po), skb, 0);
+
 drop:
        kfree_skb(skb);
 out:
@@ -427,12 +432,12 @@ static int pppoe_disc_rcv(struct sk_buff *skb,
        if (dev_net(dev) != &init_net)
                goto abort;
 
-       if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
-               goto abort;
-
        if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
                goto out;
 
+       if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
+               goto abort;
+
        ph = pppoe_hdr(skb);
        if (ph->code != PADT_CODE)
                goto abort;
@@ -937,12 +942,10 @@ static int pppoe_recvmsg(struct kiocb *iocb, struct socket *sock,
        m->msg_namelen = 0;
 
        if (skb) {
-               struct pppoe_hdr *ph = pppoe_hdr(skb);
-               const int len = ntohs(ph->length);
-
-               error = memcpy_toiovec(m->msg_iov, (unsigned char *) &ph->tag[0], len);
+               total_len = min(total_len, skb->len);
+               error = skb_copy_datagram_iovec(skb, 0, m->msg_iov, total_len);
                if (error == 0)
-                       error = len;
+                       error = total_len;
        }
 
        kfree_skb(skb);
index 70cfdb46aa27422d61e72508c840004dfc740c22..f9298827a76caa07f8508d4179b9b312cf13fb72 100644 (file)
@@ -783,14 +783,18 @@ static int pppol2tp_recvmsg(struct kiocb *iocb, struct socket *sock,
        err = 0;
        skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
                                flags & MSG_DONTWAIT, &err);
-       if (skb) {
-               err = memcpy_toiovec(msg->msg_iov, (unsigned char *) skb->data,
-                                    skb->len);
-               if (err < 0)
-                       goto do_skb_free;
-               err = skb->len;
-       }
-do_skb_free:
+       if (!skb)
+               goto end;
+
+       if (len > skb->len)
+               len = skb->len;
+       else if (len < skb->len)
+               msg->msg_flags |= MSG_TRUNC;
+
+       err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, len);
+       if (likely(err == 0))
+               err = len;
+
        kfree_skb(skb);
 end:
        return err;
index 10b666b61adde7c80908bf60d01aff1e961e4c57..cde056e0818172aeb7a5ae8d69998fb83d41796e 100644 (file)
@@ -396,8 +396,10 @@ static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *op
 {
        struct request_sock *req = reqsk_alloc(ops);
 
-       if (req != NULL)
+       if (req != NULL) {
                inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req);
+               inet6_rsk(req)->pktopts = NULL;
+       }
 
        return req;
 }
index a2aec2c0cfb562e7b6247d3f577350a7d6806c44..b358c704d10247ac0c46730f78e5db0485132f79 100644 (file)
@@ -246,6 +246,7 @@ enum rt_class_t
 {
        RT_TABLE_UNSPEC=0,
 /* User defined values */
+       RT_TABLE_COMPAT=252,
        RT_TABLE_DEFAULT=253,
        RT_TABLE_MAIN=254,
        RT_TABLE_LOCAL=255,
index a42cd63d241a1d96ac3f8bcac099a255ccbf2bbd..9fabe5b389122502c876ef611dc3f3342867011f 100644 (file)
@@ -197,4 +197,14 @@ static inline int inet_iif(const struct sk_buff *skb)
        return skb->rtable->rt_iif;
 }
 
+static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops)
+{
+       struct request_sock *req = reqsk_alloc(ops);
+
+       if (req != NULL)
+               inet_rsk(req)->opt = NULL;
+
+       return req;
+}
+
 #endif /* _INET_SOCK_H */
index 633147cb6bbc8967bc5ab04bdd6dd251a9dde90d..d448310c82c1ac8b8c718f2a2140c58737511a74 100644 (file)
@@ -433,7 +433,6 @@ extern struct sk_buff *             tcp_make_synack(struct sock *sk,
 
 extern int                     tcp_disconnect(struct sock *sk, int flags);
 
-extern void                    tcp_unhash(struct sock *sk);
 
 /* From syncookies.c */
 extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS];
index c22a3780c14eb97b45494b003c62dd321e8117a8..37d27bcb361fcee67d2c1869315b6df22e2411ad 100644 (file)
@@ -589,7 +589,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
        if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1)
                goto drop;
 
-       req = reqsk_alloc(&dccp_request_sock_ops);
+       req = inet_reqsk_alloc(&dccp_request_sock_ops);
        if (req == NULL)
                goto drop;
 
@@ -605,7 +605,6 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
        ireq = inet_rsk(req);
        ireq->loc_addr = ip_hdr(skb)->daddr;
        ireq->rmt_addr = ip_hdr(skb)->saddr;
-       ireq->opt       = NULL;
 
        /*
         * Step 3: Process LISTEN state
index 9b1129bb7ece2c868316584d12805168dbbea017..f7fe2a572d7bb6bafc27de0e16411eb6cc68b5fd 100644 (file)
@@ -421,7 +421,6 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
        ireq6 = inet6_rsk(req);
        ipv6_addr_copy(&ireq6->rmt_addr, &ipv6_hdr(skb)->saddr);
        ipv6_addr_copy(&ireq6->loc_addr, &ipv6_hdr(skb)->daddr);
-       ireq6->pktopts  = NULL;
 
        if (ipv6_opt_accepted(sk, skb) ||
            np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo ||
index 3b83c34019fc8ab161dc9fad69a8831a64ca357c..0d4d72827e4be08c4829ecea846b2a15e0d83e42 100644 (file)
@@ -960,7 +960,10 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
        rtm->rtm_dst_len = dst_len;
        rtm->rtm_src_len = 0;
        rtm->rtm_tos = tos;
-       rtm->rtm_table = tb_id;
+       if (tb_id < 256)
+               rtm->rtm_table = tb_id;
+       else
+               rtm->rtm_table = RT_TABLE_COMPAT;
        NLA_PUT_U32(skb, RTA_TABLE, tb_id);
        rtm->rtm_type = type;
        rtm->rtm_flags = fi->fib_flags;
index 73ba98921d6420ced10a70f8a0fc8ec8893e4311..d182a2a2629135a8a76df80ee40e9e6542dd871b 100644 (file)
@@ -285,7 +285,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
                cookie_check_timestamp(&tcp_opt);
 
        ret = NULL;
-       req = reqsk_alloc(&tcp_request_sock_ops); /* for safety */
+       req = inet_reqsk_alloc(&tcp_request_sock_ops); /* for safety */
        if (!req)
                goto out;
 
@@ -301,7 +301,6 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
        ireq->rmt_port          = th->source;
        ireq->loc_addr          = ip_hdr(skb)->daddr;
        ireq->rmt_addr          = ip_hdr(skb)->saddr;
-       ireq->opt               = NULL;
        ireq->snd_wscale        = tcp_opt.snd_wscale;
        ireq->rcv_wscale        = tcp_opt.rcv_wscale;
        ireq->sack_ok           = tcp_opt.sack_ok;
index cd601a866c2f5856e3f8b69ffc3fd542c465e34a..4f8485c67d1a6e4221fbc651593f2c047da4414d 100644 (file)
@@ -1285,7 +1285,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
        if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1)
                goto drop;
 
-       req = reqsk_alloc(&tcp_request_sock_ops);
+       req = inet_reqsk_alloc(&tcp_request_sock_ops);
        if (!req)
                goto drop;
 
index 938ce4ecde55d8c614eb3d5afb42df14fe685535..3ecc1157994edf91e64261b0226b371c17800cf6 100644 (file)
@@ -198,7 +198,6 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
        ireq = inet_rsk(req);
        ireq6 = inet6_rsk(req);
        treq = tcp_rsk(req);
-       ireq6->pktopts = NULL;
 
        if (security_inet_conn_request(sk, skb, req)) {
                reqsk_free(req);
index 715965f0fac0b19a862462a8eb8188ab965033b7..cb46749d4c326a3e7133537b70ed3cccce82eb9d 100644 (file)
@@ -1299,7 +1299,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
        treq = inet6_rsk(req);
        ipv6_addr_copy(&treq->rmt_addr, &ipv6_hdr(skb)->saddr);
        ipv6_addr_copy(&treq->loc_addr, &ipv6_hdr(skb)->daddr);
-       treq->pktopts = NULL;
        if (!want_cookie)
                TCP_ECN_create_request(req, tcp_hdr(skb));
 
index 9bba7ac5fee0d30a986c49ed0b43e664b056d975..7470e367272b6059751eca446c7fc1f0d08edc13 100644 (file)
@@ -3030,6 +3030,9 @@ static int key_notify_sa_expire(struct xfrm_state *x, struct km_event *c)
 
 static int pfkey_send_notify(struct xfrm_state *x, struct km_event *c)
 {
+       if (atomic_read(&pfkey_socks_nr) == 0)
+               return 0;
+
        switch (c->event) {
        case XFRM_MSG_EXPIRE:
                return key_notify_sa_expire(x, c);