]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 May 2015 17:59:13 +0000 (19:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 May 2015 17:59:13 +0000 (19:59 +0200)
added patches:
iommu-vt-d-allow-rmrr-on-graphics-devices-too.patch
nfs-add-a-stub-for-getdevicelist.patch
nfsd-eliminate-nfsd_debug.patch
nfsd4-disallow-allocate-with-special-stateids.patch
nfsd4-disallow-seek-with-special-stateids.patch
nfsd4-fix-read-permission-checking.patch
revert-nfs-replace-nfs_add_stats-with-nfs_inc_stats-when-add-one.patch

queue-3.19/iommu-vt-d-allow-rmrr-on-graphics-devices-too.patch [new file with mode: 0644]
queue-3.19/nfs-add-a-stub-for-getdevicelist.patch [new file with mode: 0644]
queue-3.19/nfsd-eliminate-nfsd_debug.patch [new file with mode: 0644]
queue-3.19/nfsd4-disallow-allocate-with-special-stateids.patch [new file with mode: 0644]
queue-3.19/nfsd4-disallow-seek-with-special-stateids.patch [new file with mode: 0644]
queue-3.19/nfsd4-fix-read-permission-checking.patch [new file with mode: 0644]
queue-3.19/revert-nfs-replace-nfs_add_stats-with-nfs_inc_stats-when-add-one.patch [new file with mode: 0644]
queue-3.19/series

diff --git a/queue-3.19/iommu-vt-d-allow-rmrr-on-graphics-devices-too.patch b/queue-3.19/iommu-vt-d-allow-rmrr-on-graphics-devices-too.patch
new file mode 100644 (file)
index 0000000..0c98fc4
--- /dev/null
@@ -0,0 +1,63 @@
+From 18436afdc11a00ac881990b454cfb2eae81d6003 Mon Sep 17 00:00:00 2001
+From: David Woodhouse <David.Woodhouse@intel.com>
+Date: Wed, 25 Mar 2015 15:05:47 +0000
+Subject: iommu/vt-d: Allow RMRR on graphics devices too
+
+From: David Woodhouse <David.Woodhouse@intel.com>
+
+commit 18436afdc11a00ac881990b454cfb2eae81d6003 upstream.
+
+Commit c875d2c1 ("iommu/vt-d: Exclude devices using RMRRs from IOMMU API
+domains") prevents certain options for devices with RMRRs. This even
+prevents those devices from getting a 1:1 mapping with 'iommu=pt',
+because we don't have the code to handle *preserving* the RMRR regions
+when moving the device between domains.
+
+There's already an exclusion for USB devices, because we know the only
+reason for RMRRs there is a misguided desire to keep legacy
+keyboard/mouse emulation running in some theoretical OS which doesn't
+have support for USB in its own right... but which *does* enable the
+IOMMU.
+
+Add an exclusion for graphics devices too, so that 'iommu=pt' works
+there. We should be able to successfully assign graphics devices to
+guests too, as long as the initial handling of stolen memory is
+reconfigured appropriately. This has certainly worked in the past.
+
+Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/iommu/intel-iommu.c |    7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/drivers/iommu/intel-iommu.c
++++ b/drivers/iommu/intel-iommu.c
+@@ -50,6 +50,7 @@
+ #define CONTEXT_SIZE          VTD_PAGE_SIZE
+ #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
++#define IS_USB_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_SERIAL_USB)
+ #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA)
+ #define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e)
+@@ -2561,6 +2562,10 @@ static bool device_has_rmrr(struct devic
+  * In both cases we assume that PCI USB devices with RMRRs have them largely
+  * for historical reasons and that the RMRR space is not actively used post
+  * boot.  This exclusion may change if vendors begin to abuse it.
++ *
++ * The same exception is made for graphics devices, with the requirement that
++ * any use of the RMRR regions will be torn down before assigning the device
++ * to a guest.
+  */
+ static bool device_is_rmrr_locked(struct device *dev)
+ {
+@@ -2570,7 +2575,7 @@ static bool device_is_rmrr_locked(struct
+       if (dev_is_pci(dev)) {
+               struct pci_dev *pdev = to_pci_dev(dev);
+-              if ((pdev->class >> 8) == PCI_CLASS_SERIAL_USB)
++              if (IS_USB_DEVICE(pdev) || IS_GFX_DEVICE(pdev))
+                       return false;
+       }
diff --git a/queue-3.19/nfs-add-a-stub-for-getdevicelist.patch b/queue-3.19/nfs-add-a-stub-for-getdevicelist.patch
new file mode 100644 (file)
index 0000000..a6c5f33
--- /dev/null
@@ -0,0 +1,46 @@
+From 7c61f0d3897eeeff6f3294adb9f910ddefa8035a Mon Sep 17 00:00:00 2001
+From: Anna Schumaker <Anna.Schumaker@netapp.com>
+Date: Tue, 14 Apr 2015 10:34:20 -0400
+Subject: NFS: Add a stub for GETDEVICELIST
+
+From: Anna Schumaker <Anna.Schumaker@netapp.com>
+
+commit 7c61f0d3897eeeff6f3294adb9f910ddefa8035a upstream.
+
+d4b18c3e (pnfs: remove GETDEVICELIST implementation) removed the
+GETDEVICELIST operation from the NFS client, but left a "hole" in the
+nfs4_procedures array.  This caused /proc/self/mountstats to report an
+operation named "51" where GETDEVICELIST used to be.  This patch adds a
+stub to fix mountstats.
+
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Fixes: d4b18c3e (pnfs: remove GETDEVICELIST implementation)
+Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfs/nfs4xdr.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/fs/nfs/nfs4xdr.c
++++ b/fs/nfs/nfs4xdr.c
+@@ -7338,6 +7338,11 @@ nfs4_stat_to_errno(int stat)
+       .p_name   = #proc,                                      \
+ }
++#define STUB(proc)            \
++[NFSPROC4_CLNT_##proc] = {    \
++      .p_name = #proc,        \
++}
++
+ struct rpc_procinfo   nfs4_procedures[] = {
+       PROC(READ,              enc_read,               dec_read),
+       PROC(WRITE,             enc_write,              dec_write),
+@@ -7390,6 +7395,7 @@ struct rpc_procinfo      nfs4_procedures[] =
+       PROC(SECINFO_NO_NAME,   enc_secinfo_no_name,    dec_secinfo_no_name),
+       PROC(TEST_STATEID,      enc_test_stateid,       dec_test_stateid),
+       PROC(FREE_STATEID,      enc_free_stateid,       dec_free_stateid),
++      STUB(GETDEVICELIST),
+       PROC(BIND_CONN_TO_SESSION,
+                       enc_bind_conn_to_session, dec_bind_conn_to_session),
+       PROC(DESTROY_CLIENTID,  enc_destroy_clientid,   dec_destroy_clientid),
diff --git a/queue-3.19/nfsd-eliminate-nfsd_debug.patch b/queue-3.19/nfsd-eliminate-nfsd_debug.patch
new file mode 100644 (file)
index 0000000..45cdba8
--- /dev/null
@@ -0,0 +1,83 @@
+From 135dd002c23054aaa056ea3162c1e0356905c195 Mon Sep 17 00:00:00 2001
+From: Mark Salter <msalter@redhat.com>
+Date: Mon, 6 Apr 2015 09:46:00 -0400
+Subject: nfsd: eliminate NFSD_DEBUG
+
+From: Mark Salter <msalter@redhat.com>
+
+commit 135dd002c23054aaa056ea3162c1e0356905c195 upstream.
+
+Commit f895b252d4edf ("sunrpc: eliminate RPC_DEBUG") introduced
+use of IS_ENABLED() in a uapi header which leads to a build
+failure for userspace apps trying to use <linux/nfsd/debug.h>:
+
+   linux/nfsd/debug.h:18:15: error: missing binary operator before token "("
+  #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
+                ^
+
+Since this was only used to define NFSD_DEBUG if CONFIG_SUNRPC_DEBUG
+is enabled, replace instances of NFSD_DEBUG with CONFIG_SUNRPC_DEBUG.
+
+Fixes: f895b252d4edf "sunrpc: eliminate RPC_DEBUG"
+Signed-off-by: Mark Salter <msalter@redhat.com>
+Reviewed-by: Jeff Layton <jlayton@primarydata.com>
+Signed-off-by: J. Bruce Fields <bfields@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/lockd/svcsubs.c              |    2 +-
+ fs/nfsd/nfs4state.c             |    2 +-
+ fs/nfsd/nfsd.h                  |    2 +-
+ include/uapi/linux/nfsd/debug.h |    8 --------
+ 4 files changed, 3 insertions(+), 11 deletions(-)
+
+--- a/fs/lockd/svcsubs.c
++++ b/fs/lockd/svcsubs.c
+@@ -31,7 +31,7 @@
+ static struct hlist_head      nlm_files[FILE_NRHASH];
+ static DEFINE_MUTEX(nlm_file_mutex);
+-#ifdef NFSD_DEBUG
++#ifdef CONFIG_SUNRPC_DEBUG
+ static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
+ {
+       u32 *fhp = (u32*)f->data;
+--- a/fs/nfsd/nfs4state.c
++++ b/fs/nfsd/nfs4state.c
+@@ -1162,7 +1162,7 @@ hash_sessionid(struct nfs4_sessionid *se
+       return sid->sequence % SESSION_HASH_SIZE;
+ }
+-#ifdef NFSD_DEBUG
++#ifdef CONFIG_SUNRPC_DEBUG
+ static inline void
+ dump_sessionid(const char *fn, struct nfs4_sessionid *sessionid)
+ {
+--- a/fs/nfsd/nfsd.h
++++ b/fs/nfsd/nfsd.h
+@@ -24,7 +24,7 @@
+ #include "export.h"
+ #undef ifdebug
+-#ifdef NFSD_DEBUG
++#ifdef CONFIG_SUNRPC_DEBUG
+ # define ifdebug(flag)                if (nfsd_debug & NFSDDBG_##flag)
+ #else
+ # define ifdebug(flag)                if (0)
+--- a/include/uapi/linux/nfsd/debug.h
++++ b/include/uapi/linux/nfsd/debug.h
+@@ -12,14 +12,6 @@
+ #include <linux/sunrpc/debug.h>
+ /*
+- * Enable debugging for nfsd.
+- * Requires RPC_DEBUG.
+- */
+-#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
+-# define NFSD_DEBUG           1
+-#endif
+-
+-/*
+  * knfsd debug flags
+  */
+ #define NFSDDBG_SOCK          0x0001
diff --git a/queue-3.19/nfsd4-disallow-allocate-with-special-stateids.patch b/queue-3.19/nfsd4-disallow-allocate-with-special-stateids.patch
new file mode 100644 (file)
index 0000000..69230eb
--- /dev/null
@@ -0,0 +1,38 @@
+From 5ba4a25ab7b13be528b23f85182f4d09cf7f71ad Mon Sep 17 00:00:00 2001
+From: "J. Bruce Fields" <bfields@redhat.com>
+Date: Fri, 3 Apr 2015 16:24:27 -0400
+Subject: nfsd4: disallow ALLOCATE with special stateids
+
+From: "J. Bruce Fields" <bfields@redhat.com>
+
+commit 5ba4a25ab7b13be528b23f85182f4d09cf7f71ad upstream.
+
+vfs_fallocate will hit a NULL dereference if the client tries an
+ALLOCATE or DEALLOCATE with a special stateid.  Fix that.  (We also
+depend on the open to have broken any conflicting leases or delegations
+for us.)
+
+(If it turns out we need to allow special stateid's then we could do a
+temporary open here in the special-stateid case, as we do for read and
+write.  For now I'm assuming it's not necessary.)
+
+Fixes: 95d871f03cae "nfsd: Add ALLOCATE support"
+Cc: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Signed-off-by: J. Bruce Fields <bfields@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfsd/nfs4proc.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/nfsd/nfs4proc.c
++++ b/fs/nfsd/nfs4proc.c
+@@ -1028,6 +1028,8 @@ nfsd4_fallocate(struct svc_rqst *rqstp,
+               dprintk("NFSD: nfsd4_fallocate: couldn't process stateid!\n");
+               return status;
+       }
++      if (!file)
++              return nfserr_bad_stateid;
+       status = nfsd4_vfs_fallocate(rqstp, &cstate->current_fh, file,
+                                    fallocate->falloc_offset,
diff --git a/queue-3.19/nfsd4-disallow-seek-with-special-stateids.patch b/queue-3.19/nfsd4-disallow-seek-with-special-stateids.patch
new file mode 100644 (file)
index 0000000..b5559cf
--- /dev/null
@@ -0,0 +1,33 @@
+From 980608fb50aea34993ba956b71cd4602aa42b14b Mon Sep 17 00:00:00 2001
+From: "J. Bruce Fields" <bfields@redhat.com>
+Date: Tue, 21 Apr 2015 15:25:39 -0400
+Subject: nfsd4: disallow SEEK with special stateids
+
+From: "J. Bruce Fields" <bfields@redhat.com>
+
+commit 980608fb50aea34993ba956b71cd4602aa42b14b upstream.
+
+If the client uses a special stateid then we'll pass a NULL file to
+vfs_llseek.
+
+Fixes: 24bab491220f " NFSD: Implement SEEK"
+Cc: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Reported-by: Christoph Hellwig <hch@infradead.org>
+Signed-off-by: J. Bruce Fields <bfields@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfsd/nfs4proc.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/nfsd/nfs4proc.c
++++ b/fs/nfsd/nfs4proc.c
+@@ -1069,6 +1069,8 @@ nfsd4_seek(struct svc_rqst *rqstp, struc
+               dprintk("NFSD: nfsd4_seek: couldn't process stateid!\n");
+               return status;
+       }
++      if (!file)
++              return nfserr_bad_stateid;
+       switch (seek->seek_whence) {
+       case NFS4_CONTENT_DATA:
diff --git a/queue-3.19/nfsd4-fix-read-permission-checking.patch b/queue-3.19/nfsd4-fix-read-permission-checking.patch
new file mode 100644 (file)
index 0000000..42f8811
--- /dev/null
@@ -0,0 +1,52 @@
+From 6e4891dc289cd191d46ab7ba1dcb29646644f9ca Mon Sep 17 00:00:00 2001
+From: "J. Bruce Fields" <bfields@redhat.com>
+Date: Fri, 3 Apr 2015 17:19:41 -0400
+Subject: nfsd4: fix READ permission checking
+
+From: "J. Bruce Fields" <bfields@redhat.com>
+
+commit 6e4891dc289cd191d46ab7ba1dcb29646644f9ca upstream.
+
+In the case we already have a struct file (derived from a stateid), we
+still need to do permission-checking; otherwise an unauthorized user
+could gain access to a file by sniffing or guessing somebody else's
+stateid.
+
+Fixes: dc97618ddda9 "nfsd4: separate splice and readv cases"
+Signed-off-by: J. Bruce Fields <bfields@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfsd/nfs4xdr.c |   12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+--- a/fs/nfsd/nfs4xdr.c
++++ b/fs/nfsd/nfs4xdr.c
+@@ -3246,6 +3246,7 @@ nfsd4_encode_read(struct nfsd4_compoundr
+       unsigned long maxcount;
+       struct xdr_stream *xdr = &resp->xdr;
+       struct file *file = read->rd_filp;
++      struct svc_fh *fhp = read->rd_fhp;
+       int starting_len = xdr->buf->len;
+       struct raparms *ra;
+       __be32 *p;
+@@ -3269,12 +3270,15 @@ nfsd4_encode_read(struct nfsd4_compoundr
+       maxcount = min_t(unsigned long, maxcount, (xdr->buf->buflen - xdr->buf->len));
+       maxcount = min_t(unsigned long, maxcount, read->rd_length);
+-      if (!read->rd_filp) {
++      if (read->rd_filp)
++              err = nfsd_permission(resp->rqstp, fhp->fh_export,
++                              fhp->fh_dentry,
++                              NFSD_MAY_READ|NFSD_MAY_OWNER_OVERRIDE);
++      else
+               err = nfsd_get_tmp_read_open(resp->rqstp, read->rd_fhp,
+                                               &file, &ra);
+-              if (err)
+-                      goto err_truncate;
+-      }
++      if (err)
++              goto err_truncate;
+       if (file->f_op->splice_read && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags))
+               err = nfsd4_encode_splice_read(resp, read, file, maxcount);
diff --git a/queue-3.19/revert-nfs-replace-nfs_add_stats-with-nfs_inc_stats-when-add-one.patch b/queue-3.19/revert-nfs-replace-nfs_add_stats-with-nfs_inc_stats-when-add-one.patch
new file mode 100644 (file)
index 0000000..92b71e8
--- /dev/null
@@ -0,0 +1,54 @@
+From 3708f842e107b9b79d54a75d152e666b693649e8 Mon Sep 17 00:00:00 2001
+From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
+Date: Thu, 16 Apr 2015 18:48:39 +0800
+Subject: Revert "nfs: replace nfs_add_stats with nfs_inc_stats when add one"
+
+From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
+
+commit 3708f842e107b9b79d54a75d152e666b693649e8 upstream.
+
+This reverts commit 5a254d08b086d80cbead2ebcee6d2a4b3a15587a.
+
+Since commit 5a254d08b086 ("nfs: replace nfs_add_stats with
+nfs_inc_stats when add one"), nfs_readpage and nfs_do_writepage use
+nfs_inc_stats to increment NFSIOS_READPAGES and NFSIOS_WRITEPAGES
+instead of nfs_add_stats.
+
+However nfs_inc_stats does not do the same thing as nfs_add_stats with
+value 1 because these functions work on distinct stats:
+nfs_inc_stats increments stats from "enum nfs_stat_eventcounters" (in
+server->io_stats->events) and nfs_add_stats those from "enum
+nfs_stat_bytecounters" (in server->io_stats->bytes).
+
+Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
+Fixes: 5a254d08b086 ("nfs: replace nfs_add_stats with nfs_inc_stats...")
+Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfs/read.c  |    2 +-
+ fs/nfs/write.c |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/nfs/read.c
++++ b/fs/nfs/read.c
+@@ -269,7 +269,7 @@ int nfs_readpage(struct file *file, stru
+       dprintk("NFS: nfs_readpage (%p %ld@%lu)\n",
+               page, PAGE_CACHE_SIZE, page_file_index(page));
+       nfs_inc_stats(inode, NFSIOS_VFSREADPAGE);
+-      nfs_inc_stats(inode, NFSIOS_READPAGES);
++      nfs_add_stats(inode, NFSIOS_READPAGES, 1);
+       /*
+        * Try to flush any pending writes to the file..
+--- a/fs/nfs/write.c
++++ b/fs/nfs/write.c
+@@ -575,7 +575,7 @@ static int nfs_do_writepage(struct page
+       int ret;
+       nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
+-      nfs_inc_stats(inode, NFSIOS_WRITEPAGES);
++      nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1);
+       nfs_pageio_cond_complete(pgio, page_file_index(page));
+       ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE);
index 106c1f70dd5f5564efc7358f4f12ce02fb82fb67..70b75cb8767757297ce3a716302b5ac41adf9f06 100644 (file)
@@ -157,3 +157,10 @@ drm-adv7511-fix-nested-sleep-when-reading-edid.patch
 drm-i915-vlv-fix-save-restore-of-gfx_max_req_count-reg.patch
 drm-i915-cope-with-large-i2c-transfers.patch
 rcu-pathwalk-breakage-when-running-into-a-symlink-overmounting-something.patch
+revert-nfs-replace-nfs_add_stats-with-nfs_inc_stats-when-add-one.patch
+nfsd4-disallow-allocate-with-special-stateids.patch
+nfsd4-fix-read-permission-checking.patch
+nfsd4-disallow-seek-with-special-stateids.patch
+nfsd-eliminate-nfsd_debug.patch
+nfs-add-a-stub-for-getdevicelist.patch
+iommu-vt-d-allow-rmrr-on-graphics-devices-too.patch