1. 10 Jun, 2013 40 commits
    • Eric Dumazet's avatar
      softirq: reduce latencies · 3003ed64
      Eric Dumazet authored
      In various network workloads, __do_softirq() latencies can be up
      to 20 ms if HZ=1000, and 200 ms if HZ=100.
      
      This is because we iterate 10 times in the softirq dispatcher,
      and some actions can consume a lot of cycles.
      
      This patch changes the fallback to ksoftirqd condition to :
      
      - A time limit of 2 ms.
      - need_resched() being set on current task
      
      When one of this condition is met, we wakeup ksoftirqd for further
      softirq processing if we still have pending softirqs.
      
      Using need_resched() as the only condition can trigger RCU stalls,
      as we can keep BH disabled for too long.
      
      I ran several benchmarks and got no significant difference in
      throughput, but a very significant reduction of latencies (one order
      of magnitude) :
      
      In following bench, 200 antagonist "netperf -t TCP_RR" are started in
      background, using all available cpus.
      
      Then we start one "netperf -t TCP_RR", bound to the cpu handling the NIC
      IRQ (hard+soft)
      
      Before patch :
      
      RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
      MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
      to 7.7.7.84 () port 0 AF_INET : first burst 0 : cpu bind
      RT_LATENCY=550110.424
      MIN_LATENCY=146858
      MAX_LATENCY=997109
      P50_LATENCY=305000
      P90_LATENCY=550000
      P99_LATENCY=710000
      MEAN_LATENCY=376989.12
      STDDEV_LATENCY=184046.92
      
      After patch :
      
      RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
      MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
      to 7.7.7.84 () port 0 AF_INET : first burst 0 : cpu bind
      RT_LATENCY=40545.492
      MIN_LATENCY=9834
      MAX_LATENCY=78366
      P50_LATENCY=33583
      P90_LATENCY=59000
      P99_LATENCY=69000
      MEAN_LATENCY=38364.67
      STDDEV_LATENCY=12865.26
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: David Miller <davem@davemloft.net>
      Cc: Tom Herbert <therbert@google.com>
      Cc: Ben Hutchings <bhutchings@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      (cherry picked from commit c10d7367)
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      3003ed64
    • Eric Dumazet's avatar
      net: reduce net_rx_action() latency to 2 HZ · e072f1c6
      Eric Dumazet authored
      We should use time_after_eq() to get maximum latency of two ticks,
      instead of three.
      
      Bug added in commit 24f8b238 (net: increase receive packet quantum)
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      (cherry picked from commit d1f41b67)
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      e072f1c6
    • Alexey Khoroshilov's avatar
      net/core: Fix potential memory leak in dev_set_alias() · b680135d
      Alexey Khoroshilov authored
      [ Upstream commit 7364e445 ]
      
      Do not leak memory by updating pointer with potentially NULL realloc return value.
      
      Found by Linux Driver Verification project (linuxtesting.org).
      Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      b680135d
    • J. Bruce Fields's avatar
      nfsd4: fix oops on unusual readlike compound · be1a41d7
      J. Bruce Fields authored
      commit d5f50b0c upstream.
      
      If the argument and reply together exceed the maximum payload size, then
      a reply with a read-like operation can overlow the rq_pages array.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      be1a41d7
    • Trond Myklebust's avatar
      kernel panic when mount NFSv4 · fc9e795a
      Trond Myklebust authored
      On Tue, 2010-12-14 at 16:58 +0800, Mi Jinlong wrote:
      > Hi,
      >
      > When testing NFSv4 at RHEL6 with kernel 2.6.32, I got a kernel panic
      > at NFS client's __rpc_create_common function.
      >
      > The panic place is:
      >   rpc_mkpipe
      >     __rpc_lookup_create()          <=== find pipefile *idmap*
      >     __rpc_mkpipe()                 <=== pipefile is *idmap*
      >       __rpc_create_common()
      >        ******  BUG_ON(!d_unhashed(dentry)); ******    *panic*
      >
      > It means that the dentry's d_flags have be set DCACHE_UNHASHED,
      > but it should not be set here.
      >
      > Is someone known this bug? or give me some idea?
      >
      > A reproduce program is append, but it can't reproduce the bug every time.
      > the export is: "/nfsroot       *(rw,no_root_squash,fsid=0,insecure)"
      >
      > And the panic message is append.
      >
      > ============================================================================
      > #!/bin/sh
      >
      > LOOPTOTAL=768
      > LOOPCOUNT=0
      > ret=0
      >
      > while [ $LOOPCOUNT -ne $LOOPTOTAL ]
      > do
      > 	((LOOPCOUNT += 1))
      > 	service nfs restart
      > 	/usr/sbin/rpc.idmapd
      > 	mount -t nfs4 127.0.0.1:/ /mnt|| return 1;
      > 	ls -l /var/lib/nfs/rpc_pipefs/nfs/*/
      > 	umount /mnt
      > 	echo $LOOPCOUNT
      > done
      >
      > ===============================================================================
      > Code: af 60 01 00 00 89 fa 89 f0 e8 64 cf 89 f0 e8 5c 7c 64 cf 31 c0 8b 5c 24 10 8b
      > 74 24 14 8b 7c 24 18 8b 6c 24 1c 83 c4 20 c3 <0f> 0b eb fc 8b 46 28 c7 44 24 08 20
      > de ee f0 c7 44 24 04 56 ea
      > EIP:[<f0ee92ea>] __rpc_create_common+0x8a/0xc0 [sunrpc] SS:ESP 0068:eccb5d28
      > ---[ end trace 8f5606cd08928ed2]---
      > Kernel panic - not syncing: Fatal exception
      > Pid:7131, comm: mount.nfs4 Tainted: G     D   -------------------2.6.32 #1
      > Call Trace:
      >  [<c080ad18>] ? panic+0x42/0xed
      >  [<c080e42c>] ? oops_end+0xbc/0xd0
      >  [<c040b090>] ? do_invalid_op+0x0/0x90
      >  [<c040b10f>] ? do_invalid_op+0x7f/0x90
      >  [<f0ee92ea>] ? __rpc_create_common+0x8a/0xc0[sunrpc]
      >  [<f0edc433>] ? rpc_free_task+0x33/0x70[sunrpc]
      >  [<f0ed6508>] ? prc_call_sync+0x48/0x60[sunrpc]
      >  [<f0ed656e>] ? rpc_ping+0x4e/0x60[sunrpc]
      >  [<f0ed6eaf>] ? rpc_create+0x38f/0x4f0[sunrpc]
      >  [<c080d80b>] ? error_code+0x73/0x78
      >  [<f0ee92ea>] ? __rpc_create_common+0x8a/0xc0[sunrpc]
      >  [<c0532bda>] ? d_lookup+0x2a/0x40
      >  [<f0ee94b1>] ? rpc_mkpipe+0x111/0x1b0[sunrpc]
      >  [<f10a59f4>] ? nfs_create_rpc_client+0xb4/0xf0[nfs]
      >  [<f10d6c6d>] ? nfs_fscache_get_client_cookie+0x1d/0x50[nfs]
      >  [<f10d3fcb>] ? nfs_idmap_new+0x7b/0x140[nfs]
      >  [<c05e76aa>] ? strlcpy+0x3a/0x60
      >  [<f10a60ca>] ? nfs4_set_client+0xea/0x2b0[nfs]
      >  [<f10a6d0c>] ? nfs4_create_server+0xac/0x1b0[nfs]
      >  [<c04f1400>] ? krealloc+0x40/0x50
      >  [<f10b0e8b>] ? nfs4_remote_get_sb+0x6b/0x250[nfs]
      >  [<c04f14ec>] ? kstrdup+0x3c/0x60
      >  [<c0520739>] ? vfs_kern_mount+0x69/0x170
      >  [<f10b1a3c>] ? nfs_do_root_mount+0x6c/0xa0[nfs]
      >  [<f10b1b47>] ? nfs4_try_mount+0x37/0xa0[nfs]
      >  [<f10afe6d>] ? nfs4_validate_text_mount_data+-x7d/0xf0[nfs]
      >  [<f10b1c42>] ? nfs4_get_sb+0x92/0x2f0
      >  [<c0520739>] ? vfs_kern_mount+0x69/0x170
      >  [<c05366d2>] ? get_fs_type+0x32/0xb0
      >  [<c052089f>] ? do_kern_mount+0x3f/0xe0
      >  [<c053954f>] ? do_mount+0x2ef/0x740
      >  [<c0537740>] ? copy_mount_options+0xb0/0x120
      >  [<c0539a0e>] ? sys_mount+0x6e/0xa0
      
      Hi,
      
      Does the following patch fix the problem?
      
      Cheers
        Trond
      
      --------------------------
      SUNRPC: Fix a BUG in __rpc_create_common
      
      From: Trond Myklebust <Trond.Myklebust@netapp.com>
      
      Mi Jinlong reports:
      
      When testing NFSv4 at RHEL6 with kernel 2.6.32, I got a kernel panic
      at NFS client's __rpc_create_common function.
      
      The panic place is:
        rpc_mkpipe
            __rpc_lookup_create()          <=== find pipefile *idmap*
            __rpc_mkpipe()                 <=== pipefile is *idmap*
              __rpc_create_common()
               ******  BUG_ON(!d_unhashed(dentry)); ****** *panic*
      
      The test is wrong: we can find ourselves with a hashed negative dentry here
      if the idmapper tried to look up the file before we got round to creating
      it.
      
      Just replace the BUG_ON() with a d_drop(dentry).
      
      [2.6.32 background info from Jonathan below]
      > Hi Willy et al,
      >
      > Please consider
      >
      >   beb0f0a9 kernel panic when mount NFSv4, 2010-12-20
      >
      > for application to kernel.org's 2.6.32.y and 2.6.34.y trees.  The
      > patch was applied upstream during the 2.6.38 merge window, so newer
      > kernels don't need it.
      >
      > (Context: <http://bugs.debian.org/695872>.)  Tom Downes (cc-ed)
      > experienced the bug on a Debian kernel close to 2.6.32.58 and
      > confirmed that the patch doesn't seem to hurt.
      >
      > The patch is part of Fedora 13's 2.6.34-based and Fedora 14's
      > 2.6.35-based kernels[1].  It was also included in the RHEL kernel at
      > some point between 2.6.32-71.29.1.el6 and 2.6.32-131.0.15.el6[2].
      >
      > Thoughts of all kinds welcome, as always.
      >
      > Regards,
      > Jonathan
      >
      > [1] https://bugzilla.redhat.com/673207
      > [2] https://oss.oracle.com/git/?p=redpatch.git;a=commit;h=8028cccdc4b1Reported-by: default avatarMi Jinlong <mijinlong@cn.fujitsu.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      (cherry picked from commit beb0f0a9)
      Cc: Jonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      fc9e795a
    • Eric Sandeen's avatar
      btrfs: use rcu_barrier() to wait for bdev puts at unmount · eeb72f5d
      Eric Sandeen authored
      commit bc178622 upstream.
      
      Doing this would reliably fail with -EBUSY for me:
      
      # mount /dev/sdb2 /mnt/scratch; umount /mnt/scratch; mkfs.btrfs -f /dev/sdb2
      ...
      unable to open /dev/sdb2: Device or resource busy
      
      because mkfs.btrfs tries to open the device O_EXCL, and somebody still has it.
      
      Using systemtap to track bdev gets & puts shows a kworker thread doing a
      blkdev put after mkfs attempts a get; this is left over from the unmount
      path:
      
      btrfs_close_devices
      	__btrfs_close_devices
      		call_rcu(&device->rcu, free_device);
      			free_device
      				INIT_WORK(&device->rcu_work, __free_device);
      				schedule_work(&device->rcu_work);
      
      so unmount might complete before __free_device fires & does its blkdev_put.
      
      Adding an rcu_barrier() to btrfs_close_devices() causes unmount to wait
      until all blkdev_put()s are done, and the device is truly free once
      unmount completes.
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      eeb72f5d
    • Vyacheslav Dubeyko's avatar
      hfsplus: fix potential overflow in hfsplus_file_truncate() · c3ff29a2
      Vyacheslav Dubeyko authored
      commit 12f267a2 upstream.
      
      Change a u32 to loff_t hfsplus_file_truncate().
      Signed-off-by: default avatarVyacheslav Dubeyko <slava@dubeyko.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      c3ff29a2
    • Alan Stern's avatar
      NLS: improve UTF8 -> UTF16 string conversion routine · 9ecb7721
      Alan Stern authored
      commit 0720a06a upstream.
      
      The utf8s_to_utf16s conversion routine needs to be improved.  Unlike
      its utf16s_to_utf8s sibling, it doesn't accept arguments specifying
      the maximum length of the output buffer or the endianness of its
      16-bit output.
      
      This patch (as1501) adds the two missing arguments, and adjusts the
      only two places in the kernel where the function is called.  A
      follow-on patch will add a third caller that does utilize the new
      capabilities.
      
      The two conversion routines are still annoyingly inconsistent in the
      way they handle invalid byte combinations.  But that's a subject for a
      different patch.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: Clemens Ladisch <clemens@ladisch.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      [bwh: Bakckported to 2.6.32: drop Hyper-V change]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      9ecb7721
    • Kevin Dankwardt's avatar
      fat: Fix stat->f_namelen · c71109d6
      Kevin Dankwardt authored
      commit eeb5b4ae upstream.
      
      I found that the length of a file name when created cannot exceed 255
      characters, yet, pathconf(), via statfs(), returns the maximum as 260.
      Signed-off-by: default avatarKevin Dankwardt <k@kcomputing.com>
      Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      c71109d6
    • Mathias Krause's avatar
      isofs: avoid info leak on export · cf2e392e
      Mathias Krause authored
      commit fe685aab upstream.
      
      For type 1 the parent_offset member in struct isofs_fid gets copied
      uninitialized to userland. Fix this by initializing it to 0.
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      cf2e392e
    • Cong Ding's avatar
      fs/cifs/cifs_dfs_ref.c: fix potential memory leakage · 1b407e59
      Cong Ding authored
      commit 10b8c7df upstream.
      
      When it goes to error through line 144, the memory allocated to *devname is
      not freed, and the caller doesn't free it either in line 250. So we free the
      memroy of *devname in function cifs_compose_mount_options() when it goes to
      error.
      Signed-off-by: default avatarCong Ding <dinggnu@gmail.com>
      Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarSteve French <smfrench@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      1b407e59
    • Jan Kara's avatar
      udf: Fix bitmap overflow on large filesystems with small block size · a27c8ce1
      Jan Kara authored
      commit 89b1f39e upstream.
      
      For large UDF filesystems with 512-byte blocks the number of necessary
      bitmap blocks is larger than 2^16 so s_nr_groups in udf_bitmap overflows
      (the number will overflow for filesystems larger than 128 GB with
      512-byte blocks). That results in ENOSPC errors despite the filesystem
      has plenty of free space.
      
      Fix the problem by changing s_nr_groups' type to 'int'. That is enough
      even for filesystems 2^32 blocks (UDF maximum) and 512-byte blocksize.
      
      Reported-and-tested-by: v10lator@myway.de
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Cc: Jim Trigg <jtrigg@spamcop.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      a27c8ce1
    • Mathias Krause's avatar
      udf: avoid info leak on export · 78d630bd
      Mathias Krause authored
      commit 0143fc5e upstream.
      
      For type 0x51 the udf.parent_partref member in struct fid gets copied
      uninitialized to userland. Fix this by initializing it to 0.
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      78d630bd
    • Namjae Jeon's avatar
      udf: fix memory leak while allocating blocks during write · 5ece3559
      Namjae Jeon authored
      commit 2fb7d99d upstream.
      
      Need to brelse the buffer_head stored in cur_epos and next_epos.
      Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: default avatarAshish Sangwan <a.sangwan@samsung.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarShuah Khan <shuah.khan@hp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      5ece3559
    • Theodore Ts'o's avatar
      ext4: avoid hang when mounting non-journal filesystems with orphan list · 5f591370
      Theodore Ts'o authored
      commit 0e9a9a1a upstream.
      
      When trying to mount a file system which does not contain a journal,
      but which does have a orphan list containing an inode which needs to
      be truncated, the mount call with hang forever in
      ext4_orphan_cleanup() because ext4_orphan_del() will return
      immediately without removing the inode from the orphan list, leading
      to an uninterruptible loop in kernel code which will busy out one of
      the CPU's on the system.
      
      This can be trivially reproduced by trying to mount the file system
      found in tests/f_orphan_extents_inode/image.gz from the e2fsprogs
      source tree.  If a malicious user were to put this on a USB stick, and
      mount it on a Linux desktop which has automatic mounts enabled, this
      could be considered a potential denial of service attack.  (Not a big
      deal in practice, but professional paranoids worry about such things,
      and have even been known to allocate CVE numbers for such problems.)
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Reviewed-by: default avatarZheng Liu <wenqing.lz@taobao.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      5f591370
    • Anatol Pomozov's avatar
      ext4: make orphan functions be no-op in no-journal mode · 9b3c0cff
      Anatol Pomozov authored
      commit c9b92530 upstream.
      
      Instead of checking whether the handle is valid, we check if journal
      is enabled. This avoids taking the s_orphan_lock mutex in all cases
      when there is no journal in use, including the error paths where
      ext4_orphan_del() is called with a handle set to NULL.
      Signed-off-by: default avatarAnatol Pomozov <anatol.pomozov@gmail.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      9b3c0cff
    • Jamie Iles's avatar
      CVE-2012-4508 kernel: ext4: AIO vs fallocate stale data exposure · 82c1ce54
      Jamie Iles authored
      CVE-2012-4508 kernel: ext4: AIO vs fallocate stale data exposure
      [dannf: backported to Debian's 2.6.32]
      
      According to Ben :
      > The original upstream commits were c278531d,
      > 60d4616f and (most importantly)
      > dee1f973 by Dmitry Monakhov
      > <dmonakhov@openvz.org>.  They were backported into the RHEL 6 kernel by
      > Lukas Czerner, according to its changelog.  Dann got this version from
      > Oracle's redpatch repository, where, if I understand rightly, Jamie Iles
      > attempted to regenerate Lukas's patch(es).
      
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarJamie Iles <jamie@jamieiles.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      82c1ce54
    • Lachlan McIlroy's avatar
      ext4: limit group search loop for non-extent files · 83c86612
      Lachlan McIlroy authored
      commit e6155736 upstream.
      
      In the case where we are allocating for a non-extent file,
      we must limit the groups we allocate from to those below
      2^32 blocks, and ext4_mb_regular_allocator() attempts to
      do this initially by putting a cap on ngroups for the
      subsequent search loop.
      
      However, the initial target group comes in from the
      allocation context (ac), and it may already be beyond
      the artificially limited ngroups.  In this case,
      the limit
      
      	if (group == ngroups)
      		group = 0;
      
      at the top of the loop is never true, and the loop will
      run away.
      
      Catch this case inside the loop and reset the search to
      start at group 0.
      
      [sandeen@redhat.com: add commit msg & comments]
      Signed-off-by: default avatarLachlan McIlroy <lmcilroy@redhat.com>
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      83c86612
    • Niu Yawei's avatar
      ext4: fix race in ext4_mb_add_n_trim() · 75de899b
      Niu Yawei authored
      commit f1167009 upstream.
      
      In ext4_mb_add_n_trim(), lg_prealloc_lock should be taken when
      changing the lg_prealloc_list.
      Signed-off-by: default avatarNiu Yawei <yawei.niu@intel.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      75de899b
    • Theodore Ts'o's avatar
      ext4: lock i_mutex when truncating orphan inodes · a89571bf
      Theodore Ts'o authored
      commit 721e3eba upstream.
      
      Commit c278531d added a warning when ext4_flush_unwritten_io() is
      called without i_mutex being taken.  It had previously not been taken
      during orphan cleanup since races weren't possible at that point in
      the mount process, but as a result of this c278531d, we will now see
      a kernel WARN_ON in this case.  Take the i_mutex in
      ext4_orphan_cleanup() to suppress this warning.
      Reported-by: default avatarAlexander Beregalov <a.beregalov@gmail.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Reviewed-by: default avatarZheng Liu <wenqing.lz@taobao.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      a89571bf
    • Jan Kara's avatar
      ext4: fix fdatasync() for files with only i_size changes · 55efcf30
      Jan Kara authored
      commit b71fc079 upstream.
      
      Code tracking when transaction needs to be committed on fdatasync(2) forgets
      to handle a situation when only inode's i_size is changed. Thus in such
      situations fdatasync(2) doesn't force transaction with new i_size to disk
      and that can result in wrong i_size after a crash.
      
      Fix the issue by updating inode's i_datasync_tid whenever its size is
      updated.
      Reported-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      55efcf30
    • Bernd Schubert's avatar
      ext4: always set i_op in ext4_mknod() · 4ae5f4a2
      Bernd Schubert authored
      commit 6a08f447 upstream.
      
      ext4_special_inode_operations have their own ifdef CONFIG_EXT4_FS_XATTR
      to mask those methods. And ext4_iget also always sets it, so there is
      an inconsistency.
      Signed-off-by: default avatarBernd Schubert <bernd.schubert@itwm.fraunhofer.de>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      4ae5f4a2
    • Dmitry Monakhov's avatar
      ext4: online defrag is not supported for journaled files · e5180af7
      Dmitry Monakhov authored
      commit f066055a upstream.
      
      Proper block swap for inodes with full journaling enabled is
      truly non obvious task. In order to be on a safe side let's
      explicitly disable it for now.
      Signed-off-by: default avatarDmitry Monakhov <dmonakhov@openvz.org>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      e5180af7
    • Eugene Shatokhin's avatar
      ext4: fix memory leak in ext4_xattr_set_acl()'s error path · 5d0735ba
      Eugene Shatokhin authored
      commit 24ec19b0 upstream.
      
      In ext4_xattr_set_acl(), if ext4_journal_start() returns an error,
      posix_acl_release() will not be called for 'acl' which may result in a
      memory leak.
      
      This patch fixes that.
      Reviewed-by: default avatarLukas Czerner <lczerner@redhat.com>
      Signed-off-by: default avatarEugene Shatokhin <eugene.shatokhin@rosalab.ru>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      5d0735ba
    • Lukas Czerner's avatar
      ext4: Fix max file size and logical block counting of extent format file · 35258552
      Lukas Czerner authored
      commit f17722f9 upstream
      
      Kazuya Mio reported that he was able to hit BUG_ON(next == lblock)
      in ext4_ext_put_gap_in_cache() while creating a sparse file in extent
      format and fill the tail of file up to its end. We will hit the BUG_ON
      when we write the last block (2^32-1) into the sparse file.
      
      The root cause of the problem lies in the fact that we specifically set
      s_maxbytes so that block at s_maxbytes fit into on-disk extent format,
      which is 32 bit long. However, we are not storing start and end block
      number, but rather start block number and length in blocks. It means
      that in order to cover extent from 0 to EXT_MAX_BLOCK we need
      EXT_MAX_BLOCK+1 to fit into len (because we counting block 0 as well) -
      and it does not.
      
      The only way to fix it without changing the meaning of the struct
      ext4_extent members is, as Kazuya Mio suggested, to lower s_maxbytes
      by one fs block so we can cover the whole extent we can get by the
      on-disk extent format.
      
      Also in many places EXT_MAX_BLOCK is used as length instead of maximum
      logical block number as the name suggests, it is all a bit messy. So
      this commit renames it to EXT_MAX_BLOCKS and change its usage in some
      places to actually be maximum number of blocks in the extent.
      
      The bug which this commit fixes can be reproduced as follows:
      
       dd if=/dev/zero of=/mnt/mp1/file bs=<blocksize> count=1 seek=$((2**32-2))
       sync
       dd if=/dev/zero of=/mnt/mp1/file bs=<blocksize> count=1 seek=$((2**32-1))
      Reported-by: default avatarKazuya Mio <k-mio@sx.jp.nec.com>
      Signed-off-by: default avatarLukas Czerner <lczerner@redhat.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      [dannf: Applied the backport from RHEL6 to Debian's 2.6.32]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      35258552
    • Allison Henderson's avatar
      ext4: don't dereference null pointer when make_indexed_dir() fails · efa760eb
      Allison Henderson authored
      Fix for a null pointer bug found while running punch hole tests
      Signed-off-by: default avatarAllison Henderson <achender@us.ibm.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      (cherry picked from commit 6976a6f2)
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      efa760eb
    • Jan Kara's avatar
      ext4: Fix fs corruption when make_indexed_dir() fails · 04b72780
      Jan Kara authored
      When make_indexed_dir() fails (e.g. because of ENOSPC) after it has
      allocated block for index tree root, we did not properly mark all
      changed buffers dirty.  This lead to only some of these buffers being
      written out and thus effectively corrupting the directory.
      
      Fix the issue by marking all changed data dirty even in the error
      failure case.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      (cherry picked from commit 7ad8e4e6)
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      04b72780
    • Jan Kara's avatar
      jbd: Fix lock ordering bug in journal_unmap_buffer() · 35ea3124
      Jan Kara authored
      commit 25389bb2 upstream.
      
      Commit 09e05d48 introduced a wait for transaction commit into
      journal_unmap_buffer() in the case we are truncating a buffer undergoing commit
      in the page stradding i_size on a filesystem with blocksize < pagesize. Sadly
      we forgot to drop buffer lock before waiting for transaction commit and thus
      deadlock is possible when kjournald wants to lock the buffer.
      
      Fix the problem by dropping the buffer lock before waiting for transaction
      commit. Since we are still holding page lock (and that is OK), buffer cannot
      disappear under us.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      35ea3124
    • Jan Kara's avatar
      jbd: Fix assertion failure in commit code due to lacking transaction credits · d9408786
      Jan Kara authored
      ext3 users of data=journal mode with blocksize < pagesize were occasionally
      hitting assertion failure in journal_commit_transaction() checking whether the
      transaction has at least as many credits reserved as buffers attached.  The
      core of the problem is that when a file gets truncated, buffers that still need
      checkpointing or that are attached to the committing transaction are left with
      buffer_mapped set. When this happens to buffers beyond i_size attached to a
      page stradding i_size, subsequent write extending the file will see these
      buffers and as they are mapped (but underlying blocks were freed) things go
      awry from here.
      
      The assertion failure just coincidentally (and in this case luckily as we would
      start corrupting filesystem) triggers due to journal_head not being properly
      cleaned up as well.
      
      Under some rare circumstances this bug could even hit data=ordered mode users.
      There the assertion won't trigger and we would end up corrupting the
      filesystem.
      
      We fix the problem by unmapping buffers if possible (in lots of cases we just
      need a buffer attached to a transaction as a place holder but it must not be
      written out anyway). And in one case, we just have to bite the bullet and wait
      for transaction commit to finish.
      Reviewed-by: default avatarJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      (cherry picked from commit 09e05d48)
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      d9408786
    • Jan Kara's avatar
      jbd: Delay discarding buffers in journal_unmap_buffer · 0b48676f
      Jan Kara authored
      Delay discarding buffers in journal_unmap_buffer until
      we know that "add to orphan" operation has definitely been
      committed, otherwise the log space of committing transation
      may be freed and reused before truncate get committed, updates
      may get lost if crash happens.
      
      This patch is a backport of JBD2 fix by dingdinghua <dingdinghua@nrchpc.ac.cn>.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      (cherry picked from commit 86963918)
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      0b48676f
    • Greg Thelen's avatar
      tmpfs: fix use-after-free of mempolicy object · 1e3e8106
      Greg Thelen authored
      commit 5f00110f upstream.
      
      The tmpfs remount logic preserves filesystem mempolicy if the mpol=M
      option is not specified in the remount request.  A new policy can be
      specified if mpol=M is given.
      
      Before this patch remounting an mpol bound tmpfs without specifying
      mpol= mount option in the remount request would set the filesystem's
      mempolicy object to a freed mempolicy object.
      
      To reproduce the problem boot a DEBUG_PAGEALLOC kernel and run:
          # mkdir /tmp/x
      
          # mount -t tmpfs -o size=100M,mpol=interleave nodev /tmp/x
      
          # grep /tmp/x /proc/mounts
          nodev /tmp/x tmpfs rw,relatime,size=102400k,mpol=interleave:0-3 0 0
      
          # mount -o remount,size=200M nodev /tmp/x
      
          # grep /tmp/x /proc/mounts
          nodev /tmp/x tmpfs rw,relatime,size=204800k,mpol=??? 0 0
              # note ? garbage in mpol=... output above
      
          # dd if=/dev/zero of=/tmp/x/f count=1
              # panic here
      
      Panic:
          BUG: unable to handle kernel NULL pointer dereference at           (null)
          IP: [<          (null)>]           (null)
          [...]
          Oops: 0010 [#1] SMP DEBUG_PAGEALLOC
          Call Trace:
            mpol_shared_policy_init+0xa5/0x160
            shmem_get_inode+0x209/0x270
            shmem_mknod+0x3e/0xf0
            shmem_create+0x18/0x20
            vfs_create+0xb5/0x130
            do_last+0x9a1/0xea0
            path_openat+0xb3/0x4d0
            do_filp_open+0x42/0xa0
            do_sys_open+0xfe/0x1e0
            compat_sys_open+0x1b/0x20
            cstar_dispatch+0x7/0x1f
      
      Non-debug kernels will not crash immediately because referencing the
      dangling mpol will not cause a fault.  Instead the filesystem will
      reference a freed mempolicy object, which will cause unpredictable
      behavior.
      
      The problem boils down to a dropped mpol reference below if
      shmem_parse_options() does not allocate a new mpol:
      
          config = *sbinfo
          shmem_parse_options(data, &config, true)
          mpol_put(sbinfo->mpol)
          sbinfo->mpol = config.mpol  /* BUG: saves unreferenced mpol */
      
      This patch avoids the crash by not releasing the mempolicy if
      shmem_parse_options() doesn't create a new mpol.
      
      How far back does this issue go? I see it in both 2.6.36 and 3.3.  I did
      not look back further.
      Signed-off-by: default avatarGreg Thelen <gthelen@google.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      1e3e8106
    • Geert Uytterhoeven's avatar
      sysfs: sysfs_pathname/sysfs_add_one: Use strlcat() instead of strcat() · 59deaa36
      Geert Uytterhoeven authored
      commit 66081a72 upstream.
      
      The warning check for duplicate sysfs entries can cause a buffer overflow
      when printing the warning, as strcat() doesn't check buffer sizes.
      Use strlcat() instead.
      
      Since strlcat() doesn't return a pointer to the passed buffer, unlike
      strcat(), I had to convert the nested concatenation in sysfs_add_one() to
      an admittedly more obscure comma operator construct, to avoid emitting code
      for the concatenation if CONFIG_BUG is disabled.
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      59deaa36
    • Anurup m's avatar
      fs/fscache/stats.c: fix memory leak · 4495d600
      Anurup m authored
      commit ec686c92 upstream.
      
      There is a kernel memory leak observed when the proc file
      /proc/fs/fscache/stats is read.
      
      The reason is that in fscache_stats_open, single_open is called and the
      respective release function is not called during release.  Hence fix
      with correct release function - single_release().
      
      Addresses https://bugzilla.kernel.org/show_bug.cgi?id=57101Signed-off-by: default avatarAnurup m <anurup.m@huawei.com>
      Cc: shyju pv <shyju.pv@huawei.com>
      Cc: Sanil kumar <sanil.kumar@huawei.com>
      Cc: Nataraj m <nataraj.m@huawei.com>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: David Howells <dhowells@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      4495d600
    • Kees Cook's avatar
      fs/compat_ioctl.c: VIDEO_SET_SPU_PALETTE missing error check · e5a2fb56
      Kees Cook authored
      commit 12176503 upstream.
      
      The compat ioctl for VIDEO_SET_SPU_PALETTE was missing an error check
      while converting ioctl arguments.  This could lead to leaking kernel
      stack contents into userspace.
      
      Patch extracted from existing fix in grsecurity.
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Cc: David Miller <davem@davemloft.net>
      Cc: Brad Spengler <spender@grsecurity.net>
      Cc: PaX Team <pageexec@freemail.hu>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      e5a2fb56
    • Eric Wong's avatar
      epoll: prevent missed events on EPOLL_CTL_MOD · 1c137a47
      Eric Wong authored
      commit 128dd175 upstream.
      
      EPOLL_CTL_MOD sets the interest mask before calling f_op->poll() to
      ensure events are not missed.  Since the modifications to the interest
      mask are not protected by the same lock as ep_poll_callback, we need to
      ensure the change is visible to other CPUs calling ep_poll_callback.
      
      We also need to ensure f_op->poll() has an up-to-date view of past
      events which occured before we modified the interest mask.  So this
      barrier also pairs with the barrier in wq_has_sleeper().
      
      This should guarantee either ep_poll_callback or f_op->poll() (or both)
      will notice the readiness of a recently-ready/modified item.
      
      This issue was encountered by Andreas Voellmy and Junchang(Jason) Wang in:
      http://thread.gmane.org/gmane.linux.kernel/1408782/Signed-off-by: default avatarEric Wong <normalperson@yhbt.net>
      Cc: Hans Verkuil <hans.verkuil@cisco.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Davide Libenzi <davidel@xmailserver.org>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
      Cc: David Miller <davem@davemloft.net>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andreas Voellmy <andreas.voellmy@yale.edu>
      Tested-by: default avatar"Junchang(Jason) Wang" <junchang.wang@yale.edu>
      Cc: netdev@vger.kernel.org
      Cc: linux-fsdevel@vger.kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      1c137a47
    • Ying Xue's avatar
      USB: ftdi_sio: Quiet sparse noise about using plain integer was NULL pointer · b7924161
      Ying Xue authored
      commit a816e311 upstream.
      
      Pointers should not be compared to plain integers.
      Quiets the sparse warning:
      warning: Using plain integer as NULL pointer
      Signed-off-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Suggested-by: default avatarLotfi Manseur <lotfi.manseur@imag.fr>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      b7924161
    • Andrew Worsley's avatar
      USB: serial: ftdi_sio: Handle the old_termios == 0 case e.g. uart_resume_port() · d62e0441
      Andrew Worsley authored
      commit c515598e upstream.
      
        Handle null old_termios in ftdi_set_termios() calls from uart_resume_port().
      Signed-off-by: default avatarAndrew Worsley <amworsley@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      Suggested-by: default avatarLotfi Manseur <lotfi.manseur@imag.fr>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      d62e0441
    • Oliver Neukum's avatar
      USB: cdc-wdm: fix buffer overflow · e3c81f65
      Oliver Neukum authored
      commit c0f5ecee upstream.
      
      The buffer for responses must not overflow.
      If this would happen, set a flag, drop the data and return
      an error after user space has read all remaining data.
      Signed-off-by: default avatarOliver Neukum <oliver@neukum.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 2.6.32: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      e3c81f65
    • Wolfgang Frisch's avatar
      USB: io_ti: Fix NULL dereference in chase_port() · 09b1d9f2
      Wolfgang Frisch authored
      commit 1ee0a224 upstream
      
      The tty is NULL when the port is hanging up.
      chase_port() needs to check for this.
      
      This patch is intended for stable series.
      The behavior was observed and tested in Linux 3.2 and 3.7.1.
      
      Johan Hovold submitted a more elaborate patch for the mainline kernel.
      
      [   56.277883] usb 1-1: edge_bulk_in_callback - nonzero read bulk status received: -84
      [   56.278811] usb 1-1: USB disconnect, device number 3
      [   56.278856] usb 1-1: edge_bulk_in_callback - stopping read!
      [   56.279562] BUG: unable to handle kernel NULL pointer dereference at 00000000000001c8
      [   56.280536] IP: [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35
      [   56.281212] PGD 1dc1b067 PUD 1e0f7067 PMD 0
      [   56.282085] Oops: 0002 [#1] SMP
      [   56.282744] Modules linked in:
      [   56.283512] CPU 1
      [   56.283512] Pid: 25, comm: khubd Not tainted 3.7.1 #1 innotek GmbH VirtualBox/VirtualBox
      [   56.283512] RIP: 0010:[<ffffffff8144e62a>]  [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35
      [   56.283512] RSP: 0018:ffff88001fa99ab0  EFLAGS: 00010046
      [   56.283512] RAX: 0000000000000046 RBX: 00000000000001c8 RCX: 0000000000640064
      [   56.283512] RDX: 0000000000010000 RSI: ffff88001fa99b20 RDI: 00000000000001c8
      [   56.283512] RBP: ffff88001fa99b20 R08: 0000000000000000 R09: 0000000000000000
      [   56.283512] R10: 0000000000000000 R11: ffffffff812fcb4c R12: ffff88001ddf53c0
      [   56.283512] R13: 0000000000000000 R14: 00000000000001c8 R15: ffff88001e19b9f4
      [   56.283512] FS:  0000000000000000(0000) GS:ffff88001fd00000(0000) knlGS:0000000000000000
      [   56.283512] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [   56.283512] CR2: 00000000000001c8 CR3: 000000001dc51000 CR4: 00000000000006e0
      [   56.283512] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [   56.283512] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      [   56.283512] Process khubd (pid: 25, threadinfo ffff88001fa98000, task ffff88001fa94f80)
      [   56.283512] Stack:
      [   56.283512]  0000000000000046 00000000000001c8 ffffffff810578ec ffffffff812fcb4c
      [   56.283512]  ffff88001e19b980 0000000000002710 ffffffff812ffe81 0000000000000001
      [   56.283512]  ffff88001fa94f80 0000000000000202 ffffffff00000001 0000000000000296
      [   56.283512] Call Trace:
      [   56.283512]  [<ffffffff810578ec>] ? add_wait_queue+0x12/0x3c
      [   56.283512]  [<ffffffff812fcb4c>] ? usb_serial_port_work+0x28/0x28
      [   56.283512]  [<ffffffff812ffe81>] ? chase_port+0x84/0x2d6
      [   56.283512]  [<ffffffff81063f27>] ? try_to_wake_up+0x199/0x199
      [   56.283512]  [<ffffffff81263a5c>] ? tty_ldisc_hangup+0x222/0x298
      [   56.283512]  [<ffffffff81300171>] ? edge_close+0x64/0x129
      [   56.283512]  [<ffffffff810612f7>] ? __wake_up+0x35/0x46
      [   56.283512]  [<ffffffff8106135b>] ? should_resched+0x5/0x23
      [   56.283512]  [<ffffffff81264916>] ? tty_port_shutdown+0x39/0x44
      [   56.283512]  [<ffffffff812fcb4c>] ? usb_serial_port_work+0x28/0x28
      [   56.283512]  [<ffffffff8125d38c>] ? __tty_hangup+0x307/0x351
      [   56.283512]  [<ffffffff812e6ddc>] ? usb_hcd_flush_endpoint+0xde/0xed
      [   56.283512]  [<ffffffff8144e625>] ? _raw_spin_lock_irqsave+0x14/0x35
      [   56.283512]  [<ffffffff812fd361>] ? usb_serial_disconnect+0x57/0xc2
      [   56.283512]  [<ffffffff812ea99b>] ? usb_unbind_interface+0x5c/0x131
      [   56.283512]  [<ffffffff8128d738>] ? __device_release_driver+0x7f/0xd5
      [   56.283512]  [<ffffffff8128d9cd>] ? device_release_driver+0x1a/0x25
      [   56.283512]  [<ffffffff8128d393>] ? bus_remove_device+0xd2/0xe7
      [   56.283512]  [<ffffffff8128b7a3>] ? device_del+0x119/0x167
      [   56.283512]  [<ffffffff812e8d9d>] ? usb_disable_device+0x6a/0x180
      [   56.283512]  [<ffffffff812e2ae0>] ? usb_disconnect+0x81/0xe6
      [   56.283512]  [<ffffffff812e4435>] ? hub_thread+0x577/0xe82
      [   56.283512]  [<ffffffff8144daa7>] ? __schedule+0x490/0x4be
      [   56.283512]  [<ffffffff8105798f>] ? abort_exclusive_wait+0x79/0x79
      [   56.283512]  [<ffffffff812e3ebe>] ? usb_remote_wakeup+0x2f/0x2f
      [   56.283512]  [<ffffffff812e3ebe>] ? usb_remote_wakeup+0x2f/0x2f
      [   56.283512]  [<ffffffff810570b4>] ? kthread+0x81/0x89
      [   56.283512]  [<ffffffff81057033>] ? __kthread_parkme+0x5c/0x5c
      [   56.283512]  [<ffffffff8145387c>] ? ret_from_fork+0x7c/0xb0
      [   56.283512]  [<ffffffff81057033>] ? __kthread_parkme+0x5c/0x5c
      [   56.283512] Code: 8b 7c 24 08 e8 17 0b c3 ff 48 8b 04 24 48 83 c4 10 c3 53 48 89 fb 41 50 e8 e0 0a c3 ff 48 89 04 24 e8 e7 0a c3 ff ba 00 00 01 00
      <f0> 0f c1 13 48 8b 04 24 89 d1 c1 ea 10 66 39 d1 74 07 f3 90 66
      [   56.283512] RIP  [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35
      [   56.283512]  RSP <ffff88001fa99ab0>
      [   56.283512] CR2: 00000000000001c8
      [   56.283512] ---[ end trace 49714df27e1679ce ]---
      Signed-off-by: default avatarWolfgang Frisch <wfpub@roembden.net>
      Cc: Johan Hovold <jhovold@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      09b1d9f2
    • Johan Hovold's avatar
      USB: garmin_gps: fix memory leak on disconnect · f9477f69
      Johan Hovold authored
      commit 618aa106 upstream.
      
      Remove bogus disconnect test introduced by 95bef012 ("USB: more serial
      drivers writing after disconnect") which prevented queued data from
      being freed on disconnect.
      
      The possible IO it was supposed to prevent is long gone.
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      f9477f69