Merge branch 'upstream/android-3.10' into 'linaro-fixes/android-3.10'
authorAmit Pundir <amit.pundir@linaro.org>
Mon, 10 Nov 2014 05:46:05 +0000 (11:16 +0530)
committerAmit Pundir <amit.pundir@linaro.org>
Mon, 10 Nov 2014 05:46:05 +0000 (11:16 +0530)
12 files changed:
Documentation/networking/ip-sysctl.txt
include/linux/cgroup.h
include/linux/ipv6.h
include/linux/wakeup_reason.h
include/uapi/linux/ipv6.h
include/uapi/sound/compress_params.h
kernel/cgroup.c
kernel/power/wakeup_reason.c
kernel/sched/core.c
mm/memcontrol.c
net/ipv6/addrconf.c
sound/core/compress_offload.c

index 6e5c7c7333bdb3aa73a84a2509670f289abc958b..74b49ba13b1fc269bf637dcae0264871bf583b32 100644 (file)
@@ -1333,6 +1333,19 @@ ndisc_notify - BOOLEAN
        1 - Generate unsolicited neighbour advertisements when device is brought
            up or hardware address changes.
 
+optimistic_dad - BOOLEAN
+       Whether to perform Optimistic Duplicate Address Detection (RFC 4429).
+               0: disabled (default)
+               1: enabled
+
+use_optimistic - BOOLEAN
+       If enabled, do not classify optimistic addresses as deprecated during
+       source address selection.  Preferred addresses will still be chosen
+       before optimistic addresses, subject to other ranking in the source
+       address selection algorithm.
+               0: disabled (default)
+               1: enabled
+
 icmp/*:
 ratelimit - INTEGER
        Limit the maximal rates for sending ICMPv6 packets.
index 8f73d835d4d57053052570edd7f5ed2d451b831a..a2bcbd2e0f9a47079a8deea42cc89916ac772270 100644 (file)
@@ -831,6 +831,17 @@ unsigned short css_id(struct cgroup_subsys_state *css);
 unsigned short css_depth(struct cgroup_subsys_state *css);
 struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
 
+/*
+ * Default Android check for whether the current process is allowed to move a
+ * task across cgroups, either because CAP_SYS_NICE is set or because the uid
+ * of the calling process is the same as the moved task or because we are
+ * running as root.
+ * Returns 0 if this is allowed, or -EACCES otherwise.
+ */
+int subsys_cgroup_allow_attach(struct cgroup *cgrp,
+                              struct cgroup_taskset *tset);
+
+
 #else /* !CONFIG_CGROUPS */
 
 static inline int cgroup_init_early(void) { return 0; }
@@ -854,6 +865,11 @@ static inline int cgroup_attach_task_all(struct task_struct *from,
        return 0;
 }
 
+static inline int subsys_cgroup_allow_attach(struct cgroup *cgrp,
+                                            struct cgroup_taskset *tset)
+{
+       return 0;
+}
 #endif /* !CONFIG_CGROUPS */
 
 #endif /* _LINUX_CGROUP_H */
index 867833ba6bd166dbfcc4e1259b6dfbcdd00d0650..76b5114e9d82ac8809ff58e163e9df5165d1ebe6 100644 (file)
@@ -41,6 +41,7 @@ struct ipv6_devconf {
        __s32           accept_source_route;
 #ifdef CONFIG_IPV6_OPTIMISTIC_DAD
        __s32           optimistic_dad;
+       __s32           use_optimistic;
 #endif
 #ifdef CONFIG_IPV6_MROUTE
        __s32           mc_forwarding;
index 5f095da2c977b2c1ec607f7729cdcb6cc1a2a5be..ad8b76936c7fb70e35f69e4e7327d41d0d7ac8ba 100644 (file)
@@ -22,4 +22,6 @@
 
 void log_wakeup_reason(int irq);
 void log_suspend_abort_reason(const char *fmt, ...);
+int check_wakeup_reason(int irq);
+
 #endif /* _LINUX_WAKEUP_REASON_H */
index 4214fac1bf4fbeea0c702c440f39aaa6cad94291..e9d0f7efde3b8dbd41790360df37336e213c1531 100644 (file)
@@ -161,6 +161,7 @@ enum {
        DEVCONF_FORCE_TLLAO,
        DEVCONF_NDISC_NOTIFY,
        DEVCONF_ACCEPT_RA_RT_TABLE,
+       DEVCONF_USE_OPTIMISTIC,
        DEVCONF_MAX
 };
 
index 602dc6c45d1a091fb548ac586c69813f25f4f508..165e7059de75173ec1bf29dcfb9138c35a4a3956 100644 (file)
@@ -57,6 +57,7 @@
 #define MAX_NUM_CODECS 32
 #define MAX_NUM_CODEC_DESCRIPTORS 32
 #define MAX_NUM_BITRATES 32
+#define MAX_NUM_SAMPLE_RATES 32
 
 /* Codecs are listed linearly to allow for extensibility */
 #define SND_AUDIOCODEC_PCM                   ((__u32) 0x00000001)
@@ -324,7 +325,8 @@ union snd_codec_options {
 
 /** struct snd_codec_desc - description of codec capabilities
  * @max_ch: Maximum number of audio channels
- * @sample_rates: Sampling rates in Hz, use SNDRV_PCM_RATE_xxx for this
+ * @sample_rates: Sampling rates in Hz, use values like 48000 for this
+ * @num_sample_rates: Number of valid values in sample_rates array
  * @bit_rate: Indexed array containing supported bit rates
  * @num_bitrates: Number of valid values in bit_rate array
  * @rate_control: value is specified by SND_RATECONTROLMODE defines.
@@ -346,7 +348,8 @@ union snd_codec_options {
 
 struct snd_codec_desc {
        __u32 max_ch;
-       __u32 sample_rates;
+       __u32 sample_rates[MAX_NUM_SAMPLE_RATES];
+       __u32 num_sample_rates;
        __u32 bit_rate[MAX_NUM_BITRATES];
        __u32 num_bitrates;
        __u32 rate_control;
@@ -364,7 +367,8 @@ struct snd_codec_desc {
  * @ch_out: Number of output channels. In case of contradiction between
  *             this field and the channelMode field, the channelMode field
  *             overrides.
- * @sample_rate: Audio sample rate of input data
+ * @sample_rate: Audio sample rate of input data in Hz, use values like 48000
+ *             for this.
  * @bit_rate: Bitrate of encoded data. May be ignored by decoders
  * @rate_control: Encoding rate control. See SND_RATECONTROLMODE defines.
  *               Encoders may rely on profiles for quality levels.
index 1f5338773862e5aef43fe47e8cc5715f5e432d34..8dc7ec1de42951b0ee27e5691895a7f1c2142f1a 100644 (file)
@@ -2116,6 +2116,25 @@ static int cgroup_allow_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
        return 0;
 }
 
+int subsys_cgroup_allow_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
+{
+       const struct cred *cred = current_cred(), *tcred;
+       struct task_struct *task;
+
+       if (capable(CAP_SYS_NICE))
+               return 0;
+
+       cgroup_taskset_for_each(task, cgrp, tset) {
+               tcred = __task_cred(task);
+
+               if (current != task && cred->euid != tcred->uid &&
+                   cred->euid != tcred->suid)
+                       return -EACCES;
+       }
+
+       return 0;
+}
+
 /*
  * Find the task_struct of the task to attach by vpid and pass it along to the
  * function to attach either it or all tasks in its threadgroup. Will lock
index 2aacc34ef17c018728631ef5aa1b82872626d175..085c99edca06fac67365cfbb2d3a4e1e414d1a6b 100644 (file)
@@ -34,7 +34,7 @@ static int irqcount;
 static bool suspend_abort;
 static char abort_reason[MAX_SUSPEND_ABORT_LEN];
 static struct kobject *wakeup_reason;
-static spinlock_t resume_reason_lock;
+static DEFINE_SPINLOCK(resume_reason_lock);
 
 static ssize_t last_resume_reason_show(struct kobject *kobj, struct kobj_attribute *attr,
                char *buf)
@@ -95,6 +95,21 @@ void log_wakeup_reason(int irq)
        spin_unlock(&resume_reason_lock);
 }
 
+int check_wakeup_reason(int irq)
+{
+       int irq_no;
+       int ret = false;
+
+       spin_lock(&resume_reason_lock);
+       for (irq_no = 0; irq_no < irqcount; irq_no++)
+               if (irq_list[irq_no] == irq) {
+                       ret = true;
+                       break;
+       }
+       spin_unlock(&resume_reason_lock);
+       return ret;
+}
+
 void log_suspend_abort_reason(const char *fmt, ...)
 {
        va_list args;
@@ -141,7 +156,7 @@ static struct notifier_block wakeup_reason_pm_notifier_block = {
 int __init wakeup_reason_init(void)
 {
        int retval;
-       spin_lock_init(&resume_reason_lock);
+
        retval = register_pm_notifier(&wakeup_reason_pm_notifier_block);
        if (retval)
                printk(KERN_WARNING "[%s] failed to register PM notifier %d\n",
index 014040fa3d2176af53f20db84f0e9a97615418c8..d5c5c9824511975214f36c290ca35d60ac86fca7 100644 (file)
@@ -7716,23 +7716,6 @@ static void cpu_cgroup_css_offline(struct cgroup *cgrp)
        sched_offline_group(tg);
 }
 
-static int
-cpu_cgroup_allow_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
-{
-       const struct cred *cred = current_cred(), *tcred;
-       struct task_struct *task;
-
-       cgroup_taskset_for_each(task, cgrp, tset) {
-               tcred = __task_cred(task);
-
-               if ((current != task) && !capable(CAP_SYS_NICE) &&
-                   cred->euid != tcred->uid && cred->euid != tcred->suid)
-                       return -EACCES;
-       }
-
-       return 0;
-}
-
 static int cpu_cgroup_can_attach(struct cgroup *cgrp,
                                 struct cgroup_taskset *tset)
 {
@@ -8092,7 +8075,7 @@ struct cgroup_subsys cpu_cgroup_subsys = {
        .css_offline    = cpu_cgroup_css_offline,
        .can_attach     = cpu_cgroup_can_attach,
        .attach         = cpu_cgroup_attach,
-       .allow_attach   = cpu_cgroup_allow_attach,
+       .allow_attach   = subsys_cgroup_allow_attach,
        .exit           = cpu_cgroup_exit,
        .subsys_id      = cpu_cgroup_subsys_id,
        .base_cftypes   = cpu_files,
index 194721839cf5d303a0de2b4df611b700db895043..338d62a052009c0d6543fc0aa597e7fbaf7587a9 100644 (file)
@@ -6753,6 +6753,12 @@ static int mem_cgroup_can_attach(struct cgroup *cgroup,
        return ret;
 }
 
+static int mem_cgroup_allow_attach(struct cgroup *cgroup,
+                                  struct cgroup_taskset *tset)
+{
+       return subsys_cgroup_allow_attach(cgroup, tset);
+}
+
 static void mem_cgroup_cancel_attach(struct cgroup *cgroup,
                                     struct cgroup_taskset *tset)
 {
@@ -6921,6 +6927,11 @@ static int mem_cgroup_can_attach(struct cgroup *cgroup,
 {
        return 0;
 }
+static int mem_cgroup_allow_attach(struct cgroup *cgroup,
+                                  struct cgroup_taskset *tset)
+{
+       return 0;
+}
 static void mem_cgroup_cancel_attach(struct cgroup *cgroup,
                                     struct cgroup_taskset *tset)
 {
@@ -6956,6 +6967,7 @@ struct cgroup_subsys mem_cgroup_subsys = {
        .can_attach = mem_cgroup_can_attach,
        .cancel_attach = mem_cgroup_cancel_attach,
        .attach = mem_cgroup_move_task,
+       .allow_attach = mem_cgroup_allow_attach,
        .bind = mem_cgroup_bind,
        .base_cftypes = mem_cgroup_files,
        .early_init = 0,
index cec8cb4d292db398f3d7cdd8d420f0cb3333be37..e1381119a6d8412b955498dff3ddb593e8342d5a 100644 (file)
@@ -1174,6 +1174,9 @@ enum {
 #endif
        IPV6_SADDR_RULE_ORCHID,
        IPV6_SADDR_RULE_PREFIX,
+#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
+       IPV6_SADDR_RULE_NOT_OPTIMISTIC,
+#endif
        IPV6_SADDR_RULE_MAX
 };
 
@@ -1201,6 +1204,15 @@ static inline int ipv6_saddr_preferred(int type)
        return 0;
 }
 
+static inline bool ipv6_use_optimistic_addr(struct inet6_dev *idev)
+{
+#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
+       return idev && idev->cnf.optimistic_dad && idev->cnf.use_optimistic;
+#else
+       return false;
+#endif
+}
+
 static int ipv6_get_saddr_eval(struct net *net,
                               struct ipv6_saddr_score *score,
                               struct ipv6_saddr_dst *dst,
@@ -1261,10 +1273,16 @@ static int ipv6_get_saddr_eval(struct net *net,
                score->scopedist = ret;
                break;
        case IPV6_SADDR_RULE_PREFERRED:
+           {
                /* Rule 3: Avoid deprecated and optimistic addresses */
+               u8 avoid = IFA_F_DEPRECATED;
+
+               if (!ipv6_use_optimistic_addr(score->ifa->idev))
+                       avoid |= IFA_F_OPTIMISTIC;
                ret = ipv6_saddr_preferred(score->addr_type) ||
-                     !(score->ifa->flags & (IFA_F_DEPRECATED|IFA_F_OPTIMISTIC));
+                     !(score->ifa->flags & avoid);
                break;
+           }
 #ifdef CONFIG_IPV6_MIP6
        case IPV6_SADDR_RULE_HOA:
            {
@@ -1312,6 +1330,14 @@ static int ipv6_get_saddr_eval(struct net *net,
                        ret = score->ifa->prefix_len;
                score->matchlen = ret;
                break;
+#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
+       case IPV6_SADDR_RULE_NOT_OPTIMISTIC:
+               /* Optimistic addresses still have lower precedence than other
+                * preferred addresses.
+                */
+               ret = !(score->ifa->flags & IFA_F_OPTIMISTIC);
+               break;
+#endif
        default:
                ret = 0;
        }
@@ -3245,8 +3271,15 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp)
         * Optimistic nodes can start receiving
         * Frames right away
         */
-       if (ifp->flags & IFA_F_OPTIMISTIC)
+       if (ifp->flags & IFA_F_OPTIMISTIC) {
                ip6_ins_rt(ifp->rt);
+               if (ipv6_use_optimistic_addr(idev)) {
+                       /* Because optimistic nodes can use this address,
+                        * notify listeners. If DAD fails, RTM_DELADDR is sent.
+                        */
+                       ipv6_ifa_notify(RTM_NEWADDR, ifp);
+               }
+       }
 
        addrconf_dad_kick(ifp);
 out:
@@ -4192,6 +4225,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
        array[DEVCONF_ACCEPT_SOURCE_ROUTE] = cnf->accept_source_route;
 #ifdef CONFIG_IPV6_OPTIMISTIC_DAD
        array[DEVCONF_OPTIMISTIC_DAD] = cnf->optimistic_dad;
+       array[DEVCONF_USE_OPTIMISTIC] = cnf->use_optimistic;
 #endif
 #ifdef CONFIG_IPV6_MROUTE
        array[DEVCONF_MC_FORWARDING] = cnf->mc_forwarding;
@@ -4926,6 +4960,14 @@ static struct addrconf_sysctl_table
                        .proc_handler   = proc_dointvec,
 
                },
+               {
+                       .procname       = "use_optimistic",
+                       .data           = &ipv6_devconf.use_optimistic,
+                       .maxlen         = sizeof(int),
+                       .mode           = 0644,
+                       .proc_handler   = proc_dointvec,
+
+               },
 #endif
 #ifdef CONFIG_IPV6_MROUTE
                {
index 99db892d7299056568e5432bdd660ea14d3143c6..fe399f8c18f4812cf436aa2eecf6911e9a93b758 100644 (file)
@@ -490,9 +490,6 @@ static int snd_compress_check_input(struct snd_compr_params *params)
        if (params->codec.ch_in == 0 || params->codec.ch_out == 0)
                return -EINVAL;
 
-       if (!(params->codec.sample_rate & SNDRV_PCM_RATE_8000_192000))
-               return -EINVAL;
-
        return 0;
 }