Magellan Linux

Annotation of /trunk/kernel-lts/patches-3.4/0157-3.4.58-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2262 - (hide annotations) (download)
Mon Aug 19 09:25:45 2013 UTC (11 years, 1 month ago) by niro
File size: 15743 byte(s)
-linux-3.4.58
1 niro 2262 diff --git a/Makefile b/Makefile
2     index 7f4df0c..b19d508 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 3
7     PATCHLEVEL = 4
8     -SUBLEVEL = 57
9     +SUBLEVEL = 58
10     EXTRAVERSION =
11     NAME = Saber-toothed Squirrel
12    
13     diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
14     index f77e341..0cd2d50 100644
15     --- a/drivers/char/virtio_console.c
16     +++ b/drivers/char/virtio_console.c
17     @@ -256,9 +256,12 @@ static struct port *find_port_by_devt_in_portdev(struct ports_device *portdev,
18     unsigned long flags;
19    
20     spin_lock_irqsave(&portdev->ports_lock, flags);
21     - list_for_each_entry(port, &portdev->ports, list)
22     - if (port->cdev->dev == dev)
23     + list_for_each_entry(port, &portdev->ports, list) {
24     + if (port->cdev->dev == dev) {
25     + kref_get(&port->kref);
26     goto out;
27     + }
28     + }
29     port = NULL;
30     out:
31     spin_unlock_irqrestore(&portdev->ports_lock, flags);
32     @@ -630,6 +633,10 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf,
33    
34     port = filp->private_data;
35    
36     + /* Port is hot-unplugged. */
37     + if (!port->guest_connected)
38     + return -ENODEV;
39     +
40     if (!port_has_data(port)) {
41     /*
42     * If nothing's connected on the host just return 0 in
43     @@ -646,7 +653,7 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf,
44     if (ret < 0)
45     return ret;
46     }
47     - /* Port got hot-unplugged. */
48     + /* Port got hot-unplugged while we were waiting above. */
49     if (!port->guest_connected)
50     return -ENODEV;
51     /*
52     @@ -789,14 +796,14 @@ static int port_fops_open(struct inode *inode, struct file *filp)
53     struct port *port;
54     int ret;
55    
56     + /* We get the port with a kref here */
57     port = find_port_by_devt(cdev->dev);
58     + if (!port) {
59     + /* Port was unplugged before we could proceed */
60     + return -ENXIO;
61     + }
62     filp->private_data = port;
63    
64     - /* Prevent against a port getting hot-unplugged at the same time */
65     - spin_lock_irq(&port->portdev->ports_lock);
66     - kref_get(&port->kref);
67     - spin_unlock_irq(&port->portdev->ports_lock);
68     -
69     /*
70     * Don't allow opening of console port devices -- that's done
71     * via /dev/hvc
72     @@ -1254,14 +1261,6 @@ static void remove_port(struct kref *kref)
73    
74     port = container_of(kref, struct port, kref);
75    
76     - sysfs_remove_group(&port->dev->kobj, &port_attribute_group);
77     - device_destroy(pdrvdata.class, port->dev->devt);
78     - cdev_del(port->cdev);
79     -
80     - kfree(port->name);
81     -
82     - debugfs_remove(port->debugfs_file);
83     -
84     kfree(port);
85     }
86    
87     @@ -1291,12 +1290,14 @@ static void unplug_port(struct port *port)
88     spin_unlock_irq(&port->portdev->ports_lock);
89    
90     if (port->guest_connected) {
91     + /* Let the app know the port is going down. */
92     + send_sigio_to_port(port);
93     +
94     + /* Do this after sigio is actually sent */
95     port->guest_connected = false;
96     port->host_connected = false;
97     - wake_up_interruptible(&port->waitqueue);
98    
99     - /* Let the app know the port is going down. */
100     - send_sigio_to_port(port);
101     + wake_up_interruptible(&port->waitqueue);
102     }
103    
104     if (is_console_port(port)) {
105     @@ -1315,6 +1316,14 @@ static void unplug_port(struct port *port)
106     */
107     port->portdev = NULL;
108    
109     + sysfs_remove_group(&port->dev->kobj, &port_attribute_group);
110     + device_destroy(pdrvdata.class, port->dev->devt);
111     + cdev_del(port->cdev);
112     +
113     + kfree(port->name);
114     +
115     + debugfs_remove(port->debugfs_file);
116     +
117     /*
118     * Locks around here are not necessary - a port can't be
119     * opened after we removed the port struct from ports_list
120     diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
121     index 54ec8905..034085d 100644
122     --- a/drivers/hwmon/adt7470.c
123     +++ b/drivers/hwmon/adt7470.c
124     @@ -215,7 +215,7 @@ static inline int adt7470_write_word_data(struct i2c_client *client, u8 reg,
125     u16 value)
126     {
127     return i2c_smbus_write_byte_data(client, reg, value & 0xFF)
128     - && i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
129     + || i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
130     }
131    
132     static void adt7470_init_client(struct i2c_client *client)
133     diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
134     index 073d5ad..7926162 100644
135     --- a/drivers/scsi/megaraid/megaraid_sas_base.c
136     +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
137     @@ -3493,11 +3493,21 @@ static int megasas_init_fw(struct megasas_instance *instance)
138     break;
139     }
140    
141     - /*
142     - * We expect the FW state to be READY
143     - */
144     - if (megasas_transition_to_ready(instance, 0))
145     - goto fail_ready_state;
146     + if (megasas_transition_to_ready(instance, 0)) {
147     + atomic_set(&instance->fw_reset_no_pci_access, 1);
148     + instance->instancet->adp_reset
149     + (instance, instance->reg_set);
150     + atomic_set(&instance->fw_reset_no_pci_access, 0);
151     + dev_info(&instance->pdev->dev,
152     + "megasas: FW restarted successfully from %s!\n",
153     + __func__);
154     +
155     + /*waitting for about 30 second before retry*/
156     + ssleep(30);
157     +
158     + if (megasas_transition_to_ready(instance, 0))
159     + goto fail_ready_state;
160     + }
161    
162     /* Check if MSI-X is supported while in ready state */
163     msix_enable = (instance->instancet->read_fw_status_reg(reg_set) &
164     diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
165     index 62b6168..e705ed3 100644
166     --- a/drivers/scsi/nsp32.c
167     +++ b/drivers/scsi/nsp32.c
168     @@ -2926,7 +2926,7 @@ static void nsp32_do_bus_reset(nsp32_hw_data *data)
169     * reset SCSI bus
170     */
171     nsp32_write1(base, SCSI_BUS_CONTROL, BUSCTL_RST);
172     - udelay(RESET_HOLD_TIME);
173     + mdelay(RESET_HOLD_TIME / 1000);
174     nsp32_write1(base, SCSI_BUS_CONTROL, 0);
175     for(i = 0; i < 5; i++) {
176     intrdat = nsp32_read2(base, IRQ_STATUS); /* dummy read */
177     diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
178     index 07322ec..29fabff 100644
179     --- a/drivers/scsi/scsi.c
180     +++ b/drivers/scsi/scsi.c
181     @@ -1025,6 +1025,9 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf,
182     {
183     int i, result;
184    
185     + if (sdev->skip_vpd_pages)
186     + goto fail;
187     +
188     /* Ask for all the pages supported by this device */
189     result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);
190     if (result)
191     diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
192     index a969ec1..aa54fad 100644
193     --- a/drivers/usb/core/hub.c
194     +++ b/drivers/usb/core/hub.c
195     @@ -3890,7 +3890,8 @@ static void hub_events(void)
196     hub->hdev->children[i - 1];
197    
198     dev_dbg(hub_dev, "warm reset port %d\n", i);
199     - if (!udev) {
200     + if (!udev || !(portstatus &
201     + USB_PORT_STAT_CONNECTION)) {
202     status = hub_port_reset(hub, i,
203     NULL, HUB_BH_RESET_TIME,
204     true);
205     @@ -3900,8 +3901,8 @@ static void hub_events(void)
206     usb_lock_device(udev);
207     status = usb_reset_device(udev);
208     usb_unlock_device(udev);
209     + connect_change = 0;
210     }
211     - connect_change = 0;
212     }
213    
214     if (connect_change)
215     diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
216     index 6d0c62a..6dd3b61 100644
217     --- a/fs/cifs/cifsencrypt.c
218     +++ b/fs/cifs/cifsencrypt.c
219     @@ -369,7 +369,7 @@ find_domain_name(struct cifs_ses *ses, const struct nls_table *nls_cp)
220     if (blobptr + attrsize > blobend)
221     break;
222     if (type == NTLMSSP_AV_NB_DOMAIN_NAME) {
223     - if (!attrsize)
224     + if (!attrsize || attrsize >= CIFS_MAX_DOMAINNAME_LEN)
225     break;
226     if (!ses->domainName) {
227     ses->domainName =
228     diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
229     index 73fea28..a5fcf19 100644
230     --- a/fs/cifs/cifsglob.h
231     +++ b/fs/cifs/cifsglob.h
232     @@ -38,6 +38,7 @@
233     #define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1)
234     #define MAX_SERVER_SIZE 15
235     #define MAX_SHARE_SIZE 80
236     +#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
237     #define MAX_USERNAME_SIZE 256 /* reasonable maximum for current servers */
238     #define MAX_PASSWORD_SIZE 512 /* max for windows seems to be 256 wide chars */
239    
240     diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
241     index 9cc574c..e7fe81d 100644
242     --- a/fs/cifs/connect.c
243     +++ b/fs/cifs/connect.c
244     @@ -1698,7 +1698,8 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
245     if (string == NULL)
246     goto out_nomem;
247    
248     - if (strnlen(string, 256) == 256) {
249     + if (strnlen(string, CIFS_MAX_DOMAINNAME_LEN)
250     + == CIFS_MAX_DOMAINNAME_LEN) {
251     printk(KERN_WARNING "CIFS: domain name too"
252     " long\n");
253     goto cifs_parse_mount_err;
254     @@ -2356,8 +2357,8 @@ cifs_put_smb_ses(struct cifs_ses *ses)
255    
256     #ifdef CONFIG_KEYS
257    
258     -/* strlen("cifs:a:") + INET6_ADDRSTRLEN + 1 */
259     -#define CIFSCREDS_DESC_SIZE (7 + INET6_ADDRSTRLEN + 1)
260     +/* strlen("cifs:a:") + CIFS_MAX_DOMAINNAME_LEN + 1 */
261     +#define CIFSCREDS_DESC_SIZE (7 + CIFS_MAX_DOMAINNAME_LEN + 1)
262    
263     /* Populate username and pw fields from keyring if possible */
264     static int
265     diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
266     index 551d0c2..de9b1c1 100644
267     --- a/fs/cifs/sess.c
268     +++ b/fs/cifs/sess.c
269     @@ -198,7 +198,7 @@ static void unicode_domain_string(char **pbcc_area, struct cifs_ses *ses,
270     bytes_ret = 0;
271     } else
272     bytes_ret = cifs_strtoUTF16((__le16 *) bcc_ptr, ses->domainName,
273     - 256, nls_cp);
274     + CIFS_MAX_DOMAINNAME_LEN, nls_cp);
275     bcc_ptr += 2 * bytes_ret;
276     bcc_ptr += 2; /* account for null terminator */
277    
278     @@ -256,8 +256,8 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses,
279    
280     /* copy domain */
281     if (ses->domainName != NULL) {
282     - strncpy(bcc_ptr, ses->domainName, 256);
283     - bcc_ptr += strnlen(ses->domainName, 256);
284     + strncpy(bcc_ptr, ses->domainName, CIFS_MAX_DOMAINNAME_LEN);
285     + bcc_ptr += strnlen(ses->domainName, CIFS_MAX_DOMAINNAME_LEN);
286     } /* else we will send a null domain name
287     so the server will default to its own domain */
288     *bcc_ptr = 0;
289     diff --git a/fs/dcache.c b/fs/dcache.c
290     index e498de2..9d39de4 100644
291     --- a/fs/dcache.c
292     +++ b/fs/dcache.c
293     @@ -1556,7 +1556,7 @@ EXPORT_SYMBOL(d_find_any_alias);
294     */
295     struct dentry *d_obtain_alias(struct inode *inode)
296     {
297     - static const struct qstr anonstring = { .name = "" };
298     + static const struct qstr anonstring = { .name = "/", .len = 1 };
299     struct dentry *tmp;
300     struct dentry *res;
301    
302     diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
303     index b80bc84..9dc6e76 100644
304     --- a/fs/debugfs/inode.c
305     +++ b/fs/debugfs/inode.c
306     @@ -527,8 +527,7 @@ EXPORT_SYMBOL_GPL(debugfs_remove);
307     */
308     void debugfs_remove_recursive(struct dentry *dentry)
309     {
310     - struct dentry *child;
311     - struct dentry *parent;
312     + struct dentry *child, *next, *parent;
313    
314     if (!dentry)
315     return;
316     @@ -538,61 +537,37 @@ void debugfs_remove_recursive(struct dentry *dentry)
317     return;
318    
319     parent = dentry;
320     + down:
321     mutex_lock(&parent->d_inode->i_mutex);
322     + list_for_each_entry_safe(child, next, &parent->d_subdirs, d_u.d_child) {
323     + if (!debugfs_positive(child))
324     + continue;
325    
326     - while (1) {
327     - /*
328     - * When all dentries under "parent" has been removed,
329     - * walk up the tree until we reach our starting point.
330     - */
331     - if (list_empty(&parent->d_subdirs)) {
332     - mutex_unlock(&parent->d_inode->i_mutex);
333     - if (parent == dentry)
334     - break;
335     - parent = parent->d_parent;
336     - mutex_lock(&parent->d_inode->i_mutex);
337     - }
338     - child = list_entry(parent->d_subdirs.next, struct dentry,
339     - d_u.d_child);
340     - next_sibling:
341     -
342     - /*
343     - * If "child" isn't empty, walk down the tree and
344     - * remove all its descendants first.
345     - */
346     + /* perhaps simple_empty(child) makes more sense */
347     if (!list_empty(&child->d_subdirs)) {
348     mutex_unlock(&parent->d_inode->i_mutex);
349     parent = child;
350     - mutex_lock(&parent->d_inode->i_mutex);
351     - continue;
352     + goto down;
353     }
354     - __debugfs_remove(child, parent);
355     - if (parent->d_subdirs.next == &child->d_u.d_child) {
356     - /*
357     - * Try the next sibling.
358     - */
359     - if (child->d_u.d_child.next != &parent->d_subdirs) {
360     - child = list_entry(child->d_u.d_child.next,
361     - struct dentry,
362     - d_u.d_child);
363     - goto next_sibling;
364     - }
365     -
366     - /*
367     - * Avoid infinite loop if we fail to remove
368     - * one dentry.
369     - */
370     - mutex_unlock(&parent->d_inode->i_mutex);
371     - break;
372     - }
373     - simple_release_fs(&debugfs_mount, &debugfs_mount_count);
374     + up:
375     + if (!__debugfs_remove(child, parent))
376     + simple_release_fs(&debugfs_mount, &debugfs_mount_count);
377     }
378    
379     - parent = dentry->d_parent;
380     + mutex_unlock(&parent->d_inode->i_mutex);
381     + child = parent;
382     + parent = parent->d_parent;
383     mutex_lock(&parent->d_inode->i_mutex);
384     - __debugfs_remove(dentry, parent);
385     +
386     + if (child != dentry) {
387     + next = list_entry(child->d_u.d_child.next, struct dentry,
388     + d_u.d_child);
389     + goto up;
390     + }
391     +
392     + if (!__debugfs_remove(child, parent))
393     + simple_release_fs(&debugfs_mount, &debugfs_mount_count);
394     mutex_unlock(&parent->d_inode->i_mutex);
395     - simple_release_fs(&debugfs_mount, &debugfs_mount_count);
396     }
397     EXPORT_SYMBOL_GPL(debugfs_remove_recursive);
398    
399     diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
400     index e42b468..b1c3f2a 100644
401     --- a/fs/ext4/ialloc.c
402     +++ b/fs/ext4/ialloc.c
403     @@ -687,11 +687,8 @@ repeat_in_this_group:
404     ino = ext4_find_next_zero_bit((unsigned long *)
405     inode_bitmap_bh->b_data,
406     EXT4_INODES_PER_GROUP(sb), ino);
407     - if (ino >= EXT4_INODES_PER_GROUP(sb)) {
408     - if (++group == ngroups)
409     - group = 0;
410     - continue;
411     - }
412     + if (ino >= EXT4_INODES_PER_GROUP(sb))
413     + goto next_group;
414     if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) {
415     ext4_error(sb, "reserved inode found cleared - "
416     "inode=%lu", ino + 1);
417     @@ -709,6 +706,9 @@ repeat_in_this_group:
418     goto got; /* we grabbed the inode! */
419     if (ino < EXT4_INODES_PER_GROUP(sb))
420     goto repeat_in_this_group;
421     +next_group:
422     + if (++group == ngroups)
423     + group = 0;
424     }
425     err = -ENOSPC;
426     goto out;
427     diff --git a/fs/ext4/super.c b/fs/ext4/super.c
428     index b93de81..8bbb14c 100644
429     --- a/fs/ext4/super.c
430     +++ b/fs/ext4/super.c
431     @@ -3232,7 +3232,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
432     }
433     if (test_opt(sb, DIOREAD_NOLOCK)) {
434     ext4_msg(sb, KERN_ERR, "can't mount with "
435     - "both data=journal and delalloc");
436     + "both data=journal and dioread_nolock");
437     goto failed_mount;
438     }
439     if (test_opt(sb, DELALLOC))
440     @@ -4397,6 +4397,21 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
441     goto restore_opts;
442     }
443    
444     + if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
445     + if (test_opt2(sb, EXPLICIT_DELALLOC)) {
446     + ext4_msg(sb, KERN_ERR, "can't mount with "
447     + "both data=journal and delalloc");
448     + err = -EINVAL;
449     + goto restore_opts;
450     + }
451     + if (test_opt(sb, DIOREAD_NOLOCK)) {
452     + ext4_msg(sb, KERN_ERR, "can't mount with "
453     + "both data=journal and dioread_nolock");
454     + err = -EINVAL;
455     + goto restore_opts;
456     + }
457     + }
458     +
459     if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED)
460     ext4_abort(sb, "Abort forced by user");
461    
462     diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
463     index 176a939..16cad53 100644
464     --- a/include/linux/ftrace_event.h
465     +++ b/include/linux/ftrace_event.h
466     @@ -71,6 +71,8 @@ struct trace_iterator {
467     /* trace_seq for __print_flags() and __print_symbolic() etc. */
468     struct trace_seq tmp_seq;
469    
470     + cpumask_var_t started;
471     +
472     /* The below is zeroed out in pipe_read */
473     struct trace_seq seq;
474     struct trace_entry *ent;
475     @@ -83,7 +85,7 @@ struct trace_iterator {
476     loff_t pos;
477     long idx;
478    
479     - cpumask_var_t started;
480     + /* All new field here will be zeroed out in pipe_read */
481     };
482    
483    
484     diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
485     index 13cd224..5dd9626 100644
486     --- a/kernel/trace/trace.c
487     +++ b/kernel/trace/trace.c
488     @@ -3478,6 +3478,7 @@ waitagain:
489     memset(&iter->seq, 0,
490     sizeof(struct trace_iterator) -
491     offsetof(struct trace_iterator, seq));
492     + cpumask_clear(iter->started);
493     iter->pos = -1;
494    
495     trace_event_read_lock();
496     diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
497     index 35ae568..9593f27 100644
498     --- a/tools/perf/util/map.c
499     +++ b/tools/perf/util/map.c
500     @@ -15,7 +15,8 @@ const char *map_type__name[MAP__NR_TYPES] = {
501    
502     static inline int is_anon_memory(const char *filename)
503     {
504     - return strcmp(filename, "//anon") == 0;
505     + return !strcmp(filename, "//anon") ||
506     + !strcmp(filename, "/anon_hugepage (deleted)");
507     }
508    
509     static inline int is_no_dso_memory(const char *filename)