2.6.39.3 review
Subsystems (72)
cover 2.6.39.3 review
This is the start of the stable review cycle for the 2.6.39.3 release. There are 107 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Sat, Jul 9, 2011, 00:00:00 UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.39.3-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Documentation/filesystems/caching/netfs-api.txt | 16 ++++++ Makefile | 2 +- arch/arm/mach-exynos4/init.c | 1 + arch/arm/plat-samsung/include/plat/regs-serial.h | 2 + arch/x86/include/asm/pvclock.h | 9 +++- arch/x86/kernel/acpi/realmode/wakeup.S | 14 +++++ arch/x86/kernel/acpi/realmode/wakeup.h | 6 ++ arch/x86/kernel/acpi/sleep.c | 6 ++ arch/x86/oprofile/nmi_int.c | 14 ++++-- arch/x86/pci/xen.c | 40 +++++++++++--- arch/x86/xen/mmu.c | 14 +++++- arch/x86/xen/smp.c | 7 +++ block/cfq-iosched.c | 11 +++- drivers/base/platform.c | 2 +- drivers/base/power/main.c | 28 ++++++++--- drivers/connector/connector.c | 1 + drivers/gpu/drm/drm_pci.c | 3 +- drivers/gpu/drm/i915/i915_irq.c | 10 ++++ drivers/gpu/drm/i915/intel_i2c.c | 3 +- drivers/gpu/drm/radeon/radeon_encoders.c | 6 ++- drivers/gpu/drm/radeon/rv770.c | 6 ++ drivers/hwmon/ibmaem.c | 2 + drivers/hwmon/ibmpex.c | 1 + drivers/hwmon/s3c-hwmon.c | 2 + drivers/i2c/busses/i2c-taos-evm.c | 8 ++-- drivers/i2c/muxes/pca954x.c | 7 ++- drivers/input/input.c | 2 +- drivers/input/mousedev.c | 4 +- drivers/md/md.c | 1 + drivers/media/rc/ir-raw.c | 4 +- drivers/media/rc/ite-cir.c | 12 +++- drivers/media/rc/ite-cir.h | 3 + drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c | 58 ++++++++++----------- drivers/media/video/uvc/uvc_queue.c | 2 + drivers/misc/lkdtm.c | 8 +++ drivers/mmc/host/tmio_mmc_pio.c | 4 +- drivers/net/hamradio/6pack.c | 4 +- drivers/net/hamradio/mkiss.c | 4 +- drivers/net/pxa168_eth.c | 2 +- drivers/net/wireless/ath/ath5k/base.c | 11 ++++- drivers/net/wireless/ath/ath5k/eeprom.c | 8 +-- drivers/net/wireless/ath/ath5k/reset.c | 5 ++- drivers/net/wireless/ath/ath9k/pci.c | 6 ++ drivers/net/wireless/iwlwifi/iwl-core.c | 3 +- drivers/pci/pci-driver.c | 4 +- drivers/pci/quirks.c | 2 + drivers/staging/lirc/lirc_zilog.c | 4 +- drivers/tty/serial/pch_uart.c | 4 +- drivers/tty/serial/s5pv210.c | 4 +- drivers/tty/tty_ldisc.c | 4 +- drivers/usb/core/driver.c | 17 +++++-- drivers/usb/core/hub.c | 16 ++++-- drivers/usb/core/message.c | 17 ++++++- drivers/usb/host/xhci-pci.c | 8 +++ drivers/usb/host/xhci-ring.c | 11 ++-- drivers/usb/host/xhci.c | 24 +++++++-- drivers/usb/host/xhci.h | 1 + drivers/usb/serial/ftdi_sio.c | 19 +++++-- drivers/usb/serial/ftdi_sio.h | 3 +- drivers/usb/serial/ftdi_sio_ids.h | 1 + drivers/watchdog/mtx-1_wdt.c | 8 +++ fs/block_dev.c | 14 +++++- fs/cifs/fscache.c | 1 + fs/fscache/page.c | 44 ++++++++++++++++ fs/hfsplus/wrapper.c | 7 ++- fs/lockd/clntproc.c | 8 +++- fs/locks.c | 30 +++++++---- fs/nfs/fscache.c | 8 +-- fs/nfs/inode.c | 6 ++- fs/nfs/internal.h | 11 ++++ fs/nfs/nfs4filelayout.c | 15 ++++-- fs/nfs/nfs4proc.c | 33 ++++++++---- fs/nfs/nfs4xdr.c | 14 +++--- fs/nfsd/Kconfig | 1 + fs/nfsd/nfsctl.c | 19 ++----- fs/nfsd/vfs.c | 19 ++++--- include/asm-generic/bug.h | 3 - include/linux/blk_types.h | 2 +- include/linux/clocksource.h | 1 + include/linux/connector.h | 2 +- include/linux/device.h | 4 +- include/linux/fscache.h | 21 ++++++++ include/linux/if_packet.h | 2 + include/linux/netfilter/ipset/ip_set_ahash.h | 4 +- include/linux/netfilter/ipset/ip_set_timeout.h | 18 ++++--- include/linux/pci_ids.h | 1 + include/linux/pm.h | 3 +- include/linux/ratelimit.h | 40 ++++++++++++++ include/linux/sunrpc/sched.h | 3 +- include/net/ip_vs.h | 3 +- init/calibrate.c | 14 +++-- kernel/power/snapshot.c | 6 ++- kernel/power/user.c | 4 +- kernel/taskstats.c | 15 ++++- kernel/time/clocksource.c | 24 +++++---- lib/debugobjects.c | 2 +- mm/hugetlb.c | 8 +++ mm/ksm.c | 6 ++ mm/memory-failure.c | 4 +- mm/memory_hotplug.c | 2 +- mm/migrate.c | 2 +- net/8021q/vlan_dev.c | 2 +- net/bridge/br_netfilter.c | 6 ++ net/core/ethtool.c | 25 +++++++++- net/core/filter.c | 5 ++- net/ipv4/af_inet.c | 3 + net/ipv4/inet_diag.c | 14 ++--- net/ipv4/inetpeer.c | 42 ++++++++++----- net/ipv4/netfilter.c | 60 ++++++++-------------- net/ipv4/netfilter/ipt_REJECT.c | 14 ++---- net/ipv4/route.c | 4 +- net/ipv4/udp.c | 3 + net/ipv6/udp.c | 5 ++- net/netfilter/ipset/ip_set_core.c | 2 +- net/netfilter/ipvs/ip_vs_conn.c | 10 +++- net/netfilter/ipvs/ip_vs_core.c | 1 + net/netfilter/ipvs/ip_vs_ftp.c | 27 +++++++--- net/packet/af_packet.c | 2 + net/sunrpc/auth_gss/auth_gss.c | 4 +- net/sunrpc/auth_gss/gss_krb5_mech.c | 3 +- net/sunrpc/clnt.c | 5 ++- net/sunrpc/sched.c | 1 + net/xfrm/xfrm_replay.c | 4 +- security/keys/request_key.c | 3 +- sound/pci/hda/patch_conexant.c | 3 + sound/pci/hda/patch_realtek.c | 1 - sound/soc/pxa/pxa2xx-pcm.c | 4 +- virt/kvm/assigned-dev.c | 5 +-- 128 files changed, 857 insertions(+), 334 deletions(-)
Hi
On Friday 08 July 2011, Greg KH wrote:
[...]
Quoted 6 lines
Responses should be made by Sat, Jul 9, 2011, 00:00:00 UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.39.3-rc1.gzand the diffstat can be found below.
The patch series from queue-2.6.39[1] (a) and patch-2.6.39.3-rc1.gz (b) differ, leading to a build failure due to gss_krb5_enctypes.h missing from patch-2.6.39.3-rc1.gz
include/linux/sunrpc/gss_krb5_enctypes.h deleted +0 -4
@@ -1,4 +0,0 @@ -/* -* Dumb way to share this static piece of information with nfsd -*/ -#define KRB5_SUPPORTED_ENCTYPES "18,17,16,23,3,1,2"
Apparently the hunk creating include/linux/sunrpc/gss_krb5_enctypes.h in nfsd-fix-dependency-of-nfsd-on-auth_rpcgss.patch hasn't made it to patch-2.6.39.3-rc1.gz, while it exists in [2].
Regards
Stefan Lippers-Hollmann
[1] http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git;a=tree;f=queue-2.6.39;hb=refs/heads/master
[2] http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git;a=blob;f=queue-2.6.39/nfsd-fix-dependency-of-nfsd-on-auth_rpcgss.patch;hb=refs/heads/master
Quoted 26 lines · Stefan Lippers-Hollmann
Hi
On Friday 08 July 2011, Greg KH wrote:
[...]Quoted 6 lines
Responses should be made by Sat, Jul 9, 2011, 00:00:00 UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.39.3-rc1.gzand the diffstat can be found below.
The patch series from queue-2.6.39[1] (a) and patch-2.6.39.3-rc1.gz (b) differ, leading to a build failure due to
gss_krb5_enctypes.hmissing from patch-2.6.39.3-rc1.gzdiff -Nrup
a/include/linux/sunrpc/gss_krb5_enctypes.hb/include/linux/sunrpc/gss_krb5_enctypes.hinclude/linux/sunrpc/gss_krb5_enctypes.h deleted +0
-4@@ -1,4 +0,0 @@ -/* -* Dumb way to share this static piece of information with nfsd -*/ -#define KRB5_SUPPORTED_ENCTYPES "18,17,16,23,3,1,2"
Quoted 3 lines
Apparently the hunk creating
include/linux/sunrpc/gss_krb5_enctypes.hin nfsd-fix-dependency-of-nfsd-on-auth_rpcgss.patch hasn't made it to patch-2.6.39.3-rc1.gz, while it exists in [2].
Ah crap, I thought that was an auto-generated file. I'll go generate the diff file differently to get this in there, thanks for letting me know.
greg k-h
Quoted 7 lines · Stefan Lippers-Hollmann
Hi
On Friday 08 July 2011, Greg KH wrote:
[...]Quoted 3 lines
Responses should be made by Sat, Jul 9, 2011, 00:00:00 UTC. Anything received after that time might be too late.
Quoted 7 lines
Quoted 3 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.39.3-rc1.gzand the diffstat can be found below.
The patch series from queue-2.6.39[1] (a) and patch-2.6.39.3-rc1.gz (b) differ, leading to a build failure due to
gss_krb5_enctypes.hmissing from patch-2.6.39.3-rc1.gz
Ok, after the mirrors catch up, there will be a -rc2 at:
kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.39.3-rc2.gz
that should have solved this issue.
thanks again for pointing it out.
greg k-h
PATCH 1/107 netfilter: ipset: Use proper timeout value to jiffies conversion
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jozsef Kadlecsik <[email protected]>
[ Upstream commit 249ddc79a38a8918ad53ac22606ca8af694344a5 ]
--- include/linux/netfilter/ipset/ip_set_timeout.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
include/linux/netfilter/ipset/ip_set_timeout.h +10 -8
@@ -45,7 +45,7 @@ ip_set_timeout_test(unsigned long timeou {return timeout !=IPSET_ELEM_UNSET && (timeout ==IPSET_ELEM_PERMANENT || -time_after (timeout, jiffies)); +time_is_after_jiffies (timeout)); } static inline bool
@@ -53,7 +53,7 @@ ip_set_timeout_expired(unsigned long tim {return timeout !=IPSET_ELEM_UNSET && timeout !=IPSET_ELEM_PERMANENT && -time_before (timeout, jiffies); +time_is_before_jiffies (timeout); } static inline unsigned long
@@ -64,7 +64,7 @@ ip_set_timeout_set(u32 timeout)if (!timeout)return IPSET_ELEM_PERMANENT ; - t = timeout *HZ + jiffies; + t =msecs_to_jiffies (timeout *1000 ) + jiffies;if (t ==IPSET_ELEM_UNSET || t ==IPSET_ELEM_PERMANENT )/* Bingo! */ t++;
@@ -75,7 +75,8 @@ ip_set_timeout_set(u32 timeout)static inline u32 ip_set_timeout_get (unsigned long timeout) { -return timeout ==IPSET_ELEM_PERMANENT ?0 : (timeout - jiffies)/HZ ; +return timeout ==IPSET_ELEM_PERMANENT ?0 : +jiffies_to_msecs (timeout - jiffies)/1000 ; }#else
@@ -89,14 +90,14 @@ static inline bool ip_set_timeout_test(unsigned long timeout) {return timeout ==IPSET_ELEM_PERMANENT || -time_after (timeout, jiffies); +time_is_after_jiffies (timeout); }static inline bool ip_set_timeout_expired (unsigned long timeout) {return timeout !=IPSET_ELEM_PERMANENT && -time_before (timeout, jiffies); +time_is_before_jiffies (timeout); } static inline unsigned long
@@ -107,7 +108,7 @@ ip_set_timeout_set(u32 timeout)if (!timeout)return IPSET_ELEM_PERMANENT ; - t = timeout *HZ + jiffies; + t =msecs_to_jiffies (timeout *1000 ) + jiffies;if (t ==IPSET_ELEM_PERMANENT )/* Bingo! :-) */ t++;
@@ -118,7 +119,8 @@ ip_set_timeout_set(u32 timeout)static inline u32 ip_set_timeout_get (unsigned long timeout) { -return timeout ==IPSET_ELEM_PERMANENT ?0 : (timeout - jiffies)/HZ ; +return timeout ==IPSET_ELEM_PERMANENT ?0 : +jiffies_to_msecs (timeout - jiffies)/1000 ; }#endif /* ! IP_SET_BITMAP_TIMEOUT */
PATCH 2/107 net: fix ETHTOOL_SFEATURES compatibility with old ethtool_ops.set_flags
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= <[email protected]>
[ Upstream commit fd0daf9d58f6b3342d07c5f6bbfb304dbe5db4ec ]
Current code squashes flags to bool - this makes set_flags fail whenever some ETH_FLAG_* equivalent features are set. Fix this.
--- net/core/ethtool.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
net/core/ethtool.c +24 -1
@@ -231,6 +231,29 @@ static int ethtool_set_feature_compat(streturn 1 ; } +static int ethtool_set_flags_compat (struct net_device *dev, +int (*legacy_set)(struct net_device *,u32 ), +struct ethtool_set_features_block *features,u32 mask) +{ +u32 value; + +if (!legacy_set) +return 0 ; + +if (!(features[0 ].valid & mask)) +return 0 ; + + value = dev->features & ~features[0 ].valid; + value |= features[0 ].requested; + + features[0 ].valid &= ~mask; + +if (legacy_set (dev, value & mask) <0 ) +netdev_info (dev,"Legacy flags change failed\n" ); + +return 1 ; +} +static int ethtool_set_features_compat (struct net_device *dev,struct ethtool_set_features_block *features) {
@@ -247,7 +270,7 @@ static int ethtool_set_features_compat(s features, NETIF_F_ALL_TSO); compat |=ethtool_set_feature_compat (dev, dev->ethtool_ops->set_rx_csum, features,NETIF_F_RXCSUM ); - compat |=ethtool_set_feature_compat (dev, dev->ethtool_ops->set_flags, + compat |=ethtool_set_flags_compat (dev, dev->ethtool_ops->set_flags, features, flags_dup_features);return compat;
PATCH 3/107 netfilter: ipset: remove unused variable from type_pf_tdel()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jozsef Kadlecsik <[email protected]>
[ Upstream commit b141c242ff978b63cdf0f3d1a767a5152750166b ]
Variable 'ret' is set in type_pf_tdel() but not used, remove.
--- include/linux/netfilter/ipset/ip_set_ahash.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/netfilter/ipset/ip_set_ahash.h +2 -2
@@ -839,7 +839,7 @@ type_pf_tdel(struct ip_set *set, void *vstruct htable *t = h->table;const struct type_pf_elem *d = value;struct hbucket *n; -int i, ret =0 ; +int i;struct type_pf_elem *data;u32 key;
@@ -850,7 +850,7 @@ type_pf_tdel(struct ip_set *set, void *vif (!type_pf_data_equal (data, d))continue ;if (type_pf_data_expired (data)) - ret = -IPSET_ERR_EXIST ; +return -IPSET_ERR_EXIST ;if (i != n->pos -1 )/* Not last one */ type_pf_data_copy (data,ahash_tdata (n, n->pos -1 ));
PATCH 4/107 netfilter: ipset: fix ip_set_flush return code
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jozsef Kadlecsik <[email protected]>
[ Upstream commit 9184a9cba622d9e38462ce11dff7da094b4fea84 ]
ip_set_flush returned -EPROTO instead of -IPSET_ERR_PROTOCOL, fixed
--- net/netfilter/ipset/ip_set_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/ipset/ip_set_core.c +1 -1
@@ -815,7 +815,7 @@ ip_set_flush(struct sock *ctnl, struct sip_set_id_t i;if (unlikely (protocol_failed (attr))) -return -EPROTO ; +return -IPSET_ERR_PROTOCOL ;if (!attr[IPSET_ATTR_SETNAME ]) {for (i =0 ; i < ip_set_max; i++)
PATCH 5/107 bug.h: Add WARN_RATELIMIT
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Joe Perches <[email protected]>
[ Upstream commit b3eec79b0776e5340a3db75b34953977c7e5086e ]
Add a generic mechanism to ratelimit WARN(foo, fmt, ...) messages using a hidden per call site static struct ratelimit_state.
Also add an __WARN_RATELIMIT variant to be able to use a specific struct ratelimit_state.
--- include/asm-generic/bug.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
include/asm-generic/bug.h +16 -0
@@ -165,6 +165,22 @@ extern void warn_slowpath_null(const cha#define WARN_ON_RATELIMIT (condition, state) \ WARN_ON((condition) && __ratelimit(state)) +#define __WARN_RATELIMIT(condition, state, format...) \ +({ \ + int rtn = 0; \ + if (unlikely(__ratelimit(state))) \ + rtn = WARN(condition, format); \ + rtn; \ +}) + +#define WARN_RATELIMIT(condition, format...) \ +({ \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + __WARN_RATELIMIT(condition, &_rs, format); \ +}) +/* * WARN_ON_SMP() is for cases that the warning is either * meaningless for !SMP or may even cause failures.
PATCH 6/107 net: filter: Use WARN_RATELIMIT
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Joe Perches <[email protected]>
[ Upstream commit 6c4a5cb219520c7bc937ee186ca53f03733bd09f ]
A mis-configured filter can spam the logs with lots of stack traces.
Rate-limit the warnings and add printout of the bogus filter information.
--- net/core/filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/filter.c +3 -1
@@ -409,7 +409,9 @@ load_b:continue ; }default : -WARN_ON (1 ); +WARN_RATELIMIT (1 ,"Unknown code:%u jt:%u tf:%u k:%u\n" , + fentry->code, fentry->jt, + fentry->jf, fentry->k);return 0 ; } }
PATCH 7/107 bug.h: Fix build with CONFIG_PRINTK disabled.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: "David S. Miller" <[email protected]>
[ Upstream commit 6b3678354647a653e669746c05765f05d2b90239 ]
Based upon an email by Joe Perches.
--- include/asm-generic/bug.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
include/asm-generic/bug.h +21 -0
@@ -162,6 +162,8 @@ extern void warn_slowpath_null(const chaunlikely (__ret_warn_once); \ }) +#ifdef CONFIG_PRINTK +#define WARN_ON_RATELIMIT (condition, state) \ WARN_ON((condition) && __ratelimit(state))
@@ -181,6 +183,25 @@ extern void warn_slowpath_null(const cha__WARN_RATELIMIT (condition, &_rs, format); \ }) +#else + +#define WARN_ON_RATELIMIT (condition, state) \ + WARN_ON(condition) + +#define __WARN_RATELIMIT(condition, state, format...) \ +({ \ + int rtn = WARN(condition, format); \ + rtn; \ +}) + +#define WARN_RATELIMIT(condition, format...) \ +({ \ + int rtn = WARN(condition, format); \ + rtn; \ +}) + +#endif +/* * WARN_ON_SMP() is for cases that the warning is either * meaningless for !SMP or may even cause failures.
PATCH 8/107 bug.h: Move ratelimit warn interfaces to ratelimit.h
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: "David S. Miller" <[email protected]>
[ Upstream commit 86e4ca66e81bba0f8640f1fa19b8b8f72cbd0561 ]
As reported by Ingo Molnar, we still have configuration combinations where use of the WARN_RATELIMIT interfaces break the build because dependencies don't get met.
Instead of going down the long road of trying to make it so that ratelimit.h can get included by kernel.h or asm-generic/bug.h, just move the interface into ratelimit.h and make users have to include that.
--- include/asm-generic/bug.h | 40 ---------------------------------------- include/linux/ratelimit.h | 40 ++++++++++++++++++++++++++++++++++++++++ net/core/filter.c | 1 + 3 files changed, 41 insertions(+), 40 deletions(-)
include/asm-generic/bug.h +0 -40
@@ -162,46 +162,6 @@ extern void warn_slowpath_null(const chaunlikely (__ret_warn_once); \ }) -#ifdef CONFIG_PRINTK - -#define WARN_ON_RATELIMIT (condition, state) \ - WARN_ON((condition) && __ratelimit(state)) - -#define __WARN_RATELIMIT(condition, state, format...) \ -({ \ - int rtn = 0; \ - if (unlikely(__ratelimit(state))) \ - rtn = WARN(condition, format); \ - rtn; \ -}) - -#define WARN_RATELIMIT(condition, format...) \ -({ \ - static DEFINE_RATELIMIT_STATE(_rs, \ - DEFAULT_RATELIMIT_INTERVAL, \ - DEFAULT_RATELIMIT_BURST); \ - __WARN_RATELIMIT(condition, &_rs, format); \ -}) - -#else - -#define WARN_ON_RATELIMIT (condition, state) \ - WARN_ON(condition) - -#define __WARN_RATELIMIT(condition, state, format...) \ -({ \ - int rtn = WARN(condition, format); \ - rtn; \ -}) - -#define WARN_RATELIMIT(condition, format...) \ -({ \ - int rtn = WARN(condition, format); \ - rtn; \ -}) - -#endif -/* * WARN_ON_SMP() is for cases that the warning is either * meaningless for !SMP or may even cause failures.
include/linux/ratelimit.h +40 -0
@@ -41,4 +41,44 @@ extern struct ratelimit_state printk_ratextern int ___ratelimit (struct ratelimit_state *rs,const char *func);#define __ratelimit (state) ___ratelimit(state, __func__) +#ifdef CONFIG_PRINTK + +#define WARN_ON_RATELIMIT (condition, state) \ + WARN_ON((condition) && __ratelimit(state)) + +#define __WARN_RATELIMIT(condition, state, format...) \ +({ \ + int rtn = 0; \ + if (unlikely(__ratelimit(state))) \ + rtn = WARN(condition, format); \ + rtn; \ +}) + +#define WARN_RATELIMIT(condition, format...) \ +({ \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + __WARN_RATELIMIT(condition, &_rs, format); \ +}) + +#else + +#define WARN_ON_RATELIMIT (condition, state) \ + WARN_ON(condition) + +#define __WARN_RATELIMIT(condition, state, format...) \ +({ \ + int rtn = WARN(condition, format); \ + rtn; \ +}) + +#define WARN_RATELIMIT(condition, format...) \ +({ \ + int rtn = WARN(condition, format); \ + rtn; \ +}) + +#endif +#endif /* _LINUX_RATELIMIT_H */
net/core/filter.c +1 -0
@@ -38,6 +38,7 @@#include <asm/unaligned.h> #include <linux/filter.h> #include <linux/reciprocal_div.h> +#include <linux/ratelimit.h> enum {BPF_S_RET_K =1 ,
PATCH 9/107 IPVS: bug in ip_vs_ftp, same list heaad used in all netns.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hans Schillstrom <[email protected]>
[ Upstream commit c74c0bfe0b61cf41a897c2444c038e0d3f600556 ]
When ip_vs was adapted to netns the ftp application was not adapted in a correct way.
However this is a fix to avoid kernel errors. In the long term another solution might be chosen. I.e the ports that the ftp appl, uses should be per netns.
--- include/net/ip_vs.h | 3 ++- net/netfilter/ipvs/ip_vs_ftp.c | 27 +++++++++++++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-)
include/net/ip_vs.h +2 -1
@@ -802,7 +802,8 @@ struct netns_ipvs {struct list_head rs_table[IP_VS_RTAB_SIZE ];/* ip_vs_app */ struct list_head app_list; - +/* ip_vs_ftp */ +struct ip_vs_app *ftp_app;/* ip_vs_proto */ #define IP_VS_PROTO_TAB_SIZE 32/* must be power of 2 */ struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE ];
net/netfilter/ipvs/ip_vs_ftp.c +19 -8
@@ -411,25 +411,35 @@ static struct ip_vs_app ip_vs_ftp = {static int __net_init __ip_vs_ftp_init (struct net *net) {int i, ret; -struct ip_vs_app *app = &ip_vs_ftp; +struct ip_vs_app *app; +struct netns_ipvs *ipvs =net_ipvs (net); + + app =kmemdup (&ip_vs_ftp,sizeof (struct ip_vs_app ),GFP_KERNEL ); +if (!app) +return -ENOMEM ; +INIT_LIST_HEAD (&app->a_list); +INIT_LIST_HEAD (&app->incs_list); + ipvs->ftp_app = app; ret =register_ip_vs_app (net, app);if (ret) -return ret; + goto err_exit;for (i=0 ; i<IP_VS_APP_MAX_PORTS ; i++) {if (!ports[i])continue ; ret =register_ip_vs_app_inc (net, app, app->protocol, ports[i]);if (ret) -break ; + goto err_unreg;pr_info ("%s: loaded support on port[%d] = %d\n" , app->name, i, ports[i]); } +return 0 ; -if (ret) -unregister_ip_vs_app (net, app); - +err_unreg: +unregister_ip_vs_app (net, app); +err_exit: +kfree (ipvs->ftp_app);return ret; }/*
@@ -437,9 +447,10 @@ static int __net_init __ip_vs_ftp_init(s*/ static void __ip_vs_ftp_exit (struct net *net) { -struct ip_vs_app *app = &ip_vs_ftp; +struct netns_ipvs *ipvs =net_ipvs (net); -unregister_ip_vs_app (net, app); +unregister_ip_vs_app (net, ipvs->ftp_app); +kfree (ipvs->ftp_app); }static struct pernet_operations ip_vs_ftp_ops = {
PATCH 10/107 inetpeer: fix race in unused_list manipulations
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 686a7e32ca7fdd819eb9606abd3db52b77d1479f ]
Several crashes in cleanup_once() were reported in recent kernels.
Commit d6cc1d642de9 (inetpeer: various changes) added a race in unlink_from_unused().
One way to avoid taking unused_peers.lock before doing the list_empty() test is to catch 0->1 refcnt transitions, using full barrier atomic operations variants (atomic_cmpxchg() and atomic_inc_return()) instead of previous atomic_inc() and atomic_add_unless() variants.
We then call unlink_from_unused() only for the owner of the 0->1 transition.
Add a new atomic_add_unless_return() static helper
With help from Arun Sharma.
Refs: https://bugzilla.kernel.org/show_bug.cgi?id=32772
--- net/ipv4/inetpeer.c | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-)
net/ipv4/inetpeer.c +27 -15
@@ -154,11 +154,9 @@ void __init inet_initpeers(void)/* Called with or without local BH being disabled. */ static void unlink_from_unused (struct inet_peer *p) { -if (!list_empty (&p->unused)) { -spin_lock_bh (&unused_peers.lock); -list_del_init (&p->unused); -spin_unlock_bh (&unused_peers.lock); - } +spin_lock_bh (&unused_peers.lock); +list_del_init (&p->unused); +spin_unlock_bh (&unused_peers.lock); } static int addr_compare(const struct inetpeer_addr *a,
@@ -205,6 +203,20 @@ static int addr_compare(const struct ine u; \ }) +static bool atomic_add_unless_return (atomic_t *ptr,int a,int u,int *newv) +{ +int cur, old =atomic_read (ptr); + +while (old != u) { + *newv = old + a; + cur =atomic_cmpxchg (ptr, old, *newv); +if (cur == old) +return true; + old = cur; + } +return false; +} +/* * Called with rcu_read_lock() * Because we hold no lock against a writer, its quite possible we fall
@@ -213,7 +225,8 @@ static int addr_compare(const struct ine* We exit from this function if number of links exceeds PEER_MAXDEPTH */ static struct inet_peer *lookup_rcu (const struct inetpeer_addr *daddr, -struct inet_peer_base *base) +struct inet_peer_base *base, +int *newrefcnt) {struct inet_peer *u =rcu_dereference (base->root);int count =0 ;
@@ -226,7 +239,7 @@ static struct inet_peer *lookup_rcu(cons* distinction between an unused entry (refcnt=0) and * a freed one. */ -if (unlikely (!atomic_add_unless (&u->refcnt,1 ,-1 ))) +if (!atomic_add_unless_return (&u->refcnt,1 ,-1 , newrefcnt)) u =NULL ;return u; }
@@ -465,22 +478,23 @@ struct inet_peer *inet_getpeer(struct instruct inet_peer_base *base =family_to_base (daddr->family);struct inet_peer *p;unsigned int sequence; -int invalidated; +int invalidated, newrefcnt =0 ;/* Look up for the address quickly, lockless. * Because of a concurrent writer, we might not find an existing entry. */ rcu_read_lock (); sequence =read_seqbegin (&base->lock); - p =lookup_rcu (daddr, base); + p =lookup_rcu (daddr, base, &newrefcnt); invalidated =read_seqretry (&base->lock, sequence);rcu_read_unlock ();if (p) { -/* The existing node has been found. +found:/* The existing node has been found. * Remove the entry from unused list if it was there. */ -unlink_from_unused (p); +if (newrefcnt ==1 ) +unlink_from_unused (p);return p; }
@@ -494,11 +508,9 @@ struct inet_peer *inet_getpeer(struct inwrite_seqlock_bh (&base->lock); p =lookup (daddr, stack, base);if (p != peer_avl_empty) { -atomic_inc (&p->refcnt); + newrefcnt =atomic_inc_return (&p->refcnt);write_sequnlock_bh (&base->lock); -/* Remove the entry from unused list if it was there. */ -unlink_from_unused (p); -return p; + goto found; } p = create ?kmem_cache_alloc (peer_cachep,GFP_ATOMIC ) :NULL ;if (p) {
PATCH 11/107 bridge: provide a cow_metrics method for fake_ops
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alexander Holler <[email protected]>
[ Upstream commit 6407d74c5106bb362b4087693688afd34942b094 ]
Like in commit 0972ddb237 (provide cow_metrics() methods to blackhole dst_ops), we must provide a cow_metrics for bridges fake_dst_ops as well.
This fixes a regression coming from commits 62fa8a846d7d (net: Implement read-only protection and COW'ing of metrics.) and 33eb9873a28 (bridge:
initialize fake_rtable metrics)
ip link set mybridge mtu 1234
-->
[ 136.546243] Pid: 8415, comm: ip Tainted: P
2.6.39.1-00006-g40545b7 #103 ASUSTeK Computer Inc. V1Sn
/V1Sn
[ 136.546256] EIP: 0060:[<00000000>] EFLAGS: 00010202 CPU: 0
[ 136.546268] EIP is at 0x0
[ 136.546273] EAX: f14a389c EBX: 000005d4 ECX: f80d32c0 EDX: f80d1da1
[ 136.546279] ESI: f14a3000 EDI: f255bf10 EBP: f15c3b54 ESP: f15c3b48
[ 136.546285] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[ 136.546293] Process ip (pid: 8415, ti=f15c2000 task=f4741f80
task.ti=f15c2000)
[ 136.546297] Stack:
[ 136.546301] f80c658f f14a3000 ffffffed f15c3b64 c12cb9c8 f80d1b80
ffffffa1 f15c3bbc
[ 136.546315] c12da347 c12d9c7d 00000000 f7670b00 00000000 f80d1b80
ffffffa6 f15c3be4
[ 136.546329] 00000004 f14a3000 f255bf20 00000008 f15c3bbc c11d6cae
00000000 00000000
[ 136.546343] Call Trace:
[ 136.546359] [<f80c658f>] ? br_change_mtu+0x5f/0x80 [bridge]
[ 136.546372] [<c12cb9c8>] dev_set_mtu+0x38/0x80
[ 136.546381] [<c12da347>] do_setlink+0x1a7/0x860
[ 136.546390] [<c12d9c7d>] ? rtnl_fill_ifinfo+0x9bd/0xc70
[ 136.546400] [<c11d6cae>] ? nla_parse+0x6e/0xb0
[ 136.546409] [<c12db931>] rtnl_newlink+0x361/0x510
[ 136.546420] [<c1023240>] ? vmalloc_sync_all+0x100/0x100
[ 136.546429] [<c1362762>] ? error_code+0x5a/0x60
[ 136.546438] [<c12db5d0>] ? rtnl_configure_link+0x80/0x80
[ 136.546446] [<c12db27a>] rtnetlink_rcv_msg+0xfa/0x210
[ 136.546454] [<c12db180>] ? __rtnl_unlock+0x20/0x20
[ 136.546463] [<c12ee0fe>] netlink_rcv_skb+0x8e/0xb0
[ 136.546471] [<c12daf1c>] rtnetlink_rcv+0x1c/0x30
[ 136.546479] [<c12edafa>] netlink_unicast+0x23a/0x280
[ 136.546487] [<c12ede6b>] netlink_sendmsg+0x26b/0x2f0
[ 136.546497] [<c12bb828>] sock_sendmsg+0xc8/0x100
[ 136.546508] [<c10adf61>] ? __alloc_pages_nodemask+0xe1/0x750
[ 136.546517] [<c11d0602>] ? _copy_from_user+0x42/0x60
[ 136.546525] [<c12c5e4c>] ? verify_iovec+0x4c/0xc0
[ 136.546534] [<c12bd805>] sys_sendmsg+0x1c5/0x200
[ 136.546542] [<c10c2150>] ? __do_fault+0x310/0x410
[ 136.546549] [<c10c2c46>] ? do_wp_page+0x1d6/0x6b0
[ 136.546557] [<c10c47d1>] ? handle_pte_fault+0xe1/0x720
[ 136.546565] [<c12bd1af>] ? sys_getsockname+0x7f/0x90
[ 136.546574] [<c10c4ec1>] ? handle_mm_fault+0xb1/0x180
[ 136.546582] [<c1023240>] ? vmalloc_sync_all+0x100/0x100
[ 136.546589] [<c10233b3>] ? do_page_fault+0x173/0x3d0
[ 136.546596] [<c12bd87b>] ? sys_recvmsg+0x3b/0x60
[ 136.546605] [<c12bdd83>] sys_socketcall+0x293/0x2d0
[ 136.546614] [<c13629d0>] sysenter_do_call+0x12/0x26
[ 136.546619] Code: Bad EIP value.
[ 136.546627] EIP: [<00000000>] 0x0 SS:ESP 0068:f15c3b48
[ 136.546645] CR2: 0000000000000000
[ 136.546652] ---[ end trace 6909b560e78934fa ]------ net/bridge/br_netfilter.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/bridge/br_netfilter.c +6 -0
@@ -104,10 +104,16 @@ static void fake_update_pmtu(struct dst_ { } +static u32 *fake_cow_metrics (struct dst_entry *dst,unsigned long old) +{ +return NULL ; +} +static struct dst_ops fake_dst_ops = { .family =AF_INET , .protocol =cpu_to_be16 (ETH_P_IP ), .update_pmtu = fake_update_pmtu, + .cow_metrics = fake_cow_metrics, };/*
PATCH 12/107 af_packet: prevent information leak
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 13fcb7bd322164c67926ffe272846d4860196dc6 ]
In 2.6.27, commit 393e52e33c6c2 (packet: deliver VLAN TCI to userspace) added a small information leak.
Add padding field and make sure its zeroed before copy to user.
--- include/linux/if_packet.h | 2 ++ net/packet/af_packet.c | 2 ++ 2 files changed, 4 insertions(+)
include/linux/if_packet.h +2 -0
@@ -62,6 +62,7 @@ struct tpacket_auxdata {__u16 tp_mac;__u16 tp_net;__u16 tp_vlan_tci; +__u16 tp_padding; };/* Rx ring - header status */
@@ -100,6 +101,7 @@ struct tpacket2_hdr {__u32 tp_sec;__u32 tp_nsec;__u16 tp_vlan_tci; +__u16 tp_padding; };#define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll))
net/packet/af_packet.c +2 -0
@@ -799,6 +799,7 @@ static int tpacket_rcv(struct sk_buff *s h.h2->tp_sec = ts.tv_sec; h.h2->tp_nsec = ts.tv_nsec; h.h2->tp_vlan_tci =vlan_tx_tag_get (skb); + h.h2->tp_padding =0 ; hdrlen =sizeof (*h.h2);break ;default :
@@ -1727,6 +1728,7 @@ static int packet_recvmsg(struct kiocb * aux.tp_net =skb_network_offset (skb); aux.tp_vlan_tci =vlan_tx_tag_get (skb); + aux.tp_padding =0 ;put_cmsg (msg,SOL_PACKET ,PACKET_AUXDATA ,sizeof (aux), &aux); }
PATCH 13/107 inet_diag: fix inet_diag_bc_audit()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit eeb1497277d6b1a0a34ed36b97e18f2bd7d6de0d ]
A malicious user or buggy application can inject code and trigger an infinite loop in inet_diag_bc_audit()
Also make sure each instruction is aligned on 4 bytes boundary, to avoid unaligned accesses.
--- net/ipv4/inet_diag.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
net/ipv4/inet_diag.c +6 -8
@@ -437,7 +437,7 @@ static int valid_cc(const void *bc, intreturn 0 ;if (cc == len)return 1 ; -if (op->yes <4 ) +if (op->yes <4 || op->yes &3 )return 0 ; len -= op->yes; bc += op->yes;
@@ -447,11 +447,11 @@ static int valid_cc(const void *bc, intstatic int inet_diag_bc_audit (const void *bytecode,int bytecode_len) { -const unsigned char *bc = bytecode; +const void *bc = bytecode;int len = bytecode_len;while (len >0 ) { -struct inet_diag_bc_op *op = (struct inet_diag_bc_op *)bc; +const struct inet_diag_bc_op *op = bc;//printk("BC: %d %d %d {%d} / %d\n", op->code, op->yes, op->no, op[1].no, len); switch (op->code) {
@@ -462,22 +462,20 @@ static int inet_diag_bc_audit(const voidcase INET_DIAG_BC_S_LE :case INET_DIAG_BC_D_GE :case INET_DIAG_BC_D_LE : -if (op->yes <4 || op->yes > len +4 ) -return -EINVAL ;case INET_DIAG_BC_JMP : -if (op->no <4 || op->no > len +4 ) +if (op->no <4 || op->no > len +4 || op->no &3 )return -EINVAL ;if (op->no < len && !valid_cc (bytecode, bytecode_len, len - op->no))return -EINVAL ;break ;case INET_DIAG_BC_NOP : -if (op->yes <4 || op->yes > len +4 ) -return -EINVAL ;break ;default :return -EINVAL ; } +if (op->yes <4 || op->yes > len +4 || op->yes &3 ) +return -EINVAL ; bc += op->yes; len -= op->yes; }
PATCH 14/107 net/ipv4: Check for mistakenly passed in non-IPv4 address
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Marcus Meissner <[email protected]>
[ Upstream commit d0733d2e29b652b2e7b1438ececa732e4eed98eb ]
Check against mistakenly passing in IPv6 addresses (which would result in an INADDR_ANY bind) or similar incompatible sockaddrs.
--- net/ipv4/af_inet.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv4/af_inet.c +3 -0
@@ -464,6 +464,9 @@ int inet_bind(struct socket *sock, strucif (addr_len <sizeof (struct sockaddr_in )) goto out; +if (addr->sin_family !=AF_INET ) + goto out; + chk_addr_ret =inet_addr_type (sock_net (sk), addr->sin_addr.s_addr);/* Not specified by any standard per-se, however it breaks too
PATCH 15/107 ipv6/udp: Use the correct variable to determine non-blocking condition
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Xufeng Zhang <[email protected]>
[ Upstream commit 32c90254ed4a0c698caa0794ebb4de63fcc69631 ]
udpv6_recvmsg() function is not using the correct variable to determine whether or not the socket is in non-blocking operation, this will lead to unexpected behavior when a UDP checksum error occurs.
Consider a non-blocking udp receive scenario: when udpv6_recvmsg() is called by sock_common_recvmsg(), MSG_DONTWAIT bit of flags variable in udpv6_recvmsg() is cleared by "flags & ~MSG_DONTWAIT" in this call:
err = sk->sk_prot->recvmsg(iocb, sk, msg, size, flags & MSG_DONTWAIT,
flags & ~MSG_DONTWAIT, &addr_len);i.e. with udpv6_recvmsg() getting these values:
int noblock = flags & MSG_DONTWAIT
int flags = flags & ~MSG_DONTWAIT
So, when udp checksum error occurs, the execution will go to csum_copy_err, and then the problem happens:
csum_copy_err:
...............
if (flags & MSG_DONTWAIT)
return -EAGAIN;
goto try_again;
...............But it will always go to try_again as MSG_DONTWAIT has been cleared from flags at call time -- only noblock contains the original value of MSG_DONTWAIT, so the test should be:
if (noblock)
return -EAGAIN;This is also consistent with what the ipv4/udp code does.
--- net/ipv6/udp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/udp.c +1 -1
@@ -453,7 +453,7 @@ csum_copy_err: }unlock_sock_fast (sk, slow); -if (flags &MSG_DONTWAIT ) +if (noblock)return -EAGAIN ; goto try_again; }
PATCH 16/107 udp/recvmsg: Clear MSG_TRUNC flag when starting over for a new packet
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Xufeng Zhang <[email protected]>
[ Upstream commit 9cfaa8def1c795a512bc04f2aec333b03724ca2e ]
Consider this scenario: When the size of the first received udp packet is bigger than the receive buffer, MSG_TRUNC bit is set in msg->msg_flags. However, if checksum error happens and this is a blocking socket, it will goto try_again loop to receive the next packet. But if the size of the next udp packet is smaller than receive buffer, MSG_TRUNC flag should not be set, but because MSG_TRUNC bit is not cleared in msg->msg_flags before receive the next packet, MSG_TRUNC is still set, which is wrong.
Fix this problem by clearing MSG_TRUNC flag when starting over for a new packet.
--- net/ipv4/udp.c | 3 +++ net/ipv6/udp.c | 3 +++ 2 files changed, 6 insertions(+)
net/ipv4/udp.c +3 -0
@@ -1241,6 +1241,9 @@ csum_copy_err:if (noblock)return -EAGAIN ; + +/* starting over for a new packet */ + msg->msg_flags &= ~MSG_TRUNC ; goto try_again; }
net/ipv6/udp.c +3 -0
@@ -455,6 +455,9 @@ csum_copy_err:if (noblock)return -EAGAIN ; + +/* starting over for a new packet */ + msg->msg_flags &= ~MSG_TRUNC ; goto try_again; }
PATCH 17/107 ksm: fix NULL pointer dereference in scan_get_next_rmap_item()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hugh Dickins <[email protected]>
commit 2b472611a32a72f4a118c069c2d62a1a3f087afd upstream.
Andrea Righi reported a case where an exiting task can race against ksmd::scan_get_next_rmap_item (http://lkml.org/lkml/2011/6/1/742) easily triggering a NULL pointer dereference in ksmd.
ksm_scan.mm_slot == &ksm_mm_head with only one registered mm
CPU 1 (__ksm_exit) CPU 2 (scan_get_next_rmap_item)
list_empty() is false
lock slot == &ksm_mm_headlist_del(slot->mm_list)
(list now empty)
unlock
lock slot = list_entry(slot->mm_list.next) (list is empty, so slot is still ksm_mm_head) unlock slot->mm == NULL ... Oops
Close this race by revalidating that the new slot is not simply the list head again.
Andrea's test case:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#define BUFSIZE getpagesize()
int main(int argc, char **argv)
{
void *ptr;
if (posix_memalign(&ptr, getpagesize(), BUFSIZE) < 0) {
perror("posix_memalign");
exit(1);
}
if (madvise(ptr, BUFSIZE, MADV_MERGEABLE) < 0) {
perror("madvise");
exit(1);
}
*(char *)NULL = 0;
return 0;
}--- mm/ksm.c | 6 ++++++ 1 file changed, 6 insertions(+)
mm/ksm.c +6 -0
@@ -1301,6 +1301,12 @@ static struct rmap_item *scan_get_next_r slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot;spin_unlock (&ksm_mmlist_lock); +/* +* Although we tested list_empty() above, a racing __ksm_exit +* of the last mm on the list may have removed it since then. +*/ +if (slot == &ksm_mm_head) +return NULL ; next_mm: ksm_scan.address =0 ; ksm_scan.rmap_list = &slot->rmap_list;
PATCH 18/107 drivers/tty/serial/pch_uart.c: dont oops if dmi_get_system_info returns NULL
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alexander Stein <[email protected]>
commit fb139dfeef9558a12ffdbf9e26951fd1a9304f3b upstream.
If dmi_get_system_info() returns NULL, pch_uart_init_port() will dereferencea a zero pointer.
This oops was observed on an Atom based board which has no BIOS, but a bootloder which doesn't provide DMI data.
--- drivers/tty/serial/pch_uart.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tty/serial/pch_uart.c +3 -1
@@ -1392,6 +1392,7 @@ static struct eg20t_port *pch_uart_init_int fifosize, base_baud;int port_type;struct pch_uart_driver_data *board; +const char *board_name; board = &drv_dat[id->driver_data]; port_type = board->port_type;
@@ -1407,7 +1408,8 @@ static struct eg20t_port *pch_uart_init_ base_baud =1843200 ;/* 1.8432MHz */ /* quirk for CM-iTC board */ -if (strstr (dmi_get_system_info (DMI_BOARD_NAME ),"CM-iTC" )) + board_name =dmi_get_system_info (DMI_BOARD_NAME ); +if (board_name &&strstr (board_name,"CM-iTC" )) base_baud =192000000 ;/* 192.0MHz */ switch (port_type) {
PATCH 19/107 migrate: dont account swapcache as shmem
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 99a15e21d96f6857dafab1e5167e5e8183215c9c upstream.
swapcache will reach the below code path in migrate_page_move_mapping, and swapcache is accounted as NR_FILE_PAGES but it's not accounted as NR_SHMEM.
Hugh pointed out we must use PageSwapCache instead of comparing mapping to &swapper_space, to avoid build failure with CONFIG_SWAP=n.
--- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/migrate.c +1 -1
@@ -288,7 +288,7 @@ static int migrate_page_move_mapping(str*/ __dec_zone_page_state (page,NR_FILE_PAGES );__inc_zone_page_state (newpage,NR_FILE_PAGES ); -if (PageSwapBacked (page)) { +if (!PageSwapCache (page) &&PageSwapBacked (page)) {__dec_zone_page_state (page,NR_SHMEM );__inc_zone_page_state (newpage,NR_SHMEM ); }
PATCH 20/107 hwmon: (ibmaem) Initialize sysfs attributes
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Guenter Roeck <[email protected]>
commit 3cdb2052a6e365ad56202874e6a8a05a2bb336fc upstream.
Initialize dynamically allocated sysfs attributes before device_create_file() call to suppress lockdep_init_map() warning if lockdep debugging is enabled.
--- drivers/hwmon/ibmaem.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hwmon/ibmaem.c +2 -0
@@ -947,6 +947,7 @@ static int aem_register_sensors(struct a/* Set up read-only sensors */ while (ro->label) { +sysfs_attr_init (&sensors->dev_attr.attr); sensors->dev_attr.attr.name = ro->label; sensors->dev_attr.attr.mode =S_IRUGO ; sensors->dev_attr.show = ro->show;
@@ -963,6 +964,7 @@ static int aem_register_sensors(struct a/* Set up read-write sensors */ while (rw->label) { +sysfs_attr_init (&sensors->dev_attr.attr); sensors->dev_attr.attr.name = rw->label; sensors->dev_attr.attr.mode =S_IRUGO |S_IWUSR ; sensors->dev_attr.show = rw->show;
PATCH 21/107 hwmon: (s3c) Initialize sysfs attributes
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Guenter Roeck <[email protected]>
commit b1e698db0939b04602ded2a2196ff69c92b49378 upstream.
Initialize dynamically allocated sysfs attributes before device_create_file() call to suppress lockdep_init_map() warning if lockdep debugging is enabled.
--- drivers/hwmon/s3c-hwmon.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hwmon/s3c-hwmon.c +2 -0
@@ -232,6 +232,7 @@ static int s3c_hwmon_create_attr(struct attr = &attrs->in; attr->index = channel; +sysfs_attr_init (&attr->dev_attr.attr); attr->dev_attr.attr.name = attrs->in_name; attr->dev_attr.attr.mode =S_IRUGO ; attr->dev_attr.show = s3c_hwmon_ch_show;
@@ -249,6 +250,7 @@ static int s3c_hwmon_create_attr(struct attr = &attrs->label; attr->index = channel; +sysfs_attr_init (&attr->dev_attr.attr); attr->dev_attr.attr.name = attrs->label_name; attr->dev_attr.attr.mode =S_IRUGO ; attr->dev_attr.show = s3c_hwmon_label_show;
PATCH 22/107 hwmon: (ibmpex) Initialize sysfs attributes
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Guenter Roeck <[email protected]>
commit fb794e0f7153918c33f2300986d995524ab711cf upstream.
Initialize dynamically allocated sysfs attributes before device_create_file() call to suppress lockdep_init_map() warning if lockdep debugging is enabled.
--- drivers/hwmon/ibmpex.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/ibmpex.c +1 -0
@@ -358,6 +358,7 @@ static int create_sensor(struct ibmpex_belse if (type ==POWER_SENSOR )sprintf (n, power_sensor_name_templates[func],"power" , counter); +sysfs_attr_init (&data->sensors[sensor].attr[func].dev_attr.attr); data->sensors[sensor].attr[func].dev_attr.attr.name = n; data->sensors[sensor].attr[func].dev_attr.attr.mode =S_IRUGO ; data->sensors[sensor].attr[func].dev_attr.show = ibmpex_show_sensor;
PATCH 23/107 Revert "drm/i915: Enable GMBUS for post-gen2 chipsets"
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jean Delvare <[email protected]>
commit 826c7e4147f902737b281e8a5a7d7aa33fd63316 upstream.
Revert commit 8f9a3f9b63b8cd3f03be9dc53533f90bd4120e5f. This fixes a hang when loading the eeprom driver (see bug #35572.) GMBUS will be re-enabled later, differently.
--- drivers/gpu/drm/i915/intel_i2c.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_i2c.c +1 -2
@@ -401,8 +401,7 @@ int intel_setup_gmbus(struct drm_device bus->reg0 = i |GMBUS_RATE_100KHZ ;/* XXX force bit banging until GMBUS is fully debugged */ -if (IS_GEN2 (dev)) - bus->force_bit =intel_gpio_create (dev_priv, i); + bus->force_bit =intel_gpio_create (dev_priv, i); }intel_i2c_reset (dev_priv->dev);
PATCH 24/107 drm/radeon/kms/atom: fix duallink on some early DCE3.2 cards
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit 8323fa6ba313ae2664420ec34d56a7fb0bbbe525 upstream.
Certain revisions of the vbios on DCE3.2 cards have a bug in the transmitter control table which prevents duallink from being enabled properly on some cards. The action switch statement jumps to the wrong offset for the OUTPUT_ENABLE action. The fix is to use the ENABLE action rather than the OUTPUT_ENABLE action on the affected cards. In fixed version of the vbios, both actions jump to the same offset, so the change should be safe.
--- drivers/gpu/drm/radeon/radeon_encoders.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_encoders.c +5 -1
@@ -1294,7 +1294,11 @@ radeon_atom_encoder_dpms(struct drm_encoif (is_dig) {switch (mode) {case DRM_MODE_DPMS_ON : -atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT ,0 ,0 ); +/* some early dce3.2 boards have a bug in their transmitter control table */ +if ((rdev->family ==CHIP_RV710 ) || (rdev->family ==CHIP_RV730 )) +atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE ,0 ,0 ); +else +atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT ,0 ,0 );if (atombios_get_encoder_mode (encoder) ==ATOM_ENCODER_MODE_DP ) {struct drm_connector *connector =radeon_get_connector_for_encoder (encoder);
PATCH 25/107 drm/radeon/kms: Fix chremap setup on RV770 CE
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit daf54f1f363a61c618662ef66d4bf09d2b090941 upstream.
CE variant requires a different chremap setup.
Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=35472
--- drivers/gpu/drm/radeon/rv770.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/radeon/rv770.c +6 -0
@@ -572,6 +572,12 @@ static void rv770_program_channel_remap(else tcp_chan_steer =0x00fac688 ; +/* RV770 CE has special chremap setup */ +if (rdev->pdev->device ==0x944e ) { + tcp_chan_steer =0x00b08b08 ; + mc_shared_chremap =0x00b08b08 ; + } +WREG32 (TCP_CHAN_STEER , tcp_chan_steer);WREG32 (MC_SHARED_CHREMAP , mc_shared_chremap); }
PATCH 26/107 drm/i915: Fix gen6 (SNB) missed BLT ring interrupts.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Daniel J Blueman <[email protected]>
commit 498e720b96379d8ee9c294950a01534a73defcf3 upstream.
The failure appeared in dmesg as:
[drm:i915_hangcheck_ring_idle] *ERROR* Hangcheck timer elapsed... blt ring idle [waiting on 35064155, at 35064155], missed IRQ?
This works around that problem on by making the blitter command streamer write interrupt state to the Hardware Status Page when a MI_USER_INTERRUPT command is decoded, which appears to force the seqno out to memory before the interrupt happens.
v1->v2: Moved to prior interrupt handler installation and RMW flags as per feedback.v2->v3: Removed RMW of flags (by anholt)
(incidence of the bug with a testcase went from avg 2/1000 to 0/12651 in the latest test run (plus more for v1))
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33394
--- drivers/gpu/drm/i915/i915_irq.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/i915_irq.c +10 -0
@@ -1567,6 +1567,16 @@ static void ironlake_irq_preinstall(strudrm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;I915_WRITE (HWSTAM ,0xeffe ); +if (IS_GEN6 (dev)) { +/* Workaround stalls observed on Sandy Bridge GPUs by +* making the blitter command streamer generate a +* write to the Hardware Status Page for +* MI_USER_INTERRUPT. This appears to serialize the +* previous seqno write out before the interrupt +* happens. +*/ +I915_WRITE (GEN6_BLITTER_HWSTAM , ~GEN6_BLITTER_USER_INTERRUPT ); + }/* XXX hotplug from PCH */
Re: [026/107] drm/i915: Fix gen6 (SNB) missed BLT ring interrupts.
Quoted 2 lines · Greg KH
2.6.39-stable review patch. If anyone has any objections, please let us know.
Note that there's a follow-on patch to this which fixes similar hangs with the BSD ring:
ec6a890dfed7dd245beba5e5bcdfcffbd934c284
drm/i915: Apply HWSTAM workaround for BSD ring on SandyBridge
...we need to apply exactly the same workaround for missing interrupts from BSD as for the BLT ring, apparently.
See also commit 498e720b96379d8ee9c294950a01534a73defcf3 (drm/i915: Fix gen6 (SNB) missed BLT ring interrupts).
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38529
Signature · 1 line
[email protected]
Re: [026/107] drm/i915: Fix gen6 (SNB) missed BLT ring interrupts.
Quoted 15 lines · Keith Packard
Quoted 2 lines · Greg KH
2.6.39-stable review patch. If anyone has any objections, please let us know.
Note that there's a follow-on patch to this which fixes similar hangs with the BSD ring:
ec6a890dfed7dd245beba5e5bcdfcffbd934c284drm/i915: Apply HWSTAM workaround for BSD ring on SandyBridge
...we need to apply exactly the same workaround for missing interrupts from BSD as for the BLT ring, apparently.
Quoted 7 lines
See also commit
498e720b96379d8ee9c294950a01534a73defcf3(drm/i915: Fix gen6 (SNB) missed BLT ring interrupts).Reported-and-tested-by [email protected]Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38529
Signed-off-by Chris Wilson <[email protected]>Signed-off-by Keith Packard <[email protected]>
Thanks, I've queued that one up now as well.
greg k-h
PATCH 27/107 drm: populate irq_by_busid-member for pci
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Wolfram Sang <[email protected]>
commit 45e97ab65026a3391cb2c938f834ca5db4d2e5b3 upstream.
Commit 8410ea (drm: rework PCI/platform driver interface) implemented drm_pci_irq_by_busid() but forgot to make it available in the drm_pci_bus-struct.
This caused a freeze on my Radeon9600-equipped laptop when executing glxgears. Thanks to Michel for noticing the flaw.
[airlied: made function static also]
--- drivers/gpu/drm/drm_pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_pci.c +2 -1
@@ -251,7 +251,7 @@ err: } -int drm_pci_irq_by_busid (struct drm_device *dev,struct drm_irq_busid *p) +static int drm_pci_irq_by_busid (struct drm_device *dev,struct drm_irq_busid *p) { if ((p->busnum >> 8) != drm_get_pci_domain(dev) || (p->busnum & 0xff) != dev->pdev->bus->number ||
@@ -292,6 +292,7 @@ static struct drm_bus drm_pci_bus = { .get_name = drm_pci_get_name, .set_busid = drm_pci_set_busid, .set_unique = drm_pci_set_unique, + .irq_by_busid = drm_pci_irq_by_busid, .agp_init = drm_pci_agp_init, };
PATCH 28/107 xen: support CONFIG_MAXSMP
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andrew Jones <[email protected]>
commit 900cba8881b39dfbc7c8062098504ab93f5387a8 upstream.
The MAXSMP config option requires CPUMASK_OFFSTACK, which in turn requires we init the memory for the maps while we bring up the cpus. MAXSMP also increases NR_CPUS to 4096. This increase in size exposed an issue in the argument construction for multicalls from xen_flush_tlb_others. The args should only need space for the actual number of cpus.
Also in 2.6.39 it exposes a bootup problem.
BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<ffffffff8157a1d3>] set_cpu_sibling_map+0x123/0x30d ... Call Trace: [<ffffffff81039a3f>] ? xen_restore_fl_direct_reloc+0x4/0x4 [<ffffffff819dc4db>] xen_smp_prepare_cpus+0x36/0x135
..
--- arch/x86/xen/mmu.c | 3 ++- arch/x86/xen/smp.c | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
arch/x86/xen/mmu.c +2 -1
@@ -59,6 +59,7 @@#include <asm/page.h> #include <asm/init.h> #include <asm/pat.h> +#include <asm/smp.h> #include <asm/xen/hypercall.h> #include <asm/xen/hypervisor.h>
@@ -1353,7 +1354,7 @@ static void xen_flush_tlb_others(const s {struct {struct mmuext_op op; - DECLARE_BITMAP(mask, NR_CPUS); + DECLARE_BITMAP(mask, num_processors); } *args;struct multicall_space mcs;
arch/x86/xen/smp.c +7 -0
@@ -206,11 +206,18 @@ static void __init xen_smp_prepare_boot_static void __init xen_smp_prepare_cpus (unsigned int max_cpus) {unsigned cpu; +unsigned int i;xen_init_lock_cpu (0 );smp_store_cpu_info (0 );cpu_data (0 ).x86_max_cores =1 ; + +for_each_possible_cpu (i) { +zalloc_cpumask_var (&per_cpu (cpu_sibling_map, i),GFP_KERNEL ); +zalloc_cpumask_var (&per_cpu (cpu_core_map, i),GFP_KERNEL ); +zalloc_cpumask_var (&per_cpu (cpu_llc_shared_map, i),GFP_KERNEL ); + }set_cpu_sibling_map (0 );if (xen_smp_intr_init (0 ))
PATCH 29/107 xen: partially revert "xen: set max_pfn_mapped to the last pfn mapped"
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Stefano Stabellini <[email protected]>
commit a91d92875ee94e4703fd017ccaadb48cfb344994 upstream.
We only need to set max_pfn_mapped to the last pfn mapped on x86_64 to make sure that cleanup_highmap doesn't remove important mappings at _end.
We don't need to do this on x86_32 because cleanup_highmap is not called on x86_32. Besides lowering max_pfn_mapped on x86_32 has the unwanted side effect of limiting the amount of memory available for the 1:1 kernel pagetable allocation.
This patch reverts the x86_32 part of the original patch.
--- arch/x86/xen/mmu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/x86/xen/mmu.c +8 -1
@@ -1722,6 +1722,11 @@ static __init void xen_map_identity_earlfor (pteidx =0 ; pteidx <PTRS_PER_PTE ; pteidx++, pfn++) {pte_t pte; +#ifdef CONFIG_X86_32 +if (pfn > max_pfn_mapped) + max_pfn_mapped = pfn; +#endif +if (!pte_none (pte_page[pteidx]))continue ;
@@ -1889,7 +1894,9 @@ __init pgd_t *xen_setup_kernel_pagetable initial_kernel_pmd =extend_brk (sizeof (pmd_t) *PTRS_PER_PMD ,PAGE_SIZE ); - max_pfn_mapped =PFN_DOWN (__pa (xen_start_info->mfn_list)); + max_pfn_mapped =PFN_DOWN (__pa (xen_start_info->pt_base) + + xen_start_info->nr_pt_frames *PAGE_SIZE + +512 *1024 ); kernel_pmd =m2v (pgd[KERNEL_PGD_BOUNDARY ].pgd);memcpy (initial_kernel_pmd, kernel_pmd,sizeof (pmd_t) *PTRS_PER_PMD );
PATCH 30/107 xen/pci: Use the INT_SRC_OVR IRQ (instead of GSI) to preset the ACPI SCI IRQ.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Konrad Rzeszutek Wilk <[email protected]>
commit 155a16f21923bc2f04161ac92acca986371ef27b upstream.
In the past we would use the GSI value to preset the ACPI SCI IRQ which worked great as GSI == IRQ:
ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 low level)
While that is most often seen, there are some oddities:
ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 20 low level)
which means that GSI 20 (or pin 20) is to be overriden for IRQ 9. Our code that presets the interrupt for ACPI SCI however would use the GSI 20 instead of IRQ 9 ending up with:
xen: sci override: global_irq=20 trigger=0 polarity=1
xen: registering gsi 20 triggering 0 polarity 1
xen: --> pirq=20 -> irq=20
xen: acpi sci 20
.. snip..
calling acpi_init+0x0/0xbc @ 1
ACPI: SCI (IRQ9) allocation failed
ACPI Exception: AE_NOT_ACQUIRED, Unable to install System Control Interrupt handler (20110413/evevent-119)
ACPI: Unable to start the ACPI Interpreter
as the ACPI interpreter made a call to 'acpi_gsi_to_irq' which got nine. It used that value to request an IRQ (request_irq) and since that was not present it failed.
The fix is to recognize that for interrupts that are overriden (in our case we only care about the ACPI SCI) we should use the IRQ number to present the IRQ instead of the using GSI. End result is that we get:
xen: sci override: global_irq=20 trigger=0 polarity=1
xen: registering gsi 20 triggering 0 polarity 1
xen: --> pirq=20 -> irq=9 (gsi=9)
xen: acpi sci 9
which fixes the ACPI interpreter failing on startup.
--- arch/x86/pci/xen.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
arch/x86/pci/xen.c +24 -2
@@ -322,6 +322,7 @@ static int xen_register_pirq(u32 gsi, instruct physdev_map_pirq map_irq;int shareable =0 ;char *name; +bool gsi_override = false;if (!xen_pv_domain ())return -1 ;
@@ -338,11 +339,32 @@ static int xen_register_pirq(u32 gsi, inif (pirq <0 ) goto out; - irq =xen_bind_pirq_gsi_to_irq (gsi, pirq, shareable, name); +/* Before we bind the GSI to a Linux IRQ, check whether +* we need to override it with bus_irq (IRQ) value. Usually for +* IRQs below IRQ_LEGACY_IRQ this holds IRQ == GSI, as so: +* ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 low level) +* but there are oddballs where the IRQ != GSI: +* ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 20 low level) +* which ends up being: gsi_to_irq[9] == 20 +* (which is what acpi_gsi_to_irq ends up calling when starting the +* the ACPI interpreter and keels over since IRQ 9 has not been +* setup as we had setup IRQ 20 for it). +*/ +if (gsi == acpi_sci_override_gsi) { +/* Check whether the GSI != IRQ */ +acpi_gsi_to_irq (gsi, &irq); +if (irq != gsi) +/* Bugger, we MUST have that IRQ. */ + gsi_override = true; + } +if (gsi_override) + irq =xen_bind_pirq_gsi_to_irq (irq, pirq, shareable, name); +else + irq =xen_bind_pirq_gsi_to_irq (gsi, pirq, shareable, name);if (irq <0 ) goto out; -printk (KERN_DEBUG "xen: --> pirq=%d -> irq=%d\n" , pirq, irq); +printk (KERN_DEBUG "xen: --> pirq=%d -> irq=%d (gsi=%d)\n" , pirq, irq, gsi); map_irq.domid =DOMID_SELF ; map_irq.type =MAP_PIRQ_TYPE_GSI ;
PATCH 31/107 xen/mmu: Fix for linker errors when CONFIG_SMP is not defined.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Konrad Rzeszutek Wilk <[email protected]>
commit 32dd11942aeb47f91209a446d6b10063c5b69389 upstream.
Simple enough - we use an extern defined symbol which is not defined when CONFIG_SMP is not defined. This fixes the linker dying.
--- arch/x86/xen/mmu.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/xen/mmu.c +4 -0
@@ -1354,7 +1354,11 @@ static void xen_flush_tlb_others(const s {struct {struct mmuext_op op; +#ifdef CONFIG_SMP DECLARE_BITMAP(mask, num_processors); +#else + DECLARE_BITMAP(mask, NR_CPUS); +#endif } *args;struct multicall_space mcs;
PATCH 32/107 xen/pci: Move check for acpi_sci_override_gsi to xen_setup_acpi_sci.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Konrad Rzeszutek Wilk <[email protected]>
commit ee339fe63ac408e4604c1c88b1f9a428f2511b70 upstream.
Previously we would check for acpi_sci_override_gsi == gsi every time a PCI device was enabled. That works during early bootup, but later on it could lead to triggering unnecessarily the acpi_gsi_to_irq(..) lookup. The reason is that acpi_sci_override_gsi was declared in __initdata and after early bootup could contain bogus values.
This patch moves the check for acpi_sci_override_gsi to the site where the ACPI SCI is preset.
--- arch/x86/pci/xen.c | 56 ++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 28 deletions(-)
arch/x86/pci/xen.c +28 -28
@@ -316,13 +316,12 @@ int __init pci_xen_hvm_init(void) }#ifdef CONFIG_XEN_DOM0 -static int xen_register_pirq (u32 gsi,int triggering) +static int xen_register_pirq (u32 gsi,int gsi_override,int triggering) {int rc, pirq, irq =-1 ;struct physdev_map_pirq map_irq;int shareable =0 ;char *name; -bool gsi_override = false;if (!xen_pv_domain ())return -1 ;
@@ -334,31 +333,12 @@ static int xen_register_pirq(u32 gsi, in shareable =1 ; name ="ioapic-level" ; } - pirq =xen_allocate_pirq_gsi (gsi);if (pirq <0 ) goto out; -/* Before we bind the GSI to a Linux IRQ, check whether -* we need to override it with bus_irq (IRQ) value. Usually for -* IRQs below IRQ_LEGACY_IRQ this holds IRQ == GSI, as so: -* ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 low level) -* but there are oddballs where the IRQ != GSI: -* ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 20 low level) -* which ends up being: gsi_to_irq[9] == 20 -* (which is what acpi_gsi_to_irq ends up calling when starting the -* the ACPI interpreter and keels over since IRQ 9 has not been -* setup as we had setup IRQ 20 for it). -*/ -if (gsi == acpi_sci_override_gsi) { -/* Check whether the GSI != IRQ */ -acpi_gsi_to_irq (gsi, &irq); -if (irq != gsi) -/* Bugger, we MUST have that IRQ. */ - gsi_override = true; - } -if (gsi_override) - irq =xen_bind_pirq_gsi_to_irq (irq, pirq, shareable, name); +if (gsi_override >=0 ) + irq =xen_bind_pirq_gsi_to_irq (gsi_override, pirq, shareable, name);else irq =xen_bind_pirq_gsi_to_irq (gsi, pirq, shareable, name);if (irq <0 )
@@ -381,7 +361,7 @@ out:return irq; } -static int xen_register_gsi (u32 gsi,int triggering,int polarity) +static int xen_register_gsi (u32 gsi,int gsi_override,int triggering,int polarity) {int rc, irq;struct physdev_setup_gsi setup_gsi;
@@ -392,7 +372,7 @@ static int xen_register_gsi(u32 gsi, intprintk (KERN_DEBUG "xen: registering gsi %u triggering %d polarity %d\n" , gsi, triggering, polarity); - irq =xen_register_pirq (gsi, triggering); + irq =xen_register_pirq (gsi, gsi_override, triggering); setup_gsi.gsi = gsi; setup_gsi.triggering = (triggering ==ACPI_EDGE_SENSITIVE ?0 :1 );
@@ -414,6 +394,8 @@ static __init void xen_setup_acpi_sci(voint rc;int trigger, polarity;int gsi = acpi_sci_override_gsi; +int irq =-1 ; +int gsi_override =-1 ;if (!gsi)return ;
@@ -430,7 +412,25 @@ static __init void xen_setup_acpi_sci(voprintk (KERN_INFO "xen: sci override: global_irq=%d trigger=%d " "polarity=%d\n" , gsi, trigger, polarity); - gsi =xen_register_gsi (gsi, trigger, polarity); +/* Before we bind the GSI to a Linux IRQ, check whether +* we need to override it with bus_irq (IRQ) value. Usually for +* IRQs below IRQ_LEGACY_IRQ this holds IRQ == GSI, as so: +* ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 low level) +* but there are oddballs where the IRQ != GSI: +* ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 20 low level) +* which ends up being: gsi_to_irq[9] == 20 +* (which is what acpi_gsi_to_irq ends up calling when starting the +* the ACPI interpreter and keels over since IRQ 9 has not been +* setup as we had setup IRQ 20 for it). +*/ +/* Check whether the GSI != IRQ */ +if (acpi_gsi_to_irq (gsi, &irq) ==0 ) { +if (irq >=0 && irq != gsi) +/* Bugger, we MUST have that IRQ. */ + gsi_override = irq; + } + + gsi =xen_register_gsi (gsi, gsi_override, trigger, polarity);printk (KERN_INFO "xen: acpi sci %d\n" , gsi);return ;
@@ -439,7 +439,7 @@ static __init void xen_setup_acpi_sci(vostatic int acpi_register_gsi_xen (struct device *dev,u32 gsi,int trigger,int polarity) { -return xen_register_gsi (gsi, trigger, polarity); +return xen_register_gsi (gsi,-1 /* no GSI override */ , trigger, polarity); }static int __init pci_xen_initial_domain (void )
@@ -478,7 +478,7 @@ void __init xen_setup_pirqs(void)if (acpi_get_override_irq (irq, &trigger, &polarity) ==-1 )continue ; -xen_register_pirq (irq, +xen_register_pirq (irq,-1 /* no GSI override */ , trigger ?ACPI_LEVEL_SENSITIVE :ACPI_EDGE_SENSITIVE ); } }
PATCH 33/107 clocksource: Make watchdog robust vs. interruption
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Thomas Gleixner <[email protected]>
commit b5199515c25cca622495eb9c6a8a1d275e775088 upstream.
The clocksource watchdog code is interruptible and it has been observed that this can trigger false positives which disable the TSC.
The reason is that an interrupt storm or a long running interrupt handler between the read of the watchdog source and the read of the TSC brings the two far enough apart that the delta is larger than the unstable treshold. Move both reads into a short interrupt disabled region to avoid that.
--- include/linux/clocksource.h | 1 + kernel/time/clocksource.c | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-)
include/linux/clocksource.h +1 -0
@@ -192,6 +192,7 @@ struct clocksource {#ifdef CONFIG_CLOCKSOURCE_WATCHDOG /* Watchdog related data, used by the framework */ struct list_head wd_list; +cycle_t cs_last;cycle_t wd_last;#endif };
kernel/time/clocksource.c +13 -11
@@ -185,7 +185,6 @@ static struct clocksource *watchdog;static struct timer_list watchdog_timer; static DECLARE_WORK(watchdog_work, clocksource_watchdog_work);static DEFINE_SPINLOCK (watchdog_lock); -static cycle_t watchdog_last;static int watchdog_running;static int clocksource_watchdog_kthread (void *data);
@@ -254,11 +253,6 @@ static void clocksource_watchdog(unsigneif (!watchdog_running) goto out; - wdnow = watchdog->read (watchdog); - wd_nsec =clocksource_cyc2ns ((wdnow - watchdog_last) & watchdog->mask, - watchdog->mult, watchdog->shift); - watchdog_last = wdnow; -list_for_each_entry (cs, &watchdog_list, wd_list) {/* Clocksource already marked unstable? */
@@ -268,19 +262,28 @@ static void clocksource_watchdog(unsignecontinue ; } +local_irq_disable (); csnow = cs->read (cs); + wdnow = watchdog->read (watchdog); +local_irq_enable ();/* Clocksource initialized ? */ if (!(cs->flags &CLOCK_SOURCE_WATCHDOG )) { cs->flags |=CLOCK_SOURCE_WATCHDOG ; - cs->wd_last = csnow; + cs->wd_last = wdnow; + cs->cs_last = csnow;continue ; } -/* Check the deviation from the watchdog clocksource. */ - cs_nsec =clocksource_cyc2ns ((csnow - cs->wd_last) & + wd_nsec =clocksource_cyc2ns ((wdnow - cs->wd_last) & watchdog->mask, + watchdog->mult, watchdog->shift); + + cs_nsec =clocksource_cyc2ns ((csnow - cs->cs_last) & cs->mask, cs->mult, cs->shift); - cs->wd_last = csnow; + cs->cs_last = csnow; + cs->wd_last = wdnow; + +/* Check the deviation from the watchdog clocksource. */ if (abs (cs_nsec - wd_nsec) >WATCHDOG_THRESHOLD ) {clocksource_unstable (cs, cs_nsec - wd_nsec);continue ;
@@ -318,7 +321,6 @@ static inline void clocksource_start_watreturn ;init_timer (&watchdog_timer); watchdog_timer.function = clocksource_watchdog; - watchdog_last = watchdog->read (watchdog); watchdog_timer.expires = jiffies +WATCHDOG_INTERVAL ;add_timer_on (&watchdog_timer,cpumask_first (cpu_online_mask)); watchdog_running =1 ;
PATCH 34/107 ARM: SAMSUNG: serial: Fix on handling of one clock source for UART
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Boojin Kim <[email protected]>
commit 470f22975448a65a1084a6f0721fa5df15323f02 upstream.
This patch fixes the way of comparison for handling of two or more clock sources for UART.
For example, if just only one clock source is defined even though there are two clock sources for UART, the serial driver does not set proper clock up. Of course, it is problem.
So this patch changes the condition of comparison to avoid useless setup clock and adds a flag 'NO_NEED_CHECK_CLKSRC' which means selection of source clock is not required.
In addition, since the Exynos4210 has only one clock source for UART this patch adds the flag into its common_init_uarts().
--- arch/arm/mach-exynos4/init.c | 1 + arch/arm/plat-samsung/include/plat/regs-serial.h | 2 ++ drivers/tty/serial/s5pv210.c | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-exynos4/init.c +1 -0
@@ -35,6 +35,7 @@ void __init exynos4_common_init_uarts(st tcfg->clocks = exynos4_serial_clocks; tcfg->clocks_size =ARRAY_SIZE (exynos4_serial_clocks); } + tcfg->flags |=NO_NEED_CHECK_CLKSRC ; }s3c24xx_init_uartdevs ("s5pv210-uart" , s5p_uart_resources, cfg, no);
arch/arm/plat-samsung/include/plat/regs-serial.h +2 -0
@@ -224,6 +224,8 @@#define S5PV210_UFSTAT_RXMASK (255<<0)#define S5PV210_UFSTAT_RXSHIFT (0) +#define NO_NEED_CHECK_CLKSRC 1 +#ifndef __ASSEMBLY__/* struct s3c24xx_uart_clksrc
drivers/tty/serial/s5pv210.c +2 -2
@@ -31,7 +31,7 @@ static int s5pv210_serial_setsource(strustruct s3c2410_uartcfg *cfg = port->dev->platform_data;unsigned long ucon =rd_regl (port,S3C2410_UCON ); -if ((cfg->clocks_size) ==1 ) +if (cfg->flags &NO_NEED_CHECK_CLKSRC )return 0 ;if (strcmp (clk->name,"pclk" ) ==0 )
@@ -56,7 +56,7 @@ static int s5pv210_serial_getsource(stru clk->divisor =1 ; -if ((cfg->clocks_size) ==1 ) +if (cfg->flags &NO_NEED_CHECK_CLKSRC )return 0 ;switch (ucon &S5PV210_UCON_CLKMASK ) {
PATCH 35/107 TTY: ldisc, do not close until there are readers
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jiri Slaby <[email protected]>
commit 92f6fa09bd453ffe3351fa1f1377a1b7cfa911e6 upstream.
We restored tty_ldisc_wait_idle in 100eeae2c5c (TTY: restore tty_ldisc_wait_idle). We used it in the ldisc changing path to fix the case where there are tasks in n_tty_read waiting for data and somebody tries to change ldisc.
Similar to the case above, there may be also tasks waiting in n_tty_read while hangup is performed. As 65b770468e98 (tty-ldisc: turn ldisc user count into a proper refcount) removed the wait-until-idle from all paths, hangup path won't wait for them to disappear either now. So add it back even to the hangup path.
There is a difference, we need uninterruptible sleep as there is obviously HUP signal pending. So tty_ldisc_wait_idle now sleeps without possibility to be interrupted. This is what original tty_ldisc_wait_idle did. After the wait idle reintroduction (100eeae2c5c), we have had interruptible sleeps for the ldisc changing path. But as there is a 5s timeout anyway, we don't allow it to be interrupted from now on. It's not worth the added complexity of deciding what kind of sleep we want.
Before 65b770468e98 tty_ldisc_release was called also from tty_ldisc_release. It is called from tty_release, so I don't think we need to restore that one.
This is nicely reproducible after constifying the timing when drivers/tty/n_tty.c is patched as follows ("TTY: ntty, add one more sanity check" patch is needed to actually see it explode):
%% -1548,6 +1549,7 @@ static int n_tty_open(struct tty_struct *tty)
/* These are ugly. Currently a malloc failure here can panic */
if (!tty->read_buf) {
+ msleep(100);
tty->read_buf = kzalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
if (!tty->read_buf)
return -ENOMEM;
%% -1785,6 +1788,7 @@ do_it_again:
break;
}
timeout = schedule_timeout(timeout);
+ msleep(20);
continue;
}
__set_current_state(TASK_RUNNING);
===== With a process: =====
while (1) {
int fd = open(argv[1], O_RDWR);
read(fd, buf, sizeof(buf));
close(fd);
}
===== and its child: =====
setsid();
while (1) {
int fd = open(tty, O_RDWR|O_NOCTTY);
ioctl(fd, TIOCSCTTY, 1);
vhangup();
close(fd);
usleep(100 * (10 + random() % 1000));
}===== EOF =====
References: https://bugzilla.novell.com/show_bug.cgi?id=693374
References: https://bugzilla.novell.com/show_bug.cgi?id=694509
--- drivers/tty/tty_ldisc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tty/tty_ldisc.c +3 -1
@@ -555,7 +555,7 @@ static void tty_ldisc_flush_works(structstatic int tty_ldisc_wait_idle (struct tty_struct *tty) {int ret; - ret =wait_event_interruptible_timeout (tty_ldisc_idle, + ret =wait_event_timeout (tty_ldisc_idle,atomic_read (&tty->ldisc->users) ==1 ,5 *HZ );if (ret <0 )return ret;
@@ -763,6 +763,8 @@ static int tty_ldisc_reinit(struct tty_sif (IS_ERR (ld))return -1 ; +WARN_ON_ONCE (tty_ldisc_wait_idle (tty)); +tty_ldisc_close (tty, tty->ldisc);tty_ldisc_put (tty->ldisc); tty->ldisc =NULL ;
PATCH 36/107 Connector: Set the CN_NETLINK_USERS correctly
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: "K. Y. Srinivasan" <[email protected]>
commit ea2c00095c022846dd8dfd211de05154d3e4e1b8 upstream.
The CN_NETLINK_USERS must be set to the highest valid index +1. Thanks to Evgeniy for pointing this out.
--- include/linux/connector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/connector.h +1 -1
@@ -44,7 +44,7 @@#define CN_VAL_DRBD 0x1#define CN_KVP_IDX 0x9/* HyperV KVP */ -#define CN_NETLINK_USERS 9 +#define CN_NETLINK_USERS 10/* Highest index + 1 */ /* * Maximum connector's message size.
PATCH 37/107 Connector: Correctly set the error code in case of success when dispatching receive callbacks
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: "K. Y. Srinivasan" <[email protected]>
commit 663dd6dcaf7e95526e469e91f41972a9c0cca30c upstream.
The recent changes to the connector code introduced this bug where even when a callback was invoked, we would return an error resulting in double freeing of the skb. This patch fixes this bug.
--- drivers/connector/connector.c | 1 + 1 file changed, 1 insertion(+)
drivers/connector/connector.c +1 -0
@@ -139,6 +139,7 @@ static int cn_call_callback(struct sk_buspin_unlock_bh (&dev->cbdev->queue_lock);if (cbq !=NULL ) { + err =0 ; cbq->callback (msg, nsp);kfree_skb (skb);cn_queue_release_callback (cbq);
PATCH 38/107 xhci: Reject double add of active endpoints.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sarah Sharp <[email protected]>
commit fa75ac379e63c2864e9049b5e8615e40f65c1e70 upstream.
While trying to switch a UAS device from the BOT configuration to the UAS configuration via the bConfigurationValue file, Tanya ran into an issue in the USB core. usb_disable_device() sets entries in udev->ep_out and udev->ep_out to NULL, but doesn't call into the xHCI bandwidth management functions to remove the BOT configuration endpoints from the xHCI host's internal structures.
The USB core would then attempt to add endpoints for the UAS configuration, and some of the endpoints had the same address as endpoints in the BOT configuration. The xHCI driver blindly added the endpoints again, but the xHCI host controller rejected the Configure Endpoint command because active endpoints were added without being dropped.
Make the xHCI driver reject calls to xhci_add_endpoint() that attempt to add active endpoints without first calling xhci_drop_endpoint().
This should be backported to kernels as old as 2.6.31.
--- drivers/usb/host/xhci.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/usb/host/xhci.c +18 -4
@@ -1396,6 +1396,7 @@ int xhci_add_endpoint(struct usb_hcd *hcu32 added_ctxs;unsigned int last_ctx;u32 new_add_flags, new_drop_flags, new_slot_info; +struct xhci_virt_device *virt_dev;int ret =0 ; ret =xhci_check_args (hcd, udev, ep,1 , true, __func__);
@@ -1418,11 +1419,25 @@ int xhci_add_endpoint(struct usb_hcd *hcreturn 0 ; } - in_ctx = xhci->devs[udev->slot_id]->in_ctx; - out_ctx = xhci->devs[udev->slot_id]->out_ctx; + virt_dev = xhci->devs[udev->slot_id]; + in_ctx = virt_dev->in_ctx; + out_ctx = virt_dev->out_ctx; ctrl_ctx =xhci_get_input_control_ctx (xhci, in_ctx); ep_index =xhci_get_endpoint_index (&ep->desc); ep_ctx =xhci_get_ep_ctx (xhci, out_ctx, ep_index); + +/* If this endpoint is already in use, and the upper layers are trying +* to add it again without dropping it, reject the addition. +*/ +if (virt_dev->eps[ep_index].ring && + !(le32_to_cpu (ctrl_ctx->drop_flags) & +xhci_get_endpoint_flag (&ep->desc))) { +xhci_warn (xhci,"Trying to add endpoint 0x%x " +"without dropping it.\n" , + (unsigned int ) ep->desc.bEndpointAddress); +return -EINVAL ; + } +/* If the HCD has already noted the endpoint is enabled, * ignore this request. */
@@ -1437,8 +1452,7 @@ int xhci_add_endpoint(struct usb_hcd *hc* process context, not interrupt context (or so documenation * for usb_set_interface() and usb_set_configuration() claim). */ -if (xhci_endpoint_init (xhci, xhci->devs[udev->slot_id], - udev, ep,GFP_NOIO ) <0 ) { +if (xhci_endpoint_init (xhci, virt_dev, udev, ep,GFP_NOIO ) <0 ) {dev_dbg (&udev->dev,"%s - could not initialize ep %#x\n" , __func__, ep->desc.bEndpointAddress);return -ENOMEM ;
PATCH 39/107 xhci: Add reset on resume quirk for asrock p67 host
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Maarten Lankhorst <[email protected]>
commit c877b3b2ad5cb9d4fe523c5496185cc328ff3ae9 upstream.
The asrock p67 xhci controller completely dies on resume, add a quirk for this, to bring the host back online after a suspend.
This should be backported to stable kernels as old as 2.6.37.
--- drivers/usb/host/xhci-pci.c | 8 ++++++++ drivers/usb/host/xhci.c | 2 ++ drivers/usb/host/xhci.h | 1 + 3 files changed, 11 insertions(+)
drivers/usb/host/xhci-pci.c +8 -0
@@ -28,6 +28,9 @@#define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73#define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 +#define PCI_VENDOR_ID_ETRON 0x1b6f +#define PCI_DEVICE_ID_ASROCK_P67 0x7023 +static const char hcd_name[] ="xhci_hcd" ;/* called after powerup, by probe or system-pm "wakeup" */
@@ -120,6 +123,11 @@ static int xhci_pci_setup(struct usb_hcd"has broken MSI implementation\n" , pdev->revision); } +if (pdev->vendor ==PCI_VENDOR_ID_ETRON && + pdev->device ==PCI_DEVICE_ID_ASROCK_P67 ) { + xhci->quirks |=XHCI_RESET_ON_RESUME ; +xhci_dbg (xhci,"QUIRK: Resetting on resume\n" ); + }if (pdev->vendor ==PCI_VENDOR_ID_NEC ) xhci->quirks |=XHCI_NEC_HOST ;
drivers/usb/host/xhci.c +2 -0
@@ -759,6 +759,8 @@ int xhci_resume(struct xhci_hcd *xhci, bmsleep (100 );spin_lock_irq (&xhci->lock); +if (xhci->quirks &XHCI_RESET_ON_RESUME ) + hibernated = true;if (!hibernated) {/* step 1: restore register */
drivers/usb/host/xhci.h +1 -0
@@ -1287,6 +1287,7 @@ struct xhci_hcd {#define XHCI_NEC_HOST (1 << 2)#define XHCI_AMD_PLL_FIX (1 << 3)#define XHCI_BROKEN_MSI (1 << 6) +#define XHCI_RESET_ON_RESUME (1 << 7)/* There are two roothubs to keep track of bus suspend info for */ struct xhci_bus_state bus_state[2 ];/* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */
PATCH 40/107 xhci: Always set urb->status to zero for isoc endpoints.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sarah Sharp <[email protected]>
commit b3df3f9c7df9a8d85e03e158d35487618a160901 upstream.
When the xHCI driver encounters a Missed Service Interval event for an isochronous endpoint ring, it means the host controller skipped over one or more isochronous TDs. For TD that is skipped, skip_isoc_td() is called. This sets the frame descriptor status to -EXDEV, and also sets the value stored in the int pointed to by status to -EXDEV.
If the isochronous TD happens to be the last TD in an URB, handle_tx_event() will use the status variable to give back the URB to the USB core. That means drivers will see urb->status as -EXDEV.
It turns out that EHCI, UHCI, and OHCI always set urb->status to zero for an isochronous urb, regardless of what the frame status is. See itd_complete() in ehci-sched.c:
} else {
/* URB was too late */
desc->status = -EXDEV;
}
}
/* handle completion now? */
if (likely ((urb_index + 1) != urb->number_of_packets))
goto done;
/* ASSERT: it's really the last itd for this urb
list_for_each_entry (itd, &stream->td_list, itd_list)
BUG_ON (itd->urb == urb);
*/
/* give urb back to the driver; completion often (re)submits */
dev = urb->dev;
ehci_urb_done(ehci, urb, 0);ehci_urb_done() completes the URB with the status of the third argument, which is always zero in this case.
It turns out that many USB webcam drivers, such as uvcvideo, cannot handle urb->status set to a non-zero value. They will not resubmit their isochronous URBs in that case, and userspace will see a frozen video.
Change the xHCI driver to be consistent with the EHCI and UHCI driver, and always set urb->status to 0 for isochronous URBs.
This patch should be backported to kernels as old as 2.6.36
--- drivers/usb/host/xhci-ring.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-ring.c +6 -5
@@ -1768,9 +1768,6 @@ static int process_isoc_td(struct xhci_h } } -if ((idx == urb_priv->length -1 ) && *status == -EINPROGRESS ) - *status =0 ; -return finish_td (xhci, td, event_trb, event, ep, status, false); }
@@ -1788,8 +1785,7 @@ static int skip_isoc_td(struct xhci_hcd idx = urb_priv->td_cnt; frame = &td->urb->iso_frame_desc[idx]; -/* The transfer is partly done */ - *status = -EXDEV ; +/* The transfer is partly done. */ frame->status = -EXDEV ;/* calc actual length */
@@ -2139,6 +2135,11 @@ cleanup:"status = %d\n" , urb, urb->actual_length, status);spin_unlock (&xhci->lock); +/* EHCI, UHCI, and OHCI always unconditionally set the +* urb->status of an isochronous endpoint to 0. +*/ +if (usb_pipetype (urb->pipe) ==PIPE_ISOCHRONOUS ) + status =0 ;usb_hcd_giveback_urb (bus_to_hcd (urb->dev->bus), urb, status);spin_lock (&xhci->lock); }
PATCH 41/107 USB: Free bandwidth when usb_disable_device is called.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sarah Sharp <[email protected]>
commit fccf4e86200b8f5edd9a65da26f150e32ba79808 upstream.
Tanya ran into an issue when trying to switch a UAS device from the BOT configuration to the UAS configuration via the bConfigurationValue sysfs file. Before installing the UAS configuration, set_bConfigurationValue() calls usb_disable_device(). That function is supposed to remove all host controller resources associated with that device, but it leaves some state in the xHCI host controller.
Commit 0791971ba8fbc44e4f476079f856335ed45e6324
usb: allow drivers to use allocated bandwidth until unbound
added a call to usb_disable_device() in usb_set_configuration(), before the xHCI bandwidth functions were invoked. That commit fixed a bug, but also introduced a bug that is triggered when a configured device is switched to a new configuration.
usb_disable_device() goes through all the motions of unbinding the drivers attached to active interfaces and removing the USB core structures associated with those interfaces, but it doesn't actually remove the endpoints from the internal xHCI host controller bandwidth structures.
When usb_disable_device() calls usb_disable_endpoint() with reset_hardware set to true, the entries in udev->ep_out and udev->ep_in will be set to NULL. Usually, when the USB core installs a new configuration, usb_hcd_alloc_bandwidth() will drop all non-NULL endpoints in udev->ep_out and udev->ep_in before adding any new endpoints. However, when the new UAS configuration was added, all those entries were null, so none of the old endpoints in the BOT configuration were dropped.
The xHCI driver blindly added the UAS configuration endpoints, and some of the endpoint addresses overlapped with the old BOT configuration endpoints. This caused the xHCI host to reject the Configure Endpoint command. Now that the xHCI driver code is cleaned up to reject a double-add of active endpoints, we need to fix the USB core to properly drop old endpoints in usb_disable_device().
If the host controller driver needs bandwidth checking support, make usb_disable_device() call usb_disable_endpoint() with reset_hardware set to false, drop the endpoints from the xHCI host controller, and then call usb_disable_endpoint() again with reset_hardware set to true.
The first call to usb_disable_endpoint() will cancel any pending URBs and wait on them to be freed in usb_hcd_disable_endpoint(), but will keep the pointers in udev->ep_out and udev->ep in intact. Then usb_hcd_alloc_bandwidth() will use those pointers to know which endpoints to drop.
The final call to usb_disable_endpoint() will do two things:
1. It will call usb_hcd_disable_endpoint() again, which should be harmless since the ep->urb_list should be empty after the first call to usb_disable_endpoint() returns.
2. It will set the entries in udev->ep_out and udev->ep in to NULL, and call usb_hcd_disable_endpoint(). That call will have no effect, since the xHCI driver doesn't set the endpoint_disable function pointer.
Note that usb_disable_device() will now need to be called with hcd->bandwidth_mutex held.
This should be backported to kernels as old as 2.6.32.
--- drivers/usb/core/hub.c | 3 +++ drivers/usb/core/message.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-)
drivers/usb/core/hub.c +3 -0
@@ -1643,6 +1643,7 @@ void usb_disconnect(struct usb_device ** {struct usb_device *udev = *pdev;int i; +struct usb_hcd *hcd =bus_to_hcd (udev->bus);if (!udev) {pr_debug ("%s nodev\n" , __func__);
@@ -1670,7 +1671,9 @@ void usb_disconnect(struct usb_device *** so that the hardware is now fully quiesced. */ dev_dbg (&udev->dev,"unregistering device\n" ); +mutex_lock (hcd->bandwidth_mutex);usb_disable_device (udev,0 ); +mutex_unlock (hcd->bandwidth_mutex);usb_hcd_synchronize_unlinks (udev);usb_remove_ep_devs (&udev->ep0);
drivers/usb/core/message.c +14 -1
@@ -1135,10 +1135,13 @@ void usb_disable_interface(struct usb_de* Deallocates hcd/hardware state for the endpoints (nuking all or most * pending urbs) and usbcore state for the interfaces, so that usbcore * must usb_set_configuration() before any interfaces could be used. +* +* Must be called with hcd->bandwidth_mutex held. */ void usb_disable_device (struct usb_device *dev,int skip_ep0) {int i; +struct usb_hcd *hcd =bus_to_hcd (dev->bus);/* getting rid of interfaces will disconnect * any drivers bound to them (a key side effect)
@@ -1172,6 +1175,16 @@ void usb_disable_device(struct usb_devicdev_dbg (&dev->dev,"%s nuking %s URBs\n" , __func__, skip_ep0 ?"non-ep0" :"all" ); +if (hcd->driver->check_bandwidth) { +/* First pass: Cancel URBs, leave endpoint pointers intact. */ +for (i = skip_ep0; i <16 ; ++i) { +usb_disable_endpoint (dev, i, false); +usb_disable_endpoint (dev, i +USB_DIR_IN , false); + } +/* Remove endpoints from the host controller internal state */ +usb_hcd_alloc_bandwidth (dev,NULL ,NULL ,NULL ); +/* Second pass: remove endpoint pointers */ + }for (i = skip_ep0; i <16 ; ++i) {usb_disable_endpoint (dev, i, true);usb_disable_endpoint (dev, i +USB_DIR_IN , true);
@@ -1727,6 +1740,7 @@ free_interfaces:/* if it's already configured, clear out old state first. * getting rid of old interfaces means unbinding their drivers. */ +mutex_lock (hcd->bandwidth_mutex);if (dev->state !=USB_STATE_ADDRESS )usb_disable_device (dev,1 );/* Skip ep0 */
@@ -1739,7 +1753,6 @@ free_interfaces:* host controller will not allow submissions to dropped endpoints. If * this call fails, the device state is unchanged. */ -mutex_lock (hcd->bandwidth_mutex); ret =usb_hcd_alloc_bandwidth (dev, cp,NULL ,NULL );if (ret <0 ) {mutex_unlock (hcd->bandwidth_mutex);
PATCH 42/107 USB: Add new FT232H chip to drivers/usb/serial/ftdi_sio.c
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Uwe Bonnes <[email protected]>
commit 309427b6351b763917caac3e4b2ab5651df99823 upstream.
appended patch adds support for the new FTDI FT232H chip. This chip is a single channel version of the dual FT2232H/quad FT4232H, coming with it's own default PID 0x6014 (FT2232H uses the same PID 0x6010 like FT2232C, FT4232H has also it's own PID).
The patch was checked on an UM232H module and a terminal program with TX/RX shorted to that typing in the terminal reproduced the characters.
--- drivers/usb/serial/ftdi_sio.c | 19 ++++++++++++++----- drivers/usb/serial/ftdi_sio.h | 3 ++- drivers/usb/serial/ftdi_sio_ids.h | 1 + 3 files changed, 17 insertions(+), 6 deletions(-)
drivers/usb/serial/ftdi_sio.c +14 -5
@@ -179,6 +179,7 @@ static struct usb_device_id id_table_com { USB_DEVICE(FTDI_VID, FTDI_232RL_PID) }, { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, { USB_DEVICE(FTDI_VID, FTDI_4232H_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_232H_PID) }, { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_PID) },
@@ -848,7 +849,8 @@ static const char *ftdi_chip_name[] = { [FT2232C] = "FT2232C", [FT232RL] = "FT232RL", [FT2232H] = "FT2232H", - [FT4232H] = "FT4232H" + [FT4232H] = "FT4232H", + [FT232H] = "FT232H" };
@@ -1168,6 +1170,7 @@ static __u32 get_ftdi_divisor(struct ttybreak ;case FT2232H :/* FT2232H chip */ case FT4232H :/* FT4232H chip */ +case FT232H :/* FT232H chip */ if ((baud <=12000000 ) & (baud >=1200 )) { div_value =ftdi_2232h_baud_to_divisor (baud); }else if (baud <1200 ) {
@@ -1429,9 +1432,12 @@ static void ftdi_determine_type(struct u }else if (version <0x600 ) {/* Assume it's an FT232BM (or FT245BM) */ priv->chip_type =FT232BM ; - }else { -/* Assume it's an FT232R */ + }else if (version <0x900 ) { +/* Assume it's an FT232RL */ priv->chip_type =FT232RL ; + }else { +/* Assume it's an FT232H */ + priv->chip_type =FT232H ; }dev_info (&udev->dev,"Detected %s\n" , ftdi_chip_name[priv->chip_type]); }
@@ -1559,7 +1565,8 @@ static int create_sysfs_attrs(struct usb priv->chip_type == FT2232C || priv->chip_type == FT232RL || priv->chip_type == FT2232H || - priv->chip_type == FT4232H)) { + priv->chip_type == FT4232H || + priv->chip_type == FT232H)) { retval =device_create_file (&port->dev, &dev_attr_latency_timer); }
@@ -1580,7 +1587,8 @@ static void remove_sysfs_attrs(struct us priv->chip_type == FT2232C || priv->chip_type == FT232RL || priv->chip_type == FT2232H || - priv->chip_type == FT4232H) { + priv->chip_type == FT4232H || + priv->chip_type == FT232H) {device_remove_file (&port->dev, &dev_attr_latency_timer); } }
@@ -2212,6 +2220,7 @@ static int ftdi_tiocmget(struct tty_strucase FT232RL :case FT2232H :case FT4232H : +case FT232H : len =2 ;break ;default :
drivers/usb/serial/ftdi_sio.h +2 -1
@@ -156,7 +156,8 @@ enum ftdi_chip_type {FT2232C =4 ,FT232RL =5 ,FT2232H =6 , -FT4232H =7 +FT4232H =7 , +FT232H =8 }; enum ftdi_sio_baudrate {
drivers/usb/serial/ftdi_sio_ids.h +1 -0
@@ -22,6 +22,7 @@#define FTDI_8U232AM_ALT_PID 0x6006/* FTDI's alternate PID for above */ #define FTDI_8U2232C_PID 0x6010/* Dual channel device */ #define FTDI_4232H_PID 0x6011/* Quad channel hi-speed device */ +#define FTDI_232H_PID 0x6014/* Single channel hi-speed device */ #define FTDI_SIO_PID 0x8372/* Product Id SIO application of 8U100AX */ #define FTDI_232RL_PID 0xFBFA/* Product ID for FT232RL */
PATCH 43/107 mm/memory-failure.c: fix page isolated count mismatch
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Minchan Kim <[email protected]>
commit 5db8a73a8d7cc6a66afbf25ed7fda338caa8f5f9 upstream.
Pages isolated for migration are accounted with the vmstat counters NR_ISOLATE_[ANON|FILE]. Callers of migrate_pages() are expected to increment these counters when pages are isolated from the LRU. Once the pages have been migrated, they are put back on the LRU or freed and the isolated count is decremented.
Memory failure is not properly accounting for pages it isolates causing the NR_ISOLATED counters to be negative. On SMP builds, this goes unnoticed as negative counters are treated as 0 due to expected per-cpu drift. On UP builds, the counter is treated by too_many_isolated() as a large value causing processes to enter D state during page reclaim or compaction. This patch accounts for pages isolated by memory failure correctly.
--- mm/memory-failure.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/memory-failure.c +3 -1
@@ -52,6 +52,7 @@#include <linux/swapops.h> #include <linux/hugetlb.h> #include <linux/memory_hotplug.h> +#include <linux/mm_inline.h> #include "internal.h" int sysctl_memory_failure_early_kill__read_mostly =0 ;
@@ -1463,7 +1464,8 @@ int soft_offline_page(struct page *page, ret =isolate_lru_page (page);if (!ret) {LIST_HEAD (pagelist); - +inc_zone_page_state (page,NR_ISOLATED_ANON + +page_is_file_cache (page));list_add (&page->lru, &pagelist); ret =migrate_pages (&pagelist, new_page,MPOL_MF_MOVE_ALL ,0 , true);
PATCH 44/107 PM: Free memory bitmaps if opening /dev/snapshot fails
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Michal Kubecek <[email protected]>
commit 8440f4b19494467883f8541b7aa28c7bbf6ac92b upstream.
When opening /dev/snapshot device, snapshot_open() creates memory bitmaps which are freed in snapshot_release(). But if any of the callbacks called by pm_notifier_call_chain() returns NOTIFY_BAD, open() fails, snapshot_release() is never called and bitmaps are not freed. Next attempt to open /dev/snapshot then triggers BUG_ON() check in create_basic_memory_bitmaps(). This happens e.g. when vmwatchdog module is active on s390x.
--- kernel/power/user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/power/user.c +3 -1
@@ -113,8 +113,10 @@ static int snapshot_open(struct inode *iif (error)pm_notifier_call_chain (PM_POST_RESTORE ); } -if (error) +if (error) { +free_basic_memory_bitmaps ();atomic_inc (&snapshot_device_available); + } data->frozen =0 ; data->ready =0 ; data->platform_support =0 ;
PATCH 45/107 ath5k: fix memory leak when fewer than N_PD_CURVES are in use
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: "Eugene A. Shatokhin" <[email protected]>
commit a0b8de350be458b33248e48b2174d9af8a4c4798 upstream.
We would free the proper number of curves, but in the wrong slots, due to a missing level of indirection through the pdgain_idx table.
It's simpler just to try to free all four slots, so do that.
--- drivers/net/wireless/ath/ath5k/eeprom.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath5k/eeprom.c +3 -5
@@ -1565,14 +1565,12 @@ ath5k_eeprom_free_pcal_info(struct ath5kif (!chinfo[pier].pd_curves)continue ; -for (pdg =0 ; pdg < ee->ee_pd_gains[mode]; pdg++) { +for (pdg =0 ; pdg <AR5K_EEPROM_N_PD_CURVES ; pdg++) {struct ath5k_pdgain_info *pd = &chinfo[pier].pd_curves[pdg]; -if (pd !=NULL ) { -kfree (pd->pd_step); -kfree (pd->pd_pwr); - } +kfree (pd->pd_step); +kfree (pd->pd_pwr); }kfree (chinfo[pier].pd_curves);
PATCH 46/107 ath5k: Disable fast channel switching by default
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Nick Kossifidis <[email protected]>
commit a99168eece601d2a79ecfcb968ce226f2f30cf98 upstream.
Disable fast channel change by default on AR2413/AR5413 due to some bug reports (it still works for me but it's better to be safe). Add a module parameter "fastchanswitch" in case anyone wants to enable it and play with it.
--- drivers/net/wireless/ath/ath5k/base.c | 11 ++++++++++- drivers/net/wireless/ath/ath5k/reset.c | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +10 -1
@@ -72,6 +72,11 @@ static int modparam_all_channels;module_param_named (all_channels, modparam_all_channels, bool,S_IRUGO );MODULE_PARM_DESC (all_channels,"Expose all channels the device can use." ); +static int modparam_fastchanswitch; +module_param_named (fastchanswitch, modparam_fastchanswitch, bool,S_IRUGO ); +MODULE_PARM_DESC (fastchanswitch,"Enable fast channel switching for AR2413/AR5413 radios." ); + +/* Module info */ MODULE_AUTHOR ("Jiri Slaby" );MODULE_AUTHOR ("Nick Kossifidis" );
@@ -2644,6 +2649,7 @@ ath5k_reset(struct ath5k_softc *sc, strustruct ath5k_hw *ah = sc->ah;struct ath_common *common =ath5k_hw_common (ah);int ret, ani_mode; +bool fast;ATH5K_DBG (sc,ATH5K_DEBUG_RESET ,"resetting\n" );
@@ -2663,7 +2669,10 @@ ath5k_reset(struct ath5k_softc *sc, struath5k_drain_tx_buffs (sc);if (chan) sc->curchan = chan; - ret =ath5k_hw_reset (ah, sc->opmode, sc->curchan, chan !=NULL , + + fast = ((chan !=NULL ) && modparam_fastchanswitch) ?1 :0 ; + + ret =ath5k_hw_reset (ah, sc->opmode, sc->curchan, fast, skip_pcu);if (ret) {ATH5K_ERR (sc,"can't reset hardware (%d)\n" , ret);
drivers/net/wireless/ath/ath5k/reset.c +4 -1
@@ -1119,8 +1119,11 @@ int ath5k_hw_reset(struct ath5k_hw *ah,/* Non fatal, can happen eg. * on mode change */ ret =0 ; - }else + }else { +ATH5K_DBG (ah->ah_sc,ATH5K_DEBUG_RESET , +"fast chan change successful\n" );return 0 ; + } }/*
PATCH 47/107 pxa168_eth: fix race in transmit path.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Richard Cochran <[email protected]>
commit 384420409d9b5d4443940abace49363d26135412 upstream.
Because the socket buffer is freed in the completion interrupt, it is not safe to access it after submitting it to the hardware.
--- drivers/net/pxa168_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/pxa168_eth.c +1 -1
@@ -1273,7 +1273,7 @@ static int pxa168_eth_start_xmit(structwmb ();wrl (pep,SDMA_CMD ,SDMA_CMD_TXDH |SDMA_CMD_ERD ); - stats->tx_bytes += skb->len; + stats->tx_bytes += length; stats->tx_packets++; dev->trans_start = jiffies;if (pep->tx_ring_size - pep->tx_desc_count <=1 ) {
RE: [047/107] pxa168_eth: fix race in transmit path.
ACK.
Quoted 45 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Friday, July 08, 2011 5:46 AM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; akpm@linux- foundation.org; [email protected]; Sachin Sanap; Zhangfei Gao; Philip Rakity; Richard Cochran; Eric Dumazet; David S. Miller
Subject: [047/107]pxa168_eth: fix race in transmit path.2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Richard Cochran <[email protected]>
commit
384420409d9b5d4443940abace49363d26135412upstream.Because the socket buffer is freed in the completion interrupt, it is not safe to access it after submitting it to the hardware.
Cc Sachin Sanap <[email protected]>Cc Zhangfei Gao <[email protected]>Cc Philip Rakity <[email protected]>Signed-off-by Richard Cochran <[email protected]>Acked-by Eric Dumazet <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/net/pxa168_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/pxa168_eth.c +1
-1@@ -1273,7 +1273,7 @@ static int pxa168_eth_start_xmit(structwmb ();wrl (pep,SDMA_CMD ,SDMA_CMD_TXDH |SDMA_CMD_ERD ); - stats->tx_bytes += skb->len; + stats->tx_bytes += length; stats->tx_packets++; dev->trans_start = jiffies;if (pep->tx_ring_size - pep->tx_desc_count <=1 ) {
Re: [047/107] pxa168_eth: fix race in transmit path.
Quoted 1 line · Sachin Sanap
ACK.
Now added, thanks.
PATCH 48/107 ath9k: Fix suspend/resume when no interface is UP
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Rajkumar Manoharan <[email protected]>
commit c31eb8e926835582cd186b33a7a864880a4c0c79 upstream.
When no interface has been brought up, the chip's power state continued as AWAKE. So during resume, the chip never been powered up.
--- drivers/net/wireless/ath/ath9k/pci.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/ath/ath9k/pci.c +6 -0
@@ -278,6 +278,12 @@ static int ath_pci_suspend(struct deviceath9k_hw_set_gpio (sc->sc_ah, sc->sc_ah->led_pin,1 ); +/* The device has to be moved to FULLSLEEP forcibly. +* Otherwise the chip never moved to full sleep, +* when no interface is up. +*/ +ath9k_hw_setpower (sc->sc_ah,ATH9K_PM_FULL_SLEEP ); +return 0 ; }
PATCH 49/107 x86, suspend: Restore MISC_ENABLE MSR in realmode wakeup
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Kees Cook <[email protected]>
commit 7a3136666bc0f0419f7aaa7b1fabb4b0e0a7fb76 upstream.
Some BIOSes will reset the Intel MISC_ENABLE MSR (specifically the XD_DISABLE bit) when resuming from S3, which can interact poorly with ebba638ae723d8a8fc2f7abce5ec18b688b791d7. In 32bit PAE mode, this can lead to a fault when EFER is restored by the kernel wakeup routines, due to it setting the NX bit for a CPU that (thanks to the BIOS reset) now incorrectly thinks it lacks the NX feature. (64bit is not affected because it uses a common CPU bring-up that specifically handles the XD_DISABLE bit.)
The need for MISC_ENABLE being restored so early is specific to the S3 resume path. Normally, MISC_ENABLE is saved in save_processor_state(), but this happens after the resume header is created, so just reproduce the logic here. (acpi_suspend_lowlevel() creates the header, calls do_suspend_lowlevel, which calls save_processor_state(), so the saved processor context isn't available during resume header creation.)
[ hpa: Consider for stable if OK in mainline ]
--- arch/x86/kernel/acpi/realmode/wakeup.S | 14 ++++++++++++++ arch/x86/kernel/acpi/realmode/wakeup.h | 6 ++++++ arch/x86/kernel/acpi/sleep.c | 6 ++++++ 3 files changed, 26 insertions(+)
arch/x86/kernel/acpi/realmode/wakeup.S +14 -0
@@ -28,6 +28,8 @@ pmode_cr3: .long 0 /* Saved %cr3 */ pmode_cr4: .long 0 /* Saved %cr4 */ pmode_efer: .quad 0 /* Saved EFER */ pmode_gdt: .quad 0 +pmode_misc_en: .quad 0 /* Saved MISC_ENABLE MSR */ +pmode_behavior: .long 0 /* Wakeup behavior flags */ realmode_flags: .long 0 real_magic: .long 0 trampoline_segment: .word 0
@@ -91,6 +93,18 @@ wakeup_code: /* Call the C code */ calll main + /* Restore MISC_ENABLE before entering protected mode, in case + BIOS decided to clear XD_DISABLE during S3. */ + movl pmode_behavior, %eax + btl $WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE, %eax + jnc 1f + + movl pmode_misc_en, %eax + movl pmode_misc_en + 4, %edx + movl $MSR_IA32_MISC_ENABLE, %ecx + wrmsr +1: + /* Do any other stuff... */ #ifndef CONFIG_64BIT
arch/x86/kernel/acpi/realmode/wakeup.h +6 -0
@@ -21,6 +21,9 @@ struct wakeup_header {u32 pmode_efer_low;/* Protected mode EFER */ u32 pmode_efer_high;u64 pmode_gdt; +u32 pmode_misc_en_low;/* Protected mode MISC_ENABLE */ +u32 pmode_misc_en_high; +u32 pmode_behavior;/* Wakeup routine behavior flags */ u32 realmode_flags;u32 real_magic;u16 trampoline_segment;/* segment with trampoline code, 64-bit only */
@@ -39,4 +42,7 @@ extern struct wakeup_header wakeup_heade#define WAKEUP_HEADER_SIGNATURE 0x51ee1111#define WAKEUP_END_SIGNATURE 0x65a22c82 +/* Wakeup behavior bits */ +#define WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE 0 +#endif /* ARCH_X86_KERNEL_ACPI_RM_WAKEUP_H */
arch/x86/kernel/acpi/sleep.c +6 -0
@@ -77,6 +77,12 @@ int acpi_suspend_lowlevel(void) header->pmode_cr0 =read_cr0 (); header->pmode_cr4 =read_cr4_safe (); + header->pmode_behavior =0 ; +if (!rdmsr_safe (MSR_IA32_MISC_ENABLE , + &header->pmode_misc_en_low, + &header->pmode_misc_en_high)) + header->pmode_behavior |= + (1 <<WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE ); header->realmode_flags = acpi_realmode_flags; header->real_magic =0x12345678 ;
PATCH 50/107 oprofile, x86: Fix race in nmi handler while starting counters
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Robert Richter <[email protected]>
commit 8fe7e94eb71430cf63a742f3c19739d82a662758 upstream.
In some rare cases, nmis are generated immediately after the nmi handler of the cpu was started. This causes the counter not to be enabled. Before enabling the nmi handlers we need to set variable ctr_running first and make sure its value is written to memory.
Also, the patch makes all existing barriers a memory barrier instead of a compiler barrier only.
--- arch/x86/oprofile/nmi_int.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
arch/x86/oprofile/nmi_int.c +10 -4
@@ -112,8 +112,10 @@ static void nmi_cpu_start(void *dummy)static int nmi_start (void ) {get_online_cpus (); -on_each_cpu (nmi_cpu_start,NULL ,1 ); ctr_running =1 ; +/* make ctr_running visible to the nmi handler: */ +smp_mb (); +on_each_cpu (nmi_cpu_start,NULL ,1 );put_online_cpus ();return 0 ; }
@@ -504,15 +506,18 @@ static int nmi_setup(void) nmi_enabled =0 ; ctr_running =0 ; -barrier (); +/* make variables visible to the nmi handler: */ +smp_mb (); err =register_die_notifier (&profile_exceptions_nb);if (err) goto fail;get_online_cpus ();register_cpu_notifier (&oprofile_cpu_nb); -on_each_cpu (nmi_cpu_setup,NULL ,1 ); nmi_enabled =1 ; +/* make nmi_enabled visible to the nmi handler: */ +smp_mb (); +on_each_cpu (nmi_cpu_setup,NULL ,1 );put_online_cpus ();return 0 ;
@@ -531,7 +536,8 @@ static void nmi_shutdown(void) nmi_enabled =0 ; ctr_running =0 ;put_online_cpus (); -barrier (); +/* make variables visible to the nmi handler: */ +smp_mb ();unregister_die_notifier (&profile_exceptions_nb); msrs = &get_cpu_var (cpu_msrs); model->shutdown (msrs);
PATCH 51/107 mmc: tmio: fix regression in TMIO_MMC_WRPROTECT_DISABLE handling
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Guennadi Liakhovetski <[email protected]>
commit 7d8b4c2a4b73da8e3632603691838ca5b2a8c26d upstream.
Commit b6147490e6aac82 ("mmc: tmio: split core functionality, DMA and MFD glue") broke handling of the TMIO_MMC_WRPROTECT_DISABLE flag by the tmio-mmc driver. This patch restores the original behaviour.
--- drivers/mmc/host/tmio_mmc_pio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/tmio_mmc_pio.c +2 -2
@@ -760,8 +760,8 @@ static int tmio_mmc_get_ro(struct mmc_hostruct tmio_mmc_host *host =mmc_priv (mmc);struct tmio_mmc_data *pdata = host->pdata; -return ((pdata->flags &TMIO_MMC_WRPROTECT_DISABLE ) || - !(sd_ctrl_read32 (host,CTL_STATUS ) &TMIO_STAT_WRPROTECT )); +return !((pdata->flags &TMIO_MMC_WRPROTECT_DISABLE ) || + (sd_ctrl_read32 (host,CTL_STATUS ) &TMIO_STAT_WRPROTECT )); }static int tmio_mmc_get_cd (struct mmc_host *mmc)
PATCH 52/107 mmc: Add PCI fixup quirks for Ricoh 1180:e823 reader
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Manoj Iyer <[email protected]>
commit be98ca652faa6468916a9b7608befff215a8ca70 upstream.
--- drivers/pci/quirks.c | 2 ++ include/linux/pci_ids.h | 1 + 2 files changed, 3 insertions(+)
drivers/pci/quirks.c +2 -0
@@ -2758,6 +2758,8 @@ static void ricoh_mmc_fixup_r5c832(struc }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_RICOH ,PCI_DEVICE_ID_RICOH_R5C832 , ricoh_mmc_fixup_r5c832);DECLARE_PCI_FIXUP_RESUME_EARLY (PCI_VENDOR_ID_RICOH ,PCI_DEVICE_ID_RICOH_R5C832 , ricoh_mmc_fixup_r5c832); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_RICOH ,PCI_DEVICE_ID_RICOH_R5CE823 , ricoh_mmc_fixup_r5c832); +DECLARE_PCI_FIXUP_RESUME_EARLY (PCI_VENDOR_ID_RICOH ,PCI_DEVICE_ID_RICOH_R5CE823 , ricoh_mmc_fixup_r5c832);#endif /*CONFIG_MMC_RICOH_MMC*/ #if defined(CONFIG_DMAR ) || defined(CONFIG_INTR_REMAP )
include/linux/pci_ids.h +1 -0
@@ -1537,6 +1537,7 @@#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478#define PCI_DEVICE_ID_RICOH_R5C822 0x0822 +#define PCI_DEVICE_ID_RICOH_R5CE823 0xe823#define PCI_DEVICE_ID_RICOH_R5C832 0x0832#define PCI_DEVICE_ID_RICOH_R5C843 0x0843
PATCH 53/107 mm: fix negative commitlimit when gigantic hugepages are allocated
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Rafael Aquini <[email protected]>
commit b0320c7b7d1ac1bd5c2d9dff3258524ab39bad32 upstream.
When 1GB hugepages are allocated on a system, free(1) reports less available memory than what really is installed in the box. Also, if the total size of hugepages allocated on a system is over half of the total memory size, CommitLimit becomes a negative number.
The problem is that gigantic hugepages (order > MAX_ORDER) can only be allocated at boot with bootmem, thus its frames are not accounted to 'totalram_pages'. However, they are accounted to hugetlb_total_pages()
What happens to turn CommitLimit into a negative number is this calculation, in fs/proc/meminfo.c:
allowed = ((totalram_pages - hugetlb_total_pages())
* sysctl_overcommit_ratio / 100) + total_swap_pages;
A similar calculation occurs in __vm_enough_memory() in mm/mmap.c.
Also, every vm statistic which depends on 'totalram_pages' will render confusing values, as if system were 'missing' some part of its memory.
Impact of this bug:
When gigantic hugepages are allocated and sysctl_overcommit_memory == OVERCOMMIT_NEVER. In a such situation, __vm_enough_memory() goes through the mentioned 'allowed' calculation and might end up mistakenly returning -ENOMEM, thus forcing the system to start reclaiming pages earlier than it would be ususal, and this could cause detrimental impact to overall system's performance, depending on the workload.
Besides the aforementioned scenario, I can only think of this causing annoyances with memory reports from /proc/meminfo and free(1).
--- mm/hugetlb.c | 8 ++++++++ 1 file changed, 8 insertions(+)
mm/hugetlb.c +8 -0
@@ -1111,6 +1111,14 @@ static void __init gather_bootmem_preallWARN_ON (page_count (page) !=1 );prep_compound_huge_page (page, h->order);prep_new_huge_page (h, page,page_to_nid (page)); +/* +* If we had gigantic hugepages allocated at boot time, we need +* to restore the 'stolen' pages to totalram_pages in order to +* fix confusing memory reports from free(1) and another +* side-effects, like CommitLimit going negative. +*/ +if (h->order > (MAX_ORDER -1 )) + totalram_pages +=1 << h->order; } }
PATCH 54/107 block: add REQ_SECURE to REQ_COMMON_MASK
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Namhyung Kim <[email protected]>
commit 155d109b5f52ffd749219b27702462dcd9cf4f8d upstream.
Add REQ_SECURE flag to REQ_COMMON_MASK so that init_request_from_bio() can pass it to @req->cmd_flags.
--- include/linux/blk_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blk_types.h +1 -1
@@ -168,7 +168,7 @@ enum rq_flag_bits { (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)#define REQ_COMMON_MASK \ (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_DISCARD | \ - REQ_NOIDLE | REQ_FLUSH | REQ_FUA) + REQ_NOIDLE | REQ_FLUSH | REQ_FUA | REQ_SECURE)#define REQ_CLONE_MASK REQ_COMMON_MASK#define REQ_RAHEAD (1 << __REQ_RAHEAD)
PATCH 55/107 NFS41: do not update isize if inode needs layoutcommit
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peng Tao <[email protected]>
commit 0f66b5984df2fe1617c05900a39a7ef493ca9de9 upstream.
nfs_update_inode will update isize if there is no queued pages. For pNFS, layoutcommit is supposed to change file size on server, the same effect as queued pages. nfs_update_inode may be called when dirty pages are written back (nfsi->npages==0) but layoutcommit is not sent, and it will change client file size according to server file size. Then client ends up losing what it just writes back in pNFS path. So we should skip updating client file size if file needs layoutcommit.
--- fs/nfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/inode.c +2 -1
@@ -1294,7 +1294,8 @@ static int nfs_update_inode(struct inodeif (new_isize != cur_isize) {/* Do we perhaps have any outstanding writes, or has * the file grown beyond our last write? */ -if (nfsi->npages ==0 || new_isize > cur_isize) { +if ((nfsi->npages ==0 && !test_bit (NFS_INO_LAYOUTCOMMIT , &nfsi->flags)) || + new_isize > cur_isize) {i_size_write (inode, new_isize); invalid |=NFS_INO_INVALID_ATTR |NFS_INO_INVALID_DATA ; }
PATCH 56/107 mm, hotplug: fix error handling in mem_online_node()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Rientjes <[email protected]>
commit 7553e8f2d5161a2b7a9b7a9f37be1b77e735552f upstream.
The error handling in mem_online_node() is incorrect: hotadd_new_pgdat() returns NULL if the new pgdat could not have been allocated and a pointer to it otherwise.
mem_online_node() should fail if hotadd_new_pgdat() fails, not the inverse. This fixes an issue when memoryless nodes are not onlined and their sysfs interface is not registered when their first cpu is brought up.
The bug was introduced by commit cf23422b9d76 ("cpu/mem hotplug: enable CPUs online before local memory online") iow v2.6.35.
--- mm/memory_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory_hotplug.c +1 -1
@@ -518,7 +518,7 @@ int mem_online_node(int nid)lock_memory_hotplug (); pgdat =hotadd_new_pgdat (nid,0 ); -if (pgdat) { +if (!pgdat) { ret = -ENOMEM ; goto out; }
PATCH 57/107 ALSA: HDA: Remove quirk for an HP device
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Henningsson <[email protected]>
commit 6f2e810ad5d162c2bfa063c1811087277b299e4e upstream.
The reporter, who is running kernel 2.6.38, reports that he needs to set model=auto for the headphone output to work correctly.
--- sound/pci/hda/patch_realtek.c | 1 - 1 file changed, 1 deletion(-)
sound/pci/hda/patch_realtek.c +0 -1
@@ -4607,7 +4607,6 @@ static struct snd_pci_quirk alc880_cfg_tSND_PCI_QUIRK (0x1025 ,0xe309 ,"ULI" ,ALC880_3ST_DIG ),SND_PCI_QUIRK (0x1025 ,0xe310 ,"ULI" ,ALC880_3ST ),SND_PCI_QUIRK (0x1039 ,0x1234 ,NULL ,ALC880_6ST_DIG ), -SND_PCI_QUIRK (0x103c ,0x2a09 ,"HP" ,ALC880_5ST ),SND_PCI_QUIRK (0x1043 ,0x10b3 ,"ASUS W1V" ,ALC880_ASUS_W1V ),SND_PCI_QUIRK (0x1043 ,0x10c2 ,"ASUS W6A" ,ALC880_ASUS_DIG ), SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
PATCH 58/107 ALSA: HDA: Add a new Conexant codec ID (506c)
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Henningsson <[email protected]>
commit f0ca89b031d327b80b612a0608d31b8e13e6dc33 upstream.
Conexant ID 506c was found on Acer Aspire 3830TG. As users report no playback, sending to stable should be safe.
--- sound/pci/hda/patch_conexant.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/patch_conexant.c +3 -0
@@ -3846,6 +3846,8 @@ static struct hda_codec_preset snd_hda_p .patch = patch_cxt5066 }, { .id = 0x14f15069, .name = "CX20585", .patch = patch_cxt5066 }, + { .id = 0x14f1506c, .name = "CX20588", + .patch = patch_cxt5066 }, { .id = 0x14f1506e, .name = "CX20590", .patch = patch_cxt5066 }, { .id = 0x14f15097, .name = "CX20631",
@@ -3874,6 +3876,7 @@ MODULE_ALIAS("snd-hda-codec-id:14f15066"MODULE_ALIAS ("snd-hda-codec-id:14f15067" );MODULE_ALIAS ("snd-hda-codec-id:14f15068" );MODULE_ALIAS ("snd-hda-codec-id:14f15069" ); +MODULE_ALIAS ("snd-hda-codec-id:14f1506c" );MODULE_ALIAS ("snd-hda-codec-id:14f1506e" );MODULE_ALIAS ("snd-hda-codec-id:14f15097" );MODULE_ALIAS ("snd-hda-codec-id:14f15098" );
PATCH 59/107 rc: fix ghost keypresses with certain hw
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jarod Wilson <[email protected]>
commit 3f5c4c73322e4d6f3d40b697dac3073d2adffe41 upstream.
With hardware that has to use ir_raw_event_store_edge to collect IR sample durations, we were not doing an event reset unless IR_MAX_DURATION had passed. That's around 4 seconds. So if someone presses up, then down, with less than 4 seconds in between, they'd get the initial up, then up and down upon pressing down.
To fix this, I've lowered the "send a reset event" logic's threshold to the input device's REP_DELAY (defaults to 500ms), and with an saa7134-based GPIO-driven IR receiver in a Hauppauge HVR-1150, I get *much* better behavior out of the remote now. Special thanks to Devin for providing the hardware to investigate this issue.
--- drivers/media/rc/ir-raw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/rc/ir-raw.c +3 -1
@@ -114,18 +114,20 @@ int ir_raw_event_store_edge(struct rc_des64 delta;/* ns */ DEFINE_IR_RAW_EVENT (ev);int rc =0 ; +int delay;if (!dev->raw)return -EINVAL ; now =ktime_get (); delta =ktime_to_ns (ktime_sub (now, dev->raw->last_event)); + delay =MS_TO_NS (dev->input_dev->rep[REP_DELAY ]);/* Check for a long duration since last event or if we're * being called for the first time, note that delta can't * possibly be negative. */ -if (delta >IR_MAX_DURATION || !dev->raw->last_type) +if (delta > delay || !dev->raw->last_type) type |=IR_START_EVENT ;else ev.duration = delta;
PATCH 60/107 lirc_zilog: fix spinning rx thread
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jarod Wilson <[email protected]>
commit 6a8c97ac92461ec57e36b10572e78d4221e8faa8 upstream.
We were calling schedule_timeout with the rx thread's task state still at TASK_RUNNING, which it shouldn't be. Make sure we call set_current_state(TASK_INTERRUPTIBLE) *before* schedule_timeout, and we're all good here. I believe this problem was mistakenly introduced in commit 5bd6b0464b68d429bc8a3fe6595d19c39dfc4d95, and I'm not sure how I missed it before, as I swear I tested the patchset that was included in, but alas, stuff happens...
--- drivers/staging/lirc/lirc_zilog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lirc/lirc_zilog.c +2 -2
@@ -475,14 +475,14 @@ static int lirc_thread(void *arg)dprintk ("poll thread started\n" );while (!kthread_should_stop ()) { +set_current_state (TASK_INTERRUPTIBLE ); +/* if device not opened, we can sleep half a second */ if (atomic_read (&ir->open_count) ==0 ) {schedule_timeout (HZ /2 );continue ; } -set_current_state (TASK_INTERRUPTIBLE ); -/* * This is ~113*2 + 24 + jitter (2*repeat gap + code length). * We use this interval as the chip resets every time you poll
PATCH 61/107 keymaps: fix table for pinnacle pctv hd devices
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jarod Wilson <[email protected]>
commit 1ba9268c2bfeebfd70193145685e12faeae92882 upstream.
Both consumers of RC_MAP_PINNACLE_PCTV_HD send along full RC-5 scancodes, so this update makes this keymap actually *have* full scancodes, heisted from rc-dib0700-rc5.c. This should fix out of the box remote functionality for the Pinnacle PCTV HD 800i (cx88 pci card) and PCTV HD Pro 801e (em28xx usb stick).
--- drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c | 58 +++++++++++-------------- 1 file changed, 27 insertions(+), 31 deletions(-)
drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c +27 -31
@@ -15,43 +15,39 @@/* Pinnacle PCTV HD 800i mini remote */ static struct rc_map_table pinnacle_pctv_hd[] = { - - {0x0f ,KEY_1 }, - {0x15 ,KEY_2 }, - {0x10 ,KEY_3 }, - {0x18 ,KEY_4 }, - {0x1b ,KEY_5 }, - {0x1e ,KEY_6 }, - {0x11 ,KEY_7 }, - {0x21 ,KEY_8 }, - {0x12 ,KEY_9 }, - {0x27 ,KEY_0 }, - - {0x24 ,KEY_ZOOM }, - {0x2a ,KEY_SUBTITLE }, - - {0x00 ,KEY_MUTE }, - {0x01 ,KEY_ENTER },/* Pinnacle Logo */ - {0x39 ,KEY_POWER }, - - {0x03 ,KEY_VOLUMEUP }, - {0x09 ,KEY_VOLUMEDOWN }, - {0x06 ,KEY_CHANNELUP }, - {0x0c ,KEY_CHANNELDOWN }, - - {0x2d ,KEY_REWIND }, - {0x30 ,KEY_PLAYPAUSE }, - {0x33 ,KEY_FASTFORWARD }, - {0x3c ,KEY_STOP }, - {0x36 ,KEY_RECORD }, - {0x3f ,KEY_EPG },/* Labeled "?" */ +/* Key codes for the tiny Pinnacle remote*/ + {0x0700 ,KEY_MUTE }, + {0x0701 ,KEY_MENU },/* Pinnacle logo */ + {0x0739 ,KEY_POWER }, + {0x0703 ,KEY_VOLUMEUP }, + {0x0709 ,KEY_VOLUMEDOWN }, + {0x0706 ,KEY_CHANNELUP }, + {0x070c ,KEY_CHANNELDOWN }, + {0x070f ,KEY_1 }, + {0x0715 ,KEY_2 }, + {0x0710 ,KEY_3 }, + {0x0718 ,KEY_4 }, + {0x071b ,KEY_5 }, + {0x071e ,KEY_6 }, + {0x0711 ,KEY_7 }, + {0x0721 ,KEY_8 }, + {0x0712 ,KEY_9 }, + {0x0727 ,KEY_0 }, + {0x0724 ,KEY_ZOOM },/* 'Square' key */ + {0x072a ,KEY_SUBTITLE },/* 'T' key */ + {0x072d ,KEY_REWIND }, + {0x0730 ,KEY_PLAYPAUSE }, + {0x0733 ,KEY_FASTFORWARD }, + {0x0736 ,KEY_RECORD }, + {0x073c ,KEY_STOP }, + {0x073f ,KEY_HELP },/* '?' key */ };static struct rc_map_list pinnacle_pctv_hd_map = { .map = { .scan = pinnacle_pctv_hd, .size =ARRAY_SIZE (pinnacle_pctv_hd), - .rc_type =RC_TYPE_UNKNOWN ,/* Legacy IR type */ + .rc_type =RC_TYPE_RC5 , .name =RC_MAP_PINNACLE_PCTV_HD , } };
PATCH 62/107 uvcvideo: Remove buffers from the queues when freeing
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sjoerd Simons <[email protected]>
commit 8ca2c80b170c47eeb55f0c2a0f2b8edf85f35d49 upstream.
When freeing memory for the video buffers also remove them from the irq & main queues.
This fixes an oops when doing the following:
open ("/dev/video", ..)VIDIOC_REQBUFSVIDIOC_QBUFVIDIOC_REQBUFS
close ()
As the second VIDIOC_REQBUFS will cause the list entries of the buffers to be cleared while they still hang around on the main and irc queues
--- drivers/media/video/uvc/uvc_queue.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/video/uvc/uvc_queue.c +2 -0
@@ -104,6 +104,8 @@ static int __uvc_free_buffers(struct uvc }if (queue->count) { +uvc_queue_cancel (queue,0 ); +INIT_LIST_HEAD (&queue->mainqueue);vfree (queue->mem); queue->count =0 ; }
PATCH 63/107 ite-cir: 8709 needs to use pnp resource 2
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jarod Wilson <[email protected]>
commit 35d136c8dab034ee14aa00d6082229b4b74607da upstream.
Thanks to the intrepid testing and debugging of Matthijs van Drunen, it was uncovered that at least some variants of the ITE8709 need to use pnp resource 2, rather than 0, for things to function properly. Resource 0 has a length of only 1, and if you try to bypass the pnp_port_len check and use it anyway (with either a length of 1 or 2), the system in question's trackpad ceased to function.
The circa lirc 0.8.7 lirc_ite8709 driver used resource 2, but the value was (amusingly) changed to 0 by way of a patch from ITE themselves, so I don't know if there may be variants where 0 actually *is* correct, but at least in this case and in the original lirc_ite8709 driver author's case, it sure looks like 2 is the right value.
This fix should probably be applied to all stable kernels with the ite-cir driver, lest we nuke more people's trackpads.
--- drivers/media/rc/ite-cir.c | 12 +++++++++--- drivers/media/rc/ite-cir.h | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/media/rc/ite-cir.c +9 -3
@@ -1357,6 +1357,7 @@ static const struct ite_dev_params ite_d {/* 0: ITE8704 */ .model = "ITE8704 CIR transceiver", .io_region_size = IT87_IOREG_LENGTH, + .io_rsrc_no = 0, .hw_tx_capable = true, .sample_period = (u32) (1000000000ULL / 115200), .tx_carrier_freq = 38000,
@@ -1381,6 +1382,7 @@ static const struct ite_dev_params ite_d {/* 1: ITE8713 */ .model = "ITE8713 CIR transceiver", .io_region_size = IT87_IOREG_LENGTH, + .io_rsrc_no = 0, .hw_tx_capable = true, .sample_period = (u32) (1000000000ULL / 115200), .tx_carrier_freq = 38000,
@@ -1405,6 +1407,7 @@ static const struct ite_dev_params ite_d {/* 2: ITE8708 */ .model = "ITE8708 CIR transceiver", .io_region_size = IT8708_IOREG_LENGTH, + .io_rsrc_no = 0, .hw_tx_capable = true, .sample_period = (u32) (1000000000ULL / 115200), .tx_carrier_freq = 38000,
@@ -1430,6 +1433,7 @@ static const struct ite_dev_params ite_d {/* 3: ITE8709 */ .model = "ITE8709 CIR transceiver", .io_region_size = IT8709_IOREG_LENGTH, + .io_rsrc_no = 2, .hw_tx_capable = true, .sample_period = (u32) (1000000000ULL / 115200), .tx_carrier_freq = 38000,
@@ -1471,6 +1475,7 @@ static int ite_probe(struct pnp_dev *pdestruct rc_dev *rdev =NULL ;int ret = -ENOMEM ;int model_no; +int io_rsrc_no;ite_dbg ("%s called" , __func__);
@@ -1500,10 +1505,11 @@ static int ite_probe(struct pnp_dev *pde/* get the description for the device */ dev_desc = &ite_dev_descs[model_no]; + io_rsrc_no = dev_desc->io_rsrc_no;/* validate pnp resources */ -if (!pnp_port_valid (pdev,0 ) || -pnp_port_len (pdev,0 ) != dev_desc->io_region_size) { +if (!pnp_port_valid (pdev, io_rsrc_no) || +pnp_port_len (pdev, io_rsrc_no) != dev_desc->io_region_size) {dev_err (&pdev->dev,"IR PNP Port not valid!\n" ); goto failure; }
@@ -1514,7 +1520,7 @@ static int ite_probe(struct pnp_dev *pde }/* store resource values */ - itdev->cir_addr =pnp_port_start (pdev,0 ); + itdev->cir_addr =pnp_port_start (pdev, io_rsrc_no); itdev->cir_irq =pnp_irq (pdev,0 );/* initialize spinlocks */
drivers/media/rc/ite-cir.h +3 -0
@@ -57,6 +57,9 @@ struct ite_dev_params {/* size of the I/O region */ int io_region_size; +/* IR pnp I/O resource number */ +int io_rsrc_no; +/* true if the hardware supports transmission */ bool hw_tx_capable;
PATCH 64/107 watchdog: mtx1-wdt: request gpio before using it
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Florian Fainelli <[email protected]>
commit 9b19d40aa3ebaf1078779da10555da2ab8512422 upstream.
Otherwise, the gpiolib autorequest feature will produce a WARN_ON():
WARNING: at drivers/gpio/gpiolib.c:101 0x8020ec6c()
autorequest GPIO-215
[...]
--- drivers/watchdog/mtx-1_wdt.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/watchdog/mtx-1_wdt.c +8 -0
@@ -211,6 +211,12 @@ static int __devinit mtx1_wdt_probe(struint ret; mtx1_wdt_device.gpio = pdev->resource[0 ].start; + ret =gpio_request_one (mtx1_wdt_device.gpio, +GPIOF_OUT_INIT_HIGH ,"mtx1-wdt" ); +if (ret <0 ) { +dev_err (&pdev->dev,"failed to request gpio" ); +return ret; + }spin_lock_init (&mtx1_wdt_device.lock);init_completion (&mtx1_wdt_device.stop);
@@ -236,6 +242,8 @@ static int __devexit mtx1_wdt_remove(str mtx1_wdt_device.queue =0 ;wait_for_completion (&mtx1_wdt_device.stop); } + +gpio_free (mtx1_wdt_device.gpio);misc_deregister (&mtx1_wdt_misc);return 0 ; }
PATCH 65/107 nfsd: v4 support requires CRYPTO
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Randy Dunlap <[email protected]>
commit be1f4084b4824301e640e81d63b6275cd99ee6a1 upstream.
nfsd V4 support uses crypto interfaces, so select CRYPTO to fix build errors in 2.6.39:
ERROR: "crypto_destroy_tfm" [fs/nfsd/nfsd.ko] undefined!
ERROR: "crypto_alloc_base" [fs/nfsd/nfsd.ko] undefined!
--- fs/nfsd/Kconfig | 1 + 1 file changed, 1 insertion(+)
fs/nfsd/Kconfig +1 -0
@@ -82,6 +82,7 @@ config NFSD_V4 select NFSD_V3 select FS_POSIX_ACL select SUNRPC_GSS + select CRYPTO help This option enables support in your system's NFS server for version 4 of the NFS protocol (RFC 3530).
PATCH 66/107 nfsd: fix dependency of nfsd on auth_rpcgss
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit b084f598df36b62dfae83c10ed17f0b66b50f442 upstream.
Commit b0b0c0a26e84 "nfsd: add proc file listing kernel's gss_krb5 enctypes" added an nunnecessary dependency of nfsd on the auth_rpcgss module.
It's a little ad hoc, but since the only piece of information nfsd needs from rpcsec_gss_krb5 is a single static string, one solution is just to share it with an include file.
--- fs/nfsd/nfsctl.c | 19 ++++++------------- include/linux/sunrpc/gss_krb5_enctypes.h | 4 ++++ net/sunrpc/auth_gss/gss_krb5_mech.c | 3 ++- 3 files changed, 12 insertions(+), 14 deletions(-)
fs/nfsd/nfsctl.c +6 -13
@@ -13,6 +13,7 @@#include <linux/lockd/lockd.h> #include <linux/sunrpc/clnt.h> #include <linux/sunrpc/gss_api.h> +#include <linux/sunrpc/gss_krb5_enctypes.h> #include "idmap.h" #include "nfsd.h"
@@ -189,18 +190,10 @@ static struct file_operations export_fea .release = single_release, }; -#ifdef CONFIG_SUNRPC_GSS +#if defined(CONFIG_SUNRPC_GSS ) || defined(CONFIG_SUNRPC_GSS_MODULE )static int supported_enctypes_show (struct seq_file *m,void *v) { -struct gss_api_mech *k5mech; - - k5mech =gss_mech_get_by_name ("krb5" ); -if (k5mech ==NULL ) - goto out; -if (k5mech->gm_upcall_enctypes !=NULL ) -seq_printf (m, k5mech->gm_upcall_enctypes); -gss_mech_put (k5mech); -out: +seq_printf (m,KRB5_SUPPORTED_ENCTYPES );return 0 ; }
@@ -215,7 +208,7 @@ static struct file_operations supported_ .llseek = seq_lseek, .release = single_release, }; -#endif /* CONFIG_SUNRPC_GSS */ +#endif /* CONFIG_SUNRPC_GSS or CONFIG_SUNRPC_GSS_MODULE */ extern int nfsd_pool_stats_open (struct inode *inode,struct file *file);extern int nfsd_pool_stats_release (struct inode *inode,struct file *file);
@@ -1427,9 +1420,9 @@ static int nfsd_fill_super(struct super_ [NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO}, [NFSD_MaxBlkSize] = {"max_block_size" , &transaction_ops,S_IWUSR |S_IRUGO }, -#ifdef CONFIG_SUNRPC_GSS +#if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE) [NFSD_SupportedEnctypes] = {"supported_krb5_enctypes" , &supported_enctypes_ops,S_IRUGO }, -#endif /* CONFIG_SUNRPC_GSS */ +#endif /* CONFIG_SUNRPC_GSS or CONFIG_SUNRPC_GSS_MODULE */ #ifdef CONFIG_NFSD_V4 [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_Gracetime] = {"nfsv4gracetime", &transaction_ops, S_IWUSR|S_IRUSR},
include/linux/sunrpc/gss_krb5_enctypes.h new file +4 -0
@@ -0,0 +1,4 @@ +/* +* Dumb way to share this static piece of information with nfsd +*/ +#define KRB5_SUPPORTED_ENCTYPES "18,17,16,23,3,1,2"
net/sunrpc/auth_gss/gss_krb5_mech.c +2 -1
@@ -43,6 +43,7 @@#include <linux/sunrpc/gss_krb5.h> #include <linux/sunrpc/xdr.h> #include <linux/crypto.h> +#include <linux/sunrpc/gss_krb5_enctypes.h> #ifdef RPC_DEBUG # define RPCDBG_FACILITY RPCDBG_AUTH
@@ -750,7 +751,7 @@ static struct gss_api_mech gss_kerberos_ .gm_ops = &gss_kerberos_ops, .gm_pf_num = ARRAY_SIZE(gss_kerberos_pfs), .gm_pfs = gss_kerberos_pfs, - .gm_upcall_enctypes = "18,17,16,23,3,1,2", + .gm_upcall_enctypes = KRB5_SUPPORTED_ENCTYPES, };static int __init init_kerberos_module (void )
PATCH 67/107 nfsd: link returns nfserr_delay when breaking lease
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Casey Bodley <[email protected]>
commit 7d751f6f8c679f51b73d01a1b5269347a929004c upstream.
fix for commit 4795bb37effb7b8fe77e2d2034545d062d3788a8, nfsd: break lease on unlink, link, and rename
if the LINK operation breaks a delegation, it returns NFS4ERR_NOENT (which is not a valid error in rfc 5661) instead of NFS4ERR_DELAY. the return value of nfsd_break_lease() in nfsd_link() must be converted from host_err to err
--- fs/nfsd/vfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfsd/vfs.c +3 -1
@@ -1653,8 +1653,10 @@ nfsd_link(struct svc_rqst *rqstp, structif (!dold->d_inode) goto out_drop_write; host_err =nfsd_break_lease (dold->d_inode); -if (host_err) +if (host_err) { + err =nfserrno (host_err); goto out_drop_write; + } host_err =vfs_link (dold, dirp, dnew);if (!host_err) { err =nfserrno (commit_metadata (ffhp));
PATCH 68/107 nfsd4: fix break_lease flags on nfsd open
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 105f4622104848ff1ee1f644d661bef9dec3eb27 upstream.
Thanks to Casey Bodley for pointing out that on a read open we pass 0, instead of O_RDONLY, to break_lease, with the result that a read open is treated like a write open for the purposes of lease breaking!
--- fs/nfsd/vfs.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
fs/nfsd/vfs.c +9 -6
@@ -699,7 +699,15 @@ nfsd_access(struct svc_rqst *rqstp, stru }#endif /* CONFIG_NFSD_V3 */ +static int nfsd_open_break_lease (struct inode *inode,int access) +{ +unsigned int mode; +if (access &NFSD_MAY_NOT_BREAK_LEASE ) +return 0 ; + mode = (access &NFSD_MAY_WRITE ) ?O_WRONLY :O_RDONLY ; +return break_lease (inode, mode |O_NONBLOCK ); +}/* * Open an existing file or directory.
@@ -747,12 +755,7 @@ nfsd_open(struct svc_rqst *rqstp, structif (!inode->i_fop) goto out; -/* -* Check to see if there are any leases on this file. -* This may block while leases are broken. -*/ -if (!(access &NFSD_MAY_NOT_BREAK_LEASE )) - host_err =break_lease (inode,O_NONBLOCK | ((access &NFSD_MAY_WRITE ) ?O_WRONLY :0 )); + host_err =nfsd_open_break_lease (inode, access);if (host_err)/* NOMEM or WOULDBLOCK */ goto out_nfserr;
PATCH 69/107 NFSv4.1: allow nfs_fhget to succeed with mounted on fileid
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andy Adamson <[email protected]>
commit 533eb4611c9eea53072eb6a61d5a6393b6a77ed7 upstream.
Commit 28331a46d88459788c8fca72dbb0415cd7f514c9 "Ensure we request the ordinary fileid when doing readdirplus"
changed the meaning of NFS_ATTR_FATTR_FILEID which used to be set when FATTR4_WORD1_MOUNTED_ON_FILED was requested.
Allow nfs_fhget to succeed with only a mounted on fileid when crossing a mountpoint or a referral.
Ask for the fileid of the absent file system if mounted_on_fileid is not supported.
--- fs/nfs/inode.c | 3 ++- fs/nfs/internal.h | 11 +++++++++++ fs/nfs/nfs4proc.c | 33 +++++++++++++++++++++++---------- 3 files changed, 36 insertions(+), 11 deletions(-)
fs/nfs/inode.c +2 -1
@@ -256,7 +256,8 @@ nfs_fhget(struct super_block *sb, structnfs_attr_check_mountpoint (sb, fattr); -if ((fattr->valid &NFS_ATTR_FATTR_FILEID ) ==0 && (fattr->valid &NFS_ATTR_FATTR_MOUNTPOINT ) ==0 ) +if (((fattr->valid &NFS_ATTR_FATTR_FILEID ) ==0 ) && + !nfs_attr_use_mounted_on_fileid (fattr)) goto out_no_inode;if ((fattr->valid &NFS_ATTR_FATTR_TYPE ) ==0 ) goto out_no_inode;
fs/nfs/internal.h +11 -0
@@ -45,6 +45,17 @@ static inline void nfs_attr_check_mountp fattr->valid |=NFS_ATTR_FATTR_MOUNTPOINT ; } +static inline int nfs_attr_use_mounted_on_fileid (struct nfs_fattr *fattr) +{ +if (((fattr->valid &NFS_ATTR_FATTR_MOUNTED_ON_FILEID ) ==0 ) || + (((fattr->valid &NFS_ATTR_FATTR_MOUNTPOINT ) ==0 ) && + ((fattr->valid &NFS_ATTR_FATTR_V4_REFERRAL ) ==0 ))) +return 0 ; + + fattr->fileid = fattr->mounted_on_fileid; +return 1 ; +} +struct nfs_clone_mount {const struct super_block *sb;const struct dentry *dentry;
fs/nfs/nfs4proc.c +23 -10
@@ -2265,12 +2265,14 @@ static int nfs4_proc_get_root(struct nfsreturn nfs4_map_errors (status); } +static void nfs_fixup_referral_attributes (struct nfs_fattr *fattr);/* * Get locations and (maybe) other attributes of a referral. * Note that we'll actually follow the referral later when * we detect fsid mismatch in inode revalidation */ -static int nfs4_get_referral (struct inode *dir,const struct qstr *name,struct nfs_fattr *fattr,struct nfs_fh *fhandle) +static int nfs4_get_referral (struct inode *dir,const struct qstr *name, +struct nfs_fattr *fattr,struct nfs_fh *fhandle) {int status = -ENOMEM ;struct page *page =NULL ;
@@ -2288,15 +2290,16 @@ static int nfs4_get_referral(struct inod goto out;/* Make sure server returned a different fsid for the referral */ if (nfs_fsid_equal (&NFS_SERVER (dir)->fsid, &locations->fattr.fsid)) { -dprintk ("%s: server did not return a different fsid for a referral at %s\n" , __func__, name->name); +dprintk ("%s: server did not return a different fsid for" +" a referral at %s\n" , __func__, name->name); status = -EIO ; goto out; } +/* Fixup attributes for the nfs_lookup() call to nfs_fhget() */ +nfs_fixup_referral_attributes (&locations->fattr); +/* replace the lookup nfs_fattr with the locations nfs_fattr */ memcpy (fattr, &locations->fattr,sizeof (struct nfs_fattr )); - fattr->valid |=NFS_ATTR_FATTR_V4_REFERRAL ; -if (!fattr->mode) - fattr->mode =S_IFDIR ;memset (fhandle,0 ,sizeof (struct nfs_fh )); out:if (page)
@@ -4657,11 +4660,15 @@ static size_t nfs4_xattr_list_nfs4_acl(sreturn len; } +/* +* nfs_fhget will use either the mounted_on_fileid or the fileid +*/ static void nfs_fixup_referral_attributes (struct nfs_fattr *fattr) { -if (!((fattr->valid &NFS_ATTR_FATTR_FILEID ) && - (fattr->valid &NFS_ATTR_FATTR_FSID ) && - (fattr->valid &NFS_ATTR_FATTR_V4_REFERRAL ))) +if (!(((fattr->valid &NFS_ATTR_FATTR_MOUNTED_ON_FILEID ) || + (fattr->valid &NFS_ATTR_FATTR_FILEID )) && + (fattr->valid &NFS_ATTR_FATTR_FSID ) && + (fattr->valid &NFS_ATTR_FATTR_V4_REFERRAL )))return ; fattr->valid |= NFS_ATTR_FATTR_TYPE | NFS_ATTR_FATTR_MODE |
@@ -4676,7 +4683,6 @@ int nfs4_proc_fs_locations(struct inodestruct nfs_server *server =NFS_SERVER (dir);u32 bitmask[2 ] = { [0 ] =FATTR4_WORD0_FSID |FATTR4_WORD0_FS_LOCATIONS , - [1 ] =FATTR4_WORD1_MOUNTED_ON_FILEID , };struct nfs4_fs_locations_arg args = { .dir_fh =NFS_FH (dir),
@@ -4695,11 +4701,18 @@ int nfs4_proc_fs_locations(struct inodeint status;dprintk ("%s: start\n" , __func__); + +/* Ask for the fileid of the absent filesystem if mounted_on_fileid +* is not supported */ +if (NFS_SERVER (dir)->attr_bitmask[1 ] &FATTR4_WORD1_MOUNTED_ON_FILEID ) + bitmask[1 ] |=FATTR4_WORD1_MOUNTED_ON_FILEID ; +else + bitmask[0 ] |=FATTR4_WORD0_FILEID ; +nfs_fattr_init (&fs_locations->fattr); fs_locations->server = server; fs_locations->nlocations =0 ; status =nfs4_call_sync (server->client, server, &msg, &args.seq_args, &res.seq_res,0 ); -nfs_fixup_referral_attributes (&fs_locations->fattr);dprintk ("%s: returned status = %d\n" , __func__, status);return status; }
PATCH 70/107 NFSv4.1: allow zero fh array in filelayout decode layout
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andy Adamson <[email protected]>
commit cec765cf5891c7fc3d905832b481bfb6fd55825d upstream.
--- fs/nfs/nfs4filelayout.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
fs/nfs/nfs4filelayout.c +10 -5
@@ -554,13 +554,18 @@ filelayout_decode_layout(struct pnfs_lay __func__, nfl_util, fl->num_fh, fl->first_stripe_index, fl->pattern_offset); -if (!fl->num_fh) +/* Note that a zero value for num_fh is legal for STRIPE_SPARSE. +* Futher checking is done in filelayout_check_layout */ +if (fl->num_fh <0 || fl->num_fh > +max (NFS4_PNFS_MAX_STRIPE_CNT ,NFS4_PNFS_MAX_MULTI_CNT )) goto out_err; - fl->fh_array =kzalloc (fl->num_fh *sizeof (struct nfs_fh *), - gfp_flags); -if (!fl->fh_array) - goto out_err; +if (fl->num_fh >0 ) { + fl->fh_array =kzalloc (fl->num_fh *sizeof (struct nfs_fh *), + gfp_flags); +if (!fl->fh_array) + goto out_err; + }for (i =0 ; i < fl->num_fh; i++) {/* Do we want to use a mempool here? */
PATCH 71/107 NFSv4: Fix a readdir regression
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Trond Myklebust <[email protected]>
commit ee7b75fc4f3ae49e1f25bf56219bb5de3c29afaf upstream.
Commit 7ebb9315 (NFS: use secinfo when crossing mountpoints) introduces a regression when decoding an NFSv4 readdir entry that sets the rdattr_error field.
By treating the resulting value as if it is a decoding error, the current code may cause us to skip valid readdir entries.
--- fs/nfs/nfs4xdr.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/nfs/nfs4xdr.c +7 -7
@@ -3030,7 +3030,7 @@ out_overflow:return -EIO ; } -static int decode_attr_error (struct xdr_stream *xdr,uint32_t *bitmap) +static int decode_attr_error (struct xdr_stream *xdr,uint32_t *bitmap,int32_t *res) {__be32 *p;
@@ -3041,7 +3041,7 @@ static int decode_attr_error(struct xdr_if (unlikely (!p)) goto out_overflow; bitmap[0 ] &= ~FATTR4_WORD0_RDATTR_ERROR ; -return -be32_to_cpup (p); + *res = -be32_to_cpup (p); }return 0 ; out_overflow:
@@ -4002,6 +4002,7 @@ static int decode_getfattr_attrs(structint status;umode_t fmode =0 ;uint32_t type; +int32_t err; status =decode_attr_type (xdr, bitmap, &type);if (status <0 )
@@ -4027,13 +4028,12 @@ static int decode_getfattr_attrs(struct goto xdr_error; fattr->valid |= status; - status =decode_attr_error (xdr, bitmap); -if (status == -NFS4ERR_WRONGSEC ) { -nfs_fixup_secinfo_attributes (fattr, fh); - status =0 ; - } + err =0 ; + status =decode_attr_error (xdr, bitmap, &err);if (status <0 ) goto xdr_error; +if (err == -NFS4ERR_WRONGSEC ) +nfs_fixup_secinfo_attributes (fattr, fh); status =decode_attr_filehandle (xdr, bitmap, fh);if (status <0 )
PATCH 72/107 Input: properly assign return value of clamp() macro.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hans Petter Selasky <[email protected]>
commit 8c127f0717b438e6abc3d92d4ae248c4224b9dcb upstream.
--- drivers/input/input.c | 2 +- drivers/input/mousedev.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/input/input.c +1 -1
@@ -1757,7 +1757,7 @@ static unsigned int input_estimate_event }else if (test_bit (ABS_MT_TRACKING_ID , dev->absbit)) { mt_slots = dev->absinfo[ABS_MT_TRACKING_ID ].maximum - dev->absinfo[ABS_MT_TRACKING_ID ].minimum +1 , -clamp (mt_slots,2 ,32 ); + mt_slots =clamp (mt_slots,2 ,32 ); }else if (test_bit (ABS_MT_POSITION_X , dev->absbit)) { mt_slots =2 ; }else {
drivers/input/mousedev.c +2 -2
@@ -187,7 +187,7 @@ static void mousedev_abs_event(struct inif (size ==0 ) size = xres ? :1 ; -clamp (value, min, max); + value =clamp (value, min, max); mousedev->packet.x = ((value - min) * xres) / size; mousedev->packet.abs_event =1 ;
@@ -201,7 +201,7 @@ static void mousedev_abs_event(struct inif (size ==0 ) size = yres ? :1 ; -clamp (value, min, max); + value =clamp (value, min, max); mousedev->packet.y = yres - ((value - min) * yres) / size; mousedev->packet.abs_event =1 ;
PATCH 73/107 debugobjects: Fix boot crash when kmemleak and debugobjects enabled
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Marcin Slusarz <[email protected]>
commit 161b6ae0e067e421b20bb35caf66bdb405c929ac upstream.
Order of initialization look like this:
...
debugobjects
kmemleak
...(lots of other subsystems)...
workqueues (through early initcall)
...
debugobjects use schedule_work for batch freeing of its data and kmemleak heavily use debugobjects, so when it comes to freeing and workqueues were not initialized yet, kernel crashes:
BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<ffffffff810854d1>] __queue_work+0x29/0x41a [<ffffffff81085910>] queue_work_on+0x16/0x1d [<ffffffff81085abc>] queue_work+0x29/0x55 [<ffffffff81085afb>] schedule_work+0x13/0x15 [<ffffffff81242de1>] free_object+0x90/0x95 [<ffffffff81242f6d>] debug_check_no_obj_freed+0x187/0x1d3 [<ffffffff814b6504>] ? _raw_spin_unlock_irqrestore+0x30/0x4d [<ffffffff8110bd14>] ? free_object_rcu+0x68/0x6d [<ffffffff8110890c>] kmem_cache_free+0x64/0x12c [<ffffffff8110bd14>] free_object_rcu+0x68/0x6d [<ffffffff810b58bc>] __rcu_process_callbacks+0x1b6/0x2d9
...
because system_wq is NULL.
Fix it by checking if workqueues susbystem was initialized before using.
--- lib/debugobjects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/debugobjects.c +1 -1
@@ -198,7 +198,7 @@ static void free_object(struct debug_obj* initialized: */ if (obj_pool_free >ODEBUG_POOL_SIZE && obj_cache) - sched = !work_pending (&debug_obj_work); + sched =keventd_up () && !work_pending (&debug_obj_work);hlist_add_head (&obj->node, &obj_pool); obj_pool_free++; obj_pool_used--;
PATCH 74/107 cfq-iosched: fix locking around ioc->ioc_data assignment
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jens Axboe <[email protected]>
commit ab4bd22d3cce6977dc039664cc2d052e3147d662 upstream.
Since we are modifying this RCU pointer, we need to hold the lock protecting it around it.
This fixes a potential reuse and double free of a cfq io_context structure. The bug has been in CFQ for a long time, it hit very few people but those it did hit seemed to see it a lot.
Tracked in RH bugzilla here:
https://bugzilla.redhat.com/show_bug.cgi?id=577968
Credit goes to Paul Bolle for figuring out that the issue was around the one-hit ioc->ioc_data cache. Thanks to his hard work the issue is now fixed.
--- block/cfq-iosched.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
block/cfq-iosched.c +4 -1
@@ -2704,8 +2704,11 @@ static void __cfq_exit_single_io_contextsmp_wmb (); cic->key =cfqd_dead_key (cfqd); -if (ioc->ioc_data == cic) +if (rcu_dereference (ioc->ioc_data) == cic) { +spin_lock (&ioc->lock);rcu_assign_pointer (ioc->ioc_data,NULL ); +spin_unlock (&ioc->lock); + }if (cic->cfqq[BLK_RW_ASYNC ]) {cfq_exit_cfqq (cfqd, cic->cfqq[BLK_RW_ASYNC ]);
PATCH 75/107 cfq-iosched: fix a rcu warning
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Shaohua Li <[email protected]>
commit 3181faa85bda3dc3f5e630a1846526c9caaa38e3 upstream.
I got a rcu warnning at boot. the ioc->ioc_data is rcu_deferenced, but doesn't hold rcu_read_lock.
--- block/cfq-iosched.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
block/cfq-iosched.c +4 -1
@@ -2704,11 +2704,14 @@ static void __cfq_exit_single_io_contextsmp_wmb (); cic->key =cfqd_dead_key (cfqd); +rcu_read_lock ();if (rcu_dereference (ioc->ioc_data) == cic) { +rcu_read_unlock ();spin_lock (&ioc->lock);rcu_assign_pointer (ioc->ioc_data,NULL );spin_unlock (&ioc->lock); - } + }else +rcu_read_unlock ();if (cic->cfqq[BLK_RW_ASYNC ]) {cfq_exit_cfqq (cfqd, cic->cfqq[BLK_RW_ASYNC ]);
PATCH 76/107 cfq-iosched: make code consistent
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Shaohua Li <[email protected]>
commit 726e99ab88db059fe1422e15376ae404f8c66eb4 upstream.
ioc->ioc_data is rcu protectd, so uses correct API to access it. This doesn't change any behavior, but just make code consistent.
--- block/cfq-iosched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/cfq-iosched.c +2 -1
@@ -3018,7 +3018,8 @@ cfq_drop_dead_cic(struct cfq_data *cfqd,spin_lock_irqsave (&ioc->lock, flags); -BUG_ON (ioc->ioc_data == cic); +BUG_ON (rcu_dereference_check (ioc->ioc_data, +lockdep_is_held (&ioc->lock)) == cic);radix_tree_delete (&ioc->radix_root, cfqd->cic_index);hlist_del_rcu (&cic->cic_list);
PATCH 77/107 block: use the passed in @bdev when claiming if partno is zero
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tejun Heo <[email protected]>
commit d4c208b86b8be4254eba0e74071496e599f94639 upstream.
6b4517a791 (block: implement bd_claiming and claiming block) introduced claiming block to support O_EXCL blkdev opens properly.
bd_start_claiming() looks up the part 0 bdev and starts claiming block. The function assumed that there is only one part 0 bdev and always used bdget_disk(disk, 0) to look it up; unfortunately, this isn't true for some drivers (floppy) which use multiple block devices to denote different operating parameters for the same physical device. There can be multiple part 0 bdev's for the same device number.
This incorrect assumption caused the wrong bdev to be used during claiming leading to unbalanced bd_holders as reported in the following bug.
https://bugzilla.kernel.org/show_bug.cgi?id=28522
This patch updates bd_start_claiming() such that it uses the bdev specified as argument if its partno is zero.
Note that this means that different bdev's can be used for the same device and O_EXCL check can be effectively bypassed. It has always been broken that way and floppy is fortunately on its way out. Leave that breakage alone.
--- fs/block_dev.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
fs/block_dev.c +13 -1
@@ -762,7 +762,19 @@ static struct block_device *bd_start_claif (!disk)return ERR_PTR (-ENXIO ); - whole =bdget_disk (disk,0 ); +/* +* Normally, @bdev should equal what's returned from bdget_disk() +* if partno is 0; however, some drivers (floppy) use multiple +* bdev's for the same physical device and @bdev may be one of the +* aliases. Keep @bdev if partno is 0. This means claimer +* tracking is broken for those devices but it has always been that +* way. +*/ +if (partno) + whole =bdget_disk (disk,0 ); +else + whole =bdgrab (bdev); +module_put (disk->fops->owner);put_disk (disk);if (!whole)
PATCH 78/107 PCI / PM: Block races between runtime PM and system sleep
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit a5f76d5eba157bf637beb2dd18026db2917c512e upstream.
After commit e8665002477f0278f84f898145b1f141ba26ee26 (PM: Allow pm_runtime_suspend() to succeed during system suspend) it is possible that a device resumed by the pm_runtime_resume(dev) in pci_pm_prepare() will be suspended immediately from a work item, timer function or otherwise, defeating the very purpose of calling pm_runtime_resume(dev) from there. To prevent that from happening it is necessary to increment the runtime PM usage counter of the device by replacing pm_runtime_resume() with pm_runtime_get_sync(). Moreover, the incremented runtime PM usage counter has to be decremented by the corresponding pci_pm_complete(), via pm_runtime_put_sync().
--- drivers/pci/pci-driver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/pci-driver.c +3 -1
@@ -624,7 +624,7 @@ static int pci_pm_prepare(struct device* system from the sleep state, we'll have to prevent it from signaling * wake-up. */ -pm_runtime_resume (dev); +pm_runtime_get_sync (dev);if (drv && drv->pm && drv->pm->prepare) error = drv->pm->prepare (dev);
@@ -638,6 +638,8 @@ static void pci_pm_complete(struct devicif (drv && drv->pm && drv->pm->complete) drv->pm->complete (dev); + + pm_runtime_put_sync(dev); }#else /* !CONFIG_PM_SLEEP */
PATCH 79/107 PM: Rename dev_pm_info.in_suspend to is_prepared
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
commit f76b168b6f117a49d36307053e1acbe30580ea5b upstream.
This patch (as1473) renames the "in_suspend" field in struct dev_pm_info to "is_prepared", in preparation for an upcoming change. The new name is more descriptive of what the field really means.
--- drivers/base/power/main.c | 14 +++++++++----- drivers/usb/core/driver.c | 6 +++--- include/linux/device.h | 4 ++-- include/linux/pm.h | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-)
drivers/base/power/main.c +9 -5
@@ -57,7 +57,7 @@ static int async_error;*/ void device_pm_init (struct device *dev) { - dev->power.in_suspend = false; + dev->power.is_prepared = false;init_completion (&dev->power.completion);complete_all (&dev->power.completion); dev->power.wakeup =NULL ;
@@ -91,7 +91,7 @@ void device_pm_add(struct device *dev)pr_debug ("PM: Adding info for %s:%s\n" , dev->bus ? dev->bus->name :"No Bus" ,dev_name (dev));mutex_lock (&dpm_list_mtx); -if (dev->parent && dev->parent->power.in_suspend) +if (dev->parent && dev->parent->power.is_prepared)dev_warn (dev,"parent %s should not be sleeping\n" ,dev_name (dev->parent));list_add_tail (&dev->power.entry, &dpm_list);
@@ -513,7 +513,11 @@ static int device_resume(struct device *dpm_wait (dev->parent, async);device_lock (dev); - dev->power.in_suspend = false; +/* +* This is a fib. But we'll allow new children to be added below +* a resumed device, even if the device hasn't been completed yet. +*/ + dev->power.is_prepared = false;if (dev->pwr_domain) {pm_dev_dbg (dev, state,"power domain " );
@@ -668,7 +672,7 @@ static void dpm_complete(pm_message_t ststruct device *dev =to_device (dpm_prepared_list.prev);get_device (dev); - dev->power.in_suspend = false; + dev->power.is_prepared = false;list_move (&dev->power.entry, &list);mutex_unlock (&dpm_list_mtx);
@@ -1037,7 +1041,7 @@ static int dpm_prepare(pm_message_t statput_device (dev);break ; } - dev->power.in_suspend = true; + dev->power.is_prepared = true;if (!list_empty (&dev->power.entry))list_move_tail (&dev->power.entry, &dpm_prepared_list);put_device (dev);
drivers/usb/core/driver.c +3 -3
@@ -375,7 +375,7 @@ static int usb_unbind_interface(struct d* Just re-enable it without affecting the endpoint toggles. */ usb_enable_interface (udev, intf, false); - }else if (!error && !intf->dev.power.in_suspend) { + }else if (!error && !intf->dev.power.is_prepared) { r =usb_set_interface (udev, intf->altsetting[0 ]. desc.bInterfaceNumber,0 );if (r <0 )
@@ -960,7 +960,7 @@ void usb_rebind_intf(struct usb_interfac }/* Try to rebind the interface */ -if (!intf->dev.power.in_suspend) { +if (!intf->dev.power.is_prepared) { intf->needs_binding =0 ; rc =device_attach (&intf->dev);if (rc <0 )
@@ -1107,7 +1107,7 @@ static int usb_resume_interface(struct uif (intf->condition ==USB_INTERFACE_UNBOUND ) {/* Carry out a deferred switch to altsetting 0 */ -if (intf->needs_altsetting0 && !intf->dev.power.in_suspend) { +if (intf->needs_altsetting0 && !intf->dev.power.is_prepared) {usb_set_interface (udev, intf->altsetting[0 ]. desc.bInterfaceNumber,0 ); intf->needs_altsetting0 =0 ;
include/linux/device.h +2 -2
@@ -506,13 +506,13 @@ static inline int device_is_registered(sstatic inline void device_enable_async_suspend (struct device *dev) { -if (!dev->power.in_suspend) +if (!dev->power.is_prepared) dev->power.async_suspend = true; }static inline void device_disable_async_suspend (struct device *dev) { -if (!dev->power.in_suspend) +if (!dev->power.is_prepared) dev->power.async_suspend = false; }
include/linux/pm.h +1 -1
@@ -425,7 +425,7 @@ struct dev_pm_info {pm_message_t power_state; unsigned int can_wakeup:1; unsigned int async_suspend:1; - unsigned int in_suspend:1; /* Owned by the PM core */ + bool is_prepared:1; /* Owned by the PM core */spinlock_t lock;#ifdef CONFIG_PM_SLEEP struct list_head entry;
PATCH 80/107 PM: Fix async resume following suspend failure
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
commit 6d0e0e84f66d32c33511984dd3badd32364b863c upstream.
The PM core doesn't handle suspend failures correctly when it comes to asynchronously suspended devices. These devices are moved onto the dpm_suspended_list as soon as the corresponding async thread is started up, and they remain on the list even if they fail to suspend or the sleep transition is cancelled before they get suspended. As a result, when the PM core unwinds the transition, it tries to resume the devices even though they were never suspended.
This patch (as1474) fixes the problem by adding a new "is_suspended" flag to dev_pm_info. Devices are resumed only if the flag is set.
[rjw:
* Moved the dev->power.is_suspended check into device_resume(), because we need to complete dev->power.completion and clear dev->power.is_prepared too for devices whose dev->power.is_suspended flags are unset.
* Fixed __device_suspend() to avoid setting dev->power.is_suspended if async_error is different from zero.]
--- drivers/base/power/main.c | 14 ++++++++++++-- include/linux/pm.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/base/power/main.c +12 -2
@@ -58,6 +58,7 @@ static int async_error;void device_pm_init (struct device *dev) { dev->power.is_prepared = false; + dev->power.is_suspended = false;init_completion (&dev->power.completion);complete_all (&dev->power.completion); dev->power.wakeup =NULL ;
@@ -519,6 +520,9 @@ static int device_resume(struct device **/ dev->power.is_prepared = false; +if (!dev->power.is_suspended) + goto Unlock; +if (dev->pwr_domain) {pm_dev_dbg (dev, state,"power domain " );pm_op (dev, &dev->pwr_domain->ops, state);
@@ -553,6 +557,9 @@ static int device_resume(struct device * } End: + dev->power.is_suspended = false; + + Unlock:device_unlock (dev);complete_all (&dev->power.completion);
@@ -838,11 +845,11 @@ static int __device_suspend(struct devicdevice_lock (dev);if (async_error) - goto End; + goto Unlock;if (pm_wakeup_pending ()) { async_error = -EBUSY ; - goto End; + goto Unlock; }if (dev->type && dev->type->pm) {
@@ -880,6 +887,9 @@ static int __device_suspend(struct devic } End: + dev->power.is_suspended = !error; + + Unlock:device_unlock (dev);complete_all (&dev->power.completion);
include/linux/pm.h +1 -0
@@ -426,6 +426,7 @@ struct dev_pm_info { unsigned int can_wakeup:1; unsigned int async_suspend:1; bool is_prepared:1; /* Owned by the PM core */ + bool is_suspended:1; /* Ditto */spinlock_t lock;#ifdef CONFIG_PM_SLEEP struct list_head entry;
PATCH 81/107 PM / Hibernate: Fix free_unnecessary_pages()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit 4d4cf23cdde2f8f9324f5684a7f349e182039529 upstream.
There is a bug in free_unnecessary_pages() that causes it to attempt to free too many pages in some cases, which triggers the BUG_ON() in memory_bm_clear_bit() for copy_bm. Namely, if count_data_pages() is initially greater than alloc_normal, we get to_free_normal equal to 0 and "save" greater from 0. In that case, if the sum of "save" and count_highmem_pages() is greater than alloc_highmem, we subtract a positive number from to_free_normal. Hence, since to_free_normal was 0 before the subtraction and is an unsigned int, the result is converted to a huge positive number that is used as the number of pages to free.
Fix this bug by checking if to_free_normal is actually greater than or equal to the number we're going to subtract from it.
--- kernel/power/snapshot.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/power/snapshot.c +5 -1
@@ -1199,7 +1199,11 @@ static void free_unnecessary_pages(void) to_free_highmem = alloc_highmem - save; }else { to_free_highmem =0 ; - to_free_normal -= save - alloc_highmem; + save -= alloc_highmem; +if (to_free_normal > save) + to_free_normal -= save; +else + to_free_normal =0 ; }memory_bm_position_reset (©_bm);
PATCH 82/107 KEYS: Fix error handling in construct_key_and_link()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Howells <[email protected]>
commit b1d7dd80aadb9042e83f9778b484a2f92e0b04d4 upstream.
Fix error handling in construct_key_and_link().
If construct_alloc_key() returns an error, it shouldn't pass out through the normal path as the key_serial() called by the kleave() statement will oops when it gets an error code in the pointer:
BUG: unable to handle kernel paging request at ffffffffffffff84 IP: [<ffffffff8120b401>] request_key_and_link+0x4d7/0x52f .. Call Trace: [<ffffffff8120b52c>] request_key+0x41/0x75 [<ffffffffa00ed6e8>] cifs_get_spnego_key+0x206/0x226 [cifs] [<ffffffffa00eb0c9>] CIFS_SessSetup+0x511/0x1234 [cifs] [<ffffffffa00d9799>] cifs_setup_session+0x90/0x1ae [cifs] [<ffffffffa00d9c02>] cifs_get_smb_ses+0x34b/0x40f [cifs] [<ffffffffa00d9e05>] cifs_mount+0x13f/0x504 [cifs] [<ffffffffa00caabb>] cifs_do_mount+0xc4/0x672 [cifs] [<ffffffff8113ae8c>] mount_fs+0x69/0x155 [<ffffffff8114ff0e>] vfs_kern_mount+0x63/0xa0 [<ffffffff81150be2>] do_kern_mount+0x4d/0xdf [<ffffffff81152278>] do_mount+0x63c/0x69f [<ffffffff8115255c>] sys_mount+0x88/0xc2 [<ffffffff814fbdc2>] system_call_fastpath+0x16/0x1b
--- security/keys/request_key.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
security/keys/request_key.c +2 -1
@@ -470,7 +470,7 @@ static struct key *construct_key_and_lin }else if (ret == -EINPROGRESS ) { ret =0 ; }else { - key =ERR_PTR (ret); + goto couldnt_alloc_key; }key_put (dest_keyring);
@@ -480,6 +480,7 @@ static struct key *construct_key_and_lin construction_failed:key_negate_and_link (key, key_negative_timeout,NULL ,NULL );key_put (key); +couldnt_alloc_key:key_put (dest_keyring);kleave (" = %d" , ret);return ERR_PTR (ret);
PATCH 83/107 i2c-taos-evm: Fix log messages
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jean Delvare <[email protected]>
commit 9b640f2e154268cb516efcaf9c434f2e73c6783e upstream.
* Print all error and information messages even when debugging is disabled.
* Don't use adapter device to log messages before it is ready.
--- drivers/i2c/busses/i2c-taos-evm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-taos-evm.c +4 -4
@@ -234,7 +234,7 @@ static int taos_connect(struct serio *seif (taos->state !=TAOS_STATE_IDLE ) { err = -ENODEV ; -dev_dbg (&serio->dev,"TAOS EVM reset failed (state=%d, " +dev_err (&serio->dev,"TAOS EVM reset failed (state=%d, " "pos=%d)\n" , taos->state, taos->pos); goto exit_close; }
@@ -255,7 +255,7 @@ static int taos_connect(struct serio *se msecs_to_jiffies(250));if (taos->state !=TAOS_STATE_IDLE ) { err = -ENODEV ; -dev_err (&adapter->dev,"Echo off failed " +dev_err (&serio->dev,"TAOS EVM echo off failed " "(state=%d)\n" , taos->state); goto exit_close; }
@@ -263,7 +263,7 @@ static int taos_connect(struct serio *se err =i2c_add_adapter (adapter);if (err) goto exit_close; -dev_dbg (&serio->dev,"Connected to TAOS EVM\n" ); +dev_info (&serio->dev,"Connected to TAOS EVM\n" ); taos->client =taos_instantiate_device (adapter);return 0 ;
@@ -288,7 +288,7 @@ static void taos_disconnect(struct serioserio_set_drvdata (serio,NULL );kfree (taos); -dev_dbg (&serio->dev,"Disconnected from TAOS EVM\n" ); +dev_info (&serio->dev,"Disconnected from TAOS EVM\n" ); }static struct serio_device_id taos_serio_ids[] = {
PATCH 84/107 i2c/pca954x: Initialize the mux to disconnected state
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Petri Gynther <[email protected]>
commit cd823db8b1161ef0d756514d280715a576d65cc3 upstream.
pca954x power-on default is channel 0 connected. If multiple pca954x muxes are connected to the same physical I2C bus, the parent bus will see channel 0 devices behind both muxes by default. This is bad.
Scenario:
-- pca954x @ 0x70 -- ch 0 (I2C-bus-101) -- EEPROM @ 0x50
|
I2C-bus-1 ---
|
-- pca954x @ 0x71 -- ch 0 (I2C-bus-111) -- EEPROM @ 0x501. Load I2C bus driver: creates I2C-bus-1
2. Load pca954x driver: creates virtual I2C-bus-101 and I2C-bus-111
3. Load eeprom driver
4. Try to read EEPROM @ 0x50 on I2C-bus-101. The transaction will also bleed onto I2C-bus-111 because pca954x @ 0x71 channel 0 is connected by default.
Fix: Initialize pca954x to disconnected state in pca954x_probe()
--- drivers/i2c/muxes/pca954x.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/i2c/muxes/pca954x.c +4 -3
@@ -201,10 +201,11 @@ static int pca954x_probe(struct i2c_cliei2c_set_clientdata (client, data); -/* Read the mux register at addr to verify -* that the mux is in fact present. +/* Write the mux register at addr to verify +* that the mux is in fact present. This also +* initializes the mux to disconnected state. */ -if (i2c_smbus_read_byte (client) <0 ) { +if (i2c_smbus_write_byte (client,0 ) <0 ) {dev_warn (&client->dev,"probe failed\n" ); goto exit_free; }
PATCH 85/107 hfsplus: add missing call to bio_put()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Seth Forshee <[email protected]>
commit 50176ddefa4a942419cb693dd2d8345bfdcde67c upstream.
hfsplus leaks bio objects by failing to call bio_put() on the bios it allocates. Add the missing call to fix the leak.
--- fs/hfsplus/wrapper.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/hfsplus/wrapper.c +5 -2
@@ -36,6 +36,7 @@ int hfsplus_submit_bio(struct block_devi {DECLARE_COMPLETION_ONSTACK (wait);struct bio *bio; +int ret =0 ; bio =bio_alloc (GFP_NOIO ,1 ); bio->bi_sector = sector;
@@ -54,8 +55,10 @@ int hfsplus_submit_bio(struct block_deviwait_for_completion (&wait);if (!bio_flagged (bio,BIO_UPTODATE )) -return -EIO ; -return 0 ; + ret = -EIO ; + +bio_put (bio); +return ret; }static int hfsplus_read_mdb (void *bufptr,struct hfsplus_wd *wd)
PATCH 86/107 md: avoid endless recovery loop when waiting for fail device to complete.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: NeilBrown <[email protected]>
commit 4274215d24633df7302069e51426659d4759c5ed upstream.
If a device fails in a way that causes pending request to take a while to complete, md will not be able to immediately remove it from the array in remove_and_add_spares.
It will then incorrectly look like a spare device and md will try to recover it even though it is failed.
This leads to a recovery process starting and instantly aborting over and over again.
We should check if the device is faulty before considering it to be a spare. This will avoid trying to start a recovery that cannot proceed.
This bug was introduced in 2.6.26 so that patch is suitable for any kernel since then.
--- drivers/md/md.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/md.c +1 -0
@@ -7062,6 +7062,7 @@ static int remove_and_add_spares(mddev_tlist_for_each_entry (rdev, &mddev->disks, same_set) {if (rdev->raid_disk >=0 && !test_bit (In_sync, &rdev->flags) && + !test_bit (Faulty, &rdev->flags) && !test_bit (Blocked, &rdev->flags)) spares++; if (rdev->raid_disk < 0
PATCH 87/107 SUNRPC: Ensure the RPC client only quits on fatal signals
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Trond Myklebust <[email protected]>
commit 5afa9133cfe67f1bfead6049a9640c9262a7101c upstream.
Fix a couple of instances where we were exiting the RPC client on arbitrary signals. We should only do so on fatal signals.
--- net/sunrpc/auth_gss/auth_gss.c | 4 ++-- net/sunrpc/clnt.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
net/sunrpc/auth_gss/auth_gss.c +2 -2
@@ -577,13 +577,13 @@ retry: } inode = &gss_msg->inode->vfs_inode;for (;;) { -prepare_to_wait (&gss_msg->waitqueue, &wait,TASK_INTERRUPTIBLE ); +prepare_to_wait (&gss_msg->waitqueue, &wait,TASK_KILLABLE );spin_lock (&inode->i_lock);if (gss_msg->ctx !=NULL || gss_msg->msg.errno <0 ) {break ; }spin_unlock (&inode->i_lock); -if (signalled ()) { +if (fatal_signal_pending (current)) { err = -ERESTARTSYS ; goto out_intr; }
net/sunrpc/clnt.c +1 -1
@@ -1058,7 +1058,7 @@ call_allocate(struct rpc_task *task)dprintk ("RPC: %5u rpc_buffer allocation failed\n" , task->tk_pid); -if (RPC_IS_ASYNC (task) || !signalled ()) { +if (RPC_IS_ASYNC (task) || !fatal_signal_pending (current)) { task->tk_action = call_allocate;rpc_delay (task,HZ >>4 );return ;
PATCH 88/107 ASoC: pxa-ssp: Correct check for stream presence
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Daniel Mack <[email protected]>
commit 53dea36c70c1857149a8c447224e3936eb8b5339 upstream.
Don't rely on the codec's channels_min information to decide wheter or not allocate a substream's DMA buffer. Rather check if the substream itself was allocated previously.
--- sound/soc/pxa/pxa2xx-pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/pxa/pxa2xx-pcm.c +2 -2
@@ -95,14 +95,14 @@ static int pxa2xx_soc_pcm_new(struct sndif (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask =DMA_BIT_MASK (32 ); -if (dai->driver->playback.channels_min) { +if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK ].substream) { ret =pxa2xx_pcm_preallocate_dma_buffer (pcm,SNDRV_PCM_STREAM_PLAYBACK );if (ret) goto out; } -if (dai->driver->capture.channels_min) { +if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE ].substream) { ret =pxa2xx_pcm_preallocate_dma_buffer (pcm,SNDRV_PCM_STREAM_CAPTURE );if (ret)
PATCH 89/107 drivers/base/platform.c: dont mark platform_device_register_resndata() as __init_or_module
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andrew Morton <[email protected]>
commit bb2b43fefab723f4a0760146e7bed59d41a50e53 upstream.
This reverts 737a3bb9416ce2a7c7a4 ("Driver core: move platform device creation helpers to .init.text (if MODULE=n)"). That patch assumed that platform_device_register_resndata() is only ever called from __init code but that isn't true in the case ioctl->drm_ioctl->radeon_cp_init().
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=35192
--- drivers/base/platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/platform.c +1 -1
@@ -367,7 +367,7 @@ EXPORT_SYMBOL_GPL(platform_device_unregi* * Returns &struct platform_device pointer on success, or ERR_PTR() on error. */ -struct platform_device *__init_or_module platform_device_register_resndata( +struct platform_device *platform_device_register_resndata( struct device *parent, const char *name, int id, const struct resource *res, unsigned int num,
Re: [089/107] drivers/base/platform.c: dont mark platform_device_register_resndata() as __init_or_module
Hello,
Quoted 8 lines · Greg KH
2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andrew Morton <[email protected]>
commit
bb2b43fefab723f4a0760146e7bed59d41a50e53upstream.
Quoted 8 lines
This reverts
737a3bb9416ce2a7c7a4("Driver core: move platform device creation helpers to .init.text (if MODULE=n)"). That patch assumed thatplatform_device_register_resndata()is only ever called from__initcode but that isn't true in the caseioctl->drm_ioctl->radeon_cp_init().Addresses https://bugzilla.kernel.org/show_bug.cgi?id=35192
Cc Uwe Kleine-König <[email protected]>
Quoted 6 lines
Reported-by Anthony Basile <[email protected]>Cc Greg KH <[email protected]>Cc David Airlie <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
You might want to remove one of your sobs.
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [089/107] drivers/base/platform.c: dont mark platform_device_register_resndata() as __init_or_module
Quoted 16 lines · Uwe Kleine-König
Hello,
Quoted 13 lines · Greg KH
2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andrew Morton <[email protected]>
commit
bb2b43fefab723f4a0760146e7bed59d41a50e53upstream.This reverts
737a3bb9416ce2a7c7a4("Driver core: move platform device creation helpers to .init.text (if MODULE=n)"). That patch assumed thatplatform_device_register_resndata()is only ever called from__initcode but that isn't true in the caseioctl->drm_ioctl->radeon_cp_init().
Quoted 4 lines
Quoted 3 lines
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=35192
Cc Uwe Kleine-König <[email protected]>Acked-by Uwe Kleine-König <[email protected]>
Now added.
Quoted 7 lines
Quoted 6 lines
Reported-by Anthony Basile <[email protected]>Cc Greg KH <[email protected]>Cc David Airlie <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>You might want to remove one of your sobs.
Heh, thanks for catching this, now done.
greg k-h
PATCH 90/107 fs: fix lock initialization
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Miklos Szeredi <[email protected]>
commit a51cb91d81f8e6fc4e5e08b772cc3ceb13ac9d37 upstream.
locks_alloc_lock() assumed that the allocated struct file_lock is already initialized to zero members. This is only true for the first allocation of the structure, after reuse some of the members will have random values.
This will for example result in passing random fl_start values to userspace in fuse for FL_FLOCK locks, which is an information leak at best.
Fix by reinitializing those members which may be non-zero after freeing.
--- fs/locks.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-)
fs/locks.c +20 -10
@@ -160,10 +160,28 @@ EXPORT_SYMBOL_GPL(unlock_flocks);static struct kmem_cache *filelock_cache__read_mostly ; +static void locks_init_lock_always (struct file_lock *fl) +{ + fl->fl_next =NULL ; + fl->fl_fasync =NULL ; + fl->fl_owner =NULL ; + fl->fl_pid =0 ; + fl->fl_nspid =NULL ; + fl->fl_file =NULL ; + fl->fl_flags =0 ; + fl->fl_type =0 ; + fl->fl_start = fl->fl_end =0 ; +} +/* Allocate an empty lock structure. */ struct file_lock *locks_alloc_lock (void ) { -return kmem_cache_alloc (filelock_cache,GFP_KERNEL ); +struct file_lock *fl =kmem_cache_alloc (filelock_cache,GFP_KERNEL ); + +if (fl) +locks_init_lock_always (fl); + +return fl; }EXPORT_SYMBOL_GPL (locks_alloc_lock);
@@ -200,17 +218,9 @@ void locks_init_lock(struct file_lock *fINIT_LIST_HEAD (&fl->fl_link);INIT_LIST_HEAD (&fl->fl_block);init_waitqueue_head (&fl->fl_wait); - fl->fl_next =NULL ; - fl->fl_fasync =NULL ; - fl->fl_owner =NULL ; - fl->fl_pid =0 ; - fl->fl_nspid =NULL ; - fl->fl_file =NULL ; - fl->fl_flags =0 ; - fl->fl_type =0 ; - fl->fl_start = fl->fl_end =0 ; fl->fl_ops =NULL ; fl->fl_lmops =NULL ; +locks_init_lock_always (fl); }EXPORT_SYMBOL (locks_init_lock);
PATCH 91/107 FS-Cache: Add a helper to bulk uncache pages on an inode
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Howells <[email protected]>
commit c902ce1bfb40d8b049bd2319b388b4b68b04bc27 upstream.
Add an FS-Cache helper to bulk uncache pages on an inode. This will only work for the circumstance where the pages in the cache correspond 1:1 with the pages attached to an inode's page cache.
This is required for CIFS and NFS: When disabling inode cookie, we were returning the cookie and setting cifsi->fscache to NULL but failed to invalidate any previously mapped pages. This resulted in "Bad page state" errors and manifested in other kind of errors when running fsstress. Fix it by uncaching mapped pages when we disable the inode cookie.
This patch should fix the following oops and "Bad page state" errors seen during fsstress testing.
------------[ cut here ]------------ kernel BUG at fs/cachefiles/namei.c:201! invalid opcode: 0000 [#1] SMP Pid: 5, comm: kworker/u:0 Not tainted 2.6.38.7-30.fc15.x86_64 #1 Bochs Bochs RIP: 0010: cachefiles_walk_to_object+0x436/0x745 [cachefiles] RSP: 0018:ffff88002ce6dd00 EFLAGS: 00010282 RAX: ffff88002ef165f0 RBX: ffff88001811f500 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000100 RDI: 0000000000000282 RBP: ffff88002ce6dda0 R08: 0000000000000100 R09: ffffffff81b3a300 R10: 0000ffff00066c0a R11: 0000000000000003 R12: ffff88002ae54840 R13: ffff88002ae54840 R14: ffff880029c29c00 R15: ffff88001811f4b0 FS: 00007f394dd32720(0000) GS:ffff88002ef00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 00007fffcb62ddf8 CR3: 000000001825f000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process kworker/u:0 (pid: 5, threadinfo ffff88002ce6c000, task ffff88002ce55cc0) Stack: 0000000000000246 ffff88002ce55cc0 ffff88002ce6dd58 ffff88001815dc00 ffff8800185246c0 ffff88001811f618 ffff880029c29d18 ffff88001811f380 ffff88002ce6dd50 ffffffff814757e4 ffff88002ce6dda0 ffffffff8106ac56 Call Trace: cachefiles_lookup_object+0x78/0xd4 [cachefiles] fscache_lookup_object+0x131/0x16d [fscache] fscache_object_work_func+0x1bc/0x669 [fscache] process_one_work+0x186/0x298 worker_thread+0xda/0x15d kthread+0x84/0x8c kernel_thread_helper+0x4/0x10 RIP cachefiles_walk_to_object+0x436/0x745 [cachefiles] ---[ end trace 1d481c9af1804caa ]---
I tested the uncaching by the following means:
(1) Create a big file on my NFS server (104857600 bytes).
(2) Read the file into the cache with md5sum on the NFS client. Look in
/proc/fs/fscache/stats: Pages : mrk=25601 unc=0
(3) Open the file for read/write ("bash 5<>/warthog/bigfile"). Look in proc
again: Pages : mrk=25601 unc=25601
--- Documentation/filesystems/caching/netfs-api.txt | 16 ++++++++ fs/cifs/fscache.c | 1 fs/fscache/page.c | 44 ++++++++++++++++++++++++ fs/nfs/fscache.c | 8 +--- include/linux/fscache.h | 21 +++++++++++ 5 files changed, 85 insertions(+), 5 deletions(-)
Documentation/filesystems/caching/netfs-api.txt +16 -0
@@ -673,6 +673,22 @@ storage request to complete, or it may a in which case the page will not be stored in the cache this time. +BULK INODE PAGE UNCACHE +----------------------- + +A convenience routine is provided to perform an uncache on all the pages +attached to an inode. This assumes that the pages on the inode correspond on a +1:1 basis with the pages in the cache. + + void fscache_uncache_all_inode_pages(struct fscache_cookie *cookie, + struct inode *inode); + +This takes the netfs cookie that the pages were cached with and the inode that +the pages are attached to. This function will wait for pages to finish being +written to the cache and for the cache to finish with the page generally. No +error is returned. + + ========================== INDEX AND DATA FILE UPDATE ==========================
fs/cifs/fscache.c +1 -0
@@ -94,6 +94,7 @@ static void cifs_fscache_disable_inode_cif (cifsi->fscache) {cFYI (1 ,"CIFS disabling inode cookie (0x%p)" , cifsi->fscache); +fscache_uncache_all_inode_pages (cifsi->fscache, inode);fscache_relinquish_cookie (cifsi->fscache,1 ); cifsi->fscache =NULL ; }
fs/fscache/page.c +44 -0
47 lines not on this page · raw message
fs/nfs/fscache.c +3 -5
@@ -259,12 +259,10 @@ static void nfs_fscache_disable_inode_codfprintk (FSCACHE ,"NFS: nfsi 0x%p turning cache off\n" ,NFS_I (inode)); -/* Need to invalidate any mapped pages that were read in before -* turning off the cache. +/* Need to uncache any pages attached to this inode that +* fscache knows about before turning off the cache. */ -if (inode->i_mapping && inode->i_mapping->nrpages) -invalidate_inode_pages2 (inode->i_mapping); - +fscache_uncache_all_inode_pages (NFS_I (inode)->fscache, inode);nfs_fscache_zap_inode_cookie (inode); } }
include/linux/fscache.h +21 -0
@@ -204,6 +204,8 @@ extern bool __fscache_check_page_write(sextern void __fscache_wait_on_page_write (struct fscache_cookie *,struct page *);extern bool __fscache_maybe_release_page (struct fscache_cookie *,struct page *,gfp_t ); +extern void __fscache_uncache_all_inode_pages (struct fscache_cookie *, +struct inode *);/** * fscache_register_netfs - Register a filesystem as desiring caching services
@@ -643,4 +645,23 @@ bool fscache_maybe_release_page(struct f return false; } +/** +* fscache_uncache_all_inode_pages - Uncache all an inode's pages +* @cookie: The cookie representing the inode's cache object. +* @inode: The inode to uncache pages from. +* +* Uncache all the pages in an inode that are marked PG_fscache, assuming them +* to be associated with the given cookie. +* +* This function may sleep. It will wait for pages that are being written out +* and will wait whilst the PG_fscache mark is removed by the cache. +*/ +static inline +void fscache_uncache_all_inode_pages (struct fscache_cookie *cookie, +struct inode *inode) +{ +if (fscache_cookie_valid (cookie)) +__fscache_uncache_all_inode_pages (cookie, inode); +} +#endif /* _LINUX_FSCACHE_H */
PATCH 92/107 6pack,mkiss: fix lock inconsistency
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Arnd Bergmann <[email protected]>
commit 6e4e2f811bade330126d4029c88c831784a7efd9 upstream.
Lockdep found a locking inconsistency in the mkiss_close function:
Quoted 7 lines
kernel: [ INFO: inconsistent lock state ]
kernel: 2.6.39.1 #3
kernel: ---------------------------------
kernel: inconsistent {IN-SOFTIRQ-R} -> {SOFTIRQ-ON-W} usage.
kernel: ax25ipd/2813 [HC0[0]:SC0[0]:HE1:SE1] takes:
kernel: (disc_data_lock){+++?.-}, at: [<ffffffffa018552b>]mkiss_close+0x1b/0x90[mkiss]
kernel: {IN-SOFTIRQ-R} state was registered at:
The message hints that disc_data_lock is aquired with softirqs disabled, but does not itself disable softirqs, which can in rare circumstances lead to a deadlock.
The same problem is present in the 6pack driver, this patch fixes both by using write_lock_bh instead of write_lock.
--- drivers/net/hamradio/6pack.c | 4 ++-- drivers/net/hamradio/mkiss.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/hamradio/6pack.c +2 -2
@@ -692,10 +692,10 @@ static void sixpack_close(struct tty_str {struct sixpack *sp; -write_lock (&disc_data_lock); +write_lock_bh (&disc_data_lock); sp = tty->disc_data; tty->disc_data =NULL ; -write_unlock (&disc_data_lock); +write_unlock_bh (&disc_data_lock);if (!sp)return ;
drivers/net/hamradio/mkiss.c +2 -2
@@ -813,10 +813,10 @@ static void mkiss_close(struct tty_struc {struct mkiss *ax; -write_lock (&disc_data_lock); +write_lock_bh (&disc_data_lock); ax = tty->disc_data; tty->disc_data =NULL ; -write_unlock (&disc_data_lock); +write_unlock_bh (&disc_data_lock);if (!ax)return ;
PATCH 93/107 iwlagn: fix change_interface for P2P types
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Johannes Berg <[email protected]>
commit 5306c0807491e891125f4fb08b04340c91530f57 upstream.
When an interface changes type to a P2P type, iwlagn will erroneously set vif->type to the P2P type and not the reduced/split type. Fix this by keeping "newtype" in another variable for the assignment to vif->type.
--- drivers/net/wireless/iwlwifi/iwl-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/iwl-core.c +2 -1
@@ -1772,6 +1772,7 @@ int iwl_mac_change_interface(struct ieeestruct iwl_priv *priv = hw->priv;struct iwl_rxon_context *ctx =iwl_rxon_ctx_from_vif (vif);struct iwl_rxon_context *tmp; +enum nl80211_iftype newviftype = newtype;u32 interface_modes;int err;
@@ -1814,7 +1815,7 @@ int iwl_mac_change_interface(struct ieee/* success */ iwl_teardown_interface (priv, vif, true); - vif->type = newtype; + vif->type = newviftype; vif->p2p = newp2p; err =iwl_setup_interface (priv, ctx);WARN_ON (err);
PATCH 94/107 drivers/misc/lkdtm.c: fix race when crashpoint is hit multiple times before checking count
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Josh Hunt <[email protected]>
commit aa2c96d6f329e66cc59352b0f12e8f04e6a9593b upstream.
We observed the crash point count going negative in cases where the crash point is hit multiple times before the check of "count == 0" is done. Because of this we never call lkdtm_do_action(). This patch just adds a spinlock to protect count.
--- drivers/misc/lkdtm.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/misc/lkdtm.c +8 -0
@@ -120,6 +120,7 @@ static int recur_count = REC_NUM_DEFAULTstatic enum cname cpoint =CN_INVALID ;static enum ctype cptype =CT_NONE ;static int count =DEFAULT_COUNT ; +static DEFINE_SPINLOCK (count_lock);module_param (recur_count, int,0644 ); MODULE_PARM_DESC(recur_count, " Recursion level for the stack overflow test, "\
@@ -230,11 +231,14 @@ static const char *cp_name_to_str(enum cstatic int lkdtm_parse_commandline (void ) {int i; +unsigned long flags;if (cpoint_count <1 || recur_count <1 )return -EINVAL ; +spin_lock_irqsave (&count_lock, flags); count = cpoint_count; +spin_unlock_irqrestore (&count_lock, flags);/* No special parameters */ if (!cpoint_type && !cpoint_name)
@@ -349,6 +353,9 @@ static void lkdtm_do_action(enum ctype wstatic void lkdtm_handler (void ) { +unsigned long flags; + +spin_lock_irqsave (&count_lock, flags); count--;printk (KERN_INFO "lkdtm: Crash point %s of type %s hit, trigger in %d rounds\n" ,cp_name_to_str (cpoint),cp_type_to_str (cptype), count);
@@ -357,6 +364,7 @@ static void lkdtm_handler(void)lkdtm_do_action (cptype); count = cpoint_count; } +spin_unlock_irqrestore (&count_lock, flags); }static int lkdtm_register_cpoint (enum cname which)
PATCH 95/107 taskstats: dont allow duplicate entries in listener mode
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Vasiliy Kulikov <[email protected]>
commit 26c4caea9d697043cc5a458b96411b86d7f6babd upstream.
Currently a single process may register exit handlers unlimited times. It may lead to a bloated listeners chain and very slow process terminations.
Eg after 10KK sent TASKSTATS_CMD_ATTR_REGISTER_CPUMASKs ~300 Mb of kernel memory is stolen for the handlers chain and "time id" shows 2-7 seconds instead of normal 0.003. It makes it possible to exhaust all kernel memory and to eat much of CPU time by triggerring numerous exits on a single CPU.
The patch limits the number of times a single process may register itself on a single CPU to one.
One little issue is kept unfixed - as taskstats_exit() is called before exit_files() in do_exit(), the orphaned listener entry (if it was not explicitly deregistered) is kept until the next someone's exit() and implicit deregistration in send_cpu_listeners(). So, if a process registered itself as a listener exits and the next spawned process gets the same pid, it would inherit taskstats attributes.
--- kernel/taskstats.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
kernel/taskstats.c +12 -3
@@ -285,16 +285,18 @@ ret:static int add_del_listener (pid_t pid,const struct cpumask *mask,int isadd) {struct listener_list *listeners; -struct listener *s, *tmp; +struct listener *s, *tmp, *s2;unsigned int cpu;if (!cpumask_subset (mask, cpu_possible_mask))return -EINVAL ; + s =NULL ;if (isadd ==REGISTER ) {for_each_cpu (cpu, mask) { - s =kmalloc_node (sizeof (struct listener ),GFP_KERNEL , -cpu_to_node (cpu)); +if (!s) + s =kmalloc_node (sizeof (struct listener ), +GFP_KERNEL ,cpu_to_node (cpu));if (!s) goto cleanup; s->pid = pid;
@@ -303,9 +305,16 @@ static int add_del_listener(pid_t pid, c listeners = &per_cpu (listener_array, cpu);down_write (&listeners->sem); +list_for_each_entry_safe (s2, tmp, &listeners->list, list) { +if (s2->pid == pid) + goto next_cpu; + }list_add (&s->list, &listeners->list); + s =NULL ; +next_cpu:up_write (&listeners->sem); } +kfree (s);return 0 ; }
PATCH 96/107 Fix CPU spinlock lockups on secondary CPU bringup
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Russell King <[email protected]>
commit 1b19ca9f0bdab7d5035821e1ec8f39df9a6e3ee0 upstream.
Secondary CPU bringup typically calls calibrate_delay() during its initialization. However, calibrate_delay() modifies a global variable (loops_per_jiffy) used for udelay() and __delay().
A side effect of 71c696b1 ("calibrate: extract fall-back calculation into own helper") introduced in the 2.6.39 merge window means that we end up with a substantial period where loops_per_jiffy is zero. This causes the spinlock debugging code to malfunction:
u64 loops = loops_per_jiffy * HZ;
for (;;) {
for (i = 0; i < loops; i++) {
if (arch_spin_trylock(&lock->raw_lock))
return;
__delay(1);
}
...
}by never calling arch_spin_trylock() - resulting in the CPU locking up in an infinite loop inside __spin_lock_debug().
Work around this by only writing to loops_per_jiffy only once we have completed all the calibration decisions.
--
Better solutions (such as omitting the calibration for secondary CPUs, or arranging for calibrate_delay() to return the LPJ value and leave it to the caller to decide where to store it) are a possibility, but would be much more invasive into each architecture.
I think this is the best solution for -rc and stable, but it should be revisited for the next merge window.
--- init/calibrate.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
init/calibrate.c +8 -6
@@ -185,30 +185,32 @@ recalibrate:void __cpuinit calibrate_delay (void ) { +unsigned long lpj;static bool printed;if (preset_lpj) { - loops_per_jiffy = preset_lpj; + lpj = preset_lpj;if (!printed)pr_info ("Calibrating delay loop (skipped) " "preset value.. " ); }else if ((!printed) && lpj_fine) { - loops_per_jiffy = lpj_fine; + lpj = lpj_fine;pr_info ("Calibrating delay loop (skipped), " "value calculated using timer frequency.. " ); - }else if ((loops_per_jiffy =calibrate_delay_direct ()) !=0 ) { + }else if ((lpj =calibrate_delay_direct ()) !=0 ) {if (!printed)pr_info ("Calibrating delay using timer " "specific routine.. " ); }else {if (!printed)pr_info ("Calibrating delay loop... " ); - loops_per_jiffy =calibrate_delay_converge (); + lpj =calibrate_delay_converge (); }if (!printed)pr_cont ("%lu.%02lu BogoMIPS (lpj=%lu)\n" , - loops_per_jiffy/(500000 /HZ ), - (loops_per_jiffy/(5000 /HZ )) %100 , loops_per_jiffy); + lpj/(500000 /HZ ), + (lpj/(5000 /HZ )) %100 , lpj); + loops_per_jiffy = lpj; printed = true; }
PATCH 97/107 NLM: Dont hang forever on NLM unlock requests
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Trond Myklebust <[email protected]>
commit 0b760113a3a155269a3fba93a409c640031dd68f upstream.
If the NLM daemon is killed on the NFS server, we can currently end up hanging forever on an 'unlock' request, instead of aborting. Basically, if the rpcbind request fails, or the server keeps returning garbage, we really want to quit instead of retrying.
--- fs/lockd/clntproc.c | 8 +++++++- include/linux/sunrpc/sched.h | 3 ++- net/sunrpc/clnt.c | 3 +++ net/sunrpc/sched.c | 1 + 4 files changed, 13 insertions(+), 2 deletions(-)
fs/lockd/clntproc.c +7 -1
@@ -708,7 +708,13 @@ static void nlmclnt_unlock_callback(struif (task->tk_status <0 ) {dprintk ("lockd: unlock failed (err = %d)\n" , -task->tk_status); - goto retry_rebind; +switch (task->tk_status) { +case -EACCES : +case -EIO : + goto die; +default : + goto retry_rebind; + } }if (status ==NLM_LCK_DENIED_GRACE_PERIOD ) {rpc_delay (task,NLMCLNT_GRACE_WAIT );
include/linux/sunrpc/sched.h +2 -1
@@ -84,7 +84,8 @@ struct rpc_task {#endif unsigned char tk_priority : 2,/* Task priority */ tk_garb_retry : 2, - tk_cred_retry : 2; + tk_cred_retry : 2, + tk_rebind_retry : 2; };#define tk_xprt tk_client->cl_xprt
net/sunrpc/clnt.c +3 -0
@@ -1172,6 +1172,9 @@ call_bind_status(struct rpc_task *task) status = -EOPNOTSUPP ;break ; } +if (task->tk_rebind_retry ==0 ) +break ; + task->tk_rebind_retry--;rpc_delay (task,3 *HZ ); goto retry_timeout;case -ETIMEDOUT :
net/sunrpc/sched.c +1 -0
@@ -792,6 +792,7 @@ static void rpc_init_task(struct rpc_tas/* Initialize retry counters */ task->tk_garb_retry =2 ; task->tk_cred_retry =2 ; + task->tk_rebind_retry =2 ; task->tk_priority = task_setup_data->priority -RPC_PRIORITY_LOW ; task->tk_owner = current->tgid;
PATCH 98/107 USB: dont let errors prevent system sleep
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
commit 0af212ba8f123c2eba151af7726c34a50b127962 upstream.
This patch (as1464) implements the recommended policy that most errors during suspend or hibernation should not prevent the system from going to sleep. In particular, failure to suspend a USB driver or a USB device should not prevent the sleep from succeeding:
Failure to suspend a device won't matter, because the device will automatically go into suspend mode when the USB bus stops carrying packets. (This might be less true for USB-3.0 devices, but let's not worry about them now.)
Failure of a driver to suspend might lead to trouble later on when the system wakes up, but it isn't sufficient reason to prevent the system from going to sleep.
--- drivers/usb/core/driver.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/usb/core/driver.c +10 -1
@@ -1187,13 +1187,22 @@ static int usb_suspend_both(struct usb_dfor (i = n -1 ; i >=0 ; --i) { intf = udev->actconfig->interface[i]; status =usb_suspend_interface (udev, intf, msg); + +/* Ignore errors during system sleep transitions */ +if (!(msg.event &PM_EVENT_AUTO )) + status =0 ;if (status !=0 )break ; } } -if (status ==0 ) +if (status ==0 ) { status =usb_suspend_device (udev, msg); +/* Again, ignore errors during system sleep transitions */ +if (!(msg.event &PM_EVENT_AUTO )) + status =0 ; + } +/* If the suspend failed, resume interfaces that did get suspended */ if (status !=0 ) { msg.event ^= (PM_EVENT_SUSPEND |PM_EVENT_RESUME );
PATCH 99/107 USB: dont let the hub driver prevent system sleep
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
commit cbb330045e5df8f665ac60227ff898421fc8fb92 upstream.
This patch (as1465) continues implementation of the policy that errors during suspend or hibernation should not prevent the system from going to sleep.
In this case, failure to turn on the Suspend feature for a hub port shouldn't be reported as an error. There are situations where this does actually occur (such as when the device plugged into that port was disconnected in the recent past), and it turns out to be harmless. There's no reason for it to prevent a system sleep.
Also, don't allow the hub driver to fail a system suspend if the downstream ports aren't all suspended. This is also harmless (and should never happen, given the change mentioned above); printing a warning message in the kernel log is all we really need to do.
--- drivers/usb/core/hub.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/usb/core/hub.c +8 -5
@@ -2311,6 +2311,10 @@ int usb_port_suspend(struct usb_device *USB_DEVICE_REMOTE_WAKEUP ,0 ,NULL ,0 , USB_CTRL_SET_TIMEOUT); + +/* System sleep transitions should never fail */ +if (!(msg.event &PM_EVENT_AUTO )) + status =0 ; }else {/* device has up to 10 msec to fully suspend */ dev_dbg(&udev->dev, "usb %ssuspend\n",
@@ -2549,16 +2553,15 @@ static int hub_suspend(struct usb_interfstruct usb_device *hdev = hub->hdev;unsigned port1; -/* fail if children aren't already suspended */ +/* Warn if children aren't already suspended */ for (port1 =1 ; port1 <= hdev->maxchild; port1++) {struct usb_device *udev; udev = hdev->children [port1-1 ];if (udev && udev->can_submit) { -if (!(msg.event &PM_EVENT_AUTO )) -dev_dbg (&intf->dev,"port %d nyet suspended\n" , - port1); -return -EBUSY ; +dev_warn (&intf->dev,"port %d nyet suspended\n" , port1); +if (msg.event &PM_EVENT_AUTO ) +return -EBUSY ; } }
PATCH 100/107 USB: fix regression occurring during device removal
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
commit e534c5b831c8b8e9f5edee5c8a37753c808b80dc upstream.
This patch (as1476) fixes a regression introduced by fccf4e86200b8f5edd9a65da26f150e32ba79808 (USB: Free bandwidth when usb_disable_device is called). usb_disconnect() grabs the bandwidth_mutex before calling usb_disable_device(), which calls down indirectly to usb_set_interface(), which tries to acquire the bandwidth_mutex.
The fix causes usb_set_interface() to return early when it is called for an interface that has already been unregistered, which is what happens in usb_disable_device().
--- drivers/usb/core/message.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/core/message.c +2 -0
@@ -1286,6 +1286,8 @@ int usb_set_interface(struct usb_device interface);return -EINVAL ; } +if (iface->unregistering) +return -ENODEV ; alt =usb_altnum_to_altsetting (iface, alternate);if (!alt) {
PATCH 101/107 ipv4: fix multicast losses
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 9aa3c94ce59066f545521033007abb6441706068 ]
Knut Tidemann found that first packet of a multicast flow was not correctly received, and bisected the regression to commit b23dd4fe42b4 (Make output route lookup return rtable directly.)
Special thanks to Knut, who provided a very nice bug report, including sample programs to demonstrate the bug.
Reported-and-bisectedby: Knut Tidemann <[email protected]>
--- net/ipv4/route.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/ipv4/route.c +1 -3
@@ -1914,9 +1914,7 @@ static int ip_route_input_mc(struct sk_b hash =rt_hash (daddr, saddr, dev->ifindex,rt_genid (dev_net (dev))); rth =rt_intern_hash (hash, rth, skb, dev->ifindex); - err =0 ; -if (IS_ERR (rth)) - err =PTR_ERR (rth); +return IS_ERR (rth) ?PTR_ERR (rth) :0 ; e_nobufs:return -ENOBUFS ;
PATCH 102/107 netfilter: Fix ip_route_me_harder triggering ip_rt_bug
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Julian Anastasov <[email protected]>
[ Upstream commit ed6e4ef836d425bc35e33bf20fcec95e68203afa ]
Avoid creating input routes with ip_route_me_harder.
It does not work for locally generated packets. Instead, restrict sockets to provide valid saddr for output route (or unicast saddr for transparent proxy). For other traffic allow saddr to be unicast or local but if callers forget to check saddr type use 0 for the output route.
The resulting handling should be:
- REJECT TCP:
- in INPUT we can provide addr_type = RTN_LOCAL but better allow rejecting traffic delivered with local route (no IP address => use RTN_UNSPEC to allow also RTN_UNICAST).
- FORWARD: RTN_UNSPEC => allow RTN_LOCAL/RTN_UNICAST saddr, add fix to ignore RTN_BROADCAST and RTN_MULTICAST
- OUTPUT: RTN_UNSPEC
- NAT, mangle, ip_queue, nf_ip_reroute: RTN_UNSPEC in LOCAL_OUT
- IPVS:
- use RTN_LOCAL in LOCAL_OUT and FORWARD after SNAT to restrict saddr to be local
--- net/ipv4/netfilter.c | 60 ++++++++++++++-------------------------- net/ipv4/netfilter/ipt_REJECT.c | 14 ++------- 2 files changed, 26 insertions(+), 48 deletions(-)
net/ipv4/netfilter.c +22 -38
@@ -17,51 +17,35 @@ int ip_route_me_harder(struct sk_buff *sconst struct iphdr *iph =ip_hdr (skb);struct rtable *rt;struct flowi4 fl4 = {}; -unsigned long orefdst; +__be32 saddr = iph->saddr; +__u8 flags =0 ;unsigned int hh_len; -unsigned int type; - type =inet_addr_type (net, iph->saddr); -if (skb->sk &&inet_sk (skb->sk)->transparent) - type =RTN_LOCAL ; -if (addr_type ==RTN_UNSPEC ) - addr_type = type; +if (!skb->sk && addr_type !=RTN_LOCAL ) { +if (addr_type ==RTN_UNSPEC ) + addr_type =inet_addr_type (net, saddr); +if (addr_type ==RTN_LOCAL || addr_type ==RTN_UNICAST ) + flags |=FLOWI_FLAG_ANYSRC ; +else + saddr =0 ; + }/* some non-standard hacks like ipt_REJECT.c:send_reset() can cause * packets with foreign saddr to appear on the NF_INET_LOCAL_OUT hook. */ -if (addr_type ==RTN_LOCAL ) { - fl4.daddr = iph->daddr; -if (type ==RTN_LOCAL ) - fl4.saddr = iph->saddr; - fl4.flowi4_tos =RT_TOS (iph->tos); - fl4.flowi4_oif = skb->sk ? skb->sk->sk_bound_dev_if :0 ; - fl4.flowi4_mark = skb->mark; - fl4.flowi4_flags = skb->sk ?inet_sk_flowi_flags (skb->sk) :0 ; - rt =ip_route_output_key (net, &fl4); -if (IS_ERR (rt)) -return -1 ; - -/* Drop old route. */ -skb_dst_drop (skb); -skb_dst_set (skb, &rt->dst); - }else { -/* non-local src, find valid iif to satisfy -* rp-filter when calling ip_route_input. */ - fl4.daddr = iph->saddr; - rt =ip_route_output_key (net, &fl4); -if (IS_ERR (rt)) -return -1 ; + fl4.daddr = iph->daddr; + fl4.saddr = saddr; + fl4.flowi4_tos =RT_TOS (iph->tos); + fl4.flowi4_oif = skb->sk ? skb->sk->sk_bound_dev_if :0 ; + fl4.flowi4_mark = skb->mark; + fl4.flowi4_flags = skb->sk ?inet_sk_flowi_flags (skb->sk) : flags; + rt =ip_route_output_key (net, &fl4); +if (IS_ERR (rt)) +return -1 ; - orefdst = skb->_skb_refdst; -if (ip_route_input (skb, iph->daddr, iph->saddr, -RT_TOS (iph->tos), rt->dst.dev) !=0 ) { -dst_release (&rt->dst); -return -1 ; - } -dst_release (&rt->dst); -refdst_drop (orefdst); - } +/* Drop old route. */ +skb_dst_drop (skb); +skb_dst_set (skb, &rt->dst);if (skb_dst (skb)->error)return -1 ;
net/ipv4/netfilter/ipt_REJECT.c +4 -10
@@ -40,7 +40,6 @@ static void send_reset(struct sk_buff *ostruct iphdr *niph;const struct tcphdr *oth;struct tcphdr _otcph, *tcph; -unsigned int addr_type;/* IP header checks: fragment. */ if (ip_hdr (oldskb)->frag_off &htons (IP_OFFSET ))
@@ -55,6 +54,9 @@ static void send_reset(struct sk_buff *oif (oth->rst)return ; +if (skb_rtable (oldskb)->rt_flags & (RTCF_BROADCAST |RTCF_MULTICAST )) +return ; +/* Check checksum */ if (nf_ip_checksum (oldskb, hook,ip_hdrlen (oldskb),IPPROTO_TCP ))return ;
@@ -101,19 +103,11 @@ static void send_reset(struct sk_buff *o nskb->csum_start = (unsigned char *)tcph - nskb->head; nskb->csum_offset = offsetof(struct tcphdr , check); - addr_type =RTN_UNSPEC ; -if (hook !=NF_INET_FORWARD -#ifdef CONFIG_BRIDGE_NETFILTER - || (nskb->nf_bridge && nskb->nf_bridge->mask &BRNF_BRIDGED ) -#endif - ) - addr_type =RTN_LOCAL ; -/* ip_route_me_harder expects skb->dst to be set */ skb_dst_set_noref (nskb,skb_dst (oldskb)); nskb->protocol =htons (ETH_P_IP ); -if (ip_route_me_harder (nskb, addr_type)) +if (ip_route_me_harder (nskb,RTN_UNSPEC )) goto free_nskb; niph->ttl =ip4_dst_hoplimit (skb_dst (nskb));
PATCH 103/107 vlan: fix typo in vlan_dev_hard_start_xmit()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Wei Yongjun <[email protected]>
[ Upstream commit 307f73df2b9829ee5a261d1ed432ff683c426cdf ]
commit 4af429d29b341bb1735f04c2fb960178ed5d52e7 (vlan: lockless transmit path) have a typo in vlan_dev_hard_start_xmit(), using u64_stats_update_begin() to end the stat update, it should be u64_stats_update_end().
--- net/8021q/vlan_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/8021q/vlan_dev.c +1 -1
@@ -338,7 +338,7 @@ static netdev_tx_t vlan_dev_hard_start_xu64_stats_update_begin (&stats->syncp); stats->tx_packets++; stats->tx_bytes += len; -u64_stats_update_begin (&stats->syncp); +u64_stats_update_end (&stats->syncp); }else {this_cpu_inc (vlan_dev_info (dev)->vlan_pcpu_stats->tx_dropped); }
PATCH 104/107 xfrm: Fix off by one in the replay advance functions
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Steffen Klassert <[email protected]>
[ Upstream commit e756682c8baa47da1648c0c016e9f48ed66bc32d ]
We may write 4 byte too much when we reinitialize the anti replay window in the replay advance functions. This patch fixes this by adjusting the last index of the initialization loop.
--- net/xfrm/xfrm_replay.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/xfrm/xfrm_replay.c +2 -2
@@ -265,7 +265,7 @@ static void xfrm_replay_advance_bmp(stru bitnr = bitnr &0x1F ; replay_esn->bmp[nr] |= (1U << bitnr); }else { - nr = replay_esn->replay_window >>5 ; + nr = (replay_esn->replay_window -1 ) >>5 ;for (i =0 ; i <= nr; i++) replay_esn->bmp[i] =0 ;
@@ -471,7 +471,7 @@ static void xfrm_replay_advance_esn(stru bitnr = bitnr &0x1F ; replay_esn->bmp[nr] |= (1U << bitnr); }else { - nr = replay_esn->replay_window >>5 ; + nr = (replay_esn->replay_window -1 ) >>5 ;for (i =0 ; i <= nr; i++) replay_esn->bmp[i] =0 ;
PATCH 105/107 Revert "KVM: Save/restore state of assigned PCI device"
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Williamson <[email protected]>
This reverts ed78661f2614d3c9f69c23e280db3bafdabdf5bb as it assumes the saved PCI state will remain valid for the entire length of time that it is attached to a guest. This fails when userspace makes use of the pci-sysfs reset interface, which invalidates the saved device state, leaving nothing to be restored after the device is reset on de-assignment. This leaves the device in an unusable state.
3.0.0 will add an interface for KVM to save the PCI state in a buffer unaffected by other callers of pci_reset_function(), but the most appropriate stable fix seems to be reverting this change since the original assumption about the device saved state persisting is incorrect.
--- virt/kvm/assigned-dev.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
virt/kvm/assigned-dev.c +1 -4
@@ -197,8 +197,7 @@ static void kvm_free_assigned_device(str {kvm_free_assigned_irq (kvm, assigned_dev); -__pci_reset_function (assigned_dev->dev); -pci_restore_state (assigned_dev->dev); +pci_reset_function (assigned_dev->dev);pci_release_regions (assigned_dev->dev);pci_disable_device (assigned_dev->dev);
@@ -515,7 +514,6 @@ static int kvm_vm_ioctl_assign_device(st }pci_reset_function (dev); -pci_save_state (dev); match->assigned_dev_id = assigned_dev->assigned_dev_id; match->host_segnr = assigned_dev->segnr;
@@ -546,7 +544,6 @@ out:mutex_unlock (&kvm->lock);return r; out_list_del: -pci_restore_state (dev);list_del (&match->list);pci_release_regions (dev); out_disable:
PATCH 106/107 KVM: Fix register corruption in pvclock_scale_delta
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Zachary Amsden <[email protected]>
(cherry picked from commit de2d1a524e94a79078d9fe22c57c0c6009237547)
The 128-bit multiply in pvclock.h was missing an output constraint for EDX which caused a register corruption to appear. Thanks to Ulrich for diagnosing the EDX corruption and Avi for providing this fix.
--- arch/x86/include/asm/pvclock.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/x86/include/asm/pvclock.h +7 -2
@@ -22,6 +22,8 @@ static inline u64 pvclock_scale_delta(u6u64 product;#ifdef __i386__u32 tmp1, tmp2; +#else +ulong tmp;#endif if (shift <0 )
@@ -42,8 +44,11 @@ static inline u64 pvclock_scale_delta(u6 : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );#elif defined(__x86_64__) __asm__ ( -"mul %%rdx ; shrd $32,%%rdx,%%rax" - :"=a" (product) :"0" (delta),"d" ((u64 )mul_frac) ); +"mul %[mul_frac] ; shrd $32, %[hi], %[lo]" + : [lo]"=a" (product), + [hi]"=d" (tmp) + :"0" (delta), + [mul_frac]"rm" ((u64 )mul_frac));#else #error implement me!#endif
PATCH 107/107 IPVS netns exit causes crash in conntrack
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hans Schillstrom <[email protected]>
commit 8f4e0a18682d91abfad72ede3d3cb5f3ebdf54b4 upstream.
Quote from Patric Mc Hardy
"This looks like nfnetlink.c excited and destroyed the nfnl socket, but ip_vs was still holding a reference to a conntrack. When the conntrack got destroyed it created a ctnetlink event, causing an oops in netlink_has_listeners when trying to use the destroyed nfnetlink socket."
If nf_conntrack_netlink is loaded before ip_vs this is not a problem.
This patch simply avoids calling ip_vs_conn_drop_conntrack() when netns is dying as suggested by Julian.
--- net/netfilter/ipvs/ip_vs_conn.c | 10 +++++++++- net/netfilter/ipvs/ip_vs_core.c | 1 + 2 files changed, 10 insertions(+), 1 deletion(-)
net/netfilter/ipvs/ip_vs_conn.c +9 -1
@@ -776,8 +776,16 @@ static void ip_vs_conn_expire(unsigned lif (cp->control)ip_vs_control_del (cp); -if (cp->flags &IP_VS_CONN_F_NFCT ) +if (cp->flags &IP_VS_CONN_F_NFCT ) {ip_vs_conn_drop_conntrack (cp); +/* Do not access conntracks during subsys cleanup +* because nf_conntrack_find_get can not be used after +* conntrack cleanup for the net. +*/ +smp_rmb (); +if (ipvs->enable) +ip_vs_conn_drop_conntrack (cp); + }ip_vs_pe_put (cp->pe);kfree (cp->pe_data);
net/netfilter/ipvs/ip_vs_core.c +1 -0
@@ -1965,6 +1965,7 @@ static void __net_exit __ip_vs_dev_clean {EnterFunction (2 );net_ipvs (net)->enable =0 ;/* Disable packet reception */ +smp_wmb ();__ip_vs_sync_cleanup (net);LeaveFunction (2 ); }