3.14.56-stable review
Greg Kroah-Hartman
maintainerPATCH 4/25 net/unix: fix logic about sk_peek_offset
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Vagin <[email protected]>
[ Upstream commit e9193d60d363e4dff75ff6d43a48f22be26d59c7 ]
Now send with MSG_PEEK can return data from multiple SKBs.
Unfortunately we take into account the peek offset for each skb, that is wrong. We need to apply the peek offset only once.
In addition, the peek offset should be used only if MSG_PEEK is set.
--- net/unix/af_unix.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/unix/af_unix.c +7 -5
@@ -1956,6 +1956,11 @@ static int unix_stream_recvmsg(struct ki goto out; } +if (flags &MSG_PEEK ) + skip =sk_peek_offset (sk, flags); +else + skip =0 ; + do { int chunk; struct sk_buff *skb, *last;
@@ -2002,7 +2007,6 @@ again:break ; } - skip =sk_peek_offset (sk, flags);while (skip >=unix_skb_len (skb)) { skip -=unix_skb_len (skb); last = skb;
@@ -2064,14 +2068,12 @@ again:if (UNIXCB (skb).fp) siocb->scm->fp =scm_fp_dup (UNIXCB (skb).fp); -if (skip) { -sk_peek_offset_fwd (sk, chunk); - skip -= chunk; - } +sk_peek_offset_fwd (sk, chunk);if (UNIXCB (skb).fp)break ; + skip =0 ; last = skb;unix_state_lock (sk); skb =skb_peek_next (skb, &sk->sk_receive_queue);
Greg Kroah-Hartman
maintainerPATCH 10/25 asix: Dont reset PHY on if_up for ASIX 88772
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Stam <[email protected]>
[ Upstream commit 3cc81d85ee01e5a0b7ea2f4190e2ed1165f53c31 ]
I've noticed every time the interface is set to 'up,', the kernel reports that the link speed is set to 100 Mbps/Full Duplex, even when ethtool is used to set autonegotiation to 'off', half duplex, 10 Mbps.
It can be tested by:
ifconfig eth0 down
ethtool -s eth0 autoneg off speed 10 duplex half ifconfig eth0 up
Then checking 'dmesg' for the link speed.
--- drivers/net/usb/asix_devices.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/asix_devices.c +1 -1
@@ -890,7 +890,7 @@ static const struct driver_info ax88772_ .unbind = ax88772_unbind, .status = asix_status, .link_reset = ax88772_link_reset, - .reset = ax88772_reset, + .reset = ax88772_link_reset, .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR | FLAG_MULTI_PACKET, .rx_fixup = asix_rx_fixup_common, .tx_fixup = asix_tx_fixup,
Greg Kroah-Hartman
maintainerPATCH 11/25 asix: Do full reset during ax88772_bind
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
[ Upstream commit 436c2a5036b6ffe813310df2cf327d3b69be0734 ]
commit 3cc81d85ee01 ("asix: Don't reset PHY on if_up for ASIX 88772") causes the ethernet on Arndale to no longer function. This appears to be because the Arndale ethernet requires a full reset before it will function correctly, however simply reverting the above patch causes problems with ethtool settings getting reset.
It seems the problem is that the ethernet is not properly reset during bind, and indeed the code in ax88772_bind that resets the device is a very small subset of the actual ax88772_reset function. This patch uses ax88772_reset in place of the existing reset code in ax88772_bind which removes some code duplication and fixes the ethernet on Arndale.
It is still possible that the original patch causes some issues with suspend and resume but that seems like a separate issue and I haven't had a chance to test that yet.
--- drivers/net/usb/asix_devices.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/net/usb/asix_devices.c +1 -13
@@ -465,19 +465,7 @@ static int ax88772_bind(struct usbnet *dreturn ret; } - ret =asix_sw_reset (dev,AX_SWRESET_IPPD |AX_SWRESET_PRL ); -if (ret <0 ) -return ret; - -msleep (150 ); - - ret =asix_sw_reset (dev,AX_SWRESET_CLEAR ); -if (ret <0 ) -return ret; - -msleep (150 ); - - ret =asix_sw_reset (dev, embd_phy ?AX_SWRESET_IPRL :AX_SWRESET_PRTE ); +ax88772_reset (dev);/* Read PHYID register *AFTER* the PHY was reset properly */ phyid =asix_get_phyid (dev);
Greg Kroah-Hartman
maintainerPATCH 12/25 crypto: sparc - initialize blkcipher.ivsize
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Kleikamp <[email protected]>
commit a66d7f724a96d6fd279bfbd2ee488def6b081bea upstream.
Some of the crypto algorithms write to the initialization vector, but no space has been allocated for it. This clobbers adjacent memory.
--- arch/sparc/crypto/aes_glue.c | 2 ++ arch/sparc/crypto/camellia_glue.c | 1 + arch/sparc/crypto/des_glue.c | 2 ++ 3 files changed, 5 insertions(+)
arch/sparc/crypto/aes_glue.c +2 -0
@@ -433,6 +433,7 @@ static struct crypto_alg algs[] = { { .blkcipher = { .min_keysize = AES_MIN_KEY_SIZE, .max_keysize = AES_MAX_KEY_SIZE, + .ivsize = AES_BLOCK_SIZE, .setkey = aes_set_key, .encrypt = cbc_encrypt, .decrypt = cbc_decrypt,
@@ -452,6 +453,7 @@ static struct crypto_alg algs[] = { { .blkcipher = { .min_keysize = AES_MIN_KEY_SIZE, .max_keysize = AES_MAX_KEY_SIZE, + .ivsize = AES_BLOCK_SIZE, .setkey = aes_set_key, .encrypt = ctr_crypt, .decrypt = ctr_crypt,
arch/sparc/crypto/camellia_glue.c +1 -0
@@ -274,6 +274,7 @@ static struct crypto_alg algs[] = { { .blkcipher = { .min_keysize = CAMELLIA_MIN_KEY_SIZE, .max_keysize = CAMELLIA_MAX_KEY_SIZE, + .ivsize = CAMELLIA_BLOCK_SIZE, .setkey = camellia_set_key, .encrypt = cbc_encrypt, .decrypt = cbc_decrypt,
arch/sparc/crypto/des_glue.c +2 -0
@@ -429,6 +429,7 @@ static struct crypto_alg algs[] = { { .blkcipher = { .min_keysize = DES_KEY_SIZE, .max_keysize = DES_KEY_SIZE, + .ivsize = DES_BLOCK_SIZE, .setkey = des_set_key, .encrypt = cbc_encrypt, .decrypt = cbc_decrypt,
@@ -485,6 +486,7 @@ static struct crypto_alg algs[] = { { .blkcipher = { .min_keysize = DES3_EDE_KEY_SIZE, .max_keysize = DES3_EDE_KEY_SIZE, + .ivsize = DES3_EDE_BLOCK_SIZE, .setkey = des3_ede_set_key, .encrypt = cbc3_encrypt, .decrypt = cbc3_decrypt,
Greg Kroah-Hartman
maintainerPATCH 13/25 crypto: ahash - ensure statesize is non-zero
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit 8996eafdcbad149ac0f772fb1649fbb75c482a6a upstream.
Unlike shash algorithms, ahash drivers must implement export and import as their descriptors may contain hardware state and cannot be exported as is. Unfortunately some ahash drivers did not provide them and end up causing crashes with algif_hash.
This patch adds a check to prevent these drivers from registering ahash algorithms until they are fixed.
--- crypto/ahash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
crypto/ahash.c +2 -1
@@ -465,7 +465,8 @@ static int ahash_prepare_alg(struct ahasstruct crypto_alg *base = &alg->halg.base;if (alg->halg.digestsize >PAGE_SIZE /8 || - alg->halg.statesize >PAGE_SIZE /8 ) + alg->halg.statesize >PAGE_SIZE /8 || + alg->halg.statesize ==0 )return -EINVAL ; base->cra_type = &crypto_ahash_type;
Greg Kroah-Hartman
maintainerPATCH 14/25 btrfs: fix use after free iterating extrefs
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
commit dc6c5fb3b514221f2e9d21ee626a9d95d3418dff upstream.
The code for btrfs inode-resolve has never worked properly for files with enough hard links to trigger extrefs. It was trying to get the leaf out of a path after freeing the path:
btrfs_release_path(path); leaf = path->nodes[0]; item_size = btrfs_item_size_nr(leaf, slot);
The fix here is to use the extent buffer we cloned just a little higher up to avoid deadlocks caused by using the leaf in the path.
--- fs/btrfs/backref.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
fs/btrfs/backref.c +3 -5
@@ -1692,7 +1692,6 @@ static int iterate_inode_extrefs(u64 inuint found =0 ;struct extent_buffer *eb;struct btrfs_inode_extref *extref; -struct extent_buffer *leaf;u32 item_size;u32 cur_offset;unsigned long ptr;
@@ -1720,9 +1719,8 @@ static int iterate_inode_extrefs(u64 inubtrfs_set_lock_blocking_rw (eb,BTRFS_READ_LOCK );btrfs_release_path (path); - leaf = path->nodes[0 ]; - item_size =btrfs_item_size_nr (leaf, slot); - ptr =btrfs_item_ptr_offset (leaf, slot); + item_size =btrfs_item_size_nr (eb, slot); + ptr =btrfs_item_ptr_offset (eb, slot); cur_offset =0 ;while (cur_offset < item_size) {
@@ -1736,7 +1734,7 @@ static int iterate_inode_extrefs(u64 inuif (ret)break ; - cur_offset +=btrfs_inode_extref_name_len (leaf, extref); + cur_offset +=btrfs_inode_extref_name_len (eb, extref); cur_offset +=sizeof (*extref); }btrfs_tree_read_unlock_blocking (eb);
Greg Kroah-Hartman
maintainerPATCH 19/25 workqueue: make sure delayed work run in local cpu
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shaohua Li <[email protected]>
commit 874bbfe600a660cba9c776b3957b1ce393151b76 upstream.
My system keeps crashing with below message. vmstat_update() schedules a delayed work in current cpu and expects the work runs in the cpu. schedule_delayed_work() is expected to make delayed work run in local cpu. The problem is timer can be migrated with NO_HZ. __queue_work() queues work in timer handler, which could run in a different cpu other than where the delayed work is scheduled. The end result is the delayed work runs in different cpu. The patch makes __queue_delayed_work records local cpu earlier. Where the timer runs doesn't change where the work runs with the change.
[ 28.010131] ------------[ cut here ]------------ [ 28.010609] kernel BUG at ../mm/vmstat.c:1392! [ 28.011099] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC KASAN [ 28.011860] Modules linked in: [ 28.012245] CPU: 0 PID: 289 Comm: kworker/0:3 Tainted: G W4.3.0-rc3+ #634 [ 28.013065] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140709_153802- 04/01/2014 [ 28.014160] Workqueue: events vmstat_update [ 28.014571] task: ffff880117682580 ti: ffff8800ba428000 task.ti: ffff8800ba428000 [ 28.015445] RIP: 0010:[<ffffffff8115f921>] [<ffffffff8115f921>]vmstat_update+0x31/0x80 [ 28.016282] RSP: 0018:ffff8800ba42fd80 EFLAGS: 00010297 [ 28.016812] RAX: 0000000000000000 RBX: ffff88011a858dc0 RCX:0000000000000000 [ 28.017585] RDX: ffff880117682580 RSI: ffffffff81f14d8c RDI:ffffffff81f4df8d [ 28.018366] RBP: ffff8800ba42fd90 R08: 0000000000000001 R09:0000000000000000 [ 28.019169] R10: 0000000000000000 R11: 0000000000000121 R12:ffff8800baa9f640 [ 28.019947] R13: ffff88011a81e340 R14: ffff88011a823700 R15:0000000000000000 [ 28.020071] FS: 0000000000000000(0000) GS:ffff88011a800000(0000)knlGS:0000000000000000 [ 28.020071] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 28.020071] CR2: 00007ff6144b01d0 CR3: 00000000b8e93000 CR4:00000000000006f0 [ 28.020071] Stack: [ 28.020071] ffff88011a858dc0 ffff8800baa9f640 ffff8800ba42fe00ffffffff8106bd88 [ 28.020071] ffffffff8106bd0b 0000000000000096 0000000000000000ffffffff82f9b1e8 [ 28.020071] ffffffff829f0b10 0000000000000000 ffffffff81f18460ffff88011a81e340 [ 28.020071] Call Trace: [ 28.020071] [<ffffffff8106bd88>] process_one_work+0x1c8/0x540 [ 28.020071] [<ffffffff8106bd0b>] ? process_one_work+0x14b/0x540 [ 28.020071] [<ffffffff8106c214>] worker_thread+0x114/0x460 [ 28.020071] [<ffffffff8106c100>] ? process_one_work+0x540/0x540 [ 28.020071] [<ffffffff81071bf8>] kthread+0xf8/0x110 [ 28.020071] [<ffffffff81071b00>] ?kthread_create_on_node+0x200/0x200 [ 28.020071] [<ffffffff81a6522f>] ret_from_fork+0x3f/0x70 [ 28.020071] [<ffffffff81071b00>] ?kthread_create_on_node+0x200/0x200
--- kernel/workqueue.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/workqueue.c +4 -4
@@ -1475,13 +1475,13 @@ static void __queue_delayed_work(int cputimer_stats_timer_set_start_info (&dwork->timer); dwork->wq = wq; +/* timer isn't guaranteed to run in this cpu, record earlier */ +if (cpu ==WORK_CPU_UNBOUND ) + cpu =raw_smp_processor_id (); dwork->cpu = cpu; timer->expires = jiffies + delay; -if (unlikely (cpu !=WORK_CPU_UNBOUND )) -add_timer_on (timer, cpu); -else -add_timer (timer); +add_timer_on (timer, cpu); }/**
Greg Kroah-Hartman
maintainerPATCH 20/25 drm/nouveau/fbcon: take runpm reference when userspace has an open fd
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Skeggs <[email protected]>
commit f231976c2e8964ceaa9250e57d27c35ff03825c2 upstream.
We need to do this in order to prevent accesses to the device while it's powered down. Userspace may have an mmap of the fb, and there's no good way (that I know of) to prevent it from touching the device otherwise.
This fixes some nasty races between runpm and plymouth on some systems, which result in the GPU getting very upset and hanging the boot.
--- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/gpu/drm/nouveau/nouveau_fbcon.c +24 -0
@@ -183,8 +183,30 @@ nouveau_fbcon_sync(struct fb_info *info)return 0 ; } +static int +nouveau_fbcon_open (struct fb_info *info,int user) +{ +struct nouveau_fbdev *fbcon = info->par; +struct nouveau_drm *drm =nouveau_drm (fbcon->dev); +int ret =pm_runtime_get_sync (drm->dev->dev); +if (ret <0 && ret != -EACCES ) +return ret; +return 0 ; +} + +static int +nouveau_fbcon_release (struct fb_info *info,int user) +{ +struct nouveau_fbdev *fbcon = info->par; +struct nouveau_drm *drm =nouveau_drm (fbcon->dev); +pm_runtime_put (drm->dev->dev); +return 0 ; +} +static struct fb_ops nouveau_fbcon_ops = { .owner =THIS_MODULE , + .fb_open = nouveau_fbcon_open, + .fb_release = nouveau_fbcon_release, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_fillrect = nouveau_fbcon_fillrect,
@@ -200,6 +222,8 @@ static struct fb_ops nouveau_fbcon_ops =static struct fb_ops nouveau_fbcon_sw_ops = { .owner =THIS_MODULE , + .fb_open = nouveau_fbcon_open, + .fb_release = nouveau_fbcon_release, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_fillrect = cfb_fillrect,
Greg Kroah-Hartman
maintainerPATCH 21/25 drm/radeon: add pm sysfs files late
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 51a4726b04e880fdd9b4e0e58b13f70b0a68a7f5 upstream.
They were added relatively early in the driver init process which meant that in some cases the driver was not finished initializing before external tools tried to use them which could result in a crash depending on the timing.
--- drivers/gpu/drm/radeon/radeon_display.c | 14 +------ drivers/gpu/drm/radeon/radeon_pm.c | 63 +++++++++++++++++++------------- 2 files changed, 40 insertions(+), 37 deletions(-)
drivers/gpu/drm/radeon/radeon_display.c +2 -12
@@ -1479,18 +1479,8 @@ int radeon_modeset_init(struct radeon_deradeon_fbdev_init (rdev);drm_kms_helper_poll_init (rdev->ddev); -if (rdev->pm.dpm_enabled) { -/* do dpm late init */ - ret =radeon_pm_late_init (rdev); -if (ret) { - rdev->pm.dpm_enabled = false; -DRM_ERROR ("radeon_pm_late_init failed, disabling dpm\n" ); - } -/* set the dpm state for PX since there won't be -* a modeset to call this. -*/ -radeon_pm_compute_clocks (rdev); - } +/* do pm late init */ + ret =radeon_pm_late_init (rdev);return 0 ; }
drivers/gpu/drm/radeon/radeon_pm.c +38 -25
81 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 1/25 l2tp: protect tunnel->del_work by ref_count
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Couzens <[email protected]>
[ Upstream commit 06a15f51cf3618e32a73871ee6a547ef7fd902b5 ]
There is a small chance that tunnel_free() is called before tunnel->del_work scheduled resulting in a zero pointer dereference.
--- net/l2tp/l2tp_core.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
net/l2tp/l2tp_core.c +9 -2
@@ -1435,7 +1435,7 @@ static void l2tp_tunnel_del_work(struct tunnel = container_of(work, struct l2tp_tunnel, del_work); sk =l2tp_tunnel_sock_lookup (tunnel);if (!sk) -return ; + goto out; sock = sk->sk_socket;
@@ -1456,6 +1456,8 @@ static void l2tp_tunnel_del_work(struct }l2tp_tunnel_sock_put (sk); +out: +l2tp_tunnel_dec_refcount (tunnel); }/* Create a socket for the tunnel, if one isn't set up by
@@ -1785,8 +1787,13 @@ EXPORT_SYMBOL_GPL(l2tp_tunnel_create);*/ int l2tp_tunnel_delete (struct l2tp_tunnel *tunnel) { +l2tp_tunnel_inc_refcount (tunnel);l2tp_tunnel_closeall (tunnel); -return (false ==queue_work (l2tp_wq, &tunnel->del_work)); +if (false ==queue_work (l2tp_wq, &tunnel->del_work)) { +l2tp_tunnel_dec_refcount (tunnel); +return 1 ; + } +return 0 ; }EXPORT_SYMBOL_GPL (l2tp_tunnel_delete);
Greg Kroah-Hartman
maintainerPATCH 2/25 af_unix: Convert the unix_sk macro to an inline function for type safety
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Conole <[email protected]>
[ Upstream commit 4613012db1d911f80897f9446a49de817b2c4c47 ]
As suggested by Eric Dumazet this change replaces the #define with a static inline function to enjoy complaints by the compiler when misusing the API.
--- include/net/af_unix.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
include/net/af_unix.h +5 -1
@@ -64,7 +64,11 @@ struct unix_sock {#define UNIX_GC_MAYBE_CYCLE 1struct socket_wq peer_wq; }; -#define unix_sk (__sk) ((struct unix_sock *)__sk) + +static inline struct unix_sock *unix_sk (struct sock *sk) +{ +return (struct unix_sock *)sk; +}#define peer_wait peer_wq.wait
Greg Kroah-Hartman
maintainerPATCH 3/25 af_unix: return data from multiple SKBs on recv() with MSG_PEEK flag
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Conole <[email protected]>
[ Upstream commit 9f389e35674f5b086edd70ed524ca0f287259725 ]
AF_UNIX sockets now return multiple skbs from recv() when MSG_PEEK flag is set.
This is referenced in kernel bugzilla #12323 @
https://bugzilla.kernel.org/show_bug.cgi?id=12323
As described both in the BZ and lkml thread @
http://lkml.org/lkml/2008/1/8/444 calling recv() with MSG_PEEK on an AF_UNIX socket only reads a single skb, where the desired effect is to return as much skb data has been queued, until hitting the recv buffer size (whichever comes first).
The modified MSG_PEEK path will now move to the next skb in the tree and jump to the again: label, rather than following the natural loop structure. This requires duplicating some of the loop head actions.
This was tested using the python socketpair python code attached to the bugzilla issue.
--- net/unix/af_unix.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
net/unix/af_unix.c +13 -1
@@ -2064,8 +2064,20 @@ again:if (UNIXCB (skb).fp) siocb->scm->fp =scm_fp_dup (UNIXCB (skb).fp); -sk_peek_offset_fwd (sk, chunk); +if (skip) { +sk_peek_offset_fwd (sk, chunk); + skip -= chunk; + } +if (UNIXCB (skb).fp) +break ; + + last = skb; +unix_state_lock (sk); + skb =skb_peek_next (skb, &sk->sk_receive_queue); +if (skb) + goto again; +unix_state_unlock (sk);break ; } }while (size);
Greg Kroah-Hartman
maintainercover 3.14.56-stable review
This is the start of the stable review cycle for the 3.14.56 release. There are 25 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Oct 25 17:45:45 UTC 2015. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.14.56-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.14.56-rc1
Konstantin Khlebnikov <[email protected]>
sched/preempt: Fix cond_resched_lock() and cond_resched_softirq()
Frederic Weisbecker <[email protected]>
sched/preempt: Rename PREEMPT_CHECK_OFFSET to PREEMPT_DISABLE_OFFSET
Ilya Dryomov <[email protected]>
rbd: fix double free on rbd_dev->header_name
Mike Snitzer <[email protected]>
dm thin: fix missing pool reference count decrement in pool_ctr error path
Alex Deucher <[email protected]>
drm/radeon: add pm sysfs files late
Ben Skeggs <[email protected]>
drm/nouveau/fbcon: take runpm reference when userspace has an open fd
Shaohua Li <[email protected]>
workqueue: make sure delayed work run in local cpu
Mika Westerberg <[email protected]>
i2c: designware: Do not use parameters from ACPI on Dell Inspiron 7348
Wolfram Sang <[email protected]>
i2c: s3c2410: enable RuntimePM before registering to the core
Wolfram Sang <[email protected]>
i2c: rcar: enable RuntimePM before registering to the core
Will Deacon <[email protected]>
arm64: errata: use KBUILD_CFLAGS_MODULE for erratum #843419
Chris Mason <[email protected]>
btrfs: fix use after free iterating extrefs
Russell King <[email protected]>
crypto: ahash - ensure statesize is non-zero
Dave Kleikamp <[email protected]>
crypto: sparc - initialize blkcipher.ivsize
Charles Keepax <[email protected]>
asix: Do full reset during ax88772_bind
Michel Stam <[email protected]>
asix: Don't reset PHY on if_up for ASIX 88772
Joe Perches <[email protected]>
ethtool: Use kcalloc instead of kmalloc for ethtool_get_strings
Guillaume Nault <[email protected]>
ppp: don't override sk->sk_state in pppoe_flush_dev()
Eric Dumazet <[email protected]>
net: add pfmemalloc check in sk_add_backlog()
Pravin B Shelar <[email protected]>
skbuff: Fix skb checksum partial check.
Pravin B Shelar <[email protected]>
skbuff: Fix skb checksum flag on skb pull
Andrey Vagin <[email protected]>
net/unix: fix logic about sk_peek_offset
Aaron Conole <[email protected]>
af_unix: return data from multiple SKBs on recv() with MSG_PEEK flag
Aaron Conole <[email protected]>
af_unix: Convert the unix_sk macro to an inline function for type safety
Alexander Couzens <[email protected]>
l2tp: protect tunnel->del_work by ref_count
-------------
Diffstat:
Makefile | 4 +- arch/arm64/Makefile | 2 +- arch/sparc/crypto/aes_glue.c | 2 + arch/sparc/crypto/camellia_glue.c | 1 + arch/sparc/crypto/des_glue.c | 2 + arch/x86/include/asm/preempt.h | 4 +- crypto/ahash.c | 3 +- drivers/block/rbd.c | 1 - drivers/gpu/drm/nouveau/nouveau_fbcon.c | 24 +++++++++++ drivers/gpu/drm/radeon/radeon_display.c | 14 +------ drivers/gpu/drm/radeon/radeon_pm.c | 63 +++++++++++++++++------------ drivers/i2c/busses/i2c-designware-platdrv.c | 20 +++++++++ drivers/i2c/busses/i2c-rcar.c | 7 ++-- drivers/i2c/busses/i2c-s3c2410.c | 8 ++-- drivers/md/dm-thin.c | 2 +- drivers/net/ppp/pppoe.c | 1 - drivers/net/usb/asix_devices.c | 16 +------- fs/btrfs/backref.c | 8 ++-- include/asm-generic/preempt.h | 5 ++- include/linux/preempt.h | 5 ++- include/linux/preempt_mask.h | 16 ++++++-- include/linux/sched.h | 6 --- include/linux/skbuff.h | 3 ++ include/net/af_unix.h | 6 ++- include/net/sock.h | 8 ++++ kernel/sched/core.c | 6 +-- kernel/workqueue.c | 8 ++-- net/core/ethtool.c | 2 +- net/core/skbuff.c | 9 +++-- net/l2tp/l2tp_core.c | 11 ++++- net/unix/af_unix.c | 16 +++++++- 31 files changed, 182 insertions(+), 101 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 5/25 skbuff: Fix skb checksum flag on skb pull
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pravin B Shelar <[email protected]>
[ Upstream commit 6ae459bdaaeebc632b16e54dcbabb490c6931d61 ]
VXLAN device can receive skb with checksum partial. But the checksum offset could be in outer header which is pulled on receive. This results in negative checksum offset for the skb. Such skb can cause the assert failure in skb_checksum_help(). Following patch fixes the bug by setting checksum-none while pulling outer header.
Following is the kernel panic msg from old kernel hitting the bug.
------------[ cut here ]------------ kernel BUG at net/core/dev.c:1906! RIP: 0010:[<ffffffff81518034>] skb_checksum_help+0x144/0x150 Call Trace: <IRQ> [<ffffffffa0164c28>] queue_userspace_packet+0x408/0x470 [openvswitch] [<ffffffffa016614d>] ovs_dp_upcall+0x5d/0x60 [openvswitch] [<ffffffffa0166236>] ovs_dp_process_packet_with_key+0xe6/0x100 [openvswitch] [<ffffffffa016629b>] ovs_dp_process_received_packet+0x4b/0x80 [openvswitch] [<ffffffffa016c51a>] ovs_vport_receive+0x2a/0x30 [openvswitch] [<ffffffffa0171383>] vxlan_rcv+0x53/0x60 [openvswitch] [<ffffffffa01734cb>] vxlan_udp_encap_recv+0x8b/0xf0 [openvswitch] [<ffffffff8157addc>] udp_queue_rcv_skb+0x2dc/0x3b0 [<ffffffff8157b56f>] __udp4_lib_rcv+0x1cf/0x6c0 [<ffffffff8157ba7a>] udp_rcv+0x1a/0x20 [<ffffffff8154fdbd>] ip_local_deliver_finish+0xdd/0x280 [<ffffffff81550128>] ip_local_deliver+0x88/0x90 [<ffffffff8154fa7d>] ip_rcv_finish+0x10d/0x370 [<ffffffff81550365>] ip_rcv+0x235/0x300 [<ffffffff8151ba1d>] __netif_receive_skb+0x55d/0x620 [<ffffffff8151c360>] netif_receive_skb+0x80/0x90 [<ffffffff81459935>] virtnet_poll+0x555/0x6f0 [<ffffffff8151cd04>] net_rx_action+0x134/0x290 [<ffffffff810683d8>] __do_softirq+0xa8/0x210 [<ffffffff8162fe6c>] call_softirq+0x1c/0x30 [<ffffffff810161a5>] do_softirq+0x65/0xa0 [<ffffffff810687be>] irq_exit+0x8e/0xb0 [<ffffffff81630733>] do_IRQ+0x63/0xe0 [<ffffffff81625f2e>] common_interrupt+0x6e/0x6e
--- include/linux/skbuff.h | 3 +++ 1 file changed, 3 insertions(+)
include/linux/skbuff.h +3 -0
@@ -2347,6 +2347,9 @@ static inline void skb_postpull_rcsum(st {if (skb->ip_summed ==CHECKSUM_COMPLETE ) skb->csum =csum_sub (skb->csum,csum_partial (start, len,0 )); +else if (skb->ip_summed ==CHECKSUM_PARTIAL && +skb_checksum_start_offset (skb) <= len) + skb->ip_summed =CHECKSUM_NONE ; }unsigned char *skb_pull_rcsum (struct sk_buff *skb,unsigned int len);
Greg Kroah-Hartman
maintainerPATCH 15/25 arm64: errata: use KBUILD_CFLAGS_MODULE for erratum #843419
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit b6dd8e0719c0d2d01429639a11b7bc2677de240c upstream.
Commit df057cc7b4fa ("arm64: errata: add module build workaround for erratum #843419") sets CFLAGS_MODULE to ensure that the large memory model is used by the compiler when building kernel modules.
However, CFLAGS_MODULE is an environment variable and intended to be overridden on the command line, which appears to be the case with the Ubuntu kernel packaging system, so use KBUILD_CFLAGS_MODULE instead.
--- arch/arm64/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/Makefile +1 -1
@@ -35,7 +35,7 @@ comma = , CHECKFLAGS += -D__aarch64__ ifeq ($(CONFIG_ARM64_ERRATUM_843419), y) -CFLAGS_MODULE += -mcmodel=large +KBUILD_CFLAGS_MODULE += -mcmodel=large endif # Default value
Greg Kroah-Hartman
maintainerPATCH 16/25 i2c: rcar: enable RuntimePM before registering to the core
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit 4f7effddf4549d57114289f273710f077c4c330a upstream.
The core may register clients attached to this master which may use funtionality from the master. So, RuntimePM must be enabled before, otherwise this will fail. While here, move drvdata, too.
--- drivers/i2c/busses/i2c-rcar.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-rcar.c +4 -3
@@ -712,15 +712,16 @@ static int rcar_i2c_probe(struct platforreturn ret; } +pm_runtime_enable (dev); +platform_set_drvdata (pdev, priv); + ret =i2c_add_numbered_adapter (adap);if (ret <0 ) {dev_err (dev,"reg adap failed: %d\n" , ret); +pm_runtime_disable (dev);return ret; } -pm_runtime_enable (dev); -platform_set_drvdata (pdev, priv); -dev_info (dev,"probed\n" );return 0 ;
Greg Kroah-Hartman
maintainerPATCH 6/25 skbuff: Fix skb checksum partial check.
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pravin B Shelar <[email protected]>
[ Upstream commit 31b33dfb0a144469dd805514c9e63f4993729a48 ]
Earlier patch 6ae459bda tried to detect void ckecksum partial skb by comparing pull length to checksum offset. But it does not work for all cases since checksum-offset depends on updates to skb->data.
Following patch fixes it by validating checksum start offset after skb-data pointer is updated. Negative value of checksum offset start means there is no need to checksum.
--- include/linux/skbuff.h | 2 +- net/core/skbuff.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-)
include/linux/skbuff.h +1 -1
@@ -2348,7 +2348,7 @@ static inline void skb_postpull_rcsum(stif (skb->ip_summed ==CHECKSUM_COMPLETE ) skb->csum =csum_sub (skb->csum,csum_partial (start, len,0 ));else if (skb->ip_summed ==CHECKSUM_PARTIAL && -skb_checksum_start_offset (skb) <= len) +skb_checksum_start_offset (skb) <0 ) skb->ip_summed =CHECKSUM_NONE ; }
net/core/skbuff.c +5 -4
@@ -2862,11 +2862,12 @@ EXPORT_SYMBOL(skb_append_datato_frags);*/ unsigned char *skb_pull_rcsum (struct sk_buff *skb,unsigned int len) { +unsigned char *data = skb->data; +BUG_ON (len > skb->len); - skb->len -= len; -BUG_ON (skb->len < skb->data_len); -skb_postpull_rcsum (skb, skb->data, len); -return skb->data += len; +__skb_pull (skb, len); +skb_postpull_rcsum (skb, data, len); +return skb->data; }EXPORT_SYMBOL_GPL (skb_pull_rcsum);
Greg Kroah-Hartman
maintainerPATCH 22/25 dm thin: fix missing pool reference count decrement in pool_ctr error path
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit ba30670f4d5292c4e7f7980bbd5071f7c4794cdd upstream.
--- drivers/md/dm-thin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-thin.c +1 -1
@@ -2373,7 +2373,7 @@ static int pool_ctr(struct dm_target *ti metadata_low_callback, pool);if (r) - goto out_free_pt; + goto out_flags_changed; pt->callbacks.congested_fn = pool_is_congested;dm_table_add_target_callbacks (ti->table, &pt->callbacks);
Greg Kroah-Hartman
maintainerPATCH 23/25 rbd: fix double free on rbd_dev->header_name
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <[email protected]>
commit 3ebe138ac642a195c7f2efdb918f464734421fd6 upstream.
If rbd_dev_image_probe() in rbd_dev_probe_parent() fails, header_name is freed twice: once in rbd_dev_probe_parent() and then in its caller rbd_dev_image_probe() (rbd_dev_image_probe() is called recursively to handle parent images).
rbd_dev_probe_parent() is responsible for probing the parent, so it shouldn't muck with clone's fields.
--- drivers/block/rbd.c | 1 - 1 file changed, 1 deletion(-)
drivers/block/rbd.c +0 -1
@@ -4851,7 +4851,6 @@ static int rbd_dev_probe_parent(struct r out_err:if (parent) {rbd_dev_unparent (rbd_dev); -kfree (rbd_dev->header_name);rbd_dev_destroy (parent); }else {rbd_put_client (rbdc);
Greg Kroah-Hartman
maintainerPATCH 7/25 net: add pfmemalloc check in sk_add_backlog()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit c7c49b8fde26b74277188bdc6c9dca38db6fa35b ]
Greg reported crashes hitting the following check in __sk_backlog_rcv()
BUG_ON(!sock_flag(sk, SOCK_MEMALLOC));
The pfmemalloc bit is currently checked in sk_filter().
This works correctly for TCP, because sk_filter() is ran in tcp_v[46]_rcv() before hitting the prequeue or backlog checks.
For UDP or other protocols, this does not work, because the sk_filter() is ran from sock_queue_rcv_skb(), which might be called _after_ backlog queuing if socket is owned by user by the time packet is processed by softirq handler.
--- include/net/sock.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/net/sock.h +8 -0
@@ -805,6 +805,14 @@ static inline __must_check int sk_add_baif (sk_rcvqueues_full (sk, skb, limit))return -ENOBUFS ; +/* +* If the skb was allocated from pfmemalloc reserves, only +* allow SOCK_MEMALLOC sockets to use it as this socket is +* helping free memory +*/ +if (skb_pfmemalloc (skb) && !sock_flag (sk,SOCK_MEMALLOC )) +return -ENOMEM ; +__sk_add_backlog (sk, skb); sk->sk_backlog.len += skb->truesize;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 8/25 ppp: dont override sk->sk_state in pppoe_flush_dev()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
[ Upstream commit e6740165b8f7f06d8caee0fceab3fb9d790a6fed ]
Since commit 2b018d57ff18 ("pppoe: drop PPPOX_ZOMBIEs in pppoe_release"), pppoe_release() calls dev_put(po->pppoe_dev) if sk is in the PPPOX_ZOMBIE state. But pppoe_flush_dev() can set sk->sk_state to PPPOX_ZOMBIE _and_ reset po->pppoe_dev to NULL. This leads to the following oops:
[ 570.140800] BUG: unable to handle kernel NULL pointer dereference at 00000000000004e0 [ 570.142931] IP: [<ffffffffa018c701>] pppoe_release+0x50/0x101 [pppoe] [ 570.144601] PGD 3d119067 PUD 3dbc1067 PMD 0 [ 570.144601] Oops: 0000 [#1] SMP [ 570.144601] Modules linked in: l2tp_ppp l2tp_netlink l2tp_core ip6_udp_tunnel udp_tunnel pppoe pppox ppp_generic slhc loop crc32c_intel ghash_clmulni_intel jitterentropy_rng sha256_generic hmac drbg ansi_cprng aesni_intel aes_x86_64 ablk_helper cryptd lrw gf128mul glue_helper acpi_cpufreq evdev serio_raw processor button ext4 crc16 mbcache jbd2 virtio_net virtio_blk virtio_pci virtio_ring virtio [ 570.144601] CPU: 1 PID: 15738 Comm: ppp-apitest Not tainted 4.2.0 #1 [ 570.144601] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014 [ 570.144601] task: ffff88003d30d600 ti: ffff880036b60000 task.ti: ffff880036b60000 [ 570.144601] RIP: 0010:[<ffffffffa018c701>] [<ffffffffa018c701>] pppoe_release+0x50/0x101 [pppoe] [ 570.144601] RSP: 0018:ffff880036b63e08 EFLAGS: 00010202 [ 570.144601] RAX: 0000000000000000 RBX: ffff880034340000 RCX: 0000000000000206 [ 570.144601] RDX: 0000000000000006 RSI: ffff88003d30dd20 RDI: ffff88003d30dd20 [ 570.144601] RBP: ffff880036b63e28 R08: 0000000000000001 R09: 0000000000000000 [ 570.144601] R10: 00007ffee9b50420 R11: ffff880034340078 R12: ffff8800387ec780 [ 570.144601] R13: ffff8800387ec7b0 R14: ffff88003e222aa0 R15: ffff8800387ec7b0 [ 570.144601] FS: 00007f5672f48700(0000) GS:ffff88003fc80000(0000) knlGS:0000000000000000 [ 570.144601] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 570.144601] CR2: 00000000000004e0 CR3: 0000000037f7e000 CR4: 00000000000406a0 [ 570.144601] Stack: [ 570.144601] ffffffffa018f240 ffff8800387ec780 ffffffffa018f240 ffff8800387ec7b0 [ 570.144601] ffff880036b63e48 ffffffff812caabe ffff880039e4e000 0000000000000008 [ 570.144601] ffff880036b63e58 ffffffff812cabad ffff880036b63ea8 ffffffff811347f5 [ 570.144601] Call Trace: [ 570.144601] [<ffffffff812caabe>] sock_release+0x1a/0x75 [ 570.144601] [<ffffffff812cabad>] sock_close+0xd/0x11 [ 570.144601] [<ffffffff811347f5>] __fput+0xff/0x1a5 [ 570.144601] [<ffffffff811348cb>] ____fput+0x9/0xb [ 570.144601] [<ffffffff81056682>] task_work_run+0x66/0x90 [ 570.144601] [<ffffffff8100189e>] prepare_exit_to_usermode+0x8c/0xa7 [ 570.144601] [<ffffffff81001a26>] syscall_return_slowpath+0x16d/0x19b [ 570.144601] [<ffffffff813babb1>] int_ret_from_sys_call+0x25/0x9f [ 570.144601] Code: 48 8b 83 c8 01 00 00 a8 01 74 12 48 89 df e8 8b 27 14 e1 b8 f7 ff ff ff e9 b7 00 00 00 8a 43 12 a8 0b 74 1c 48 8b 83 a8 04 00 00 <48> 8b 80 e0 04 00 00 65 ff 08 48 c7 83 a8 04 00 00 00 00 00 00 [ 570.144601] RIP [<ffffffffa018c701>] pppoe_release+0x50/0x101 [pppoe] [ 570.144601] RSP <ffff880036b63e08> [ 570.144601] CR2: 00000000000004e0 [ 570.200518] ---[ end trace 46956baf17349563 ]---
pppoe_flush_dev() has no reason to override sk->sk_state with PPPOX_ZOMBIE. pppox_unbind_sock() already sets sk->sk_state to PPPOX_DEAD, which is the correct state given that sk is unbound and po->pppoe_dev is NULL.
--- drivers/net/ppp/pppoe.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ppp/pppoe.c +0 -1
@@ -313,7 +313,6 @@ static void pppoe_flush_dev(struct net_dif (po->pppoe_dev == dev && sk->sk_state & (PPPOX_CONNECTED |PPPOX_BOUND |PPPOX_ZOMBIE )) {pppox_unbind_sock (sk); - sk->sk_state =PPPOX_ZOMBIE ; sk->sk_state_change (sk); po->pppoe_dev =NULL ;dev_put (dev);
Greg Kroah-Hartman
maintainerPATCH 24/25 sched/preempt: Rename PREEMPT_CHECK_OFFSET to PREEMPT_DISABLE_OFFSET
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
commit 90b62b5129d5cb50f62f40e684de7a1961e57197 upstream.
"CHECK" suggests it's only used as a comparison mask. But now it's used further as a config-conditional preempt disabler offset. Lets disambiguate this name.
--- include/linux/preempt_mask.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/linux/preempt_mask.h +4 -4
@@ -72,9 +72,9 @@#define in_nmi () (preempt_count() & NMI_MASK)#if defined(CONFIG_PREEMPT_COUNT ) -# define PREEMPT_CHECK_OFFSET 1 +# define PREEMPT_DISABLE_OFFSET 1#else -# define PREEMPT_CHECK_OFFSET 0 +# define PREEMPT_DISABLE_OFFSET 0#endif /*
@@ -90,7 +90,7 @@* * Work as expected. */ -#define SOFTIRQ_LOCK_OFFSET (SOFTIRQ_DISABLE_OFFSET + PREEMPT_CHECK_OFFSET) +#define SOFTIRQ_LOCK_OFFSET (SOFTIRQ_DISABLE_OFFSET + PREEMPT_DISABLE_OFFSET)/* * Are we running in atomic context? WARNING: this macro cannot
@@ -106,7 +106,7 @@* (used by the scheduler, *after* releasing the kernel lock) */ #define in_atomic_preempt_off () \ - ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET) + ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_DISABLE_OFFSET)#ifdef CONFIG_PREEMPT_COUNT # define preemptible () (preempt_count() == 0 && !irqs_disabled())
Greg Kroah-Hartman
maintainerPATCH 25/25 sched/preempt: Fix cond_resched_lock() and cond_resched_softirq()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Khlebnikov <[email protected]>
commit fe32d3cd5e8eb0f82e459763374aa80797023403 upstream.
These functions check should_resched() before unlocking spinlock/bh-enable:preempt_count always non-zero => should_resched() always returns false. cond_resched_lock() worked iff spin_needbreak is set.
This patch adds argument "preempt_offset" to should_resched().
preempt_count offset constants for that:
PREEMPT_DISABLE_OFFSET - offset after preempt_disable() PREEMPT_LOCK_OFFSET - offset after spin_lock() SOFTIRQ_DISABLE_OFFSET - offset after local_bh_distable() SOFTIRQ_LOCK_OFFSET - offset after spin_lock_bh()
--- arch/x86/include/asm/preempt.h | 4 ++-- include/asm-generic/preempt.h | 5 +++-- include/linux/preempt.h | 5 +++-- include/linux/preempt_mask.h | 14 +++++++++++--- include/linux/sched.h | 6 ------ kernel/sched/core.c | 6 +++--- 6 files changed, 22 insertions(+), 18 deletions(-)
arch/x86/include/asm/preempt.h +2 -2
@@ -105,9 +105,9 @@ static __always_inline bool __preempt_co/* * Returns true when we need to resched and can (barring IRQ state). */ -static __always_inline bool should_resched(void) +static __always_inline bool should_resched(int preempt_offset) { -return unlikely (!__this_cpu_read_4 (__preempt_count)); +return unlikely (__this_cpu_read_4 (__preempt_count) == preempt_offset); }#ifdef CONFIG_PREEMPT
include/asm-generic/preempt.h +3 -2
@@ -74,9 +74,10 @@ static __always_inline bool __preempt_co/* * Returns true when we need to resched and can (barring IRQ state). */ -static __always_inline bool should_resched(void) +static __always_inline bool should_resched(int preempt_offset) { -return unlikely (!preempt_count () &&tif_need_resched ()); +return unlikely (preempt_count () == preempt_offset && +tif_need_resched ()); }#ifdef CONFIG_PREEMPT
include/linux/preempt.h +3 -2
@@ -22,7 +22,8 @@#if defined(CONFIG_DEBUG_PREEMPT ) || defined(CONFIG_PREEMPT_TRACER )extern void preempt_count_add (int val);extern void preempt_count_sub (int val); -#define preempt_count_dec_and_test () ({ preempt_count_sub(1); should_resched(); }) +#define preempt_count_dec_and_test () \ + ({ preempt_count_sub(1); should_resched(0); })#else #define preempt_count_add (val) __preempt_count_add(val)#define preempt_count_sub (val) __preempt_count_sub(val)
@@ -61,7 +62,7 @@ do { \#define preempt_check_resched () \ do { \ - if (should_resched()) \ + if (should_resched(0)) \ __preempt_schedule(); \ } while (0)
include/linux/preempt_mask.h +11 -3
@@ -71,13 +71,21 @@*/ #define in_nmi () (preempt_count() & NMI_MASK) +/* +* The preempt_count offset after preempt_disable(); +*/ #if defined(CONFIG_PREEMPT_COUNT ) -# define PREEMPT_DISABLE_OFFSET 1 +# define PREEMPT_DISABLE_OFFSET PREEMPT_OFFSET#else -# define PREEMPT_DISABLE_OFFSET 0 +# define PREEMPT_DISABLE_OFFSET 0#endif /* +* The preempt_count offset after spin_lock() +*/ +#define PREEMPT_LOCK_OFFSET PREEMPT_DISABLE_OFFSET + +/* * The preempt_count offset needed for things like: * * spin_lock_bh()
@@ -90,7 +98,7 @@* * Work as expected. */ -#define SOFTIRQ_LOCK_OFFSET (SOFTIRQ_DISABLE_OFFSET + PREEMPT_DISABLE_OFFSET) +#define SOFTIRQ_LOCK_OFFSET (SOFTIRQ_DISABLE_OFFSET + PREEMPT_LOCK_OFFSET)/* * Are we running in atomic context? WARNING: this macro cannot
include/linux/sched.h +0 -6
@@ -2647,12 +2647,6 @@ extern int _cond_resched(void);extern int __cond_resched_lock (spinlock_t *lock); -#ifdef CONFIG_PREEMPT_COUNT -#define PREEMPT_LOCK_OFFSET PREEMPT_OFFSET -#else -#define PREEMPT_LOCK_OFFSET 0 -#endif -#define cond_resched_lock (lock) ({ \ __might_sleep(__FILE__, __LINE__, PREEMPT_LOCK_OFFSET); \ __cond_resched_lock(lock); \
kernel/sched/core.c +3 -3
@@ -4113,7 +4113,7 @@ static void __cond_resched(void) int __sched _cond_resched(void) { -if (should_resched ()) { +if (should_resched (0 )) {__cond_resched ();return 1 ; }
@@ -4131,7 +4131,7 @@ EXPORT_SYMBOL(_cond_resched);*/ int __cond_resched_lock (spinlock_t *lock) { -int resched =should_resched (); +int resched =should_resched (PREEMPT_LOCK_OFFSET );int ret =0 ;lockdep_assert_held (lock);
@@ -4153,7 +4153,7 @@ int __sched __cond_resched_softirq(void) {BUG_ON (!in_softirq ()); -if (should_resched ()) { +if (should_resched (SOFTIRQ_DISABLE_OFFSET )) {local_bh_enable ();__cond_resched ();local_bh_disable ();
Greg Kroah-Hartman
maintainerPATCH 9/25 ethtool: Use kcalloc instead of kmalloc for ethtool_get_strings
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Perches <[email protected]>
[ Upstream commit 077cb37fcf6f00a45f375161200b5ee0cd4e937b ]
It seems that kernel memory can leak into userspace by a kmalloc, ethtool_get_strings, then copy_to_user sequence.
Avoid this by using kcalloc to zero fill the copied buffer.
--- net/core/ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/ethtool.c +1 -1
@@ -1080,7 +1080,7 @@ static int ethtool_get_strings(struct ne gstrings.len = ret; - data =kmalloc (gstrings.len *ETH_GSTRING_LEN ,GFP_USER ); + data =kcalloc (gstrings.len,ETH_GSTRING_LEN ,GFP_USER );if (!data)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 17/25 i2c: s3c2410: enable RuntimePM before registering to the core
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit eadd709f5d2e8aebb1b7bf49460e97a68d81a9b0 upstream.
The core may register clients attached to this master which may use funtionality from the master. So, RuntimePM must be enabled before, otherwise this will fail. While here, move drvdata, too.
--- drivers/i2c/busses/i2c-s3c2410.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-s3c2410.c +5 -3
@@ -1198,17 +1198,19 @@ static int s3c24xx_i2c_probe(struct plat i2c->adap.nr = i2c->pdata->bus_num; i2c->adap.dev.of_node = pdev->dev.of_node; +platform_set_drvdata (pdev, i2c); + +pm_runtime_enable (&pdev->dev); + ret =i2c_add_numbered_adapter (&i2c->adap);if (ret <0 ) {dev_err (&pdev->dev,"failed to add bus to i2c core\n" ); +pm_runtime_disable (&pdev->dev);s3c24xx_i2c_deregister_cpufreq (i2c);clk_unprepare (i2c->clk);return ret; } -platform_set_drvdata (pdev, i2c); - -pm_runtime_enable (&pdev->dev);pm_runtime_enable (&i2c->adap.dev);dev_info (&pdev->dev,"%s: S3C I2C adapter\n" ,dev_name (&i2c->adap.dev));
Greg Kroah-Hartman
maintainerPATCH 18/25 i2c: designware: Do not use parameters from ACPI on Dell Inspiron 7348
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <[email protected]>
commit 56d4b8a24cef5d66f0d10ac778a520d3c2c68a48 upstream.
ACPI SSCN/FMCN methods were originally added because then the platform can provide the most accurate HCNT/LCNT values to the driver. However, this seems not to be true for Dell Inspiron 7348 where using these causes the touchpad to fail in boot:
i2c_hid i2c-DLL0675:00: failed to retrieve report from device. i2c_designware INT3433:00: i2c_dw_handle_tx_abort: lost arbitration i2c_hid i2c-DLL0675:00: failed to retrieve report from device. i2c_designware INT3433:00: controller timed out
The values received from ACPI are (in fast mode):
HCNT: 72
LCNT: 160
this translates to following timings (input clock is 100MHz on Broadwell):
tHIGH: 720 ns (spec min 600 ns)
tLOW: 1600 ns (spec min 1300 ns)
Bus period: 2920 ns (assuming 300 ns tf and tr)
Bus speed: 342.5 kHz
Both tHIGH and tLOW are within the I2C specification.
The calculated values when ACPI parameters are not used are (in fast mode):
HCNT: 87
LCNT: 159
which translates to:
tHIGH: 870 ns (spec min 600 ns)
tLOW: 1590 ns (spec min 1300 ns)
Bus period 3060 ns (assuming 300 ns tf and tr)
Bus speed 326.8 kHz
These values are also within the I2C specification.
Since both ACPI and calculated values meet the I2C specification timing requirements it is hard to say why the touchpad does not function properly with the ACPI values except that the bus speed is higher in this case (but still well below the max 400kHz).
Solve this by adding DMI quirk to the driver that disables using ACPI parameters on this particulare machine.
--- drivers/i2c/busses/i2c-designware-platdrv.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/i2c/busses/i2c-designware-platdrv.c +20 -0
@@ -28,6 +28,7 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/delay.h> +#include <linux/dmi.h> #include <linux/i2c.h> #include <linux/clk.h> #include <linux/errno.h>
@@ -53,6 +54,22 @@ static u32 i2c_dw_get_clk_rate_khz(struc }#ifdef CONFIG_ACPI +/* +* The HCNT/LCNT information coming from ACPI should be the most accurate +* for given platform. However, some systems get it wrong. On such systems +* we get better results by calculating those based on the input clock. +*/ +static const struct dmi_system_id dw_i2c_no_acpi_params[] = { + { + .ident ="Dell Inspiron 7348" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Inspiron 7348" ), + }, + }, + { } +}; +static void dw_i2c_acpi_params (struct platform_device *pdev,char method[],u16 *hcnt,u16 *lcnt,u32 *sda_hold) {
@@ -60,6 +77,9 @@ static void dw_i2c_acpi_params(struct placpi_handle handle =ACPI_HANDLE (&pdev->dev);union acpi_object *obj; +if (dmi_check_system (dw_i2c_no_acpi_params)) +return ; +if (ACPI_FAILURE (acpi_evaluate_object (handle, method,NULL , &buf)))return ;
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.56 release. There are 25 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Oct 25 17:45:45 UTC 2015. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.14.56-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.56 release. There are 25 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Oct 25 17:45:45 UTC 2015. Anything received after that time might be too late.
Build results:
total: 127 pass: 127 fail: 0 Qemu test results: total: 80 pass: 80 fail: 0
Details are available at http://server.roeck-us.net:8010/builders.
Guenter