3.2.79-rc1 review
Subsystems (2)
cover 3.2.79-rc1 review
This is the start of the stable review cycle for the 3.2.79 release. There are 62 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Mar 31 22:00:00 UTC 2016. Anything received after that time might be too late.
A combined patch relative to 3.2.78 will be posted as an additional response to this. A shortlog and diffstat can be found below.
Ben.
-------------
Alexandra Yates (1):
Adding Intel Lewisburg device IDs for SATA
[f5bdd66c705484b4bc77eb914be15c1b7881fae7]
Amir Vadai (1):
net/mlx4_en: Count HW buffer overrun only once
[281e8b2fdf8e4ef366b899453cae50e09b577ada]
Andrea Arcangeli (1):
mm: thp: fix SMP race condition between THP page fault and MADV_DONTNEED
[ad33bb04b2a6cee6c1f99fabb15cddbf93ff0433]
Andrey Skvortsov (1):
USB: option: add support for SIM7100E
[3158a8d416f4e1b79dcc867d67cb50013140772c]
Anton Protopopov (1):
cifs: fix erroneous return value
[4b550af519854421dfec9f7732cdddeb057134b2]
Arnd Bergmann (2):
libata: fix HDIO_GET_32BIT ioctl
[287e6611ab1eac76c2c5ebf6e345e04c80ca9c61]
tracing: Fix freak link error caused by branch tracer
[b33c8ff4431a343561e2319f17c14286f2aa52e2]
Ben Hutchings (2):
Revert "crypto: algif_skcipher - Do not dereference ctx without socket lock"
[not upstream; reverting a broken backport]
crypto: {blk,giv}cipher: Set has_setkey
[a1383cd86a062fc798899ab20f0ec2116cce39cb]
Benjamin Poirier (1):
mld, igmp: Fix reserved tailroom calculation
[1837b2e2bcd23137766555a63867e649c0b637f0]
Bjørn Mork (1):
USB: option: add "4G LTE usb-modem U901"
[d061c1caa31d4d9792cfe48a2c6b309a0e01ef46]
CQ Tang (1):
iommu/vt-d: Fix 64-bit accesses to 32-bit DMAR_GSTS_REG
[fda3bec12d0979aae3f02ee645913d66fbc8a26e]
Chris Bainbridge (1):
mac80211: fix use of uninitialised values in RX aggregation
[f39ea2690bd61efec97622c48323f40ed6e16317]
Christian Borntraeger (1):
KVM: async_pf: do not warn on page allocation failures
[d7444794a02ff655eda87e3cc54e86b940e7736f]
Christoph Hellwig (1):
nfs: fix nfs_size_to_loff_t
[50ab8ec74a153eb30db26529088bc57dd700b24c]
David Woodhouse (2):
Fix directory hardlinks from deleted directories
[be629c62a603e5935f8177fd8a19e014100a259e]
jffs2: Fix page lock / f->sem deadlock
[49e91e7079febe59a20ca885a87dd1c54240d0f1]Felix Fietkau (1):
mac80211: minstrel_ht: set default tx aggregation timeout to 0
[7a36b930e6ed4702c866dc74a5ad07318a57c688]
Gabriel Krisman Bertazi (1):
ipr: Fix regression when loading firmware
[21b81716c6bff24cda52dc75588455f879ddbfe9]
Gerhard Uttenthaler (1):
can: ems_usb: Fix possible tx overflow
[90cfde46586d2286488d8ed636929e936c0c9ab2]
H. Peter Anvin (1):
x86, extable: Remove open-coded exception table entries in arch/x86/lib/copy_user_nocache_64.S
[0d8559feafbc9dc5a2c17ba42aea7de824b18308]
Harvey Hunt (1):
libata: Align ata_device's id on a cacheline
[4ee34ea3a12396f35b26d90a094c75db95080baa]
Insu Yun (1):
ipr: Fix out-of-bounds null overwrite
[d63c7dd5bcb9441af0526d370c43a65ca2c980d9]
Ioan-Adrian Ratiu (1):
HID: usbhid: fix recursive deadlock
[e470127e9606b1fa151c4184243e61296d1e0c0f]
Jan Kara (1):
ext4: fix bh->b_state corruption
[ed8ad83808f009ade97ebbf6519bc3a97fefbc0c]Johannes Berg (2):
cfg80211/wext: fix message ordering
[cb150b9d23be6ee7f3a0fff29784f1c5b5ac514d]
wext: fix message delay/ordering
[8bf862739a7786ae72409220914df960a0aa80d8]
John Youn (1):
usb: dwc3: Fix assignment of EP transfer resources
[c450960187f45d4260db87c7dd4fc0bceb5565d8]
Ken Lin (1):
USB: cp210x: add IDs for GE B650V3 and B850V3 boards
[6627ae19385283b89356a199d7f03c75ba35fb29]Konrad Rzeszutek Wilk (3):
xen/pciback: Check PF instead of VF for PCI_COMMAND_MEMORY
[8d47065f7d1980dde52abb874b301054f3013602]
xen/pciback: Save the number of MSI-X entries to be copied later.
[d159457b84395927b5a52adb72f748dd089ad5e5]
xen/pcifront: Fix mysterious crashes when NUMA locality information was extracted.
[4d8c8bd6f2062c9988817183a91fe2e623c8aa5e]
Linus Torvalds (1):
Revert "drm/radeon: call hpd_irq_event on resume"
[256faedcfd646161477d47a1a78c32a562d2e845]
Maciej W. Rozycki (1):
MIPS: traps: Fix SIGFPE information leak from do_ov' and do_trap_or_bp'
[e723e3f7f9591b79e8c56b3d7c5a204a9c571b55]
Martin Schwidefsky (1):
s390/mm: four page table levels vs. fork
[3446c13b268af86391d06611327006b059b8bab1]
Mikulas Patocka (1):
hpfs: don't truncate the file when delete fails
[b6853f78e763d42c7a158d8de3549c9827c604ab]
Or Gerlitz (1):
IB/core: Use GRH when the path hop-limit > 0
[11d8d645343efba0c975aefe7c2cf3b33c836c75]
Rainer Weikusat (2):
af_unix: Don't set err in unix_stream_read_generic unless there was an error
[1b92ee3d03af6643df395300ba7748f19ecdb0c5]
af_unix: Guard against other == sk in unix_dgram_sendmsg
[a5527dda344fff0514b7989ef7a755729769daa1]Rasmus Villemoes (1):
drm/i915: fix error path in intel_setup_gmbus()
[2417c8c03f508841b85bf61acc91836b7b0e2560]
Richard Weinberger (1):
ubi: Fix out of bounds write in volume update code
[e4f6daac20332448529b11f09388f1d55ef2084c]
Simon Guinot (1):
kernel/resource.c: fix muxed resource handling in __request_region()
[59ceeaaf355fa0fb16558ef7c24413c804932ada]
Stefan Haberland (2):
s390/dasd: fix refcount for PAV reassignment
[9d862ababb609439c5d6987f6d3ddd09e703aa0b]
s390/dasd: prevent incorrect length error under z/VM after PAV changes
[020bf042e5b397479c1174081b935d0ff15d1a64]
Stefan Hajnoczi (1):
sunrpc/cache: fix off-by-one in qword_get()
[b7052cd7bcf3c1478796e93e3dff2b44c9e82943]
Steven Rostedt (1):
tracepoints: Do not trace when cpu is offline
[f37755490fe9bf76f6ba1d8c6591745d3574a6a6]
Takashi Iwai (8):
ALSA: hdsp: Fix wrong boolean ctl value accesses
[eab3c4db193f5fcccf70e884de9a922ca2c63d80]
ALSA: hdspm: Fix wrong boolean ctl value accesses
[537e48136295c5860a92138c5ea3959b9542868b]
ALSA: seq: Fix double port list deletion
[13d5e5d4725c64ec06040d636832e78453f477b7]
ALSA: seq: Fix leak of pool buffer at concurrent writes
[d99a36f4728fcbcc501b78447f625bdcce15b842]
ALSA: seq: oss: Don't drain at closing a client
[197b958c1e76a575d77038cc98b4bebc2134279f]
ALSA: timer: Fix broken compat timer user status ioctl
[3a72494ac2a3bd229db941d51e7efe2f6ccd947b]
ASoC: wm8958: Fix enum ctl accesses in a wrong type
[d0784829ae3b0beeb69b476f017d5c8a2eb95198]
ASoC: wm8994: Fix enum ctl accesses in a wrong type
[8019c0b37cd5a87107808300a496388b777225bf]
Thomas Betker (1):
Revert "jffs2: Fix lock acquisition order bug in jffs2_write_begin"
[157078f64b8a9cd7011b6b900b2f2498df850748]
Todd E Brandt (1):
PM / sleep / x86: Fix crash on graph trace through x86 suspend
[92f9e179a702a6adbc11e2fedc76ecd6ffc9e3f7]
Toshi Kani (2):
x86/uaccess/64: Handle the caching of 4-byte nocache copies properly in __copy_user_nocache()
[a82eee7424525e34e98d821dd059ce14560a1e35]
x86/uaccess/64: Make the __copy_user_nocache() assembly code more readable
[ee9737c924706aaa72c2ead93e3ad5644681dc1c]
Vasily Kulikov (1):
include/linux/poison.h: fix LIST_POISON{1,2} offset
[8a5e5e02fc83aaf67053ab53b359af08c6c49aaf]
Vittorio Alfieri (1):
USB: cp210x: Add ID for Parrot NMEA GPS Flight Recorder
[3c4c615d70c8cbdc8ba8c79ed702640930652a79]Vladis Dronov (1):
Input: aiptek - fix crash on detecting device without endpoints
[8e20cf2bce122ce9262d6034ee5d5b76fbb92f96]
Yegor Yefremov (1):
USB: serial: option: add support for Quectel UC20
[c0992d0f54847d0d1d85c60fcaa054f175ab1ccd]
Makefile | 4 +- arch/mips/kernel/traps.c | 13 ++- arch/s390/include/asm/mmu_context.h | 20 ++-- arch/s390/include/asm/pgalloc.h | 3 - arch/x86/kernel/acpi/sleep.c | 7 ++ arch/x86/lib/copy_user_nocache_64.S | 152 ++++++++++++++++++--------- crypto/ablkcipher.c | 1 + crypto/algif_skcipher.c | 5 +- crypto/blkcipher.c | 1 + drivers/ata/ahci.c | 6 ++ drivers/ata/libata-scsi.c | 11 +- drivers/gpu/drm/i915/intel_i2c.c | 2 +- drivers/gpu/drm/radeon/radeon_device.c | 1 - drivers/hid/usbhid/hid-core.c | 4 +- drivers/infiniband/core/sa_query.c | 2 +- drivers/input/tablet/aiptek.c | 9 ++ drivers/iommu/dmar.c | 2 +- drivers/iommu/intr_remapping.c | 2 +- drivers/mtd/ubi/upd.c | 2 +- drivers/net/can/usb/ems_usb.c | 14 ++- drivers/net/ethernet/mellanox/mlx4/en_port.c | 4 +- drivers/pci/xen-pcifront.c | 10 +- drivers/s390/block/dasd_alias.c | 23 ++-- drivers/scsi/ipr.c | 10 +- drivers/usb/dwc3/core.h | 1 - drivers/usb/dwc3/ep0.c | 5 - drivers/usb/dwc3/gadget.c | 70 ++++++++---- drivers/usb/serial/cp210x.c | 3 + drivers/usb/serial/option.c | 11 ++ drivers/xen/xen-pciback/pciback_ops.c | 9 +- fs/cifs/cifsencrypt.c | 2 +- fs/ext4/inode.c | 32 +++++- fs/hpfs/namei.c | 31 +----- fs/jffs2/README.Locking | 5 +- fs/jffs2/build.c | 75 +++++++++---- fs/jffs2/file.c | 39 ++++--- fs/jffs2/gc.c | 17 +-- fs/jffs2/nodelist.h | 6 +- include/linux/ata.h | 4 +- include/linux/compiler.h | 2 +- include/linux/libata.h | 2 +- include/linux/nfs_fs.h | 4 +- include/linux/poison.h | 4 +- include/linux/skbuff.h | 24 +++++ include/linux/tracepoint.h | 5 + include/net/iw_handler.h | 6 ++ kernel/resource.c | 5 +- mm/memory.c | 14 ++- net/ipv4/igmp.c | 3 +- net/ipv6/mcast.c | 3 +- net/mac80211/agg-rx.c | 2 +- net/mac80211/rc80211_minstrel_ht.c | 2 +- net/sunrpc/cache.c | 2 +- net/unix/af_unix.c | 23 ++-- net/wireless/core.c | 4 + net/wireless/wext-core.c | 52 +++++++-- sound/core/seq/oss/seq_oss.c | 2 - sound/core/seq/oss/seq_oss_device.h | 1 - sound/core/seq/oss/seq_oss_init.c | 17 --- sound/core/seq/seq_memory.c | 13 ++- sound/core/seq/seq_ports.c | 13 ++- sound/core/timer_compat.c | 5 +- sound/pci/rme9652/hdsp.c | 4 +- sound/pci/rme9652/hdspm.c | 6 +- sound/soc/codecs/wm8958-dsp2.c | 8 +- sound/soc/codecs/wm8994.c | 4 +- virt/kvm/async_pf.c | 2 +- 67 files changed, 555 insertions(+), 295 deletions(-)
Signature · 2 lines
Ben Hutchings Tomorrow will be cancelled due to lack of interest.
PATCH 1/62 Revert "crypto: algif_skcipher - Do not dereference ctx without socket lock"
3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
This reverts commit c54ddfbb1b691d77c52b76ca6e13ca7082eb3b82, which was a poorly backported version of commit 6454c2b83f719057069777132b13949e4c6b6350 upstream. The small part I was able to backport makes no sense by itself.
--- crypto/algif_skcipher.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
crypto/algif_skcipher.c +1 -4
@@ -249,11 +249,8 @@ static int skcipher_sendmsg(struct kiocb {struct sock *sk = sock->sk;struct alg_sock *ask =alg_sk (sk); -struct sock *psk = ask->parent; -struct alg_sock *pask =alg_sk (psk);struct skcipher_ctx *ctx = ask->private; -struct ablkcipher_tfm *skc = pask->private; -struct crypto_ablkcipher *tfm = skc->base; +struct crypto_ablkcipher *tfm =crypto_ablkcipher_reqtfm (&ctx->req);unsigned ivsize =crypto_ablkcipher_ivsize (tfm);struct skcipher_sg_list *sgl;struct af_alg_control con = {};
PATCH 2/62 crypto: {blk,giv}cipher: Set has_setkey
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
Commit a1383cd86a06 ("crypto: skcipher - Add crypto_skcipher_has_setkey") was incorrectly backported to the 3.2.y and 3.16.y stable branches. We need to set ablkcipher_tfm::has_setkey in the crypto_init_blkcipher_ops_async() and crypto_init_givcipher_ops() functions as well as crypto_init_ablkcipher_ops().
---
crypto/ablkcipher.c +1 -0
@@ -461,6 +461,7 @@ static int crypto_init_givcipher_ops(str crt->givdecrypt = alg->givdecrypt ?: no_givdecrypt; crt->base =__crypto_ablkcipher_cast (tfm); crt->ivsize = alg->ivsize; + crt->has_setkey = alg->max_keysize;return 0 ; }
crypto/blkcipher.c +1 -0
@@ -458,6 +458,7 @@ static int crypto_init_blkcipher_ops_asy } crt->base =__crypto_ablkcipher_cast (tfm); crt->ivsize = alg->ivsize; + crt->has_setkey = alg->max_keysize;return 0 ; }
PATCH 3/62 iommu/vt-d: Fix 64-bit accesses to 32-bit DMAR_GSTS_REG
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: CQ Tang <[email protected]>
commit fda3bec12d0979aae3f02ee645913d66fbc8a26e upstream.
This is a 32-bit register. Apparently harmless on real hardware, but causing justified warnings in simulation.
--- drivers/iommu/dmar.c | 2 +- drivers/iommu/intr_remapping.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/dmar.c +1 -1
@@ -923,7 +923,7 @@ void dmar_disable_qi(struct intel_iommuraw_spin_lock_irqsave (&iommu->register_lock, flags); - sts =dmar_readq (iommu->reg +DMAR_GSTS_REG ); + sts =readl (iommu->reg +DMAR_GSTS_REG );if (!(sts &DMA_GSTS_QIES )) goto end;
drivers/iommu/intr_remapping.c +1 -1
@@ -496,7 +496,7 @@ static void iommu_disable_intr_remappingraw_spin_lock_irqsave (&iommu->register_lock, flags); - sts =dmar_readq (iommu->reg +DMAR_GSTS_REG ); + sts =readl (iommu->reg +DMAR_GSTS_REG );if (!(sts &DMA_GSTS_IRES )) goto end;
PATCH 4/62 wext: fix message delay/ordering
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 8bf862739a7786ae72409220914df960a0aa80d8 upstream.
Beniamino reported that he was getting an RTM_NEWLINK message for a given interface, after the RTM_DELLINK for it. It turns out that the message is a wireless extensions message, which was sent because the interface had been connected and disconnection while it was deleted caused a wext message.
For its netlink messages, wext uses RTM_NEWLINK, but the message is without all the regular rtnetlink attributes, so "ip monitor link" prints just rudimentary information:
5: wlan1: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default
link/ether 02:00:00:00:01:00 brd ff:ff:ff:ff:ff:ff
Deleted 5: wlan1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default
link/ether 02:00:00:00:01:00 brd ff:ff:ff:ff:ff:ff5: wlan1: <BROADCAST,MULTICAST,UP>
link/ether
(from my hwsim reproduction)
This can cause userspace to get confused since it doesn't expect an RTM_NEWLINK message after RTM_DELLINK.
The reason for this is that wext schedules a worker to send out the messages, and the scheduling delay can cause the messages to get out to userspace in different order.
To fix this, have wext register a netdevice notifier and flush out any pending messages when netdevice state changes. This fixes any ordering whenever the original message wasn't sent by a notifier itself.
--- net/wireless/wext-core.c | 51 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 11 deletions(-)
net/wireless/wext-core.c +40 -11
@@ -342,6 +342,39 @@ static const int compat_event_type_size[/* IW event code */ +static void wireless_nlevent_flush (void ) +{ +struct sk_buff *skb; +struct net *net; + +ASSERT_RTNL (); + +for_each_net (net) { +while ((skb =skb_dequeue (&net->wext_nlevents))) +rtnl_notify (skb, net,0 ,RTNLGRP_LINK ,NULL , +GFP_KERNEL ); + } +} + +static int wext_netdev_notifier_call (struct notifier_block *nb, +unsigned long state,void *ptr) +{ +/* +* When a netdev changes state in any way, flush all pending messages +* to avoid them going out in a strange order, e.g. RTM_NEWLINK after +* RTM_DELLINK, or with IFF_UP after without IFF_UP during dev_close() +* or similar - all of which could otherwise happen due to delays from +* schedule_work(). +*/ +wireless_nlevent_flush (); + +return NOTIFY_OK ; +} + +static struct notifier_block wext_netdev_notifier = { + .notifier_call = wext_netdev_notifier_call, +}; +static int __net_init wext_pernet_init (struct net *net) {skb_queue_head_init (&net->wext_nlevents);
@@ -360,7 +393,12 @@ static struct pernet_operations wext_perstatic int __init wireless_nlevent_init (void ) { -return register_pernet_subsys (&wext_pernet_ops); +int err =register_pernet_subsys (&wext_pernet_ops); + +if (err) +return err; + +return register_netdevice_notifier (&wext_netdev_notifier); }subsys_initcall (wireless_nlevent_init);
@@ -368,17 +406,8 @@ subsys_initcall(wireless_nlevent_init);/* Process events generated by the wireless layer or the driver. */ static void wireless_nlevent_process (struct work_struct *work) { -struct sk_buff *skb; -struct net *net; -rtnl_lock (); - -for_each_net (net) { -while ((skb =skb_dequeue (&net->wext_nlevents))) -rtnl_notify (skb, net,0 ,RTNLGRP_LINK ,NULL , -GFP_KERNEL ); - } - +wireless_nlevent_flush ();rtnl_unlock (); }
PATCH 5/62 cfg80211/wext: fix message ordering
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit cb150b9d23be6ee7f3a0fff29784f1c5b5ac514d upstream.
Since cfg80211 frequently takes actions from its netdev notifier call, wireless extensions messages could still be ordered badly since the wext netdev notifier, since wext is built into the kernel, runs before the cfg80211 netdev notifier. For example, the following can happen:
5: wlan1: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default
link/ether 02:00:00:00:01:00 brd ff:ff:ff:ff:ff:ff
5: wlan1: <BROADCAST,MULTICAST,UP>
link/ether
when setting the interface down causes the wext message.
To also fix this, export the wireless_nlevent_flush() function and also call it from the cfg80211 notifier.
[bwh: Backported to 3.2:
- Add default case in cfg80211_netdev_notifier_call() which bypasses the added wireless_nlevent_flush() (added upstream by commit 6784c7db8d43 "cfg80211: change return value of notifier function")
- Adjust context]
---
include/net/iw_handler.h +6 -0
@@ -442,6 +442,12 @@ extern void wireless_send_event(struct nunsigned int cmd, union iwreq_data * wrqu, const char * extra); +#ifdef CONFIG_WEXT_CORE +/* flush all previous wext events - if work is done from netdev notifiers */ +void wireless_nlevent_flush (void ); +#else +static inline void wireless_nlevent_flush (void ) {} +#endif /* We may need a function to send a stream of events to user space. * More on that later... */
net/wireless/core.c +4 -0
@@ -985,8 +985,12 @@ static int cfg80211_netdev_notifier_callif (ret)return notifier_from_errno (ret);break ; +default : +return NOTIFY_DONE ; } +wireless_nlevent_flush (); +return NOTIFY_DONE ; }
net/wireless/wext-core.c +2 -1
@@ -342,7 +342,7 @@ static const int compat_event_type_size[/* IW event code */ -static void wireless_nlevent_flush (void ) +void wireless_nlevent_flush (void ) {struct sk_buff *skb;struct net *net;
@@ -355,6 +355,7 @@ static void wireless_nlevent_flush(void) GFP_KERNEL); } } +EXPORT_SYMBOL_GPL (wireless_nlevent_flush);static int wext_netdev_notifier_call (struct notifier_block *nb,unsigned long state,void *ptr)
PATCH 6/62 mac80211: fix use of uninitialised values in RX aggregation
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chris Bainbridge <[email protected]>
commit f39ea2690bd61efec97622c48323f40ed6e16317 upstream.
Use kzalloc instead of kmalloc for struct tid_ampdu_rx to initialize the "removed" field (all others are initialized manually). That fixes:
UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29 load of value 2 is not a valid value for type '_Bool' CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265 Workqueue: phy0 rt2x00usb_work_rxdone 0000000000000004 ffff880254a7ba50 ffffffff8181d866 0000000000000007 ffff880254a7ba78 ffff880254a7ba68 ffffffff8188422d ffffffff8379b500 ffff880254a7bab8 ffffffff81884747 0000000000000202 0000000348620032 Call Trace: [<ffffffff8181d866>] dump_stack+0x45/0x5f [<ffffffff8188422d>] ubsan_epilogue+0xd/0x40 [<ffffffff81884747>] __ubsan_handle_load_invalid_value+0x67/0x70 [<ffffffff82227b4d>] ieee80211_sta_reorder_release.isra.16+0x5ed/0x730 [<ffffffff8222ca14>] ieee80211_prepare_and_rx_handle+0xd04/0x1c00 [<ffffffff8222db03>] __ieee80211_rx_handle_packet+0x1f3/0x750 [<ffffffff8222e4a7>] ieee80211_rx_napi+0x447/0x990
While at it, convert to use sizeof(*tid_agg_rx) instead.
--- net/mac80211/agg-rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/agg-rx.c +1 -1
@@ -280,7 +280,7 @@ void ieee80211_process_addba_request(str }/* prepare A-MPDU MLME for Rx aggregation */ - tid_agg_rx =kmalloc (sizeof (struct tid_ampdu_rx ),GFP_KERNEL ); + tid_agg_rx =kzalloc (sizeof (*tid_agg_rx),GFP_KERNEL );if (!tid_agg_rx) goto end;
PATCH 7/62 nfs: fix nfs_size_to_loff_t
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 50ab8ec74a153eb30db26529088bc57dd700b24c upstream.
See http: //www.infradead.org/rpr.html
X-Evolution-Source: [email protected]
Content-Transfer-Encoding: 8bit
Mime-Version: 1.0
We support OFFSET_MAX just fine, so don't round down below it. Also switch to using min_t to make the helper more readable.
--- include/linux/nfs_fs.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
include/linux/nfs_fs.h +1 -3
@@ -588,9 +588,7 @@ static inline void nfs3_forget_cached_acstatic inline loff_t nfs_size_to_loff_t (__u64 size) { -if (size > (__u64 )OFFSET_MAX -1 ) -return OFFSET_MAX -1 ; -return (loff_t ) size; +return min_t (u64, size,OFFSET_MAX ); } static inline ino_t
PATCH 8/62 drm/i915: fix error path in intel_setup_gmbus()
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Rasmus Villemoes <[email protected]>
commit ed3f9fd1e865975ceefdb2a43b453e090b1fd787 upstream.
This fails to undo the setup for pin==0; moreover, something interesting happens if the setup failed already at pin==0.
--- drivers/gpu/drm/i915/intel_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_i2c.c +1 -1
@@ -410,7 +410,7 @@ int intel_setup_gmbus(struct drm_devicereturn 0 ; err: -while (--i) { +while (i--) {struct intel_gmbus *bus = &dev_priv->gmbus[i];i2c_del_adapter (&bus->adapter); }
PATCH 9/62 cifs: fix erroneous return value
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Anton Protopopov <[email protected]>
commit 4b550af519854421dfec9f7732cdddeb057134b2 upstream.
The setup_ntlmv2_rsp() function may return positive value ENOMEM instead of -ENOMEM in case of kmalloc failure.
--- fs/cifs/cifsencrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/cifsencrypt.c +1 -1
@@ -616,7 +616,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, c ses->auth_key.response =kmalloc (baselen + tilen,GFP_KERNEL );if (!ses->auth_key.response) { - rc =ENOMEM ; + rc = -ENOMEM ; ses->auth_key.len =0 ;cERROR (1 ,"%s: Can't allocate auth blob" , __func__); goto setup_ntlmv2_rsp_ret;
PATCH 10/62 s390/dasd: prevent incorrect length error under z/VM after PAV changes
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <[email protected]>
commit 020bf042e5b397479c1174081b935d0ff15d1a64 upstream.
The channel checks the specified length and the provided amount of data for CCWs and provides an incorrect length error if the size does not match. Under z/VM with simulation activated the length may get changed. Having the suppress length indication bit set is stated as good CCW coding practice and avoids errors under z/VM.
--- drivers/s390/block/dasd_alias.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/block/dasd_alias.c +1 -1
@@ -749,7 +749,7 @@ static int reset_summary_unit_check(struASCEBC ((char *) &cqr->magic,4 ); ccw = cqr->cpaddr; ccw->cmd_code =DASD_ECKD_CCW_RSCK ; - ccw->flags =0 ; + ccw->flags =CCW_FLAG_SLI ; ccw->count =16 ; ccw->cda = (__u32 )(addr_t ) cqr->data; ((char *)cqr->data)[0 ] = reason;
PATCH 11/62 s390/dasd: fix refcount for PAV reassignment
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <[email protected]>
commit 9d862ababb609439c5d6987f6d3ddd09e703aa0b upstream.
Add refcount to the DASD device when a summary unit check worker is scheduled. This prevents that the device is set offline with worker in place.
--- drivers/s390/block/dasd_alias.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/s390/block/dasd_alias.c +16 -5
@@ -326,8 +326,10 @@ void dasd_alias_disconnect_device_from_lspin_unlock_irqrestore (&lcu->lock, flags);cancel_work_sync (&lcu->suc_data.worker);spin_lock_irqsave (&lcu->lock, flags); -if (device == lcu->suc_data.device) +if (device == lcu->suc_data.device) { +dasd_put_device (device); lcu->suc_data.device =NULL ; + } } was_pending =0 ;if (device == lcu->ruac_data.device) {
@@ -335,8 +337,10 @@ void dasd_alias_disconnect_device_from_l was_pending =1 ;cancel_delayed_work_sync (&lcu->ruac_data.dwork);spin_lock_irqsave (&lcu->lock, flags); -if (device == lcu->ruac_data.device) +if (device == lcu->ruac_data.device) { +dasd_put_device (device); lcu->ruac_data.device =NULL ; + } } private->lcu =NULL ;spin_unlock_irqrestore (&lcu->lock, flags);
@@ -586,8 +590,10 @@ static void lcu_update_work(struct work_if (rc || (lcu->flags &NEED_UAC_UPDATE )) {DBF_DEV_EVENT (DBF_WARNING , device,"could not update" " alias data in lcu (rc = %d), retry later" , rc); -schedule_delayed_work (&lcu->ruac_data.dwork,30 *HZ ); +if (!schedule_delayed_work (&lcu->ruac_data.dwork,30 *HZ )) +dasd_put_device (device); }else { +dasd_put_device (device); lcu->ruac_data.device =NULL ; lcu->flags &= ~UPDATE_PENDING ; }
@@ -630,8 +636,10 @@ static int _schedule_lcu_update(struct a*/ if (!usedev)return -EINVAL ; +dasd_get_device (usedev); lcu->ruac_data.device = usedev; -schedule_delayed_work (&lcu->ruac_data.dwork,0 ); +if (!schedule_delayed_work (&lcu->ruac_data.dwork,0 )) +dasd_put_device (usedev);return 0 ; }
@@ -953,6 +961,7 @@ static void summary_unit_check_handling_/* 3. read new alias configuration */ _schedule_lcu_update (lcu, device); lcu->suc_data.device =NULL ; +dasd_put_device (device);spin_unlock_irqrestore (&lcu->lock, flags); }
@@ -1012,6 +1021,8 @@ void dasd_alias_handle_summary_unit_chec } lcu->suc_data.reason = reason; lcu->suc_data.device = device; +dasd_get_device (device);spin_unlock (&lcu->lock); -schedule_work (&lcu->suc_data.worker); +if (!schedule_work (&lcu->suc_data.worker)) +dasd_put_device (device); };
PATCH 12/62 libata: fix HDIO_GET_32BIT ioctl
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 287e6611ab1eac76c2c5ebf6e345e04c80ca9c61 upstream.
As reported by Soohoon Lee, the HDIO_GET_32BIT ioctl does not work correctly in compat mode with libata.
I have investigated the issue further and found multiple problems that all appeared with the same commit that originally introduced HDIO_GET_32BIT handling in libata back in linux-2.6.8 and presumably also linux-2.4, as the code uses "copy_to_user(arg, &val, 1)" to copy a 'long' variable containing either 0 or 1 to user space.
The problems with this are:
* On big-endian machines, this will always write a zero because it stores the wrong byte into user space.
* In compat mode, the upper three bytes of the variable are updated by the compat_hdio_ioctl() function, but they now contain uninitialized stack data.
* The hdparm tool calling this ioctl uses a 'static long' variable to store the result. This means at least the upper bytes are initialized to zero, but calling another ioctl like HDIO_GET_MULTCOUNT would fill them with data that remains stale when the low byte is overwritten. Fortunately libata doesn't implement any of the affected ioctl commands, so this would only happen when we query both an IDE and an ATA device in the same command such as "hdparm -N -c /dev/hda /dev/sda"
* The libata code for unknown reasons started using ATA_IOC_GET_IO32 and ATA_IOC_SET_IO32 as aliases for HDIO_GET_32BIT and HDIO_SET_32BIT, while the ioctl commands that were added later use the normal HDIO_* names. This is harmless but rather confusing.
This addresses all four issues by changing the code to use put_user() on an 'unsigned long' variable in HDIO_GET_32BIT, like the IDE subsystem does, and by clarifying the names of the ioctl commands.
--- drivers/ata/libata-scsi.c | 11 +++++------ include/linux/ata.h | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-)
drivers/ata/libata-scsi.c +5 -6
@@ -672,19 +672,18 @@ static int ata_ioc32(struct ata_port *apint ata_sas_scsi_ioctl (struct ata_port *ap,struct scsi_device *scsidev,int cmd,void __user *arg) { -int val = -EINVAL , rc = -EINVAL ; +unsigned long val; +int rc = -EINVAL ;unsigned long flags;switch (cmd) { -case ATA_IOC_GET_IO32 : +case HDIO_GET_32BIT :spin_lock_irqsave (ap->lock, flags); val =ata_ioc32 (ap);spin_unlock_irqrestore (ap->lock, flags); -if (copy_to_user (arg, &val,1 )) -return -EFAULT ; -return 0 ; +return put_user (val, (unsigned long __user *)arg); -case ATA_IOC_SET_IO32 : +case HDIO_SET_32BIT : val = (unsigned long ) arg; rc =0 ;spin_lock_irqsave (ap->lock, flags);
include/linux/ata.h +2 -2
@@ -464,8 +464,8 @@ enum ata_tf_protocols { };enum ata_ioctls { -ATA_IOC_GET_IO32 =0x309 , -ATA_IOC_SET_IO32 =0x324 , +ATA_IOC_GET_IO32 =0x309 ,/* HDIO_GET_32BIT */ +ATA_IOC_SET_IO32 =0x324 ,/* HDIO_SET_32BIT */ };/* core structures */
PATCH 13/62 xen/pciback: Check PF instead of VF for PCI_COMMAND_MEMORY
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Rzeszutek Wilk <[email protected]>
commit 8d47065f7d1980dde52abb874b301054f3013602 upstream.
Commit 408fb0e5aa7fda0059db282ff58c3b2a4278baa0 (xen/pciback: Don't allow MSI-X ops if PCI_COMMAND_MEMORY is not set) prevented enabling MSI-X on passed-through virtual functions, because it checked the VF for PCI_COMMAND_MEMORY but this is not a valid bit for VFs.
Instead, check the physical function for PCI_COMMAND_MEMORY.
--- drivers/xen/xen-pciback/pciback_ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/xen/xen-pciback/pciback_ops.c +2 -1
@@ -225,8 +225,9 @@ int xen_pcibk_enable_msix(struct xen_pci/* * PCI_COMMAND_MEMORY must be enabled, otherwise we may not be able * to access the BARs where the MSI-X entries reside. +* But VF devices are unique in which the PF needs to be checked. */ -pci_read_config_word (dev,PCI_COMMAND , &cmd); +pci_read_config_word (pci_physfn (dev),PCI_COMMAND , &cmd);if (dev->msi_enabled || !(cmd &PCI_COMMAND_MEMORY ))return -ENXIO ;
PATCH 14/62 xen/pciback: Save the number of MSI-X entries to be copied later.
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Rzeszutek Wilk <[email protected]>
commit d159457b84395927b5a52adb72f748dd089ad5e5 upstream.
Commit 8135cf8b092723dbfcc611fe6fdcb3a36c9951c5 (xen/pciback: Save xen_pci_op commands before processing it) broke enabling MSI-X because it would never copy the resulting vectors into the response. The number of vectors requested was being overwritten by the return value (typically zero for success).
Save the number of vectors before processing the op, so the correct number of vectors are copied afterwards.
--- drivers/xen/xen-pciback/pciback_ops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/xen/xen-pciback/pciback_ops.c +5 -1
@@ -331,6 +331,9 @@ void xen_pcibk_do_op(struct work_structstruct xen_pcibk_dev_data *dev_data =NULL ;struct xen_pci_op *op = &pdev->op;int test_intx =0 ; +#ifdef CONFIG_PCI_MSI +unsigned int nr =0 ; +#endif *op = pdev->sh_info->op;barrier ();
@@ -359,6 +362,7 @@ void xen_pcibk_do_op(struct work_struct op->err =xen_pcibk_disable_msi (pdev, dev, op);break ;case XEN_PCI_OP_enable_msix: + nr = op->value; op->err =xen_pcibk_enable_msix (pdev, dev, op);break ;case XEN_PCI_OP_disable_msix:
@@ -381,7 +385,7 @@ void xen_pcibk_do_op(struct work_structif (op->cmd == XEN_PCI_OP_enable_msix && op->err ==0 ) {unsigned int i; -for (i =0 ; i < op->value; i++) +for (i =0 ; i < nr; i++) pdev->sh_info->op.msix_entries[i].vector = op->msix_entries[i].vector; }
PATCH 15/62 xen/pcifront: Fix mysterious crashes when NUMA locality information was extracted.
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Rzeszutek Wilk <[email protected]>
commit 4d8c8bd6f2062c9988817183a91fe2e623c8aa5e upstream.
Occasionaly PV guests would crash with:
pciback 0000:00:00.1: Xen PCI mapped GSI0 to IRQ16
BUG: unable to handle kernel paging request at 0000000d1a8c0be0 .. snip.. <ffffffff8139ce1b>] find_next_bit+0xb/0x10 [<ffffffff81387f22>] cpumask_next_and+0x22/0x40 [<ffffffff813c1ef8>] pci_device_probe+0xb8/0x120 [<ffffffff81529097>] ? driver_sysfs_add+0x77/0xa0 [<ffffffff815293e4>] driver_probe_device+0x1a4/0x2d0 [<ffffffff813c1ddd>] ? pci_match_device+0xdd/0x110 [<ffffffff81529657>] __device_attach_driver+0xa7/0xb0 [<ffffffff815295b0>] ? __driver_attach+0xa0/0xa0 [<ffffffff81527622>] bus_for_each_drv+0x62/0x90 [<ffffffff8152978d>] __device_attach+0xbd/0x110 [<ffffffff815297fb>] device_attach+0xb/0x10 [<ffffffff813b75ac>] pci_bus_add_device+0x3c/0x70 [<ffffffff813b7618>] pci_bus_add_devices+0x38/0x80 [<ffffffff813dc34e>] pcifront_scan_root+0x13e/0x1a0 [<ffffffff817a0692>] pcifront_backend_changed+0x262/0x60b [<ffffffff814644c6>] ? xenbus_gather+0xd6/0x160 [<ffffffff8120900f>] ? put_object+0x2f/0x50 [<ffffffff81465c1d>] xenbus_otherend_changed+0x9d/0xa0 [<ffffffff814678ee>] backend_changed+0xe/0x10 [<ffffffff81463a28>] xenwatch_thread+0xc8/0x190 [<ffffffff810f22f0>] ? woken_wake_function+0x10/0x10
which was the result of two things:
When we call pci_scan_root_bus we would pass in 'sd' (sysdata) pointer which was an 'pcifront_sd' structure. However in the pci_device_add it expects that the 'sd' is 'struct sysdata' and sets the dev->node to what is in sd->node (offset 4):
set_dev_node(&dev->dev, pcibus_to_node(bus));
__pcibus_to_node(const struct pci_bus *bus)
{
const struct pci_sysdata *sd = bus->sysdata;
return sd->node;
}However our structure was pcifront_sd which had nothing at that offset:
struct pcifront_sd {
int domain; /* 0 4 */
/* XXX 4 bytes hole, try to pack */
struct pcifront_device * pdev; /* 8 8 */
}
That is an hole - filled with garbage as we used kmalloc instead of kzalloc (the second problem).
This patch fixes the issue by:
1) Use kzalloc to initialize to a well known state.
2) Put 'struct pci_sysdata' at the start of 'pcifront_sd'. That way access to the 'node' will access the right offset.
--- drivers/pci/xen-pcifront.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/pci/xen-pcifront.c +6 -4
@@ -50,7 +50,7 @@ struct pcifront_device { };struct pcifront_sd { -int domain; +struct pci_sysdata sd;struct pcifront_device *pdev; };
@@ -64,7 +64,9 @@ static inline void pcifront_init_sd(stru unsigned int domain, unsigned int bus, struct pcifront_device *pdev) { - sd->domain = domain; +/* Because we do not expose that information via XenBus. */ + sd->sd.node = first_online_node; + sd->sd.domain = domain; sd->pdev = pdev; }
@@ -461,8 +463,8 @@ static int __devinit pcifront_scan_root(dev_info (&pdev->xdev->dev,"Creating PCI Frontend Bus %04x:%02x\n" , domain, bus); - bus_entry =kmalloc (sizeof (*bus_entry),GFP_KERNEL ); - sd =kmalloc (sizeof (*sd),GFP_KERNEL ); + bus_entry =kzalloc (sizeof (*bus_entry),GFP_KERNEL ); + sd =kzalloc (sizeof (*sd),GFP_KERNEL );if (!bus_entry || !sd) { err = -ENOMEM ; goto err_out;
PATCH 16/62 ALSA: seq: Fix leak of pool buffer at concurrent writes
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit d99a36f4728fcbcc501b78447f625bdcce15b842 upstream.
When multiple concurrent writes happen on the ALSA sequencer device right after the open, it may try to allocate vmalloc buffer for each write and leak some of them. It's because the presence check and the assignment of the buffer is done outside the spinlock for the pool.
The fix is to move the check and the assignment into the spinlock.
(The current implementation is suboptimal, as there can be multiple
unnecessary vmallocs because the allocation is done before the check in the spinlock. But the pool size is already checked beforehand, so this isn't a big problem; that is, the only possible path is the multiple writes before any pool assignment, and practically seen, the current coverage should be "good enough".)
The issue was triggered by syzkaller fuzzer.
--- sound/core/seq/seq_memory.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
sound/core/seq/seq_memory.c +9 -4
@@ -383,17 +383,22 @@ int snd_seq_pool_init(struct snd_seq_pooif (snd_BUG_ON (!pool))return -EINVAL ; -if (pool->ptr)/* should be atomic? */ -return 0 ; - pool->ptr =vmalloc (sizeof (struct snd_seq_event_cell ) * pool->size); -if (pool->ptr ==NULL ) { + cellptr =vmalloc (sizeof (struct snd_seq_event_cell ) * pool->size); +if (!cellptr) {snd_printd ("seq: malloc for sequencer events failed\n" );return -ENOMEM ; }/* add new cells to the free cell list */ spin_lock_irqsave (&pool->lock, flags); +if (pool->ptr) { +spin_unlock_irqrestore (&pool->lock, flags); +vfree (cellptr); +return 0 ; + } + + pool->ptr = cellptr; pool->free =NULL ;for (cell =0 ; cell < pool->size; cell++) {
PATCH 17/62 tracepoints: Do not trace when cpu is offline
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit f37755490fe9bf76f6ba1d8c6591745d3574a6a6 upstream.
The tracepoint infrastructure uses RCU sched protection to enable and disable tracepoints safely. There are some instances where tracepoints are used in infrastructure code (like kfree()) that get called after a CPU is going offline, and perhaps when it is coming back online but hasn't been registered yet.
This can probuce the following warning:
[ INFO: suspicious RCU usage. ]
4.4.0-00006-g0fe53e8-dirty #34 Tainted: G S
-------------------------------
include/trace/events/kmem.h:141 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
RCU used illegally from offline CPU! rcu_scheduler_active = 1, debug_locks = 1 no locks held by swapper/8/0.
stack backtrace: CPU: 8 PID: 0 Comm: swapper/8 Tainted: G S 4.4.0-00006-g0fe53e8-dirty #34 Call Trace: [c0000005b76c78d0] [c0000000008b9540] .dump_stack+0x98/0xd4 (unreliable) [c0000005b76c7950] [c00000000010c898] .lockdep_rcu_suspicious+0x108/0x170 [c0000005b76c79e0] [c00000000029adc0] .kfree+0x390/0x440 [c0000005b76c7a80] [c000000000055f74] .destroy_context+0x44/0x100 [c0000005b76c7b00] [c0000000000934a0] .__mmdrop+0x60/0x150 [c0000005b76c7b90] [c0000000000e3ff0] .idle_task_exit+0x130/0x140 [c0000005b76c7c20] [c000000000075804] .pseries_mach_cpu_die+0x64/0x310 [c0000005b76c7cd0] [c000000000043e7c] .cpu_die+0x3c/0x60 [c0000005b76c7d40] [c0000000000188d8] .arch_cpu_idle_dead+0x28/0x40 [c0000005b76c7db0] [c000000000101e6c] .cpu_startup_entry+0x50c/0x560 [c0000005b76c7ed0] [c000000000043bd8] .start_secondary+0x328/0x360 [c0000005b76c7f90] [c000000000008a6c] start_secondary_prolog+0x10/0x14
This warning is not a false positive either. RCU is not protecting code that is being executed while the CPU is offline.
Instead of playing "whack-a-mole(TM)" and adding conditional statements to the tracepoints we find that are used in this instance, simply add a cpu_online() test to the tracepoint code where the tracepoint will be ignored if the CPU is offline.
Use of raw_smp_processor_id() is fine, as there should never be a case where the tracepoint code goes from running on a CPU that is online and suddenly gets migrated to a CPU that is offline.
--- include/linux/tracepoint.h | 5 +++++ 1 file changed, 5 insertions(+)
include/linux/tracepoint.h +5 -0
@@ -14,8 +14,10 @@* See the file COPYING for more details. */ +#include <linux/smp.h> #include <linux/errno.h> #include <linux/types.h> +#include <linux/cpumask.h> #include <linux/rcupdate.h> #include <linux/jump_label.h>
@@ -126,6 +128,9 @@ static inline void tracepoint_synchronizvoid *it_func; \void *__data; \ \ +if (!cpu_online (raw_smp_processor_id ())) \ +return ; \ + \if (!(cond)) \return ; \rcu_read_lock_sched_notrace (); \
PATCH 18/62 tracing: Fix freak link error caused by branch tracer
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit b33c8ff4431a343561e2319f17c14286f2aa52e2 upstream.
In my randconfig tests, I came across a bug that involves several components:
* gcc-4.9 through at least 5.3
* CONFIG_GCOV_PROFILE_ALL enabling -fprofile-arcs for all files
* CONFIG_PROFILE_ALL_BRANCHES overriding every if()
* The optimized implementation of do_div() that tries to replace a library call with an division by multiplication
* code in drivers/media/dvb-frontends/zl10353.c doing
u32 adc_clock = 450560; /* 45.056 MHz */
if (state->config.adc_clock)
adc_clock = state->config.adc_clock;
do_div(value, adc_clock);In this case, gcc fails to determine whether the divisor in do_div() is __builtin_constant_p(). In particular, it concludes that __builtin_constant_p(adc_clock) is false, while __builtin_constant_p(!!adc_clock) is true.
That in turn throws off the logic in do_div() that also uses __builtin_constant_p(), and instead of picking either the constant- optimized division, and the code in ilog2() that uses __builtin_constant_p() to figure out whether it knows the answer at compile time. The result is a link error from failing to find multiple symbols that should never have been called based on the __builtin_constant_p():
dvb-frontends/zl10353.c:138: undefined reference to ____ilog2_NaN' dvb-frontends/zl10353.c:138: undefined reference to __aeabi_uldivmod'
ERROR: "____ilog2_NaN" [drivers/media/dvb-frontends/zl10353.ko] undefined!
ERROR: "__aeabi_uldivmod" [drivers/media/dvb-frontends/zl10353.ko] undefined!
This patch avoids the problem by changing __trace_if() to check whether the condition is known at compile-time to be nonzero, rather than checking whether it is actually a constant.
I see this one link error in roughly one out of 1600 randconfig builds on ARM, and the patch fixes all known instances.
--- include/linux/compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/compiler.h +1 -1
@@ -125,7 +125,7 @@ void ftrace_likely_update(struct ftrace_*/ #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )#define __trace_if (cond) \ - if (__builtin_constant_p((cond)) ? !!(cond) : \ + if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ({ \ int ______r; \ static struct ftrace_branch_data \
PATCH 19/62 ALSA: seq: Fix double port list deletion
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 13d5e5d4725c64ec06040d636832e78453f477b7 upstream.
The commit [7f0973e973cd: ALSA: seq: Fix lockdep warnings due to double mutex locks] split the management of two linked lists (source and destination) into two individual calls for avoiding the AB/BA deadlock. However, this may leave the possible double deletion of one of two lists when the counterpart is being deleted concurrently. It ends up with a list corruption, as revealed by syzkaller fuzzer.
This patch fixes it by checking the list emptiness and skipping the deletion and the following process.
--- sound/core/seq/seq_ports.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
sound/core/seq/seq_ports.c +8 -5
@@ -540,19 +540,22 @@ static void delete_and_unsubscribe_port( bool is_src, bool ack) {struct snd_seq_port_subs_info *grp; +struct list_head *list; +bool empty; grp = is_src ? &port->c_src : &port->c_dest; + list = is_src ? &subs->src_list : &subs->dest_list;down_write (&grp->list_mutex);write_lock_irq (&grp->list_lock); -if (is_src) -list_del (&subs->src_list); -else -list_del (&subs->dest_list); + empty =list_empty (list); +if (!empty) +list_del_init (list); grp->exclusive =0 ;write_unlock_irq (&grp->list_lock);up_write (&grp->list_mutex); -unsubscribe_port (client, port, grp, &subs->info, ack); +if (!empty) +unsubscribe_port (client, port, grp, &subs->info, ack); }/* connect two ports */
PATCH 20/62 af_unix: Don't set err in unix_stream_read_generic unless there was an error
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Rainer Weikusat <[email protected]>
commit 1b92ee3d03af6643df395300ba7748f19ecdb0c5 upstream.
The present unix_stream_read_generic contains various code sequences of the form
err = -EDISASTER;
if (<test>)
goto out;
This has the unfortunate side effect of possibly causing the error code to bleed through to the final
out:
return copied ? : err;
and then to be wrongly returned if no data was copied because the caller didn't supply a data buffer, as demonstrated by the program available at
Change it such that err is only set if an error condition was detected.
--- net/unix/af_unix.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
net/unix/af_unix.c +10 -6
@@ -2059,13 +2059,15 @@ static int unix_stream_recvmsg(struct kiint err =0 ;long timeo; - err = -EINVAL ; -if (sk->sk_state !=TCP_ESTABLISHED ) +if (unlikely (sk->sk_state !=TCP_ESTABLISHED )) { + err = -EINVAL ; goto out; + } - err = -EOPNOTSUPP ; -if (flags&MSG_OOB ) +if (unlikely (flags &MSG_OOB )) { + err = -EOPNOTSUPP ; goto out; + } target =sock_rcvlowat (sk, flags&MSG_WAITALL , size); timeo =sock_rcvtimeo (sk, noblock);
@@ -2107,9 +2109,11 @@ static int unix_stream_recvmsg(struct ki goto unlock;unix_state_unlock (sk); - err = -EAGAIN ; -if (!timeo) +if (!timeo) { + err = -EAGAIN ;break ; + } +mutex_unlock (&u->readlock); timeo =unix_stream_data_wait (sk, timeo);
PATCH 21/62 af_unix: Guard against other == sk in unix_dgram_sendmsg
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Rainer Weikusat <[email protected]>
commit a5527dda344fff0514b7989ef7a755729769daa1 upstream.
The unix_dgram_sendmsg routine use the following test
if (unlikely(unix_peer(other) != sk && unix_recvq_full(other))) {
to determine if sk and other are in an n:1 association (either established via connect or by using sendto to send messages to an unrelated socket identified by address). This isn't correct as the specified address could have been bound to the sending socket itself or because this socket could have been connected to itself by the time of the unix_peer_get but disconnected before the unix_state_lock(other). In both cases, the if-block would be entered despite other == sk which might either block the sender unintentionally or lead to trying to unlock the same spin lock twice for a non-blocking send. Add a other != sk check to guard against this.
--- net/unix/af_unix.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/unix/af_unix.c +6 -1
@@ -1694,7 +1694,12 @@ restart_locked: goto out_unlock; } -if (unlikely (unix_peer (other) != sk &&unix_recvq_full (other))) { +/* other == sk && unix_peer(other) != sk if +* - unix_peer(sk) == NULL, destination address bound to sk +* - unix_peer(sk) == sk by time of get but disconnected before lock +*/ +if (other != sk && +unlikely (unix_peer (other) != sk &&unix_recvq_full (other))) {if (timeo) { timeo =unix_wait_for_peer (other, timeo);
PATCH 22/62 x86, extable: Remove open-coded exception table entries in arch/x86/lib/copy_user_nocache_64.S
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 0d8559feafbc9dc5a2c17ba42aea7de824b18308 upstream.
Remove open-coded exception table entries in arch/x86/lib/copy_user_nocache_64.S, and replace them with _ASM_EXTABLE() macros; this will allow us to change the format and type of the exception table entries.
--- arch/x86/lib/copy_user_nocache_64.S | 50 +++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 27 deletions(-)
arch/x86/lib/copy_user_nocache_64.S +23 -27
@@ -14,6 +14,7 @@ #include <asm/current.h> #include <asm/asm-offsets.h> #include <asm/thread_info.h> +#include <asm/asm.h> .macro ALIGN_DESTINATION #ifdef FIX_ALIGNMENT
@@ -36,11 +37,8 @@ jmp copy_user_handle_tail .previous - .section __ex_table,"a" - .align 8 - .quad 100b,103b - .quad 101b,103b - .previous + _ASM_EXTABLE(100b,103b) + _ASM_EXTABLE(101b,103b) #endif .endm
@@ -111,27 +109,25 @@ ENTRY(__copy_user_nocache) jmp copy_user_handle_tail .previous - .section __ex_table,"a" - .quad 1b,30b - .quad 2b,30b - .quad 3b,30b - .quad 4b,30b - .quad 5b,30b - .quad 6b,30b - .quad 7b,30b - .quad 8b,30b - .quad 9b,30b - .quad 10b,30b - .quad 11b,30b - .quad 12b,30b - .quad 13b,30b - .quad 14b,30b - .quad 15b,30b - .quad 16b,30b - .quad 18b,40b - .quad 19b,40b - .quad 21b,50b - .quad 22b,50b - .previous + _ASM_EXTABLE(1b,30b) + _ASM_EXTABLE(2b,30b) + _ASM_EXTABLE(3b,30b) + _ASM_EXTABLE(4b,30b) + _ASM_EXTABLE(5b,30b) + _ASM_EXTABLE(6b,30b) + _ASM_EXTABLE(7b,30b) + _ASM_EXTABLE(8b,30b) + _ASM_EXTABLE(9b,30b) + _ASM_EXTABLE(10b,30b) + _ASM_EXTABLE(11b,30b) + _ASM_EXTABLE(12b,30b) + _ASM_EXTABLE(13b,30b) + _ASM_EXTABLE(14b,30b) + _ASM_EXTABLE(15b,30b) + _ASM_EXTABLE(16b,30b) + _ASM_EXTABLE(18b,40b) + _ASM_EXTABLE(19b,40b) + _ASM_EXTABLE(21b,50b) + _ASM_EXTABLE(22b,50b) CFI_ENDPROC ENDPROC(__copy_user_nocache)
PATCH 23/62 x86/uaccess/64: Make the __copy_user_nocache() assembly code more readable
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Toshi Kani <[email protected]>
commit ee9737c924706aaa72c2ead93e3ad5644681dc1c upstream.
Add comments to __copy_user_nocache() to clarify its procedures and alignment requirements.
Also change numeric branch target labels to named local labels.
No code changed:
arch/x86/lib/copy_user_64.o:
text data bss dec hex filename
1239 0 0 1239 4d7 copy_user_64.o.before
1239 0 0 1239 4d7 copy_user_64.o.aftermd5:
58bed94c2db98c1ca9a2d46d0680aaae copy_user_64.o.before.asm
58bed94c2db98c1ca9a2d46d0680aaae copy_user_64.o.after.asm--- arch/x86/lib/copy_user_nocache_64.S | 114 ++++++++++++++++++++++++++++---------------- 1 file changed, 73 insertions(+), 41 deletions(-)
arch/x86/lib/copy_user_nocache_64.S +73 -41
@@ -44,17 +44,30 @@ /* * copy_user_nocache - Uncached memory copy with exception handling - * This will force destination/source out of cache for more performance. + * This will force destination out of cache for more performance. + * + * Note: Cached memory copy is used when destination or size is not + * naturally aligned. That is: + * - Require 8-byte alignment when size is 8 bytes or larger. */ ENTRY(__copy_user_nocache) CFI_STARTPROC + + /* If size is less than 8 bytes, go to byte copy */ cmpl $8,%edx - jb 20f /* less then 8 bytes, go to byte copy loop */ + jb .L_1b_cache_copy_entry + + /* If destination is not 8-byte aligned, "cache" copy to align it */ ALIGN_DESTINATION + + /* Set 4x8-byte copy count and remainder */ movl %edx,%ecx andl $63,%edx shrl $6,%ecx - jz 17f + jz .L_8b_nocache_copy_entry /* jump if count is 0 */ + + /* Perform 4x8-byte nocache loop-copy */ +.L_4x8b_nocache_copy_loop: 1: movq (%rsi),%r8 2: movq 1*8(%rsi),%r9 3: movq 2*8(%rsi),%r10
@@ -74,60 +87,79 @@ ENTRY(__copy_user_nocache) leaq 64(%rsi),%rsi leaq 64(%rdi),%rdi decl %ecx - jnz 1b -17: movl %edx,%ecx + jnz .L_4x8b_nocache_copy_loop + + /* Set 8-byte copy count and remainder */ +.L_8b_nocache_copy_entry: + movl %edx,%ecx andl $7,%edx shrl $3,%ecx - jz 20f -18: movq (%rsi),%r8 -19: movnti %r8,(%rdi) + jz .L_1b_cache_copy_entry /* jump if count is 0 */ + + /* Perform 8-byte nocache loop-copy */ +.L_8b_nocache_copy_loop: +20: movq (%rsi),%r8 +21: movnti %r8,(%rdi) leaq 8(%rsi),%rsi leaq 8(%rdi),%rdi decl %ecx - jnz 18b -20: andl %edx,%edx - jz 23f + jnz .L_8b_nocache_copy_loop + + /* If no byte left, we're done */ +.L_1b_cache_copy_entry: + andl %edx,%edx + jz .L_finish_copy + + /* Perform byte "cache" loop-copy for the remainder */ movl %edx,%ecx -21: movb (%rsi),%al -22: movb %al,(%rdi) +.L_1b_cache_copy_loop: +40: movb (%rsi),%al +41: movb %al,(%rdi) incq %rsi incq %rdi decl %ecx - jnz 21b -23: xorl %eax,%eax + jnz .L_1b_cache_copy_loop + + /* Finished copying; fence the prior stores */ +.L_finish_copy: + xorl %eax,%eax sfence ret .section .fixup,"ax" -30: shll $6,%ecx +.L_fixup_4x8b_copy: + shll $6,%ecx addl %ecx,%edx - jmp 60f -40: lea (%rdx,%rcx,8),%rdx - jmp 60f -50: movl %ecx,%edx -60: sfence + jmp .L_fixup_handle_tail +.L_fixup_8b_copy: + lea (%rdx,%rcx,8),%rdx + jmp .L_fixup_handle_tail +.L_fixup_1b_copy: + movl %ecx,%edx +.L_fixup_handle_tail: + sfence jmp copy_user_handle_tail .previous - _ASM_EXTABLE(1b,30b) - _ASM_EXTABLE(2b,30b) - _ASM_EXTABLE(3b,30b) - _ASM_EXTABLE(4b,30b) - _ASM_EXTABLE(5b,30b) - _ASM_EXTABLE(6b,30b) - _ASM_EXTABLE(7b,30b) - _ASM_EXTABLE(8b,30b) - _ASM_EXTABLE(9b,30b) - _ASM_EXTABLE(10b,30b) - _ASM_EXTABLE(11b,30b) - _ASM_EXTABLE(12b,30b) - _ASM_EXTABLE(13b,30b) - _ASM_EXTABLE(14b,30b) - _ASM_EXTABLE(15b,30b) - _ASM_EXTABLE(16b,30b) - _ASM_EXTABLE(18b,40b) - _ASM_EXTABLE(19b,40b) - _ASM_EXTABLE(21b,50b) - _ASM_EXTABLE(22b,50b) + _ASM_EXTABLE(1b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(2b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(3b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(4b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(5b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(6b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(7b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(8b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(9b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(10b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(11b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(12b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(13b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(14b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(15b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(16b,.L_fixup_4x8b_copy) + _ASM_EXTABLE(20b,.L_fixup_8b_copy) + _ASM_EXTABLE(21b,.L_fixup_8b_copy) + _ASM_EXTABLE(40b,.L_fixup_1b_copy) + _ASM_EXTABLE(41b,.L_fixup_1b_copy) CFI_ENDPROC ENDPROC(__copy_user_nocache)
PATCH 24/62 x86/uaccess/64: Handle the caching of 4-byte nocache copies properly in __copy_user_nocache()
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Toshi Kani <[email protected]>
commit a82eee7424525e34e98d821dd059ce14560a1e35 upstream.
Data corruption issues were observed in tests which initiated a system crash/reset while accessing BTT devices. This problem is reproducible.
The BTT driver calls pmem_rw_bytes() to update data in pmem devices. This interface calls __copy_user_nocache(), which uses non-temporal stores so that the stores to pmem are persistent.
__copy_user_nocache() uses non-temporal stores when a request size is 8 bytes or larger (and is aligned by 8 bytes). The BTT driver updates the BTT map table, which entry size is 4 bytes. Therefore, updates to the map table entries remain cached, and are not written to pmem after a crash.
Change __copy_user_nocache() to use non-temporal store when a request size is 4 bytes. The change extends the current byte-copy path for a less-than-8-bytes request, and does not add any overhead to the regular path.
--- arch/x86/lib/copy_user_nocache_64.S | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-)
arch/x86/lib/copy_user_nocache_64.S +32 -4
@@ -49,13 +49,14 @@ * Note: Cached memory copy is used when destination or size is not * naturally aligned. That is: * - Require 8-byte alignment when size is 8 bytes or larger. + * - Require 4-byte alignment when size is 4 bytes. */ ENTRY(__copy_user_nocache) CFI_STARTPROC - /* If size is less than 8 bytes, go to byte copy */ + /* If size is less than 8 bytes, go to 4-byte copy */ cmpl $8,%edx - jb .L_1b_cache_copy_entry + jb .L_4b_nocache_copy_entry /* If destination is not 8-byte aligned, "cache" copy to align it */ ALIGN_DESTINATION
@@ -94,7 +95,7 @@ ENTRY(__copy_user_nocache) movl %edx,%ecx andl $7,%edx shrl $3,%ecx - jz .L_1b_cache_copy_entry /* jump if count is 0 */ + jz .L_4b_nocache_copy_entry /* jump if count is 0 */ /* Perform 8-byte nocache loop-copy */ .L_8b_nocache_copy_loop:
@@ -106,11 +107,33 @@ ENTRY(__copy_user_nocache) jnz .L_8b_nocache_copy_loop /* If no byte left, we're done */ -.L_1b_cache_copy_entry: +.L_4b_nocache_copy_entry: + andl %edx,%edx + jz .L_finish_copy + + /* If destination is not 4-byte aligned, go to byte copy: */ + movl %edi,%ecx + andl $3,%ecx + jnz .L_1b_cache_copy_entry + + /* Set 4-byte copy count (1 or 0) and remainder */ + movl %edx,%ecx + andl $3,%edx + shrl $2,%ecx + jz .L_1b_cache_copy_entry /* jump if count is 0 */ + + /* Perform 4-byte nocache copy: */ +30: movl (%rsi),%r8d +31: movnti %r8d,(%rdi) + leaq 4(%rsi),%rsi + leaq 4(%rdi),%rdi + + /* If no bytes left, we're done: */ andl %edx,%edx jz .L_finish_copy /* Perform byte "cache" loop-copy for the remainder */ +.L_1b_cache_copy_entry: movl %edx,%ecx .L_1b_cache_copy_loop: 40: movb (%rsi),%al
@@ -134,6 +157,9 @@ ENTRY(__copy_user_nocache) .L_fixup_8b_copy: lea (%rdx,%rcx,8),%rdx jmp .L_fixup_handle_tail +.L_fixup_4b_copy: + lea (%rdx,%rcx,4),%rdx + jmp .L_fixup_handle_tail .L_fixup_1b_copy: movl %ecx,%edx .L_fixup_handle_tail:
@@ -159,6 +185,8 @@ ENTRY(__copy_user_nocache) _ASM_EXTABLE(16b,.L_fixup_4x8b_copy) _ASM_EXTABLE(20b,.L_fixup_8b_copy) _ASM_EXTABLE(21b,.L_fixup_8b_copy) + _ASM_EXTABLE(30b,.L_fixup_4b_copy) + _ASM_EXTABLE(31b,.L_fixup_4b_copy) _ASM_EXTABLE(40b,.L_fixup_1b_copy) _ASM_EXTABLE(41b,.L_fixup_1b_copy) CFI_ENDPROC
PATCH 25/62 usb: dwc3: Fix assignment of EP transfer resources
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: John Youn <[email protected]>
commit c450960187f45d4260db87c7dd4fc0bceb5565d8 upstream.
The assignement of EP transfer resources was not handled properly in the dwc3 driver. Commit aebda6187181 ("usb: dwc3: Reset the transfer resource index on SET_INTERFACE") previously fixed one aspect of this where resources may be exhausted with multiple calls to SET_INTERFACE. However, it introduced an issue where composite devices with multiple interfaces can be assigned the same transfer resources for different endpoints. This patch solves both issues.
The assignment of transfer resources cannot perfectly follow the data book due to the fact that the controller driver does not have all knowledge of the configuration in advance. It is given this information piecemeal by the composite gadget framework after every SET_CONFIGURATION and SET_INTERFACE. Trying to follow the databook programming model in this scenario can cause errors. For two reasons:
1) The databook says to do DEPSTARTCFG for every SET_CONFIGURATION and SET_INTERFACE (8.1.5). This is incorrect in the scenario of multiple interfaces.
2) The databook does not mention doing more DEPXFERCFG for new endpoint on alt setting (8.1.6).
The following simplified method is used instead:
All hardware endpoints can be assigned a transfer resource and this setting will stay persistent until either a core reset or hibernation. So whenever we do a DEPSTARTCFG(0) we can go ahead and do DEPXFERCFG for every hardware endpoint as well. We are guaranteed that there are as many transfer resources as endpoints.
This patch triggers off of the calling dwc3_gadget_start_config() for EP0-out, which always happens first, and which should only happen in one of the above conditions.
--- drivers/usb/dwc3/core.h | 1 - drivers/usb/dwc3/ep0.c | 5 ---- drivers/usb/dwc3/gadget.c | 70 +++++++++++++++++++++++++++++++++++------------ 3 files changed, 52 insertions(+), 24 deletions(-)
drivers/usb/dwc3/core.h +0 -1
@@ -610,7 +610,6 @@ struct dwc3 { unsigned ep0_status_pending:1; unsigned ep0_bounced:1; unsigned ep0_expect_in:1; - unsigned start_config_issued:1;enum dwc3_ep0_next ep0_next_event;enum dwc3_ep0_state ep0state;
drivers/usb/dwc3/ep0.c +0 -5
@@ -449,7 +449,6 @@ static int dwc3_ep0_set_config(struct dwu32 cfg;int ret; - dwc->start_config_issued = false; cfg =le16_to_cpu (ctrl->wValue);switch (dwc->dev_state) {
@@ -498,10 +497,6 @@ static int dwc3_ep0_std_request(struct ddev_vdbg (dwc->dev,"USB_REQ_SET_CONFIGURATION\n" ); ret =dwc3_ep0_set_config (dwc, ctrl);break ; -case USB_REQ_SET_INTERFACE : -dev_vdbg (dwc->dev ,"USB_REQ_SET_INTERFACE" ); - dwc->start_config_issued = false; -/* Fall through */ default :dev_vdbg (dwc->dev,"Forwarding to gadget driver\n" ); ret =dwc3_ep0_delegate_req (dwc, ctrl);
drivers/usb/dwc3/gadget.c +52 -18
108 lines not on this page · raw message
PATCH 26/62 net/mlx4_en: Count HW buffer overrun only once
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Amir Vadai <[email protected]>
commit 281e8b2fdf8e4ef366b899453cae50e09b577ada upstream.
RdropOvflw counts overrun of HW buffer, therefore should be used for rx_fifo_errors only.
Currently RdropOvflw counter is mistakenly also set into rx_missed_errors and rx_over_errors too, which makes the device total dropped packets accounting to show wrong results.
Fix that. Use it for rx_fifo_errors only.
--- drivers/net/ethernet/mellanox/mlx4/en_port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_port.c +2 -2
@@ -248,11 +248,11 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_ebe64_to_cpu (mlx4_en_stats->MCAST_novlan); stats->collisions =0 ; stats->rx_length_errors =be32_to_cpu (mlx4_en_stats->RdropLength); - stats->rx_over_errors =be32_to_cpu (mlx4_en_stats->RdropOvflw); + stats->rx_over_errors =0 ; stats->rx_crc_errors =be32_to_cpu (mlx4_en_stats->RCRC); stats->rx_frame_errors =0 ; stats->rx_fifo_errors =be32_to_cpu (mlx4_en_stats->RdropOvflw); - stats->rx_missed_errors =be32_to_cpu (mlx4_en_stats->RdropOvflw); + stats->rx_missed_errors =0 ; stats->tx_aborted_errors =0 ; stats->tx_carrier_errors =0 ; stats->tx_fifo_errors =0 ;
PATCH 27/62 USB: option: add support for SIM7100E
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Skvortsov <[email protected]>
commit 3158a8d416f4e1b79dcc867d67cb50013140772c upstream.
$ lsusb: Bus 001 Device 101: ID 1e0e:9001 Qualcomm / Option
$ usb-devices: T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=101 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 2 P: Vendor=1e0e ProdID=9001 Rev= 2.32 S: Manufacturer=SimTech, Incorporated S: Product=SimTech, Incorporated S: SerialNumber=0123456789ABCDEF C:* #Ifs= 7 Cfg#= 1 Atr=80 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
The last interface (6) is used for Android Composite ADB interface.
Serial port layout:
0: QCDM/DIAG
1: NMEA
2: AT
3: AT/PPP
4: audio
--- drivers/usb/serial/option.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/serial/option.c +7 -0
@@ -316,6 +316,7 @@ static void option_instat_callback(struc#define TOSHIBA_PRODUCT_G450 0x0d45#define ALINK_VENDOR_ID 0x1e0e +#define SIMCOM_PRODUCT_SIM7100E 0x9001/* Yes, ALINK_VENDOR_ID */ #define ALINK_PRODUCT_PH300 0x9100#define ALINK_PRODUCT_3GU 0x9200
@@ -613,6 +614,10 @@ static const struct option_blacklist_inf .reserved = BIT(3) | BIT(4), }; +static const struct option_blacklist_info simcom_sim7100e_blacklist = { + .reserved =BIT (5 ) |BIT (6 ), +}; +static const struct option_blacklist_info telit_le910_blacklist = { .sendsetup =BIT (0 ), .reserved =BIT (1 ) |BIT (2 ),
@@ -1644,6 +1649,8 @@ static const struct usb_device_id option { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, { USB_DEVICE(ALINK_VENDOR_ID, ALINK_PRODUCT_PH300) }, { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, + { USB_DEVICE(ALINK_VENDOR_ID, SIMCOM_PRODUCT_SIM7100E), + .driver_info = (kernel_ulong_t)&simcom_sim7100e_blacklist }, { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist },
PATCH 28/62 USB: cp210x: add IDs for GE B650V3 and B850V3 boards
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ken Lin <[email protected]>
commit 6627ae19385283b89356a199d7f03c75ba35fb29 upstream.
Add USB ID for cp2104/5 devices on GE B650v3 and B850v3 boards.
--- drivers/usb/serial/cp210x.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/cp210x.c +2 -0
@@ -168,6 +168,8 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ { USB_DEVICE(0x18EF, 0xE025) }, /* ELV Marble Sound Board 1 */ + { USB_DEVICE(0x1901, 0x0190) }, /* GE B850 CP2105 Recorder interface */ + { USB_DEVICE(0x1901, 0x0193) }, /* GE B650 CP2104 PMC interface */ { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */
PATCH 29/62 USB: option: add "4G LTE usb-modem U901"
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit d061c1caa31d4d9792cfe48a2c6b309a0e01ef46 upstream.
Thomas reports:
T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 4 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=05c6 ProdID=6001 Rev=00.00 S: Manufacturer=USB Modem S: Product=USB Modem S: SerialNumber=1234567890ABCDEF C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I: If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -1133,6 +1133,8 @@ static const struct usb_device_id option { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ + { USB_DEVICE_AND_INTERFACE_INFO(QUALCOMM_VENDOR_ID, 0x6001, 0xff, 0xff, 0xff), /* 4G LTE usb-modem U901 */ + .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
PATCH 30/62 Adding Intel Lewisburg device IDs for SATA
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexandra Yates <[email protected]>
commit f5bdd66c705484b4bc77eb914be15c1b7881fae7 upstream.
This patch complements the list of device IDs previously added for lewisburg sata.
--- drivers/ata/ahci.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/ata/ahci.c +6 -0
@@ -377,15 +377,21 @@ static const struct pci_device_id ahci_p { PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H RAID */ { PCI_VDEVICE(INTEL, 0xa10f), board_ahci }, /* Sunrise Point-H RAID */ { PCI_VDEVICE(INTEL, 0x2822), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0x2823), board_ahci }, /* Lewisburg AHCI*/ { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0x2827), board_ahci }, /* Lewisburg RAID*/ { PCI_VDEVICE(INTEL, 0xa182), board_ahci }, /* Lewisburg AHCI*/ { PCI_VDEVICE(INTEL, 0xa184), board_ahci }, /* Lewisburg RAID*/ { PCI_VDEVICE(INTEL, 0xa186), board_ahci }, /* Lewisburg RAID*/ { PCI_VDEVICE(INTEL, 0xa18e), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0xa1d2), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0xa1d6), board_ahci }, /* Lewisburg RAID*/ { PCI_VDEVICE(INTEL, 0xa202), board_ahci }, /* Lewisburg AHCI*/ { PCI_VDEVICE(INTEL, 0xa204), board_ahci }, /* Lewisburg RAID*/ { PCI_VDEVICE(INTEL, 0xa206), board_ahci }, /* Lewisburg RAID*/ { PCI_VDEVICE(INTEL, 0xa20e), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0xa252), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0xa256), board_ahci }, /* Lewisburg RAID*//* JMicron 360/1/3/5/6, match class to avoid IDE function */ { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
PATCH 31/62 ext4: fix bh->b_state corruption
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit ed8ad83808f009ade97ebbf6519bc3a97fefbc0c upstream.
ext4 can update bh->b_state non-atomically in _ext4_get_block() and ext4_da_get_block_prep(). Usually this is fine since bh is just a temporary storage for mapping information on stack but in some cases it can be fully living bh attached to a page. In such case non-atomic update of bh->b_state can race with an atomic update which then gets lost. Usually when we are mapping bh and thus updating bh->b_state non-atomically, nobody else touches the bh and so things work out fine but there is one case to especially worry about: ext4_finish_bio() uses BH_Uptodate_Lock on the first bh in the page to synchronize handling of PageWriteback state. So when blocksize < pagesize, we can be atomically modifying bh->b_state of a buffer that actually isn't under IO and thus can race e.g. with delalloc trying to map that buffer. The result is that we can mistakenly set / clear BH_Uptodate_Lock bit resulting in the corruption of PageWriteback state or missed unlock of BH_Uptodate_Lock.
Fix the problem by always updating bh->b_state bits atomically.
[bwh: Backported to 3.2:
- s/READ_ONCE/ACCESS_ONCE/
- Adjust context]
--- fs/ext4/inode.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-)
fs/ext4/inode.c +30 -2
@@ -595,6 +595,34 @@ int ext4_map_blocks(handle_t *handle, streturn retval; } +/* +* Update EXT4_MAP_FLAGS in bh->b_state. For buffer heads attached to pages +* we have to be careful as someone else may be manipulating b_state as well. +*/ +static void ext4_update_bh_state (struct buffer_head *bh,unsigned long flags) +{ +unsigned long old_state; +unsigned long new_state; + + flags &=EXT4_MAP_FLAGS ; + +/* Dummy buffer_head? Set non-atomically. */ +if (!bh->b_page) { + bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS ) | flags; +return ; + } +/* +* Someone else may be modifying b_state. Be careful! This is ugly but +* once we get rid of using bh as a container for mapping information +* to pass to / from get_block functions, this can go away. +*/ +do { + old_state =ACCESS_ONCE (bh->b_state); + new_state = (old_state & ~EXT4_MAP_FLAGS ) | flags; + }while (unlikely ( +cmpxchg (&bh->b_state, old_state, new_state) != old_state)); +} +/* Maximum number of blocks we map for direct IO at once. */ #define DIO_MAX_BLOCKS 4096
@@ -625,7 +653,7 @@ static int _ext4_get_block(struct inode ret =ext4_map_blocks (handle, inode, &map, flags);if (ret >0 ) {map_bh (bh, inode->i_sb, map.m_pblk); - bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS ) | map.m_flags; +ext4_update_bh_state (bh, map.m_flags); bh->b_size = inode->i_sb->s_blocksize * map.m_len; ret =0 ; }
@@ -1787,7 +1815,7 @@ static int ext4_da_get_block_prep(structreturn ret;map_bh (bh, inode->i_sb, map.m_pblk); - bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS ) | map.m_flags; +ext4_update_bh_state (bh, map.m_flags);if (buffer_unwritten (bh)) {/* A delayed write to unwritten bh should be marked
PATCH 32/62 kernel/resource.c: fix muxed resource handling in __request_region()
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Simon Guinot <[email protected]>
commit 59ceeaaf355fa0fb16558ef7c24413c804932ada upstream.
In __request_region, if a conflict with a BUSY and MUXED resource is detected, then the caller goes to sleep and waits for the resource to be released. A pointer on the conflicting resource is kept. At wake-up this pointer is used as a parent to retry to request the region.
A first problem is that this pointer might well be invalid (if for example the conflicting resource have already been freed). Another problem is that the next call to __request_region() fails to detect a remaining conflict. The previously conflicting resource is passed as a parameter and __request_region() will look for a conflict among the children of this resource and not at the resource itself. It is likely to succeed anyway, even if there is still a conflict.
Instead, the parent of the conflicting resource should be passed to __request_region().
As a fix, this patch doesn't update the parent resource pointer in the case we have to wait for a muxed region right after.
--- kernel/resource.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/resource.c +3 -2
@@ -886,9 +886,10 @@ struct resource * __request_region(strucif (!conflict)break ;if (conflict != parent) { - parent = conflict; -if (!(conflict->flags &IORESOURCE_BUSY )) +if (!(conflict->flags &IORESOURCE_BUSY )) { + parent = conflict;continue ; + } }if (conflict->flags & flags &IORESOURCE_MUXED ) {add_wait_queue (&muxed_resource_wait, &wait);
PATCH 33/62 can: ems_usb: Fix possible tx overflow
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Gerhard Uttenthaler <[email protected]>
commit 90cfde46586d2286488d8ed636929e936c0c9ab2 upstream.
This patch fixes the problem that more CAN messages could be sent to the interface as could be send on the CAN bus. This was more likely for slow baud rates. The sleeping _start_xmit was woken up in the _write_bulk_callback. Under heavy TX load this produced another bulk transfer without checking the free_slots variable and hence caused the overflow in the interface.
--- drivers/net/can/usb/ems_usb.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/can/usb/ems_usb.c +10 -4
@@ -118,6 +118,9 @@ MODULE_LICENSE("GPL v2");*/ #define EMS_USB_ARM7_CLOCK 8000000 +#define CPC_TX_QUEUE_TRIGGER_LOW 25 +#define CPC_TX_QUEUE_TRIGGER_HIGH 35 +/* * CAN-Message representation in a CPC_MSG. Message object type is * CPC_MSG_TYPE_CAN_FRAME or CPC_MSG_TYPE_RTR_FRAME or
@@ -280,6 +283,11 @@ static void ems_usb_read_interrupt_callbswitch (urb->status) {case 0 : dev->free_slots = dev->intr_in_buffer[1 ]; +if (dev->free_slots >CPC_TX_QUEUE_TRIGGER_HIGH ){ +if (netif_queue_stopped (netdev)){ +netif_wake_queue (netdev); + } + }break ;case -ECONNRESET :/* unlink */
@@ -535,8 +543,6 @@ static void ems_usb_write_bulk_callback(/* Release context */ context->echo_index =MAX_TX_URBS ; -if (netif_queue_stopped (netdev)) -netif_wake_queue (netdev); }/*
@@ -596,7 +602,7 @@ static int ems_usb_start(struct ems_usbint err, i; dev->intr_in_buffer[0 ] =0 ; - dev->free_slots =15 ;/* initial size */ + dev->free_slots =50 ;/* initial size */ for (i =0 ; i <MAX_RX_URBS ; i++) {struct urb *urb =NULL ;
@@ -858,7 +864,7 @@ static netdev_tx_t ems_usb_start_xmit(st/* Slow down tx path */ if (atomic_read (&dev->active_tx_urbs) >=MAX_TX_URBS || - dev->free_slots <5 ) { + dev->free_slots <CPC_TX_QUEUE_TRIGGER_LOW ) {netif_stop_queue (netdev); } }
PATCH 34/62 mac80211: minstrel_ht: set default tx aggregation timeout to 0
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit 7a36b930e6ed4702c866dc74a5ad07318a57c688 upstream.
The value 5000 was put here with the addition of the timeout field to ieee80211_start_tx_ba_session. It was originally added in mac80211 to save resources for drivers like iwlwifi, which only supports a limited number of concurrent aggregation sessions.
Since iwlwifi does not use minstrel_ht and other drivers don't need this, 0 is a better default - especially since there have been recent reports of aggregation setup related issues reproduced with ath9k. This should improve stability without causing any adverse effects.
--- net/mac80211/rc80211_minstrel_ht.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/rc80211_minstrel_ht.c +1 -1
@@ -376,7 +376,7 @@ minstrel_aggr_check(struct minstrel_privif (skb_get_queue_mapping (skb) ==IEEE80211_AC_VO )return ; -ieee80211_start_tx_ba_session (pubsta, tid,5000 ); +ieee80211_start_tx_ba_session (pubsta, tid,0 ); } static void
PATCH 35/62 sunrpc/cache: fix off-by-one in qword_get()
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Hajnoczi <[email protected]>
commit b7052cd7bcf3c1478796e93e3dff2b44c9e82943 upstream.
The qword_get() function NUL-terminates its output buffer. If the input string is in hex format \xXXXX... and the same length as the output buffer, there is an off-by-one:
int qword_get(char **bpp, char *dest, int bufsize)
{
...
while (len < bufsize) {
...
*dest++ = (h << 4) | l;
len++;
}
...
*dest = '\0';
return len;
}This patch ensures the NUL terminator doesn't fall outside the output buffer.
--- net/sunrpc/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/cache.c +1 -1
@@ -1211,7 +1211,7 @@ int qword_get(char **bpp, char *dest, inif (bp[0 ] =='\\' && bp[1 ] =='x' ) {/* HEX STRING */ bp +=2 ; -while (len < bufsize) { +while (len < bufsize -1 ) {int h, l; h =hex_to_bin (bp[0 ]);
PATCH 36/62 KVM: async_pf: do not warn on page allocation failures
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Christian Borntraeger <[email protected]>
commit d7444794a02ff655eda87e3cc54e86b940e7736f upstream.
In async_pf we try to allocate with NOWAIT to get an element quickly or fail. This code also handle failures gracefully. Lets silence potential page allocation failures under load.
qemu-system-s39: page allocation failure: order:0,mode:0x2200000 [...]
Call Trace: ([<00000000001146b8>] show_trace+0xf8/0x148) [<000000000011476a>] show_stack+0x62/0xe8 [<00000000004a36b8>] dump_stack+0x70/0x98 [<0000000000272c3a>] warn_alloc_failed+0xd2/0x148 [<000000000027709e>] __alloc_pages_nodemask+0x94e/0xb38 [<00000000002cd36a>] new_slab+0x382/0x400 [<00000000002cf7ac>] ___slab_alloc.constprop.30+0x2dc/0x378 [<00000000002d03d0>] kmem_cache_alloc+0x160/0x1d0 [<0000000000133db4>] kvm_setup_async_pf+0x6c/0x198 [<000000000013dee8>] kvm_arch_vcpu_ioctl_run+0xd48/0xd58 [<000000000012fcaa>] kvm_vcpu_ioctl+0x372/0x690 [<00000000002f66f6>] do_vfs_ioctl+0x3be/0x510 [<00000000002f68ec>] SyS_ioctl+0xa4/0xb8 [<0000000000781c5e>] system_call+0xd6/0x264
[<000003ffa24fa06a>] 0x3ffa24fa06a
--- virt/kvm/async_pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/async_pf.c +1 -1
@@ -159,7 +159,7 @@ int kvm_setup_async_pf(struct kvm_vcpu ** do alloc nowait since if we are going to sleep anyway we * may as well sleep faulting in page */ - work =kmem_cache_zalloc (async_pf_cache,GFP_NOWAIT ); + work =kmem_cache_zalloc (async_pf_cache,GFP_NOWAIT | __GFP_NOWARN);if (!work)return 0 ;
PATCH 37/62 Revert "jffs2: Fix lock acquisition order bug in jffs2_write_begin"
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Betker <[email protected]>
commit 157078f64b8a9cd7011b6b900b2f2498df850748 upstream.
This reverts commit 5ffd3412ae55
("jffs2: Fix lock acquisition order bug in jffs2_write_begin").
The commit modified jffs2_write_begin() to remove a deadlock with jffs2_garbage_collect_live(), but this introduced new deadlocks found by multiple users. page_lock() actually has to be called before mutex_lock(&c->alloc_sem) or mutex_lock(&f->sem) because jffs2_write_end() and jffs2_readpage() are called with the page locked, and they acquire c->alloc_sem and f->sem, resp.
In other words, the lock order in jffs2_write_begin() was correct, and it is the jffs2_garbage_collect_live() path that has to be changed.
Revert the commit to get rid of the new deadlocks, and to clear the way for a better fix of the original deadlock.
[bwh: Backported to 3.2: use D1(printk(KERN_DEBUG ...)) instead of
jffs2_dbg(1, ...)]
--- fs/jffs2/file.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-)
fs/jffs2/file.c +18 -21
@@ -135,39 +135,33 @@ static int jffs2_write_begin(struct filestruct page *pg;struct inode *inode = mapping->host;struct jffs2_inode_info *f =JFFS2_INODE_INFO (inode); -struct jffs2_sb_info *c =JFFS2_SB_INFO (inode->i_sb); -struct jffs2_raw_inode ri; -uint32_t alloc_len =0 ;pgoff_t index = pos >>PAGE_CACHE_SHIFT ;uint32_t pageofs = index <<PAGE_CACHE_SHIFT ;int ret =0 ; -D1 (printk (KERN_DEBUG "%s()\n" , __func__)); - -if (pageofs > inode->i_size) { - ret =jffs2_reserve_space (c,sizeof (ri), &alloc_len, -ALLOC_NORMAL ,JFFS2_SUMMARY_INODE_SIZE ); -if (ret) -return ret; - } - -mutex_lock (&f->sem); pg =grab_cache_page_write_begin (mapping, index, flags); -if (!pg) { -if (alloc_len) -jffs2_complete_reservation (c); -mutex_unlock (&f->sem); +if (!pg)return -ENOMEM ; - } *pagep = pg; -if (alloc_len) { +D1 (printk (KERN_DEBUG "%s()\n" , __func__)); + +if (pageofs > inode->i_size) {/* Make new hole frag from old EOF to new page */ +struct jffs2_sb_info *c =JFFS2_SB_INFO (inode->i_sb); +struct jffs2_raw_inode ri;struct jffs2_full_dnode *fn; +uint32_t alloc_len;D1 (printk (KERN_DEBUG "Writing new hole frag 0x%x-0x%x between current EOF and new page\n" , (unsigned int )inode->i_size, pageofs)); + ret =jffs2_reserve_space (c,sizeof (ri), &alloc_len, +ALLOC_NORMAL ,JFFS2_SUMMARY_INODE_SIZE ); +if (ret) + goto out_page; + +mutex_lock (&f->sem);memset (&ri,0 ,sizeof (ri)); ri.magic =cpu_to_je16 (JFFS2_MAGIC_BITMASK );
@@ -194,6 +188,7 @@ static int jffs2_write_begin(struct fileif (IS_ERR (fn)) { ret =PTR_ERR (fn);jffs2_complete_reservation (c); +mutex_unlock (&f->sem); goto out_page; } ret =jffs2_add_full_dnode_to_inode (c, f, fn);
@@ -207,10 +202,12 @@ static int jffs2_write_begin(struct filejffs2_mark_node_obsolete (c, fn->raw);jffs2_free_full_dnode (fn);jffs2_complete_reservation (c); +mutex_unlock (&f->sem); goto out_page; }jffs2_complete_reservation (c); inode->i_size = pageofs; +mutex_unlock (&f->sem); }/*
@@ -219,18 +216,18 @@ static int jffs2_write_begin(struct file* case of a short-copy. */ if (!PageUptodate (pg)) { +mutex_lock (&f->sem); ret =jffs2_do_readpage_nolock (inode, pg); +mutex_unlock (&f->sem);if (ret) goto out_page; } -mutex_unlock (&f->sem);D1 (printk (KERN_DEBUG "end write_begin(). pg->flags %lx\n" , pg->flags));return ret; out_page:unlock_page (pg);page_cache_release (pg); -mutex_unlock (&f->sem);return ret; }
PATCH 38/62 jffs2: Fix page lock / f->sem deadlock
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: David Woodhouse <[email protected]>
commit 49e91e7079febe59a20ca885a87dd1c54240d0f1 upstream.
With this fix, all code paths should now be obtaining the page lock before f->sem.
--- fs/jffs2/README.Locking | 5 +---- fs/jffs2/gc.c | 17 ++++++++++------- 2 files changed, 11 insertions(+), 11 deletions(-)
fs/jffs2/README.Locking +1 -4
@@ -2,10 +2,6 @@ JFFS2 LOCKING DOCUMENTATION --------------------------- -At least theoretically, JFFS2 does not require the Big Kernel Lock -(BKL), which was always helpfully obtained for it by Linux 2.4 VFS -code. It has its own locking, as described below. - This document attempts to describe the existing locking rules for JFFS2. It is not expected to remain perfectly up to date, but ought to be fairly close.
@@ -69,6 +65,7 @@ Ordering constraints: any f->sem held. 2. Never attempt to lock two file mutexes in one thread. No ordering rules have been made for doing so. + 3. Never lock a page cache page with f->sem held. erase_completion_lock spinlock
fs/jffs2/gc.c +10 -7
@@ -1246,14 +1246,17 @@ static int jffs2_garbage_collect_dnode(sBUG_ON (start > orig_start); } -/* First, use readpage() to read the appropriate page into the page cache */ -/* Q: What happens if we actually try to GC the _same_ page for which commit_write() -* triggered garbage collection in the first place? -* A: I _think_ it's OK. read_cache_page shouldn't deadlock, we'll write out the -* page OK. We'll actually write it out again in commit_write, which is a little -* suboptimal, but at least we're correct. -*/ +/* The rules state that we must obtain the page lock *before* f->sem, so +* drop f->sem temporarily. Since we also hold c->alloc_sem, nothing's +* actually going to *change* so we're safe; we only allow reading. +* +* It is important to note that jffs2_write_begin() will ensure that its +* page is marked Uptodate before allocating space. That means that if we +* end up here trying to GC the *same* page that jffs2_write_begin() is +* trying to write out, read_cache_page() will not deadlock. */ +mutex_unlock (&f->sem); pg_ptr =jffs2_gc_fetch_page (c, f, start, &pg); +mutex_lock (&f->sem);if (IS_ERR (pg_ptr)) {printk (KERN_WARNING "read_cache_page() returned error: %ld\n" ,PTR_ERR (pg_ptr));
PATCH 39/62 Fix directory hardlinks from deleted directories
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: David Woodhouse <[email protected]>
commit be629c62a603e5935f8177fd8a19e014100a259e upstream.
When a directory is deleted, we don't take too much care about killing off all the dirents that belong to it — on the basis that on remount, the scan will conclude that the directory is dead anyway.
This doesn't work though, when the deleted directory contained a child directory which was moved *out*. In the early stages of the fs build we can then end up with an apparent hard link, with the child directory appearing both in its true location, and as a child of the original directory which are this stage of the mount process we don't *yet* know is defunct.
To resolve this, take out the early special-casing of the "directories shall not have hard links" rule in jffs2_build_inode_pass1(), and let the normal nlink processing happen for directories as well as other inodes.
Then later in the build process we can set ic->pino_nlink to the parent inode#, as is required for directories during normal operaton, instead of the nlink. And complain only *then* about hard links which are still in evidence even after killing off all the unreachable paths.
--- fs/jffs2/build.c | 75 ++++++++++++++++++++++++++++++++++++++++------------- fs/jffs2/nodelist.h | 6 ++++- 2 files changed, 62 insertions(+), 19 deletions(-)
fs/jffs2/build.c +57 -18
@@ -47,7 +47,8 @@ next_inode(int *i, struct jffs2_inode_castatic void jffs2_build_inode_pass1 (struct jffs2_sb_info *c, -struct jffs2_inode_cache *ic) +struct jffs2_inode_cache *ic, +int *dir_hardlinks) {struct jffs2_full_dirent *fd;
@@ -66,19 +67,21 @@ static void jffs2_build_inode_pass1(strudbg_fsbuild ("child \"%s\" (ino #%u) of dir ino #%u doesn't exist!\n" , fd->name, fd->ino, ic->ino);jffs2_mark_node_obsolete (c, fd->raw); +/* Clear the ic/raw union so it doesn't cause problems later. */ + fd->ic =NULL ;continue ; } +/* From this point, fd->raw is no longer used so we can set fd->ic */ + fd->ic = child_ic; + child_ic->pino_nlink++; +/* If we appear (at this stage) to have hard-linked directories, +* set a flag to trigger a scan later */ if (fd->type ==DT_DIR ) { -if (child_ic->pino_nlink) { -JFFS2_ERROR ("child dir \"%s\" (ino #%u) of dir ino #%u appears to be a hard link\n" , - fd->name, fd->ino, ic->ino); -/* TODO: What do we do about it? */ - }else { - child_ic->pino_nlink = ic->ino; - } - }else - child_ic->pino_nlink++; + child_ic->flags |=INO_FLAGS_IS_DIR ; +if (child_ic->pino_nlink >1 ) + *dir_hardlinks =1 ; + }dbg_fsbuild ("increased nlink for child \"%s\" (ino #%u)\n" , fd->name, fd->ino);/* Can't free scan_dents so far. We might need them in pass 2 */
@@ -92,8 +95,7 @@ static void jffs2_build_inode_pass1(stru*/ static int jffs2_build_filesystem (struct jffs2_sb_info *c) { -int ret; -int i; +int ret, i, dir_hardlinks =0 ;struct jffs2_inode_cache *ic;struct jffs2_full_dirent *fd;struct jffs2_full_dirent *dead_fds =NULL ;
@@ -117,7 +119,7 @@ static int jffs2_build_filesystem(struct/* Now scan the directory tree, increasing nlink according to every dirent found. */ for_each_inode (i, c, ic) {if (ic->scan_dents) { -jffs2_build_inode_pass1 (c, ic); +jffs2_build_inode_pass1 (c, ic, &dir_hardlinks);cond_resched (); } }
@@ -153,6 +155,20 @@ static int jffs2_build_filesystem(struct }dbg_fsbuild ("pass 2a complete\n" ); + +if (dir_hardlinks) { +/* If we detected directory hardlinks earlier, *hopefully* +* they are gone now because some of the links were from +* dead directories which still had some old dirents lying +* around and not yet garbage-collected, but which have +* been discarded above. So clear the pino_nlink field +* in each directory, so that the final scan below can +* print appropriate warnings. */ +for_each_inode (i, c, ic) { +if (ic->flags &INO_FLAGS_IS_DIR ) + ic->pino_nlink =0 ; + } + }dbg_fsbuild ("freeing temporary data structures\n" );/* Finally, we can scan again and free the dirent structs */
@@ -160,6 +176,33 @@ static int jffs2_build_filesystem(structwhile (ic->scan_dents) { fd = ic->scan_dents; ic->scan_dents = fd->next; +/* We do use the pino_nlink field to count nlink of +* directories during fs build, so set it to the +* parent ino# now. Now that there's hopefully only +* one. */ +if (fd->type ==DT_DIR ) { +if (!fd->ic) { +/* We'll have complained about it and marked the coresponding +raw node obsolete already. Just skip it. */ +continue ; + } + +/* We *have* to have set this in jffs2_build_inode_pass1() */ +BUG_ON (!(fd->ic->flags &INO_FLAGS_IS_DIR )); + +/* We clear ic->pino_nlink ∀ directories' ic *only* if dir_hardlinks +* is set. Otherwise, we know this should never trigger anyway, so +* we don't do the check. And ic->pino_nlink still contains the nlink +* value (which is 1). */ +if (dir_hardlinks && fd->ic->pino_nlink) { +JFFS2_ERROR ("child dir \"%s\" (ino #%u) of dir ino #%u is also hard linked from dir ino #%u\n" , + fd->name, fd->ino, ic->ino, fd->ic->pino_nlink); +/* Should we unlink it from its previous parent? */ + } + +/* For directories, ic->pino_nlink holds that parent inode # */ + fd->ic->pino_nlink = ic->ino; + }jffs2_free_full_dirent (fd); } ic->scan_dents =NULL ;
@@ -238,11 +281,7 @@ static void jffs2_build_remove_unlinked_/* Reduce nlink of the child. If it's now zero, stick it on the dead_fds list to be cleaned up later. Else just free the fd */ - -if (fd->type ==DT_DIR ) - child_ic->pino_nlink =0 ; -else - child_ic->pino_nlink--; + child_ic->pino_nlink--;if (!child_ic->pino_nlink) { dbg_fsbuild("inode #%u (\"%s\") now has no links; adding to dead_fds list.\n",
fs/jffs2/nodelist.h +5 -1
@@ -194,6 +194,7 @@ struct jffs2_inode_cache {#define INO_STATE_CLEARING 6/* In clear_inode() */ #define INO_FLAGS_XATTR_CHECKED 0x01/* has no duplicate xattr_ref */ +#define INO_FLAGS_IS_DIR 0x02/* is a directory */ #define RAWNODE_CLASS_INODE_CACHE 0#define RAWNODE_CLASS_XATTR_DATUM 1
@@ -249,7 +250,10 @@ struct jffs2_readinode_infostruct jffs2_full_dirent { -struct jffs2_raw_node_ref *raw; +union { +struct jffs2_raw_node_ref *raw; +struct jffs2_inode_cache *ic;/* Just during part of build */ + };struct jffs2_full_dirent *next;uint32_t version;uint32_t ino;/* == zero for unlink */
PATCH 40/62 libata: Align ata_device's id on a cacheline
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Harvey Hunt <[email protected]>
commit 4ee34ea3a12396f35b26d90a094c75db95080baa upstream.
The id buffer in ata_device is a DMA target, but it isn't explicitly cacheline aligned. Due to this, adjacent fields can be overwritten with stale data from memory on non coherent architectures. As a result, the kernel is sometimes unable to communicate with an ATA device.
Fix this by ensuring that the id buffer is cacheline aligned.
This issue is similar to that fixed by Commit 84bda12af31f ("libata: align ap->sector_buf").
--- include/linux/libata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/libata.h +1 -1
@@ -662,7 +662,7 @@ struct ata_device {union {u16 id[ATA_ID_WORDS ];/* IDENTIFY xxx DEVICE data */ u32 gscr[SATA_PMP_GSCR_DWORDS ];/* PMP GSCR block */ - }; + }____cacheline_aligned ;/* error history */ int spdn_cnt;
PATCH 41/62 ipr: Fix out-of-bounds null overwrite
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Insu Yun <[email protected]>
commit d63c7dd5bcb9441af0526d370c43a65ca2c980d9 upstream.
Return value of snprintf is not bound by size value, 2nd argument.
(https://www.kernel.org/doc/htmldocs/kernel-api/API-snprintf.html).
Return value is number of printed chars, can be larger than 2nd argument. Therefore, it can write null byte out of bounds ofbuffer. Since snprintf puts null, it does not need to put additional null byte.
--- drivers/scsi/ipr.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/ipr.c +2 -3
@@ -3736,13 +3736,12 @@ static ssize_t ipr_store_update_fw(strucstruct ipr_sglist *sglist;char fname[100 ];char *src; -int len, result, dnld_size; +int result, dnld_size;if (!capable (CAP_SYS_ADMIN ))return -EACCES ; - len =snprintf (fname,99 ,"%s" , buf); - fname[len-1 ] ='\0' ; +snprintf (fname,sizeof (fname),"%s" , buf);if (request_firmware (&fw_entry, fname, &ioa_cfg->pdev->dev)) {dev_err (&ioa_cfg->pdev->dev,"Firmware file %s not found\n" , fname);
PATCH 42/62 ipr: Fix regression when loading firmware
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Gabriel Krisman Bertazi <[email protected]>
commit 21b81716c6bff24cda52dc75588455f879ddbfe9 upstream.
Commit d63c7dd5bcb9 ("ipr: Fix out-of-bounds null overwrite") removed the end of line handling when storing the update_fw sysfs attribute. This changed the userpace API because it started refusing writes terminated by a line feed, which broke the update tools we already have.
This patch re-adds that handling, so both a write terminated by a line feed or not can make it through with the update.
--- drivers/scsi/ipr.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/scsi/ipr.c +5 -0
@@ -3736,6 +3736,7 @@ static ssize_t ipr_store_update_fw(strucstruct ipr_sglist *sglist;char fname[100 ];char *src; +char *endline;int result, dnld_size;if (!capable (CAP_SYS_ADMIN ))
@@ -3743,6 +3744,10 @@ static ssize_t ipr_store_update_fw(strucsnprintf (fname,sizeof (fname),"%s" , buf); + endline =strchr (fname,'\n' ); +if (endline) + *endline ='\0' ; +if (request_firmware (&fw_entry, fname, &ioa_cfg->pdev->dev)) {dev_err (&ioa_cfg->pdev->dev,"Firmware file %s not found\n" , fname);return -EIO ;
PATCH 43/62 mm: thp: fix SMP race condition between THP page fault and MADV_DONTNEED
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit ad33bb04b2a6cee6c1f99fabb15cddbf93ff0433 upstream.
pmd_trans_unstable()/pmd_none_or_trans_huge_or_clear_bad() were introduced to locklessy (but atomically) detect when a pmd is a regular (stable) pmd or when the pmd is unstable and can infinitely transition from pmd_none() and pmd_trans_huge() from under us, while only holding the mmap_sem for reading (for writing not).
While holding the mmap_sem only for reading, MADV_DONTNEED can run from under us and so before we can assume the pmd to be a regular stable pmd we need to compare it against pmd_none() and pmd_trans_huge() in an atomic way, with pmd_trans_unstable(). The old pmd_trans_huge() left a tiny window for a race.
Useful applications are unlikely to notice the difference as doing MADV_DONTNEED concurrently with a page fault would lead to undefined behavior.
--- mm/memory.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
mm/memory.c +12 -2
@@ -3583,8 +3583,18 @@ retry:*/ if (unlikely (pmd_none (*pmd)) &&__pte_alloc (mm, vma, pmd, address))return VM_FAULT_OOM ; -/* if an huge pmd materialized from under us just retry later */ -if (unlikely (pmd_trans_huge (*pmd))) +/* +* If a huge pmd materialized under us just retry later. Use +* pmd_trans_unstable() instead of pmd_trans_huge() to ensure the pmd +* didn't become pmd_trans_huge under us and then back to pmd_none, as +* a result of MADV_DONTNEED running immediately after a huge pmd fault +* in a different thread of this mm, in turn leading to a misleading +* pmd_trans_huge() retval. All we have to ensure is that it is a +* regular pmd that we can walk with pte_offset_map() and we can do that +* through an atomic read in C, which is what pmd_trans_unstable() +* provides. +*/ +if (unlikely (pmd_trans_unstable (pmd)))return 0 ;/* * A regular pmd is established and it can't morph into a huge pmd
PATCH 44/62 hpfs: don't truncate the file when delete fails
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit b6853f78e763d42c7a158d8de3549c9827c604ab upstream.
The delete opration can allocate additional space on the HPFS filesystem due to btree split. The HPFS driver checks in advance if there is available space, so that it won't corrupt the btree if we run out of space during splitting.
If there is not enough available space, the HPFS driver attempted to truncate the file, but this results in a deadlock since the commit 7dd29d8d865efdb00c0542a5d2c87af8c52ea6c7 ("HPFS: Introduce a global mutex and lock it on every callback from VFS").
This patch removes the code that tries to truncate the file and -ENOSPC is returned instead. If the user hits -ENOSPC on delete, he should try to delete other files (that are stored in a leaf btree node), so that the delete operation will make some space for deleting the file stored in non-leaf btree node.
--- fs/hpfs/namei.c | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-)
fs/hpfs/namei.c +3 -28
@@ -362,12 +362,11 @@ static int hpfs_unlink(struct inode *dirstruct inode *inode = dentry->d_inode;dnode_secno dno;int r; -int rep =0 ;int err;hpfs_lock (dir->i_sb);hpfs_adjust_length (name, &len); -again: + err = -ENOENT ; de =map_dirent (dir,hpfs_i (dir)->i_dno, name, len, &dno, &qbh);if (!de)
@@ -387,33 +386,9 @@ again:hpfs_error (dir->i_sb,"there was error when removing dirent" ); err = -EFSERROR ;break ; -case 2 :/* no space for deleting, try to truncate file */ - +case 2 :/* no space for deleting */ err = -ENOSPC ; -if (rep++) -break ; - -dentry_unhash (dentry); -if (!d_unhashed (dentry)) { -hpfs_unlock (dir->i_sb); -return -ENOSPC ; - } -if (generic_permission (inode,MAY_WRITE ) || - !S_ISREG (inode->i_mode) || -get_write_access (inode)) { -d_rehash (dentry); - }else { -struct iattr newattrs; -/*printk("HPFS: truncating file before delete.\n");*/ - newattrs.ia_size =0 ; - newattrs.ia_valid =ATTR_SIZE |ATTR_CTIME ; - err =notify_change (dentry, &newattrs); -put_write_access (inode); -if (!err) - goto again; - } -hpfs_unlock (dir->i_sb); -return -ENOSPC ; +break ;default :drop_nlink (inode); err =0 ;
PATCH 45/62 ALSA: timer: Fix broken compat timer user status ioctl
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 3a72494ac2a3bd229db941d51e7efe2f6ccd947b upstream.
The timer user status compat ioctl returned the bogus struct used for 64bit architectures instead of the 32bit one. This patch addresses it to return the proper struct.
--- sound/core/timer_compat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/core/timer_compat.c +3 -2
@@ -70,13 +70,14 @@ static int snd_timer_user_status_compat( struct snd_timer_status32 __user *_status) {struct snd_timer_user *tu; -struct snd_timer_status status; +struct snd_timer_status32 status; tu = file->private_data;if (snd_BUG_ON (!tu->timeri))return -ENXIO ;memset (&status,0 ,sizeof (status)); - status.tstamp = tu->tstamp; + status.tstamp.tv_sec = tu->tstamp.tv_sec; + status.tstamp.tv_nsec = tu->tstamp.tv_nsec; status.resolution =snd_timer_resolution (tu->timeri); status.lost = tu->timeri->lost; status.overrun = tu->overrun;
PATCH 46/62 ALSA: hdspm: Fix wrong boolean ctl value accesses
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 537e48136295c5860a92138c5ea3959b9542868b upstream.
snd-hdspm driver accesses enum item values (int) instead of boolean values (long) wrongly for some ctl elements. This patch fixes them.
---
sound/pci/rme9652/hdspm.c +3 -3
@@ -4386,7 +4386,7 @@ static int snd_hdspm_get_tco_word_term(s {struct hdspm *hdspm =snd_kcontrol_chip (kcontrol); - ucontrol->value.enumerated.item[0 ] = hdspm->tco->term; + ucontrol->value.integer.value[0 ] = hdspm->tco->term;return 0 ; }
@@ -4397,8 +4397,8 @@ static int snd_hdspm_put_tco_word_term(s {struct hdspm *hdspm =snd_kcontrol_chip (kcontrol); -if (hdspm->tco->term != ucontrol->value.enumerated.item[0 ]) { - hdspm->tco->term = ucontrol->value.enumerated.item[0 ]; +if (hdspm->tco->term != ucontrol->value.integer.value[0 ]) { + hdspm->tco->term = ucontrol->value.integer.value[0 ];hdspm_tco_write (hdspm);
PATCH 47/62 ALSA: hdsp: Fix wrong boolean ctl value accesses
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit eab3c4db193f5fcccf70e884de9a922ca2c63d80 upstream.
snd-hdsp driver accesses enum item values (int) instead of boolean values (long) wrongly for some ctl elements. This patch fixes them.
--- sound/pci/rme9652/hdsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/rme9652/hdsp.c +2 -2
@@ -3163,7 +3163,7 @@ static int snd_hdsp_get_dds_offset(struc {struct hdsp *hdsp =snd_kcontrol_chip (kcontrol); - ucontrol->value.enumerated.item[0 ] =hdsp_dds_offset (hdsp); + ucontrol->value.integer.value[0 ] =hdsp_dds_offset (hdsp);return 0 ; }
@@ -3175,7 +3175,7 @@ static int snd_hdsp_put_dds_offset(strucif (!snd_hdsp_use_is_exclusive (hdsp))return -EBUSY ; - val = ucontrol->value.enumerated.item[0 ]; + val = ucontrol->value.integer.value[0 ];spin_lock_irq (&hdsp->lock);if (val !=hdsp_dds_offset (hdsp)) change = (hdsp_set_dds_offset (hdsp, val) ==0 ) ?1 :0 ;
PATCH 48/62 USB: cp210x: Add ID for Parrot NMEA GPS Flight Recorder
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vittorio Alfieri <[email protected]>
commit 3c4c615d70c8cbdc8ba8c79ed702640930652a79 upstream.
The Parrot NMEA GPS Flight Recorder is a USB composite device consisting of hub, flash storage, and cp210x usb to serial chip. It is an accessory to the mass-produced Parrot AR Drone 2. The device emits standard NMEA messages which make the it compatible with NMEA compatible software. It was tested using gpsd version 3.11-3 as an NMEA interpreter and using the official Parrot Flight Recorder.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -170,6 +170,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x18EF, 0xE025) }, /* ELV Marble Sound Board 1 */ { USB_DEVICE(0x1901, 0x0190) }, /* GE B850 CP2105 Recorder interface */ { USB_DEVICE(0x1901, 0x0193) }, /* GE B650 CP2104 PMC interface */ + { USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */ { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */
PATCH 49/62 ASoC: wm8958: Fix enum ctl accesses in a wrong type
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit d0784829ae3b0beeb69b476f017d5c8a2eb95198 upstream.
"MBC Mode", "VSS Mode", "VSS HPF Mode" and "Enhanced EQ Mode" ctls in wm8958 codec driver are enum, while the current driver accesses wrongly via value.integer.value[]. They have to be via value.enumerated.item[] instead.
--- sound/soc/codecs/wm8958-dsp2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/wm8958-dsp2.c +4 -4
@@ -458,7 +458,7 @@ static int wm8958_put_mbc_enum(struct snstruct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol);struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct wm8994_pdata *pdata = wm8994->pdata; -int value = ucontrol->value.integer.value[0 ]; +int value = ucontrol->value.enumerated.item[0 ];int reg;/* Don't allow on the fly reconfiguration */
@@ -548,7 +548,7 @@ static int wm8958_put_vss_enum(struct snstruct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol);struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct wm8994_pdata *pdata = wm8994->pdata; -int value = ucontrol->value.integer.value[0 ]; +int value = ucontrol->value.enumerated.item[0 ];int reg;/* Don't allow on the fly reconfiguration */
@@ -581,7 +581,7 @@ static int wm8958_put_vss_hpf_enum(strucstruct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol);struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct wm8994_pdata *pdata = wm8994->pdata; -int value = ucontrol->value.integer.value[0 ]; +int value = ucontrol->value.enumerated.item[0 ];int reg;/* Don't allow on the fly reconfiguration */
@@ -748,7 +748,7 @@ static int wm8958_put_enh_eq_enum(structstruct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol);struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct wm8994_pdata *pdata = wm8994->pdata; -int value = ucontrol->value.integer.value[0 ]; +int value = ucontrol->value.enumerated.item[0 ];int reg;/* Don't allow on the fly reconfiguration */
PATCH 50/62 ASoC: wm8994: Fix enum ctl accesses in a wrong type
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 8019c0b37cd5a87107808300a496388b777225bf upstream.
The DRC Mode like "AIF1DRC1 Mode" and EQ Mode like "AIF1.1 EQ Mode" in wm8994 codec driver are enum ctls, while the current driver accesses wrongly via value.integer.value[]. They have to be via value.enumerated.item[] instead.
--- sound/soc/codecs/wm8994.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/wm8994.c +2 -2
@@ -386,7 +386,7 @@ static int wm8994_put_drc_enum(struct snstruct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct wm8994_pdata *pdata = wm8994->pdata;int drc =wm8994_get_drc (kcontrol->id.name); -int value = ucontrol->value.integer.value[0 ]; +int value = ucontrol->value.enumerated.item[0 ];if (drc <0 )return drc;
@@ -489,7 +489,7 @@ static int wm8994_put_retune_mobile_enumstruct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct wm8994_pdata *pdata = wm8994->pdata;int block =wm8994_get_retune_mobile_block (kcontrol->id.name); -int value = ucontrol->value.integer.value[0 ]; +int value = ucontrol->value.enumerated.item[0 ];if (block <0 )return block;
PATCH 51/62 USB: serial: option: add support for Quectel UC20
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Yegor Yefremov <[email protected]>
commit c0992d0f54847d0d1d85c60fcaa054f175ab1ccd upstream.
Add support for Quectel UC20 and blacklist the QMI interface.
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -1138,6 +1138,8 @@ static const struct usb_device_id option { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9003), /* Quectel UC20 */ + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),
PATCH 52/62 ALSA: seq: oss: Don't drain at closing a client
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 197b958c1e76a575d77038cc98b4bebc2134279f upstream.
The OSS sequencer client tries to drain the pending events at releasing. Unfortunately, as spotted by syzkaller fuzzer, this may lead to an unkillable process state when the event has been queued at the far future. Since the process being released can't be signaled any longer, it remains and waits for the echo-back event in that far future.
Back to history, the draining feature was implemented at the time we misinterpreted POSIX definition for blocking file operation. Actually, such a behavior is superfluous at release, and we should just release the device as is instead of keeping it up forever.
This patch just removes the draining call that may block the release for too long time unexpectedly.
[bwh: Backported to 3.2: snd_seq_oss_drain_write() has an extra log statement
to be deleted]
--- sound/core/seq/oss/seq_oss.c | 2 -- sound/core/seq/oss/seq_oss_device.h | 1 - sound/core/seq/oss/seq_oss_init.c | 16 ---------------- 3 files changed, 19 deletions(-)
sound/core/seq/oss/seq_oss.c +0 -2
@@ -150,8 +150,6 @@ odev_release(struct inode *inode, structif ((dp = file->private_data) ==NULL )return 0 ; -snd_seq_oss_drain_write (dp); -mutex_lock (®ister_mutex);snd_seq_oss_release (dp);mutex_unlock (®ister_mutex);
sound/core/seq/oss/seq_oss_device.h +0 -1
@@ -131,7 +131,6 @@ int snd_seq_oss_write(struct seq_oss_devunsigned int snd_seq_oss_poll (struct seq_oss_devinfo *dp,struct file *file,poll_table * wait);void snd_seq_oss_reset (struct seq_oss_devinfo *dp); -void snd_seq_oss_drain_write (struct seq_oss_devinfo *dp);/* */ void snd_seq_oss_process_queue (struct seq_oss_devinfo *dp,abstime_t time);
sound/core/seq/oss/seq_oss_init.c +0 -17
@@ -447,23 +447,6 @@ snd_seq_oss_release(struct seq_oss_devin/* -* Wait until the queue is empty (if we don't have nonblock) -*/ -void -snd_seq_oss_drain_write (struct seq_oss_devinfo *dp) -{ -if (! dp->timer->running) -return ; -if (is_write_mode (dp->file_mode) && !is_nonblock_mode (dp->file_mode) && - dp->writeq) { -debug_printk (("syncing..\n" )); -while (snd_seq_oss_writeq_sync (dp->writeq)) - ; - } -} - - -/* * reset sequencer devices */ void
PATCH 53/62 PM / sleep / x86: Fix crash on graph trace through x86 suspend
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Todd E Brandt <[email protected]>
commit 92f9e179a702a6adbc11e2fedc76ecd6ffc9e3f7 upstream.
Pause/unpause graph tracing around do_suspend_lowlevel as it has inconsistent call/return info after it jumps to the wakeup vector. The graph trace buffer will otherwise become misaligned and may eventually crash and hang on suspend.
To reproduce the issue and test the fix:
Run a function_graph trace over suspend/resume and set the graph function to suspend_devices_and_enter. This consistently hangs the system without this fix.
--- arch/x86/kernel/acpi/sleep.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/kernel/acpi/sleep.c +7 -0
@@ -15,6 +15,7 @@#include <asm/pgtable.h> #include <asm/cacheflush.h> +#include <linux/ftrace.h> #include "realmode/wakeup.h" #include "sleep.h"
@@ -102,7 +103,13 @@ int acpi_suspend_lowlevel(void) saved_magic =0x123456789abcdef0L ;#endif /* CONFIG_64BIT */ +/* +* Pause/unpause graph tracing around do_suspend_lowlevel as it has +* inconsistent call/return info after it jumps to the wakeup vector. +*/ +pause_graph_tracing ();do_suspend_lowlevel (); +unpause_graph_tracing ();return 0 ; }
PATCH 54/62 IB/core: Use GRH when the path hop-limit > 0
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Or Gerlitz <[email protected]>
commit 11d8d645343efba0c975aefe7c2cf3b33c836c75 upstream.
According to IBTA spec v1.3 section 12.7.19, QPs should use GRH when the path returned by the SA has hop-limit > 0. Currently, we do that only for the > 1 case, fix that.
--- drivers/infiniband/core/sa_query.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/sa_query.c +1 -1
@@ -508,7 +508,7 @@ int ib_init_ah_from_path(struct ib_devic force_grh =rdma_port_get_link_layer (device, port_num) ==IB_LINK_LAYER_ETHERNET ; -if (rec->hop_limit >1 || force_grh) { +if (rec->hop_limit >0 || force_grh) { ah_attr->ah_flags =IB_AH_GRH ; ah_attr->grh.dgid = rec->dgid;
PATCH 55/62 mld, igmp: Fix reserved tailroom calculation
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Poirier <[email protected]>
commit 1837b2e2bcd23137766555a63867e649c0b637f0 upstream.
The current reserved_tailroom calculation fails to take hlen and tlen into account.
skb:
[__hlen__|__data____________|__tlen___|__extra__]
^ ^
head skb_end_offset
In this representation, hlen + data + tlen is the size passed to alloc_skb. "extra" is the extra space made available in __alloc_skb because of rounding up by kmalloc. We can reorder the representation like so:
[__hlen__|__data____________|__extra__|__tlen___]
^ ^
head skb_end_offset
The maximum space available for ip headers and payload without fragmentation is min(mtu, data + extra). Therefore, reserved_tailroom
= data + extra + tlen - min(mtu, data + extra)
= skb_end_offset - hlen - min(mtu, skb_end_offset - hlen - tlen) = skb_tailroom - min(mtu, skb_tailroom - tlen) ; after skb_reserve(hlen)
Compare the second line to the current expression:reserved_tailroom = skb_end_offset - min(mtu, skb_end_offset) and we can see that hlen and tlen are not taken into account.
The min() in the third line can be expanded into:
if mtu < skb_tailroom - tlen:
reserved_tailroom = skb_tailroom - mtu
else:
reserved_tailroom = tlen
Depending on hlen, tlen, mtu and the number of multicast address records, the current code may output skbs that have less tailroom than dev->needed_tailroom or it may output more skbs than needed because not all space available is used.
--- include/linux/skbuff.h | 24 ++++++++++++++++++++++++ net/ipv4/igmp.c | 3 +-- net/ipv6/mcast.c | 3 +-- 3 files changed, 26 insertions(+), 4 deletions(-)
include/linux/skbuff.h +24 -0
@@ -1377,6 +1377,30 @@ static inline void skb_reserve(struct sk skb->tail += len; } +/** +* skb_tailroom_reserve - adjust reserved_tailroom +* @skb: buffer to alter +* @mtu: maximum amount of headlen permitted +* @needed_tailroom: minimum amount of reserved_tailroom +* +* Set reserved_tailroom so that headlen can be as large as possible but +* not larger than mtu and tailroom cannot be smaller than +* needed_tailroom. +* The required headroom should already have been reserved before using +* this function. +*/ +static inline void skb_tailroom_reserve (struct sk_buff *skb,unsigned int mtu, +unsigned int needed_tailroom) +{ +SKB_LINEAR_ASSERT (skb); +if (mtu <skb_tailroom (skb) - needed_tailroom) +/* use at most mtu */ + skb->reserved_tailroom =skb_tailroom (skb) - mtu; +else +/* use up to all available space */ + skb->reserved_tailroom = needed_tailroom; +} +static inline void skb_reset_mac_len (struct sk_buff *skb) { skb->mac_len = skb->network_header - skb->mac_header;
net/ipv4/igmp.c +1 -2
@@ -327,9 +327,8 @@ static struct sk_buff *igmpv3_newpack(stskb_dst_set (skb, &rt->dst); skb->dev = dev; - skb->reserved_tailroom =skb_end_offset (skb) - -min (mtu,skb_end_offset (skb));skb_reserve (skb, hlen); +skb_tailroom_reserve (skb, mtu, tlen);skb_reset_network_header (skb); pip =ip_hdr (skb);
net/ipv6/mcast.c +1 -2
@@ -1359,9 +1359,8 @@ static struct sk_buff *mld_newpack(strucif (!skb)return NULL ; - skb->reserved_tailroom =skb_end_offset (skb) - -min (mtu,skb_end_offset (skb));skb_reserve (skb, hlen); +skb_tailroom_reserve (skb, mtu, tlen);if (__ipv6_get_lladdr (idev, &addr_buf,IFA_F_TENTATIVE )) {/* <draft-ietf-magma-mld-source-05.txt>:
PATCH 56/62 MIPS: traps: Fix SIGFPE information leak from `do_ov' and `do_trap_or_bp'
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Maciej W. Rozycki" <[email protected]>
commit e723e3f7f9591b79e8c56b3d7c5a204a9c571b55 upstream.
Avoid sending a partially initialised siginfo_t' structure along SIGFPE signals issued from do_ov' and `do_trap_or_bp', leading to information leaking from the kernel stack.
--- arch/mips/kernel/traps.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
arch/mips/kernel/traps.c +6 -7
@@ -656,14 +656,14 @@ static int simulate_sync(struct pt_regs asmlinkage void do_ov(struct pt_regs *regs) { -siginfo_t info; +siginfo_t info = { + .si_signo =SIGFPE , + .si_code =FPE_INTOVF , + .si_addr = (void __user *)regs->cp0_epc, + };die_if_kernel ("Integer overflow" , regs); - info.si_code =FPE_INTOVF ; - info.si_signo =SIGFPE ; - info.si_errno =0 ; - info.si_addr = (void __user *) regs->cp0_epc;force_sig_info (SIGFPE , &info, current); }
@@ -758,7 +758,7 @@ asmlinkage void do_fpe(struct pt_regs *rstatic void do_trap_or_bp (struct pt_regs *regs,unsigned int code,const char *str) { -siginfo_t info; +siginfo_t info = {0 };char b[40 ];#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
@@ -785,7 +785,6 @@ static void do_trap_or_bp(struct pt_regselse info.si_code =FPE_INTOVF ; info.si_signo =SIGFPE ; - info.si_errno =0 ; info.si_addr = (void __user *) regs->cp0_epc;force_sig_info (SIGFPE , &info, current);break ;
PATCH 57/62 ubi: Fix out of bounds write in volume update code
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit e4f6daac20332448529b11f09388f1d55ef2084c upstream.
ubi_start_leb_change() allocates too few bytes. ubi_more_leb_change_data() will write up to req->upd_bytes + ubi->min_io_size bytes.
--- drivers/mtd/ubi/upd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/ubi/upd.c +1 -1
@@ -197,7 +197,7 @@ int ubi_start_leb_change(struct ubi_devi vol->ch_lnum = req->lnum; vol->ch_dtype = req->dtype; - vol->upd_buf =vmalloc (req->bytes); + vol->upd_buf =vmalloc (ALIGN ((int )req->bytes, ubi->min_io_size));if (!vol->upd_buf)return -ENOMEM ;
PATCH 58/62 Revert "drm/radeon: call hpd_irq_event on resume"
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 256faedcfd646161477d47a1a78c32a562d2e845 upstream.
This reverts commit dbb17a21c131eca94eb31136eee9a7fe5aff00d9.
It turns out that commit can cause problems for systems with multiple GPUs, and causes X to hang on at least a HP Pavilion dv7 with hybrid graphics.
This got noticed originally in 4.4.4, where this patch had already gotten back-ported, but 4.5-rc7 was verified to have the same problem.
Alexander Deucher says:
"It looks like you have a muxed system so I suspect what's happening is
that one of the display is being reported as connected for both the IGP and the dGPU and then the desktop environment gets confused or there some sort problem in the detect functions since the mux is not switched to the dGPU. I don't see an easy fix unless Dave has any ideas. I'd say just revert for now"
--- drivers/gpu/drm/radeon/radeon_device.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/radeon/radeon_device.c +0 -1
@@ -960,7 +960,6 @@ int radeon_resume_kms(struct drm_device }drm_kms_helper_poll_enable (dev); -drm_helper_hpd_irq_event (dev);return 0 ; }
PATCH 59/62 s390/mm: four page table levels vs. fork
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
commit 3446c13b268af86391d06611327006b059b8bab1 upstream.
The fork of a process with four page table levels is broken since git commit 6252d702c5311ce9 "[S390] dynamic page tables."
All new mm contexts are created with three page table levels and an asce limit of 4TB. If the parent has four levels dup_mmap will add vmas to the new context which are outside of the asce limit. The subsequent call to copy_page_range will walk the three level page table structure of the new process with non-zero pgd and pud indexes. This leads to memory clobbers as the pgd_index *and* the pud_index is added to the mm->pgd pointer without a pgd_deref in between.
The init_new_context() function is selecting the number of page table levels for a new context. The function is used by mm_init() which in turn is called by dup_mm() and mm_alloc(). These two are used by fork() and exec(). The init_new_context() function can distinguish the two cases by looking at mm->context.asce_limit, for fork() the mm struct has been copied and the number of page table levels may not change. For exec() the mm_alloc() function set the new mm structure to zero, in this case a three-level page table is created as the temporary stack space is located at STACK_TOP_MAX = 4TB.
This fixes CVE-2016-2143.
[bwh: Backported to 3.2:
- 31-bit s390 is still supported so keep the #ifdef CONFIG_64BIT conditions
- Split page table locks are not implemented for PMDs so don't call pgtable_pmd_page_{ctor,dtor}()
- PMDs are not accounted so don't call mm_inc_nr_pmds()
- Adjust context]
---
arch/s390/include/asm/mmu_context.h +11 -9
@@ -16,12 +16,11 @@static inline int init_new_context (struct task_struct *tsk,struct mm_struct *mm) { +spin_lock_init (&mm->context.list_lock); +INIT_LIST_HEAD (&mm->context.pgtable_list); +INIT_LIST_HEAD (&mm->context.gmap_list);atomic_set (&mm->context.attach_count,0 ); mm->context.flush_mm =0 ; - mm->context.asce_bits = _ASCE_TABLE_LENGTH | _ASCE_USER_BITS; -#ifdef CONFIG_64BIT - mm->context.asce_bits |= _ASCE_TYPE_REGION3; -#endif if (current->mm && current->mm->context.alloc_pgste) {/* * alloc_pgste indicates, that any NEW context will be created
@@ -40,7 +39,14 @@ static inline int init_new_context(struc mm->context.has_pgste =0 ; mm->context.alloc_pgste =0 ; } - mm->context.asce_limit =STACK_TOP_MAX ; +if (mm->context.asce_limit ==0 ) { +/* context created by exec, set asce limit to 4TB */ + mm->context.asce_bits = _ASCE_TABLE_LENGTH | _ASCE_USER_BITS; +#ifdef CONFIG_64BIT + mm->context.asce_bits |= _ASCE_TYPE_REGION3; +#endif + mm->context.asce_limit =STACK_TOP_MAX ; + }crst_table_init ((unsigned long *) mm->pgd,pgd_entry_type (mm));return 0 ; }
@@ -94,10 +100,6 @@ static inline void activate_mm(struct mmstatic inline void arch_dup_mmap (struct mm_struct *oldmm,struct mm_struct *mm) { -#ifdef CONFIG_64BIT -if (oldmm->context.asce_limit < mm->context.asce_limit) -crst_table_downgrade (mm, oldmm->context.asce_limit); -#endif }static inline void arch_exit_mmap (struct mm_struct *mm)
arch/s390/include/asm/pgalloc.h +0 -3
@@ -110,9 +110,6 @@ static inline void pud_populate(struct mstatic inline pgd_t *pgd_alloc (struct mm_struct *mm) { -spin_lock_init (&mm->context.list_lock); -INIT_LIST_HEAD (&mm->context.pgtable_list); -INIT_LIST_HEAD (&mm->context.gmap_list);return (pgd_t *)crst_table_alloc (mm); }#define pgd_free (mm, pgd) crst_table_free(mm, (unsigned long *) pgd)
PATCH 60/62 Input: aiptek - fix crash on detecting device without endpoints
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vladis Dronov <[email protected]>
commit 8e20cf2bce122ce9262d6034ee5d5b76fbb92f96 upstream.
The aiptek driver crashes in aiptek_probe() when a specially crafted USB device without endpoints is detected. This fix adds a check that the device has proper configuration expected by the driver. Also an error return value is changed to more matching one in one of the error paths.
--- drivers/input/tablet/aiptek.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/input/tablet/aiptek.c +9 -0
@@ -1810,6 +1810,14 @@ aiptek_probe(struct usb_interface *intf,input_set_abs_params (inputdev,ABS_TILT_Y ,AIPTEK_TILT_MIN ,AIPTEK_TILT_MAX ,0 ,0 );input_set_abs_params (inputdev,ABS_WHEEL ,AIPTEK_WHEEL_MIN ,AIPTEK_WHEEL_MAX -1 ,0 ,0 ); +/* Verify that a device really has an endpoint */ +if (intf->altsetting[0 ].desc.bNumEndpoints <1 ) { +dev_err (&intf->dev, +"interface has %d endpoints, but must have minimum 1\n" , + intf->altsetting[0 ].desc.bNumEndpoints); + err = -EINVAL ; + goto fail3; + } endpoint = &intf->altsetting[0 ].endpoint[0 ].desc;/* Go set up our URB, which is called when the tablet receives
@@ -1852,6 +1860,7 @@ aiptek_probe(struct usb_interface *intf,if (i ==ARRAY_SIZE (speeds)) {dev_info (&intf->dev,"Aiptek tried all speeds, no sane response\n" ); + err = -EINVAL ; goto fail2; }
PATCH 61/62 include/linux/poison.h: fix LIST_POISON{1,2} offset
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Kulikov <[email protected]>
commit 8a5e5e02fc83aaf67053ab53b359af08c6c49aaf upstream.
Poison pointer values should be small enough to find a room in non-mmap'able/hardly-mmap'able space. E.g. on x86 "poison pointer space" is located starting from 0x0. Given unprivileged users cannot mmap anything below mmap_min_addr, it should be safe to use poison pointers lower than mmap_min_addr.
The current poison pointer values of LIST_POISON{1,2} might be too big for mmap_min_addr values equal or less than 1 MB (common case, e.g. Ubuntu uses only 0x10000). There is little point to use such a big value given the "poison pointer space" below 1 MB is not yet exhausted. Changing it to a smaller value solves the problem for small mmap_min_addr setups.
The values are suggested by Solar Designer:
http://www.openwall.com/lists/oss-security/2015/05/02/6
--- include/linux/poison.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/poison.h +2 -2
@@ -19,8 +19,8 @@* under normal circumstances, used to verify that nobody uses * non-initialized list entries. */ -#define LIST_POISON1 ((void *) 0x00100100 + POISON_POINTER_DELTA) -#define LIST_POISON2 ((void *) 0x00200200 + POISON_POINTER_DELTA) +#define LIST_POISON1 ((void *) 0x100 + POISON_POINTER_DELTA) +#define LIST_POISON2 ((void *) 0x200 + POISON_POINTER_DELTA)/********** include/linux/timer.h **********/ /*
PATCH 62/62 HID: usbhid: fix recursive deadlock
In reply to Ben Hutchings3.2.79-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ioan-Adrian Ratiu <[email protected]>
commit e470127e9606b1fa151c4184243e61296d1e0c0f upstream.
The critical section protected by usbhid->lock in hid_ctrl() is too big and because of this it causes a recursive deadlock. "Too big" means the case statement and the call to hid_input_report() do not need to be protected by the spinlock (no URB operations are done inside them).
The deadlock happens because in certain rare cases drivers try to grab the lock while handling the ctrl irq which grabs the lock before them as described above. For example newer wacom tablets like 056a:033c try to reschedule proximity reads from wacom_intuos_schedule_prox_event() calling hid_hw_request() -> usbhid_request() -> usbhid_submit_report() which tries to grab the usbhid lock already held by hid_ctrl().
There are two ways to get out of this deadlock:
1. Make the drivers work "around" the ctrl critical region, in the wacom case for ex. by delaying the scheduling of the proximity read request itself to a workqueue.
2. Shrink the critical region so the usbhid lock protects only the instructions which modify usbhid state, calling hid_input_report() with the spinlock unlocked, allowing the device driver to grab the lock first, finish and then grab the lock afterwards in hid_ctrl().
This patch implements the 2nd solution.
--- drivers/hid/usbhid/hid-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/usbhid/hid-core.c +2 -2
@@ -448,8 +448,6 @@ static void hid_ctrl(struct urb *urb)struct usbhid_device *usbhid = hid->driver_data;int unplug =0 , status = urb->status; -spin_lock (&usbhid->lock); -switch (status) {case 0 :/* success */ if (usbhid->ctrl[usbhid->ctrltail].dir ==USB_DIR_IN )
@@ -469,6 +467,8 @@ static void hid_ctrl(struct urb *urb)hid_warn (urb->dev,"ctrl urb status %d received\n" , status); } +spin_lock (&usbhid->lock); +if (unplug) usbhid->ctrltail = usbhid->ctrlhead;else
This is the combined diff for 3.2.79-rc1 relative to 3.2.78.
Ben.
Signature · 2 lines
Ben Hutchings Tomorrow will be cancelled due to lack of interest.
Makefile +2 -2
@@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 2 -SUBLEVEL = 78 -EXTRAVERSION = +SUBLEVEL = 79 +EXTRAVERSION = -rc1 NAME = Saber-toothed Squirrel # *DOCUMENTATION*
arch/mips/kernel/traps.c +6 -7
@@ -656,14 +656,14 @@ static int simulate_sync(struct pt_regs *regs, unsigned int opcode) asmlinkage void do_ov(struct pt_regs *regs) { -siginfo_t info; +siginfo_t info = { + .si_signo =SIGFPE , + .si_code =FPE_INTOVF , + .si_addr = (void __user *)regs->cp0_epc, + };die_if_kernel ("Integer overflow" , regs); - info.si_code =FPE_INTOVF ; - info.si_signo =SIGFPE ; - info.si_errno =0 ; - info.si_addr = (void __user *) regs->cp0_epc;force_sig_info (SIGFPE , &info, current); }
@@ -758,7 +758,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)static void do_trap_or_bp (struct pt_regs *regs,unsigned int code,const char *str) { -siginfo_t info; +siginfo_t info = {0 };char b[40 ];#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
@@ -785,7 +785,6 @@ static void do_trap_or_bp(struct pt_regs *regs, unsigned int code,else info.si_code =FPE_INTOVF ; info.si_signo =SIGFPE ; - info.si_errno =0 ; info.si_addr = (void __user *) regs->cp0_epc;force_sig_info (SIGFPE , &info, current);break ;
arch/s390/include/asm/mmu_context.h +11 -9
@@ -16,12 +16,11 @@static inline int init_new_context (struct task_struct *tsk,struct mm_struct *mm) { +spin_lock_init (&mm->context.list_lock); +INIT_LIST_HEAD (&mm->context.pgtable_list); +INIT_LIST_HEAD (&mm->context.gmap_list);atomic_set (&mm->context.attach_count,0 ); mm->context.flush_mm =0 ; - mm->context.asce_bits = _ASCE_TABLE_LENGTH | _ASCE_USER_BITS; -#ifdef CONFIG_64BIT - mm->context.asce_bits |= _ASCE_TYPE_REGION3; -#endif if (current->mm && current->mm->context.alloc_pgste) {/* * alloc_pgste indicates, that any NEW context will be created
@@ -40,7 +39,14 @@ static inline int init_new_context(struct task_struct *tsk, mm->context.has_pgste =0 ; mm->context.alloc_pgste =0 ; } - mm->context.asce_limit =STACK_TOP_MAX ; +if (mm->context.asce_limit ==0 ) { +/* context created by exec, set asce limit to 4TB */ + mm->context.asce_bits = _ASCE_TABLE_LENGTH | _ASCE_USER_BITS; +#ifdef CONFIG_64BIT + mm->context.asce_bits |= _ASCE_TYPE_REGION3; +#endif + mm->context.asce_limit =STACK_TOP_MAX ; + }crst_table_init ((unsigned long *) mm->pgd,pgd_entry_type (mm));return 0 ; }
@@ -94,10 +100,6 @@ static inline void activate_mm(struct mm_struct *prev,static inline void arch_dup_mmap (struct mm_struct *oldmm,struct mm_struct *mm) { -#ifdef CONFIG_64BIT -if (oldmm->context.asce_limit < mm->context.asce_limit) -crst_table_downgrade (mm, oldmm->context.asce_limit); -#endif }static inline void arch_exit_mmap (struct mm_struct *mm)
arch/s390/include/asm/pgalloc.h +0 -3
@@ -110,9 +110,6 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)static inline pgd_t *pgd_alloc (struct mm_struct *mm) { -spin_lock_init (&mm->context.list_lock); -INIT_LIST_HEAD (&mm->context.pgtable_list); -INIT_LIST_HEAD (&mm->context.gmap_list);return (pgd_t *)crst_table_alloc (mm); }#define pgd_free (mm, pgd) crst_table_free(mm, (unsigned long *) pgd)
arch/x86/kernel/acpi/sleep.c +7 -0
@@ -15,6 +15,7 @@#include <asm/pgtable.h> #include <asm/cacheflush.h> +#include <linux/ftrace.h> #include "realmode/wakeup.h" #include "sleep.h"
@@ -102,7 +103,13 @@ int acpi_suspend_lowlevel(void) saved_magic =0x123456789abcdef0L ;#endif /* CONFIG_64BIT */ +/* +* Pause/unpause graph tracing around do_suspend_lowlevel as it has +* inconsistent call/return info after it jumps to the wakeup vector. +*/ +pause_graph_tracing ();do_suspend_lowlevel (); +unpause_graph_tracing ();return 0 ; }
arch/x86/lib/copy_user_nocache_64.S +104 -48
199 lines not on this page · raw message
crypto/ablkcipher.c +1 -0
@@ -461,6 +461,7 @@ static int crypto_init_givcipher_ops(struct crypto_tfm *tfm, u32 type, crt->givdecrypt = alg->givdecrypt ?: no_givdecrypt; crt->base =__crypto_ablkcipher_cast (tfm); crt->ivsize = alg->ivsize; + crt->has_setkey = alg->max_keysize;return 0 ; }
crypto/algif_skcipher.c +1 -4
@@ -249,11 +249,8 @@ static int skcipher_sendmsg(struct kiocb *unused, struct socket *sock, {struct sock *sk = sock->sk;struct alg_sock *ask =alg_sk (sk); -struct sock *psk = ask->parent; -struct alg_sock *pask =alg_sk (psk);struct skcipher_ctx *ctx = ask->private; -struct ablkcipher_tfm *skc = pask->private; -struct crypto_ablkcipher *tfm = skc->base; +struct crypto_ablkcipher *tfm =crypto_ablkcipher_reqtfm (&ctx->req);unsigned ivsize =crypto_ablkcipher_ivsize (tfm);struct skcipher_sg_list *sgl;struct af_alg_control con = {};
crypto/blkcipher.c +1 -0
@@ -458,6 +458,7 @@ static int crypto_init_blkcipher_ops_async(struct crypto_tfm *tfm) } crt->base =__crypto_ablkcipher_cast (tfm); crt->ivsize = alg->ivsize; + crt->has_setkey = alg->max_keysize;return 0 ; }
drivers/ata/ahci.c +6 -0
@@ -377,15 +377,21 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H RAID */ { PCI_VDEVICE(INTEL, 0xa10f), board_ahci }, /* Sunrise Point-H RAID */ { PCI_VDEVICE(INTEL, 0x2822), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0x2823), board_ahci }, /* Lewisburg AHCI*/ { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0x2827), board_ahci }, /* Lewisburg RAID*/ { PCI_VDEVICE(INTEL, 0xa182), board_ahci }, /* Lewisburg AHCI*/ { PCI_VDEVICE(INTEL, 0xa184), board_ahci }, /* Lewisburg RAID*/ { PCI_VDEVICE(INTEL, 0xa186), board_ahci }, /* Lewisburg RAID*/ { PCI_VDEVICE(INTEL, 0xa18e), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0xa1d2), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0xa1d6), board_ahci }, /* Lewisburg RAID*/ { PCI_VDEVICE(INTEL, 0xa202), board_ahci }, /* Lewisburg AHCI*/ { PCI_VDEVICE(INTEL, 0xa204), board_ahci }, /* Lewisburg RAID*/ { PCI_VDEVICE(INTEL, 0xa206), board_ahci }, /* Lewisburg RAID*/ { PCI_VDEVICE(INTEL, 0xa20e), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0xa252), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0xa256), board_ahci }, /* Lewisburg RAID*//* JMicron 360/1/3/5/6, match class to avoid IDE function */ { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
drivers/ata/libata-scsi.c +5 -6
@@ -672,19 +672,18 @@ static int ata_ioc32(struct ata_port *ap)int ata_sas_scsi_ioctl (struct ata_port *ap,struct scsi_device *scsidev,int cmd,void __user *arg) { -int val = -EINVAL , rc = -EINVAL ; +unsigned long val; +int rc = -EINVAL ;unsigned long flags;switch (cmd) { -case ATA_IOC_GET_IO32 : +case HDIO_GET_32BIT :spin_lock_irqsave (ap->lock, flags); val =ata_ioc32 (ap);spin_unlock_irqrestore (ap->lock, flags); -if (copy_to_user (arg, &val,1 )) -return -EFAULT ; -return 0 ; +return put_user (val, (unsigned long __user *)arg); -case ATA_IOC_SET_IO32 : +case HDIO_SET_32BIT : val = (unsigned long ) arg; rc =0 ;spin_lock_irqsave (ap->lock, flags);
drivers/gpu/drm/i915/intel_i2c.c +1 -1
@@ -410,7 +410,7 @@ int intel_setup_gmbus(struct drm_device *dev)return 0 ; err: -while (--i) { +while (i--) {struct intel_gmbus *bus = &dev_priv->gmbus[i];i2c_del_adapter (&bus->adapter); }
drivers/gpu/drm/radeon/radeon_device.c +0 -1
@@ -960,7 +960,6 @@ int radeon_resume_kms(struct drm_device *dev) }drm_kms_helper_poll_enable (dev); -drm_helper_hpd_irq_event (dev);return 0 ; }
drivers/hid/usbhid/hid-core.c +2 -2
@@ -448,8 +448,6 @@ static void hid_ctrl(struct urb *urb)struct usbhid_device *usbhid = hid->driver_data;int unplug =0 , status = urb->status; -spin_lock (&usbhid->lock); -switch (status) {case 0 :/* success */ if (usbhid->ctrl[usbhid->ctrltail].dir ==USB_DIR_IN )
@@ -469,6 +467,8 @@ static void hid_ctrl(struct urb *urb)hid_warn (urb->dev,"ctrl urb status %d received\n" , status); } +spin_lock (&usbhid->lock); +if (unplug) usbhid->ctrltail = usbhid->ctrlhead;else
drivers/infiniband/core/sa_query.c +1 -1
@@ -508,7 +508,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, force_grh =rdma_port_get_link_layer (device, port_num) ==IB_LINK_LAYER_ETHERNET ; -if (rec->hop_limit >1 || force_grh) { +if (rec->hop_limit >0 || force_grh) { ah_attr->ah_flags =IB_AH_GRH ; ah_attr->grh.dgid = rec->dgid;
drivers/input/tablet/aiptek.c +9 -0
@@ -1810,6 +1810,14 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)input_set_abs_params (inputdev,ABS_TILT_Y ,AIPTEK_TILT_MIN ,AIPTEK_TILT_MAX ,0 ,0 );input_set_abs_params (inputdev,ABS_WHEEL ,AIPTEK_WHEEL_MIN ,AIPTEK_WHEEL_MAX -1 ,0 ,0 ); +/* Verify that a device really has an endpoint */ +if (intf->altsetting[0 ].desc.bNumEndpoints <1 ) { +dev_err (&intf->dev, +"interface has %d endpoints, but must have minimum 1\n" , + intf->altsetting[0 ].desc.bNumEndpoints); + err = -EINVAL ; + goto fail3; + } endpoint = &intf->altsetting[0 ].endpoint[0 ].desc;/* Go set up our URB, which is called when the tablet receives
@@ -1852,6 +1860,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)if (i ==ARRAY_SIZE (speeds)) {dev_info (&intf->dev,"Aiptek tried all speeds, no sane response\n" ); + err = -EINVAL ; goto fail2; }
drivers/iommu/dmar.c +1 -1
@@ -923,7 +923,7 @@ void dmar_disable_qi(struct intel_iommu *iommu)raw_spin_lock_irqsave (&iommu->register_lock, flags); - sts =dmar_readq (iommu->reg +DMAR_GSTS_REG ); + sts =readl (iommu->reg +DMAR_GSTS_REG );if (!(sts &DMA_GSTS_QIES )) goto end;
drivers/iommu/intr_remapping.c +1 -1
@@ -496,7 +496,7 @@ static void iommu_disable_intr_remapping(struct intel_iommu *iommu)raw_spin_lock_irqsave (&iommu->register_lock, flags); - sts =dmar_readq (iommu->reg +DMAR_GSTS_REG ); + sts =readl (iommu->reg +DMAR_GSTS_REG );if (!(sts &DMA_GSTS_IRES )) goto end;
drivers/mtd/ubi/upd.c +1 -1
@@ -197,7 +197,7 @@ int ubi_start_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, vol->ch_lnum = req->lnum; vol->ch_dtype = req->dtype; - vol->upd_buf =vmalloc (req->bytes); + vol->upd_buf =vmalloc (ALIGN ((int )req->bytes, ubi->min_io_size));if (!vol->upd_buf)return -ENOMEM ;
drivers/net/can/usb/ems_usb.c +10 -4
@@ -118,6 +118,9 @@ MODULE_LICENSE("GPL v2");*/ #define EMS_USB_ARM7_CLOCK 8000000 +#define CPC_TX_QUEUE_TRIGGER_LOW 25 +#define CPC_TX_QUEUE_TRIGGER_HIGH 35 +/* * CAN-Message representation in a CPC_MSG. Message object type is * CPC_MSG_TYPE_CAN_FRAME or CPC_MSG_TYPE_RTR_FRAME or
@@ -280,6 +283,11 @@ static void ems_usb_read_interrupt_callback(struct urb *urb)switch (urb->status) {case 0 : dev->free_slots = dev->intr_in_buffer[1 ]; +if (dev->free_slots >CPC_TX_QUEUE_TRIGGER_HIGH ){ +if (netif_queue_stopped (netdev)){ +netif_wake_queue (netdev); + } + }break ;case -ECONNRESET :/* unlink */
@@ -535,8 +543,6 @@ static void ems_usb_write_bulk_callback(struct urb *urb)/* Release context */ context->echo_index =MAX_TX_URBS ; -if (netif_queue_stopped (netdev)) -netif_wake_queue (netdev); }/*
@@ -596,7 +602,7 @@ static int ems_usb_start(struct ems_usb *dev)int err, i; dev->intr_in_buffer[0 ] =0 ; - dev->free_slots =15 ;/* initial size */ + dev->free_slots =50 ;/* initial size */ for (i =0 ; i <MAX_RX_URBS ; i++) {struct urb *urb =NULL ;
@@ -858,7 +864,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne/* Slow down tx path */ if (atomic_read (&dev->active_tx_urbs) >=MAX_TX_URBS || - dev->free_slots <5 ) { + dev->free_slots <CPC_TX_QUEUE_TRIGGER_LOW ) {netif_stop_queue (netdev); } }
drivers/net/ethernet/mellanox/mlx4/en_port.c +2 -2
@@ -248,11 +248,11 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)be64_to_cpu (mlx4_en_stats->MCAST_novlan); stats->collisions =0 ; stats->rx_length_errors =be32_to_cpu (mlx4_en_stats->RdropLength); - stats->rx_over_errors =be32_to_cpu (mlx4_en_stats->RdropOvflw); + stats->rx_over_errors =0 ; stats->rx_crc_errors =be32_to_cpu (mlx4_en_stats->RCRC); stats->rx_frame_errors =0 ; stats->rx_fifo_errors =be32_to_cpu (mlx4_en_stats->RdropOvflw); - stats->rx_missed_errors =be32_to_cpu (mlx4_en_stats->RdropOvflw); + stats->rx_missed_errors =0 ; stats->tx_aborted_errors =0 ; stats->tx_carrier_errors =0 ; stats->tx_fifo_errors =0 ;
drivers/pci/xen-pcifront.c +6 -4
@@ -50,7 +50,7 @@ struct pcifront_device { };struct pcifront_sd { -int domain; +struct pci_sysdata sd;struct pcifront_device *pdev; };
@@ -64,7 +64,9 @@ static inline void pcifront_init_sd(struct pcifront_sd *sd, unsigned int domain, unsigned int bus, struct pcifront_device *pdev) { - sd->domain = domain; +/* Because we do not expose that information via XenBus. */ + sd->sd.node = first_online_node; + sd->sd.domain = domain; sd->pdev = pdev; }
@@ -461,8 +463,8 @@ static int __devinit pcifront_scan_root(struct pcifront_device *pdev,dev_info (&pdev->xdev->dev,"Creating PCI Frontend Bus %04x:%02x\n" , domain, bus); - bus_entry =kmalloc (sizeof (*bus_entry),GFP_KERNEL ); - sd =kmalloc (sizeof (*sd),GFP_KERNEL ); + bus_entry =kzalloc (sizeof (*bus_entry),GFP_KERNEL ); + sd =kzalloc (sizeof (*sd),GFP_KERNEL );if (!bus_entry || !sd) { err = -ENOMEM ; goto err_out;
drivers/s390/block/dasd_alias.c +17 -6
@@ -326,8 +326,10 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device)spin_unlock_irqrestore (&lcu->lock, flags);cancel_work_sync (&lcu->suc_data.worker);spin_lock_irqsave (&lcu->lock, flags); -if (device == lcu->suc_data.device) +if (device == lcu->suc_data.device) { +dasd_put_device (device); lcu->suc_data.device =NULL ; + } } was_pending =0 ;if (device == lcu->ruac_data.device) {
@@ -335,8 +337,10 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device) was_pending =1 ;cancel_delayed_work_sync (&lcu->ruac_data.dwork);spin_lock_irqsave (&lcu->lock, flags); -if (device == lcu->ruac_data.device) +if (device == lcu->ruac_data.device) { +dasd_put_device (device); lcu->ruac_data.device =NULL ; + } } private->lcu =NULL ;spin_unlock_irqrestore (&lcu->lock, flags);
@@ -586,8 +590,10 @@ static void lcu_update_work(struct work_struct *work)if (rc || (lcu->flags &NEED_UAC_UPDATE )) {DBF_DEV_EVENT (DBF_WARNING , device,"could not update" " alias data in lcu (rc = %d), retry later" , rc); -schedule_delayed_work (&lcu->ruac_data.dwork,30 *HZ ); +if (!schedule_delayed_work (&lcu->ruac_data.dwork,30 *HZ )) +dasd_put_device (device); }else { +dasd_put_device (device); lcu->ruac_data.device =NULL ; lcu->flags &= ~UPDATE_PENDING ; }
@@ -630,8 +636,10 @@ static int _schedule_lcu_update(struct alias_lcu *lcu,*/ if (!usedev)return -EINVAL ; +dasd_get_device (usedev); lcu->ruac_data.device = usedev; -schedule_delayed_work (&lcu->ruac_data.dwork,0 ); +if (!schedule_delayed_work (&lcu->ruac_data.dwork,0 )) +dasd_put_device (usedev);return 0 ; }
@@ -749,7 +757,7 @@ static int reset_summary_unit_check(struct alias_lcu *lcu,ASCEBC ((char *) &cqr->magic,4 ); ccw = cqr->cpaddr; ccw->cmd_code =DASD_ECKD_CCW_RSCK ; - ccw->flags =0 ; + ccw->flags =CCW_FLAG_SLI ; ccw->count =16 ; ccw->cda = (__u32 )(addr_t ) cqr->data; ((char *)cqr->data)[0 ] = reason;
@@ -953,6 +961,7 @@ static void summary_unit_check_handling_work(struct work_struct *work)/* 3. read new alias configuration */ _schedule_lcu_update (lcu, device); lcu->suc_data.device =NULL ; +dasd_put_device (device);spin_unlock_irqrestore (&lcu->lock, flags); }
@@ -1012,6 +1021,8 @@ void dasd_alias_handle_summary_unit_check(struct dasd_device *device, } lcu->suc_data.reason = reason; lcu->suc_data.device = device; +dasd_get_device (device);spin_unlock (&lcu->lock); -schedule_work (&lcu->suc_data.worker); +if (!schedule_work (&lcu->suc_data.worker)) +dasd_put_device (device); };
drivers/scsi/ipr.c +7 -3
@@ -3736,13 +3736,17 @@ static ssize_t ipr_store_update_fw(struct device *dev,struct ipr_sglist *sglist;char fname[100 ];char *src; -int len, result, dnld_size; +char *endline; +int result, dnld_size;if (!capable (CAP_SYS_ADMIN ))return -EACCES ; - len =snprintf (fname,99 ,"%s" , buf); - fname[len-1 ] ='\0' ; +snprintf (fname,sizeof (fname),"%s" , buf); + + endline =strchr (fname,'\n' ); +if (endline) + *endline ='\0' ;if (request_firmware (&fw_entry, fname, &ioa_cfg->pdev->dev)) {dev_err (&ioa_cfg->pdev->dev,"Firmware file %s not found\n" , fname);
drivers/usb/dwc3/core.h +0 -1
@@ -610,7 +610,6 @@ struct dwc3 { unsigned ep0_status_pending:1; unsigned ep0_bounced:1; unsigned ep0_expect_in:1; - unsigned start_config_issued:1;enum dwc3_ep0_next ep0_next_event;enum dwc3_ep0_state ep0state;
drivers/usb/dwc3/ep0.c +0 -5
@@ -449,7 +449,6 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)u32 cfg;int ret; - dwc->start_config_issued = false; cfg =le16_to_cpu (ctrl->wValue);switch (dwc->dev_state) {
@@ -498,10 +497,6 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)dev_vdbg (dwc->dev,"USB_REQ_SET_CONFIGURATION\n" ); ret =dwc3_ep0_set_config (dwc, ctrl);break ; -case USB_REQ_SET_INTERFACE : -dev_vdbg (dwc->dev ,"USB_REQ_SET_INTERFACE" ); - dwc->start_config_issued = false; -/* Fall through */ default :dev_vdbg (dwc->dev,"Forwarding to gadget driver\n" ); ret =dwc3_ep0_delegate_req (dwc, ctrl);
drivers/usb/dwc3/gadget.c +52 -18
108 lines not on this page · raw message
drivers/usb/serial/cp210x.c +3 -0
@@ -168,6 +168,9 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ { USB_DEVICE(0x18EF, 0xE025) }, /* ELV Marble Sound Board 1 */ + { USB_DEVICE(0x1901, 0x0190) }, /* GE B850 CP2105 Recorder interface */ + { USB_DEVICE(0x1901, 0x0193) }, /* GE B650 CP2104 PMC interface */ + { USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */ { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */
drivers/usb/serial/option.c +11 -0
@@ -316,6 +316,7 @@ static void option_instat_callback(struct urb *urb);#define TOSHIBA_PRODUCT_G450 0x0d45#define ALINK_VENDOR_ID 0x1e0e +#define SIMCOM_PRODUCT_SIM7100E 0x9001/* Yes, ALINK_VENDOR_ID */ #define ALINK_PRODUCT_PH300 0x9100#define ALINK_PRODUCT_3GU 0x9200
@@ -613,6 +614,10 @@ static const struct option_blacklist_info zte_1255_blacklist = { .reserved = BIT(3) | BIT(4), }; +static const struct option_blacklist_info simcom_sim7100e_blacklist = { + .reserved =BIT (5 ) |BIT (6 ), +}; +static const struct option_blacklist_info telit_le910_blacklist = { .sendsetup =BIT (0 ), .reserved =BIT (1 ) |BIT (2 ),
@@ -1128,9 +1133,13 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ + { USB_DEVICE_AND_INTERFACE_INFO(QUALCOMM_VENDOR_ID, 0x6001, 0xff, 0xff, 0xff), /* 4G LTE usb-modem U901 */ + .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9003), /* Quectel UC20 */ + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),
@@ -1644,6 +1653,8 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, { USB_DEVICE(ALINK_VENDOR_ID, ALINK_PRODUCT_PH300) }, { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, + { USB_DEVICE(ALINK_VENDOR_ID, SIMCOM_PRODUCT_SIM7100E), + .driver_info = (kernel_ulong_t)&simcom_sim7100e_blacklist }, { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist },
drivers/xen/xen-pciback/pciback_ops.c +7 -2
@@ -225,8 +225,9 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev,/* * PCI_COMMAND_MEMORY must be enabled, otherwise we may not be able * to access the BARs where the MSI-X entries reside. +* But VF devices are unique in which the PF needs to be checked. */ -pci_read_config_word (dev,PCI_COMMAND , &cmd); +pci_read_config_word (pci_physfn (dev),PCI_COMMAND , &cmd);if (dev->msi_enabled || !(cmd &PCI_COMMAND_MEMORY ))return -ENXIO ;
@@ -330,6 +331,9 @@ void xen_pcibk_do_op(struct work_struct *data)struct xen_pcibk_dev_data *dev_data =NULL ;struct xen_pci_op *op = &pdev->op;int test_intx =0 ; +#ifdef CONFIG_PCI_MSI +unsigned int nr =0 ; +#endif *op = pdev->sh_info->op;barrier ();
@@ -358,6 +362,7 @@ void xen_pcibk_do_op(struct work_struct *data) op->err =xen_pcibk_disable_msi (pdev, dev, op);break ;case XEN_PCI_OP_enable_msix: + nr = op->value; op->err =xen_pcibk_enable_msix (pdev, dev, op);break ;case XEN_PCI_OP_disable_msix:
@@ -380,7 +385,7 @@ void xen_pcibk_do_op(struct work_struct *data)if (op->cmd == XEN_PCI_OP_enable_msix && op->err ==0 ) {unsigned int i; -for (i =0 ; i < op->value; i++) +for (i =0 ; i < nr; i++) pdev->sh_info->op.msix_entries[i].vector = op->msix_entries[i].vector; }
fs/cifs/cifsencrypt.c +1 -1
@@ -616,7 +616,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) ses->auth_key.response =kmalloc (baselen + tilen,GFP_KERNEL );if (!ses->auth_key.response) { - rc =ENOMEM ; + rc = -ENOMEM ; ses->auth_key.len =0 ;cERROR (1 ,"%s: Can't allocate auth blob" , __func__); goto setup_ntlmv2_rsp_ret;
fs/ext4/inode.c +30 -2
@@ -595,6 +595,34 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,return retval; } +/* +* Update EXT4_MAP_FLAGS in bh->b_state. For buffer heads attached to pages +* we have to be careful as someone else may be manipulating b_state as well. +*/ +static void ext4_update_bh_state (struct buffer_head *bh,unsigned long flags) +{ +unsigned long old_state; +unsigned long new_state; + + flags &=EXT4_MAP_FLAGS ; + +/* Dummy buffer_head? Set non-atomically. */ +if (!bh->b_page) { + bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS ) | flags; +return ; + } +/* +* Someone else may be modifying b_state. Be careful! This is ugly but +* once we get rid of using bh as a container for mapping information +* to pass to / from get_block functions, this can go away. +*/ +do { + old_state =ACCESS_ONCE (bh->b_state); + new_state = (old_state & ~EXT4_MAP_FLAGS ) | flags; + }while (unlikely ( +cmpxchg (&bh->b_state, old_state, new_state) != old_state)); +} +/* Maximum number of blocks we map for direct IO at once. */ #define DIO_MAX_BLOCKS 4096
@@ -625,7 +653,7 @@ static int _ext4_get_block(struct inode *inode, sector_t iblock, ret =ext4_map_blocks (handle, inode, &map, flags);if (ret >0 ) {map_bh (bh, inode->i_sb, map.m_pblk); - bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS ) | map.m_flags; +ext4_update_bh_state (bh, map.m_flags); bh->b_size = inode->i_sb->s_blocksize * map.m_len; ret =0 ; }
@@ -1787,7 +1815,7 @@ static int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,return ret;map_bh (bh, inode->i_sb, map.m_pblk); - bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS ) | map.m_flags; +ext4_update_bh_state (bh, map.m_flags);if (buffer_unwritten (bh)) {/* A delayed write to unwritten bh should be marked
fs/hpfs/namei.c +3 -28
@@ -362,12 +362,11 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry)struct inode *inode = dentry->d_inode;dnode_secno dno;int r; -int rep =0 ;int err;hpfs_lock (dir->i_sb);hpfs_adjust_length (name, &len); -again: + err = -ENOENT ; de =map_dirent (dir,hpfs_i (dir)->i_dno, name, len, &dno, &qbh);if (!de)
@@ -387,33 +386,9 @@ again:hpfs_error (dir->i_sb,"there was error when removing dirent" ); err = -EFSERROR ;break ; -case 2 :/* no space for deleting, try to truncate file */ - +case 2 :/* no space for deleting */ err = -ENOSPC ; -if (rep++) -break ; - -dentry_unhash (dentry); -if (!d_unhashed (dentry)) { -hpfs_unlock (dir->i_sb); -return -ENOSPC ; - } -if (generic_permission (inode,MAY_WRITE ) || - !S_ISREG (inode->i_mode) || -get_write_access (inode)) { -d_rehash (dentry); - }else { -struct iattr newattrs; -/*printk("HPFS: truncating file before delete.\n");*/ - newattrs.ia_size =0 ; - newattrs.ia_valid =ATTR_SIZE |ATTR_CTIME ; - err =notify_change (dentry, &newattrs); -put_write_access (inode); -if (!err) - goto again; - } -hpfs_unlock (dir->i_sb); -return -ENOSPC ; +break ;default :drop_nlink (inode); err =0 ;
fs/jffs2/README.Locking +1 -4
@@ -2,10 +2,6 @@ JFFS2 LOCKING DOCUMENTATION --------------------------- -At least theoretically, JFFS2 does not require the Big Kernel Lock -(BKL), which was always helpfully obtained for it by Linux 2.4 VFS -code. It has its own locking, as described below. - This document attempts to describe the existing locking rules for JFFS2. It is not expected to remain perfectly up to date, but ought to be fairly close.
@@ -69,6 +65,7 @@ Ordering constraints: any f->sem held. 2. Never attempt to lock two file mutexes in one thread. No ordering rules have been made for doing so. + 3. Never lock a page cache page with f->sem held. erase_completion_lock spinlock
fs/jffs2/build.c +57 -18
121 lines not on this page · raw message
fs/jffs2/file.c +18 -21
@@ -135,39 +135,33 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,struct page *pg;struct inode *inode = mapping->host;struct jffs2_inode_info *f =JFFS2_INODE_INFO (inode); -struct jffs2_sb_info *c =JFFS2_SB_INFO (inode->i_sb); -struct jffs2_raw_inode ri; -uint32_t alloc_len =0 ;pgoff_t index = pos >>PAGE_CACHE_SHIFT ;uint32_t pageofs = index <<PAGE_CACHE_SHIFT ;int ret =0 ; -D1 (printk (KERN_DEBUG "%s()\n" , __func__)); - -if (pageofs > inode->i_size) { - ret =jffs2_reserve_space (c,sizeof (ri), &alloc_len, -ALLOC_NORMAL ,JFFS2_SUMMARY_INODE_SIZE ); -if (ret) -return ret; - } - -mutex_lock (&f->sem); pg =grab_cache_page_write_begin (mapping, index, flags); -if (!pg) { -if (alloc_len) -jffs2_complete_reservation (c); -mutex_unlock (&f->sem); +if (!pg)return -ENOMEM ; - } *pagep = pg; -if (alloc_len) { +D1 (printk (KERN_DEBUG "%s()\n" , __func__)); + +if (pageofs > inode->i_size) {/* Make new hole frag from old EOF to new page */ +struct jffs2_sb_info *c =JFFS2_SB_INFO (inode->i_sb); +struct jffs2_raw_inode ri;struct jffs2_full_dnode *fn; +uint32_t alloc_len;D1 (printk (KERN_DEBUG "Writing new hole frag 0x%x-0x%x between current EOF and new page\n" , (unsigned int )inode->i_size, pageofs)); + ret =jffs2_reserve_space (c,sizeof (ri), &alloc_len, +ALLOC_NORMAL ,JFFS2_SUMMARY_INODE_SIZE ); +if (ret) + goto out_page; + +mutex_lock (&f->sem);memset (&ri,0 ,sizeof (ri)); ri.magic =cpu_to_je16 (JFFS2_MAGIC_BITMASK );
@@ -194,6 +188,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,if (IS_ERR (fn)) { ret =PTR_ERR (fn);jffs2_complete_reservation (c); +mutex_unlock (&f->sem); goto out_page; } ret =jffs2_add_full_dnode_to_inode (c, f, fn);
@@ -207,10 +202,12 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,jffs2_mark_node_obsolete (c, fn->raw);jffs2_free_full_dnode (fn);jffs2_complete_reservation (c); +mutex_unlock (&f->sem); goto out_page; }jffs2_complete_reservation (c); inode->i_size = pageofs; +mutex_unlock (&f->sem); }/*
@@ -219,18 +216,18 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,* case of a short-copy. */ if (!PageUptodate (pg)) { +mutex_lock (&f->sem); ret =jffs2_do_readpage_nolock (inode, pg); +mutex_unlock (&f->sem);if (ret) goto out_page; } -mutex_unlock (&f->sem);D1 (printk (KERN_DEBUG "end write_begin(). pg->flags %lx\n" , pg->flags));return ret; out_page:unlock_page (pg);page_cache_release (pg); -mutex_unlock (&f->sem);return ret; }
fs/jffs2/gc.c +10 -7
@@ -1246,14 +1246,17 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_eraBUG_ON (start > orig_start); } -/* First, use readpage() to read the appropriate page into the page cache */ -/* Q: What happens if we actually try to GC the _same_ page for which commit_write() -* triggered garbage collection in the first place? -* A: I _think_ it's OK. read_cache_page shouldn't deadlock, we'll write out the -* page OK. We'll actually write it out again in commit_write, which is a little -* suboptimal, but at least we're correct. -*/ +/* The rules state that we must obtain the page lock *before* f->sem, so +* drop f->sem temporarily. Since we also hold c->alloc_sem, nothing's +* actually going to *change* so we're safe; we only allow reading. +* +* It is important to note that jffs2_write_begin() will ensure that its +* page is marked Uptodate before allocating space. That means that if we +* end up here trying to GC the *same* page that jffs2_write_begin() is +* trying to write out, read_cache_page() will not deadlock. */ +mutex_unlock (&f->sem); pg_ptr =jffs2_gc_fetch_page (c, f, start, &pg); +mutex_lock (&f->sem);if (IS_ERR (pg_ptr)) {printk (KERN_WARNING "read_cache_page() returned error: %ld\n" ,PTR_ERR (pg_ptr));
fs/jffs2/nodelist.h +5 -1
@@ -194,6 +194,7 @@ struct jffs2_inode_cache {#define INO_STATE_CLEARING 6/* In clear_inode() */ #define INO_FLAGS_XATTR_CHECKED 0x01/* has no duplicate xattr_ref */ +#define INO_FLAGS_IS_DIR 0x02/* is a directory */ #define RAWNODE_CLASS_INODE_CACHE 0#define RAWNODE_CLASS_XATTR_DATUM 1
@@ -249,7 +250,10 @@ struct jffs2_readinode_infostruct jffs2_full_dirent { -struct jffs2_raw_node_ref *raw; +union { +struct jffs2_raw_node_ref *raw; +struct jffs2_inode_cache *ic;/* Just during part of build */ + };struct jffs2_full_dirent *next;uint32_t version;uint32_t ino;/* == zero for unlink */
include/linux/ata.h +2 -2
@@ -464,8 +464,8 @@ enum ata_tf_protocols { };enum ata_ioctls { -ATA_IOC_GET_IO32 =0x309 , -ATA_IOC_SET_IO32 =0x324 , +ATA_IOC_GET_IO32 =0x309 ,/* HDIO_GET_32BIT */ +ATA_IOC_SET_IO32 =0x324 ,/* HDIO_SET_32BIT */ };/* core structures */
include/linux/compiler.h +1 -1
@@ -125,7 +125,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);*/ #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )#define __trace_if (cond) \ - if (__builtin_constant_p((cond)) ? !!(cond) : \ + if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ({ \ int ______r; \ static struct ftrace_branch_data \
include/linux/libata.h +1 -1
@@ -662,7 +662,7 @@ struct ata_device {union {u16 id[ATA_ID_WORDS ];/* IDENTIFY xxx DEVICE data */ u32 gscr[SATA_PMP_GSCR_DWORDS ];/* PMP GSCR block */ - }; + }____cacheline_aligned ;/* error history */ int spdn_cnt;
include/linux/nfs_fs.h +1 -3
@@ -588,9 +588,7 @@ static inline void nfs3_forget_cached_acls(struct inode *inode)static inline loff_t nfs_size_to_loff_t (__u64 size) { -if (size > (__u64 )OFFSET_MAX -1 ) -return OFFSET_MAX -1 ; -return (loff_t ) size; +return min_t (u64, size,OFFSET_MAX ); } static inline ino_t
include/linux/poison.h +2 -2
@@ -19,8 +19,8 @@* under normal circumstances, used to verify that nobody uses * non-initialized list entries. */ -#define LIST_POISON1 ((void *) 0x00100100 + POISON_POINTER_DELTA) -#define LIST_POISON2 ((void *) 0x00200200 + POISON_POINTER_DELTA) +#define LIST_POISON1 ((void *) 0x100 + POISON_POINTER_DELTA) +#define LIST_POISON2 ((void *) 0x200 + POISON_POINTER_DELTA)/********** include/linux/timer.h **********/ /*
include/linux/skbuff.h +24 -0
@@ -1377,6 +1377,30 @@ static inline void skb_reserve(struct sk_buff *skb, int len) skb->tail += len; } +/** +* skb_tailroom_reserve - adjust reserved_tailroom +* @skb: buffer to alter +* @mtu: maximum amount of headlen permitted +* @needed_tailroom: minimum amount of reserved_tailroom +* +* Set reserved_tailroom so that headlen can be as large as possible but +* not larger than mtu and tailroom cannot be smaller than +* needed_tailroom. +* The required headroom should already have been reserved before using +* this function. +*/ +static inline void skb_tailroom_reserve (struct sk_buff *skb,unsigned int mtu, +unsigned int needed_tailroom) +{ +SKB_LINEAR_ASSERT (skb); +if (mtu <skb_tailroom (skb) - needed_tailroom) +/* use at most mtu */ + skb->reserved_tailroom =skb_tailroom (skb) - mtu; +else +/* use up to all available space */ + skb->reserved_tailroom = needed_tailroom; +} +static inline void skb_reset_mac_len (struct sk_buff *skb) { skb->mac_len = skb->network_header - skb->mac_header;
include/linux/tracepoint.h +5 -0
@@ -14,8 +14,10 @@* See the file COPYING for more details. */ +#include <linux/smp.h> #include <linux/errno.h> #include <linux/types.h> +#include <linux/cpumask.h> #include <linux/rcupdate.h> #include <linux/jump_label.h>
@@ -126,6 +128,9 @@ static inline void tracepoint_synchronize_unregister(void)void *it_func; \void *__data; \ \ +if (!cpu_online (raw_smp_processor_id ())) \ +return ; \ + \if (!(cond)) \return ; \rcu_read_lock_sched_notrace (); \
include/net/iw_handler.h +6 -0
@@ -442,6 +442,12 @@ extern void wireless_send_event(struct net_device * dev,unsigned int cmd, union iwreq_data * wrqu, const char * extra); +#ifdef CONFIG_WEXT_CORE +/* flush all previous wext events - if work is done from netdev notifiers */ +void wireless_nlevent_flush (void ); +#else +static inline void wireless_nlevent_flush (void ) {} +#endif /* We may need a function to send a stream of events to user space. * More on that later... */
kernel/resource.c +3 -2
@@ -886,9 +886,10 @@ struct resource * __request_region(struct resource *parent,if (!conflict)break ;if (conflict != parent) { - parent = conflict; -if (!(conflict->flags &IORESOURCE_BUSY )) +if (!(conflict->flags &IORESOURCE_BUSY )) { + parent = conflict;continue ; + } }if (conflict->flags & flags &IORESOURCE_MUXED ) {add_wait_queue (&muxed_resource_wait, &wait);
mm/memory.c +12 -2
@@ -3583,8 +3583,18 @@ retry:*/ if (unlikely (pmd_none (*pmd)) &&__pte_alloc (mm, vma, pmd, address))return VM_FAULT_OOM ; -/* if an huge pmd materialized from under us just retry later */ -if (unlikely (pmd_trans_huge (*pmd))) +/* +* If a huge pmd materialized under us just retry later. Use +* pmd_trans_unstable() instead of pmd_trans_huge() to ensure the pmd +* didn't become pmd_trans_huge under us and then back to pmd_none, as +* a result of MADV_DONTNEED running immediately after a huge pmd fault +* in a different thread of this mm, in turn leading to a misleading +* pmd_trans_huge() retval. All we have to ensure is that it is a +* regular pmd that we can walk with pte_offset_map() and we can do that +* through an atomic read in C, which is what pmd_trans_unstable() +* provides. +*/ +if (unlikely (pmd_trans_unstable (pmd)))return 0 ;/* * A regular pmd is established and it can't morph into a huge pmd
net/ipv4/igmp.c +1 -2
@@ -327,9 +327,8 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, unsigned int mtu)skb_dst_set (skb, &rt->dst); skb->dev = dev; - skb->reserved_tailroom =skb_end_offset (skb) - -min (mtu,skb_end_offset (skb));skb_reserve (skb, hlen); +skb_tailroom_reserve (skb, mtu, tlen);skb_reset_network_header (skb); pip =ip_hdr (skb);
net/ipv6/mcast.c +1 -2
@@ -1359,9 +1359,8 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)if (!skb)return NULL ; - skb->reserved_tailroom =skb_end_offset (skb) - -min (mtu,skb_end_offset (skb));skb_reserve (skb, hlen); +skb_tailroom_reserve (skb, mtu, tlen);if (__ipv6_get_lladdr (idev, &addr_buf,IFA_F_TENTATIVE )) {/* <draft-ietf-magma-mld-source-05.txt>:
net/mac80211/agg-rx.c +1 -1
@@ -280,7 +280,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, }/* prepare A-MPDU MLME for Rx aggregation */ - tid_agg_rx =kmalloc (sizeof (struct tid_ampdu_rx ),GFP_KERNEL ); + tid_agg_rx =kzalloc (sizeof (*tid_agg_rx),GFP_KERNEL );if (!tid_agg_rx) goto end;
net/mac80211/rc80211_minstrel_ht.c +1 -1
@@ -376,7 +376,7 @@ minstrel_aggr_check(struct minstrel_priv *mp, struct ieee80211_sta *pubsta, struif (skb_get_queue_mapping (skb) ==IEEE80211_AC_VO )return ; -ieee80211_start_tx_ba_session (pubsta, tid,5000 ); +ieee80211_start_tx_ba_session (pubsta, tid,0 ); } static void
net/sunrpc/cache.c +1 -1
@@ -1211,7 +1211,7 @@ int qword_get(char **bpp, char *dest, int bufsize)if (bp[0 ] =='\\' && bp[1 ] =='x' ) {/* HEX STRING */ bp +=2 ; -while (len < bufsize) { +while (len < bufsize -1 ) {int h, l; h =hex_to_bin (bp[0 ]);
net/unix/af_unix.c +16 -7
@@ -1694,7 +1694,12 @@ restart_locked: goto out_unlock; } -if (unlikely (unix_peer (other) != sk &&unix_recvq_full (other))) { +/* other == sk && unix_peer(other) != sk if +* - unix_peer(sk) == NULL, destination address bound to sk +* - unix_peer(sk) == sk by time of get but disconnected before lock +*/ +if (other != sk && +unlikely (unix_peer (other) != sk &&unix_recvq_full (other))) {if (timeo) { timeo =unix_wait_for_peer (other, timeo);
@@ -2059,13 +2064,15 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,int err =0 ;long timeo; - err = -EINVAL ; -if (sk->sk_state !=TCP_ESTABLISHED ) +if (unlikely (sk->sk_state !=TCP_ESTABLISHED )) { + err = -EINVAL ; goto out; + } - err = -EOPNOTSUPP ; -if (flags&MSG_OOB ) +if (unlikely (flags &MSG_OOB )) { + err = -EOPNOTSUPP ; goto out; + } target =sock_rcvlowat (sk, flags&MSG_WAITALL , size); timeo =sock_rcvtimeo (sk, noblock);
@@ -2107,9 +2114,11 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, goto unlock;unix_state_unlock (sk); - err = -EAGAIN ; -if (!timeo) +if (!timeo) { + err = -EAGAIN ;break ; + } +mutex_unlock (&u->readlock); timeo =unix_stream_data_wait (sk, timeo);
net/wireless/core.c +4 -0
@@ -985,8 +985,12 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,if (ret)return notifier_from_errno (ret);break ; +default : +return NOTIFY_DONE ; } +wireless_nlevent_flush (); +return NOTIFY_DONE ; }
net/wireless/wext-core.c +41 -11
71 lines not on this page · raw message
sound/core/seq/oss/seq_oss.c +0 -2
@@ -150,8 +150,6 @@ odev_release(struct inode *inode, struct file *file)if ((dp = file->private_data) ==NULL )return 0 ; -snd_seq_oss_drain_write (dp); -mutex_lock (®ister_mutex);snd_seq_oss_release (dp);mutex_unlock (®ister_mutex);
sound/core/seq/oss/seq_oss_device.h +0 -1
@@ -131,7 +131,6 @@ int snd_seq_oss_write(struct seq_oss_devinfo *dp, const char __user *buf, int counsigned int snd_seq_oss_poll (struct seq_oss_devinfo *dp,struct file *file,poll_table * wait);void snd_seq_oss_reset (struct seq_oss_devinfo *dp); -void snd_seq_oss_drain_write (struct seq_oss_devinfo *dp);/* */ void snd_seq_oss_process_queue (struct seq_oss_devinfo *dp,abstime_t time);
sound/core/seq/oss/seq_oss_init.c +0 -17
@@ -447,23 +447,6 @@ snd_seq_oss_release(struct seq_oss_devinfo *dp)/* -* Wait until the queue is empty (if we don't have nonblock) -*/ -void -snd_seq_oss_drain_write (struct seq_oss_devinfo *dp) -{ -if (! dp->timer->running) -return ; -if (is_write_mode (dp->file_mode) && !is_nonblock_mode (dp->file_mode) && - dp->writeq) { -debug_printk (("syncing..\n" )); -while (snd_seq_oss_writeq_sync (dp->writeq)) - ; - } -} - - -/* * reset sequencer devices */ void
sound/core/seq/seq_memory.c +9 -4
@@ -383,17 +383,22 @@ int snd_seq_pool_init(struct snd_seq_pool *pool)if (snd_BUG_ON (!pool))return -EINVAL ; -if (pool->ptr)/* should be atomic? */ -return 0 ; - pool->ptr =vmalloc (sizeof (struct snd_seq_event_cell ) * pool->size); -if (pool->ptr ==NULL ) { + cellptr =vmalloc (sizeof (struct snd_seq_event_cell ) * pool->size); +if (!cellptr) {snd_printd ("seq: malloc for sequencer events failed\n" );return -ENOMEM ; }/* add new cells to the free cell list */ spin_lock_irqsave (&pool->lock, flags); +if (pool->ptr) { +spin_unlock_irqrestore (&pool->lock, flags); +vfree (cellptr); +return 0 ; + } + + pool->ptr = cellptr; pool->free =NULL ;for (cell =0 ; cell < pool->size; cell++) {
sound/core/seq/seq_ports.c +8 -5
@@ -540,19 +540,22 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client, bool is_src, bool ack) {struct snd_seq_port_subs_info *grp; +struct list_head *list; +bool empty; grp = is_src ? &port->c_src : &port->c_dest; + list = is_src ? &subs->src_list : &subs->dest_list;down_write (&grp->list_mutex);write_lock_irq (&grp->list_lock); -if (is_src) -list_del (&subs->src_list); -else -list_del (&subs->dest_list); + empty =list_empty (list); +if (!empty) +list_del_init (list); grp->exclusive =0 ;write_unlock_irq (&grp->list_lock);up_write (&grp->list_mutex); -unsubscribe_port (client, port, grp, &subs->info, ack); +if (!empty) +unsubscribe_port (client, port, grp, &subs->info, ack); }/* connect two ports */
sound/core/timer_compat.c +3 -2
@@ -70,13 +70,14 @@ static int snd_timer_user_status_compat(struct file *file, struct snd_timer_status32 __user *_status) {struct snd_timer_user *tu; -struct snd_timer_status status; +struct snd_timer_status32 status; tu = file->private_data;if (snd_BUG_ON (!tu->timeri))return -ENXIO ;memset (&status,0 ,sizeof (status)); - status.tstamp = tu->tstamp; + status.tstamp.tv_sec = tu->tstamp.tv_sec; + status.tstamp.tv_nsec = tu->tstamp.tv_nsec; status.resolution =snd_timer_resolution (tu->timeri); status.lost = tu->timeri->lost; status.overrun = tu->overrun;
sound/pci/rme9652/hdsp.c +2 -2
@@ -3163,7 +3163,7 @@ static int snd_hdsp_get_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ctl {struct hdsp *hdsp =snd_kcontrol_chip (kcontrol); - ucontrol->value.enumerated.item[0 ] =hdsp_dds_offset (hdsp); + ucontrol->value.integer.value[0 ] =hdsp_dds_offset (hdsp);return 0 ; }
@@ -3175,7 +3175,7 @@ static int snd_hdsp_put_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ctlif (!snd_hdsp_use_is_exclusive (hdsp))return -EBUSY ; - val = ucontrol->value.enumerated.item[0 ]; + val = ucontrol->value.integer.value[0 ];spin_lock_irq (&hdsp->lock);if (val !=hdsp_dds_offset (hdsp)) change = (hdsp_set_dds_offset (hdsp, val) ==0 ) ?1 :0 ;
sound/pci/rme9652/hdspm.c +3 -3
@@ -4386,7 +4386,7 @@ static int snd_hdspm_get_tco_word_term(struct snd_kcontrol *kcontrol, {struct hdspm *hdspm =snd_kcontrol_chip (kcontrol); - ucontrol->value.enumerated.item[0 ] = hdspm->tco->term; + ucontrol->value.integer.value[0 ] = hdspm->tco->term;return 0 ; }
@@ -4397,8 +4397,8 @@ static int snd_hdspm_put_tco_word_term(struct snd_kcontrol *kcontrol, {struct hdspm *hdspm =snd_kcontrol_chip (kcontrol); -if (hdspm->tco->term != ucontrol->value.enumerated.item[0 ]) { - hdspm->tco->term = ucontrol->value.enumerated.item[0 ]; +if (hdspm->tco->term != ucontrol->value.integer.value[0 ]) { + hdspm->tco->term = ucontrol->value.integer.value[0 ];hdspm_tco_write (hdspm);
sound/soc/codecs/wm8958-dsp2.c +4 -4
@@ -458,7 +458,7 @@ static int wm8958_put_mbc_enum(struct snd_kcontrol *kcontrol,struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol);struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct wm8994_pdata *pdata = wm8994->pdata; -int value = ucontrol->value.integer.value[0 ]; +int value = ucontrol->value.enumerated.item[0 ];int reg;/* Don't allow on the fly reconfiguration */
@@ -548,7 +548,7 @@ static int wm8958_put_vss_enum(struct snd_kcontrol *kcontrol,struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol);struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct wm8994_pdata *pdata = wm8994->pdata; -int value = ucontrol->value.integer.value[0 ]; +int value = ucontrol->value.enumerated.item[0 ];int reg;/* Don't allow on the fly reconfiguration */
@@ -581,7 +581,7 @@ static int wm8958_put_vss_hpf_enum(struct snd_kcontrol *kcontrol,struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol);struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct wm8994_pdata *pdata = wm8994->pdata; -int value = ucontrol->value.integer.value[0 ]; +int value = ucontrol->value.enumerated.item[0 ];int reg;/* Don't allow on the fly reconfiguration */
@@ -748,7 +748,7 @@ static int wm8958_put_enh_eq_enum(struct snd_kcontrol *kcontrol,struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol);struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct wm8994_pdata *pdata = wm8994->pdata; -int value = ucontrol->value.integer.value[0 ]; +int value = ucontrol->value.enumerated.item[0 ];int reg;/* Don't allow on the fly reconfiguration */
sound/soc/codecs/wm8994.c +2 -2
@@ -386,7 +386,7 @@ static int wm8994_put_drc_enum(struct snd_kcontrol *kcontrol,struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct wm8994_pdata *pdata = wm8994->pdata;int drc =wm8994_get_drc (kcontrol->id.name); -int value = ucontrol->value.integer.value[0 ]; +int value = ucontrol->value.enumerated.item[0 ];if (drc <0 )return drc;
@@ -489,7 +489,7 @@ static int wm8994_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct wm8994_pdata *pdata = wm8994->pdata;int block =wm8994_get_retune_mobile_block (kcontrol->id.name); -int value = ucontrol->value.integer.value[0 ]; +int value = ucontrol->value.enumerated.item[0 ];if (block <0 )return block;
virt/kvm/async_pf.c +1 -1
@@ -159,7 +159,7 @@ int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn,* do alloc nowait since if we are going to sleep anyway we * may as well sleep faulting in page */ - work =kmem_cache_zalloc (async_pf_cache,GFP_NOWAIT ); + work =kmem_cache_zalloc (async_pf_cache,GFP_NOWAIT | __GFP_NOWARN);if (!work)return 0 ;
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.2.79 release. There are 62 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Mar 31 22:00:00 UTC 2016. Anything received after that time might be too late.
Build results:
total: 94 pass: 94 fail: 0 Qemu test results: total: 61 pass: 61 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Quoted 10 lines · Guenter Roeck
Quoted 9 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.2.79 release. There are 62 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Mar 31 22:00:00 UTC 2016. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 94 pass: 94 fail: 0 Qemu test results: total: 61 pass: 61 fail: 0Details are available at http://kerneltests.org/builders.
Thanks for checking.
Ben.
--
Ben Hutchings
Tomorrow will be cancelled due to lack of interest.