wrapfs-2.6.35.y.git
3 years agoWrapfs: add ->bmap support wrapfs
Erez Zadok [Fri, 13 May 2022 23:41:12 +0000 (19:41 -0400)]
Wrapfs: add ->bmap support

Signed-off-by: Aditya Sonavane <aditya.sonavane@stonybrook.edu>
Signed-off-by: Erez Zadok <ezk@cs.stonybrook.edu>
3 years agowrapfs: copyright year update
Erez Zadok [Sat, 7 May 2022 22:11:35 +0000 (18:11 -0400)]
wrapfs: copyright year update

3 years agowrapfs: change http URLs to https
Erez Zadok [Sat, 7 May 2022 20:47:40 +0000 (16:47 -0400)]
wrapfs: change http URLs to https

5 years agomerge changes
Erez Zadok [Sun, 15 Dec 2019 23:59:05 +0000 (18:59 -0500)]
merge changes

5 years agowrapfs: update copyright
Erez Zadok [Sat, 14 Dec 2019 05:04:54 +0000 (00:04 -0500)]
wrapfs: update copyright

5 years agowrapfs: remove unused variable
Erez Zadok [Sat, 14 Dec 2019 04:20:01 +0000 (23:20 -0500)]
wrapfs: remove unused variable

6 years agoupdate copyright
Erez Zadok [Fri, 29 Mar 2019 20:45:08 +0000 (16:45 -0400)]
update copyright

6 years agofix spell error
Erez Zadok [Fri, 29 Mar 2019 20:38:42 +0000 (16:38 -0400)]
fix spell error

8 years agoWrapfs: ->iget fixes
Erez Zadok [Sun, 19 Feb 2017 00:11:21 +0000 (19:11 -0500)]
Wrapfs: ->iget fixes

Change where we igrab/iput to ensure we always hold a valid lower_inode.
Return ENOMEM (not EACCES) if iget5_locked returns NULL.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
8 years agoWrapfs: update copyrights for 2017
Erez Zadok [Sat, 18 Feb 2017 20:14:56 +0000 (15:14 -0500)]
Wrapfs: update copyrights for 2017

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
9 years agoWrapfs: update nlinks after rename
Erez Zadok [Mon, 14 Dec 2015 23:51:34 +0000 (18:51 -0500)]
Wrapfs: update nlinks after rename

Signed-off-by: Logeswari P Viswanath <logeswari.pv@hpe.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
9 years agoWrapfs: update copyright year to 2015
Erez Zadok [Wed, 4 Nov 2015 17:42:13 +0000 (12:42 -0500)]
Wrapfs: update copyright year to 2015

9 years agoWrapfs: use vfs xattr helpers
Erez Zadok [Wed, 4 Nov 2015 17:42:13 +0000 (12:42 -0500)]
Wrapfs: use vfs xattr helpers

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
11 years agoWrapfs: properly copy meta-data after AIO operations from lower inode
Erez Zadok [Sat, 16 Aug 2014 03:36:40 +0000 (23:36 -0400)]
Wrapfs: properly copy meta-data after AIO operations from lower inode

Signed-off-by: Mengyang Li <li.mengyang@stonybrook.edu>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
11 years agoWrapfs: leave placeholders for updating upper inode after AIO
Erez Zadok [Mon, 11 Aug 2014 23:24:04 +0000 (19:24 -0400)]
Wrapfs: leave placeholders for updating upper inode after AIO

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
11 years agoWrapfs: protect lower_file by ref-count during aio operation
Erez Zadok [Sun, 10 Aug 2014 07:32:28 +0000 (03:32 -0400)]
Wrapfs: protect lower_file by ref-count during aio operation

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Mengyang Li <li.mengyang@stonybrook.edu>
11 years agoWrapfs: fix ->llseek to update upper and lower offsets
Erez Zadok [Thu, 26 Jun 2014 03:42:59 +0000 (23:42 -0400)]
Wrapfs: fix ->llseek to update upper and lower offsets

Fixes bug: xfstests generic/257. f_pos consistently is required by and
only by dir_ops->wrapfs_readdir, main_ops is not affected.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Mengyang Li <li.mengyang@stonybrook.edu>
11 years ago Wrapfs: support extended attributes (xattr) operations
Erez Zadok [Thu, 26 Jun 2014 03:42:59 +0000 (23:42 -0400)]
 Wrapfs: support extended attributes (xattr) operations

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Mengyang Li <li.mengyang@stonybrook.edu>
11 years agoWrapfs: support asynchronous-IO (AIO) operations
Erez Zadok [Sat, 21 Jun 2014 01:21:14 +0000 (21:21 -0400)]
Wrapfs: support asynchronous-IO (AIO) operations

Signed-off-by: Li Mengyang <li.mengyang@stonybrook.edu>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
11 years agoWrapfs: support direct-IO (DIO) operations
Erez Zadok [Sat, 21 Jun 2014 01:21:14 +0000 (21:21 -0400)]
Wrapfs: support direct-IO (DIO) operations

Signed-off-by: Li Mengyang <li.mengyang@stonybrook.edu>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
11 years agoWrapfs: implement vm_ops->page_mkwrite
Erez Zadok [Thu, 15 May 2014 04:15:55 +0000 (00:15 -0400)]
Wrapfs: implement vm_ops->page_mkwrite

Some file systems (e.g., ext4) require it.  Reported by Ted Ts'o.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
11 years agoWrapfs: update documentation
Erez Zadok [Thu, 3 Apr 2014 17:42:28 +0000 (13:42 -0400)]
Wrapfs: update documentation

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
11 years agoWrapfs: update maintainers
Erez Zadok [Thu, 3 Apr 2014 17:42:26 +0000 (13:42 -0400)]
Wrapfs: update maintainers

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
11 years agoWrapfs: update documentation
Erez Zadok [Tue, 21 Jan 2014 08:08:45 +0000 (03:08 -0500)]
Wrapfs: update documentation

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
11 years agoWrapfs: 2014 Copyright update
Erez Zadok [Tue, 21 Jan 2014 06:11:03 +0000 (01:11 -0500)]
Wrapfs: 2014 Copyright update

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
12 years agoWrapfs: copy lower inode attributes in ->ioctl
Erez Zadok [Wed, 5 Jun 2013 05:44:04 +0000 (01:44 -0400)]
Wrapfs: copy lower inode attributes in ->ioctl

Some ioctls (e.g., EXT2_IOC_SETFLAGS) can change inode attributes, so copy
them from lower inode.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
12 years agoWrapfs: remove unnecessary call to vm_unmap in ->mmap
Erez Zadok [Wed, 5 Jun 2013 05:43:04 +0000 (01:43 -0400)]
Wrapfs: remove unnecessary call to vm_unmap in ->mmap

Code is unnecessary and causes deadlocks in newer kernels.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
12 years agopatch copyright-2013.patch
Erez Zadok [Mon, 3 Jun 2013 01:53:47 +0000 (21:53 -0400)]
patch copyright-2013.patch

13 years agoWrapfs: drop our dentry in ->rmdir
Erez Zadok [Fri, 9 Sep 2011 04:45:23 +0000 (00:45 -0400)]
Wrapfs: drop our dentry in ->rmdir

Also clear nlinks on our inode.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: lookup fixes
Erez Zadok [Mon, 2 May 2011 06:00:02 +0000 (02:00 -0400)]
Wrapfs: lookup fixes

Don't use lookup_one_len any longer (doesn't work for NFS).
Initialize lower wrapfs_dentry_info so lower_path is NULL.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: remove extra debug in rmdir
Erez Zadok [Fri, 18 Mar 2011 17:14:28 +0000 (13:14 -0400)]
Wrapfs: remove extra debug in rmdir

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: checkpatch fixes
Erez Zadok [Fri, 18 Mar 2011 16:37:43 +0000 (12:37 -0400)]
Wrapfs: checkpatch fixes

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: copyright update for 2011
Erez Zadok [Fri, 18 Mar 2011 03:04:47 +0000 (23:04 -0400)]
Wrapfs: copyright update for 2011

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: better handling of NFS silly-renamed files
Erez Zadok [Fri, 18 Mar 2011 03:04:47 +0000 (23:04 -0400)]
Wrapfs: better handling of NFS silly-renamed files

In ->unlink, if we try to unlink an NFS silly-renamed file, NFS returns
-EBUSY.  We have to treat it as a success and return 0 to the VFS.  NFS will
remove silly-deleted files later on anyway.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: update parent directory inode size in inode ops
Erez Zadok [Fri, 18 Mar 2011 03:04:47 +0000 (23:04 -0400)]
Wrapfs: update parent directory inode size in inode ops

After ->unlink, ->rmdir, and ->rename, we need to copy the (possibly
changed) inode size of the parent directory(ies) where the operation took
place.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: remove unnecessary calls to copy lower inode->n_links
Erez Zadok [Fri, 18 Mar 2011 03:04:47 +0000 (23:04 -0400)]
Wrapfs: remove unnecessary calls to copy lower inode->n_links

Removed from ->create, ->symlink, and ->mknod.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: ->setattr fixes
Erez Zadok [Tue, 8 Mar 2011 06:08:10 +0000 (01:08 -0500)]
Wrapfs: ->setattr fixes

Call inode_change_ok on our inode, not lower.
Don't copy inode sizes (VFS does it).
Pass lower file in struct iattr passed to notify_change on lower inode.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: update ->fsync prototype
Erez Zadok [Sat, 7 Aug 2010 03:06:32 +0000 (23:06 -0400)]
Wrapfs: update ->fsync prototype

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: include slab.h
Erez Zadok [Sat, 7 Aug 2010 02:56:05 +0000 (22:56 -0400)]
Wrapfs: include slab.h

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: update documentation
Erez Zadok [Sat, 7 Aug 2010 02:36:47 +0000 (22:36 -0400)]
Wrapfs: update documentation

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: avoid an extra path_get/put pair in wrapfs_open
Erez Zadok [Sat, 7 Aug 2010 02:36:49 +0000 (22:36 -0400)]
Wrapfs: avoid an extra path_get/put pair in wrapfs_open

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: decrement nd_path on follow_link error
Erez Zadok [Sat, 7 Aug 2010 02:36:50 +0000 (22:36 -0400)]
Wrapfs: decrement nd_path on follow_link error

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: don't mention kernel version in modload message
Erez Zadok [Sat, 7 Aug 2010 02:36:56 +0000 (22:36 -0400)]
Wrapfs: don't mention kernel version in modload message

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs/VFS: remove init_lower_nd and unexport release_lower_nd
Erez Zadok [Sat, 7 Aug 2010 02:36:58 +0000 (22:36 -0400)]
Wrapfs/VFS: remove init_lower_nd and unexport release_lower_nd

Only wrapfs_create used it, and it is unnecessary to init a completely new
nameidata for the lower file system.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoKconfig: hook to configure Wrapfs
Erez Zadok [Sat, 7 Aug 2010 02:37:00 +0000 (22:37 -0400)]
Kconfig: hook to configure Wrapfs

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoMakefile: hook to compile Wrapfs
Erez Zadok [Sat, 7 Aug 2010 02:37:02 +0000 (22:37 -0400)]
Makefile: hook to compile Wrapfs

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoVFS: export release_open_intent symbol
Erez Zadok [Sat, 7 Aug 2010 02:37:03 +0000 (22:37 -0400)]
VFS: export release_open_intent symbol

Needed to release the resources of the lower nameidata structures that we
create and pass to lower file systems (e.g., when calling vfs_create).

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: file system magic number
Erez Zadok [Sat, 7 Aug 2010 02:37:09 +0000 (22:37 -0400)]
Wrapfs: file system magic number

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: Kconfig options
Erez Zadok [Sat, 7 Aug 2010 02:37:10 +0000 (22:37 -0400)]
Wrapfs: Kconfig options

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: main Makefile
Erez Zadok [Sat, 7 Aug 2010 02:37:12 +0000 (22:37 -0400)]
Wrapfs: main Makefile

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: vm_ops operations
Erez Zadok [Sat, 7 Aug 2010 02:37:13 +0000 (22:37 -0400)]
Wrapfs: vm_ops operations

Includes necessary address_space workaround ops.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: mount-time and module-linkage functions
Erez Zadok [Sat, 7 Aug 2010 02:37:14 +0000 (22:37 -0400)]
Wrapfs: mount-time and module-linkage functions

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: lookup-related functions
Erez Zadok [Sat, 7 Aug 2010 02:37:15 +0000 (22:37 -0400)]
Wrapfs: lookup-related functions

Main lookup function, nameidata helpers, and stacking-interposition
functions.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: file operations
Erez Zadok [Sat, 7 Aug 2010 02:37:17 +0000 (22:37 -0400)]
Wrapfs: file operations

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: dentry operations
Erez Zadok [Sat, 7 Aug 2010 02:37:18 +0000 (22:37 -0400)]
Wrapfs: dentry operations

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: inode operations
Erez Zadok [Sat, 7 Aug 2010 02:37:19 +0000 (22:37 -0400)]
Wrapfs: inode operations

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: superblock operations
Erez Zadok [Sat, 7 Aug 2010 02:37:20 +0000 (22:37 -0400)]
Wrapfs: superblock operations

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: main header file
Erez Zadok [Sat, 7 Aug 2010 02:37:22 +0000 (22:37 -0400)]
Wrapfs: main header file

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: Maintainers
Erez Zadok [Sat, 7 Aug 2010 02:37:23 +0000 (22:37 -0400)]
Wrapfs: Maintainers

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoDocumentation: index entry for Wrapfs
Erez Zadok [Sat, 7 Aug 2010 02:37:24 +0000 (22:37 -0400)]
Documentation: index entry for Wrapfs

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agoWrapfs: introduction and usage documentation
Erez Zadok [Sat, 7 Aug 2010 02:37:26 +0000 (22:37 -0400)]
Wrapfs: introduction and usage documentation

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 years agorelease 2.6.35.14 master v2.6.35.14
Andi Kleen [Mon, 1 Aug 2011 20:56:51 +0000 (13:56 -0700)]
release 2.6.35.14

Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoIGMP snooping: set mrouters_only flag for IPv6 traffic
Fernando Luis Vázquez Cao [Mon, 13 Jun 2011 15:06:58 +0000 (15:06 +0000)]
IGMP snooping: set mrouters_only flag for IPv6 traffic

[ upstream commit fc2af6c73fc9449cd5894a36bb76b8f8c0e49fd8 ]
 properly

Upon reception of a MGM report packet the kernel sets the mrouters_only flag
in a skb that is a clone of the original skb, which means that the bridge
loses track of MGM packets (cb buffers are tied to a specific skb and not
shared) and it ends up forwading join requests to the bridge interface.

This can cause unexpected membership timeouts and intermitent/permanent loss
of connectivity as described in RFC 4541 [2.1.1. IGMP Forwarding Rules]:

    A snooping switch should forward IGMP Membership Reports only to
    those ports where multicast routers are attached.
    [...]
    Sending membership reports to other hosts can result, for IGMPv1
    and IGMPv2, in unintentionally preventing a host from joining a
    specific multicast group.

Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
Signed-off-by: David S. Miller <davem@conan.davemloft.net>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoIGMP snooping: set mrouters_only flag for IPv4 traffic
Fernando Luis Vázquez Cao [Mon, 13 Jun 2011 15:04:43 +0000 (15:04 +0000)]
IGMP snooping: set mrouters_only flag for IPv4 traffic

[ upstream commit 62b2bcb49cca72f6d3f39f831127a6ab315a475d ]
 properly

Upon reception of a IGMP/IGMPv2 membership report the kernel sets the
mrouters_only flag in a skb that may be a clone of the original skb, which
means that sometimes the bridge loses track of membership report packets (cb
buffers are tied to a specific skb and not shared) and it ends up forwading
join requests to the bridge interface.

This can cause unexpected membership timeouts and intermitent/permanent loss
of connectivity as described in RFC 4541 [2.1.1. IGMP Forwarding Rules]:

    A snooping switch should forward IGMP Membership Reports only to
    those ports where multicast routers are attached.
    [...]
    Sending membership reports to other hosts can result, for IGMPv1
    and IGMPv2, in unintentionally preventing a host from joining a
    specific multicast group.

Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
Tested-by: Hayato Kakuta <kakuta.hayato@oss.ntt.co.jp>
Signed-off-by: David S. Miller <davem@conan.davemloft.net>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoipv6: add special mode forwarding=2 to send RS while
Thomas Graf [Fri, 3 Sep 2010 03:04:20 +0000 (03:04 +0000)]
ipv6: add special mode forwarding=2 to send RS while

[ upstream commit c3bccac2fa76f1619dfe4fb7b9bee69de7f066d8 ]
 configured as router

Similar to accepting router advertisement, the IPv6 stack does not send router
solicitations if forwarding is enabled.

This patch enables this behavior to be overruled by setting forwarding to the
special value 2.

Signed-off-by: Thomas Graf <tgraf@infradead.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agox86, mtrr: lock stop machine during MTRR rendezvous sequence
Suresh Siddha [Thu, 23 Jun 2011 18:19:26 +0000 (11:19 -0700)]
x86, mtrr: lock stop machine during MTRR rendezvous sequence

[ upstream commit 6d3321e8e2b3bf6a5892e2ef673c7bf536e3f904 ]

MTRR rendezvous sequence using stop_one_cpu_nowait() can potentially
happen in parallel with another system wide rendezvous using
stop_machine(). This can lead to deadlock (The order in which
works are queued can be different on different cpu's. Some cpu's
will be running the first rendezvous handler and others will be running
the second rendezvous handler. Each set waiting for the other set to join
for the system wide rendezvous, leading to a deadlock).

MTRR rendezvous sequence is not implemented using stop_machine() as this
gets called both from the process context aswell as the cpu online paths
(where the cpu has not come online and the interrupts are disabled etc).
stop_machine() works with only online cpus.

For now, take the stop_machine mutex in the MTRR rendezvous sequence that
gets called from an online cpu (here we are in the process context
and can potentially sleep while taking the mutex). And the MTRR rendezvous
that gets triggered during cpu online doesn't need to take this stop_machine
lock (as the stop_machine() already ensures that there is no cpu hotplug
going on in parallel by doing get_online_cpus())

    TBD: Pursue a cleaner solution of extending the stop_machine()
         infrastructure to handle the case where the calling cpu is
         still not online and use this for MTRR rendezvous sequence.

fixes: https://bugzilla.novell.com/show_bug.cgi?id=672008

Reported-by: Vadim Kotelnikov <vadimuzzz@inbox.ru>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/20110623182056.807230326@sbsiddha-MOBL3.sc.intel.com
Cc: stable@kernel.org # 2.6.35+, backport a week or two after this gets more testing in mainline
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agoSERIAL: SC26xx: Fix link error.
Ralf Baechle [Mon, 27 Jun 2011 13:26:56 +0000 (14:26 +0100)]
SERIAL: SC26xx: Fix link error.

[ upstream commit f2eb3cdf14457fccb14ae8c4d7d7cee088cd3957 ]

Kconfig allows enabling console support for the SC26xx driver even when
it's configured as a module resulting in a:

ERROR: "uart_console_device" [drivers/tty/serial/sc26xx.ko] undefined!

modpost error since the driver was merged in
eea63e0e8a60d00485b47fb6e75d9aa2566b989b [SC26XX: New serial driver for
SC2681 uarts] in 2.6.25.  Fixed by only allowing console support to be
enabled if the driver is builtin.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-serial@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: stable <stable@kernel.org>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoASoC: Ensure we delay long enough for WM8994 FLL to lock
Mark Brown [Sat, 2 Jul 2011 00:24:46 +0000 (17:24 -0700)]
ASoC: Ensure we delay long enough for WM8994 FLL to lock

[ upstream commit 8e9ddf811ba021506d2316fcfe619faa0ab3f567 ]
 when starting

This delay is very conservative.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Cc: stable@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoARM: 6989/1: perf: do not start the PMU when no events are
Will Deacon [Fri, 1 Jul 2011 13:38:12 +0000 (14:38 +0100)]
ARM: 6989/1: perf: do not start the PMU when no events are

[ upstream commit f4f38430c94c38187db73a2cf3892cc8b12a2713 ]
 present

armpmu_enable can be called in situations where no events are present
(for example, from the event rotation tick after a profiled task has
exited). In this case, we currently start the PMU anyway which may
leave it active inevitably without any events being monitored.

This patch adds a simple check to the enabling code so that we avoid
starting the PMU when no events are present.

Cc: <stable@kernel.org>
Reported-by: Ashwin Chaugle <ashwinc@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoStaging: hv: netvsc: Fix a bug in accounting transmit slots
K. Y. Srinivasan [Thu, 16 Jun 2011 20:16:37 +0000 (13:16 -0700)]
Staging: hv: netvsc: Fix a bug in accounting transmit slots

[ upstream commit 9079ce691255792009c446d8c3382507b8d38635 ]

The transmit slots were manipulated without proper locking. Fix this bug by
making the variable tracking the transmit slots atomic.

This patch should be ported to prior stable kernels 2.6.32 and later.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agostaging: comedi: fix infoleak to userspace
Vasiliy Kulikov [Sun, 26 Jun 2011 08:56:22 +0000 (12:56 +0400)]
staging: comedi: fix infoleak to userspace

[ upstream commit 819cbb120eaec7e014e5abd029260db1ca8c5735 ]

driver_name and board_name are pointers to strings, not buffers of size
COMEDI_NAMELEN.  Copying COMEDI_NAMELEN bytes of a string containing
less than COMEDI_NAMELEN-1 bytes would leak some unrelated bytes.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agostaging: r8192e_pci: Handle duplicate PCI ID 0x10ec:0x8192
Larry Finger [Sun, 19 Jun 2011 03:34:34 +0000 (22:34 -0500)]
staging: r8192e_pci: Handle duplicate PCI ID 0x10ec:0x8192

[ upstream commit 1c50bf7e415cf6ce9545dbecc2ac0d89d3916c53 ]
 conflict with rtl8192se

There are two devices with PCI ID 0x10ec:0x8192, namely RTL8192E and
RTL8192SE. The method of distinguishing them is by the revision ID
at offset 0x8 of the PCI configuration space. If the value is 0x10,
then the device uses rtl8192se for a driver.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoiommu/amd: Don't use MSI address range for DMA addresses
Joerg Roedel [Wed, 6 Jul 2011 15:14:44 +0000 (17:14 +0200)]
iommu/amd: Don't use MSI address range for DMA addresses

[ upstream commit 17f5b569e09cfa3488eaa663cbf9feada2e789f5 ]

Reserve the MSI address range in the address allocator so
that MSI addresses are not handed out as dma handles.

Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoARM: pxa: fix PGSR register address calculation
Paul Parsons [Sun, 8 May 2011 01:54:33 +0000 (01:54 +0000)]
ARM: pxa: fix PGSR register address calculation

[ upstream commit beb0c9b056b1c23d2029b46a425362e9ccbeba01 ]

The file mfp-pxa2xx.c defines a macro, PGSR(), which translates a gpio
bank number to a PGSR register address. The function pxa2xx_mfp_suspend()
erroneously passed in a gpio number instead of a gpio bank number.

Signed-off-by: Paul Parsons <lost.distance@yahoo.com>
Cc: stable@kernel.org
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agotracing: Have "enable" file use refcounts like the "filter"
Steven Rostedt [Tue, 5 Jul 2011 18:32:51 +0000 (14:32 -0400)]
tracing: Have "enable" file use refcounts like the "filter"

[ upstream commit 40ee4dffff061399eb9358e0c8fcfbaf8de4c8fe ]
 file

The "enable" file for the event system can be removed when a module
is unloaded and the event system only has events from that module.
As the event system nr_events count goes to zero, it may be freed
if its ref_count is also set to zero.

Like the "filter" file, the "enable" file may be opened by a task and
referenced later, after a module has been unloaded and the events for
that event system have been removed.

Although the "filter" file referenced the event system structure,
the "enable" file only references a pointer to the event system
name. Since the name is freed when the event system is removed,
it is possible that an access to the "enable" file may reference
a freed pointer.

Update the "enable" file to use the subsystem_open() routine that
the "filter" file uses, to keep a reference to the event system
structure while the "enable" file is opened.

Cc: <stable@kernel.org>
Reported-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agotracing: Fix bug when reading system filters on module
Steven Rostedt [Tue, 5 Jul 2011 15:36:06 +0000 (11:36 -0400)]
tracing: Fix bug when reading system filters on module

[ upstream commit e9dbfae53eeb9fc3d4bb7da3df87fa9875f5da02 ]
 removal

The event system is freed when its nr_events is set to zero. This happens
when a module created an event system and then later the module is
removed. Modules may share systems, so the system is allocated when
it is created and freed when the modules are unloaded and all the
events under the system are removed (nr_events set to zero).

The problem arises when a task opened the "filter" file for the
system. If the module is unloaded and it removed the last event for
that system, the system structure is freed. If the task that opened
the filter file accesses the "filter" file after the system has
been freed, the system will access an invalid pointer.

By adding a ref_count, and using it to keep track of what
is using the event system, we can free it after all users
are finished with the event system.

Cc: <stable@kernel.org>
Reported-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoASoC: ak4642: fixup snd_soc_update_bits mask for PW_MGMT2
Kuninori Morimoto [Thu, 7 Jul 2011 00:58:56 +0000 (17:58 -0700)]
ASoC: ak4642: fixup snd_soc_update_bits mask for PW_MGMT2

[ upstream commit bd7fdbcaa2d06d446577fd3c9b81847b04469e01 ]

mask didn't cover update-data

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agomac80211: fix TKIP replay vulnerability
Johannes Berg [Thu, 7 Jul 2011 16:24:54 +0000 (18:24 +0200)]
mac80211: fix TKIP replay vulnerability

[ upstream commit 34459512ffa7236c849466e3bd604801389734e1 ]

Unlike CCMP, the presence or absence of the QoS
field doesn't change the encryption, only the
TID is used. When no QoS field is present, zero
is used as the TID value. This means that it is
possible for an attacker to take a QoS packet
with TID 0 and replay it as a non-QoS packet.

Unfortunately, mac80211 uses different IVs for
checking the validity of the packet's TKIP IV
when it checks TID 0 and when it checks non-QoS
packets. This means it is vulnerable to this
replay attack.

To fix this, use the same replay counter for
TID 0 and non-QoS packets by overriding the
rx->queue value to 0 if it is 16 (non-QoS).

This is a minimal fix for now. I caused this
issue in

commit 1411f9b531f0a910cd1c85a337737c1e6ffbae6a
Author: Johannes Berg <johannes@sipsolutions.net>
Date:   Thu Jul 10 10:11:02 2008 +0200

    mac80211: fix RX sequence number check

while fixing a sequence number issue (there,
a separate counter needs to be used).

[AK: This was a non trivial backport. Johannes, John,
please double check]

Cc: stable@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agov4l2-ioctl.c: prefill tuner type for g_frequency and
Hans Verkuil [Sun, 12 Jun 2011 09:36:41 +0000 (06:36 -0300)]
v4l2-ioctl.c: prefill tuner type for g_frequency and

[ upstream commit 227690df75382e46a4f6ea1bbc5df855a674b47f ]
 g/s_tuner

The subdevs are supposed to receive a valid tuner type for the g_frequency
and g/s_tuner subdev ops. Some drivers do this, others don't. So prefill
this in v4l2-ioctl.c based on whether the device node from which this is
called is a radio node or not.

The spec does not require applications to fill in the type, and if they
leave it at 0 then the 'check_mode' call in tuner-core.c will return
an error and the ioctl does nothing.

Cc: stable@kernel.org
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agopvrusb2: fix g/s_tuner support
Hans Verkuil [Sun, 12 Jun 2011 09:39:52 +0000 (06:39 -0300)]
pvrusb2: fix g/s_tuner support

[ upstream commit 50e9efd60b213ce43ad6979bfc18e25eec2d8413 ]

The tuner-core subdev requires that the type field of v4l2_tuner is
filled in correctly. This is done in v4l2-ioctl.c, but pvrusb2 doesn't
use that yet, so we have to do it manually based on whether the current
input is radio or not.

Tested with my pvrusb2.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Mike Isely <isely@pobox.com>
Cc: stable@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agobttv: fix s_tuner for radio
Hans Verkuil [Sun, 12 Jun 2011 10:02:43 +0000 (07:02 -0300)]
bttv: fix s_tuner for radio

[ upstream commit a024c1a6b274e11596d124619e43c25560f64c01 ]

Fix typo: g_tuner should have been s_tuner.

Tested with a bttv card.

Cc: stable@kernel.org
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoSUNRPC: Fix a race between work-queue and rpc_killall_tasks
Trond Myklebust [Wed, 6 Jul 2011 23:58:23 +0000 (19:58 -0400)]
SUNRPC: Fix a race between work-queue and rpc_killall_tasks

[ upstream commit b55c59892e1f3b6c7d4b9ccffb4263e1486fb990 ]

Since rpc_killall_tasks may modify the rpc_task's tk_action field
without any locking, we need to be careful when dereferencing it.

Reported-by: Ben Greear <greearb@candelatech.com>
Tested-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agousb: musb: restore INDEX register in resume path
Ajay Kumar Gupta [Fri, 8 Jul 2011 09:36:13 +0000 (15:06 +0530)]
usb: musb: restore INDEX register in resume path

[ upstream commit 3c5fec75e121b21a2eb35e5a6b44291509abba6f ]

Restoring the missing INDEX register value in musb_restore_context().
Without this suspend resume functionality is broken with offmode
enabled.

Cc: stable@kernel.org
Acked-by: Anand Gadiyar <gadiyar@ti.com>
Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agomac80211: Restart STA timers only on associated state
Rajkumar Manoharan [Thu, 7 Jul 2011 18:03:39 +0000 (23:33 +0530)]
mac80211: Restart STA timers only on associated state

[ upstream commit 676b58c27475a9defccc025fea1cbd2b141ee539 ]

A panic was observed when the device is failed to resume properly,
and there are no running interfaces. ieee80211_reconfig tries
to restart STA timers on unassociated state.

Cc: stable@kernel.org
Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoEHCI: only power off port if over-current is active
Sergei Shtylyov [Wed, 6 Jul 2011 19:19:38 +0000 (23:19 +0400)]
EHCI: only power off port if over-current is active

[ upstream commit 81463c1d707186adbbe534016cd1249edeab0dac ]

MAX4967 USB power supply chip we use on our boards signals over-current when
power is not enabled; once it's enabled, over-current signal returns to normal.
That unfortunately caused the endless stream of "over-current change on port"
messages. The EHCI root hub code reacts on every over-current signal change
with powering off the port -- such change event is generated the moment the
port power is enabled, so once enabled the power is immediately cut off.
I think we should only cut off power when we're seeing the active over-current
signal, so I'm adding such check to that code. I also think that the fact that
we've cut off the port power should be reflected in the result of GetPortStatus
request immediately, hence I'm adding a PORTSCn register readback after write...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: stable@kernel.org
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agomm/nommu.c: fix remap_pfn_range()
Bob Liu [Fri, 8 Jul 2011 22:39:46 +0000 (15:39 -0700)]
mm/nommu.c: fix remap_pfn_range()

[ upstream commit 8f3b1327aa454bc8283e96bca7669c3c88b83f79 ]

remap_pfn_range() means map physical address pfn<<PAGE_SHIFT to user addr.

For nommu arch it's implemented by vma->vm_start = pfn << PAGE_SHIFT which
is wrong acroding the original meaning of this function.  And some driver
developer using remap_pfn_range() with correct parameter will get
unexpected result because vm_start is changed.  It should be implementd
like addr = pfn << PAGE_SHIFT but which is meanless on nommu arch, this
patch just make it simply return.

Parameter name and setting of vma->vm_flags also be fixed.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: David Howells <dhowells@redhat.com>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Bob Liu <lliubbo@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agofirewire: ohci: do not bind to Pinnacle cards, avert panic
Stefan Richter [Sat, 9 Jul 2011 22:23:03 +0000 (00:23 +0200)]
firewire: ohci: do not bind to Pinnacle cards, avert panic

[ upstream commit 7f7e37115a8b6724f26d0637a04e1d35e3c59717 ]

When firewire-ohci is bound to a Pinnacle MovieBoard, eventually a
"Register access failure" is logged and an interrupt storm or a kernel
panic happens.  https://bugzilla.kernel.org/show_bug.cgi?id=36622

Until this is sorted out (if that is going to succeed at all), let's
just prevent firewire-ohci from touching these devices.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: <stable@kernel.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoARM: pxa/cm-x300: fix V3020 RTC functionality
Igor Grinberg [Mon, 9 May 2011 11:41:46 +0000 (14:41 +0300)]
ARM: pxa/cm-x300: fix V3020 RTC functionality

[ upstream commit 6c7b3ea52e345ab614edb91d3f0e9f3bb3713871 ]

While in sleep mode the CS# and other V3020 RTC GPIOs must be driven
high, otherwise V3020 RTC fails to keep the right time in sleep mode.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Cc: stable@kernel.org
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoSUNRPC: Fix use of static variable in rpcb_getport_async
Ben Greear [Tue, 12 Jul 2011 17:27:55 +0000 (10:27 -0700)]
SUNRPC: Fix use of static variable in rpcb_getport_async

[ upstream commit ec0dd267bf7d08cb30e321e45a75fd40edd7e528 ]

Because struct rpcbind_args *map was declared static, if two
threads entered this method at the same time, the values
assigned to map could be sent two two differen tasks.
This could cause all sorts of problems, include use-after-free
and double-free of memory.

Fix this by removing the static declaration so that the map
pointer is on the stack.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Cc: stable@kernel.org
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agox86, intel, power: Initialize MSR_IA32_ENERGY_PERF_BIAS
Len Brown [Thu, 14 Jul 2011 04:53:24 +0000 (00:53 -0400)]
x86, intel, power: Initialize MSR_IA32_ENERGY_PERF_BIAS

[ upstream commit abe48b108247e9b90b4c6739662a2e5c765ed114 ]

Since 2.6.36 (23016bf0d25), Linux prints the existence of "epb" in /proc/cpuinfo,
Since 2.6.38 (d5532ee7b40), the x86_energy_perf_policy(8) utility has
been available in-tree to update MSR_IA32_ENERGY_PERF_BIAS.

However, the typical BIOS fails to initialize the MSR, presumably
because this is handled by high-volume shrink-wrap operating systems...

Linux distros, on the other hand, do not yet invoke x86_energy_perf_policy(8).
As a result, WSM-EP, SNB, and later hardware from Intel will run in its
default hardware power-on state (performance), which assumes that users
care for performance at all costs and not for energy efficiency.
While that is fine for performance benchmarks, the hardware's intended default
operating point is "normal" mode...

Initialize the MSR to the "normal" by default during kernel boot.

x86_energy_perf_policy(8) is available to change the default after boot,
should the user have a different preference.

Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1107140051020.18606@x980
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: <stable@kernel.org>
14 years agox86: Look for IA32_ENERGY_PERF_BIAS support
Venkatesh Pallipadi [Fri, 4 Jun 2010 03:22:28 +0000 (23:22 -0400)]
x86: Look for IA32_ENERGY_PERF_BIAS support

[ upstream commit 23016bf0 ]

The new IA32_ENERGY_PERF_BIAS MSR allows system software to give
hardware a hint whether OS policy favors more power saving,
or more performance.  This allows the OS to have some influence
on internal hardware power/performance tradeoffs where the OS
has previously had no influence.

The support for this feature is indicated by CPUID.06H.ECX.bit3,
as documented in the Intel Architectures Software Developer's Manual.

This patch discovers support of this feature and displays it
as "epb" in /proc/cpuinfo.

Signed-off-by: Venkatesh Pallipadi <venki@google.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
LKML-Reference: <alpine.LFD.2.00.1006032310160.6669@localhost.localdomain>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agosvcrpc: fix list-corrupting race on nfsd shutdown
J. Bruce Fields [Wed, 29 Jun 2011 20:49:04 +0000 (16:49 -0400)]
svcrpc: fix list-corrupting race on nfsd shutdown

[ upstream commit ebc63e531cc6a457595dd110b07ac530eae788c3 ]

After commit 3262c816a3d7fb1eaabce633caa317887ed549ae "[PATCH] knfsd:
split svc_serv into pools", svc_delete_xprt (then svc_delete_socket) no
longer removed its xpt_ready (then sk_ready) field from whatever list it
was on, noting that there was no point since the whole list was about to
be destroyed anyway.

That was mostly true, but forgot that a few svc_xprt_enqueue()'s might
still be hanging around playing with the about-to-be-destroyed list, and
could get themselves into trouble writing to freed memory if we left
this xprt on the list after freeing it.

(This is actually functionally identical to a patch made first by Ben
Greear, but with more comments.)

Cc: stable@kernel.org
Cc: gnb@fmeh.org
Reported-by: Ben Greear <greearb@candelatech.com>
Tested-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agofirewire: cdev: return -ENOTTY for unimplemented ioctls, not
Stefan Richter [Sat, 9 Jul 2011 14:42:26 +0000 (16:42 +0200)]
firewire: cdev: return -ENOTTY for unimplemented ioctls, not

[ upstream commit d873d794235efa590ab3c94d5ee22bb1fab19ac4 ]
 -EINVAL

On Jun 27 Linus Torvalds wrote:
> The correct error code for "I don't understand this ioctl" is ENOTTY.
> The naming may be odd, but you should think of that error value as a
> "unrecognized ioctl number, you're feeding me random numbers that I
> don't understand and I assume for historical reasons that you tried to
> do some tty operation on me".
[...]
> The EINVAL thing goes way back, and is a disaster. It predates Linux
> itself, as far as I can tell. You'll find lots of man-pages that have
> this line in it:
>
>   EINVAL Request or argp is not valid.
>
> and it shows up in POSIX etc. And sadly, it generally shows up
> _before_ the line that says
>
>   ENOTTY The specified request does not apply to the kind of object
> that the descriptor d references.
>
> so a lot of people get to the EINVAL, and never even notice the ENOTTY.
[...]
> At least glibc (and hopefully other C libraries) use a _string_ that
> makes much more sense: strerror(ENOTTY) is "Inappropriate ioctl for
> device"

So let's correct this in the <linux/firewire-cdev.h> ABI while it is
still young, relative to distributor adoption.

Side note:  We return -ENOTTY not only on _IOC_TYPE or _IOC_NR mismatch,
but also on _IOC_SIZE mismatch.  An ioctl with an unsupported size of
argument structure can be seen as an unsupported version of that ioctl.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: <stable@kernel.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agofirewire: cdev: prevent race between first get_info ioctl
Stefan Richter [Sat, 9 Jul 2011 14:43:22 +0000 (16:43 +0200)]
firewire: cdev: prevent race between first get_info ioctl

[ upstream commit 93b37905f70083d6143f5f4dba0a45cc64379a62 ]
 and bus reset event queuing

Between open(2) of a /dev/fw* and the first FW_CDEV_IOC_GET_INFO
ioctl(2) on it, the kernel already queues FW_CDEV_EVENT_BUS_RESET events
to be read(2) by the client.  The get_info ioctl is practically always
issued right away after open, hence this condition only occurs if the
client opens during a bus reset, especially during a rapid series of bus
resets.

The problem with this condition is twofold:

  - These bus reset events carry the (as yet undocumented) @closure
    value of 0.  But it is not the kernel's place to choose closures;
    they are privat to the client.  E.g., this 0 value forced from the
    kernel makes it unsafe for clients to dereference it as a pointer to
    a closure object without NULL pointer check.

  - It is impossible for clients to determine the relative order of bus
    reset events from get_info ioctl(2) versus those from read(2),
    except in one way:  By comparison of closure values.  Again, such a
    procedure imposes complexity on clients and reduces freedom in use
    of the bus reset closure.

So, change the ABI to suppress queuing of bus reset events before the
first FW_CDEV_IOC_GET_INFO ioctl was issued by the client.

Note, this ABI change cannot be version-controlled.  The kernel cannot
distinguish old from new clients before the first FW_CDEV_IOC_GET_INFO
ioctl.

We will try to back-merge this change into currently maintained stable/
longterm series, and we only document the new behaviour.  The old
behavior is now considered a kernel bug, which it basically is.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: <stable@kernel.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agoUSB: OHCI: fix another regression for NVIDIA controllers
Alan Stern [Fri, 15 Jul 2011 21:22:15 +0000 (17:22 -0400)]
USB: OHCI: fix another regression for NVIDIA controllers

[ upstream commit 6ea12a04d295235ed67010a09fdea58c949e3eb0 ]

The NVIDIA series of OHCI controllers continues to be troublesome.  A
few people using the MCP67 chipset have reported that even with the
most recent kernels, the OHCI controller fails to handle new
connections and spams the system log with "unable to enumerate USB
port" messages.  This is different from the other problems previously
reported for NVIDIA OHCI controllers, although it is probably related.

It turns out that the MCP67 controller does not like to be kept in the
RESET state very long.  After only a few seconds, it decides not to
work any more.  This patch (as1479) changes the PCI initialization
quirk code so that NVIDIA controllers are switched into the SUSPEND
state after 50 ms of RESET.  With no interrupts enabled and all the
downstream devices reset, and thus unable to send wakeup requests,
this should be perfectly safe (even for non-NVIDIA hardware).

The removal code in ohci-hcd hasn't been changed; it will still leave
the controller in the RESET state.  As a result, if someone unloads
ohci-hcd and then reloads it, the controller won't work again until
the system is rebooted.  If anybody complains about this, the removal
code can be updated similarly.

This fixes Bugzilla #22052.

Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: stable <stable@kernel.org>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agohwmon: (asus_atk0110) Fix memory leak
Luca Tettamanti [Sun, 17 Jul 2011 16:39:18 +0000 (18:39 +0200)]
hwmon: (asus_atk0110) Fix memory leak

[ upstream commit 0b8e77f12cb6bfe2e5a67f2cdc8c7af23abc4ccf ]

The object returned by atk_gitm is dynamically allocated and must be
freed.

Signed-off-by: Luca Tettamanti <kronos.it@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: stable@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agohwmon: (max1111) Fix race condition causing NULL pointer
Pavel Herrmann [Sun, 17 Jul 2011 16:39:19 +0000 (18:39 +0200)]
hwmon: (max1111) Fix race condition causing NULL pointer

[ upstream commit d3f684f2820a7f42acef68bea6622d9032127fb2 ]
 exception

spi_sync call uses its spi_message parameter to keep completion information,
using a drvdata structure is not thread-safe. Use a mutex to prevent
multiple access to shared driver data.

Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
Acked-by: Cyril Hrubis <metan@ucw.cz>
Tested-by: Stanislav Brabec <utx@penguin.cz>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: stable@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agosi4713-i2c: avoid potential buffer overflow on si4713
Mauro Carvalho Chehab [Sun, 17 Jul 2011 03:24:37 +0000 (00:24 -0300)]
si4713-i2c: avoid potential buffer overflow on si4713

[ upstream commit dc6b845044ccb7e9e6f3b7e71bd179b3cf0223b6 ]
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

While compiling it with Fedora 15, I noticed this issue:

  inlined from ‘si4713_write_econtrol_string’ at drivers/media/radio/si4713-i2c.c:1065:24:
  arch/x86/include/asm/uaccess_32.h:211:26: error: call to ‘copy_from_user_overflow’ declared with attribute error: copy_from_user() buffer size is not provably correct

Cc: stable@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Acked-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
Reviewed-by: Eugene Teo <eugeneteo@kernel.sg>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agopowerpc/kdump: Fix timeout in crash_kexec_wait_realmode
Michael Neuling [Mon, 4 Jul 2011 20:40:10 +0000 (20:40 +0000)]
powerpc/kdump: Fix timeout in crash_kexec_wait_realmode

[ upstream commit 63f21a56f1cc0b800a4c00349c59448f82473d19 ]

The existing code it pretty ugly.  How about we clean it up even more
like this?

From: Anton Blanchard <anton@samba.org>

We check for timeout expiry in the outer loop, but we also need to
check it in the inner loop or we can lock up forever waiting for a
CPU to hit real mode.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Cc: <stable@kernel.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
14 years agohvc_console: Improve tty/console put_chars handling
Hendrik Brueckner [Tue, 5 Jul 2011 21:50:18 +0000 (21:50 +0000)]
hvc_console: Improve tty/console put_chars handling

[ upstream commit 8c2381af0d3ef62a681dac5a141b6dabb27bf2e1 ]

Currently, the hvc_console_print() function drops console output if the
hvc backend's put_chars() returns 0.  This patch changes this behavior
to allow a retry through returning -EAGAIN.

This change also affects the hvc_push() function.  Both functions are
changed to handle -EAGAIN and to retry the put_chars() operation.

If a hvc backend returns -EAGAIN, the retry handling differs:

  - hvc_console_print() spins to write the complete console output.
  - hvc_push() behaves the same way as for returning 0.

Now hvc backends can indirectly control the way how console output is
handled through the hvc console layer.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Acked-by: Anton Blanchard <anton@samba.org>
Cc: <stable@kernel.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>