diff -druNp linux-libre-3.4.57-gnu1/drivers/char/virtio_console.c linux-libre-3.4.58-gnu1/drivers/char/virtio_console.c
--- linux-libre-3.4.57-gnu1/drivers/char/virtio_console.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/drivers/char/virtio_console.c	2013-08-15 01:57:16.000000000 -0400
@@ -256,9 +256,12 @@ static struct port *find_port_by_devt_in
 	unsigned long flags;
 
 	spin_lock_irqsave(&portdev->ports_lock, flags);
-	list_for_each_entry(port, &portdev->ports, list)
-		if (port->cdev->dev == dev)
+	list_for_each_entry(port, &portdev->ports, list) {
+		if (port->cdev->dev == dev) {
+			kref_get(&port->kref);
 			goto out;
+		}
+	}
 	port = NULL;
 out:
 	spin_unlock_irqrestore(&portdev->ports_lock, flags);
@@ -630,6 +633,10 @@ static ssize_t port_fops_read(struct fil
 
 	port = filp->private_data;
 
+	/* Port is hot-unplugged. */
+	if (!port->guest_connected)
+		return -ENODEV;
+
 	if (!port_has_data(port)) {
 		/*
 		 * If nothing's connected on the host just return 0 in
@@ -646,7 +653,7 @@ static ssize_t port_fops_read(struct fil
 		if (ret < 0)
 			return ret;
 	}
-	/* Port got hot-unplugged. */
+	/* Port got hot-unplugged while we were waiting above. */
 	if (!port->guest_connected)
 		return -ENODEV;
 	/*
@@ -789,14 +796,14 @@ static int port_fops_open(struct inode *
 	struct port *port;
 	int ret;
 
+	/* We get the port with a kref here */
 	port = find_port_by_devt(cdev->dev);
+	if (!port) {
+		/* Port was unplugged before we could proceed */
+		return -ENXIO;
+	}
 	filp->private_data = port;
 
-	/* Prevent against a port getting hot-unplugged at the same time */
-	spin_lock_irq(&port->portdev->ports_lock);
-	kref_get(&port->kref);
-	spin_unlock_irq(&port->portdev->ports_lock);
-
 	/*
 	 * Don't allow opening of console port devices -- that's done
 	 * via /dev/hvc
@@ -1254,14 +1261,6 @@ static void remove_port(struct kref *kre
 
 	port = container_of(kref, struct port, kref);
 
-	sysfs_remove_group(&port->dev->kobj, &port_attribute_group);
-	device_destroy(pdrvdata.class, port->dev->devt);
-	cdev_del(port->cdev);
-
-	kfree(port->name);
-
-	debugfs_remove(port->debugfs_file);
-
 	kfree(port);
 }
 
@@ -1291,12 +1290,14 @@ static void unplug_port(struct port *por
 	spin_unlock_irq(&port->portdev->ports_lock);
 
 	if (port->guest_connected) {
+		/* Let the app know the port is going down. */
+		send_sigio_to_port(port);
+
+		/* Do this after sigio is actually sent */
 		port->guest_connected = false;
 		port->host_connected = false;
-		wake_up_interruptible(&port->waitqueue);
 
-		/* Let the app know the port is going down. */
-		send_sigio_to_port(port);
+		wake_up_interruptible(&port->waitqueue);
 	}
 
 	if (is_console_port(port)) {
@@ -1315,6 +1316,14 @@ static void unplug_port(struct port *por
 	 */
 	port->portdev = NULL;
 
+	sysfs_remove_group(&port->dev->kobj, &port_attribute_group);
+	device_destroy(pdrvdata.class, port->dev->devt);
+	cdev_del(port->cdev);
+
+	kfree(port->name);
+
+	debugfs_remove(port->debugfs_file);
+
 	/*
 	 * Locks around here are not necessary - a port can't be
 	 * opened after we removed the port struct from ports_list
diff -druNp linux-libre-3.4.57-gnu1/drivers/hwmon/adt7470.c linux-libre-3.4.58-gnu1/drivers/hwmon/adt7470.c
--- linux-libre-3.4.57-gnu1/drivers/hwmon/adt7470.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/drivers/hwmon/adt7470.c	2013-08-15 01:57:16.000000000 -0400
@@ -215,7 +215,7 @@ static inline int adt7470_write_word_dat
 					  u16 value)
 {
 	return i2c_smbus_write_byte_data(client, reg, value & 0xFF)
-	       && i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
+	       || i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
 }
 
 static void adt7470_init_client(struct i2c_client *client)
diff -druNp linux-libre-3.4.57-gnu1/drivers/scsi/megaraid/megaraid_sas_base.c linux-libre-3.4.58-gnu1/drivers/scsi/megaraid/megaraid_sas_base.c
--- linux-libre-3.4.57-gnu1/drivers/scsi/megaraid/megaraid_sas_base.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/drivers/scsi/megaraid/megaraid_sas_base.c	2013-08-15 01:57:16.000000000 -0400
@@ -3493,11 +3493,21 @@ static int megasas_init_fw(struct megasa
 		break;
 	}
 
-	/*
-	 * We expect the FW state to be READY
-	 */
-	if (megasas_transition_to_ready(instance, 0))
-		goto fail_ready_state;
+	if (megasas_transition_to_ready(instance, 0)) {
+		atomic_set(&instance->fw_reset_no_pci_access, 1);
+		instance->instancet->adp_reset
+			(instance, instance->reg_set);
+		atomic_set(&instance->fw_reset_no_pci_access, 0);
+		dev_info(&instance->pdev->dev,
+			"megasas: FW restarted successfully from %s!\n",
+			__func__);
+
+		/*waitting for about 30 second before retry*/
+		ssleep(30);
+
+		if (megasas_transition_to_ready(instance, 0))
+			goto fail_ready_state;
+	}
 
 	/* Check if MSI-X is supported while in ready state */
 	msix_enable = (instance->instancet->read_fw_status_reg(reg_set) &
diff -druNp linux-libre-3.4.57-gnu1/drivers/scsi/nsp32.c linux-libre-3.4.58-gnu1/drivers/scsi/nsp32.c
--- linux-libre-3.4.57-gnu1/drivers/scsi/nsp32.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/drivers/scsi/nsp32.c	2013-08-15 01:57:16.000000000 -0400
@@ -2926,7 +2926,7 @@ static void nsp32_do_bus_reset(nsp32_hw_
 	 * reset SCSI bus
 	 */
 	nsp32_write1(base, SCSI_BUS_CONTROL, BUSCTL_RST);
-	udelay(RESET_HOLD_TIME);
+	mdelay(RESET_HOLD_TIME / 1000);
 	nsp32_write1(base, SCSI_BUS_CONTROL, 0);
 	for(i = 0; i < 5; i++) {
 		intrdat = nsp32_read2(base, IRQ_STATUS); /* dummy read */
diff -druNp linux-libre-3.4.57-gnu1/drivers/scsi/scsi.c linux-libre-3.4.58-gnu1/drivers/scsi/scsi.c
--- linux-libre-3.4.57-gnu1/drivers/scsi/scsi.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/drivers/scsi/scsi.c	2013-08-15 01:57:16.000000000 -0400
@@ -1025,6 +1025,9 @@ int scsi_get_vpd_page(struct scsi_device
 {
 	int i, result;
 
+	if (sdev->skip_vpd_pages)
+		goto fail;
+
 	/* Ask for all the pages supported by this device */
 	result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);
 	if (result)
diff -druNp linux-libre-3.4.57-gnu1/drivers/usb/core/hub.c linux-libre-3.4.58-gnu1/drivers/usb/core/hub.c
--- linux-libre-3.4.57-gnu1/drivers/usb/core/hub.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/drivers/usb/core/hub.c	2013-08-15 01:57:16.000000000 -0400
@@ -3890,7 +3890,8 @@ static void hub_events(void)
 					hub->hdev->children[i - 1];
 
 				dev_dbg(hub_dev, "warm reset port %d\n", i);
-				if (!udev) {
+				if (!udev || !(portstatus &
+						USB_PORT_STAT_CONNECTION)) {
 					status = hub_port_reset(hub, i,
 							NULL, HUB_BH_RESET_TIME,
 							true);
@@ -3900,8 +3901,8 @@ static void hub_events(void)
 					usb_lock_device(udev);
 					status = usb_reset_device(udev);
 					usb_unlock_device(udev);
+					connect_change = 0;
 				}
-				connect_change = 0;
 			}
 
 			if (connect_change)
diff -druNp linux-libre-3.4.57-gnu1/fs/cifs/cifsencrypt.c linux-libre-3.4.58-gnu1/fs/cifs/cifsencrypt.c
--- linux-libre-3.4.57-gnu1/fs/cifs/cifsencrypt.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/fs/cifs/cifsencrypt.c	2013-08-15 01:57:16.000000000 -0400
@@ -369,7 +369,7 @@ find_domain_name(struct cifs_ses *ses, c
 		if (blobptr + attrsize > blobend)
 			break;
 		if (type == NTLMSSP_AV_NB_DOMAIN_NAME) {
-			if (!attrsize)
+			if (!attrsize || attrsize >= CIFS_MAX_DOMAINNAME_LEN)
 				break;
 			if (!ses->domainName) {
 				ses->domainName =
diff -druNp linux-libre-3.4.57-gnu1/fs/cifs/cifsglob.h linux-libre-3.4.58-gnu1/fs/cifs/cifsglob.h
--- linux-libre-3.4.57-gnu1/fs/cifs/cifsglob.h	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/fs/cifs/cifsglob.h	2013-08-15 01:57:16.000000000 -0400
@@ -38,6 +38,7 @@
 #define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1)
 #define MAX_SERVER_SIZE 15
 #define MAX_SHARE_SIZE 80
+#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
 #define MAX_USERNAME_SIZE 256	/* reasonable maximum for current servers */
 #define MAX_PASSWORD_SIZE 512	/* max for windows seems to be 256 wide chars */
 
diff -druNp linux-libre-3.4.57-gnu1/fs/cifs/connect.c linux-libre-3.4.58-gnu1/fs/cifs/connect.c
--- linux-libre-3.4.57-gnu1/fs/cifs/connect.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/fs/cifs/connect.c	2013-08-15 01:57:16.000000000 -0400
@@ -1698,7 +1698,8 @@ cifs_parse_mount_options(const char *mou
 			if (string == NULL)
 				goto out_nomem;
 
-			if (strnlen(string, 256) == 256) {
+			if (strnlen(string, CIFS_MAX_DOMAINNAME_LEN)
+					== CIFS_MAX_DOMAINNAME_LEN) {
 				printk(KERN_WARNING "CIFS: domain name too"
 						    " long\n");
 				goto cifs_parse_mount_err;
@@ -2356,8 +2357,8 @@ cifs_put_smb_ses(struct cifs_ses *ses)
 
 #ifdef CONFIG_KEYS
 
-/* strlen("cifs:a:") + INET6_ADDRSTRLEN + 1 */
-#define CIFSCREDS_DESC_SIZE (7 + INET6_ADDRSTRLEN + 1)
+/* strlen("cifs:a:") + CIFS_MAX_DOMAINNAME_LEN + 1 */
+#define CIFSCREDS_DESC_SIZE (7 + CIFS_MAX_DOMAINNAME_LEN + 1)
 
 /* Populate username and pw fields from keyring if possible */
 static int
diff -druNp linux-libre-3.4.57-gnu1/fs/cifs/sess.c linux-libre-3.4.58-gnu1/fs/cifs/sess.c
--- linux-libre-3.4.57-gnu1/fs/cifs/sess.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/fs/cifs/sess.c	2013-08-15 01:57:16.000000000 -0400
@@ -198,7 +198,7 @@ static void unicode_domain_string(char *
 		bytes_ret = 0;
 	} else
 		bytes_ret = cifs_strtoUTF16((__le16 *) bcc_ptr, ses->domainName,
-					    256, nls_cp);
+					    CIFS_MAX_DOMAINNAME_LEN, nls_cp);
 	bcc_ptr += 2 * bytes_ret;
 	bcc_ptr += 2;  /* account for null terminator */
 
@@ -256,8 +256,8 @@ static void ascii_ssetup_strings(char **
 
 	/* copy domain */
 	if (ses->domainName != NULL) {
-		strncpy(bcc_ptr, ses->domainName, 256);
-		bcc_ptr += strnlen(ses->domainName, 256);
+		strncpy(bcc_ptr, ses->domainName, CIFS_MAX_DOMAINNAME_LEN);
+		bcc_ptr += strnlen(ses->domainName, CIFS_MAX_DOMAINNAME_LEN);
 	} /* else we will send a null domain name
 	     so the server will default to its own domain */
 	*bcc_ptr = 0;
diff -druNp linux-libre-3.4.57-gnu1/fs/dcache.c linux-libre-3.4.58-gnu1/fs/dcache.c
--- linux-libre-3.4.57-gnu1/fs/dcache.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/fs/dcache.c	2013-08-15 01:57:16.000000000 -0400
@@ -1556,7 +1556,7 @@ EXPORT_SYMBOL(d_find_any_alias);
  */
 struct dentry *d_obtain_alias(struct inode *inode)
 {
-	static const struct qstr anonstring = { .name = "" };
+	static const struct qstr anonstring = { .name = "/", .len = 1 };
 	struct dentry *tmp;
 	struct dentry *res;
 
diff -druNp linux-libre-3.4.57-gnu1/fs/debugfs/inode.c linux-libre-3.4.58-gnu1/fs/debugfs/inode.c
--- linux-libre-3.4.57-gnu1/fs/debugfs/inode.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/fs/debugfs/inode.c	2013-08-15 01:57:16.000000000 -0400
@@ -527,8 +527,7 @@ EXPORT_SYMBOL_GPL(debugfs_remove);
  */
 void debugfs_remove_recursive(struct dentry *dentry)
 {
-	struct dentry *child;
-	struct dentry *parent;
+	struct dentry *child, *next, *parent;
 
 	if (!dentry)
 		return;
@@ -538,61 +537,37 @@ void debugfs_remove_recursive(struct den
 		return;
 
 	parent = dentry;
+ down:
 	mutex_lock(&parent->d_inode->i_mutex);
+	list_for_each_entry_safe(child, next, &parent->d_subdirs, d_u.d_child) {
+		if (!debugfs_positive(child))
+			continue;
 
-	while (1) {
-		/*
-		 * When all dentries under "parent" has been removed,
-		 * walk up the tree until we reach our starting point.
-		 */
-		if (list_empty(&parent->d_subdirs)) {
-			mutex_unlock(&parent->d_inode->i_mutex);
-			if (parent == dentry)
-				break;
-			parent = parent->d_parent;
-			mutex_lock(&parent->d_inode->i_mutex);
-		}
-		child = list_entry(parent->d_subdirs.next, struct dentry,
-				d_u.d_child);
- next_sibling:
-
-		/*
-		 * If "child" isn't empty, walk down the tree and
-		 * remove all its descendants first.
-		 */
+		/* perhaps simple_empty(child) makes more sense */
 		if (!list_empty(&child->d_subdirs)) {
 			mutex_unlock(&parent->d_inode->i_mutex);
 			parent = child;
-			mutex_lock(&parent->d_inode->i_mutex);
-			continue;
-		}
-		__debugfs_remove(child, parent);
-		if (parent->d_subdirs.next == &child->d_u.d_child) {
-			/*
-			 * Try the next sibling.
-			 */
-			if (child->d_u.d_child.next != &parent->d_subdirs) {
-				child = list_entry(child->d_u.d_child.next,
-						   struct dentry,
-						   d_u.d_child);
-				goto next_sibling;
-			}
-
-			/*
-			 * Avoid infinite loop if we fail to remove
-			 * one dentry.
-			 */
-			mutex_unlock(&parent->d_inode->i_mutex);
-			break;
+			goto down;
 		}
-		simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ up:
+		if (!__debugfs_remove(child, parent))
+			simple_release_fs(&debugfs_mount, &debugfs_mount_count);
 	}
 
-	parent = dentry->d_parent;
+	mutex_unlock(&parent->d_inode->i_mutex);
+	child = parent;
+	parent = parent->d_parent;
 	mutex_lock(&parent->d_inode->i_mutex);
-	__debugfs_remove(dentry, parent);
+
+	if (child != dentry) {
+		next = list_entry(child->d_u.d_child.next, struct dentry,
+					d_u.d_child);
+		goto up;
+	}
+
+	if (!__debugfs_remove(child, parent))
+		simple_release_fs(&debugfs_mount, &debugfs_mount_count);
 	mutex_unlock(&parent->d_inode->i_mutex);
-	simple_release_fs(&debugfs_mount, &debugfs_mount_count);
 }
 EXPORT_SYMBOL_GPL(debugfs_remove_recursive);
 
diff -druNp linux-libre-3.4.57-gnu1/fs/ext4/ialloc.c linux-libre-3.4.58-gnu1/fs/ext4/ialloc.c
--- linux-libre-3.4.57-gnu1/fs/ext4/ialloc.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/fs/ext4/ialloc.c	2013-08-15 01:57:16.000000000 -0400
@@ -687,11 +687,8 @@ repeat_in_this_group:
 		ino = ext4_find_next_zero_bit((unsigned long *)
 					      inode_bitmap_bh->b_data,
 					      EXT4_INODES_PER_GROUP(sb), ino);
-		if (ino >= EXT4_INODES_PER_GROUP(sb)) {
-			if (++group == ngroups)
-				group = 0;
-			continue;
-		}
+		if (ino >= EXT4_INODES_PER_GROUP(sb))
+			goto next_group;
 		if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) {
 			ext4_error(sb, "reserved inode found cleared - "
 				   "inode=%lu", ino + 1);
@@ -709,6 +706,9 @@ repeat_in_this_group:
 			goto got; /* we grabbed the inode! */
 		if (ino < EXT4_INODES_PER_GROUP(sb))
 			goto repeat_in_this_group;
+next_group:
+		if (++group == ngroups)
+			group = 0;
 	}
 	err = -ENOSPC;
 	goto out;
diff -druNp linux-libre-3.4.57-gnu1/fs/ext4/super.c linux-libre-3.4.58-gnu1/fs/ext4/super.c
--- linux-libre-3.4.57-gnu1/fs/ext4/super.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/fs/ext4/super.c	2013-08-15 01:57:16.000000000 -0400
@@ -3232,7 +3232,7 @@ static int ext4_fill_super(struct super_
 		}
 		if (test_opt(sb, DIOREAD_NOLOCK)) {
 			ext4_msg(sb, KERN_ERR, "can't mount with "
-				 "both data=journal and delalloc");
+				 "both data=journal and dioread_nolock");
 			goto failed_mount;
 		}
 		if (test_opt(sb, DELALLOC))
@@ -4397,6 +4397,21 @@ static int ext4_remount(struct super_blo
 		goto restore_opts;
 	}
 
+	if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
+		if (test_opt2(sb, EXPLICIT_DELALLOC)) {
+			ext4_msg(sb, KERN_ERR, "can't mount with "
+				 "both data=journal and delalloc");
+			err = -EINVAL;
+			goto restore_opts;
+		}
+		if (test_opt(sb, DIOREAD_NOLOCK)) {
+			ext4_msg(sb, KERN_ERR, "can't mount with "
+				 "both data=journal and dioread_nolock");
+			err = -EINVAL;
+			goto restore_opts;
+		}
+	}
+
 	if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED)
 		ext4_abort(sb, "Abort forced by user");
 
diff -druNp linux-libre-3.4.57-gnu1/include/linux/ftrace_event.h linux-libre-3.4.58-gnu1/include/linux/ftrace_event.h
--- linux-libre-3.4.57-gnu1/include/linux/ftrace_event.h	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/include/linux/ftrace_event.h	2013-08-15 01:57:16.000000000 -0400
@@ -71,6 +71,8 @@ struct trace_iterator {
 	/* trace_seq for __print_flags() and __print_symbolic() etc. */
 	struct trace_seq	tmp_seq;
 
+	cpumask_var_t		started;
+
 	/* The below is zeroed out in pipe_read */
 	struct trace_seq	seq;
 	struct trace_entry	*ent;
@@ -83,7 +85,7 @@ struct trace_iterator {
 	loff_t			pos;
 	long			idx;
 
-	cpumask_var_t		started;
+	/* All new field here will be zeroed out in pipe_read */
 };
 
 
diff -druNp linux-libre-3.4.57-gnu1/kernel/trace/trace.c linux-libre-3.4.58-gnu1/kernel/trace/trace.c
--- linux-libre-3.4.57-gnu1/kernel/trace/trace.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/kernel/trace/trace.c	2013-08-15 01:57:16.000000000 -0400
@@ -3478,6 +3478,7 @@ waitagain:
 	memset(&iter->seq, 0,
 	       sizeof(struct trace_iterator) -
 	       offsetof(struct trace_iterator, seq));
+	cpumask_clear(iter->started);
 	iter->pos = -1;
 
 	trace_event_read_lock();
diff -druNp linux-libre-3.4.57-gnu1/Makefile linux-libre-3.4.58-gnu1/Makefile
--- linux-libre-3.4.57-gnu1/Makefile	2013-08-12 07:24:09.000000000 -0400
+++ linux-libre-3.4.58-gnu1/Makefile	2013-08-15 16:05:08.000000000 -0400
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 4
-SUBLEVEL = 57
+SUBLEVEL = 58
 EXTRAVERSION =-gnu1
 NAME = Saber-toothed Squirrel
 
diff -druNp linux-libre-3.4.57-gnu1/tools/perf/util/map.c linux-libre-3.4.58-gnu1/tools/perf/util/map.c
--- linux-libre-3.4.57-gnu1/tools/perf/util/map.c	2013-08-11 21:54:51.000000000 -0400
+++ linux-libre-3.4.58-gnu1/tools/perf/util/map.c	2013-08-15 01:57:16.000000000 -0400
@@ -15,7 +15,8 @@ const char *map_type__name[MAP__NR_TYPES
 
 static inline int is_anon_memory(const char *filename)
 {
-	return strcmp(filename, "//anon") == 0;
+	return !strcmp(filename, "//anon") ||
+	       !strcmp(filename, "/anon_hugepage (deleted)");
 }
 
 static inline int is_no_dso_memory(const char *filename)
