1. 15 3月, 2016 8 次提交
  2. 24 2月, 2016 1 次提交
    • S
      sunrpc/cache: fix off-by-one in qword_get() · b7052cd7
      Stefan Hajnoczi 提交于
      The qword_get() function NUL-terminates its output buffer.  If the input
      string is in hex format \xXXXX... and the same length as the output
      buffer, there is an off-by-one:
      
        int qword_get(char **bpp, char *dest, int bufsize)
        {
            ...
            while (len < bufsize) {
                ...
                *dest++ = (h << 4) | l;
                len++;
            }
            ...
            *dest = '\0';
            return len;
        }
      
      This patch ensures the NUL terminator doesn't fall outside the output
      buffer.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      b7052cd7
  3. 18 2月, 2016 1 次提交
    • S
      auth_gss: fix panic in gss_pipe_downcall() in fips mode · 437b300c
      Scott Mayhew 提交于
      On Mon, 15 Feb 2016, Trond Myklebust wrote:
      
      > Hi Scott,
      >
      > On Mon, Feb 15, 2016 at 2:28 PM, Scott Mayhew <smayhew@redhat.com> wrote:
      > > md5 is disabled in fips mode, and attempting to import a gss context
      > > using md5 while in fips mode will result in crypto_alg_mod_lookup()
      > > returning -ENOENT, which will make its way back up to
      > > gss_pipe_downcall(), where the BUG() is triggered.  Handling the -ENOENT
      > > allows for a more graceful failure.
      > >
      > > Signed-off-by: Scott Mayhew <smayhew@redhat.com>
      > > ---
      > >  net/sunrpc/auth_gss/auth_gss.c | 3 +++
      > >  1 file changed, 3 insertions(+)
      > >
      > > diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
      > > index 799e65b..c30fc3b 100644
      > > --- a/net/sunrpc/auth_gss/auth_gss.c
      > > +++ b/net/sunrpc/auth_gss/auth_gss.c
      > > @@ -737,6 +737,9 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
      > >                 case -ENOSYS:
      > >                         gss_msg->msg.errno = -EAGAIN;
      > >                         break;
      > > +               case -ENOENT:
      > > +                       gss_msg->msg.errno = -EPROTONOSUPPORT;
      > > +                       break;
      > >                 default:
      > >                         printk(KERN_CRIT "%s: bad return from "
      > >                                 "gss_fill_context: %zd\n", __func__, err);
      > > --
      > > 2.4.3
      > >
      >
      > Well debugged, but I unfortunately do have to ask if this patch is
      > sufficient? In addition to -ENOENT, and -ENOMEM, it looks to me as if
      > crypto_alg_mod_lookup() can also fail with -EINTR, -ETIMEDOUT, and
      > -EAGAIN. Don't we also want to handle those?
      
      You're right, I was focusing on the panic that I could easily reproduce.
      I'm still not sure how I could trigger those other conditions.
      
      >
      > In fact, peering into the rats nest that is
      > gss_import_sec_context_kerberos(), it looks as if that is just a tiny
      > subset of all the errors that we might run into. Perhaps the right
      > thing to do here is to get rid of the BUG() (but keep the above
      > printk) and just return a generic error?
      
      That sounds fine to me -- updated patch attached.
      
      -Scott
      
      >From d54c6b64a107a90a38cab97577de05f9a4625052 Mon Sep 17 00:00:00 2001
      From: Scott Mayhew <smayhew@redhat.com>
      Date: Mon, 15 Feb 2016 15:12:19 -0500
      Subject: [PATCH] auth_gss: remove the BUG() from gss_pipe_downcall()
      
      Instead return a generic error via gss_msg->msg.errno.  None of the
      errors returned by gss_fill_context() should necessarily trigger a
      kernel panic.
      Signed-off-by: NScott Mayhew <smayhew@redhat.com>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      437b300c
  4. 17 2月, 2016 1 次提交
  5. 23 1月, 2016 1 次提交
    • A
      wrappers for ->i_mutex access · 5955102c
      Al Viro 提交于
      parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
      inode_foo(inode) being mutex_foo(&inode->i_mutex).
      
      Please, use those for access to ->i_mutex; over the coming cycle
      ->i_mutex will become rwsem, with ->lookup() done with it held
      only shared.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      5955102c
  6. 20 1月, 2016 11 次提交
  7. 15 1月, 2016 1 次提交
    • V
      kmemcg: account certain kmem allocations to memcg · 5d097056
      Vladimir Davydov 提交于
      Mark those kmem allocations that are known to be easily triggered from
      userspace as __GFP_ACCOUNT/SLAB_ACCOUNT, which makes them accounted to
      memcg.  For the list, see below:
      
       - threadinfo
       - task_struct
       - task_delay_info
       - pid
       - cred
       - mm_struct
       - vm_area_struct and vm_region (nommu)
       - anon_vma and anon_vma_chain
       - signal_struct
       - sighand_struct
       - fs_struct
       - files_struct
       - fdtable and fdtable->full_fds_bits
       - dentry and external_name
       - inode for all filesystems. This is the most tedious part, because
         most filesystems overwrite the alloc_inode method.
      
      The list is far from complete, so feel free to add more objects.
      Nevertheless, it should be close to "account everything" approach and
      keep most workloads within bounds.  Malevolent users will be able to
      breach the limit, but this was possible even with the former "account
      everything" approach (simply because it did not account everything in
      fact).
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: NVladimir Davydov <vdavydov@virtuozzo.com>
      Acked-by: NJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Greg Thelen <gthelen@google.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5d097056
  8. 07 1月, 2016 2 次提交
    • J
      Revert "svcrdma: Do not send XDR roundup bytes for a write chunk" · 3daa020f
      J. Bruce Fields 提交于
      This reverts commit 6f18dc89.
      
      Just as one example, it appears this code could do the wrong thing in
      the case of a two-byte NFS READ that crosses a page boundary.
      
      Chuck says: "In that case, nfsd would pass down an xdr_buf that has one
      byte in a page, one byte in another page, and a two-byte XDR pad. The
      logic introduced by this optimization would be fooled, and neither the
      second byte nor the XDR pad would be written to the client."
      
      Cc: Chuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      3daa020f
    • T
      SUNRPC: Fixup socket wait for memory · 13331a55
      Trond Myklebust 提交于
      We're seeing hangs in the NFS client code, with loops of the form:
      
       RPC: 30317 xmit incomplete (267368 left of 524448)
       RPC: 30317 call_status (status -11)
       RPC: 30317 call_transmit (status 0)
       RPC: 30317 xprt_prepare_transmit
       RPC: 30317 xprt_transmit(524448)
       RPC:       xs_tcp_send_request(267368) = -11
       RPC: 30317 xmit incomplete (267368 left of 524448)
       RPC: 30317 call_status (status -11)
       RPC: 30317 call_transmit (status 0)
       RPC: 30317 xprt_prepare_transmit
       RPC: 30317 xprt_transmit(524448)
      
      Turns out commit ceb5d58b ("net: fix sock_wake_async() rcu protection")
      moved SOCKWQ_ASYNC_NOSPACE out of sock->flags and into sk->sk_wq->flags,
      however it never tried to fix up the code in net/sunrpc.
      
      The new idiom is to use the flags in the RCU protected struct socket_wq.
      While we're at it, clear out the now redundant places where we set/clear
      SOCKWQ_ASYNC_NOSPACE and SOCK_NOSPACE. In principle, sk_stream_wait_memory()
      is supposed to set these for us, so we only need to clear them in the
      particular case of our ->write_space() callback.
      
      Fixes: ceb5d58b ("net: fix sock_wake_async() rcu protection")
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: stable@vger.kernel.org # 4.4
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      13331a55
  9. 31 12月, 2015 1 次提交
  10. 28 12月, 2015 1 次提交
  11. 23 12月, 2015 2 次提交
  12. 19 12月, 2015 10 次提交