]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.8-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Oct 2016 07:30:29 +0000 (09:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Oct 2016 07:30:29 +0000 (09:30 +0200)
added patches:
make-__xfs_xattr_put_listen-preperly-report-errors.patch
scsi-configure-runtime-pm-before-calling-device_add-in-scsi_add_host_with_dma.patch

queue-4.8/make-__xfs_xattr_put_listen-preperly-report-errors.patch [new file with mode: 0644]
queue-4.8/scsi-configure-runtime-pm-before-calling-device_add-in-scsi_add_host_with_dma.patch [new file with mode: 0644]
queue-4.8/series

diff --git a/queue-4.8/make-__xfs_xattr_put_listen-preperly-report-errors.patch b/queue-4.8/make-__xfs_xattr_put_listen-preperly-report-errors.patch
new file mode 100644 (file)
index 0000000..3ba51d0
--- /dev/null
@@ -0,0 +1,46 @@
+From 791cc43b36eb1f88166c8505900cad1b43c7fe1a Mon Sep 17 00:00:00 2001
+From: Artem Savkov <asavkov@redhat.com>
+Date: Wed, 14 Sep 2016 07:40:35 +1000
+Subject: Make __xfs_xattr_put_listen preperly report errors.
+
+From: Artem Savkov <asavkov@redhat.com>
+
+commit 791cc43b36eb1f88166c8505900cad1b43c7fe1a upstream.
+
+Commit 2a6fba6 "xfs: only return -errno or success from attr ->put_listent"
+changes the returnvalue of __xfs_xattr_put_listen to 0 in case when there is
+insufficient space in the buffer assuming that setting context->count to -1
+would be enough, but all of the ->put_listent callers only check seen_enough.
+This results in a failed assertion:
+XFS: Assertion failed: context->count >= 0, file: fs/xfs/xfs_xattr.c, line: 175
+in insufficient buffer size case.
+
+This is only reproducible with at least 2 xattrs and only when the buffer
+gets depleted before the last one.
+
+Furthermore if buffersize is such that it is enough to hold the last xattr's
+name, but not enough to hold the sum of preceeding xattr names listxattr won't
+fail with ERANGE, but will suceed returning last xattr's name without the
+first character. The first character end's up overwriting data stored at
+(context->alist - 1).
+
+Signed-off-by: Artem Savkov <asavkov@redhat.com>
+Reviewed-by: Dave Chinner <dchinner@redhat.com>
+Signed-off-by: Dave Chinner <david@fromorbit.com>
+Cc: Eric Sandeen <sandeen@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/xfs/xfs_xattr.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/fs/xfs/xfs_xattr.c
++++ b/fs/xfs/xfs_xattr.c
+@@ -147,6 +147,7 @@ __xfs_xattr_put_listent(
+       arraytop = context->count + prefix_len + namelen + 1;
+       if (arraytop > context->firstu) {
+               context->count = -1;    /* insufficient space */
++              context->seen_enough = 1;
+               return 0;
+       }
+       offset = (char *)context->alist + context->count;
diff --git a/queue-4.8/scsi-configure-runtime-pm-before-calling-device_add-in-scsi_add_host_with_dma.patch b/queue-4.8/scsi-configure-runtime-pm-before-calling-device_add-in-scsi_add_host_with_dma.patch
new file mode 100644 (file)
index 0000000..03c2c5e
--- /dev/null
@@ -0,0 +1,65 @@
+From 0d5644b7d8daa3c1d91acb4367731f568c9c9469 Mon Sep 17 00:00:00 2001
+From: Heiner Kallweit <hkallweit1@gmail.com>
+Date: Wed, 3 Aug 2016 21:49:03 +0200
+Subject: scsi: configure runtime pm before calling device_add in scsi_add_host_with_dma
+
+From: Heiner Kallweit <hkallweit1@gmail.com>
+
+commit 0d5644b7d8daa3c1d91acb4367731f568c9c9469 upstream.
+
+Runtime PM should be configured already once we call device_add. See
+also the description in this mail thread
+https://lists.linuxfoundation.org/pipermail/linux-pm/2009-November/023198.html
+or the order of calls e.g. in usb_new_device.
+
+The changed order also helps to avoid scenarios where runtime pm for
+&shost->shost_gendev is activated whilst the parent is suspended,
+resulting in error message "runtime PM trying to activate child device
+hostx but parent yyy is not active".
+
+In addition properly reverse the runtime pm calls in the error path.
+
+Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/hosts.c |   12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+--- a/drivers/scsi/hosts.c
++++ b/drivers/scsi/hosts.c
+@@ -246,10 +246,6 @@ int scsi_add_host_with_dma(struct Scsi_H
+       shost->dma_dev = dma_dev;
+-      error = device_add(&shost->shost_gendev);
+-      if (error)
+-              goto out_destroy_freelist;
+-
+       /*
+        * Increase usage count temporarily here so that calling
+        * scsi_autopm_put_host() will trigger runtime idle if there is
+@@ -260,6 +256,10 @@ int scsi_add_host_with_dma(struct Scsi_H
+       pm_runtime_enable(&shost->shost_gendev);
+       device_enable_async_suspend(&shost->shost_gendev);
++      error = device_add(&shost->shost_gendev);
++      if (error)
++              goto out_destroy_freelist;
++
+       scsi_host_set_state(shost, SHOST_RUNNING);
+       get_device(shost->shost_gendev.parent);
+@@ -309,6 +309,10 @@ int scsi_add_host_with_dma(struct Scsi_H
+  out_del_gendev:
+       device_del(&shost->shost_gendev);
+  out_destroy_freelist:
++      device_disable_async_suspend(&shost->shost_gendev);
++      pm_runtime_disable(&shost->shost_gendev);
++      pm_runtime_set_suspended(&shost->shost_gendev);
++      pm_runtime_put_noidle(&shost->shost_gendev);
+       scsi_destroy_command_freelist(shost);
+  out_destroy_tags:
+       if (shost_use_blk_mq(shost))
index 7d0d372c0773b90915bfd3b364f083c9348561ae..f4ea17fa2a5ded090ae5e579ef0dd39dc3a3367f 100644 (file)
@@ -1 +1,3 @@
 v4l-rcar-fcp-don-t-force-users-to-check-for-disabled-fcp-support.patch
+scsi-configure-runtime-pm-before-calling-device_add-in-scsi_add_host_with_dma.patch
+make-__xfs_xattr_put_listen-preperly-report-errors.patch