Magellan Linux

Annotation of /trunk/kernel-magellan/patches-3.15/0100-3.15.1-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2443 - (hide annotations) (download)
Wed Jun 25 14:25:24 2014 UTC (9 years, 11 months ago) by niro
File size: 14178 byte(s)
-linux-3.15.1
1 niro 2443 diff --git a/Makefile b/Makefile
2     index 6d1e304943a3..e2846acd2841 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 3
7     PATCHLEVEL = 15
8     -SUBLEVEL = 0
9     +SUBLEVEL = 1
10     EXTRAVERSION =
11     NAME = Shuffling Zombie Juror
12    
13     diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
14     index 60707814a84b..dae5607e1115 100644
15     --- a/drivers/ata/ahci.c
16     +++ b/drivers/ata/ahci.c
17     @@ -445,10 +445,14 @@ static const struct pci_device_id ahci_pci_tbl[] = {
18     .driver_data = board_ahci_yes_fbs }, /* 88se9172 */
19     { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192),
20     .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */
21     + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a0),
22     + .driver_data = board_ahci_yes_fbs },
23     { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3),
24     .driver_data = board_ahci_yes_fbs },
25     { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230),
26     .driver_data = board_ahci_yes_fbs },
27     + { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642),
28     + .driver_data = board_ahci_yes_fbs },
29    
30     /* Promise */
31     { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */
32     diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h
33     index 1bdc0e7e8b79..80643ef9183f 100644
34     --- a/drivers/media/dvb-core/dvb-usb-ids.h
35     +++ b/drivers/media/dvb-core/dvb-usb-ids.h
36     @@ -361,6 +361,7 @@
37     #define USB_PID_FRIIO_WHITE 0x0001
38     #define USB_PID_TVWAY_PLUS 0x0002
39     #define USB_PID_SVEON_STV20 0xe39d
40     +#define USB_PID_SVEON_STV20_RTL2832U 0xd39d
41     #define USB_PID_SVEON_STV22 0xe401
42     #define USB_PID_SVEON_STV22_IT9137 0xe411
43     #define USB_PID_AZUREWAVE_AZ6027 0x3275
44     @@ -375,4 +376,5 @@
45     #define USB_PID_CTVDIGDUAL_V2 0xe410
46     #define USB_PID_PCTV_2002E 0x025c
47     #define USB_PID_PCTV_2002E_SE 0x025d
48     +#define USB_PID_SVEON_STV27 0xd3af
49     #endif
50     diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
51     index dcbd392e6efc..a676e4452847 100644
52     --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
53     +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
54     @@ -1537,6 +1537,12 @@ static const struct usb_device_id rtl28xxu_id_table[] = {
55     &rtl2832u_props, "Crypto ReDi PC 50 A", NULL) },
56     { DVB_USB_DEVICE(USB_VID_KYE, 0x707f,
57     &rtl2832u_props, "Genius TVGo DVB-T03", NULL) },
58     + { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd395,
59     + &rtl2832u_props, "Peak DVB-T USB", NULL) },
60     + { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV20_RTL2832U,
61     + &rtl2832u_props, "Sveon STV20", NULL) },
62     + { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV27,
63     + &rtl2832u_props, "Sveon STV27", NULL) },
64    
65     /* RTL2832P devices: */
66     { DVB_USB_DEVICE(USB_VID_HANFTEK, 0x0131,
67     diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
68     index 8dbdaaef1af5..bdcebfa30fc8 100644
69     --- a/drivers/misc/mei/hw-me.c
70     +++ b/drivers/misc/mei/hw-me.c
71     @@ -164,6 +164,9 @@ static void mei_me_hw_reset_release(struct mei_device *dev)
72     hcsr |= H_IG;
73     hcsr &= ~H_RST;
74     mei_hcsr_set(hw, hcsr);
75     +
76     + /* complete this write before we set host ready on another CPU */
77     + mmiowb();
78     }
79     /**
80     * mei_me_hw_reset - resets fw via mei csr register.
81     @@ -183,8 +186,21 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable)
82     else
83     hcsr &= ~H_IE;
84    
85     + dev->recvd_hw_ready = false;
86     mei_me_reg_write(hw, H_CSR, hcsr);
87    
88     + /*
89     + * Host reads the H_CSR once to ensure that the
90     + * posted write to H_CSR completes.
91     + */
92     + hcsr = mei_hcsr_read(hw);
93     +
94     + if ((hcsr & H_RST) == 0)
95     + dev_warn(&dev->pdev->dev, "H_RST is not set = 0x%08X", hcsr);
96     +
97     + if ((hcsr & H_RDY) == H_RDY)
98     + dev_warn(&dev->pdev->dev, "H_RDY is not cleared 0x%08X", hcsr);
99     +
100     if (intr_enable == false)
101     mei_me_hw_reset_release(dev);
102    
103     @@ -201,6 +217,7 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable)
104     static void mei_me_host_set_ready(struct mei_device *dev)
105     {
106     struct mei_me_hw *hw = to_me_hw(dev);
107     + hw->host_hw_state = mei_hcsr_read(hw);
108     hw->host_hw_state |= H_IE | H_IG | H_RDY;
109     mei_hcsr_set(hw, hw->host_hw_state);
110     }
111     @@ -233,10 +250,7 @@ static bool mei_me_hw_is_ready(struct mei_device *dev)
112     static int mei_me_hw_ready_wait(struct mei_device *dev)
113     {
114     int err;
115     - if (mei_me_hw_is_ready(dev))
116     - return 0;
117    
118     - dev->recvd_hw_ready = false;
119     mutex_unlock(&dev->device_lock);
120     err = wait_event_interruptible_timeout(dev->wait_hw_ready,
121     dev->recvd_hw_ready,
122     @@ -491,14 +505,13 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
123     /* check if we need to start the dev */
124     if (!mei_host_is_ready(dev)) {
125     if (mei_hw_is_ready(dev)) {
126     + mei_me_hw_reset_release(dev);
127     dev_dbg(&dev->pdev->dev, "we need to start the dev.\n");
128    
129     dev->recvd_hw_ready = true;
130     wake_up_interruptible(&dev->wait_hw_ready);
131     } else {
132     -
133     - dev_dbg(&dev->pdev->dev, "Reset Completed.\n");
134     - mei_me_hw_reset_release(dev);
135     + dev_dbg(&dev->pdev->dev, "Spurious Interrupt\n");
136     }
137     goto end;
138     }
139     diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
140     index 955ab7990c5b..fb02fc2fb034 100644
141     --- a/drivers/pci/msi.c
142     +++ b/drivers/pci/msi.c
143     @@ -414,7 +414,7 @@ static void free_msi_irqs(struct pci_dev *dev)
144     if (dev->msi_irq_groups) {
145     sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups);
146     msi_attrs = dev->msi_irq_groups[0]->attrs;
147     - list_for_each_entry(entry, &dev->msi_list, list) {
148     + while (msi_attrs[count]) {
149     dev_attr = container_of(msi_attrs[count],
150     struct device_attribute, attr);
151     kfree(dev_attr->attr.name);
152     diff --git a/fs/attr.c b/fs/attr.c
153     index 5d4e59d56e85..6530ced19697 100644
154     --- a/fs/attr.c
155     +++ b/fs/attr.c
156     @@ -50,14 +50,14 @@ int inode_change_ok(const struct inode *inode, struct iattr *attr)
157     if ((ia_valid & ATTR_UID) &&
158     (!uid_eq(current_fsuid(), inode->i_uid) ||
159     !uid_eq(attr->ia_uid, inode->i_uid)) &&
160     - !inode_capable(inode, CAP_CHOWN))
161     + !capable_wrt_inode_uidgid(inode, CAP_CHOWN))
162     return -EPERM;
163    
164     /* Make sure caller can chgrp. */
165     if ((ia_valid & ATTR_GID) &&
166     (!uid_eq(current_fsuid(), inode->i_uid) ||
167     (!in_group_p(attr->ia_gid) && !gid_eq(attr->ia_gid, inode->i_gid))) &&
168     - !inode_capable(inode, CAP_CHOWN))
169     + !capable_wrt_inode_uidgid(inode, CAP_CHOWN))
170     return -EPERM;
171    
172     /* Make sure a caller can chmod. */
173     @@ -67,7 +67,7 @@ int inode_change_ok(const struct inode *inode, struct iattr *attr)
174     /* Also check the setgid bit! */
175     if (!in_group_p((ia_valid & ATTR_GID) ? attr->ia_gid :
176     inode->i_gid) &&
177     - !inode_capable(inode, CAP_FSETID))
178     + !capable_wrt_inode_uidgid(inode, CAP_FSETID))
179     attr->ia_mode &= ~S_ISGID;
180     }
181    
182     @@ -160,7 +160,7 @@ void setattr_copy(struct inode *inode, const struct iattr *attr)
183     umode_t mode = attr->ia_mode;
184    
185     if (!in_group_p(inode->i_gid) &&
186     - !inode_capable(inode, CAP_FSETID))
187     + !capable_wrt_inode_uidgid(inode, CAP_FSETID))
188     mode &= ~S_ISGID;
189     inode->i_mode = mode;
190     }
191     diff --git a/fs/dcache.c b/fs/dcache.c
192     index be2bea834bf4..e99c6f529ba8 100644
193     --- a/fs/dcache.c
194     +++ b/fs/dcache.c
195     @@ -532,10 +532,12 @@ static inline struct dentry *lock_parent(struct dentry *dentry)
196     struct dentry *parent = dentry->d_parent;
197     if (IS_ROOT(dentry))
198     return NULL;
199     + if (unlikely((int)dentry->d_lockref.count < 0))
200     + return NULL;
201     if (likely(spin_trylock(&parent->d_lock)))
202     return parent;
203     - spin_unlock(&dentry->d_lock);
204     rcu_read_lock();
205     + spin_unlock(&dentry->d_lock);
206     again:
207     parent = ACCESS_ONCE(dentry->d_parent);
208     spin_lock(&parent->d_lock);
209     diff --git a/fs/inode.c b/fs/inode.c
210     index f96d2a6f88cc..d2fb2f282fca 100644
211     --- a/fs/inode.c
212     +++ b/fs/inode.c
213     @@ -1839,14 +1839,18 @@ EXPORT_SYMBOL(inode_init_owner);
214     * inode_owner_or_capable - check current task permissions to inode
215     * @inode: inode being checked
216     *
217     - * Return true if current either has CAP_FOWNER to the inode, or
218     - * owns the file.
219     + * Return true if current either has CAP_FOWNER in a namespace with the
220     + * inode owner uid mapped, or owns the file.
221     */
222     bool inode_owner_or_capable(const struct inode *inode)
223     {
224     + struct user_namespace *ns;
225     +
226     if (uid_eq(current_fsuid(), inode->i_uid))
227     return true;
228     - if (inode_capable(inode, CAP_FOWNER))
229     +
230     + ns = current_user_ns();
231     + if (ns_capable(ns, CAP_FOWNER) && kuid_has_mapping(ns, inode->i_uid))
232     return true;
233     return false;
234     }
235     diff --git a/fs/namei.c b/fs/namei.c
236     index 80168273396b..985c6f368485 100644
237     --- a/fs/namei.c
238     +++ b/fs/namei.c
239     @@ -332,10 +332,11 @@ int generic_permission(struct inode *inode, int mask)
240    
241     if (S_ISDIR(inode->i_mode)) {
242     /* DACs are overridable for directories */
243     - if (inode_capable(inode, CAP_DAC_OVERRIDE))
244     + if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE))
245     return 0;
246     if (!(mask & MAY_WRITE))
247     - if (inode_capable(inode, CAP_DAC_READ_SEARCH))
248     + if (capable_wrt_inode_uidgid(inode,
249     + CAP_DAC_READ_SEARCH))
250     return 0;
251     return -EACCES;
252     }
253     @@ -345,7 +346,7 @@ int generic_permission(struct inode *inode, int mask)
254     * at least one exec bit set.
255     */
256     if (!(mask & MAY_EXEC) || (inode->i_mode & S_IXUGO))
257     - if (inode_capable(inode, CAP_DAC_OVERRIDE))
258     + if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE))
259     return 0;
260    
261     /*
262     @@ -353,7 +354,7 @@ int generic_permission(struct inode *inode, int mask)
263     */
264     mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
265     if (mask == MAY_READ)
266     - if (inode_capable(inode, CAP_DAC_READ_SEARCH))
267     + if (capable_wrt_inode_uidgid(inode, CAP_DAC_READ_SEARCH))
268     return 0;
269    
270     return -EACCES;
271     @@ -2379,7 +2380,7 @@ static inline int check_sticky(struct inode *dir, struct inode *inode)
272     return 0;
273     if (uid_eq(dir->i_uid, fsuid))
274     return 0;
275     - return !inode_capable(inode, CAP_FOWNER);
276     + return !capable_wrt_inode_uidgid(inode, CAP_FOWNER);
277     }
278    
279     /*
280     diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
281     index 0b18776b075e..6152cbe353e8 100644
282     --- a/fs/xfs/xfs_ioctl.c
283     +++ b/fs/xfs/xfs_ioctl.c
284     @@ -1215,7 +1215,7 @@ xfs_ioctl_setattr(
285     * cleared upon successful return from chown()
286     */
287     if ((ip->i_d.di_mode & (S_ISUID|S_ISGID)) &&
288     - !inode_capable(VFS_I(ip), CAP_FSETID))
289     + !capable_wrt_inode_uidgid(VFS_I(ip), CAP_FSETID))
290     ip->i_d.di_mode &= ~(S_ISUID|S_ISGID);
291    
292     /*
293     diff --git a/include/linux/capability.h b/include/linux/capability.h
294     index a6ee1f9a5018..84b13ad67c1c 100644
295     --- a/include/linux/capability.h
296     +++ b/include/linux/capability.h
297     @@ -210,7 +210,7 @@ extern bool has_ns_capability_noaudit(struct task_struct *t,
298     struct user_namespace *ns, int cap);
299     extern bool capable(int cap);
300     extern bool ns_capable(struct user_namespace *ns, int cap);
301     -extern bool inode_capable(const struct inode *inode, int cap);
302     +extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap);
303     extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);
304    
305     /* audit system wants to get cap info from files as well */
306     diff --git a/kernel/auditsc.c b/kernel/auditsc.c
307     index f251a5e8d17a..21eae3c05ec0 100644
308     --- a/kernel/auditsc.c
309     +++ b/kernel/auditsc.c
310     @@ -728,6 +728,22 @@ static enum audit_state audit_filter_task(struct task_struct *tsk, char **key)
311     return AUDIT_BUILD_CONTEXT;
312     }
313    
314     +static int audit_in_mask(const struct audit_krule *rule, unsigned long val)
315     +{
316     + int word, bit;
317     +
318     + if (val > 0xffffffff)
319     + return false;
320     +
321     + word = AUDIT_WORD(val);
322     + if (word >= AUDIT_BITMASK_SIZE)
323     + return false;
324     +
325     + bit = AUDIT_BIT(val);
326     +
327     + return rule->mask[word] & bit;
328     +}
329     +
330     /* At syscall entry and exit time, this filter is called if the
331     * audit_state is not low enough that auditing cannot take place, but is
332     * also not high enough that we already know we have to write an audit
333     @@ -745,11 +761,8 @@ static enum audit_state audit_filter_syscall(struct task_struct *tsk,
334    
335     rcu_read_lock();
336     if (!list_empty(list)) {
337     - int word = AUDIT_WORD(ctx->major);
338     - int bit = AUDIT_BIT(ctx->major);
339     -
340     list_for_each_entry_rcu(e, list, list) {
341     - if ((e->rule.mask[word] & bit) == bit &&
342     + if (audit_in_mask(&e->rule, ctx->major) &&
343     audit_filter_rules(tsk, &e->rule, ctx, NULL,
344     &state, false)) {
345     rcu_read_unlock();
346     @@ -769,20 +782,16 @@ static enum audit_state audit_filter_syscall(struct task_struct *tsk,
347     static int audit_filter_inode_name(struct task_struct *tsk,
348     struct audit_names *n,
349     struct audit_context *ctx) {
350     - int word, bit;
351     int h = audit_hash_ino((u32)n->ino);
352     struct list_head *list = &audit_inode_hash[h];
353     struct audit_entry *e;
354     enum audit_state state;
355    
356     - word = AUDIT_WORD(ctx->major);
357     - bit = AUDIT_BIT(ctx->major);
358     -
359     if (list_empty(list))
360     return 0;
361    
362     list_for_each_entry_rcu(e, list, list) {
363     - if ((e->rule.mask[word] & bit) == bit &&
364     + if (audit_in_mask(&e->rule, ctx->major) &&
365     audit_filter_rules(tsk, &e->rule, ctx, n, &state, false)) {
366     ctx->current_state = state;
367     return 1;
368     diff --git a/kernel/capability.c b/kernel/capability.c
369     index a8d63df0c322..24663b3e0635 100644
370     --- a/kernel/capability.c
371     +++ b/kernel/capability.c
372     @@ -424,23 +424,19 @@ bool capable(int cap)
373     EXPORT_SYMBOL(capable);
374    
375     /**
376     - * inode_capable - Check superior capability over inode
377     + * capable_wrt_inode_uidgid - Check nsown_capable and uid and gid mapped
378     * @inode: The inode in question
379     * @cap: The capability in question
380     *
381     - * Return true if the current task has the given superior capability
382     - * targeted at it's own user namespace and that the given inode is owned
383     - * by the current user namespace or a child namespace.
384     - *
385     - * Currently we check to see if an inode is owned by the current
386     - * user namespace by seeing if the inode's owner maps into the
387     - * current user namespace.
388     - *
389     + * Return true if the current task has the given capability targeted at
390     + * its own user namespace and that the given inode's uid and gid are
391     + * mapped into the current user namespace.
392     */
393     -bool inode_capable(const struct inode *inode, int cap)
394     +bool capable_wrt_inode_uidgid(const struct inode *inode, int cap)
395     {
396     struct user_namespace *ns = current_user_ns();
397    
398     - return ns_capable(ns, cap) && kuid_has_mapping(ns, inode->i_uid);
399     + return ns_capable(ns, cap) && kuid_has_mapping(ns, inode->i_uid) &&
400     + kgid_has_mapping(ns, inode->i_gid);
401     }
402     -EXPORT_SYMBOL(inode_capable);
403     +EXPORT_SYMBOL(capable_wrt_inode_uidgid);