Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:3.14 commit in: /
Date: Tue, 27 Oct 2015 13:38:47
Message-Id: 1445953102.9cd6b37a67e6a9299fd28e066e9c675aceb16110.mpagano@gentoo
1 commit: 9cd6b37a67e6a9299fd28e066e9c675aceb16110
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Tue Oct 27 13:38:22 2015 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 27 13:38:22 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=9cd6b37a
7
8 Linux patch 3.14.56
9
10 0000_README | 4 +
11 1055_linux-3.14.56.patch | 782 +++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 786 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index a142995..1326707 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -262,6 +262,10 @@ Patch: 1054_linux-3.14.55.patch
19 From: http://www.kernel.org
20 Desc: Linux 3.14.55
21
22 +Patch: 1055_linux-3.14.56.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 3.14.56
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1055_linux-3.14.56.patch b/1055_linux-3.14.56.patch
31 new file mode 100644
32 index 0000000..83b202c
33 --- /dev/null
34 +++ b/1055_linux-3.14.56.patch
35 @@ -0,0 +1,782 @@
36 +diff --git a/Makefile b/Makefile
37 +index 97d18c1d27f2..2a13d9d63880 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 3
42 + PATCHLEVEL = 14
43 +-SUBLEVEL = 55
44 ++SUBLEVEL = 56
45 + EXTRAVERSION =
46 + NAME = Remembering Coco
47 +
48 +diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
49 +index 0ab1a34dab58..dcc26850727d 100644
50 +--- a/arch/arm64/Makefile
51 ++++ b/arch/arm64/Makefile
52 +@@ -35,7 +35,7 @@ comma = ,
53 + CHECKFLAGS += -D__aarch64__
54 +
55 + ifeq ($(CONFIG_ARM64_ERRATUM_843419), y)
56 +-CFLAGS_MODULE += -mcmodel=large
57 ++KBUILD_CFLAGS_MODULE += -mcmodel=large
58 + endif
59 +
60 + # Default value
61 +diff --git a/arch/sparc/crypto/aes_glue.c b/arch/sparc/crypto/aes_glue.c
62 +index ded4cee35318..dc78cdd43e0a 100644
63 +--- a/arch/sparc/crypto/aes_glue.c
64 ++++ b/arch/sparc/crypto/aes_glue.c
65 +@@ -433,6 +433,7 @@ static struct crypto_alg algs[] = { {
66 + .blkcipher = {
67 + .min_keysize = AES_MIN_KEY_SIZE,
68 + .max_keysize = AES_MAX_KEY_SIZE,
69 ++ .ivsize = AES_BLOCK_SIZE,
70 + .setkey = aes_set_key,
71 + .encrypt = cbc_encrypt,
72 + .decrypt = cbc_decrypt,
73 +@@ -452,6 +453,7 @@ static struct crypto_alg algs[] = { {
74 + .blkcipher = {
75 + .min_keysize = AES_MIN_KEY_SIZE,
76 + .max_keysize = AES_MAX_KEY_SIZE,
77 ++ .ivsize = AES_BLOCK_SIZE,
78 + .setkey = aes_set_key,
79 + .encrypt = ctr_crypt,
80 + .decrypt = ctr_crypt,
81 +diff --git a/arch/sparc/crypto/camellia_glue.c b/arch/sparc/crypto/camellia_glue.c
82 +index 641f55cb61c3..eb87d6dd86b1 100644
83 +--- a/arch/sparc/crypto/camellia_glue.c
84 ++++ b/arch/sparc/crypto/camellia_glue.c
85 +@@ -274,6 +274,7 @@ static struct crypto_alg algs[] = { {
86 + .blkcipher = {
87 + .min_keysize = CAMELLIA_MIN_KEY_SIZE,
88 + .max_keysize = CAMELLIA_MAX_KEY_SIZE,
89 ++ .ivsize = CAMELLIA_BLOCK_SIZE,
90 + .setkey = camellia_set_key,
91 + .encrypt = cbc_encrypt,
92 + .decrypt = cbc_decrypt,
93 +diff --git a/arch/sparc/crypto/des_glue.c b/arch/sparc/crypto/des_glue.c
94 +index d11500972994..1359bfc544e4 100644
95 +--- a/arch/sparc/crypto/des_glue.c
96 ++++ b/arch/sparc/crypto/des_glue.c
97 +@@ -429,6 +429,7 @@ static struct crypto_alg algs[] = { {
98 + .blkcipher = {
99 + .min_keysize = DES_KEY_SIZE,
100 + .max_keysize = DES_KEY_SIZE,
101 ++ .ivsize = DES_BLOCK_SIZE,
102 + .setkey = des_set_key,
103 + .encrypt = cbc_encrypt,
104 + .decrypt = cbc_decrypt,
105 +@@ -485,6 +486,7 @@ static struct crypto_alg algs[] = { {
106 + .blkcipher = {
107 + .min_keysize = DES3_EDE_KEY_SIZE,
108 + .max_keysize = DES3_EDE_KEY_SIZE,
109 ++ .ivsize = DES3_EDE_BLOCK_SIZE,
110 + .setkey = des3_ede_set_key,
111 + .encrypt = cbc3_encrypt,
112 + .decrypt = cbc3_decrypt,
113 +diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h
114 +index b39e194f6c8d..999b4a3e65f5 100644
115 +--- a/arch/x86/include/asm/preempt.h
116 ++++ b/arch/x86/include/asm/preempt.h
117 +@@ -105,9 +105,9 @@ static __always_inline bool __preempt_count_dec_and_test(void)
118 + /*
119 + * Returns true when we need to resched and can (barring IRQ state).
120 + */
121 +-static __always_inline bool should_resched(void)
122 ++static __always_inline bool should_resched(int preempt_offset)
123 + {
124 +- return unlikely(!__this_cpu_read_4(__preempt_count));
125 ++ return unlikely(__this_cpu_read_4(__preempt_count) == preempt_offset);
126 + }
127 +
128 + #ifdef CONFIG_PREEMPT
129 +diff --git a/crypto/ahash.c b/crypto/ahash.c
130 +index a92dc382f781..865ef923eda6 100644
131 +--- a/crypto/ahash.c
132 ++++ b/crypto/ahash.c
133 +@@ -465,7 +465,8 @@ static int ahash_prepare_alg(struct ahash_alg *alg)
134 + struct crypto_alg *base = &alg->halg.base;
135 +
136 + if (alg->halg.digestsize > PAGE_SIZE / 8 ||
137 +- alg->halg.statesize > PAGE_SIZE / 8)
138 ++ alg->halg.statesize > PAGE_SIZE / 8 ||
139 ++ alg->halg.statesize == 0)
140 + return -EINVAL;
141 +
142 + base->cra_type = &crypto_ahash_type;
143 +diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
144 +index b583773e4ecb..2ea515509ca6 100644
145 +--- a/drivers/block/rbd.c
146 ++++ b/drivers/block/rbd.c
147 +@@ -4851,7 +4851,6 @@ static int rbd_dev_probe_parent(struct rbd_device *rbd_dev)
148 + out_err:
149 + if (parent) {
150 + rbd_dev_unparent(rbd_dev);
151 +- kfree(rbd_dev->header_name);
152 + rbd_dev_destroy(parent);
153 + } else {
154 + rbd_put_client(rbdc);
155 +diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
156 +index 7903e0ed3c75..a5846b34fdd9 100644
157 +--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
158 ++++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
159 +@@ -183,8 +183,30 @@ nouveau_fbcon_sync(struct fb_info *info)
160 + return 0;
161 + }
162 +
163 ++static int
164 ++nouveau_fbcon_open(struct fb_info *info, int user)
165 ++{
166 ++ struct nouveau_fbdev *fbcon = info->par;
167 ++ struct nouveau_drm *drm = nouveau_drm(fbcon->dev);
168 ++ int ret = pm_runtime_get_sync(drm->dev->dev);
169 ++ if (ret < 0 && ret != -EACCES)
170 ++ return ret;
171 ++ return 0;
172 ++}
173 ++
174 ++static int
175 ++nouveau_fbcon_release(struct fb_info *info, int user)
176 ++{
177 ++ struct nouveau_fbdev *fbcon = info->par;
178 ++ struct nouveau_drm *drm = nouveau_drm(fbcon->dev);
179 ++ pm_runtime_put(drm->dev->dev);
180 ++ return 0;
181 ++}
182 ++
183 + static struct fb_ops nouveau_fbcon_ops = {
184 + .owner = THIS_MODULE,
185 ++ .fb_open = nouveau_fbcon_open,
186 ++ .fb_release = nouveau_fbcon_release,
187 + .fb_check_var = drm_fb_helper_check_var,
188 + .fb_set_par = drm_fb_helper_set_par,
189 + .fb_fillrect = nouveau_fbcon_fillrect,
190 +@@ -200,6 +222,8 @@ static struct fb_ops nouveau_fbcon_ops = {
191 +
192 + static struct fb_ops nouveau_fbcon_sw_ops = {
193 + .owner = THIS_MODULE,
194 ++ .fb_open = nouveau_fbcon_open,
195 ++ .fb_release = nouveau_fbcon_release,
196 + .fb_check_var = drm_fb_helper_check_var,
197 + .fb_set_par = drm_fb_helper_set_par,
198 + .fb_fillrect = cfb_fillrect,
199 +diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
200 +index 11d06c7b5afa..1af604a4512a 100644
201 +--- a/drivers/gpu/drm/radeon/radeon_display.c
202 ++++ b/drivers/gpu/drm/radeon/radeon_display.c
203 +@@ -1479,18 +1479,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
204 + radeon_fbdev_init(rdev);
205 + drm_kms_helper_poll_init(rdev->ddev);
206 +
207 +- if (rdev->pm.dpm_enabled) {
208 +- /* do dpm late init */
209 +- ret = radeon_pm_late_init(rdev);
210 +- if (ret) {
211 +- rdev->pm.dpm_enabled = false;
212 +- DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n");
213 +- }
214 +- /* set the dpm state for PX since there won't be
215 +- * a modeset to call this.
216 +- */
217 +- radeon_pm_compute_clocks(rdev);
218 +- }
219 ++ /* do pm late init */
220 ++ ret = radeon_pm_late_init(rdev);
221 +
222 + return 0;
223 + }
224 +diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
225 +index 0095ee7fce34..214adc6d2a68 100644
226 +--- a/drivers/gpu/drm/radeon/radeon_pm.c
227 ++++ b/drivers/gpu/drm/radeon/radeon_pm.c
228 +@@ -1153,14 +1153,6 @@ static int radeon_pm_init_old(struct radeon_device *rdev)
229 + INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler);
230 +
231 + if (rdev->pm.num_power_states > 1) {
232 +- /* where's the best place to put these? */
233 +- ret = device_create_file(rdev->dev, &dev_attr_power_profile);
234 +- if (ret)
235 +- DRM_ERROR("failed to create device file for power profile\n");
236 +- ret = device_create_file(rdev->dev, &dev_attr_power_method);
237 +- if (ret)
238 +- DRM_ERROR("failed to create device file for power method\n");
239 +-
240 + if (radeon_debugfs_pm_init(rdev)) {
241 + DRM_ERROR("Failed to register debugfs file for PM!\n");
242 + }
243 +@@ -1218,20 +1210,6 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev)
244 + goto dpm_failed;
245 + rdev->pm.dpm_enabled = true;
246 +
247 +- ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state);
248 +- if (ret)
249 +- DRM_ERROR("failed to create device file for dpm state\n");
250 +- ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level);
251 +- if (ret)
252 +- DRM_ERROR("failed to create device file for dpm state\n");
253 +- /* XXX: these are noops for dpm but are here for backwards compat */
254 +- ret = device_create_file(rdev->dev, &dev_attr_power_profile);
255 +- if (ret)
256 +- DRM_ERROR("failed to create device file for power profile\n");
257 +- ret = device_create_file(rdev->dev, &dev_attr_power_method);
258 +- if (ret)
259 +- DRM_ERROR("failed to create device file for power method\n");
260 +-
261 + if (radeon_debugfs_pm_init(rdev)) {
262 + DRM_ERROR("Failed to register debugfs file for dpm!\n");
263 + }
264 +@@ -1371,9 +1349,44 @@ int radeon_pm_late_init(struct radeon_device *rdev)
265 + int ret = 0;
266 +
267 + if (rdev->pm.pm_method == PM_METHOD_DPM) {
268 +- mutex_lock(&rdev->pm.mutex);
269 +- ret = radeon_dpm_late_enable(rdev);
270 +- mutex_unlock(&rdev->pm.mutex);
271 ++ if (rdev->pm.dpm_enabled) {
272 ++ ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state);
273 ++ if (ret)
274 ++ DRM_ERROR("failed to create device file for dpm state\n");
275 ++ ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level);
276 ++ if (ret)
277 ++ DRM_ERROR("failed to create device file for dpm state\n");
278 ++ /* XXX: these are noops for dpm but are here for backwards compat */
279 ++ ret = device_create_file(rdev->dev, &dev_attr_power_profile);
280 ++ if (ret)
281 ++ DRM_ERROR("failed to create device file for power profile\n");
282 ++ ret = device_create_file(rdev->dev, &dev_attr_power_method);
283 ++ if (ret)
284 ++ DRM_ERROR("failed to create device file for power method\n");
285 ++
286 ++ mutex_lock(&rdev->pm.mutex);
287 ++ ret = radeon_dpm_late_enable(rdev);
288 ++ mutex_unlock(&rdev->pm.mutex);
289 ++ if (ret) {
290 ++ rdev->pm.dpm_enabled = false;
291 ++ DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n");
292 ++ } else {
293 ++ /* set the dpm state for PX since there won't be
294 ++ * a modeset to call this.
295 ++ */
296 ++ radeon_pm_compute_clocks(rdev);
297 ++ }
298 ++ }
299 ++ } else {
300 ++ if (rdev->pm.num_power_states > 1) {
301 ++ /* where's the best place to put these? */
302 ++ ret = device_create_file(rdev->dev, &dev_attr_power_profile);
303 ++ if (ret)
304 ++ DRM_ERROR("failed to create device file for power profile\n");
305 ++ ret = device_create_file(rdev->dev, &dev_attr_power_method);
306 ++ if (ret)
307 ++ DRM_ERROR("failed to create device file for power method\n");
308 ++ }
309 + }
310 + return ret;
311 + }
312 +diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
313 +index d0bdac0498ce..f7439c556413 100644
314 +--- a/drivers/i2c/busses/i2c-designware-platdrv.c
315 ++++ b/drivers/i2c/busses/i2c-designware-platdrv.c
316 +@@ -28,6 +28,7 @@
317 + #include <linux/kernel.h>
318 + #include <linux/module.h>
319 + #include <linux/delay.h>
320 ++#include <linux/dmi.h>
321 + #include <linux/i2c.h>
322 + #include <linux/clk.h>
323 + #include <linux/errno.h>
324 +@@ -53,6 +54,22 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)
325 + }
326 +
327 + #ifdef CONFIG_ACPI
328 ++/*
329 ++ * The HCNT/LCNT information coming from ACPI should be the most accurate
330 ++ * for given platform. However, some systems get it wrong. On such systems
331 ++ * we get better results by calculating those based on the input clock.
332 ++ */
333 ++static const struct dmi_system_id dw_i2c_no_acpi_params[] = {
334 ++ {
335 ++ .ident = "Dell Inspiron 7348",
336 ++ .matches = {
337 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
338 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7348"),
339 ++ },
340 ++ },
341 ++ { }
342 ++};
343 ++
344 + static void dw_i2c_acpi_params(struct platform_device *pdev, char method[],
345 + u16 *hcnt, u16 *lcnt, u32 *sda_hold)
346 + {
347 +@@ -60,6 +77,9 @@ static void dw_i2c_acpi_params(struct platform_device *pdev, char method[],
348 + acpi_handle handle = ACPI_HANDLE(&pdev->dev);
349 + union acpi_object *obj;
350 +
351 ++ if (dmi_check_system(dw_i2c_no_acpi_params))
352 ++ return;
353 ++
354 + if (ACPI_FAILURE(acpi_evaluate_object(handle, method, NULL, &buf)))
355 + return;
356 +
357 +diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
358 +index d3c5d6216575..32812d3e5411 100644
359 +--- a/drivers/i2c/busses/i2c-rcar.c
360 ++++ b/drivers/i2c/busses/i2c-rcar.c
361 +@@ -712,15 +712,16 @@ static int rcar_i2c_probe(struct platform_device *pdev)
362 + return ret;
363 + }
364 +
365 ++ pm_runtime_enable(dev);
366 ++ platform_set_drvdata(pdev, priv);
367 ++
368 + ret = i2c_add_numbered_adapter(adap);
369 + if (ret < 0) {
370 + dev_err(dev, "reg adap failed: %d\n", ret);
371 ++ pm_runtime_disable(dev);
372 + return ret;
373 + }
374 +
375 +- pm_runtime_enable(dev);
376 +- platform_set_drvdata(pdev, priv);
377 +-
378 + dev_info(dev, "probed\n");
379 +
380 + return 0;
381 +diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
382 +index 79a211782766..a272988f8f10 100644
383 +--- a/drivers/i2c/busses/i2c-s3c2410.c
384 ++++ b/drivers/i2c/busses/i2c-s3c2410.c
385 +@@ -1198,17 +1198,19 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
386 + i2c->adap.nr = i2c->pdata->bus_num;
387 + i2c->adap.dev.of_node = pdev->dev.of_node;
388 +
389 ++ platform_set_drvdata(pdev, i2c);
390 ++
391 ++ pm_runtime_enable(&pdev->dev);
392 ++
393 + ret = i2c_add_numbered_adapter(&i2c->adap);
394 + if (ret < 0) {
395 + dev_err(&pdev->dev, "failed to add bus to i2c core\n");
396 ++ pm_runtime_disable(&pdev->dev);
397 + s3c24xx_i2c_deregister_cpufreq(i2c);
398 + clk_unprepare(i2c->clk);
399 + return ret;
400 + }
401 +
402 +- platform_set_drvdata(pdev, i2c);
403 +-
404 +- pm_runtime_enable(&pdev->dev);
405 + pm_runtime_enable(&i2c->adap.dev);
406 +
407 + dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev));
408 +diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
409 +index c1120eb96d86..b94e4648c199 100644
410 +--- a/drivers/md/dm-thin.c
411 ++++ b/drivers/md/dm-thin.c
412 +@@ -2373,7 +2373,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv)
413 + metadata_low_callback,
414 + pool);
415 + if (r)
416 +- goto out_free_pt;
417 ++ goto out_flags_changed;
418 +
419 + pt->callbacks.congested_fn = pool_is_congested;
420 + dm_table_add_target_callbacks(ti->table, &pt->callbacks);
421 +diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
422 +index 6c9c16d76935..f606b5ba611f 100644
423 +--- a/drivers/net/ppp/pppoe.c
424 ++++ b/drivers/net/ppp/pppoe.c
425 +@@ -313,7 +313,6 @@ static void pppoe_flush_dev(struct net_device *dev)
426 + if (po->pppoe_dev == dev &&
427 + sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) {
428 + pppox_unbind_sock(sk);
429 +- sk->sk_state = PPPOX_ZOMBIE;
430 + sk->sk_state_change(sk);
431 + po->pppoe_dev = NULL;
432 + dev_put(dev);
433 +diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
434 +index 5d194093f3e1..816d511e34d3 100644
435 +--- a/drivers/net/usb/asix_devices.c
436 ++++ b/drivers/net/usb/asix_devices.c
437 +@@ -465,19 +465,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
438 + return ret;
439 + }
440 +
441 +- ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL);
442 +- if (ret < 0)
443 +- return ret;
444 +-
445 +- msleep(150);
446 +-
447 +- ret = asix_sw_reset(dev, AX_SWRESET_CLEAR);
448 +- if (ret < 0)
449 +- return ret;
450 +-
451 +- msleep(150);
452 +-
453 +- ret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_PRTE);
454 ++ ax88772_reset(dev);
455 +
456 + /* Read PHYID register *AFTER* the PHY was reset properly */
457 + phyid = asix_get_phyid(dev);
458 +@@ -890,7 +878,7 @@ static const struct driver_info ax88772_info = {
459 + .unbind = ax88772_unbind,
460 + .status = asix_status,
461 + .link_reset = ax88772_link_reset,
462 +- .reset = ax88772_reset,
463 ++ .reset = ax88772_link_reset,
464 + .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR | FLAG_MULTI_PACKET,
465 + .rx_fixup = asix_rx_fixup_common,
466 + .tx_fixup = asix_tx_fixup,
467 +diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
468 +index 6244f9cf8ae3..0529defbdf73 100644
469 +--- a/fs/btrfs/backref.c
470 ++++ b/fs/btrfs/backref.c
471 +@@ -1692,7 +1692,6 @@ static int iterate_inode_extrefs(u64 inum, struct btrfs_root *fs_root,
472 + int found = 0;
473 + struct extent_buffer *eb;
474 + struct btrfs_inode_extref *extref;
475 +- struct extent_buffer *leaf;
476 + u32 item_size;
477 + u32 cur_offset;
478 + unsigned long ptr;
479 +@@ -1720,9 +1719,8 @@ static int iterate_inode_extrefs(u64 inum, struct btrfs_root *fs_root,
480 + btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
481 + btrfs_release_path(path);
482 +
483 +- leaf = path->nodes[0];
484 +- item_size = btrfs_item_size_nr(leaf, slot);
485 +- ptr = btrfs_item_ptr_offset(leaf, slot);
486 ++ item_size = btrfs_item_size_nr(eb, slot);
487 ++ ptr = btrfs_item_ptr_offset(eb, slot);
488 + cur_offset = 0;
489 +
490 + while (cur_offset < item_size) {
491 +@@ -1736,7 +1734,7 @@ static int iterate_inode_extrefs(u64 inum, struct btrfs_root *fs_root,
492 + if (ret)
493 + break;
494 +
495 +- cur_offset += btrfs_inode_extref_name_len(leaf, extref);
496 ++ cur_offset += btrfs_inode_extref_name_len(eb, extref);
497 + cur_offset += sizeof(*extref);
498 + }
499 + btrfs_tree_read_unlock_blocking(eb);
500 +diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h
501 +index 1cd3f5d767a8..54352f4dde1a 100644
502 +--- a/include/asm-generic/preempt.h
503 ++++ b/include/asm-generic/preempt.h
504 +@@ -74,9 +74,10 @@ static __always_inline bool __preempt_count_dec_and_test(void)
505 + /*
506 + * Returns true when we need to resched and can (barring IRQ state).
507 + */
508 +-static __always_inline bool should_resched(void)
509 ++static __always_inline bool should_resched(int preempt_offset)
510 + {
511 +- return unlikely(!preempt_count() && tif_need_resched());
512 ++ return unlikely(preempt_count() == preempt_offset &&
513 ++ tif_need_resched());
514 + }
515 +
516 + #ifdef CONFIG_PREEMPT
517 +diff --git a/include/linux/preempt.h b/include/linux/preempt.h
518 +index 1841b58cf173..411a5c6371da 100644
519 +--- a/include/linux/preempt.h
520 ++++ b/include/linux/preempt.h
521 +@@ -22,7 +22,8 @@
522 + #if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER)
523 + extern void preempt_count_add(int val);
524 + extern void preempt_count_sub(int val);
525 +-#define preempt_count_dec_and_test() ({ preempt_count_sub(1); should_resched(); })
526 ++#define preempt_count_dec_and_test() \
527 ++ ({ preempt_count_sub(1); should_resched(0); })
528 + #else
529 + #define preempt_count_add(val) __preempt_count_add(val)
530 + #define preempt_count_sub(val) __preempt_count_sub(val)
531 +@@ -61,7 +62,7 @@ do { \
532 +
533 + #define preempt_check_resched() \
534 + do { \
535 +- if (should_resched()) \
536 ++ if (should_resched(0)) \
537 + __preempt_schedule(); \
538 + } while (0)
539 +
540 +diff --git a/include/linux/preempt_mask.h b/include/linux/preempt_mask.h
541 +index dbeec4d4a3be..5cb25f17331a 100644
542 +--- a/include/linux/preempt_mask.h
543 ++++ b/include/linux/preempt_mask.h
544 +@@ -71,13 +71,21 @@
545 + */
546 + #define in_nmi() (preempt_count() & NMI_MASK)
547 +
548 ++/*
549 ++ * The preempt_count offset after preempt_disable();
550 ++ */
551 + #if defined(CONFIG_PREEMPT_COUNT)
552 +-# define PREEMPT_CHECK_OFFSET 1
553 ++# define PREEMPT_DISABLE_OFFSET PREEMPT_OFFSET
554 + #else
555 +-# define PREEMPT_CHECK_OFFSET 0
556 ++# define PREEMPT_DISABLE_OFFSET 0
557 + #endif
558 +
559 + /*
560 ++ * The preempt_count offset after spin_lock()
561 ++ */
562 ++#define PREEMPT_LOCK_OFFSET PREEMPT_DISABLE_OFFSET
563 ++
564 ++/*
565 + * The preempt_count offset needed for things like:
566 + *
567 + * spin_lock_bh()
568 +@@ -90,7 +98,7 @@
569 + *
570 + * Work as expected.
571 + */
572 +-#define SOFTIRQ_LOCK_OFFSET (SOFTIRQ_DISABLE_OFFSET + PREEMPT_CHECK_OFFSET)
573 ++#define SOFTIRQ_LOCK_OFFSET (SOFTIRQ_DISABLE_OFFSET + PREEMPT_LOCK_OFFSET)
574 +
575 + /*
576 + * Are we running in atomic context? WARNING: this macro cannot
577 +@@ -106,7 +114,7 @@
578 + * (used by the scheduler, *after* releasing the kernel lock)
579 + */
580 + #define in_atomic_preempt_off() \
581 +- ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET)
582 ++ ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_DISABLE_OFFSET)
583 +
584 + #ifdef CONFIG_PREEMPT_COUNT
585 + # define preemptible() (preempt_count() == 0 && !irqs_disabled())
586 +diff --git a/include/linux/sched.h b/include/linux/sched.h
587 +index 91fe6a38b307..ec6000f66e75 100644
588 +--- a/include/linux/sched.h
589 ++++ b/include/linux/sched.h
590 +@@ -2647,12 +2647,6 @@ extern int _cond_resched(void);
591 +
592 + extern int __cond_resched_lock(spinlock_t *lock);
593 +
594 +-#ifdef CONFIG_PREEMPT_COUNT
595 +-#define PREEMPT_LOCK_OFFSET PREEMPT_OFFSET
596 +-#else
597 +-#define PREEMPT_LOCK_OFFSET 0
598 +-#endif
599 +-
600 + #define cond_resched_lock(lock) ({ \
601 + __might_sleep(__FILE__, __LINE__, PREEMPT_LOCK_OFFSET); \
602 + __cond_resched_lock(lock); \
603 +diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
604 +index ab3133797ff7..d8bec47b6edd 100644
605 +--- a/include/linux/skbuff.h
606 ++++ b/include/linux/skbuff.h
607 +@@ -2347,6 +2347,9 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb,
608 + {
609 + if (skb->ip_summed == CHECKSUM_COMPLETE)
610 + skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0));
611 ++ else if (skb->ip_summed == CHECKSUM_PARTIAL &&
612 ++ skb_checksum_start_offset(skb) < 0)
613 ++ skb->ip_summed = CHECKSUM_NONE;
614 + }
615 +
616 + unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
617 +diff --git a/include/net/af_unix.h b/include/net/af_unix.h
618 +index a175ba4a7adb..dfe4ddfbb43c 100644
619 +--- a/include/net/af_unix.h
620 ++++ b/include/net/af_unix.h
621 +@@ -64,7 +64,11 @@ struct unix_sock {
622 + #define UNIX_GC_MAYBE_CYCLE 1
623 + struct socket_wq peer_wq;
624 + };
625 +-#define unix_sk(__sk) ((struct unix_sock *)__sk)
626 ++
627 ++static inline struct unix_sock *unix_sk(struct sock *sk)
628 ++{
629 ++ return (struct unix_sock *)sk;
630 ++}
631 +
632 + #define peer_wait peer_wq.wait
633 +
634 +diff --git a/include/net/sock.h b/include/net/sock.h
635 +index 0c79a740e97d..ff4f825647a5 100644
636 +--- a/include/net/sock.h
637 ++++ b/include/net/sock.h
638 +@@ -805,6 +805,14 @@ static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *s
639 + if (sk_rcvqueues_full(sk, skb, limit))
640 + return -ENOBUFS;
641 +
642 ++ /*
643 ++ * If the skb was allocated from pfmemalloc reserves, only
644 ++ * allow SOCK_MEMALLOC sockets to use it as this socket is
645 ++ * helping free memory
646 ++ */
647 ++ if (skb_pfmemalloc(skb) && !sock_flag(sk, SOCK_MEMALLOC))
648 ++ return -ENOMEM;
649 ++
650 + __sk_add_backlog(sk, skb);
651 + sk->sk_backlog.len += skb->truesize;
652 + return 0;
653 +diff --git a/kernel/sched/core.c b/kernel/sched/core.c
654 +index a19262a7d70b..bbe957762ace 100644
655 +--- a/kernel/sched/core.c
656 ++++ b/kernel/sched/core.c
657 +@@ -4113,7 +4113,7 @@ static void __cond_resched(void)
658 +
659 + int __sched _cond_resched(void)
660 + {
661 +- if (should_resched()) {
662 ++ if (should_resched(0)) {
663 + __cond_resched();
664 + return 1;
665 + }
666 +@@ -4131,7 +4131,7 @@ EXPORT_SYMBOL(_cond_resched);
667 + */
668 + int __cond_resched_lock(spinlock_t *lock)
669 + {
670 +- int resched = should_resched();
671 ++ int resched = should_resched(PREEMPT_LOCK_OFFSET);
672 + int ret = 0;
673 +
674 + lockdep_assert_held(lock);
675 +@@ -4153,7 +4153,7 @@ int __sched __cond_resched_softirq(void)
676 + {
677 + BUG_ON(!in_softirq());
678 +
679 +- if (should_resched()) {
680 ++ if (should_resched(SOFTIRQ_DISABLE_OFFSET)) {
681 + local_bh_enable();
682 + __cond_resched();
683 + local_bh_disable();
684 +diff --git a/kernel/workqueue.c b/kernel/workqueue.c
685 +index 423c9e37a9e7..646a8b81bee1 100644
686 +--- a/kernel/workqueue.c
687 ++++ b/kernel/workqueue.c
688 +@@ -1475,13 +1475,13 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
689 + timer_stats_timer_set_start_info(&dwork->timer);
690 +
691 + dwork->wq = wq;
692 ++ /* timer isn't guaranteed to run in this cpu, record earlier */
693 ++ if (cpu == WORK_CPU_UNBOUND)
694 ++ cpu = raw_smp_processor_id();
695 + dwork->cpu = cpu;
696 + timer->expires = jiffies + delay;
697 +
698 +- if (unlikely(cpu != WORK_CPU_UNBOUND))
699 +- add_timer_on(timer, cpu);
700 +- else
701 +- add_timer(timer);
702 ++ add_timer_on(timer, cpu);
703 + }
704 +
705 + /**
706 +diff --git a/net/core/ethtool.c b/net/core/ethtool.c
707 +index 30071dec287a..0b39ab6f7675 100644
708 +--- a/net/core/ethtool.c
709 ++++ b/net/core/ethtool.c
710 +@@ -1080,7 +1080,7 @@ static int ethtool_get_strings(struct net_device *dev, void __user *useraddr)
711 +
712 + gstrings.len = ret;
713 +
714 +- data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER);
715 ++ data = kcalloc(gstrings.len, ETH_GSTRING_LEN, GFP_USER);
716 + if (!data)
717 + return -ENOMEM;
718 +
719 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
720 +index 8207f8d7f665..366f7ff741b7 100644
721 +--- a/net/core/skbuff.c
722 ++++ b/net/core/skbuff.c
723 +@@ -2862,11 +2862,12 @@ EXPORT_SYMBOL(skb_append_datato_frags);
724 + */
725 + unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len)
726 + {
727 ++ unsigned char *data = skb->data;
728 ++
729 + BUG_ON(len > skb->len);
730 +- skb->len -= len;
731 +- BUG_ON(skb->len < skb->data_len);
732 +- skb_postpull_rcsum(skb, skb->data, len);
733 +- return skb->data += len;
734 ++ __skb_pull(skb, len);
735 ++ skb_postpull_rcsum(skb, data, len);
736 ++ return skb->data;
737 + }
738 + EXPORT_SYMBOL_GPL(skb_pull_rcsum);
739 +
740 +diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
741 +index 85d9d94c0a3c..3679bd6000d7 100644
742 +--- a/net/l2tp/l2tp_core.c
743 ++++ b/net/l2tp/l2tp_core.c
744 +@@ -1435,7 +1435,7 @@ static void l2tp_tunnel_del_work(struct work_struct *work)
745 + tunnel = container_of(work, struct l2tp_tunnel, del_work);
746 + sk = l2tp_tunnel_sock_lookup(tunnel);
747 + if (!sk)
748 +- return;
749 ++ goto out;
750 +
751 + sock = sk->sk_socket;
752 +
753 +@@ -1456,6 +1456,8 @@ static void l2tp_tunnel_del_work(struct work_struct *work)
754 + }
755 +
756 + l2tp_tunnel_sock_put(sk);
757 ++out:
758 ++ l2tp_tunnel_dec_refcount(tunnel);
759 + }
760 +
761 + /* Create a socket for the tunnel, if one isn't set up by
762 +@@ -1785,8 +1787,13 @@ EXPORT_SYMBOL_GPL(l2tp_tunnel_create);
763 + */
764 + int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel)
765 + {
766 ++ l2tp_tunnel_inc_refcount(tunnel);
767 + l2tp_tunnel_closeall(tunnel);
768 +- return (false == queue_work(l2tp_wq, &tunnel->del_work));
769 ++ if (false == queue_work(l2tp_wq, &tunnel->del_work)) {
770 ++ l2tp_tunnel_dec_refcount(tunnel);
771 ++ return 1;
772 ++ }
773 ++ return 0;
774 + }
775 + EXPORT_SYMBOL_GPL(l2tp_tunnel_delete);
776 +
777 +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
778 +index 4757f1cf6237..4affedbe0206 100644
779 +--- a/net/unix/af_unix.c
780 ++++ b/net/unix/af_unix.c
781 +@@ -1956,6 +1956,11 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
782 + goto out;
783 + }
784 +
785 ++ if (flags & MSG_PEEK)
786 ++ skip = sk_peek_offset(sk, flags);
787 ++ else
788 ++ skip = 0;
789 ++
790 + do {
791 + int chunk;
792 + struct sk_buff *skb, *last;
793 +@@ -2002,7 +2007,6 @@ again:
794 + break;
795 + }
796 +
797 +- skip = sk_peek_offset(sk, flags);
798 + while (skip >= unix_skb_len(skb)) {
799 + skip -= unix_skb_len(skb);
800 + last = skb;
801 +@@ -2066,6 +2070,16 @@ again:
802 +
803 + sk_peek_offset_fwd(sk, chunk);
804 +
805 ++ if (UNIXCB(skb).fp)
806 ++ break;
807 ++
808 ++ skip = 0;
809 ++ last = skb;
810 ++ unix_state_lock(sk);
811 ++ skb = skb_peek_next(skb, &sk->sk_receive_queue);
812 ++ if (skb)
813 ++ goto again;
814 ++ unix_state_unlock(sk);
815 + break;
816 + }
817 + } while (size);