~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to net/ipv4/ip_sockglue.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb)
132
132
{
133
133
        struct sockaddr_in sin;
134
 
        struct iphdr *iph = ip_hdr(skb);
 
134
        const struct iphdr *iph = ip_hdr(skb);
135
135
        __be16 *ports = (__be16 *)skb_transport_header(skb);
136
136
 
137
137
        if (skb_transport_offset(skb) + 4 > skb->len)
451
451
}
452
452
 
453
453
 
 
454
static void opt_kfree_rcu(struct rcu_head *head)
 
455
{
 
456
        kfree(container_of(head, struct ip_options_rcu, rcu));
 
457
}
 
458
 
454
459
/*
455
460
 *      Socket option code for IP. This is the end of the line after any
456
461
 *      TCP,UDP etc options on an IP socket.
497
502
        switch (optname) {
498
503
        case IP_OPTIONS:
499
504
        {
500
 
                struct ip_options *opt = NULL;
 
505
                struct ip_options_rcu *old, *opt = NULL;
 
506
 
501
507
                if (optlen > 40)
502
508
                        goto e_inval;
503
509
                err = ip_options_get_from_user(sock_net(sk), &opt,
504
510
                                               optval, optlen);
505
511
                if (err)
506
512
                        break;
 
513
                old = rcu_dereference_protected(inet->inet_opt,
 
514
                                                sock_owned_by_user(sk));
507
515
                if (inet->is_icsk) {
508
516
                        struct inet_connection_sock *icsk = inet_csk(sk);
509
517
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
512
520
                               (TCPF_LISTEN | TCPF_CLOSE)) &&
513
521
                             inet->inet_daddr != LOOPBACK4_IPV6)) {
514
522
#endif
515
 
                                if (inet->opt)
516
 
                                        icsk->icsk_ext_hdr_len -= inet->opt->optlen;
 
523
                                if (old)
 
524
                                        icsk->icsk_ext_hdr_len -= old->opt.optlen;
517
525
                                if (opt)
518
 
                                        icsk->icsk_ext_hdr_len += opt->optlen;
 
526
                                        icsk->icsk_ext_hdr_len += opt->opt.optlen;
519
527
                                icsk->icsk_sync_mss(sk, icsk->icsk_pmtu_cookie);
520
528
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
521
529
                        }
522
530
#endif
523
531
                }
524
 
                opt = xchg(&inet->opt, opt);
525
 
                kfree(opt);
 
532
                rcu_assign_pointer(inet->inet_opt, opt);
 
533
                if (old)
 
534
                        call_rcu(&old->rcu, opt_kfree_rcu);
526
535
                break;
527
536
        }
528
537
        case IP_PKTINFO:
1081
1090
        case IP_OPTIONS:
1082
1091
        {
1083
1092
                unsigned char optbuf[sizeof(struct ip_options)+40];
1084
 
                struct ip_options * opt = (struct ip_options *)optbuf;
 
1093
                struct ip_options *opt = (struct ip_options *)optbuf;
 
1094
                struct ip_options_rcu *inet_opt;
 
1095
 
 
1096
                inet_opt = rcu_dereference_protected(inet->inet_opt,
 
1097
                                                     sock_owned_by_user(sk));
1085
1098
                opt->optlen = 0;
1086
 
                if (inet->opt)
1087
 
                        memcpy(optbuf, inet->opt,
1088
 
                               sizeof(struct ip_options)+
1089
 
                               inet->opt->optlen);
 
1099
                if (inet_opt)
 
1100
                        memcpy(optbuf, &inet_opt->opt,
 
1101
                               sizeof(struct ip_options) +
 
1102
                               inet_opt->opt.optlen);
1090
1103
                release_sock(sk);
1091
1104
 
1092
1105
                if (opt->optlen == 0)