3.16.62-rc1 review
Subsystems (6)
PATCH 4/328 audit: Fix extended comparison of GID/EGID
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ondrej Mosnáček <[email protected]>
commit af85d1772e31fed34165a1b3decef340cf4080c0 upstream.
The audit_filter_rules() function in auditsc.c used the in_[e]group_p() functions to check GID/EGID match, but these functions use the current task's credentials, while the comparison should use the credentials of the task given to audit_filter_rules() as a parameter (tsk).
Note that we can use group_search(cred->group_info, ...) as a replacement for both in_group_p and in_egroup_p as these functions only compare the parameter to cred->fsgid/egid and then call group_search.
In fact, the usage of in_group_p was even more incorrect: it compares to cred->fsgid (which is usually equal to cred->egid) and not cred->gid.
GitHub issue:
https://github.com/linux-audit/audit-kernel/issues/82
--- kernel/auditsc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/auditsc.c +4 -4
@@ -489,20 +489,20 @@ static int audit_filter_rules(struct tas result =audit_gid_comparator (cred->gid, f->op, f->gid);if (f->op == Audit_equal) {if (!result) - result =in_group_p (f->gid); + result =groups_search (cred->group_info, f->gid); }else if (f->op == Audit_not_equal) {if (result) - result = !in_group_p (f->gid); + result = !groups_search (cred->group_info, f->gid); }break ;case AUDIT_EGID : result =audit_gid_comparator (cred->egid, f->op, f->gid);if (f->op == Audit_equal) {if (!result) - result =in_egroup_p (f->gid); + result =groups_search (cred->group_info, f->gid); }else if (f->op == Audit_not_equal) {if (result) - result = !in_egroup_p (f->gid); + result = !groups_search (cred->group_info, f->gid); }break ;case AUDIT_SGID :
PATCH 5/328 kprobes: Make list and blacklist root user read only
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu <[email protected]>
commit f2a3ab36077222437b4826fc76111caa14562b7c upstream.
Since the blacklist and list files on debugfs indicates a sensitive address information to reader, it should be restricted to the root user.
--- kernel/kprobes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/kprobes.c +2 -2
@@ -2414,7 +2414,7 @@ static int __init debugfs_kprobe_init(voif (!dir)return -ENOMEM ; - file =debugfs_create_file ("list" ,0444 , dir,NULL , + file =debugfs_create_file ("list" ,0400 , dir,NULL , &debugfs_kprobes_operations);if (!file) goto error;
@@ -2424,7 +2424,7 @@ static int __init debugfs_kprobe_init(voif (!file) goto error; - file =debugfs_create_file ("blacklist" ,0444 , dir,NULL , + file =debugfs_create_file ("blacklist" ,0400 , dir,NULL , &debugfs_kprobe_blacklist_ops);if (!file) goto error;
PATCH 7/328 USB: serial: sierra: fix potential deadlock at close
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: John Ogness <[email protected]>
commit e60870012e5a35b1506d7b376fddfb30e9da0b27 upstream.
The portdata spinlock can be taken in interrupt context (via sierra_outdat_callback()).
Disable interrupts when taking the portdata spinlock when discarding deferred URBs during close to prevent a possible deadlock.
--- drivers/usb/serial/sierra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/serial/sierra.c +2 -2
@@ -772,9 +772,9 @@ static void sierra_close(struct usb_serikfree (urb->transfer_buffer);usb_free_urb (urb);usb_autopm_put_interface_async (serial->interface); -spin_lock (&portdata->lock); +spin_lock_irq (&portdata->lock); portdata->outstanding_urbs--; -spin_unlock (&portdata->lock); +spin_unlock_irq (&portdata->lock); }sierra_stop_rx_urbs (port);
PATCH 8/328 platform/x86: ideapad-laptop: Add Y520-15IKBN to no_hw_rfkill
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Olle Liljenzin <[email protected]>
commit 5d9f40b56630a8702b5f7a61a770f9b73aa07464 upstream.
Lenovo Legion Y520-15IKBN is yet another Lenovo model that does not have an hw rfkill switch, resulting in wifi always reported as hard blocked.
Add the model to the list of models without rfkill switch.
--- drivers/platform/x86/ideapad-laptop.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/ideapad-laptop.c +7 -0
@@ -860,6 +860,13 @@ static struct dmi_system_id no_hw_rfkill }, }, { + .ident = "Lenovo Legion Y520-15IKBN", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Y520-15IKBN"), + }, + }, + { .ident ="Lenovo Yoga 2 11 / 13 / Pro" , .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
PATCH 12/328 media: omap3isp: zero-initialize the isp cam_xclk{a,b} initial data
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Javier Martinez Canillas <[email protected]>
commit 2ec7debd44b49927a6e2861521994cc075a389ed upstream.
The struct clk_init_data init variable is declared in the isp_xclk_init() function so is an automatic variable allocated in the stack. But it's not explicitly zero-initialized, so some init fields are left uninitialized.
This causes the data structure to have undefined values that may confuse the common clock framework when the clock is registered.
For example, the uninitialized .flags field could have the CLK_IS_CRITICAL bit set, causing the framework to wrongly prepare the clk on registration. This leads to the isp_xclk_prepare() callback being called, which in turn calls to the omap3isp_get() function that increments the isp dev refcount.
Since this omap3isp_get() call is unexpected, this leads to an unbalanced omap3isp_get() call that prevents the requested IRQ to be later enabled, due the refcount not being 0 when the correct omap3isp_get() call happens.
--- drivers/media/platform/omap3isp/isp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/omap3isp/isp.c +1 -1
@@ -282,7 +282,7 @@ static const char *isp_xclk_parent_namestatic int isp_xclk_init (struct isp_device *isp) {struct isp_platform_data *pdata = isp->pdata; -struct clk_init_data init; +struct clk_init_data init = {0 };unsigned int i;for (i =0 ; i <ARRAY_SIZE (isp->xclks); ++i)
PATCH 16/328 crypto: memzero_explicit - make sure to clear out sensitive data
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
commit 7185ad2672a7d50bc384de0e38d90b75d99f3d82 upstream.
Recently, in commit 13aa93c70e71 ("random: add and use memzero_explicit() for clearing data"), we have found that GCC may optimize some memset() cases away when it detects a stack variable is not being used anymore and going out of scope. This can happen, for example, in cases when we are clearing out sensitive information such as keying material or any e.g. intermediate results from crypto computations, etc.
With the help of Coccinelle, we can figure out and fix such occurences in the crypto subsytem as well. Julia Lawall provided the following Coccinelle program:
@@
type T;
identifier x;
@@
T x;
... when exists
when any
-memset
+memzero_explicit
(&x,
-0,
...) ... when != x
when strict
@@
type T;
identifier x;
@@
T x[...];
... when exists
when any
-memset
+memzero_explicit
(x,
-0,
...)
... when != x
when strictTherefore, make use of the drop-in replacement memzero_explicit() for exactly such cases instead of using memset().
--- crypto/cts.c | 3 ++- crypto/sha1_generic.c | 2 +- crypto/sha256_generic.c | 5 ++--- crypto/sha512_generic.c | 2 +- crypto/tgr192.c | 4 ++-- crypto/vmac.c | 2 +- crypto/wp512.c | 8 ++++---- 7 files changed, 13 insertions(+), 13 deletions(-)
crypto/cts.c +2 -1
@@ -202,7 +202,8 @@ static int cts_cbc_decrypt(struct crypto/* 5. Append the tail (BB - Ln) bytes of Xn (tmp) to Cn to create En */ memcpy (s + bsize + lastn, tmp + lastn, bsize - lastn);/* 6. Decrypt En to create Pn-1 */ -memset (iv,0 ,sizeof (iv)); +memzero_explicit (iv,sizeof (iv)); +sg_set_buf (&sgsrc[0 ], s + bsize, bsize);sg_set_buf (&sgdst[0 ], d, bsize); err =crypto_blkcipher_decrypt_iv (&lcldesc, sgdst, sgsrc, bsize);
crypto/sha1_generic.c +1 -1
@@ -64,7 +64,7 @@ int crypto_sha1_update(struct shash_desc src = data + done; }while (done +SHA1_BLOCK_SIZE <= len); -memset (temp,0 ,sizeof (temp)); +memzero_explicit (temp,sizeof (temp)); partial =0 ; }memcpy (sctx->buffer + partial, src, len - done);
crypto/sha256_generic.c +2 -3
@@ -210,10 +210,9 @@ static void sha256_transform(u32 *state,/* clear any sensitive info... */ a = b = c = d = e = f = g = h = t1 = t2 =0 ; -memset (W ,0 ,64 *sizeof (u32)); +memzero_explicit (W ,64 *sizeof (u32)); } -static int sha224_init (struct shash_desc *desc) {struct sha256_state *sctx =shash_desc_ctx (desc);
@@ -316,7 +315,7 @@ static int sha224_final(struct shash_dessha256_final (desc,D );memcpy (hash,D ,SHA224_DIGEST_SIZE ); -memset (D ,0 ,SHA256_DIGEST_SIZE ); +memzero_explicit (D ,SHA256_DIGEST_SIZE );return 0 ; }
crypto/sha512_generic.c +1 -1
@@ -238,7 +238,7 @@ static int sha384_final(struct shash_dessha512_final (desc,D );memcpy (hash,D ,48 ); -memset (D ,0 ,64 ); +memzero_explicit (D ,64 );return 0 ; }
crypto/tgr192.c +2 -2
@@ -612,7 +612,7 @@ static int tgr160_final(struct shash_destgr192_final (desc,D );memcpy (out,D ,TGR160_DIGEST_SIZE ); -memset (D ,0 ,TGR192_DIGEST_SIZE ); +memzero_explicit (D ,TGR192_DIGEST_SIZE );return 0 ; }
@@ -623,7 +623,7 @@ static int tgr128_final(struct shash_destgr192_final (desc,D );memcpy (out,D ,TGR128_DIGEST_SIZE ); -memset (D ,0 ,TGR192_DIGEST_SIZE ); +memzero_explicit (D ,TGR192_DIGEST_SIZE );return 0 ; }
crypto/vmac.c +1 -1
@@ -613,7 +613,7 @@ static int vmac_final(struct shash_desc } mac =vmac (ctx->partial, ctx->partial_size, nonce,NULL , ctx);memcpy (out, &mac,sizeof (vmac_t)); -memset (&mac,0 ,sizeof (vmac_t)); +memzero_explicit (&mac,sizeof (vmac_t));memset (&ctx->__vmac_ctx,0 ,sizeof (struct vmac_ctx )); ctx->partial_size =0 ;return 0 ;
crypto/wp512.c +4 -4
@@ -1102,8 +1102,8 @@ static int wp384_final(struct shash_descu8 D [64 ];wp512_final (desc,D ); -memcpy (out,D ,WP384_DIGEST_SIZE ); -memset (D ,0 ,WP512_DIGEST_SIZE ); +memcpy (out,D ,WP384_DIGEST_SIZE ); +memzero_explicit (D ,WP512_DIGEST_SIZE );return 0 ; }
@@ -1113,8 +1113,8 @@ static int wp256_final(struct shash_descu8 D [64 ];wp512_final (desc,D ); -memcpy (out,D ,WP256_DIGEST_SIZE ); -memset (D ,0 ,WP512_DIGEST_SIZE ); +memcpy (out,D ,WP256_DIGEST_SIZE ); +memzero_explicit (D ,WP512_DIGEST_SIZE );return 0 ; }
PATCH 20/328 leds: max8997: use mode when calling max8997_led_set_mode
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit 7a5de56db902ea632a0ff0c2b47481d278db645f upstream.
Variable mode is assigned to pdata->led_pdata->mode[led->id] and yet is not being used when calling function max8997_led_set_mode. Fix this by using mode when calling max8997_led_set_mode.
Cleans up clang warning:
warning: variable 'mode' set but not used [-Wunused-but-set-variable]
--- drivers/leds/leds-max8997.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-max8997.c +1 -1
@@ -262,7 +262,7 @@ static int max8997_led_probe(struct plat mode = pdata->led_pdata->mode[led->id]; brightness = pdata->led_pdata->brightness[led->id]; -max8997_led_set_mode (led, pdata->led_pdata->mode[led->id]); +max8997_led_set_mode (led, mode);if (brightness > led->cdev.max_brightness) brightness = led->cdev.max_brightness;
PATCH 23/328 USB: serial: kobil_sct: fix modem-status error handling
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit a420b5d939ee58f1d950f0ea782834056520aeaa upstream.
Make sure to return -EIO in case of a short modem-status read request.
While at it, split the debug message to not include the (zeroed) transfer-buffer content in case of errors.
--- drivers/usb/serial/kobil_sct.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/usb/serial/kobil_sct.c +10 -2
@@ -408,12 +408,20 @@ static int kobil_tiocmget(struct tty_str transfer_buffer_length, KOBIL_TIMEOUT); -dev_dbg (&port->dev,"%s - Send get_status_line_state URB returns: %i. Statusline: %02x\n" , - __func__, result, transfer_buffer[0 ]); +dev_dbg (&port->dev,"Send get_status_line_state URB returns: %i\n" , + result); +if (result <1 ) { +if (result >=0 ) + result = -EIO ; + goto out_free; + } + +dev_dbg (&port->dev,"Statusline: %02x\n" , transfer_buffer[0 ]); result =0 ;if ((transfer_buffer[0 ] &SUSBCR_GSL_DSR ) !=0 ) result =TIOCM_DSR ; +out_free:kfree (transfer_buffer);return result; }
PATCH 29/328 vxlan: fix default fdb entry netlink notify ordering during netdev create
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Roopa Prabhu <[email protected]>
commit 0241b836732f5f43c3f0fd9e9073c1fb24ea6757 upstream.
Problem:
In vxlan_newlink, a default fdb entry is added before register_netdev. The default fdb creation function also notifies user-space of the fdb entry on the vxlan device which user-space does not know about yet. (RTM_NEWNEIGH goes before RTM_NEWLINK for the same ifindex).
This patch fixes the user-space netlink notification ordering issue with the following changes:
- decouple fdb notify from fdb create.
- Move fdb notify after register_netdev.
- Call rtnl_configure_link in vxlan newlink handler to notify userspace about the newlink before fdb notify and
hence avoiding the user-space race.
[bwh: Backported to 3.16:
- Drop changes to vxlan_changelink()
- Drop last argument to vxlan_fdb_destroy()
- Adjust context]
---
drivers/net/vxlan.c +17 -5
@@ -2614,6 +2614,7 @@ static int vxlan_newlink(struct net *netstruct vxlan_net *vn =net_generic (net, vxlan_net_id);struct vxlan_dev *vxlan =netdev_priv (dev), *tmp;struct vxlan_rdst *dst = &vxlan->default_dst; +struct vxlan_fdb *f =NULL ;__u32 vni;int err;bool use_ipv6 = false;
@@ -2751,27 +2752,38 @@ static int vxlan_newlink(struct net *net/* create an fdb entry for a valid default destination */ if (!vxlan_addr_any (&vxlan->default_dst.remote_ip)) { - err =vxlan_fdb_update (vxlan, all_zeros_mac, + err =vxlan_fdb_create (vxlan, all_zeros_mac, &vxlan->default_dst.remote_ip,NUD_REACHABLE |NUD_PERMANENT , -NLM_F_EXCL |NLM_F_CREATE , vxlan->dst_port, vxlan->default_dst.remote_vni, vxlan->default_dst.remote_ifindex, -NTF_SELF ); +NTF_SELF , &f);if (err)return err; } err =register_netdevice (dev); +if (err) + goto errout; + + err =rtnl_configure_link (dev,NULL );if (err) { -vxlan_fdb_delete_default (vxlan); -return err; +unregister_netdevice (dev); + goto errout; } +/* notify default fdb entry */ +if (f) +vxlan_fdb_notify (vxlan, f,first_remote_rtnl (f),RTM_NEWNEIGH ); +list_add (&vxlan->next, &vn->vxlan_list);return 0 ; +errout: +if (f) +vxlan_fdb_destroy (vxlan, f); +return err; }static void vxlan_dellink (struct net_device *dev,struct list_head *head)
PATCH 36/328 mei: bus: type promotion bug in mei_nfc_if_version()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit b40b3e9358fbafff6a4ba0f4b9658f6617146f9c upstream.
We accidentally removed the check for negative returns without considering the issue of type promotion.
The "if_version_length" variable is type size_t so if __mei_cl_recv() returns a negative then "bytes_recv" is type promoted
to a high positive value and treated as success.
--- drivers/misc/mei/nfc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/mei/nfc.c +1 -1
@@ -292,7 +292,7 @@ static int mei_nfc_if_version(struct meireturn -ENOMEM ; bytes_recv =__mei_cl_recv (cl, (u8 *)reply, if_version_length); -if (bytes_recv < if_version_length) { +if (bytes_recv <0 || bytes_recv < if_version_length) {dev_err (&dev->pdev->dev,"Could not read IF version\n" ); ret = -EIO ; goto err;
PATCH 37/328 uart: fix race between uart_put_char() and uart_shutdown()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tycho Andersen <[email protected]>
commit a5ba1d95e46ecaea638ddd7cd144107c783acb5d upstream.
We have reports of the following crash:
PID: 7 TASK: ffff88085c6d61c0 CPU: 1 COMMAND: "kworker/u25:0"
#0 [ffff88085c6db710] machine_kexec at ffffffff81046239
#1 [ffff88085c6db760] crash_kexec at ffffffff810fc248
#2 [ffff88085c6db830] oops_end at ffffffff81008ae7
#3 [ffff88085c6db860] no_context at ffffffff81050b8f
#4 [ffff88085c6db8b0] __bad_area_nosemaphore at ffffffff81050d75
#5 [ffff88085c6db900] bad_area_nosemaphore at ffffffff81050e83
#6 [ffff88085c6db910] __do_page_fault at ffffffff8105132e
#7 [ffff88085c6db9b0] do_page_fault at ffffffff8105152c
#8 [ffff88085c6db9c0] page_fault at ffffffff81a3f122
[exception RIP: uart_put_char+149]
RIP: ffffffff814b67b5 RSP: ffff88085c6dba78 RFLAGS: 00010006
RAX: 0000000000000292 RBX: ffffffff827c5120 RCX: 0000000000000081
RDX: 0000000000000000 RSI: 000000000000005f RDI: ffffffff827c5120
RBP: ffff88085c6dba98 R8: 000000000000012c R9: ffffffff822ea320
R10: ffff88085fe4db04 R11: 0000000000000001 R12: ffff881059f9c000
R13: 0000000000000001 R14: 000000000000005f R15: 0000000000000fba
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
#9 [ffff88085c6dbaa0] tty_put_char at ffffffff81497544
#10 [ffff88085c6dbac0] do_output_char at ffffffff8149c91c
#11 [ffff88085c6dbae0] __process_echoes at ffffffff8149cb8b
#12 [ffff88085c6dbb30] commit_echoes at ffffffff8149cdc2
#13 [ffff88085c6dbb60] n_tty_receive_buf_fast at ffffffff8149e49b
#14 [ffff88085c6dbbc0] __receive_buf at ffffffff8149ef5a
#15 [ffff88085c6dbc20] n_tty_receive_buf_common at ffffffff8149f016
#16 [ffff88085c6dbca0] n_tty_receive_buf2 at ffffffff8149f194
#17 [ffff88085c6dbcb0] flush_to_ldisc at ffffffff814a238a
#18 [ffff88085c6dbd50] process_one_work at ffffffff81090be2
#19 [ffff88085c6dbe20] worker_thread at ffffffff81091b4d
#20 [ffff88085c6dbeb0] kthread at ffffffff81096384
#21 [ffff88085c6dbf50] ret_from_fork at ffffffff81a3d69fafter slogging through some dissasembly:
ffffffff814b6720 <uart_put_char>:
ffffffff814b6720: 55 push %rbp ffffffff814b6721: 48 89 e5 mov %rsp,%rbp ffffffff814b6724: 48 83 ec 20 sub $0x20,%rsp ffffffff814b6728: 48 89 1c 24 mov %rbx,(%rsp) ffffffff814b672c: 4c 89 64 24 08 mov %r12,0x8(%rsp) ffffffff814b6731: 4c 89 6c 24 10 mov %r13,0x10(%rsp) ffffffff814b6736: 4c 89 74 24 18 mov %r14,0x18(%rsp) ffffffff814b673b: e8 b0 8e 58 00 callq ffffffff81a3f5f0 <mcount> ffffffff814b6740: 4c 8b a7 88 02 00 00 mov 0x288(%rdi),%r12 ffffffff814b6747: 45 31 ed xor %r13d,%r13d ffffffff814b674a: 41 89 f6 mov %esi,%r14d ffffffff814b674d: 49 83 bc 24 70 01 00 cmpq $0x0,0x170(%r12) ffffffff814b6754: 00 00 ffffffff814b6756: 49 8b 9c 24 80 01 00 mov 0x180(%r12),%rbx ffffffff814b675d: 00 ffffffff814b675e: 74 2f je ffffffff814b678f <uart_put_char+0x6f> ffffffff814b6760: 48 89 df mov %rbx,%rdi ffffffff814b6763: e8 a8 67 58 00 callq ffffffff81a3cf10 <_raw_spin_lock_irqsave> ffffffff814b6768: 41 8b 8c 24 78 01 00 mov 0x178(%r12),%ecx ffffffff814b676f: 00 ffffffff814b6770: 89 ca mov %ecx,%edx ffffffff814b6772: f7 d2 not %edx ffffffff814b6774: 41 03 94 24 7c 01 00 add 0x17c(%r12),%edx ffffffff814b677b: 00 ffffffff814b677c: 81 e2 ff 0f 00 00 and $0xfff,%edx ffffffff814b6782: 75 23 jne ffffffff814b67a7 <uart_put_char+0x87> ffffffff814b6784: 48 89 c6 mov %rax,%rsi ffffffff814b6787: 48 89 df mov %rbx,%rdi ffffffff814b678a: e8 e1 64 58 00 callq ffffffff81a3cc70 <_raw_spin_unlock_irqrestore> ffffffff814b678f: 44 89 e8 mov %r13d,%eax ffffffff814b6792: 48 8b 1c 24 mov (%rsp),%rbx ffffffff814b6796: 4c 8b 64 24 08 mov 0x8(%rsp),%r12 ffffffff814b679b: 4c 8b 6c 24 10 mov 0x10(%rsp),%r13 ffffffff814b67a0: 4c 8b 74 24 18 mov 0x18(%rsp),%r14 ffffffff814b67a5: c9 leaveq ffffffff814b67a6: c3 retq ffffffff814b67a7: 49 8b 94 24 70 01 00 mov 0x170(%r12),%rdx ffffffff814b67ae: 00 ffffffff814b67af: 48 63 c9 movslq %ecx,%rcx ffffffff814b67b2: 41 b5 01 mov $0x1,%r13b ffffffff814b67b5: 44 88 34 0a mov %r14b,(%rdx,%rcx,1) ffffffff814b67b9: 41 8b 94 24 78 01 00 mov 0x178(%r12),%edx ffffffff814b67c0: 00 ffffffff814b67c1: 83 c2 01 add $0x1,%edx ffffffff814b67c4: 81 e2 ff 0f 00 00 and $0xfff,%edx ffffffff814b67ca: 41 89 94 24 78 01 00 mov %edx,0x178(%r12)
ffffffff814b67d1: 00ffffffff814b67d2: eb b0 jmp ffffffff814b6784 <uart_put_char+0x64>ffffffff814b67d4: 66 66 66 2e 0f 1f 84 data32 data32 nopw %cs:0x0(%rax,%rax,1)ffffffff814b67db: 00 00 00 00 00
for our build, this is crashing at:
circ->buf[circ->head] = c;
Looking in uart_port_startup(), it seems that circ->buf (state->xmit.buf) protected by the "per-port mutex", which based on uart_port_check() is state->port.mutex. Indeed, the lock acquired in uart_put_char() is uport->lock, i.e. not the same lock.
Anyway, since the lock is not acquired, if uart_shutdown() is called, the last chunk of that function may release state->xmit.buf before its assigned to null, and cause the race above.
To fix it, let's lock uport->lock when allocating/deallocating state->xmit.buf in addition to the per-port mutex.
v2: switch to locking uport->lock on allocation/deallocation instead of
locking the per-port mutex in uart_put_char. Note that since uport->lock is a spin lock, we have to switch the allocation to GFP_ATOMIC.
v3: move the allocation outside the lock, so we can switch back to
GFP_KERNEL
[bwh: Backported to 3.16: Use uport->lock directly rather than through
uart_port_{,un}lock()]
--- drivers/tty/serial/serial_core.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/tty/serial/serial_core.c +12 -5
@@ -131,6 +131,7 @@ static int uart_port_startup(struct tty_struct uart_port *uport = state->uart_port;struct tty_port *port = &state->port;unsigned long page; +unsigned long flags =0 ;int retval =0 ;if (uport->type ==PORT_UNKNOWN )
@@ -145,15 +146,18 @@ static int uart_port_startup(struct tty_* Initialise and allocate the transmit and temporary * buffer. */ -if (!state->xmit.buf) { -/* This is protected by the per port mutex */ - page =get_zeroed_page (GFP_KERNEL ); -if (!page) -return -ENOMEM ; + page =get_zeroed_page (GFP_KERNEL ); +if (!page) +return -ENOMEM ; +spin_lock_irqsave (&uport->lock, flags); +if (!state->xmit.buf) { state->xmit.buf = (unsigned char *) page;uart_circ_clear (&state->xmit); + }else { +free_page (page); } +spin_unlock_irqrestore (&uport->lock, flags); retval = uport->ops->startup (uport);if (retval ==0 ) {
@@ -232,6 +236,7 @@ static void uart_shutdown(struct tty_str {struct uart_port *uport = state->uart_port;struct tty_port *port = &state->port; +unsigned long flags =0 ;/* * Set the TTY IO error marker
@@ -262,10 +267,12 @@ static void uart_shutdown(struct tty_str/* * Free the transmit buffer page. */ +spin_lock_irqsave (&uport->lock, flags);if (state->xmit.buf) {free_page ((unsigned long )state->xmit.buf); state->xmit.buf =NULL ; } +spin_unlock_irqrestore (&uport->lock, flags); }/**
PATCH 38/328 tty: fix typo in comment of tty_termios_encode_baud_rate
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Brugger <[email protected]>
commit a1d51aa2214cea3f91611893610a2f769cada0e7 upstream.
--- drivers/tty/tty_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/tty_ioctl.c +1 -1
@@ -408,7 +408,7 @@ void tty_termios_encode_baud_rate(struct#ifdef BOTHER /* If the user asked for a precise weird speed give a precise weird -answer. If they asked for a Bfoo speed they many have problems +answer. If they asked for a Bfoo speed they may have problems digesting non-exact replies so fuzz a bit */ if ((termios->c_cflag &CBAUD ) ==BOTHER )
PATCH 39/328 tty: fix termios input-speed encoding
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit fada18c48d774b9e837928ecdce6a5d5fdd11ee7 upstream.
Make sure to clear the CIBAUD bits before OR-ing the new mask when encoding the termios input baud rate.
This could otherwise lead to an incorrect input rate being reported back and incidentally set on subsequent termios updates.
--- drivers/tty/tty_ioctl.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/tty_ioctl.c +3 -0
@@ -419,6 +419,9 @@ void tty_termios_encode_baud_rate(struct ibinput =1 ;/* An input speed was specified */ #endif termios->c_cflag &= ~CBAUD ; +#ifdef IBSHIFT + termios->c_cflag &= ~(CBAUD <<IBSHIFT ); +#endif /* * Our goal is to find a close match to the standard baud rate
PATCH 41/328 s390/kvm: fix deadlock when killed by oom
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Claudio Imbrenda <[email protected]>
commit 306d6c49ac9ded11114cb53b0925da52f2c2ada1 upstream.
When the oom killer kills a userspace process in the page fault handler while in guest context, the fault handler fails to release the mm_sem if the FAULT_FLAG_RETRY_NOWAIT option is set. This leads to a deadlock when tearing down the mm when the process terminates. This bug can only happen when pfault is enabled, so only KVM clients are affected.
The problem arises in the rare cases in which handle_mm_fault does not release the mm_sem. This patch fixes the issue by manually releasing the mm_sem when needed.
--- arch/s390/mm/fault.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/mm/fault.c +2 -0
@@ -497,6 +497,8 @@ retry:/* No reason to continue if interrupted by SIGKILL. */ if ((fault &VM_FAULT_RETRY ) &&fatal_signal_pending (current)) { fault =VM_FAULT_SIGNAL ; +if (flags &FAULT_FLAG_RETRY_NOWAIT ) + goto out_up; goto out; }if (unlikely (fault &VM_FAULT_ERROR ))
PATCH 42/328 ARM: hisi: handle of_iomap and fix missing of_node_put
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Mc Guire <[email protected]>
commit d396cb185c0337aae5664b250cdd9a73f6eb1503 upstream.
Relying on an unchecked of_iomap() which can return NULL is problematic here, an explicit check seems mandatory. Also the call to of_find_compatible_node() returns a device node with refcount incremented therefor an explicit of_node_put() is needed here.
--- arch/arm/mach-hisi/hotplug.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
arch/arm/mach-hisi/hotplug.c +13 -6
@@ -137,13 +137,20 @@ static int hi3xxx_hotplug_init(void)struct device_node *node; node =of_find_compatible_node (NULL ,NULL ,"hisilicon,sysctrl" ); -if (node) { - ctrl_base =of_iomap (node,0 ); - id =HI3620_CTRL ; -return 0 ; +if (!node) { + id =ERROR_CTRL ; +return -ENOENT ; } - id =ERROR_CTRL ; -return -ENOENT ; + + ctrl_base =of_iomap (node,0 ); +of_node_put (node); +if (!ctrl_base) { + id =ERROR_CTRL ; +return -ENOMEM ; + } + + id =HI3620_CTRL ; +return 0 ; }void hi3xxx_set_cpu (int cpu,bool enable)
PATCH 44/328 mtdchar: fix overflows in adjustment of `count`
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 6c6bc9ea84d0008024606bf5ba10519e20d851bf upstream.
The first checks in mtdchar_read() and mtdchar_write() attempt to limit count such that *ppos + count <= mtd->size. However, they ignore the possibility of *ppos > mtd->size, allowing the calculation of count to wrap around. mtdchar_lseek() prevents seeking beyond mtd->size, but the pread/pwrite syscalls bypass this.
I haven't found any codepath on which this actually causes dangerous behavior, but it seems like a sensible change anyway.
--- drivers/mtd/mtdchar.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/mtd/mtdchar.c +7 -3
@@ -190,8 +190,12 @@ static ssize_t mtdchar_read(struct filepr_debug ("MTD_read\n" ); -if (*ppos + count > mtd->size) - count = mtd->size - *ppos; +if (*ppos + count > mtd->size) { +if (*ppos < mtd->size) + count = mtd->size - *ppos; +else + count =0 ; + }if (!count)return 0 ;
@@ -276,7 +280,7 @@ static ssize_t mtdchar_write(struct filepr_debug ("MTD_write\n" ); -if (*ppos == mtd->size) +if (*ppos >= mtd->size)return -ENOSPC ;if (*ppos + count > mtd->size)
PATCH 45/328 binfmt_elf: Respect error return from `regset->active'
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Maciej W. Rozycki" <[email protected]>
commit 2f819db565e82e5f73cd42b39925098986693378 upstream.
The regset API documented in <linux/regset.h> defines -ENODEV as the result of the ->active' handler to be used where the feature requested is not available on the hardware found. However code handling core file note generation in fill_thread_core_info' interpretes any non-zero result from the `->active' handler as the regset requested being active. Consequently processing continues (and hopefully gracefully fails later on) rather than being abandoned right away for the regset requested.
Fix the problem then by making the code proceed only if a positive result is returned from the `->active' handler.
Patchwork: https://patchwork.linux-mips.org/patch/19332/
--- fs/binfmt_elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/binfmt_elf.c +1 -1
@@ -1571,7 +1571,7 @@ static int fill_thread_core_info(structconst struct user_regset *regset = &view->regsets[i];do_thread_regset_writeback (t->task, regset);if (regset->core_note_type && regset->get && - (!regset->active || regset->active (t->task, regset))) { + (!regset->active || regset->active (t->task, regset) >0 )) {int ret;size_t size = regset->n * regset->size;void *data =kmalloc (size,GFP_KERNEL );
PATCH 46/328 MIPS: Correct the 64-bit DSP accumulator register size
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Maciej W. Rozycki" <[email protected]>
commit f5958b4cf4fc38ed4583ab83fb7c4cd1ab05f47b upstream.
Use the unsigned long' rather than __u32' type for DSP accumulator registers, like with the regular MIPS multiply/divide accumulator and general-purpose registers, as all are 64-bit in 64-bit implementations and using a 32-bit data type leads to contents truncation on context saving.
Update arch_ptrace' and compat_arch_ptrace' accordingly, removing casts that are similarly not used with multiply/divide accumulator or general-purpose register accesses.
Patchwork: https://patchwork.linux-mips.org/patch/19329/
--- arch/mips/include/asm/processor.h | 2 +- arch/mips/kernel/ptrace.c | 2 +- arch/mips/kernel/ptrace32.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/mips/include/asm/processor.h +1 -1
@@ -143,7 +143,7 @@ struct mips_fpu_struct {#define NUM_DSP_REGS 6 -typedef __u32 dspreg_t ; +typedef unsigned long dspreg_t ;struct mips_dsp_state {dspreg_t dspr[NUM_DSP_REGS ];
arch/mips/kernel/ptrace.c +1 -1
@@ -790,7 +790,7 @@ long arch_ptrace(struct task_struct *chi goto out; } dregs =__get_dsp_regs (child); - tmp = (unsigned long ) (dregs[addr -DSP_BASE ]); + tmp = dregs[addr -DSP_BASE ];break ; }case DSP_CONTROL :
arch/mips/kernel/ptrace32.c +1 -1
@@ -140,7 +140,7 @@ long compat_arch_ptrace(struct task_stru goto out; } dregs =__get_dsp_regs (child); - tmp = (unsigned long ) (dregs[addr -DSP_BASE ]); + tmp = dregs[addr -DSP_BASE ];break ; }case DSP_CONTROL :
PATCH 48/328 ALSA: memalloc: Don't exceed over the requested size
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit dfef01e150824b0e6da750cacda8958188d29aea upstream.
snd_dma_alloc_pages_fallback() tries to allocate pages again when the allocation fails with reduced size. But the first try actually *increases* the size to power-of-two, which may give back a larger chunk than the requested size. This confuses the callers, e.g. sgbuf assumes that the size is equal or less, and it may result in a bad loop due to the underflow and eventually lead to Oops.
The code of this function seems incorrectly assuming the usage of get_order(). We need to decrease at first, then align to power-of-two.
--- sound/core/memalloc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
sound/core/memalloc.c +2 -6
@@ -239,16 +239,12 @@ int snd_dma_alloc_pages_fallback(int typint err;while ((err =snd_dma_alloc_pages (type, device, size, dmab)) <0 ) { -size_t aligned_size;if (err != -ENOMEM )return err;if (size <=PAGE_SIZE )return -ENOMEM ; - aligned_size =PAGE_SIZE <<get_order (size); -if (size != aligned_size) - size = aligned_size; -else - size >>=1 ; + size >>=1 ; + size =PAGE_SIZE <<get_order (size); }if (! dmab->area)return -ENOMEM ;
PATCH 58/328 udlfb: fix semaphore value leak
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 9d0aa601e4cd9c0892f90d36e8488d79b72f4073 upstream.
I observed that the performance of the udl fb driver degrades over time. On a freshly booted machine, it takes 6 seconds to do "ls -la /usr/bin"; after some time of use, the same operation takes 14 seconds.
The reason is that the value of "limit_sem" decays over time.
The udl driver uses a semaphore "limit_set" to specify how many free urbs are there on dlfb->urbs.list. If the count is zero, the "down" operation will sleep until some urbs are added to the freelist.
In order to avoid some hypothetical deadlock, the driver will not call "up" immediately, but it will offload it to a workqueue. The problem is that if we call "schedule_delayed_work" on the same work item multiple times, the work item may only be executed once.
This is happening:
* some urb completes
* dlfb_urb_completion adds it to the free list
* dlfb_urb_completion calls schedule_delayed_work to schedule the function dlfb_release_urb_work to increase the semaphore count
* as the urb is on the free list, some other task grabs it and submits it
* the submitted urb completes, dlfb_urb_completion is called again
* dlfb_urb_completion calls schedule_delayed_work, but the work is already scheduled, so it does nothing
* finally, dlfb_release_urb_work is called, it increases the semaphore count by 1, although it should increase it by 2
So, the semaphore count is decreasing over time, and this causes gradual performance degradation.
Note that in the current kernel, the "up" function may be called from interrupt and it may race with the "down" function called by another thread, so we don't have to offload the call of "up" to a workqueue at all. This patch removes the workqueue code. The patch also changes "down_interruptible" to "down" in dlfb_free_urb_list, so that we will clean up the driver properly even if a signal arrives.
With this patch, the performance of udlfb no longer degrades.
[bwh: Backported to 3.16: Pointers to struct dlfb_data are named "dev" rather
than "dlfb"]
--- drivers/video/fbdev/udlfb.c | 27 ++------------------------- include/video/udlfb.h | 1 - 2 files changed, 2 insertions(+), 26 deletions(-)
drivers/video/fbdev/udlfb.c +2 -25
@@ -928,14 +928,6 @@ static void dlfb_free(struct kref *kref)kfree (dev); } -static void dlfb_release_urb_work (struct work_struct *work) -{ - struct urb_node *unode = container_of(work, struct urb_node, - release_urb_work.work); - -up (&unode->dev->urbs.limit_sem); -} -static void dlfb_free_framebuffer (struct dlfb_data *dev) {struct fb_info *info = dev->info;
@@ -1797,14 +1789,7 @@ static void dlfb_urb_completion(struct u dev->urbs.available++;spin_unlock_irqrestore (&dev->urbs.lock, flags); -/* -* When using fb_defio, we deadlock if up() is called -* while another is waiting. So queue to another process. -*/ -if (fb_defio) -schedule_delayed_work (&unode->release_urb_work,0 ); -else -up (&dev->urbs.limit_sem); +up (&dev->urbs.limit_sem); }static void dlfb_free_urb_list (struct dlfb_data *dev)
@@ -1813,16 +1798,11 @@ static void dlfb_free_urb_list(struct dlstruct list_head *node;struct urb_node *unode;struct urb *urb; -int ret;unsigned long flags;/* keep waiting and freeing, until we've got 'em all */ while (count--) { - -/* Getting interrupted means a leak, but ok at disconnect */ - ret =down_interruptible (&dev->urbs.limit_sem); -if (ret) -break ; +down (&dev->urbs.limit_sem);spin_lock_irqsave (&dev->urbs.lock, flags);
@@ -1862,9 +1842,6 @@ static int dlfb_alloc_urb_list(struct dlbreak ; unode->dev = dev; -INIT_DELAYED_WORK (&unode->release_urb_work, - dlfb_release_urb_work); - urb =usb_alloc_urb (0 ,GFP_KERNEL );if (!urb) {kfree (unode);
include/video/udlfb.h +0 -1
@@ -19,7 +19,6 @@ struct dloarea {struct urb_node {struct list_head entry;struct dlfb_data *dev; -struct delayed_work release_urb_work;struct urb *urb; };
PATCH 60/328 udlfb: don't switch if we are switching to the same videomode
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 564f1807379298dfdb12ed0d5b25fcb89c238527 upstream.
The udlfb driver reprograms the hardware everytime the user switches the console, that makes quite unusable when working on the console.
This patch makes the driver remember the videomode we are in and avoid reprogramming the hardware if we switch to the same videomode.
We mask the "activate" field and the "FB_VMODE_SMOOTH_XPAN" flag when comparing the videomode, because they cause spurious switches when switching to and from the Xserver.
[bwh: Backported to 3.16: Pointer to struct dlfb_data is named "dev" rather
than "dlfb"]
--- drivers/video/fbdev/udlfb.c | 18 ++++++++++++++++-- include/video/udlfb.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/video/fbdev/udlfb.c +16 -2
@@ -1057,10 +1057,24 @@ static int dlfb_ops_set_par(struct fb_inint result;u16 *pix_framebuffer;int i; +struct fb_var_screeninfo fvs; + +/* clear the activate field because it causes spurious miscompares */ + fvs = info->var; + fvs.activate =0 ; + fvs.vmode &= ~FB_VMODE_SMOOTH_XPAN ; + +if (!memcmp (&dev->current_mode, &fvs,sizeof (struct fb_var_screeninfo ))) +return 0 ; result =dlfb_set_video_mode (dev, &info->var); -if ((result ==0 ) && (dev->fb_count ==0 )) { +if (result) +return result; + + dev->current_mode = fvs; + +if (dev->fb_count ==0 ) {/* paint greenscreen */
@@ -1072,7 +1086,7 @@ static int dlfb_ops_set_par(struct fb_in info->screen_base); } -return result; +return 0 ; }/* To fonzi the jukebox (e.g. make blanking changes take effect) */
include/video/udlfb.h +1 -0
@@ -56,6 +56,7 @@ struct dlfb_data {atomic_t bytes_identical;/* saved effort with backbuffer comparison */ atomic_t bytes_sent;/* to usb, after compression including overhead */ atomic_t cpu_kcycles_used;/* transpired during pixel processing */ +struct fb_var_screeninfo current_mode; };#define NR_USB_REQUEST_I2C_SUB_IO 0x02
PATCH 61/328 udlfb: make a local copy of fb_ops
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 2c29cfc3eaf11779176bf41475cfca49bccba11c upstream.
The defio subsystem overwrites the method fb_osp->mmap. That method is stored in module's static data - and that means that if we have multiple diplaylink adapters, they will over write each other's method.
In order to avoid interference between multiple adapters, we copy the fb_ops structure to a device-local memory.
[bwh: Backported to 3.16: Pointer to struct dlfb_data is named "dev" rather
than "dlfb"]
--- drivers/video/fbdev/udlfb.c | 3 ++- include/video/udlfb.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/video/fbdev/udlfb.c +2 -1
@@ -1680,7 +1680,8 @@ static void dlfb_init_framebuffer_work(s dev->info = info; info->par = dev; info->pseudo_palette = dev->pseudo_palette; - info->fbops = &dlfb_ops; + dev->ops = dlfb_ops; + info->fbops = &dev->ops; retval =fb_alloc_cmap (&info->cmap,256 ,0 );if (retval <0 ) {
include/video/udlfb.h +1 -0
@@ -51,6 +51,7 @@ struct dlfb_data {int base8;u32 pseudo_palette[256 ];int blank_mode;/*one of FB_BLANK_ */ +struct fb_ops ops;/* blit-only rendering path metrics, exposed through sysfs */ atomic_t bytes_rendered;/* raw pixel-bytes driver asked to render */ atomic_t bytes_identical;/* saved effort with backbuffer comparison */
PATCH 62/328 udlfb: set optimal write delay
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit bb24153a3f13dd0dbc1f8055ad97fe346d598f66 upstream.
The default delay 5 jiffies is too much when the kernel is compiled with HZ=100 - it results in jumpy cursor in Xwindow.
In order to find out the optimal delay, I benchmarked the driver on 1280x720x30fps video. I found out that with HZ=1000, 10ms is acceptable, but with HZ=250 or HZ=300, we need 4ms, so that the video is played without any frame skips.
This patch changes the delay to this value.
--- include/video/udlfb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/video/udlfb.h +1 -1
@@ -88,7 +88,7 @@ struct dlfb_data {#define MIN_RAW_PIX_BYTES 2#define MIN_RAW_CMD_BYTES (RAW_HEADER_BYTES + MIN_RAW_PIX_BYTES) -#define DL_DEFIO_WRITE_DELAY 5/* fb_deferred_io.delay in jiffies */ +#define DL_DEFIO_WRITE_DELAY msecs_to_jiffies(HZ <= 300 ? 4 : 10)/* optimal value for 720p video */ #define DL_DEFIO_WRITE_DISABLE (HZ*60)/* "disable" with long delay */ /* remove these once align.h patch is taken into kernel */
PATCH 65/328 xfrm: fix 'passing zero to ERR_PTR()' warning
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: YueHaibing <[email protected]>
commit 934ffce1343f22ed5e2d0bd6da4440f4848074de upstream.
Fix a static code checker warning:
net/xfrm/xfrm_policy.c:1836 xfrm_resolve_and_create_bundle() warn: passing zero to 'ERR_PTR'
xfrm_tmpl_resolve return 0 just means no xdst found, return NULL instead of passing zero to ERR_PTR.
--- net/xfrm/xfrm_policy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/xfrm/xfrm_policy.c +4 -1
@@ -1692,7 +1692,10 @@ xfrm_resolve_and_create_bundle(struct xf/* Try to instantiate a bundle */ err =xfrm_tmpl_resolve (pols, num_pols, fl, xfrm, family);if (err <=0 ) { -if (err !=0 && err != -EAGAIN ) +if (err ==0 ) +return NULL ; + +if (err != -EAGAIN )XFRM_INC_STATS (net,LINUX_MIB_XFRMOUTPOLERROR );return ERR_PTR (err); }
PATCH 67/328 ALSA: vx: Fix possible transfer overflow
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 874e1f6fad9a5184b67f4cee37c1335cd2cc5677 upstream.
The pseudo DMA transfer codes in VX222 and VX-pocket driver have a slight bug where they check the buffer boundary wrongly, and may overflow. Also, the zero sample count might be handled badly for the playback (although it shouldn't happen in theory). This patch addresses these issues.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=141541
--- sound/drivers/vx/vx_pcm.c | 6 ++++-- sound/pci/vx222/vx222_ops.c | 12 ++++++------ sound/pcmcia/vx/vxp_ops.c | 12 ++++++------ 3 files changed, 16 insertions(+), 14 deletions(-)
sound/drivers/vx/vx_pcm.c +4 -2
@@ -1071,8 +1071,10 @@ static void vx_pcm_capture_update(struct/* ok, let's accelerate! */ int align = pipe->align *3 ; space = (count / align) * align; -vx_pseudo_dma_read (chip, runtime, pipe, space); - count -= space; +if (space >0 ) { +vx_pseudo_dma_read (chip, runtime, pipe, space); + count -= space; + } }/* read the rest of bytes */ while (count >0 ) {
sound/pci/vx222/vx222_ops.c +6 -6
@@ -264,12 +264,12 @@ static void vx2_dma_write(struct vx_core/* Transfer using pseudo-dma. */ -if (offset + count > pipe->buffer_bytes) { +if (offset + count >= pipe->buffer_bytes) {int length = pipe->buffer_bytes - offset; count -= length; length >>=2 ;/* in 32bit words */ /* Transfer using pseudo-dma. */ -while (length-- >0 ) { +for (; length >0 ; length--) {outl (cpu_to_le32 (*addr), port); addr++; }
@@ -279,7 +279,7 @@ static void vx2_dma_write(struct vx_core pipe->hw_ptr += count; count >>=2 ;/* in 32bit words */ /* Transfer using pseudo-dma. */ -while (count-- >0 ) { +for (; count >0 ; count--) {outl (cpu_to_le32 (*addr), port); addr++; }
@@ -302,12 +302,12 @@ static void vx2_dma_read(struct vx_corevx2_setup_pseudo_dma (chip,0 );/* Transfer using pseudo-dma. */ -if (offset + count > pipe->buffer_bytes) { +if (offset + count >= pipe->buffer_bytes) {int length = pipe->buffer_bytes - offset; count -= length; length >>=2 ;/* in 32bit words */ /* Transfer using pseudo-dma. */ -while (length-- >0 ) +for (; length >0 ; length--) *addr++ =le32_to_cpu (inl (port)); addr = (u32 *)runtime->dma_area; pipe->hw_ptr =0 ;
@@ -315,7 +315,7 @@ static void vx2_dma_read(struct vx_core pipe->hw_ptr += count; count >>=2 ;/* in 32bit words */ /* Transfer using pseudo-dma. */ -while (count-- >0 ) +for (; count >0 ; count--) *addr++ =le32_to_cpu (inl (port));vx2_release_pseudo_dma (chip);
sound/pcmcia/vx/vxp_ops.c +6 -6
@@ -369,12 +369,12 @@ static void vxp_dma_write(struct vx_coreunsigned short *addr = (unsigned short *)(runtime->dma_area + offset);vx_setup_pseudo_dma (chip,1 ); -if (offset + count > pipe->buffer_bytes) { +if (offset + count >= pipe->buffer_bytes) {int length = pipe->buffer_bytes - offset; count -= length; length >>=1 ;/* in 16bit words */ /* Transfer using pseudo-dma. */ -while (length-- >0 ) { +for (; length >0 ; length--) {outw (cpu_to_le16 (*addr), port); addr++; }
@@ -384,7 +384,7 @@ static void vxp_dma_write(struct vx_core pipe->hw_ptr += count; count >>=1 ;/* in 16bit words */ /* Transfer using pseudo-dma. */ -while (count-- >0 ) { +for (; count >0 ; count--) {outw (cpu_to_le16 (*addr), port); addr++; }
@@ -411,12 +411,12 @@ static void vxp_dma_read(struct vx_coreif (snd_BUG_ON (count %2 ))return ;vx_setup_pseudo_dma (chip,0 ); -if (offset + count > pipe->buffer_bytes) { +if (offset + count >= pipe->buffer_bytes) {int length = pipe->buffer_bytes - offset; count -= length; length >>=1 ;/* in 16bit words */ /* Transfer using pseudo-dma. */ -while (length-- >0 ) +for (; length >0 ; length--) *addr++ =le16_to_cpu (inw (port)); addr = (unsigned short *)runtime->dma_area; pipe->hw_ptr =0 ;
@@ -424,7 +424,7 @@ static void vxp_dma_read(struct vx_core pipe->hw_ptr += count; count >>=1 ;/* in 16bit words */ /* Transfer using pseudo-dma. */ -while (count-- >1 ) +for (; count >1 ; count--) *addr++ =le16_to_cpu (inw (port));/* Disable DMA */ pchip->regDIALOG &= ~VXP_DLG_DMAREAD_SEL_MASK ;
PATCH 70/328 ALSA: cs5535audio: Fix invalid endian conversion
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 69756930f2de0457d51db7d505a1e4f40e9fd116 upstream.
One place in cs5535audio_build_dma_packets() does an extra conversion via cpu_to_le32(); namely jmpprd_addr is passed to setup_prd() ops, which writes the value via cs_writel(). That is, the callback does the conversion by itself, and we don't need to convert beforehand.
This patch fixes that bogus conversion.
--- sound/pci/cs5535audio/cs5535audio.h | 6 +++--- sound/pci/cs5535audio/cs5535audio_pcm.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
sound/pci/cs5535audio/cs5535audio.h +3 -3
@@ -66,9 +66,9 @@ struct cs5535audio_dma_ops { };struct cs5535audio_dma_desc { -u32 addr; -u16 size; -u16 ctlreserved; +__le32 addr; +__le16 size; +__le16 ctlreserved; };struct cs5535audio_dma {
sound/pci/cs5535audio/cs5535audio_pcm.c +2 -2
@@ -158,8 +158,8 @@ static int cs5535audio_build_dma_packets lastdesc->addr =cpu_to_le32 ((u32 ) dma->desc_buf.addr); lastdesc->size =0 ; lastdesc->ctlreserved =cpu_to_le16 (PRD_JMP ); - jmpprd_addr =cpu_to_le32 (lastdesc->addr + - (sizeof (struct cs5535audio_dma_desc )*periods)); + jmpprd_addr = (u32 )dma->desc_buf.addr + +sizeof (struct cs5535audio_dma_desc ) * periods; dma->substream = substream; dma->period_bytes = period_bytes;
PATCH 72/328 fuse: flush requests on umount
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 580640ba5d331eb5631a5de46941c98f5ed90886 upstream.
Use fuse_abort_conn() instead of fuse_conn_kill() in fuse_put_super(). This flushes and aborts requests still on any queues. But since we've already reset fc->connected, those requests would not be useful anyway and would be flushed when the fuse device is closed.
Next patches will rely on requests being flushed before the superblock is destroyed.
Use fuse_abort_conn() in cuse_process_init_reply() too, since it makes no difference there, and we can get rid of fuse_conn_kill().
--- fs/fuse/cuse.c | 2 +- fs/fuse/fuse_i.h | 2 -- fs/fuse/inode.c | 16 +--------------- 3 files changed, 2 insertions(+), 18 deletions(-)
fs/fuse/cuse.c +1 -1
@@ -415,7 +415,7 @@ err_unlock: err_region:unregister_chrdev_region (devt,1 ); err: -fuse_conn_kill (fc); +fuse_abort_conn (fc); goto out; }
fs/fuse/fuse_i.h +0 -2
@@ -804,8 +804,6 @@ void fuse_invalidate_atime(struct inode*/ struct fuse_conn *fuse_conn_get (struct fuse_conn *fc); -void fuse_conn_kill (struct fuse_conn *fc); -/** * Initialize fuse_conn */
fs/fuse/inode.c +1 -15
@@ -376,27 +376,13 @@ static void fuse_bdi_destroy(struct fusebdi_destroy (&fc->bdi); } -void fuse_conn_kill (struct fuse_conn *fc) -{ -spin_lock (&fc->lock); - fc->connected =0 ; - fc->blocked =0 ; - fc->initialized =1 ; -spin_unlock (&fc->lock); -/* Flush all readers on this fs */ -kill_fasync (&fc->fasync,SIGIO ,POLL_IN ); -wake_up_all (&fc->waitq); -wake_up_all (&fc->blocked_waitq); -} -EXPORT_SYMBOL_GPL (fuse_conn_kill); -static void fuse_put_super (struct super_block *sb) {struct fuse_conn *fc =get_fuse_conn_super (sb);fuse_send_destroy (fc); -fuse_conn_kill (fc); +fuse_abort_conn (fc);mutex_lock (&fuse_mutex);list_del (&fc->entry);fuse_ctl_remove_conn (fc);
PATCH 73/328 fuse: Fix oops at process_init_reply()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit e8f3bd773d22f488724dffb886a1618da85c2966 upstream.
syzbot is hitting NULL pointer dereference at process_init_reply(). This is because deactivate_locked_super() is called before response for initial request is processed.
Fix this by aborting and waiting for all requests (including FUSE_INIT) before resetting fc->sb.
Original patch by Tetsuo Handa <[email protected]>.
[bwh: Backported to 3.16:
- Drop second argument to fuse_abort_conn()
- fuse_wait_aborted() is not needed]
---
fs/fuse/inode.c +10 -12
@@ -380,9 +380,6 @@ static void fuse_put_super(struct super_ {struct fuse_conn *fc =get_fuse_conn_super (sb); -fuse_send_destroy (fc); - -fuse_abort_conn (fc);mutex_lock (&fuse_mutex);list_del (&fc->entry);fuse_ctl_remove_conn (fc);
@@ -1124,16 +1121,24 @@ static struct dentry *fuse_mount(structreturn mount_nodev (fs_type, flags, raw_data, fuse_fill_super); } -static void fuse_kill_sb_anon (struct super_block *sb) +static void fuse_sb_destroy (struct super_block *sb) {struct fuse_conn *fc =get_fuse_conn_super (sb);if (fc) { +fuse_send_destroy (fc); + +fuse_abort_conn (fc); +down_write (&fc->killsb); fc->sb =NULL ;up_write (&fc->killsb); } +} +static void fuse_kill_sb_anon (struct super_block *sb) +{ +fuse_sb_destroy (sb);kill_anon_super (sb); }
@@ -1156,14 +1161,7 @@ static struct dentry *fuse_mount_blk(strstatic void fuse_kill_sb_blk (struct super_block *sb) { -struct fuse_conn *fc =get_fuse_conn_super (sb); - -if (fc) { -down_write (&fc->killsb); - fc->sb =NULL ; -up_write (&fc->killsb); - } - +fuse_sb_destroy (sb);kill_block_super (sb); }
PATCH 75/328 fuse: Add missed unlock_page() to fuse_readpages_fill()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kirill Tkhai <[email protected]>
commit 109728ccc5933151c68d1106e4065478a487a323 upstream.
The above error path returns with page unlocked, so this place seems also to behave the same.
--- fs/fuse/file.c | 1 + 1 file changed, 1 insertion(+)
fs/fuse/file.c +1 -0
@@ -911,6 +911,7 @@ static int fuse_readpages_fill(void *_da }if (WARN_ON (req->num_pages >= req->max_pages)) { +unlock_page (page);fuse_put_request (fc, req);return -EIO ; }
PATCH 79/328 media: dvb-usb-v2/gl861: ensure USB message buffers DMA'able
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Akihiro Tsukada <[email protected]>
commit 86f65c218123c4e36fd855fbbc38147ffaf29974 upstream.
i2c message buf might be on stack.
--- drivers/media/usb/dvb-usb-v2/gl861.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/media/usb/dvb-usb-v2/gl861.c +17 -3
@@ -20,6 +20,8 @@ static int gl861_i2c_msg(struct dvb_usb_u16 value = addr << (8 +1 );int wo = (rbuf ==NULL || rlen ==0 );/* write-only */ u8 req, type; +u8 *buf; +int ret;if (wo) { req =GL861_REQ_I2C_WRITE ;
@@ -42,11 +44,23 @@ static int gl861_i2c_msg(struct dvb_usb_ KBUILD_MODNAME, wlen);return -EINVAL ; } - + buf =NULL ; +if (rlen >0 ) { + buf =kmalloc (rlen,GFP_KERNEL ); +if (!buf) +return -ENOMEM ; + }msleep (1 );/* avoid I2C errors */ -return usb_control_msg (d->udev,usb_rcvctrlpipe (d->udev,0 ), req, type, - value, index, rbuf, rlen,2000 ); + ret =usb_control_msg (d->udev,usb_rcvctrlpipe (d->udev,0 ), req, type, + value, index, buf, rlen,2000 ); +if (rlen >0 ) { +if (ret >0 ) +memcpy (rbuf, buf, rlen); +kfree (buf); + } + +return ret; }/* I2C */
PATCH 81/328 partitions/aix: fix usage of uninitialized lv_info and lvname structures
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauricio Faria de Oliveira <[email protected]>
commit 14cb2c8a6c5dae57ee3e2da10fa3db2b9087e39e upstream.
The if-block that sets a successful return value in aix_partition() uses 'lvip[].pps_per_lv' and 'n[].name' potentially uninitialized.
For example, if 'numlvs' is zero or alloc_lvn() fails, neither is initialized, but are used anyway if alloc_pvd() succeeds after it.
So, make the alloc_pvd() call conditional on their initialization.
This has been hit when attaching an apparently corrupted/stressed AIX LUN, misleading the kernel to pr_warn() invalid data and hang.
[...] partition (null) (11 pp's found) is not contiguous [...] partition (null) (2 pp's found) is not contiguous [...] partition (null) (3 pp's found) is not contiguous [...] partition (null) (64 pp's found) is not contiguous
--- block/partitions/aix.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
block/partitions/aix.c +3 -2
@@ -177,7 +177,7 @@ int aix_partition(struct parsed_partitiou32 vgda_sector =0 ;u32 vgda_len =0 ;int numlvs =0 ; -struct pvd *pvd; +struct pvd *pvd =NULL ;struct lv_info {unsigned short pps_per_lv;unsigned short pps_found;
@@ -231,10 +231,11 @@ int aix_partition(struct parsed_partitioif (lvip[i].pps_per_lv) foundlvs +=1 ; } +/* pvd loops depend on n[].name and lvip[].pps_per_lv */ + pvd =alloc_pvd (state, vgda_sector +17 ); }put_dev_sector (sect); } - pvd =alloc_pvd (state, vgda_sector +17 );if (pvd) {int numpps =be16_to_cpu (pvd->pp_count);int psn_part1 =be32_to_cpu (pvd->psn_part1);
PATCH 82/328 partitions/aix: append null character to print data from disk
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauricio Faria de Oliveira <[email protected]>
commit d43fdae7bac2def8c4314b5a49822cb7f08a45f1 upstream.
Even if properly initialized, the lvname array (i.e., strings) is read from disk, and might contain corrupt data (e.g., lack the null terminating character for strings).
So, make sure the partition name string used in pr_warn() has the null terminating character.
--- block/partitions/aix.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
block/partitions/aix.c +6 -2
@@ -282,10 +282,14 @@ int aix_partition(struct parsed_partitio next_lp_ix +=1 ; }for (i =0 ; i < state->limit; i +=1 ) -if (lvip[i].pps_found && !lvip[i].lv_is_contiguous) +if (lvip[i].pps_found && !lvip[i].lv_is_contiguous) { +char tmp[sizeof (n[i].name) +1 ];// null char + +snprintf (tmp,sizeof (tmp),"%s" , n[i].name);pr_warn ("partition %s (%u pp's found) is " "not contiguous\n" , - n[i].name, lvip[i].pps_found); + tmp, lvip[i].pps_found); + }kfree (pvd); }kfree (n);
PATCH 87/328 udl-kms: handle allocation failure
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 542bb9788a1f485eb1a2229178f665d8ea166156 upstream.
Allocations larger than PAGE_ALLOC_COSTLY_ORDER are unreliable and they may fail anytime. This patch fixes the udl kms driver so that when a large alloactions fails, it tries to do multiple smaller allocations.
--- drivers/gpu/drm/udl/udl_main.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)
drivers/gpu/drm/udl/udl_main.c +18 -10
@@ -171,17 +171,22 @@ static void udl_free_urb_list(struct drmstatic int udl_alloc_urb_list (struct drm_device *dev,int count,size_t size) {struct udl_device *udl = dev->dev_private; -int i =0 ;struct urb *urb;struct urb_node *unode;char *buf; +size_t wanted_size = count * size;spin_lock_init (&udl->urbs.lock); +retry: udl->urbs.size = size;INIT_LIST_HEAD (&udl->urbs.list); -while (i < count) { +sema_init (&udl->urbs.limit_sem,0 ); + udl->urbs.count =0 ; + udl->urbs.available =0 ; + +while (udl->urbs.count * size < wanted_size) { unode =kzalloc (sizeof (struct urb_node ),GFP_KERNEL );if (!unode)break ;
@@ -197,11 +202,16 @@ static int udl_alloc_urb_list(struct drm } unode->urb = urb; - buf =usb_alloc_coherent (udl->ddev->usbdev,MAX_TRANSFER ,GFP_KERNEL , + buf =usb_alloc_coherent (udl->ddev->usbdev, size,GFP_KERNEL , &urb->transfer_dma);if (!buf) {kfree (unode);usb_free_urb (urb); +if (size >PAGE_SIZE ) { + size /=2 ; +udl_free_urb_list (dev); + goto retry; + }break ; }
@@ -212,16 +222,14 @@ static int udl_alloc_urb_list(struct drmlist_add_tail (&unode->entry, &udl->urbs.list); - i++; +up (&udl->urbs.limit_sem); + udl->urbs.count++; + udl->urbs.available++; } -sema_init (&udl->urbs.limit_sem, i); - udl->urbs.count = i; - udl->urbs.available = i; - -DRM_DEBUG ("allocated %d %d byte urbs\n" , i, (int ) size); +DRM_DEBUG ("allocated %d %d byte urbs\n" , udl->urbs.count, (int ) size); -return i; +return udl->urbs.count; }struct urb *udl_get_urb (struct drm_device *dev)
PATCH 89/328 ath10k: prevent active scans on potential unusable channels
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit 3f259111583801013cb605bb4414aa529adccf1c upstream.
The QCA4019 hw1.0 firmware 10.4-3.2.1-00050 and 10.4-3.5.3-00053 (and most likely all other) seem to ignore the WMI_CHAN_FLAG_DFS flag during the scan. This results in transmission (probe requests) on channels which are not "available" for transmissions.
Since the firmware is closed source and nothing can be done from our side to fix the problem in it, the driver has to work around this problem. The WMI_CHAN_FLAG_PASSIVE seems to be interpreted by the firmware to not scan actively on a channel unless an AP was detected on it. Simple probe requests will then be transmitted by the STA on the channel.
ath10k must therefore also use this flag when it queues a radar channel for scanning. This should reduce the chance of an active scan when the channel might be "unusable" for transmissions.
--- drivers/net/wireless/ath/ath10k/mac.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/wireless/ath/ath10k/mac.c +7 -0
@@ -1724,6 +1724,13 @@ static int ath10k_update_channel_list(st passive = channel->flags &IEEE80211_CHAN_NO_IR ; ch->passive = passive; +/* the firmware is ignoring the "radar" flag of the +* channel and is scanning actively using Probe Requests +* on "Radar detection"/DFS channels which are not +* marked as "available" +*/ + ch->passive |= ch->chan_radar; + ch->freq = channel->center_freq; ch->min_power =0 ; ch->max_power = channel->max_power *2 ;
PATCH 91/328 tracing: Do not call start/stop() functions when tracing_on does not change
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (VMware)" <[email protected]>
commit f143641bfef9a4a60c57af30de26c63057e7e695 upstream.
Currently, when one echo's in 1 into tracing_on, the current tracer's "start()" function is executed, even if tracing_on was already one. This can lead to strange side effects. One being that if the hwlat tracer is enabled, and someone does "echo 1 > tracing_on" into tracing_on, the hwlat tracer's start() function is called again which will recreate another kernel thread, and make it unable to remove the old one.
--- kernel/trace/trace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/trace.c +3 -1
@@ -6180,7 +6180,9 @@ rb_simple_write(struct file *filp, constif (buffer) {mutex_lock (&trace_types_lock); -if (val) { +if (!!val ==tracer_tracing_is_on (tr)) { + val =0 ;/* do nothing */ + }else if (val) {tracer_tracing_on (tr);if (tr->current_trace->start) tr->current_trace->start (tr);
PATCH 93/328 ext4: fix spectre gadget in ext4_mb_regular_allocator()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Cline <[email protected]>
commit 1a5d5e5d51e75a5bca67dadbcea8c841934b7b85 upstream.
'ac->ac_g_ex.fe_len' is a user-controlled value which is used in the derivation of 'ac->ac_2order'. 'ac->ac_2order', in turn, is used to index arrays which makes it a potential spectre gadget. Fix this by sanitizing the value assigned to 'ac->ac2_order'. This covers the following accesses found with the help of smatch:
* fs/ext4/mballoc.c:1896 ext4_mb_simple_scan_group() warn: potential spectre issue 'grp->bb_counters' [w] (local cap)
* fs/ext4/mballoc.c:445 mb_find_buddy() warn: potential spectre issue 'EXT4_SB(e4b->bd_sb)->s_mb_offsets' [r] (local cap)
* fs/ext4/mballoc.c:446 mb_find_buddy() warn: potential spectre issue 'EXT4_SB(e4b->bd_sb)->s_mb_maxs' [r] (local cap)
--- fs/ext4/mballoc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/mballoc.c +3 -1
@@ -26,6 +26,7 @@#include <linux/log2.h> #include <linux/module.h> #include <linux/slab.h> +#include <linux/nospec.h> #include <trace/events/ext4.h> #ifdef CONFIG_EXT4_DEBUG
@@ -2124,7 +2125,8 @@ ext4_mb_regular_allocator(struct ext4_al* This should tell if fe_len is exactly power of 2 */ if ((ac->ac_g_ex.fe_len & (~(1 << (i -1 )))) ==0 ) - ac->ac_2order = i -1 ; + ac->ac_2order =array_index_nospec (i -1 , + sb->s_blocksize_bits +2 ); }/* if stream allocation is enabled, use global goal */
PATCH 96/328 scsi: sysfs: Introduce sysfs_{un,}break_active_protection()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 2afc9166f79b8f6da5f347f48515215ceee4ae37 upstream.
Introduce these two functions and export them such that the next patch can add calls to these functions from the SCSI core.
--- fs/sysfs/file.c | 44 +++++++++++++++++++++++++++++++++++++++++++ include/linux/sysfs.h | 14 ++++++++++++++ 2 files changed, 58 insertions(+)
fs/sysfs/file.c +44 -0
@@ -357,6 +357,50 @@ int sysfs_chmod_file(struct kobject *kobEXPORT_SYMBOL_GPL (sysfs_chmod_file);/** +* sysfs_break_active_protection - break "active" protection +* @kobj: The kernel object @attr is associated with. +* @attr: The attribute to break the "active" protection for. +* +* With sysfs, just like kernfs, deletion of an attribute is postponed until +* all active .show() and .store() callbacks have finished unless this function +* is called. Hence this function is useful in methods that implement self +* deletion. +*/ +struct kernfs_node *sysfs_break_active_protection (struct kobject *kobj, +const struct attribute *attr) +{ +struct kernfs_node *kn; + +kobject_get (kobj); + kn =kernfs_find_and_get (kobj->sd, attr->name); +if (kn) +kernfs_break_active_protection (kn); +return kn; +} +EXPORT_SYMBOL_GPL (sysfs_break_active_protection); + +/** +* sysfs_unbreak_active_protection - restore "active" protection +* @kn: Pointer returned by sysfs_break_active_protection(). +* +* Undo the effects of sysfs_break_active_protection(). Since this function +* calls kernfs_put() on the kernfs node that corresponds to the 'attr' +* argument passed to sysfs_break_active_protection() that attribute may have +* been removed between the sysfs_break_active_protection() and +* sysfs_unbreak_active_protection() calls, it is not safe to access @kn after +* this function has returned. +*/ +void sysfs_unbreak_active_protection (struct kernfs_node *kn) +{ +struct kobject *kobj = kn->parent->priv; + +kernfs_unbreak_active_protection (kn); +kernfs_put (kn); +kobject_put (kobj); +} +EXPORT_SYMBOL_GPL (sysfs_unbreak_active_protection); + +/** * sysfs_remove_file_ns - remove an object attribute with a custom ns tag * @kobj: object we're acting for * @attr: attribute descriptor
include/linux/sysfs.h +14 -0
@@ -204,6 +204,9 @@ int __must_check sysfs_create_files(stru const struct attribute **attr);int __must_check sysfs_chmod_file (struct kobject *kobj,const struct attribute *attr,umode_t mode); +struct kernfs_node *sysfs_break_active_protection (struct kobject *kobj, +const struct attribute *attr); +void sysfs_unbreak_active_protection (struct kernfs_node *kn);void sysfs_remove_file_ns (struct kobject *kobj,const struct attribute *attr,const void *ns);bool sysfs_remove_file_self (struct kobject *kobj,const struct attribute *attr);
@@ -314,6 +317,17 @@ static inline int sysfs_chmod_file(strucreturn 0 ; } +static inline struct kernfs_node * +sysfs_break_active_protection (struct kobject *kobj, +const struct attribute *attr) +{ +return NULL ; +} + +static inline void sysfs_unbreak_active_protection (struct kernfs_node *kn) +{ +} +static inline void sysfs_remove_file_ns (struct kobject *kobj,const struct attribute *attr,const void *ns)
PATCH 98/328 xfrm: Validate address prefix lengths in the xfrm selector.
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Klassert <[email protected]>
commit 07bf7908950a8b14e81aa1807e3c667eab39287a upstream.
We don't validate the address prefix lengths in the xfrm selector we got from userspace. This can lead to undefined behaviour in the address matching functions if the prefix is too big for the given address family. Fix this by checking the prefixes and refuse SA/policy insertation when a prefix is invalid.
--- net/xfrm/xfrm_user.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
net/xfrm/xfrm_user.c +12 -0
@@ -150,10 +150,16 @@ static int verify_newsa_info(struct xfrm err = -EINVAL ;switch (p->family) {case AF_INET : +if (p->sel.prefixlen_d >32 || p->sel.prefixlen_s >32 ) + goto out; +break ;case AF_INET6 :#if IS_ENABLED (CONFIG_IPV6 ) +if (p->sel.prefixlen_d >128 || p->sel.prefixlen_s >128 ) + goto out; +break ;#else err = -EAFNOSUPPORT ;
@@ -1227,10 +1233,16 @@ static int verify_newpolicy_info(structswitch (p->sel.family) {case AF_INET : +if (p->sel.prefixlen_d >32 || p->sel.prefixlen_s >32 ) +return -EINVAL ; +break ;case AF_INET6 :#if IS_ENABLED (CONFIG_IPV6 ) +if (p->sel.prefixlen_d >128 || p->sel.prefixlen_s >128 ) +return -EINVAL ; +break ;#else return -EAFNOSUPPORT ;
PATCH 108/328 percpu_counter: batch size aware __percpu_counter_compare()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit 80188b0d77d7426b494af739ac129e0e684acb84 upstream.
XFS uses non-stanard batch sizes for avoiding frequent global counter updates on it's allocated inode counters, as they increment or decrement in batches of 64 inodes. Hence the standard percpu counter batch of 32 means that the counter is effectively a global counter. Currently Xfs uses a batch size of 128 so that it doesn't take the global lock on every single modification.
However, Xfs also needs to compare accurately against zero, which means we need to use percpu_counter_compare(), and that has a hard-coded batch size of 32, and hence will spuriously fail to detect when it is supposed to use precise comparisons and hence the accounting goes wrong.
Add __percpu_counter_compare() to take a custom batch size so we can use it sanely in XFS and factor percpu_counter_compare() to use it.
--- include/linux/percpu_counter.h | 13 ++++++++++++- lib/percpu_counter.c | 6 +++--- 2 files changed, 15 insertions(+), 4 deletions(-)
include/linux/percpu_counter.h +12 -1
@@ -40,7 +40,12 @@ void percpu_counter_destroy(struct percpvoid percpu_counter_set (struct percpu_counter *fbc,s64 amount);void __percpu_counter_add (struct percpu_counter *fbc,s64 amount,s32 batch);s64 __percpu_counter_sum (struct percpu_counter *fbc); -int percpu_counter_compare (struct percpu_counter *fbc,s64 rhs); +int __percpu_counter_compare (struct percpu_counter *fbc,s64 rhs,s32 batch); + +static inline int percpu_counter_compare (struct percpu_counter *fbc,s64 rhs) +{ +return __percpu_counter_compare (fbc, rhs, percpu_counter_batch); +}static inline void percpu_counter_add (struct percpu_counter *fbc,s64 amount) {
@@ -114,6 +119,12 @@ static inline int percpu_counter_comparereturn 0 ; } +static inline int +__percpu_counter_compare (struct percpu_counter *fbc,s64 rhs,s32 batch) +{ +return percpu_counter_compare (fbc, rhs); +} +static inline void percpu_counter_add (struct percpu_counter *fbc,s64 amount) {
lib/percpu_counter.c +3 -3
@@ -193,13 +193,13 @@ static int percpu_counter_hotcpu_callbac* Compare counter against given value. * Return 1 if greater, 0 if equal and -1 if less */ -int percpu_counter_compare (struct percpu_counter *fbc,s64 rhs) +int __percpu_counter_compare (struct percpu_counter *fbc,s64 rhs,s32 batch) {s64 count; count =percpu_counter_read (fbc);/* Check to see if rough count will be sufficient for comparison */ -if (abs (count - rhs) > (percpu_counter_batch*num_online_cpus ())) { +if (abs (count - rhs) > (batch *num_online_cpus ())) {if (count > rhs)return 1 ;else
@@ -214,7 +214,7 @@ int percpu_counter_compare(struct percpuelse return 0 ; } -EXPORT_SYMBOL (percpu_counter_compare); +EXPORT_SYMBOL (__percpu_counter_compare);static int __init percpu_counter_startup (void ) {
PATCH 110/328 Btrfs: fix btrfs_write_inode vs delayed iput deadlock
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit 3c4276936f6fbe52884b4ea4e6cc120b890a0f9f upstream.
We recently ran into the following deadlock involving btrfs_write_inode():
[ +0.005066] __schedule+0x38e/0x8c0 [ +0.007144] schedule+0x36/0x80 [ +0.006447] bit_wait+0x11/0x60 [ +0.006446] __wait_on_bit+0xbe/0x110 [ +0.007487] ? bit_wait_io+0x60/0x60 [ +0.007319] __inode_wait_for_writeback+0x96/0xc0 [ +0.009568] ? autoremove_wake_function+0x40/0x40 [ +0.009565] inode_wait_for_writeback+0x21/0x30 [ +0.009224] evict+0xb0/0x190 [ +0.006099] iput+0x1a8/0x210 [ +0.006103] btrfs_run_delayed_iputs+0x73/0xc0 [ +0.009047] btrfs_commit_transaction+0x799/0x8c0 [ +0.009567] btrfs_write_inode+0x81/0xb0 [ +0.008008] __writeback_single_inode+0x267/0x320 [ +0.009569] writeback_sb_inodes+0x25b/0x4e0 [ +0.008702] wb_writeback+0x102/0x2d0 [ +0.007487] wb_workfn+0xa4/0x310 [ +0.006794] ? wb_workfn+0xa4/0x310 [ +0.007143] process_one_work+0x150/0x410 [ +0.008179] worker_thread+0x6d/0x520 [ +0.007490] kthread+0x12c/0x160 [ +0.006620] ? put_pwq_unlocked+0x80/0x80 [ +0.008185] ? kthread_park+0xa0/0xa0 [ +0.007484] ? do_syscall_64+0x53/0x150 [ +0.007837] ret_from_fork+0x29/0x40
Writeback calls:
btrfs_write_inode
btrfs_commit_transaction
btrfs_run_delayed_iputs
If iput() is called on that same inode, evict() will wait for writeback forever.
btrfs_write_inode() was originally added way back in 4730a4bc5bf3 ("btrfs_dirty_inode") to support O_SYNC writes. However, ->write_inode() hasn't been used for O_SYNC since 148f948ba877 ("vfs: Introduce new helpers for syncing after writing to O_SYNC file or IS_SYNC inode"), so btrfs_write_inode() is actually unnecessary (and leads to a bunch of unnecessary commits). Get rid of it, which also gets rid of the deadlock.
---
fs/btrfs/inode.c +0 -25
@@ -5542,31 +5542,6 @@ err:return ret; } -int btrfs_write_inode (struct inode *inode,struct writeback_control *wbc) -{ -struct btrfs_root *root =BTRFS_I (inode)->root; -struct btrfs_trans_handle *trans; -int ret =0 ; -bool nolock = false; - -if (test_bit (BTRFS_INODE_DUMMY , &BTRFS_I (inode)->runtime_flags)) -return 0 ; - -if (btrfs_fs_closing (root->fs_info) &&btrfs_is_free_space_inode (inode)) - nolock = true; - -if (wbc->sync_mode ==WB_SYNC_ALL ) { -if (nolock) - trans =btrfs_join_transaction_nolock (root); -else - trans =btrfs_join_transaction (root); -if (IS_ERR (trans)) -return PTR_ERR (trans); - ret =btrfs_commit_transaction (trans, root); - } -return ret; -} -/* * This is somewhat expensive, updating the tree every time the * inode changes. But, it is most likely to find the inode in cache.
fs/btrfs/super.c +0 -1
@@ -1852,7 +1852,6 @@ static const struct super_operations btr .sync_fs = btrfs_sync_fs, .show_options = btrfs_show_options, .show_devname = btrfs_show_devname, - .write_inode = btrfs_write_inode, .alloc_inode = btrfs_alloc_inode, .destroy_inode = btrfs_destroy_inode, .statfs = btrfs_statfs,
PATCH 112/328 ASoC: wm8994: Mark expected switch fall-through
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Gustavo A. R. Silva" <[email protected]>
commit 2cea1542859bc812f1ec51ea71c06e927e5b922e upstream.
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Addresses-Coverity-ID: 115050 ("Missing break in switch")
--- sound/soc/codecs/wm8994.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/wm8994.c +1 -0
@@ -2427,6 +2427,7 @@ static int wm8994_set_dai_sysclk(structsnd_soc_update_bits (codec,WM8994_POWER_MANAGEMENT_2 ,WM8994_OPCLK_ENA ,0 ); } +/* fall through */ default :return -EINVAL ;
PATCH 114/328 powerpc/pseries: Avoid using the size greater than RTAS_ERROR_LOG_MAX.
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mahesh Salgaonkar <[email protected]>
commit 74e96bf44f430cf7a01de19ba6cf49b361cdfd6e upstream.
The global mce data buffer that used to copy rtas error log is of 2048 (RTAS_ERROR_LOG_MAX) bytes in size. Before the copy we read extended_log_length from rtas error log header, then use max of extended_log_length and RTAS_ERROR_LOG_MAX as a size of data to be copied. Ideally the platform (phyp) will never send extended error log with size > 2048. But if that happens, then we have a risk of buffer overrun and corruption. Fix this by using min_t instead.
--- arch/powerpc/platforms/pseries/ras.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/pseries/ras.c +1 -1
@@ -309,7 +309,7 @@ static struct rtas_error_log *fwnmi_get_int len, error_log_length; error_log_length =8 +rtas_error_extended_log_length (h); - len =max_t (int, error_log_length,RTAS_ERROR_LOG_MAX ); + len =min_t (int, error_log_length,RTAS_ERROR_LOG_MAX );memset (global_mce_data_buf,0 ,RTAS_ERROR_LOG_MAX );memcpy (global_mce_data_buf, h, len); errhdr = (struct rtas_error_log *)global_mce_data_buf;
PATCH 125/328 powerpc/pseries: Fix endianness while restoring of r3 in MCE handler.
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mahesh Salgaonkar <[email protected]>
commit cd813e1cd7122f2c261dce5b54d1e0c97f80e1a5 upstream.
During Machine Check interrupt on pseries platform, register r3 points RTAS extended event log passed by hypervisor. Since hypervisor uses r3 to pass pointer to rtas log, it stores the original r3 value at the start of the memory (first 8 bytes) pointed by r3. Since hypervisor stores this info and rtas log is in BE format, linux should make sure to restore r3 value in correct endian format.
Without this patch when MCE handler, after recovery, returns to code that that caused the MCE may end up with Data SLB access interrupt for invalid address followed by kernel panic or hang.
Severe Machine check interrupt [Recovered]
NIP [d00000000ca301b8]: init_module+0x1b8/0x338 [bork_kernel]
Initiator: CPU
Error type: SLB [Multihit]
Effective address: d00000000ca70000
cpu 0xa: Vector: 380 (Data SLB Access) at [c0000000fc7775b0]
pc: c0000000009694c0: vsnprintf+0x80/0x480
lr: c0000000009698e0: vscnprintf+0x20/0x60
sp: c0000000fc777830
msr: 8000000002009033
dar: a803a30c000000d0
current = 0xc00000000bc9ef00
paca = 0xc00000001eca5c00 softe: 3 irq_happened: 0x01
pid = 8860, comm = insmod
vscnprintf+0x20/0x60
vprintk_emit+0xb4/0x4b0
vprintk_func+0x5c/0xd0
printk+0x38/0x4c
init_module+0x1c0/0x338 [bork_kernel]
do_one_initcall+0x54/0x230
do_init_module+0x8c/0x248
load_module+0x12b8/0x15b0
sys_finit_module+0xa8/0x110
system_call+0x58/0x6c
--- Exception: c00 (System Call) at 00007fff8bda0644
SP (7fffdfbfe980) is in userspaceThis patch fixes this issue.
--- arch/powerpc/platforms/pseries/ras.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/pseries/ras.c +1 -1
@@ -298,7 +298,7 @@ static struct rtas_error_log *fwnmi_get_ } savep =__va (regs->gpr[3 ]); - regs->gpr[3 ] = savep[0 ];/* restore original r3 */ + regs->gpr[3 ] =be64_to_cpu (savep[0 ]);/* restore original r3 */ /* If it isn't an extended log we can use the per cpu 64bit buffer */ h = (struct rtas_error_log *)&savep[1 ];
PATCH 132/328 9p/virtio: fix off-by-one error in sg list bounds check
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: jiangyiwen <[email protected]>
commit 23cba9cbde0bba05d772b335fe5f66aa82b9ad19 upstream.
Because the value of limit is VIRTQUEUE_NUM, if index is equal to limit, it will cause sg array out of bounds, so correct the judgement of BUG_ON.
--- net/9p/trans_virtio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/9p/trans_virtio.c +2 -1
@@ -193,7 +193,7 @@ static int pack_sg_list(struct scatterli s =rest_of_page (data);if (s > count) s = count; -BUG_ON (index > limit); +BUG_ON (index >= limit);/* Make sure we don't terminate early. */ sg_unmark_end (&sg[index]);sg_set_buf (&sg[index++], data, s);
@@ -239,6 +239,7 @@ pack_sg_list_p(struct scatterlist *sg, i s =rest_of_page (data);if (s > count) s = count; +BUG_ON (index >= limit);/* Make sure we don't terminate early. */ sg_unmark_end (&sg[index]);sg_set_page (&sg[index++], pdata[i++], s, data_off);
PATCH 133/328 KVM: arm/arm64: Skip updating PMD entry if no change
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Punit Agrawal <[email protected]>
commit 86658b819cd0a9aa584cd84453ed268a6f013770 upstream.
Contention on updating a PMD entry by a large number of vcpus can lead to duplicate work when handling stage 2 page faults. As the page table update follows the break-before-make requirement of the architecture, it can lead to repeated refaults due to clearing the entry and flushing the tlbs.
This problem is more likely when -
* there are large number of vcpus
* the mapping is large block mapping
such as when using PMD hugepages (512MB) with 64k pages.
Fix this by skipping the page table update if there is no change in the entry being updated.
--- arch/arm/kvm/mmu.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-)
arch/arm/kvm/mmu.c +27 -11
@@ -685,19 +685,35 @@ static int stage2_set_pmd_huge(struct kv pmd =stage2_get_pmd (kvm, cache, addr);VM_BUG_ON (!pmd); -/* -* Mapping in huge pages should only happen through a fault. If a -* page is merged into a transparent huge page, the individual -* subpages of that huge page should be unmapped through MMU -* notifiers before we get here. -* -* Merging of CompoundPages is not supported; they should become -* splitting first, unmapped, merged, and mapped back in on-demand. -*/ -VM_BUG_ON (pmd_present (*pmd) &&pmd_pfn (*pmd) !=pmd_pfn (*new_pmd)); - old_pmd = *pmd;if (pmd_present (old_pmd)) { +/* +* Multiple vcpus faulting on the same PMD entry, can +* lead to them sequentially updating the PMD with the +* same value. Following the break-before-make +* (pmd_clear() followed by tlb_flush()) process can +* hinder forward progress due to refaults generated +* on missing translations. +* +* Skip updating the page table if the entry is +* unchanged. +*/ +if (pmd_val (old_pmd) ==pmd_val (*new_pmd)) +return 0 ; + +/* +* Mapping in huge pages should only happen through a +* fault. If a page is merged into a transparent huge +* page, the individual subpages of that huge page +* should be unmapped through MMU notifiers before we +* get here. +* +* Merging of CompoundPages is not supported; they +* should become splitting first, unmapped, merged, +* and mapped back in on-demand. +*/ +VM_BUG_ON (pmd_pfn (old_pmd) !=pmd_pfn (*new_pmd)); +pmd_clear (pmd);kvm_tlb_flush_vmid_ipa (kvm, addr); }else {
PATCH 136/328 xtensa: limit offsets in __loop_cache_{all,page}
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit be75de25251f7cf3e399ca1f584716a95510d24a upstream.
When building kernel for xtensa cores with big cache lines (e.g. 128 bytes or more) __loop_cache_all and __loop_cache_page may generate assembly instructions with immediate fields that are too big. This results in the following build errors:
arch/xtensa/mm/misc.S: Assembler messages:
arch/xtensa/mm/misc.S:464: Error: operand 2 of 'diwbi' has invalid value '256' arch/xtensa/mm/misc.S:464: Error: operand 2 of 'diwbi' has invalid value '384' arch/xtensa/kernel/head.S: Assembler messages:
arch/xtensa/kernel/head.S:172: Error: operand 2 of 'diu' has invalid value '256' arch/xtensa/kernel/head.S:172: Error: operand 2 of 'diu' has invalid value '384' arch/xtensa/kernel/head.S:176: Error: operand 2 of 'iiu' has invalid value '256' arch/xtensa/kernel/head.S:176: Error: operand 2 of 'iiu' has invalid value '384' arch/xtensa/kernel/head.S:255: Error: operand 2 of 'diwb' has invalid value '256' arch/xtensa/kernel/head.S:255: Error: operand 2 of 'diwb' has invalid value '384'
Add parameter max_immed to these macros and use it to limit values of immediate operands. Extract common code of these macros into the new macro __loop_cache_unroll.
--- arch/xtensa/include/asm/cacheasm.h | 65 ++++++++++++++++++------------ 1 file changed, 40 insertions(+), 25 deletions(-)
arch/xtensa/include/asm/cacheasm.h +40 -25
@@ -31,16 +31,32 @@* */ - .macro __loop_cache_all ar at insn size line_width - movi \ar, 0 + .macro __loop_cache_unroll ar at insn size line_width max_immed + + .if (1 << (\line_width)) > (\max_immed) + .set _reps, 1 + .elseif (2 << (\line_width)) > (\max_immed) + .set _reps, 2 + .else + .set _reps, 4 + .endif + + __loopi \ar, \at, \size, (_reps << (\line_width)) + .set _index, 0 + .rep _reps + \insn \ar, _index << (\line_width) + .set _index, _index + 1 + .endr + __endla \ar, \at, _reps << (\line_width) + + .endm + - __loopi \ar, \at, \size, (4 << (\line_width)) - \insn \ar, 0 << (\line_width) - \insn \ar, 1 << (\line_width) - \insn \ar, 2 << (\line_width) - \insn \ar, 3 << (\line_width) - __endla \ar, \at, 4 << (\line_width) + .macro __loop_cache_all ar at insn size line_width max_immed + + movi \ar, 0 + __loop_cache_unroll \ar, \at, \insn, \size, \line_width, \max_immed .endm
@@ -57,14 +73,9 @@ .endm - .macro __loop_cache_page ar at insn line_width + .macro __loop_cache_page ar at insn line_width max_immed - __loopi \ar, \at, PAGE_SIZE, 4 << (\line_width) - \insn \ar, 0 << (\line_width) - \insn \ar, 1 << (\line_width) - \insn \ar, 2 << (\line_width) - \insn \ar, 3 << (\line_width) - __endla \ar, \at, 4 << (\line_width) + __loop_cache_unroll \ar, \at, \insn, PAGE_SIZE, \line_width, \max_immed .endm
@@ -73,7 +84,8 @@ .macro ___unlock_dcache_all ar at - __loop_cache_all \ar \at diu XCHAL_DCACHE_SIZE XCHAL_DCACHE_LINEWIDTH + __loop_cache_all \ar \at diu XCHAL_DCACHE_SIZE \ + XCHAL_DCACHE_LINEWIDTH 240 .endm
@@ -83,21 +95,24 @@ .macro ___unlock_icache_all ar at - __loop_cache_all \ar \at iiu XCHAL_ICACHE_SIZE XCHAL_ICACHE_LINEWIDTH + __loop_cache_all \ar \at iiu XCHAL_ICACHE_SIZE \ + XCHAL_ICACHE_LINEWIDTH 240 .endm #endif .macro ___flush_invalidate_dcache_all ar at - __loop_cache_all \ar \at diwbi XCHAL_DCACHE_SIZE XCHAL_DCACHE_LINEWIDTH + __loop_cache_all \ar \at diwbi XCHAL_DCACHE_SIZE \ + XCHAL_DCACHE_LINEWIDTH 240 .endm .macro ___flush_dcache_all ar at - __loop_cache_all \ar \at diwb XCHAL_DCACHE_SIZE XCHAL_DCACHE_LINEWIDTH + __loop_cache_all \ar \at diwb XCHAL_DCACHE_SIZE \ + XCHAL_DCACHE_LINEWIDTH 240 .endm
@@ -105,7 +120,7 @@ .macro ___invalidate_dcache_all ar at __loop_cache_all \ar \at dii __stringify(DCACHE_WAY_SIZE) \ - XCHAL_DCACHE_LINEWIDTH + XCHAL_DCACHE_LINEWIDTH 1020 .endm
@@ -113,7 +128,7 @@ .macro ___invalidate_icache_all ar at __loop_cache_all \ar \at iii __stringify(ICACHE_WAY_SIZE) \ - XCHAL_ICACHE_LINEWIDTH + XCHAL_ICACHE_LINEWIDTH 1020 .endm
@@ -150,27 +165,27 @@ .macro ___flush_invalidate_dcache_page ar as - __loop_cache_page \ar \as dhwbi XCHAL_DCACHE_LINEWIDTH + __loop_cache_page \ar \as dhwbi XCHAL_DCACHE_LINEWIDTH 1020 .endm .macro ___flush_dcache_page ar as - __loop_cache_page \ar \as dhwb XCHAL_DCACHE_LINEWIDTH + __loop_cache_page \ar \as dhwb XCHAL_DCACHE_LINEWIDTH 1020 .endm .macro ___invalidate_dcache_page ar as - __loop_cache_page \ar \as dhi XCHAL_DCACHE_LINEWIDTH + __loop_cache_page \ar \as dhi XCHAL_DCACHE_LINEWIDTH 1020 .endm .macro ___invalidate_icache_page ar as - __loop_cache_page \ar \as ihi XCHAL_ICACHE_LINEWIDTH + __loop_cache_page \ar \as ihi XCHAL_ICACHE_LINEWIDTH 1020 .endm
PATCH 143/328 s390/pci: fix out of bounds access during irq setup
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Ott <[email protected]>
commit 866f3576a72b2233a76dffb80290f8086dc49e17 upstream.
During interrupt setup we allocate interrupt vectors, walk the list of msi descriptors, and fill in the message data. Requesting more interrupts than supported on s390 can lead to an out of bounds access.
When we restrict the number of interrupts we should also stop walking the msi list after all supported interrupts are handled.
--- arch/s390/pci/pci.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/pci/pci.c +2 -0
@@ -397,6 +397,8 @@ int arch_setup_msi_irqs(struct pci_dev * hwirq =0 ;list_for_each_entry (msi, &pdev->msi_list, list) { rc = -EIO ; +if (hwirq >= msi_vecs) +break ; irq =irq_alloc_desc (0 );/* Alloc irq on node 0 */ if (irq <0 ) goto out_msi;
PATCH 146/328 tracing/blktrace: Fix to allow setting same value
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (VMware)" <[email protected]>
commit 757d9140072054528b13bbe291583d9823cde195 upstream.
Masami Hiramatsu reported:
Current trace-enable attribute in sysfs returns an error if user writes the same setting value as current one, e.g.
# cat /sys/block/sda/trace/enable
0
# echo 0 > /sys/block/sda/trace/enable
bash: echo: write error: Invalid argument
# echo 1 > /sys/block/sda/trace/enable
# echo 1 > /sys/block/sda/trace/enable
bash: echo: write error: Device or resource busyBut this is not a preferred behavior, it should ignore if new setting is same as current one. This fixes the problem as below.
# cat /sys/block/sda/trace/enable
0
# echo 0 > /sys/block/sda/trace/enable
# echo 1 > /sys/block/sda/trace/enable
# echo 1 > /sys/block/sda/trace/enable--- kernel/trace/blktrace.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/trace/blktrace.c +4 -0
@@ -1778,6 +1778,10 @@ static ssize_t sysfs_blk_trace_attr_stormutex_lock (&q->blk_trace_mutex);if (attr == &dev_attr_enable) { +if (!!value == !!q->blk_trace) { + ret =0 ; + goto out_unlock_bdev; + }if (value) ret =blk_trace_setup_queue (q, bdev);else
PATCH 151/328 iscsi-target: nullify session in failed login sequence
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
commit a0b3b9b2409b409c677f7eb1e0485b816a5848f7 upstream.
In case login sequence failed, make sure conn->sess is NULL before calling wait_conn as some transports (iser) may rely on that (waiting for session commands).
--- drivers/target/iscsi/iscsi_target_login.c | 1 + 1 file changed, 1 insertion(+)
drivers/target/iscsi/iscsi_target_login.c +1 -0
@@ -1209,6 +1209,7 @@ void iscsi_target_login_sess_out(struct }kfree (conn->sess->sess_ops);kfree (conn->sess); + conn->sess =NULL ; old_sess_out:iscsi_stop_login_thread_timer (np);
PATCH 154/328 fs/quota: Fix spectre gadget in do_quotactl
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Cline <[email protected]>
commit 7b6924d94a60c6b8c1279ca003e8744e6cd9e8b1 upstream.
'type' is user-controlled, so sanitize it after the bounds check to avoid using it in speculative execution. This covers the following potential gadgets detected with the help of smatch:
* fs/ext4/super.c:5741 ext4_quota_read() warn: potential spectre issue 'sb_dqopt(sb)->files' [r]
* fs/ext4/super.c:5778 ext4_quota_write() warn: potential spectre issue 'sb_dqopt(sb)->files' [r]
* fs/f2fs/super.c:1552 f2fs_quota_read() warn: potential spectre issue 'sb_dqopt(sb)->files' [r]
* fs/f2fs/super.c:1608 f2fs_quota_write() warn: potential spectre issue 'sb_dqopt(sb)->files' [r]
* fs/quota/dquot.c:412 mark_info_dirty() warn: potential spectre issue 'sb_dqopt(sb)->info' [w]
* fs/quota/dquot.c:933 dqinit_needed() warn: potential spectre issue 'dquots' [r]
* fs/quota/dquot.c:2112 dquot_commit_info() warn: potential spectre issue 'dqopt->ops' [r]
* fs/quota/dquot.c:2362 vfs_load_quota_inode() warn: potential spectre issue 'dqopt->files' [w] (local cap)
* fs/quota/dquot.c:2369 vfs_load_quota_inode() warn: potential spectre issue 'dqopt->ops' [w] (local cap)
* fs/quota/dquot.c:2370 vfs_load_quota_inode() warn: potential spectre issue 'dqopt->info' [w] (local cap)
* fs/quota/quota.c:110 quota_getfmt() warn: potential spectre issue 'sb_dqopt(sb)->info' [r]
* fs/quota/quota_v2.c:84 v2_check_quota_file() warn: potential spectre issue 'quota_magics' [w]
* fs/quota/quota_v2.c:85 v2_check_quota_file() warn: potential spectre issue 'quota_versions' [w]
* fs/quota/quota_v2.c:96 v2_read_file_info() warn: potential spectre issue 'dqopt->info' [r]
* fs/quota/quota_v2.c:172 v2_write_file_info() warn: potential spectre issue 'dqopt->info' [r]
Additionally, a quick inspection indicates there are array accesses with 'type' in quota_on() and quota_off() functions which are also addressed by this.
[bwh: Backported to 3.16: The maximum valid quota type is command-dependent.
Introduce a local variable rather than repeating the expression.]
---
fs/quota/quota.c +4 -1
@@ -17,6 +17,7 @@#include <linux/quotaops.h> #include <linux/types.h> #include <linux/writeback.h> +#include <linux/nospec.h> static int check_quotactl_permission (struct super_block *sb,int type,int cmd,qid_t id)
@@ -405,10 +406,12 @@ static int quota_rmxquota(struct super_bstatic int do_quotactl (struct super_block *sb,int type,int cmd,qid_t id,void __user *addr,struct path *path) { +unsigned int max_quotas =XQM_COMMAND (cmd) ?XQM_MAXQUOTAS :MAXQUOTAS ;int ret; -if (type >= (XQM_COMMAND (cmd) ?XQM_MAXQUOTAS :MAXQUOTAS )) +if (type >= max_quotas)return -EINVAL ; + type =array_index_nospec (type, max_quotas);if (!sb->s_qcop)return -ENOSYS ;
PATCH 157/328 getxattr: use correct xattr length
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
commit 82c9a927bc5df6e06b72d206d24a9d10cced4eb5 upstream.
When running in a container with a user namespace, if you call getxattr with name = "system.posix_acl_access" and size % 8 != 4, then getxattr silently skips the user namespace fixup that it normally does resulting in un-fixed-up data being returned.
This is caused by posix_acl_fix_xattr_to_user() being passed the total buffer size and not the actual size of the xattr as returned by vfs_getxattr().
This commit passes the actual length of the xattr as returned by vfs_getxattr() down.
A reproducer for the issue is:
touch acl_posix
setfacl -m user:0:rwx acl_posix
and the compile:
#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <attr/xattr.h>
/* Run in user namespace with nsuid 0 mapped to uid != 0 on the host. */
int main(int argc, void **argv)
{
ssize_t ret1, ret2;
char buf1[128], buf2[132];
int fret = EXIT_SUCCESS;
char *file; if (argc < 2) {
fprintf(stderr,
"Please specify a file with "
"\"system.posix_acl_access\" permissions set\n");
_exit(EXIT_FAILURE);
}
file = argv[1];
ret1 = getxattr(file, "system.posix_acl_access",
buf1, sizeof(buf1));
if (ret1 < 0) {
fprintf(stderr, "%s - Failed to retrieve "
"\"system.posix_acl_access\" "
"from \"%s\"\n", strerror(errno), file);
_exit(EXIT_FAILURE);
}
ret2 = getxattr(file, "system.posix_acl_access",
buf2, sizeof(buf2));
if (ret2 < 0) {
fprintf(stderr, "%s - Failed to retrieve "
"\"system.posix_acl_access\" "
"from \"%s\"\n", strerror(errno), file);
_exit(EXIT_FAILURE);
}
if (ret1 != ret2) {
fprintf(stderr, "The value of \"system.posix_acl_"
"access\" for file \"%s\" changed "
"between two successive calls\n", file);
_exit(EXIT_FAILURE);
}
for (ssize_t i = 0; i < ret2; i++) {
if (buf1[i] == buf2[i])
continue;
fprintf(stderr,
"Unexpected different in byte %zd: "
"%02x != %02x\n", i, buf1[i], buf2[i]);
fret = EXIT_FAILURE;
}
if (fret == EXIT_SUCCESS)
fprintf(stderr, "Test passed\n");
else
fprintf(stderr, "Test failed\n");
_exit(fret); }
and run:
./tester acl_posix
On a non-fixed up kernel this should return something like:
root@c1:/# ./t Unexpected different in byte 16: ffffffa0 != 00 Unexpected different in byte 17: ffffff86 != 00 Unexpected different in byte 18: 01 != 00
and on a fixed kernel:
root@c1:~# ./t Test passed
--- fs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xattr.c +1 -1
@@ -466,7 +466,7 @@ getxattr(struct dentry *d, const char __if (error >0 ) {if ((strcmp (kname,XATTR_NAME_POSIX_ACL_ACCESS ) ==0 ) || (strcmp (kname,XATTR_NAME_POSIX_ACL_DEFAULT ) ==0 )) -posix_acl_fix_xattr_to_user (kvalue, size); +posix_acl_fix_xattr_to_user (kvalue, error);if (size &©_to_user (value, kvalue, error)) error = -EFAULT ; }else if (error == -ERANGE && size >=XATTR_SIZE_MAX ) {
PATCH 165/328 x86/speculation/l1tf: Increase l1tf memory limit for Nehalem+
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andi Kleen <[email protected]>
commit cc51e5428ea54f575d49cfcede1d4cb3a72b4ec4 upstream.
On Nehalem and newer core CPUs the CPU cache internally uses 44 bits physical address space. The L1TF workaround is limited by this internal cache address width, and needs to have one bit free there for the mitigation to work.
Older client systems report only 36bit physical address space so the range check decides that L1TF is not mitigated for a 36bit phys/32GB system with some memory holes.
But since these actually have the larger internal cache width this warning is bogus because it would only really be needed if the system had more than 43bits of memory.
Add a new internal x86_cache_bits field. Normally it is the same as the physical bits field reported by CPUID, but for Nehalem and newerforce it to be at least 44bits.
Change the L1TF memory size warning to use the new cache_bits field to avoid bogus warnings and remove the bogus comment about memory size.
--- arch/x86/include/asm/processor.h | 4 ++- arch/x86/kernel/cpu/bugs.c | 46 ++++++++++++++++++++++++++++---- arch/x86/kernel/cpu/common.c | 1 + 3 files changed, 45 insertions(+), 6 deletions(-)
arch/x86/include/asm/processor.h +3 -1
@@ -127,6 +127,8 @@ struct cpuinfo_x86 {/* Index into per_cpu list: */ u16 cpu_index;u32 microcode; +/* Address space bits used by the cache internally */ +u8 x86_cache_bits; } __attribute__((__aligned__(SMP_CACHE_BYTES)));#define X86_VENDOR_INTEL 0
@@ -167,7 +169,7 @@ extern void fpu_detect(struct cpuinfo_x8static inline unsigned long long l1tf_pfn_limit (void ) { -return BIT_ULL (boot_cpu_data.x86_phys_bits -1 -PAGE_SHIFT ); +return BIT_ULL (boot_cpu_data.x86_cache_bits -1 -PAGE_SHIFT ); }extern void early_cpu_init (void );
arch/x86/kernel/cpu/bugs.c +41 -5
63 lines not on this page · raw message
arch/x86/kernel/cpu/common.c +1 -0
@@ -772,6 +772,7 @@ void get_cpu_cap(struct cpuinfo_x86 *c) else if (cpu_has(c, X86_FEATURE_PAE) || cpu_has(c, X86_FEATURE_PSE36)) c->x86_phys_bits = 36;#endif + c->x86_cache_bits = c->x86_phys_bits;if (c->extended_cpuid_level >=0x80000007 ) c->x86_power =cpuid_edx (0x80000007 );
PATCH 166/328 USB: serial: io_ti: fix array underflow in completion handler
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 691a03cfe8ca483f9c48153b869d354e4ae3abef upstream.
As reported by Dan Carpenter, a malicious USB device could set port_number to a negative value and we would underflow the port array in the interrupt completion handler.
As these devices only have one or two ports, fix this by making sure we only consider the seventh bit when determining the port number (and ignore bits 0xb0 which are typically set to 0x30).
--- drivers/usb/serial/io_ti.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/io_ti.h +1 -1
@@ -178,7 +178,7 @@ struct ump_interrupt { } __attribute__((packed)); -#define TIUMP_GET_PORT_FROM_CODE (c) (((c) >> 4) - 3) +#define TIUMP_GET_PORT_FROM_CODE (c) (((c) >> 6) & 0x01)#define TIUMP_GET_FUNC_FROM_CODE (c) ((c) & 0x0f)#define TIUMP_INTERRUPT_CODE_LSR 0x03#define TIUMP_INTERRUPT_CODE_MSR 0x04
PATCH 178/328 x86/microcode: Make sure boot_cpu_data.microcode is up-to-date
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Prarit Bhargava <[email protected]>
commit 370a132bb2227ff76278f98370e0e701d86ff752 upstream.
When preparing an MCE record for logging, boot_cpu_data.microcode is used to read out the microcode revision on the box.
However, on systems where late microcode update has happened, the microcode revision output in a MCE log record is wrong because boot_cpu_data.microcode is not updated when the microcode gets updated.
But, the microcode revision saved in boot_cpu_data's microcode member should be kept up-to-date, regardless, for consistency.
Make it so.
--- arch/x86/kernel/cpu/microcode/amd.c | 4 ++++ arch/x86/kernel/cpu/microcode/intel.c | 4 ++++ 2 files changed, 8 insertions(+)
arch/x86/kernel/cpu/microcode/amd.c +4 -0
@@ -231,6 +231,10 @@ int apply_microcode_amd(int cpu) uci->cpu_sig.rev = mc_amd->hdr.patch_id; c->microcode = mc_amd->hdr.patch_id; +/* Update boot_cpu_data's revision too, if we're on the BSP: */ +if (c->cpu_index == boot_cpu_data.cpu_index) + boot_cpu_data.microcode = mc_amd->hdr.patch_id; +return 0 ; }
arch/x86/kernel/cpu/microcode/intel.c +4 -0
@@ -188,6 +188,10 @@ int apply_microcode(int cpu) uci->cpu_sig.rev = rev; c->microcode = rev; +/* Update boot_cpu_data's revision too, if we're on the BSP: */ +if (c->cpu_index == boot_cpu_data.cpu_index) + boot_cpu_data.microcode = rev; +return 0 ; }
PATCH 182/328 SMB3: Backup intent flag missing for directory opens with backupuid mounts
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 5e19697b56a64004e2d0ff1bb952ea05493c088f upstream.
When "backup intent" is requested on the mount (e.g. backupuid or backupgid mount options), the corresponding flag needs to be set on opens of directories (and files) but was missing in some places causing access denied trying to enumerate and backup servers.
Fixes kernel bugzilla #200953
https://bugzilla.kernel.org/show_bug.cgi?id=200953
---
fs/cifs/inode.c +2 -0
@@ -446,6 +446,8 @@ cifs_sfu_type(struct cifs_fattr *fattr, oparms.cifs_sb = cifs_sb; oparms.desired_access =GENERIC_READ ; oparms.create_options =CREATE_NOT_DIR ; +if (backup_cred (cifs_sb)) + oparms.create_options |=CREATE_OPEN_BACKUP_INTENT ; oparms.disposition =FILE_OPEN ; oparms.path = path; oparms.fid = &fid;
fs/cifs/smb2ops.c +12 -3
@@ -315,7 +315,10 @@ smb2_is_path_accessible(const unsigned i oparms.tcon = tcon; oparms.desired_access =FILE_READ_ATTRIBUTES ; oparms.disposition =FILE_OPEN ; - oparms.create_options =0 ; +if (backup_cred (cifs_sb)) + oparms.create_options =CREATE_OPEN_BACKUP_INTENT ; +else + oparms.create_options =0 ; oparms.fid = &fid; oparms.reconnect = false;
@@ -725,7 +728,10 @@ smb2_query_dir_first(const unsigned int oparms.tcon = tcon; oparms.desired_access =FILE_READ_ATTRIBUTES |FILE_READ_DATA ; oparms.disposition =FILE_OPEN ; - oparms.create_options =0 ; +if (backup_cred (cifs_sb)) + oparms.create_options =CREATE_OPEN_BACKUP_INTENT ; +else + oparms.create_options =0 ; oparms.fid = fid; oparms.reconnect = false;
@@ -891,7 +897,10 @@ smb2_query_symlink(const unsigned int xi oparms.tcon = tcon; oparms.desired_access =FILE_READ_ATTRIBUTES ; oparms.disposition =FILE_OPEN ; - oparms.create_options =0 ; +if (backup_cred (cifs_sb)) + oparms.create_options =CREATE_OPEN_BACKUP_INTENT ; +else + oparms.create_options =0 ; oparms.fid = &fid; oparms.reconnect = false;
PATCH 183/328 smb3: check for and properly advertise directory lease support
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit f801568332321e2b1e7a8bd26c3e4913a312a2ec upstream.
Although servers will typically ignore unsupported features, we should advertise the support for directory leases (as Windows e.g. does) in the negotiate protocol capabilities we pass to the server, and should check for the server capability (CAP_DIRECTORY_LEASING) before sending a lease request for an open of a directory. This will prevent us from accidentally sending directory leases to SMB2.1 or SMB2 server for example.
[bwh: Backported to 3.16:
- Drop changes to smb3any_values, smbdefault_values, smb311_values
- Adjust context]
---
fs/cifs/smb2ops.c +2 -2
@@ -1433,7 +1433,7 @@ struct smb_version_values smb21_values =struct smb_version_values smb30_values = { .version_string =SMB30_VERSION_STRING , .protocol_id =SMB30_PROT_ID , - .req_capabilities =SMB2_GLOBAL_CAP_DFS |SMB2_GLOBAL_CAP_LEASING |SMB2_GLOBAL_CAP_LARGE_MTU , + .req_capabilities =SMB2_GLOBAL_CAP_DFS |SMB2_GLOBAL_CAP_LEASING |SMB2_GLOBAL_CAP_LARGE_MTU |SMB2_GLOBAL_CAP_DIRECTORY_LEASING , .large_lock_type =0 , .exclusive_lock_type =SMB2_LOCKFLAG_EXCLUSIVE_LOCK , .shared_lock_type =SMB2_LOCKFLAG_SHARED_LOCK ,
@@ -1453,7 +1453,7 @@ struct smb_version_values smb30_values =struct smb_version_values smb302_values = { .version_string =SMB302_VERSION_STRING , .protocol_id =SMB302_PROT_ID , - .req_capabilities =SMB2_GLOBAL_CAP_DFS |SMB2_GLOBAL_CAP_LEASING |SMB2_GLOBAL_CAP_LARGE_MTU , + .req_capabilities =SMB2_GLOBAL_CAP_DFS |SMB2_GLOBAL_CAP_LEASING |SMB2_GLOBAL_CAP_LARGE_MTU |SMB2_GLOBAL_CAP_DIRECTORY_LEASING , .large_lock_type =0 , .exclusive_lock_type =SMB2_LOCKFLAG_EXCLUSIVE_LOCK , .shared_lock_type =SMB2_LOCKFLAG_SHARED_LOCK ,
fs/cifs/smb2pdu.c +3 -0
@@ -1211,6 +1211,9 @@ SMB2_open(const unsigned int xid, structif (!(server->capabilities &SMB2_GLOBAL_CAP_LEASING ) || *oplock ==SMB2_OPLOCK_LEVEL_NONE ) req->RequestedOplockLevel = *oplock; +else if (!(server->capabilities &SMB2_GLOBAL_CAP_DIRECTORY_LEASING ) && + (oparms->create_options &CREATE_NOT_FILE )) + req->RequestedOplockLevel = *oplock;/* no srv lease support */ else { rc =add_lease_context (server, iov, &num_iovecs, oparms->fid->lease_key, oplock);
PATCH 186/328 spi: tegra20-slink: explicitly enable/disable clock
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Ziswiler <[email protected]>
commit 7001cab1dabc0b72b2b672ef58a90ab64f5e2343 upstream.
Depending on the SPI instance one may get an interrupt storm upon requesting resp. interrupt unless the clock is explicitly enabled beforehand. This has been observed trying to bring up instance 4 on T20.
--- drivers/spi/spi-tegra20-slink.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
drivers/spi/spi-tegra20-slink.c +23 -8
@@ -1063,6 +1063,24 @@ static int tegra_slink_probe(struct plat goto exit_free_master; } +/* disabled clock may cause interrupt storm upon request */ + tspi->clk =devm_clk_get (&pdev->dev,NULL ); +if (IS_ERR (tspi->clk)) { + ret =PTR_ERR (tspi->clk); +dev_err (&pdev->dev,"Can not get clock %d\n" , ret); + goto exit_free_master; + } + ret =clk_prepare (tspi->clk); +if (ret <0 ) { +dev_err (&pdev->dev,"Clock prepare failed %d\n" , ret); + goto exit_free_master; + } + ret =clk_enable (tspi->clk); +if (ret <0 ) { +dev_err (&pdev->dev,"Clock enable failed %d\n" , ret); + goto exit_free_master; + } + spi_irq =platform_get_irq (pdev,0 ); tspi->irq = spi_irq; ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
@@ -1071,14 +1089,7 @@ static int tegra_slink_probe(struct platif (ret <0 ) {dev_err (&pdev->dev,"Failed to register ISR for IRQ %d\n" , tspi->irq); - goto exit_free_master; - } - - tspi->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (tspi->clk)) { -dev_err (&pdev->dev,"can not get clock\n" ); - ret =PTR_ERR (tspi->clk); - goto exit_free_irq; + goto exit_clk_disable; } tspi->rst =devm_reset_control_get (&pdev->dev,"spi" );
@@ -1138,6 +1149,8 @@ exit_rx_dma_free:tegra_slink_deinit_dma_param (tspi, true); exit_free_irq:free_irq (spi_irq, tspi); +exit_clk_disable: +clk_disable (tspi->clk); exit_free_master:spi_master_put (master);return ret;
@@ -1150,6 +1163,8 @@ static int tegra_slink_remove(struct plafree_irq (tspi->irq, tspi); +clk_disable (tspi->clk); +if (tspi->tx_dma_chan)tegra_slink_deinit_dma_param (tspi, false);
PATCH 188/328 ext4: prevent online resize with backup superblock
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 011fa99404bea3f5d897c4983f6bd51170e3b18f upstream.
Prevent BUG or corrupted file systems after the following:
mkfs.ext4 /dev/vdc 100M
mount -t ext4 -o sb=40961 /dev/vdc /vdc
resize2fs /dev/vdc
We previously prevented online resizing using the old resize ioctl. Move the code to ext4_resize_begin(), so the check applies for all of the resize ioctl's.
--- fs/ext4/resize.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
fs/ext4/resize.c +12 -12
@@ -24,6 +24,18 @@ int ext4_resize_begin(struct super_blockreturn -EPERM ;/* +* If we are not using the primary superblock/GDT copy don't resize, +* because the user tools have no way of handling this. Probably a +* bad time to do it anyways. +*/ +if (EXT4_SB (sb)->s_sbh->b_blocknr != +le32_to_cpu (EXT4_SB (sb)->s_es->s_first_data_block)) { +ext4_warning (sb,"won't resize using backup superblock at %llu" , + (unsigned long long )EXT4_SB (sb)->s_sbh->b_blocknr); +return -EPERM ; + } + +/* * We are not allowed to do online-resizing on a filesystem mounted * with error, because it can destroy the filesystem easily. */
@@ -758,18 +770,6 @@ static int add_new_gdb(handle_t *handle,"EXT4-fs: ext4_add_new_gdb: adding group block %lu\n" , gdb_num); -/* -* If we are not using the primary superblock/GDT copy don't resize, -* because the user tools have no way of handling this. Probably a -* bad time to do it anyways. -*/ -if (EXT4_SB (sb)->s_sbh->b_blocknr != -le32_to_cpu (EXT4_SB (sb)->s_es->s_first_data_block)) { -ext4_warning (sb,"won't resize using backup superblock at %llu" , - (unsigned long long )EXT4_SB (sb)->s_sbh->b_blocknr); -return -EPERM ; - } - gdb_bh =sb_bread (sb, gdblock);if (!gdb_bh)return -EIO ;
PATCH 189/328 ext4: fix online resizing for bigalloc file systems with a 1k block size
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 5f8c10936fab2b69a487400f2872902e597dd320 upstream.
An online resize of a file system with the bigalloc feature enabled and a 1k block size would be refused since ext4_resize_begin() did not understand s_first_data_block is 0 for all bigalloc file systems, even when the block size is 1k.
--- fs/ext4/resize.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ext4/resize.c +2 -1
@@ -18,6 +18,7 @@int ext4_resize_begin (struct super_block *sb) { +struct ext4_sb_info *sbi =EXT4_SB (sb);int ret =0 ;if (!capable (CAP_SYS_RESOURCE ))
@@ -28,7 +29,7 @@ int ext4_resize_begin(struct super_block* because the user tools have no way of handling this. Probably a * bad time to do it anyways. */ -if (EXT4_SB (sb)->s_sbh->b_blocknr != +if (EXT4_B2C (sbi, sbi->s_sbh->b_blocknr) !=le32_to_cpu (EXT4_SB (sb)->s_es->s_first_data_block)) {ext4_warning (sb,"won't resize using backup superblock at %llu" , (unsigned long long )EXT4_SB (sb)->s_sbh->b_blocknr);
PATCH 190/328 nbd: don't allow invalid blocksize settings
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit bc811f05d77f47059c197a98b6ad242eb03999cb upstream.
syzbot reports a divide-by-zero off the NBD_SET_BLKSIZE ioctl. We need proper validation of the input here. Not just if it's zero, but also if the value is a power-of-2 and in a valid range. Add that.
--- drivers/block/nbd.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/block/nbd.c +3 -0
@@ -667,6 +667,9 @@ static int __nbd_ioctl(struct block_devi }case NBD_SET_BLKSIZE : +if (!arg || !is_power_of_2 (arg) || arg <512 || + arg >PAGE_SIZE ) +return -EINVAL ; nbd->blksize = arg; nbd->bytesize &= ~(nbd->blksize-1 ); bdev->bd_inode->i_size = nbd->bytesize;
PATCH 193/328 iw_cxgb4: atomically flush the qp
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve Wise <[email protected]>
commit bc52e9ca74b9a395897bb640c6671b2cbf716032 upstream.
__flush_qp() has a race condition where during the flush operation, the qp lock is released allowing another thread to possibly post a WR, which corrupts the queue state, possibly causing crashes. The lock was released to preserve the cq/qp locking hierarchy of cq first, then qp. However releasing the qp lock is not necessary; both RQ and SQ CQ locks can be acquired first, followed by the qp lock, and then the RQ and SQ flushing can be done w/o unlocking.
--- drivers/infiniband/hw/cxgb4/qp.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/infiniband/hw/cxgb4/qp.c +11 -8
@@ -1071,31 +1071,34 @@ static void __flush_qp(struct c4iw_qp *qPDBG ("%s qhp %p rchp %p schp %p\n" , __func__, qhp, rchp, schp); -/* locking hierarchy: cq lock first, then qp lock. */ +/* locking hierarchy: cqs lock first, then qp lock. */ spin_lock_irqsave (&rchp->lock, flag); +if (schp != rchp) +spin_lock (&schp->lock);spin_lock (&qhp->lock);if (qhp->wq.flushed) {spin_unlock (&qhp->lock); +if (schp != rchp) +spin_unlock (&schp->lock);spin_unlock_irqrestore (&rchp->lock, flag);return ; } qhp->wq.flushed =1 ; +t4_set_wq_in_error (&qhp->wq);c4iw_flush_hw_cq (rchp, qhp);c4iw_count_rcqes (&rchp->cq, &qhp->wq, &count); rq_flushed =c4iw_flush_rq (&qhp->wq, &rchp->cq, count); -spin_unlock (&qhp->lock); -spin_unlock_irqrestore (&rchp->lock, flag); -/* locking hierarchy: cq lock first, then qp lock. */ -spin_lock_irqsave (&schp->lock, flag); -spin_lock (&qhp->lock);if (schp != rchp)c4iw_flush_hw_cq (schp, qhp); sq_flushed =c4iw_flush_sq (qhp); +spin_unlock (&qhp->lock); -spin_unlock_irqrestore (&schp->lock, flag); +if (schp != rchp) +spin_unlock (&schp->lock); +spin_unlock_irqrestore (&rchp->lock, flag);if (schp == rchp) { if (t4_clear_cq_armed(&rchp->cq) &&
@@ -1129,8 +1132,8 @@ static void flush_qp(struct c4iw_qp *qhp rchp =to_c4iw_cq (qhp->ibqp.recv_cq); schp =to_c4iw_cq (qhp->ibqp.send_cq); -t4_set_wq_in_error (&qhp->wq);if (qhp->ibqp.uobject) { +t4_set_wq_in_error (&qhp->wq);t4_set_cq_in_error (&rchp->cq);spin_lock_irqsave (&rchp->comp_handler_lock, flag); (*rchp->ibcq.comp_handler)(&rchp->ibcq, rchp->ibcq.cq_context);
PATCH 195/328 cfg80211: reg: Init wiphy_idx in regulatory_hint_core()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Otcheretianski <[email protected]>
commit 24f33e64fcd0d50a4b1a8e5b41bd0257aa66b0e8 upstream.
Core regulatory hints didn't set wiphy_idx to WIPHY_IDX_INVALID. Since the regulatory request is zeroed, wiphy_idx was always implicitly set to
0. This resulted in updating only phy #0.
Fix that.
--- net/wireless/reg.c | 1 + 1 file changed, 1 insertion(+)
net/wireless/reg.c +1 -0
@@ -1993,6 +1993,7 @@ static int regulatory_hint_core(const ch request->alpha2[0 ] = alpha2[0 ]; request->alpha2[1 ] = alpha2[1 ]; request->initiator =NL80211_REGDOM_SET_BY_CORE ; + request->wiphy_idx =WIPHY_IDX_INVALID ;queue_regulatory_request (request);
PATCH 198/328 USB: Add quirk to support DJI CineSSD
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tim Anderson <[email protected]>
commit f45681f9becaa65111ed0a691ccf080a0cd5feb8 upstream.
This device does not correctly handle the LPM operations.
Also, the device cannot handle ATA pass-through commands and locks up when attempted while running in super speed.
This patch adds the equivalent quirk logic as found in uas.
--- drivers/usb/core/quirks.c | 3 +++ drivers/usb/storage/scsiglue.c | 9 +++++++++ drivers/usb/storage/unusual_devs.h | 7 +++++++ 3 files changed, 19 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -260,6 +260,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x2040, 0x7200), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, + /* DJI CineSSD */ + { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, + /* INTEL VALUE SSD */ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
drivers/usb/storage/scsiglue.c +9 -0
@@ -341,6 +341,15 @@ static int queuecommand_lck(struct scsi_return 0 ; } +if ((us->fflags &US_FL_NO_ATA_1X ) && + (srb->cmnd[0 ] ==ATA_12 || srb->cmnd[0 ] ==ATA_16 )) { +memcpy (srb->sense_buffer, usb_stor_sense_invalidCDB, +sizeof (usb_stor_sense_invalidCDB)); + srb->result =SAM_STAT_CHECK_CONDITION ; +done (srb); +return 0 ; + } +/* enqueue the command and wake up the control thread */ srb->scsi_done = done; us->srb = srb;
drivers/usb/storage/unusual_devs.h +7 -0
@@ -2144,6 +2144,13 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_GO_SLOW ), +/* Reported-by: Tim Anderson <[email protected]> */ +UNUSUAL_DEV (0x2ca3 ,0x0031 ,0x0000 ,0x9999 , +"DJI" , +"CineSSD" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , + US_FL_NO_ATA_1X), +/* Reported by Frederic Marchal <[email protected]> * Mio Moov 330 */
PATCH 202/328 spi: rspi: Fix invalid SPI use during system suspend
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit c1ca59c22c56930b377a665fdd1b43351887830b upstream.
If the SPI queue is running during system suspend, the system may lock up.
Fix this by stopping/restarting the queue during system suspend/resume, by calling spi_master_suspend()/spi_master_resume() from the PM callbacks. In-kernel users will receive an -ESHUTDOWN error while system suspend/resume is in progress.
Based on a patch for sh-msiof by Gaku Inami.
--- drivers/spi/spi-rspi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/spi/spi-rspi.c +24 -0
@@ -1158,6 +1158,29 @@ static struct platform_device_id spi_driMODULE_DEVICE_TABLE (platform, spi_driver_ids); +#ifdef CONFIG_PM_SLEEP +static int rspi_suspend (struct device *dev) +{ +struct platform_device *pdev =to_platform_device (dev); +struct rspi_data *rspi =platform_get_drvdata (pdev); + +return spi_master_suspend (rspi->master); +} + +static int rspi_resume (struct device *dev) +{ +struct platform_device *pdev =to_platform_device (dev); +struct rspi_data *rspi =platform_get_drvdata (pdev); + +return spi_master_resume (rspi->master); +} + +static SIMPLE_DEV_PM_OPS(rspi_pm_ops, rspi_suspend, rspi_resume); +#define DEV_PM_OPS &rspi_pm_ops +#else +#define DEV_PM_OPS NULL +#endif /* CONFIG_PM_SLEEP */ +static struct platform_driver rspi_driver = { .probe = rspi_probe, .remove = rspi_remove,
@@ -1165,6 +1188,7 @@ static struct platform_driver rspi_drive .driver = { .name = "renesas_spi", .owner = THIS_MODULE, + .pm = DEV_PM_OPS, .of_match_table = of_match_ptr(rspi_of_match), }, };
PATCH 204/328 spi: rspi: Fix leaking of unused DMA descriptors
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 3819bc8752367eae0d72fa1c473dc88ea45631a7 upstream.
If dmaengine_prep_slave_sg() or dmaengine_submit() fail, we may leak unused DMA descriptors.
As per Documentation/dmaengine.txt, once a DMA descriptor has been obtained, it must be submitted. Hence:
- First prepare and submit all DMA descriptors,
- Prepare the SPI controller for DMA,
- Start DMA by calling dma_async_issue_pending(),
- Make sure to call dmaengine_terminate_all() on all descriptors that haven't completed.
--- drivers/spi/spi-rspi.c | 94 ++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 36 deletions(-)
drivers/spi/spi-rspi.c +58 -36
@@ -472,25 +472,52 @@ static int rspi_dma_transfer(struct rspidma_cookie_t cookie;int ret; -if (tx) { - desc_tx =dmaengine_prep_slave_sg (rspi->master->dma_tx, - tx->sgl, tx->nents,DMA_TO_DEVICE , -DMA_PREP_INTERRUPT |DMA_CTRL_ACK ); -if (!desc_tx) - goto no_dma; - - irq_mask |=SPCR_SPTIE ; - } +/* First prepare and submit the DMA request(s), as this may fail */ if (rx) { desc_rx =dmaengine_prep_slave_sg (rspi->master->dma_rx, rx->sgl, rx->nents,DMA_FROM_DEVICE ,DMA_PREP_INTERRUPT |DMA_CTRL_ACK ); -if (!desc_rx) - goto no_dma; +if (!desc_rx) { + ret = -EAGAIN ; + goto no_dma_rx; + } + + desc_rx->callback = rspi_dma_complete; + desc_rx->callback_param = rspi; + cookie =dmaengine_submit (desc_rx); +if (dma_submit_error (cookie)) { + ret = cookie; + goto no_dma_rx; + } irq_mask |=SPCR_SPRIE ; } +if (tx) { + desc_tx =dmaengine_prep_slave_sg (rspi->master->dma_tx, + tx->sgl, tx->nents,DMA_TO_DEVICE , +DMA_PREP_INTERRUPT |DMA_CTRL_ACK ); +if (!desc_tx) { + ret = -EAGAIN ; + goto no_dma_tx; + } + +if (rx) { +/* No callback */ + desc_tx->callback =NULL ; + }else { + desc_tx->callback = rspi_dma_complete; + desc_tx->callback_param = rspi; + } + cookie =dmaengine_submit (desc_tx); +if (dma_submit_error (cookie)) { + ret = cookie; + goto no_dma_tx; + } + + irq_mask |=SPCR_SPTIE ; + } +/* * DMAC needs SPxIE, but if SPxIE is set, the IRQ routine will be * called. So, this driver disables the IRQ while DMA transfer.
@@ -503,34 +530,24 @@ static int rspi_dma_transfer(struct rspirspi_enable_irq (rspi, irq_mask); rspi->dma_callbacked =0 ; -if (rx) { - desc_rx->callback = rspi_dma_complete; - desc_rx->callback_param = rspi; - cookie =dmaengine_submit (desc_rx); -if (dma_submit_error (cookie)) -return cookie; +/* Now start DMA */ +if (rx)dma_async_issue_pending (rspi->master->dma_rx); - } -if (tx) { -if (rx) { -/* No callback */ - desc_tx->callback =NULL ; - }else { - desc_tx->callback = rspi_dma_complete; - desc_tx->callback_param = rspi; - } - cookie =dmaengine_submit (desc_tx); -if (dma_submit_error (cookie)) -return cookie; +if (tx)dma_async_issue_pending (rspi->master->dma_tx); - } ret =wait_event_interruptible_timeout (rspi->wait, rspi->dma_callbacked,HZ );if (ret >0 && rspi->dma_callbacked) ret =0 ; -else if (!ret) +else if (!ret) { +dev_err (&rspi->master->dev,"DMA timeout\n" ); ret = -ETIMEDOUT ; +if (tx) +dmaengine_terminate_all (rspi->master->dma_tx); +if (rx) +dmaengine_terminate_all (rspi->master->dma_rx); + }rspi_disable_irq (rspi, irq_mask);
@@ -541,11 +558,16 @@ static int rspi_dma_transfer(struct rspireturn ret; -no_dma: -pr_warn_once ("%s %s: DMA not available, falling back to PIO\n" , -dev_driver_string (&rspi->master->dev), -dev_name (&rspi->master->dev)); -return -EAGAIN ; +no_dma_tx: +if (rx) +dmaengine_terminate_all (rspi->master->dma_rx); +no_dma_rx: +if (ret == -EAGAIN ) { +pr_warn_once ("%s %s: DMA not available, falling back to PIO\n" , +dev_driver_string (&rspi->master->dev), +dev_name (&rspi->master->dev)); + } +return ret; }static void rspi_receive_init (const struct rspi_data *rspi)
PATCH 206/328 usb: Don't die twice if PCI xhci host is not responding in resume
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit f3dc41c5d22b2ca14a0802a65d8cdc33a3882d4e upstream.
usb_hc_died() should only be called once, and with the primary HCD as parameter. It will mark both primary and secondary hcd's dead.
Remove the extra call to usb_cd_died with the shared hcd as parameter.
--- drivers/usb/core/hcd-pci.c | 2 -- 1 file changed, 2 deletions(-)
drivers/usb/core/hcd-pci.c +0 -2
@@ -528,8 +528,6 @@ static int resume_common(struct device * event == PM_EVENT_RESTORE);if (retval) {dev_err (dev,"PCI post-resume error %d!\n" , retval); -if (hcd->shared_hcd) -usb_hc_died (hcd->shared_hcd);usb_hc_died (hcd); } }
PATCH 208/328 usb: host: u132-hcd: Fix a sleep-in-atomic-context bug in u132_get_frame()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jia-Ju Bai <[email protected]>
commit 6d4f268fa132742fe96dad22307c68d237356d88 upstream.
i_usX2Y_subs_startup in usbusx2yaudio.c is a completion handler function for the USB driver. So it should not sleep, but it is can sleep according to the function call paths (from bottom to top) in Linux-4.16.
[FUNC] msleepdrivers/usb/host/u132-hcd.c, 2558:
msleep in u132_get_framedrivers/usb/core/hcd.c, 2231:
[FUNC_PTR]u132_get_frame in usb_hcd_get_frame_numberdrivers/usb/core/usb.c, 822:
usb_hcd_get_frame_number in usb_get_current_frame_numbersound/usb/usx2y/usbusx2yaudio.c, 303:
usb_get_current_frame_number in i_usX2Y_urb_completesound/usb/usx2y/usbusx2yaudio.c, 366:
i_usX2Y_urb_complete in i_usX2Y_subs_startup
Note that [FUNC_PTR] means a function pointer call is used.
To fix this bug, msleep() is replaced with mdelay().
This bug is found by my static analysis tool DSAC.
--- drivers/usb/host/u132-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/u132-hcd.c +1 -1
@@ -2569,7 +2569,7 @@ static int u132_get_frame(struct usb_hcd }else {int frame =0 ;dev_err (&u132->platform_dev->dev,"TODO: u132_get_frame\n" ); -msleep (100 ); +mdelay (100 );return frame; } }
PATCH 209/328 usb: misc: uss720: Fix two sleep-in-atomic-context bugs
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jia-Ju Bai <[email protected]>
commit bc8acc214d3f1cafebcbcd101a695bbac716595d upstream.
async_complete() in uss720.c is a completion handler function for the USB driver. So it should not sleep, but it is can sleep according to the function call paths (from bottom to top) in Linux-4.16.
[FUNC] set_1284_register(GFP_KERNEL) drivers/usb/misc/uss720.c, 372:
set_1284_register in parport_uss720_frob_controldrivers/parport/ieee1284.c, 560:
[FUNC_PTR]parport_uss720_frob_control in parport_ieee1284_ack_data_availdrivers/parport/ieee1284.c, 577:
parport_ieee1284_ack_data_avail in parport_ieee1284_interrupt./include/linux/parport.h, 474:
parport_ieee1284_interrupt in parport_generic_irqdrivers/usb/misc/uss720.c, 116:
parport_generic_irq in async_complete
[FUNC] get_1284_register(GFP_KERNEL) drivers/usb/misc/uss720.c, 382:
get_1284_register in parport_uss720_read_statusdrivers/parport/ieee1284.c, 555:
[FUNC_PTR]parport_uss720_read_status in parport_ieee1284_ack_data_availdrivers/parport/ieee1284.c, 577:
parport_ieee1284_ack_data_avail in parport_ieee1284_interrupt./include/linux/parport.h, 474:
parport_ieee1284_interrupt in parport_generic_irqdrivers/usb/misc/uss720.c, 116:
parport_generic_irq in async_complete
Note that [FUNC_PTR] means a function pointer call is used.
To fix these bugs, GFP_KERNEL is replaced with GFP_ATOMIC.
These bugs are found by my static analysis tool DSAC.
--- drivers/usb/misc/uss720.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/misc/uss720.c +2 -2
@@ -392,7 +392,7 @@ static unsigned char parport_uss720_frob mask &=0x0f ; val &=0x0f ; d = (priv->reg[1 ] & (~mask)) ^ val; -if (set_1284_register (pp,2 , d,GFP_KERNEL )) +if (set_1284_register (pp,2 , d,GFP_ATOMIC ))return 0 ; priv->reg[1 ] = d;return d &0xf ;
@@ -402,7 +402,7 @@ static unsigned char parport_uss720_read {unsigned char ret; -if (get_1284_register (pp,1 , &ret,GFP_KERNEL )) +if (get_1284_register (pp,1 , &ret,GFP_ATOMIC ))return 0 ;return ret &0xf8 ; }
PATCH 210/328 IB/ipoib: Avoid a race condition between start_xmit and cm_rep_handler
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Knister <[email protected]>
commit 816e846c2eb9129a3e0afa5f920c8bbc71efecaa upstream.
Inside of start_xmit() the call to check if the connection is up and the queueing of the packets for later transmission is not atomic which leaves a window where cm_rep_handler can run, set the connection up, dequeue pending packets and leave the subsequently queued packets by start_xmit() sitting on neigh->queue until they're dropped when the connection is torn down. This only applies to connected mode. These dropped packets can really upset TCP, for example, and cause multi-minute delays in transmission for open connections.
Here's the code in start_xmit where we check to see if the connection is up:
if (ipoib_cm_get(neigh)) {
if (ipoib_cm_up(neigh)) {
ipoib_cm_send(dev, skb, ipoib_cm_get(neigh));
goto unref;
}
}The race occurs if cm_rep_handler execution occurs after the above connection check (specifically if it gets to the point where it acquires priv->lock to dequeue pending skb's) but before the below code snippet in start_xmit where packets are queued.
if (skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE) {
push_pseudo_header(skb, phdr->hwaddr);
spin_lock_irqsave(&priv->lock, flags);
__skb_queue_tail(&neigh->queue, skb);
spin_unlock_irqrestore(&priv->lock, flags);
} else {
++dev->stats.tx_dropped;
dev_kfree_skb_any(skb);
}The patch acquires the netif tx lock in cm_rep_handler for the section where it sets the connection up and dequeues and retransmits deferred skb's.
--- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/ulp/ipoib/ipoib_cm.c +2 -0
@@ -996,12 +996,14 @@ static int ipoib_cm_rep_handler(struct iskb_queue_head_init (&skqueue); +netif_tx_lock_bh (p->dev);spin_lock_irq (&priv->lock);set_bit (IPOIB_FLAG_OPER_UP , &p->flags);if (p->neigh)while ((skb =__skb_dequeue (&p->neigh->queue)))__skb_queue_tail (&skqueue, skb);spin_unlock_irq (&priv->lock); +netif_tx_unlock_bh (p->dev);while ((skb =__skb_dequeue (&skqueue))) { skb->dev = p->dev;
PATCH 220/328 batman-adv: Prevent duplicated tvlv handler
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit ae3cdc97dc10c7a3b31f297dab429bfb774c9ccb upstream.
The function batadv_tvlv_handler_register is responsible for adding new tvlv_handler to the handler_list. It first checks whether the entry already is in the list or not. If it is, then the creation of a new entry is aborted.
But the lock for the list is only held when the list is really modified. This could lead to duplicated entries because another context could create an entry with the same key between the check and the list manipulation.
The check and the manipulation of the list must therefore be in the same locked code section.
--- net/batman-adv/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/batman-adv/main.c +6 -2
@@ -1058,15 +1058,20 @@ void batadv_tvlv_handler_register(struct {struct batadv_tvlv_handler *tvlv_handler; +spin_lock_bh (&bat_priv->tvlv.handler_list_lock); + tvlv_handler =batadv_tvlv_handler_get (bat_priv, type, version);if (tvlv_handler) { +spin_unlock_bh (&bat_priv->tvlv.handler_list_lock);batadv_tvlv_handler_free_ref (tvlv_handler);return ; } tvlv_handler =kzalloc (sizeof (*tvlv_handler),GFP_ATOMIC ); -if (!tvlv_handler) +if (!tvlv_handler) { +spin_unlock_bh (&bat_priv->tvlv.handler_list_lock);return ; + } tvlv_handler->ogm_handler = optr; tvlv_handler->unicast_handler = uptr;
@@ -1076,7 +1081,6 @@ void batadv_tvlv_handler_register(structatomic_set (&tvlv_handler->refcount,1 );INIT_HLIST_NODE (&tvlv_handler->list); -spin_lock_bh (&bat_priv->tvlv.handler_list_lock);hlist_add_head_rcu (&tvlv_handler->list, &bat_priv->tvlv.handler_list);spin_unlock_bh (&bat_priv->tvlv.handler_list_lock); }
PATCH 225/328 hwmon: (nct6775) Fix access to fan pulse registers
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit c793279c77035053e67937f5743c6ebfc303e7c5 upstream.
Not all fans have a fan pulse register. This can result in reading beyond the end of REG_FAN_PULSES and FAN_PULSE_SHIFT arrays, and was reported by smatch as possible error.
1672 for (i = 0; i < ARRAY_SIZE(data->rpm); i++) {
^^^^^^^^^^^^^^^^^^^^^^^^ This is a 7 element array.
...
1685 data->fan_pulses[i] =
1686 (nct6775_read_value(data, data->REG_FAN_PULSES[i])
1687 >> data->FAN_PULSE_SHIFT[i]) & 0x03;
^^^^^^^^^^^^^^^^^^^^^^^^ FAN_PULSE_SHIFT is either 5 or 6 elements.
To fix the problem, we have to ensure that all REG_FAN_PULSES and FAN_PULSE_SHIFT have the appropriate length, and that REG_FAN_PULSES is only read if the register actually exists.
[bwh: Backported to 3.16:
- NCT6776_REG_FAN_PULSES covers only 3 fans
- Adjust context]
--- drivers/hwmon/nct6775.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/hwmon/nct6775.c +15 -9
@@ -269,8 +269,9 @@ static const u16 NCT6775_REG_PWM_READ[]static const u16 NCT6775_REG_FAN [] = {0x630 ,0x632 ,0x634 ,0x636 ,0x638 };static const u16 NCT6775_REG_FAN_MIN [] = {0x3b ,0x3c ,0x3d }; -static const u16 NCT6775_REG_FAN_PULSES [] = {0x641 ,0x642 ,0x643 ,0x644 ,0 }; -static const u16 NCT6775_FAN_PULSE_SHIFT [] = {0 ,0 ,0 ,0 ,0 ,0 }; +static const u16 NCT6775_REG_FAN_PULSES [NUM_FAN ] = { +0x641 ,0x642 ,0x643 ,0x644 }; +static const u16 NCT6775_FAN_PULSE_SHIFT [NUM_FAN ] = { };static const u16 NCT6775_REG_TEMP [] = {0x27 ,0x150 ,0x250 ,0x62b ,0x62c ,0x62d };
@@ -382,7 +383,8 @@ static const u8 NCT6776_REG_PWM_MODE[] =static const u8 NCT6776_PWM_MODE_MASK [] = {0x01 ,0 ,0 ,0 ,0 ,0 };static const u16 NCT6776_REG_FAN_MIN [] = {0x63a ,0x63c ,0x63e ,0x640 ,0x642 }; -static const u16 NCT6776_REG_FAN_PULSES [] = {0x644 ,0x645 ,0x646 ,0 ,0 }; +static const u16 NCT6776_REG_FAN_PULSES [NUM_FAN ] = { +0x644 ,0x645 ,0x646 };static const u16 NCT6776_REG_WEIGHT_DUTY_BASE [] = {0x13e ,0x23e ,0x33e ,0x83e ,0x93e ,0xa3e };
@@ -451,7 +453,7 @@ static const s8 NCT6779_BEEP_BITS[] = {static const u16 NCT6779_REG_FAN [] = {0x4b0 ,0x4b2 ,0x4b4 ,0x4b6 ,0x4b8 ,0x4ba }; -static const u16 NCT6779_REG_FAN_PULSES [] = { +static const u16 NCT6779_REG_FAN_PULSES [NUM_FAN ] = {0x644 ,0x645 ,0x646 ,0x647 ,0x648 ,0x649 };static const u16 NCT6779_REG_CRITICAL_PWM_ENABLE [] = {
@@ -564,8 +566,8 @@ static const u16 NCT6106_REG_TEMP_CONFIGstatic const u16 NCT6106_REG_FAN [] = {0x20 ,0x22 ,0x24 };static const u16 NCT6106_REG_FAN_MIN [] = {0xe0 ,0xe2 ,0xe4 }; -static const u16 NCT6106_REG_FAN_PULSES [] = {0xf6 ,0xf6 ,0xf6 ,0 ,0 }; -static const u16 NCT6106_FAN_PULSE_SHIFT [] = {0 ,2 ,4 ,0 ,0 }; +static const u16 NCT6106_REG_FAN_PULSES [] = {0xf6 ,0xf6 ,0xf6 }; +static const u16 NCT6106_FAN_PULSE_SHIFT [] = {0 ,2 ,4 };static const u8 NCT6106_REG_PWM_MODE [] = {0xf3 ,0xf3 ,0xf3 };static const u8 NCT6106_PWM_MODE_MASK [] = {0x01 ,0x02 ,0x04 };
@@ -1451,9 +1453,13 @@ static struct nct6775_data *nct6775_updaif (data->has_fan_min & (1 << i)) data->fan_min[i] =nct6775_read_value (data, data->REG_FAN_MIN[i]); - data->fan_pulses[i] = - (nct6775_read_value (data, data->REG_FAN_PULSES[i]) - >> data->FAN_PULSE_SHIFT[i]) &0x03 ; + +if (data->REG_FAN_PULSES[i]) { + data->fan_pulses[i] = + (nct6775_read_value (data, + data->REG_FAN_PULSES[i]) + >> data->FAN_PULSE_SHIFT[i]) &0x03 ; + }nct6775_select_fan_div (dev, data, i, reg); }
PATCH 227/328 ALSA: bebob: use address returned by kmalloc() instead of kernel stack for streaming DMA mapping
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
commit 493626f2d87a74e6dbea1686499ed6e7e600484e upstream.
When executing 'fw_run_transaction()' with 'TCODE_WRITE_BLOCK_REQUEST', an address of 'payload' argument is used for streaming DMA mapping by 'firewire_ohci' module if 'size' argument is larger than 8 byte. Although in this case the address should not be on kernel stack, current implementation of ALSA bebob driver uses data in kernel stack for a cue to boot M-Audio devices. This often brings unexpected result, especially for a case of CONFIG_VMAP_STACK=y.
This commit fixes the bug.
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=201021
Reference: https://forum.manjaro.org/t/firewire-m-audio-410-driver-wont-load-firmware/51165
--- sound/firewire/bebob/bebob_maudio.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
sound/firewire/bebob/bebob_maudio.c +14 -10
@@ -96,17 +96,13 @@ int snd_bebob_maudio_load_firmware(strucstruct fw_device *device =fw_parent_device (unit);int err, rcode;u64 date; -__le32 cues[3 ] = { -cpu_to_le32 (MAUDIO_BOOTLOADER_CUE1 ), -cpu_to_le32 (MAUDIO_BOOTLOADER_CUE2 ), -cpu_to_le32 (MAUDIO_BOOTLOADER_CUE3 ) - }; +__le32 *cues;/* check date of software used to build */ err =snd_bebob_read_block (unit,INFO_OFFSET_SW_DATE , &date,sizeof (u64));if (err <0 ) - goto end; +return err;/* * firmware version 5058 or later has date later than "20070401", but * 'date' is not null-terminated.
@@ -114,20 +110,28 @@ int snd_bebob_maudio_load_firmware(strucif (date <0x3230303730343031LL ) {dev_err (&unit->device,"Use firmware version 5058 or later\n" ); - err = -ENOSYS ; - goto end; +return -ENXIO ; } + cues =kmalloc_array (3 ,sizeof (*cues),GFP_KERNEL ); +if (!cues) +return -ENOMEM ; + + cues[0 ] =cpu_to_le32 (MAUDIO_BOOTLOADER_CUE1 ); + cues[1 ] =cpu_to_le32 (MAUDIO_BOOTLOADER_CUE2 ); + cues[2 ] =cpu_to_le32 (MAUDIO_BOOTLOADER_CUE3 ); + rcode =fw_run_transaction (device->card,TCODE_WRITE_BLOCK_REQUEST , device->node_id, device->generation, device->max_speed,BEBOB_ADDR_REG_REQ , - cues,sizeof (cues)); + cues,3 *sizeof (*cues)); +kfree (cues);if (rcode !=RCODE_COMPLETE ) {dev_err (&unit->device,"Failed to send a cue to load firmware\n" ); err = -EIO ; } -end: +return err; }
PATCH 232/328 x86/boot: Move EISA setup to a separate file
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit f7eaf6e00fd581043bb540dfe865f1d81769b189 upstream.
EISA has absolutely nothing to do with traps, so move it out of traps.c into its own eisa.c file.
Furthermore, the EISA bus detection does not need to run during very early boot, it's good enough to run it before the EISA bus and drivers are initialized.
I.e. instead of calling it from the very early trap_init() code, make it a subsys_initcall().
--- arch/x86/kernel/Makefile | 1 + arch/x86/kernel/eisa.c | 18 ++++++++++++++++++ arch/x86/kernel/traps.c | 13 ------------- 3 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 arch/x86/kernel/eisa.c
arch/x86/kernel/Makefile +1 -0
@@ -92,6 +92,7 @@ obj-$(CONFIG_PARAVIRT) += paravirt.o pa obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= paravirt-spinlocks.o obj-$(CONFIG_PARAVIRT_CLOCK) += pvclock.o +obj-$(CONFIG_EISA) += eisa.o obj-$(CONFIG_PCSPKR_PLATFORM) += pcspeaker.o obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o
arch/x86/kernel/eisa.c new file +18 -0
@@ -0,0 +1,18 @@ +/* +* EISA specific code +* +* This file is licensed under the GPL V2 +*/ +#include <linux/ioport.h> +#include <linux/eisa.h> + +static __init int eisa_bus_probe (void ) +{ +void __iomem *p =ioremap (0x0FFFD9 ,4 ); + +if (readl (p) =='E' + ('I' <<8 ) + ('S' <<16 ) + ('A' <<24 )) + EISA_bus =1 ; +iounmap (p); +return 0 ; +} +subsys_initcall (eisa_bus_probe);
arch/x86/kernel/traps.c +0 -13
@@ -37,11 +37,6 @@#include <linux/smp.h> #include <linux/io.h> -#ifdef CONFIG_EISA -#include <linux/ioport.h> -#include <linux/eisa.h> -#endif -#if defined(CONFIG_EDAC )#include <linux/edac.h> #endif
@@ -796,14 +791,6 @@ void __init trap_init(void) {int i; -#ifdef CONFIG_EISA -void __iomem *p =early_ioremap (0x0FFFD9 ,4 ); - -if (readl (p) =='E' + ('I' <<8 ) + ('S' <<16 ) + ('A' <<24 )) - EISA_bus =1 ; -early_iounmap (p,4 ); -#endif -set_intr_gate (X86_TRAP_DE , divide_error);set_intr_gate_ist (X86_TRAP_NMI , &nmi,NMI_STACK );/* int4 can be called from all */
PATCH 240/328 ext4: don't mark mmp buffer head dirty
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Li Dongyang <[email protected]>
commit fe18d649891d813964d3aaeebad873f281627fbc upstream.
Marking mmp bh dirty before writing it will make writeback pick up mmp block later and submit a write, we don't want the duplicate write as kmmpd thread should have full control of reading and writing the mmp block.
Another reason is we will also have random I/O error on the writeback request when blk integrity is enabled, because kmmpd could modify the content of the mmp block(e.g. setting new seq and time) while the mmp block is under I/O requested by writeback.
--- fs/ext4/mmp.c | 1 - 1 file changed, 1 deletion(-)
fs/ext4/mmp.c +0 -1
@@ -48,7 +48,6 @@ static int write_mmp_block(struct super_*/ sb_start_write (sb);ext4_mmp_csum_set (sb, mmp); -mark_buffer_dirty (bh);lock_buffer (bh); bh->b_end_io = end_buffer_write_sync;get_bh (bh);
PATCH 245/328 serial: cpm_uart: return immediately from console poll
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
commit be28c1e3ca29887e207f0cbcd294cefe5074bab6 upstream.
kgdb expects poll function to return immediately and returning NO_POLL_CHAR when no character is available.
--- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/tty/serial/cpm_uart/cpm_uart_core.c +7 -3
@@ -1062,8 +1062,8 @@ static int poll_wait_key(char *obuf, str/* Get the address of the host memory buffer. */ bdp = pinfo->rx_cur; -while (bdp->cbd_sc &BD_SC_EMPTY ) - ; +if (bdp->cbd_sc &BD_SC_EMPTY ) +return NO_POLL_CHAR ;/* If the buffer address is in the CPM DPRAM, don't * convert it.
@@ -1097,7 +1097,11 @@ static int cpm_get_poll_char(struct uart poll_chars =0 ; }if (poll_chars <=0 ) { - poll_chars =poll_wait_key (poll_buf, pinfo); +int ret =poll_wait_key (poll_buf, pinfo); + +if (ret ==NO_POLL_CHAR ) +return ret; + poll_chars = ret; pollp = poll_buf; } poll_chars--;
PATCH 249/328 x86/paravirt: Fix some warning messages
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 571d0563c8881595f4ab027aef9ed1c55e3e7b7c upstream.
The first argument to WARN_ONCE() is a condition.
--- arch/x86/kernel/paravirt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/paravirt.c +2 -2
@@ -99,7 +99,7 @@ unsigned paravirt_patch_call(void *insnbif (len <5 ) {#ifdef CONFIG_RETPOLINE -WARN_ONCE ("Failing to patch indirect CALL in %ps\n" , (void *)addr); +WARN_ONCE (1 ,"Failing to patch indirect CALL in %ps\n" , (void *)addr);#endif return len;/* call too long for patch site */ }
@@ -119,7 +119,7 @@ unsigned paravirt_patch_jmp(void *insnbuif (len <5 ) {#ifdef CONFIG_RETPOLINE -WARN_ONCE ("Failing to patch indirect JMP in %ps\n" , (void *)addr); +WARN_ONCE (1 ,"Failing to patch indirect JMP in %ps\n" , (void *)addr);#endif return len;/* call too long for patch site */ }
PATCH 259/328 mm: shmem.c: Correctly annotate new inodes for lockdep
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Joel Fernandes (Google)" <[email protected]>
commit b45d71fb89ab8adfe727b9d0ee188ed58582a647 upstream.
Directories and inodes don't necessarily need to be in the same lockdep class. For ex, hugetlbfs splits them out too to prevent false positives in lockdep. Annotate correctly after new inode creation. If its a directory inode, it will be put into a different class.
This should fix a lockdep splat reported by syzbot:
Quoted 77 lines
======================================================
WARNING: possible circular locking dependency detected 4.18.0-rc8-next-20180810+ #36 Not tainted
------------------------------------------------------
syz-executor900/4483 is trying to acquire lock:00000000d2bfc8fe(&sb->s_type->i_mutex_key#9){++++}, at:inode_lockinclude/linux/fs.h:765[inline]00000000d2bfc8fe(&sb->s_type->i_mutex_key#9){++++}, at:shmem_fallocate+0x18b/0x12e0mm/shmem.c:2602but task is already holding lock:
0000000025208078 (ashmem_mutex){+.+.}, at:ashmem_shrink_scan+0xb4/0x630drivers/staging/android/ashmem.c:448which lock already depends on the new lock.
-> #2 (ashmem_mutex){+.+.}:
__mutex_lock_common kernel/locking/mutex.c:925 [inline] __mutex_lock+0x171/0x1700 kernel/locking/mutex.c:1073 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1088 ashmem_mmap+0x55/0x520 drivers/staging/android/ashmem.c:361 call_mmap include/linux/fs.h:1844 [inline] mmap_region+0xf27/0x1c50 mm/mmap.c:1762 do_mmap+0xa10/0x1220 mm/mmap.c:1535 do_mmap_pgoff include/linux/mm.h:2298 [inline] vm_mmap_pgoff+0x213/0x2c0 mm/util.c:357 ksys_mmap_pgoff+0x4da/0x660 mm/mmap.c:1585 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:100 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:91 [inline] __x64_sys_mmap+0xe9/0x1b0 arch/x86/kernel/sys_x86_64.c:91 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe-> #1 (&mm->mmap_sem){++++}:
__might_fault+0x155/0x1e0 mm/memory.c:4568 _copy_to_user+0x30/0x110 lib/usercopy.c:25 copy_to_user include/linux/uaccess.h:155 [inline] filldir+0x1ea/0x3a0 fs/readdir.c:196 dir_emit_dot include/linux/fs.h:3464 [inline] dir_emit_dots include/linux/fs.h:3475 [inline] dcache_readdir+0x13a/0x620 fs/libfs.c:193 iterate_dir+0x48b/0x5d0 fs/readdir.c:51 __do_sys_getdents fs/readdir.c:231 [inline] __se_sys_getdents fs/readdir.c:212 [inline] __x64_sys_getdents+0x29f/0x510 fs/readdir.c:212 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe-> #0 (&sb->s_type->i_mutex_key#9){++++}:
lock_acquire+0x1e4/0x540 kernel/locking/lockdep.c:3924 down_write+0x8f/0x130 kernel/locking/rwsem.c:70 inode_lock include/linux/fs.h:765 [inline] shmem_fallocate+0x18b/0x12e0 mm/shmem.c:2602 ashmem_shrink_scan+0x236/0x630 drivers/staging/android/ashmem.c:455 ashmem_ioctl+0x3ae/0x13a0 drivers/staging/android/ashmem.c:797 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0x1de/0x1720 fs/ioctl.c:685 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:702 __do_sys_ioctl fs/ioctl.c:709 [inline] __se_sys_ioctl fs/ioctl.c:707 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:707 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbeother info that might help us debug this:
Chain exists of: &sb->s_type->i_mutex_key#9 --> &mm->mmap_sem --> ashmem_mutex Possible unsafe locking scenario:CPU0 CPU1 ---- ---- lock(ashmem_mutex); lock(&mm->mmap_sem); lock(ashmem_mutex);
Quoted 7 lines
lock(&sb->s_type->i_mutex_key#9);*** DEADLOCK ***
1 lock held by syz-executor900/4483:
#0: 0000000025208078 (ashmem_mutex){+.+.}, at:ashmem_shrink_scan+0xb4/0x630drivers/staging/android/ashmem.c:448
--- mm/shmem.c | 2 ++ 1 file changed, 2 insertions(+)
mm/shmem.c +2 -0
@@ -1422,6 +1422,8 @@ static struct inode *shmem_get_inode(strmpol_shared_policy_init (&info->policy,NULL );break ; } + +lockdep_annotate_inode_mutex_key (inode); }else shmem_free_inode (sb);return inode;
PATCH 266/328 bcache: Remove deprecated create_workqueue
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bhaktipriya Shridhar <[email protected]>
commit 81baf90af2dcc8259e99e2f236024524b55313fc upstream.
alloc_workqueue replaces deprecated create_workqueue().
Dedicated workqueues have been used since bcache_wq and moving_gc_wq are workqueues for writes and are being used on a memory reclaim path. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure.
Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.
--- drivers/md/bcache/super.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/bcache/super.c +3 -2
@@ -1543,7 +1543,8 @@ struct cache_set *bch_cache_set_alloc(st !(c->fill_iter =mempool_create_kmalloc_pool (1 , iter_size)) || !(c->bio_split =bioset_create (4 , offsetof(struct bbio , bio))) || !(c->uuids =alloc_bucket_pages (GFP_KERNEL , c)) || - !(c->moving_gc_wq =create_workqueue ("bcache_gc" )) || + !(c->moving_gc_wq =alloc_workqueue ("bcache_gc" , +WQ_MEM_RECLAIM ,0 )) ||bch_journal_alloc (c) ||bch_btree_cache_alloc (c) || bch_open_buckets_alloc(c) ||
@@ -2135,7 +2136,7 @@ static int __init bcache_init(void)return bcache_major; } - if (!(bcache_wq = create_workqueue("bcache")) || + if (!(bcache_wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0)) || !(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) || sysfs_create_files(bcache_kobj, files) || bch_request_init() ||
PATCH 267/328 bcache: explicitly destroy mutex while exiting
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Liang Chen <[email protected]>
commit 330a4db89d39a6b43f36da16824eaa7a7509d34d upstream.
mutex_destroy does nothing most of time, but it's better to call it to make the code future proof and it also has some meaning for like mutex debug.
As Coly pointed out in a previous review, bcache_exit() may not be able to handle all the references properly if userspace registers cache and backing devices right before bch_debug_init runs and bch_debug_init failes later. So not exposing userspace interface until everything is ready to avoid that issue.
--- drivers/md/bcache/super.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/md/bcache/super.c +4 -2
@@ -2115,6 +2115,7 @@ static void bcache_exit(void)if (bcache_major)unregister_blkdev (bcache_major,"bcache" );unregister_reboot_notifier (&reboot); +mutex_destroy (&bch_register_lock); }static int __init bcache_init (void )
@@ -2133,14 +2134,15 @@ static int __init bcache_init(void) bcache_major =register_blkdev (0 ,"bcache" );if (bcache_major <0 ) {unregister_reboot_notifier (&reboot); +mutex_destroy (&bch_register_lock);return bcache_major; }if (!(bcache_wq =alloc_workqueue ("bcache" ,WQ_MEM_RECLAIM ,0 )) || !(bcache_kobj =kobject_create_and_add ("bcache" , fs_kobj)) || -sysfs_create_files (bcache_kobj, files) ||bch_request_init () || -bch_debug_init (bcache_kobj)) +bch_debug_init (bcache_kobj) || +sysfs_create_files (bcache_kobj, files)) goto err;return 0 ;
PATCH 271/328 crypto: mxs-dcp - Fix wait logic on chan threads
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leonard Crestez <[email protected]>
commit d80771c08363ad7fbf0f56f5301e7ca65065c582 upstream.
When compiling with CONFIG_DEBUG_ATOMIC_SLEEP=y the mxs-dcp driver prints warnings such as:
WARNING: CPU: 0 PID: 120 at kernel/sched/core.c:7736 __might_sleep+0x98/0x9c do not call blocking ops when !TASK_RUNNING; state=1 set at [<8081978c>] dcp_chan_thread_sha+0x3c/0x2ec
The problem is that blocking ops will manipulate current->state themselves so it is not allowed to call them between set_current_state(TASK_INTERRUPTIBLE) and schedule().
Fix this by converting the per-chan mutex to a spinlock (it only protects tiny list ops anyway) and rearranging the wait logic so that callbacks are called current->state as TASK_RUNNING. Those callbacks will indeed call blocking ops themselves so this is required.
--- drivers/crypto/mxs-dcp.c | 53 +++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 23 deletions(-)
drivers/crypto/mxs-dcp.c +30 -23
@@ -63,7 +63,7 @@ struct dcp {struct dcp_coherent_block *coh;struct completion completion[DCP_MAX_CHANS ]; -struct mutex mutex[DCP_MAX_CHANS ]; +spinlock_t lock[DCP_MAX_CHANS ];struct task_struct *thread[DCP_MAX_CHANS ];struct crypto_queue queue[DCP_MAX_CHANS ]; };
@@ -349,13 +349,20 @@ static int dcp_chan_thread_aes(void *datint ret; - do { - __set_current_state(TASK_INTERRUPTIBLE); +while (!kthread_should_stop ()) { +set_current_state (TASK_INTERRUPTIBLE ); - mutex_lock(&sdcp->mutex[chan]); +spin_lock (&sdcp->lock[chan]); backlog =crypto_get_backlog (&sdcp->queue[chan]); arq =crypto_dequeue_request (&sdcp->queue[chan]); - mutex_unlock(&sdcp->mutex[chan]); +spin_unlock (&sdcp->lock[chan]); + +if (!backlog && !arq) { +schedule (); +continue ; + } + +set_current_state (TASK_RUNNING );if (backlog) backlog->complete (backlog, -EINPROGRESS );
@@ -363,11 +370,8 @@ static int dcp_chan_thread_aes(void *datif (arq) { ret =mxs_dcp_aes_block_crypt (arq); arq->complete (arq, ret); -continue ; } - -schedule (); - }while (!kthread_should_stop ()); + }return 0 ; }
@@ -407,9 +411,9 @@ static int mxs_dcp_aes_enqueue(struct ab rctx->ecb = ecb; actx->chan =DCP_CHAN_CRYPTO ; -mutex_lock (&sdcp->mutex[actx->chan]); +spin_lock (&sdcp->lock[actx->chan]); ret =crypto_enqueue_request (&sdcp->queue[actx->chan], &req->base); -mutex_unlock (&sdcp->mutex[actx->chan]); +spin_unlock (&sdcp->lock[actx->chan]);wake_up_process (sdcp->thread[actx->chan]);
@@ -645,13 +649,20 @@ static int dcp_chan_thread_sha(void *datstruct ahash_request *req;int ret, fini; - do { - __set_current_state(TASK_INTERRUPTIBLE); +while (!kthread_should_stop ()) { +set_current_state (TASK_INTERRUPTIBLE ); - mutex_lock(&sdcp->mutex[chan]); +spin_lock (&sdcp->lock[chan]); backlog =crypto_get_backlog (&sdcp->queue[chan]); arq =crypto_dequeue_request (&sdcp->queue[chan]); - mutex_unlock(&sdcp->mutex[chan]); +spin_unlock (&sdcp->lock[chan]); + +if (!backlog && !arq) { +schedule (); +continue ; + } + +set_current_state (TASK_RUNNING );if (backlog) backlog->complete (backlog, -EINPROGRESS );
@@ -663,12 +674,8 @@ static int dcp_chan_thread_sha(void *dat ret =dcp_sha_req_to_buf (arq); fini = rctx->fini; arq->complete (arq, ret); -if (!fini) -continue ; } - -schedule (); - }while (!kthread_should_stop ()); + }return 0 ; }
@@ -726,9 +733,9 @@ static int dcp_sha_update_fx(struct ahas rctx->init =1 ; } -mutex_lock (&sdcp->mutex[actx->chan]); +spin_lock (&sdcp->lock[actx->chan]); ret =crypto_enqueue_request (&sdcp->queue[actx->chan], &req->base); -mutex_unlock (&sdcp->mutex[actx->chan]); +spin_unlock (&sdcp->lock[actx->chan]);wake_up_process (sdcp->thread[actx->chan]);mutex_unlock (&actx->mutex);
@@ -984,7 +991,7 @@ static int mxs_dcp_probe(struct platformplatform_set_drvdata (pdev, sdcp);for (i =0 ; i <DCP_MAX_CHANS ; i++) { -mutex_init (&sdcp->mutex[i]); +spin_lock_init (&sdcp->lock[i]);init_completion (&sdcp->completion[i]);crypto_init_queue (&sdcp->queue[i],50 ); }
PATCH 272/328 asix: Check for supported Wake-on-LAN modes
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit c4ce446e33d7a0e978256ac6fea4c80e59d9de5f upstream.
The driver currently silently accepts unsupported Wake-on-LAN modes (other than WAKE_PHY or WAKE_MAGIC) without reporting that to the user, which is confusing.
--- drivers/net/usb/asix_common.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/usb/asix_common.c +3 -0
@@ -417,6 +417,9 @@ int asix_set_wol(struct net_device *net,struct usbnet *dev =netdev_priv (net);u8 opt =0 ; +if (wolinfo->wolopts & ~(WAKE_PHY |WAKE_MAGIC )) +return -EINVAL ; +if (wolinfo->wolopts &WAKE_PHY ) opt |=AX_MONITOR_LINK ;if (wolinfo->wolopts &WAKE_MAGIC )
PATCH 273/328 ax88179_178a: Check for supported Wake-on-LAN modes
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit 5ba6b4aa9a410c5e2c6417df52b5e2118ea9b467 upstream.
The driver currently silently accepts unsupported Wake-on-LAN modes (other than WAKE_PHY or WAKE_MAGIC) without reporting that to the user, which is confusing.
--- drivers/net/usb/ax88179_178a.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/usb/ax88179_178a.c +3 -0
@@ -506,6 +506,9 @@ ax88179_set_wol(struct net_device *net,struct usbnet *dev =netdev_priv (net);u8 opt =0 ; +if (wolinfo->wolopts & ~(WAKE_PHY |WAKE_MAGIC )) +return -EINVAL ; +if (wolinfo->wolopts &WAKE_PHY ) opt |=AX_MONITOR_MODE_RWLC ;if (wolinfo->wolopts &WAKE_MAGIC )
PATCH 284/328 xhci: Add missing CAS workaround for Intel Sunrise Point xHCI
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit ffe84e01bb1b38c7eb9c6b6da127a6c136d251df upstream.
The workaround for missing CAS bit is also needed for xHC on Intel sunrisepoint PCH. For more details see:
Intel 100/c230 series PCH specification update Doc #332692-006 Errata #8
--- drivers/usb/host/xhci-pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/host/xhci-pci.c +2 -0
@@ -178,6 +178,8 @@ static void xhci_pci_quirks(struct devic }if (pdev->vendor ==PCI_VENDOR_ID_INTEL && (pdev->device ==PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || + pdev->device ==PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || + pdev->device ==PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || pdev->device ==PCI_DEVICE_ID_INTEL_APL_XHCI || pdev->device ==PCI_DEVICE_ID_INTEL_DNV_XHCI )) xhci->quirks |=XHCI_MISSING_CAS ;
PATCH 290/328 rtnl: limit IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES to 4096
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 0e1d6eca5113858ed2caea61a5adc03c595f6096 upstream.
We have an impressive number of syzkaller bugs that are linked to the fact that syzbot was able to create a networking device with millions of TX (or RX) queues.
Let's limit the number of RX/TX queues to 4096, this really should cover all known cases.
A separate patch will add various cond_resched() in the loops handling sysfs entries at device creation and dismantle.
Tested:
lpaa6:~# ip link add gre-4097 numtxqueues 4097 numrxqueues 4097 type ip6gretap RTNETLINK answers: Invalid argument
lpaa6:~# time ip link add gre-4096 numtxqueues 4096 numrxqueues 4096 type ip6gretap
real 0m0.180s
user 0m0.000s
sys 0m0.107s
--- net/core/rtnetlink.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/core/rtnetlink.c +6 -0
@@ -1831,6 +1831,12 @@ struct net_device *rtnl_create_link(struelse if (ops->get_num_rx_queues) num_rx_queues = ops->get_num_rx_queues (); +if (num_tx_queues <1 || num_tx_queues >4096 ) +return ERR_PTR (-EINVAL ); + +if (num_rx_queues <1 || num_rx_queues >4096 ) +return ERR_PTR (-EINVAL ); + err = -ENOMEM ; dev =alloc_netdev_mqs (ops->priv_size, ifname, ops->setup, num_tx_queues, num_rx_queues);
PATCH 294/328 team: Forbid enslaving team device to itself
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
commit 471b83bd8bbe4e89743683ef8ecb78f7029d8288 upstream.
team's ndo_add_slave() acquires 'team->lock' and later tries to open the newly enslaved device via dev_open(). This emits a 'NETDEV_UP' event that causes the VLAN driver to add VLAN 0 on the team device. team's ndo_vlan_rx_add_vid() will also try to acquire 'team->lock' and deadlock.
Fix this by checking early at the enslavement function that a team device is not being enslaved to itself.
A similar check was added to the bond driver in commit 09a89c219baf ("bonding: disallow enslaving a bond to itself").
WARNING: possible recursive locking detected
4.18.0-rc7+ #176 Not tainted
--------------------------------------------
syz-executor4/6391 is trying to acquire lock:
(____ptrval____) (&team->lock){+.+.}, at: team_vlan_rx_add_vid+0x3b/0x1e0 drivers/net/team/team.c:1868
but task is already holding lock:
(____ptrval____) (&team->lock){+.+.}, at: team_add_slave+0xdb/0x1c30 drivers/net/team/team.c:1947
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&team->lock);
lock(&team->lock);
*** DEADLOCK ***
May be due to missing lock nesting notation
2 locks held by syz-executor4/6391:
#0: (____ptrval____) (rtnl_mutex){+.+.}, at: rtnl_lock net/core/rtnetlink.c:77 [inline] #0: (____ptrval____) (rtnl_mutex){+.+.}, at: rtnetlink_rcv_msg+0x412/0xc30 net/core/rtnetlink.c:4662 #1: (____ptrval____) (&team->lock){+.+.}, at: team_add_slave+0xdb/0x1c30 drivers/net/team/team.c:1947
stack backtrace: CPU: 1 PID: 6391 Comm: syz-executor4 Not tainted 4.18.0-rc7+ #176 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113 print_deadlock_bug kernel/locking/lockdep.c:1765 [inline] check_deadlock kernel/locking/lockdep.c:1809 [inline] validate_chain kernel/locking/lockdep.c:2405 [inline] __lock_acquire.cold.64+0x1fb/0x486 kernel/locking/lockdep.c:3435 lock_acquire+0x1e4/0x540 kernel/locking/lockdep.c:3924 __mutex_lock_common kernel/locking/mutex.c:757 [inline] __mutex_lock+0x176/0x1820 kernel/locking/mutex.c:894 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:909 team_vlan_rx_add_vid+0x3b/0x1e0 drivers/net/team/team.c:1868 vlan_add_rx_filter_info+0x14a/0x1d0 net/8021q/vlan_core.c:210 __vlan_vid_add net/8021q/vlan_core.c:278 [inline] vlan_vid_add+0x63e/0x9d0 net/8021q/vlan_core.c:308 vlan_device_event.cold.12+0x2a/0x2f net/8021q/vlan.c:381 notifier_call_chain+0x180/0x390 kernel/notifier.c:93 __raw_notifier_call_chain kernel/notifier.c:394 [inline] raw_notifier_call_chain+0x2d/0x40 kernel/notifier.c:401 call_netdevice_notifiers_info+0x3f/0x90 net/core/dev.c:1735 call_netdevice_notifiers net/core/dev.c:1753 [inline] dev_open+0x173/0x1b0 net/core/dev.c:1433 team_port_add drivers/net/team/team.c:1219 [inline] team_add_slave+0xa8b/0x1c30 drivers/net/team/team.c:1948 do_set_master+0x1c9/0x220 net/core/rtnetlink.c:2248 do_setlink+0xba4/0x3e10 net/core/rtnetlink.c:2382 rtnl_setlink+0x2a9/0x400 net/core/rtnetlink.c:2636 rtnetlink_rcv_msg+0x46e/0xc30 net/core/rtnetlink.c:4665 netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2455 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:4683 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline] netlink_unicast+0x5a0/0x760 net/netlink/af_netlink.c:1343 netlink_sendmsg+0xa18/0xfd0 net/netlink/af_netlink.c:1908 sock_sendmsg_nosec net/socket.c:642 [inline] sock_sendmsg+0xd5/0x120 net/socket.c:652 ___sys_sendmsg+0x7fd/0x930 net/socket.c:2126 __sys_sendmsg+0x11d/0x290 net/socket.c:2164 __do_sys_sendmsg net/socket.c:2173 [inline] __se_sys_sendmsg net/socket.c:2171 [inline] __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2171 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x456b29 Code: fd b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 cb b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f9706bf8c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f9706bf96d4 RCX: 0000000000456b29 RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000004 RBP: 00000000009300a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000004d3548 R14: 00000000004c8227 R15: 0000000000000000
---
drivers/net/team/team.c +5 -0
@@ -1124,6 +1124,11 @@ static int team_port_add(struct team *tereturn -EBUSY ; } +if (dev == port_dev) { +netdev_err (dev,"Cannot enslave team device to itself\n" ); +return -EINVAL ; + } +if (port_dev->features &NETIF_F_VLAN_CHALLENGED &&vlan_uses_dev (dev)) { netdev_err(dev, "Device %s is VLAN challenged and team device has VLAN set up\n",
PATCH 295/328 MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Maciej W. Rozycki" <[email protected]>
commit 148b9aba99e0bbadf361747d21456e1589015f74 upstream.
Fix a commit 8a8158c85e1e ("MIPS: memset.S: EVA & fault support for small_memset") regression and remove assembly warnings:
arch/mips/lib/memset.S: Assembler messages:arch/mips/lib/memset.S:243: Warning: Macro instruction expanded into multiple instructions in a branch delay slot
triggering with the CPU_DADDI_WORKAROUNDS option set and this code:
PTR_SUBU a2, t1, a0 jr ra PTR_ADDIU a2, 1
This is because with that option in place the DADDIU instruction, which the PTR_ADDIU CPP macro expands to, becomes a GAS macro, which in turn expands to an LI/DADDU (or actually ADDIU/DADDU) sequence:
13c: 01a4302f dsubu a2,t1,a0
140: 03e00008 jr ra
144: 24010001 li at,1
148: 00c1302d daddu a2,a2,at
...
Correct this by switching off the `noreorder' assembly mode and letting GAS schedule this jump's delay slot, as there is nothing special about it that would require manual scheduling. With this change in place correct code is produced:
13c: 01a4302f dsubu a2,t1,a0
140: 24010001 li at,1
144: 03e00008 jr ra
148: 00c1302d daddu a2,a2,at
...
Patchwork: https://patchwork.linux-mips.org/patch/20833/
--- arch/mips/lib/memset.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/mips/lib/memset.S +3 -1
@@ -213,9 +213,11 @@ nop .Lsmall_fixup\@: + .set reorder PTR_SUBU a2, t1, a0 + PTR_ADDIU a2, 1 jr ra - PTR_ADDIU a2, 1 + .set noreorder .endm
PATCH 298/328 ipv6: take rcu lock in rawv6_send_hdrinc()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wei Wang <[email protected]>
commit a688caa34beb2fd2a92f1b6d33e40cde433ba160 upstream.
In rawv6_send_hdrinc(), in order to avoid an extra dst_hold(), we directly assign the dst to skb and set passed in dst to NULL to avoid double free.
However, in error case, we free skb and then do stats update with the dst pointer passed in. This causes use-after-free on the dst. Fix it by taking rcu read lock right before dst could get released to make sure dst does not get freed until the stats update is done.
Note: we don't have this issue in ipv4 cause dst is not used for stats update in v4.
Syzkaller reported following crash:
BUG: KASAN: use-after-free in rawv6_send_hdrinc net/ipv6/raw.c:692 [inline] BUG: KASAN: use-after-free in rawv6_sendmsg+0x4421/0x4630 net/ipv6/raw.c:921 Read of size 8 at addr ffff8801d95ba730 by task syz-executor0/32088 CPU: 1 PID: 32088 Comm: syz-executor0 Not tainted 4.19.0-rc2+ #93 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1c4/0x2b4 lib/dump_stack.c:113 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 rawv6_send_hdrinc net/ipv6/raw.c:692 [inline] rawv6_sendmsg+0x4421/0x4630 net/ipv6/raw.c:921 inet_sendmsg+0x1a1/0x690 net/ipv4/af_inet.c:798 sock_sendmsg_nosec net/socket.c:621 [inline] sock_sendmsg+0xd5/0x120 net/socket.c:631 ___sys_sendmsg+0x7fd/0x930 net/socket.c:2114 __sys_sendmsg+0x11d/0x280 net/socket.c:2152 __do_sys_sendmsg net/socket.c:2161 [inline] __se_sys_sendmsg net/socket.c:2159 [inline] __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2159 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x457099 Code: fd b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 cb b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f83756edc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f83756ee6d4 RCX: 0000000000457099 RDX: 0000000000000000 RSI: 0000000020003840 RDI: 0000000000000004 RBP: 00000000009300a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000004d4b30 R14: 00000000004c90b1 R15: 0000000000000000 Allocated by task 32088: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490 kmem_cache_alloc+0x12e/0x730 mm/slab.c:3554 dst_alloc+0xbb/0x1d0 net/core/dst.c:105 ip6_dst_alloc+0x35/0xa0 net/ipv6/route.c:353 ip6_rt_cache_alloc+0x247/0x7b0 net/ipv6/route.c:1186 ip6_pol_route+0x8f8/0xd90 net/ipv6/route.c:1895 ip6_pol_route_output+0x54/0x70 net/ipv6/route.c:2093 fib6_rule_lookup+0x277/0x860 net/ipv6/fib6_rules.c:122 ip6_route_output_flags+0x2c5/0x350 net/ipv6/route.c:2121 ip6_route_output include/net/ip6_route.h:88 [inline] ip6_dst_lookup_tail+0xe27/0x1d60 net/ipv6/ip6_output.c:951 ip6_dst_lookup_flow+0xc8/0x270 net/ipv6/ip6_output.c:1079 rawv6_sendmsg+0x12d9/0x4630 net/ipv6/raw.c:905 inet_sendmsg+0x1a1/0x690 net/ipv4/af_inet.c:798 sock_sendmsg_nosec net/socket.c:621 [inline] sock_sendmsg+0xd5/0x120 net/socket.c:631 ___sys_sendmsg+0x7fd/0x930 net/socket.c:2114 __sys_sendmsg+0x11d/0x280 net/socket.c:2152 __do_sys_sendmsg net/socket.c:2161 [inline] __se_sys_sendmsg net/socket.c:2159 [inline] __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2159 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 5356: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3498 [inline] kmem_cache_free+0x83/0x290 mm/slab.c:3756 dst_destroy+0x267/0x3c0 net/core/dst.c:141 dst_destroy_rcu+0x16/0x19 net/core/dst.c:154 __rcu_reclaim kernel/rcu/rcu.h:236 [inline] rcu_do_batch kernel/rcu/tree.c:2576 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:2880 [inline] __rcu_process_callbacks kernel/rcu/tree.c:2847 [inline] rcu_process_callbacks+0xf23/0x2670 kernel/rcu/tree.c:2864 __do_softirq+0x30b/0xad8 kernel/softirq.c:292
[bwh: Backported to 3.16:
- We don't set tstamp here
- Adjust context]
---
net/ipv6/raw.c +20 -9
@@ -643,8 +643,6 @@ static int rawv6_send_hdrinc(struct sock skb->protocol =htons (ETH_P_IPV6 ); skb->priority = sk->sk_priority; skb->mark = sk->sk_mark; -skb_dst_set (skb, &rt->dst); - *dstp =NULL ;skb_put (skb, length);skb_reset_network_header (skb);
@@ -654,24 +652,37 @@ static int rawv6_send_hdrinc(struct sock skb->transport_header = skb->network_header; err =memcpy_fromiovecend ((void *)iph, from,0 , length); -if (err) - goto error_fault; +if (err) { + err = -EFAULT ; +kfree_skb (skb); + goto error; + } +skb_dst_set (skb, &rt->dst); + *dstp =NULL ; + +/* Acquire rcu_read_lock() in case we need to use rt->rt6i_idev +* in the error path. Since skb has been freed, the dst could +* have been queued for deletion. +*/ +rcu_read_lock ();IP6_UPD_PO_STATS (net, rt->rt6i_idev,IPSTATS_MIB_OUT , skb->len); err =NF_HOOK (NFPROTO_IPV6 ,NF_INET_LOCAL_OUT , skb,NULL , rt->dst.dev, dst_output);if (err >0 ) err =net_xmit_errno (err); -if (err) - goto error; +if (err) { +IP6_INC_STATS (net, rt->rt6i_idev,IPSTATS_MIB_OUTDISCARDS ); +rcu_read_unlock (); + goto error_check; + } +rcu_read_unlock (); out:return 0 ; -error_fault: - err = -EFAULT ; -kfree_skb (skb); error:IP6_INC_STATS (net, rt->rt6i_idev,IPSTATS_MIB_OUTDISCARDS ); +error_check:if (err == -ENOBUFS && !np->recverr) err =0 ;return err;
PATCH 299/328 Make file credentials available to the seqfile interfaces
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 34dbbcdbf63360661ff7bda6c5f52f99ac515f92 upstream.
A lot of seqfile users seem to be using things like %pK that uses the credentials of the current process, but that is actually completely wrong for filesystem interfaces.
The unix semantics for permission checking files is to check permissions at _open_ time, not at read or write time, and that is not just a small
detail: passing off stdin/stdout/stderr to a suid application and making the actual IO happen in privileged context is a classic exploit technique.
So if we want to be able to look at permissions at read time, we need to use the file open credentials, not the current ones. Normal file accesses can just use "f_cred" (or any of the helper functions that do that, like file_ns_capable()), but the seqfile interfaces do not have any such options.
It turns out that seq_file _does_ save away the user_ns information of the file, though. Since user_ns is just part of the full credential information, replace that special case with saving off the cred pointer instead, and suddenly seq_file has all the permission information it needs.
--- fs/seq_file.c | 7 ++++--- include/linux/seq_file.h | 13 ++++--------- 2 files changed, 8 insertions(+), 12 deletions(-)
fs/seq_file.c +4 -3
@@ -69,9 +69,10 @@ int seq_open(struct file *file, const stmemset (p,0 ,sizeof (*p));mutex_init (&p->lock); p->op = op; -#ifdef CONFIG_USER_NS - p->user_ns = file->f_cred->user_ns; -#endif + +// No refcounting: the lifetime of 'p' is constrained +// to the lifetime of the file. + p->file = file;/* * Wrappers around seq_open(e.g. swaps_open) need to be
include/linux/seq_file.h +4 -9
@@ -7,13 +7,10 @@#include <linux/mutex.h> #include <linux/cpumask.h> #include <linux/nodemask.h> +#include <linux/fs.h> +#include <linux/cred.h> struct seq_operations ; -struct file ; -struct path ; -struct inode ; -struct dentry ; -struct user_namespace ;struct seq_file {char *buf;
@@ -27,9 +24,7 @@ struct seq_file {struct mutex lock;const struct seq_operations *op;int poll_event; -#ifdef CONFIG_USER_NS -struct user_namespace *user_ns; -#endif +const struct file *file;void *private; };
@@ -151,7 +146,7 @@ int seq_put_decimal_ll(struct seq_file *static inline struct user_namespace *seq_user_ns (struct seq_file *seq) {#ifdef CONFIG_USER_NS -return seq->user_ns; +return seq->file->f_cred->user_ns;#else extern struct user_namespace init_user_ns;return &init_user_ns;
PATCH 303/328 mm: madvise(MADV_DODUMP): allow hugetlbfs pages
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Black <[email protected]>
commit d41aa5252394c065d1f04d1ceea885b70d00c9c6 upstream.
Reproducer, assuming 2M of hugetlbfs available:
Hugetlbfs mounted, size=2M and option user=testuser
# mount | grep ^hugetlbfs hugetlbfs on /dev/hugepages type hugetlbfs (rw,pagesize=2M,user=dan) # sysctl vm.nr_hugepages=1 vm.nr_hugepages = 1 # grep Huge /proc/meminfo AnonHugePages: 0 kB ShmemHugePages: 0 kB HugePages_Total: 1 HugePages_Free: 1 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB Hugetlb: 2048 kB
Code:
#include <sys/mman.h>
#include <stddef.h>
#define SIZE 2*1024*1024
int main()
{
void *ptr;
ptr = mmap(NULL, SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_HUGETLB | MAP_ANONYMOUS, -1, 0);
madvise(ptr, SIZE, MADV_DONTDUMP);
madvise(ptr, SIZE, MADV_DODUMP);
}Compile and strace:
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB, -1, 0) = 0x7ff7c9200000 madvise(0x7ff7c9200000, 2097152, MADV_DONTDUMP) = 0
madvise(0x7ff7c9200000, 2097152, MADV_DODUMP) = -1 EINVAL (Invalid argument)
hugetlbfs pages have VM_DONTEXPAND in the VmFlags driver pages based on author testing with analysis from Florian Weimer[1].
The inclusion of VM_DONTEXPAND into the VM_SPECIAL defination was a consequence of the large useage of VM_DONTEXPAND in device drivers.
A consequence of [2] is that VM_DONTEXPAND marked pages are unable to be marked DODUMP.
A user could quite legitimately madvise(MADV_DONTDUMP) their hugetlbfs memory for a while and later request that madvise(MADV_DODUMP) on the same memory. We correct this omission by allowing madvice(MADV_DODUMP) on hugetlbfs pages.
[1] https://stackoverflow.com/questions/52548260/madvisedodump-on-the-same-ptr-size-as-a-successful-madvisedontdump-fails-wit
[2] commit 0103bd16fb90 ("mm: prepare VM_DONTDUMP for using in drivers")
--- mm/madvise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/madvise.c +1 -1
@@ -75,7 +75,7 @@ static long madvise_behavior(struct vm_a new_flags |=VM_DONTDUMP ;break ;case MADV_DODUMP : -if (new_flags &VM_SPECIAL ) { +if (!is_vm_hugetlb_page (vma) && new_flags &VM_SPECIAL ) { error = -EINVAL ; goto out; }
PATCH 305/328 usb: usbip: Fix BUG: KASAN: slab-out-of-bounds in vhci_hub_control()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Shuah Khan (Samsung OSG)" <[email protected]>
commit 81f7567c51ad97668d1c3a48e8ecc482e64d4161 upstream.
vhci_hub_control() accesses port_status array with out of bounds port value. Fix it to reference port_status[] only with a valid rhport value when invalid_rhport flag is true.
The invalid_rhport flag is set early on after detecting in port value is within the bounds or not.
The following is used reproduce the problem and verify the fix:
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14ed8ab6400000
[bwh: Backported to 3.16:
- s/VHCI_HC_PORTS/VHCI_NPORTS/
- Mask wIndex before using it, as done upstream in commit 1c9de5bf4286 "usbip: vhci-hcd: Add USB3 SuperSpeed support"
- Drop inapplicable changes
- Adjust filename]
---
drivers/staging/usbip/vhci_hcd.c +32 -11
@@ -234,7 +234,8 @@ static int vhci_hub_control(struct usb_h {struct vhci_hcd *dum;int retval =0 ; -int rhport; +int rhport =-1 ; +bool invalid_rhport = false;u32 prev_port_status[VHCI_NPORTS ];
@@ -245,11 +246,23 @@ static int vhci_hub_control(struct usb_h* NOTE: * wIndex shows the port number and begins from 1. */ + wIndex = ((__u8)(wIndex &0x00ff ));usbip_dbg_vhci_rh ("typeReq %x wValue %x wIndex %x\n" , typeReq, wValue, wIndex); -if (wIndex >VHCI_NPORTS ) -pr_err ("invalid port number %d\n" , wIndex); - rhport = ((__u8)(wIndex &0x00ff )) -1 ; + +/* +* wIndex can be 0 for some request types (typeReq). rhport is +* in valid range when wIndex >= 1 and < VHCI_HC_PORTS. +* +* Reference port_status[] only with valid rhport when +* invalid_rhport is false. +*/ +if (wIndex <1 || wIndex >VHCI_NPORTS ) { + invalid_rhport = true; +if (wIndex >VHCI_NPORTS ) +pr_err ("invalid port number %d\n" , wIndex); + }else + rhport = wIndex -1 ; dum =hcd_to_vhci (hcd);
@@ -257,8 +270,9 @@ static int vhci_hub_control(struct usb_h/* store old status and compare now and old later */ if (usbip_dbg_flag_vhci_rh) { -memcpy (prev_port_status, dum->port_status, -sizeof (prev_port_status)); +if (!invalid_rhport) +memcpy (prev_port_status, dum->port_status, +sizeof (prev_port_status)); }switch (typeReq) {
@@ -266,8 +280,10 @@ static int vhci_hub_control(struct usb_husbip_dbg_vhci_rh (" ClearHubFeature\n" );break ;case ClearPortFeature: -if (rhport <0 ) +if (invalid_rhport) { +pr_err ("invalid port number %d\n" , wIndex); goto error; + }switch (wValue) {case USB_PORT_FEAT_SUSPEND :if (dum->port_status[rhport] &USB_PORT_STAT_SUSPEND ) {
@@ -315,9 +331,10 @@ static int vhci_hub_control(struct usb_hbreak ;case GetPortStatus:usbip_dbg_vhci_rh (" GetPortStatus port %x\n" , wIndex); -if (wIndex >VHCI_NPORTS || wIndex <1 ) { +if (invalid_rhport) {pr_err ("invalid port number %d\n" , wIndex); retval = -EPIPE ; + goto error; }/* we do not care about resume. */
@@ -372,8 +389,10 @@ static int vhci_hub_control(struct usb_hcase USB_PORT_FEAT_RESET :usbip_dbg_vhci_rh (" SetPortFeature: USB_PORT_FEAT_RESET\n" ); -if (rhport <0 ) +if (invalid_rhport) { +pr_err ("invalid port number %d\n" , wIndex); goto error; + }/* if it's already running, disconnect first */ if (dum->port_status[rhport] &USB_PORT_STAT_ENABLE ) { dum->port_status[rhport] &=
@@ -389,8 +408,10 @@ static int vhci_hub_control(struct usb_hdefault :usbip_dbg_vhci_rh (" SetPortFeature: default %d\n" , wValue); -if (rhport <0 ) +if (invalid_rhport) { +pr_err ("invalid port number %d\n" , wIndex); goto error; + } dum->port_status[rhport] |= (1 << wValue);break ; }
@@ -406,7 +427,7 @@ error:if (usbip_dbg_flag_vhci_rh) {pr_debug ("port %d\n" , rhport);/* Only dump valid port status */ -if (rhport >=0 ) { +if (!invalid_rhport) {dump_port_status_diff (prev_port_status[rhport], dum->port_status[rhport]); }
PATCH 315/328 usb: gadget: storage: Fix Spectre v1 vulnerability
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Gustavo A. R. Silva" <[email protected]>
commit 9ae24af3669111d418242caec8dd4ebd9ba26860 upstream.
num can be indirectly controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability.
This issue was detected with the help of Smatch:
drivers/usb/gadget/function/f_mass_storage.c:3177 fsg_lun_make() warn:
potential spectre issue 'fsg_opts->common->luns' [r] (local cap)
Fix this by sanitizing num before using it to index fsg_opts->common->luns
Notice that given that speculation windows are large, the policy is to kill the speculation on the first load and not worry if it can be completed with a dependent load/store [1].
[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2
--- drivers/usb/gadget/f_mass_storage.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/gadget/f_mass_storage.c +3 -0
@@ -219,6 +219,8 @@#include <linux/usb/gadget.h> #include <linux/usb/composite.h> +#include <linux/nospec.h> +#include "gadget_chips.h" #include "configfs.h"
@@ -3344,6 +3346,7 @@ static struct config_group *fsg_lun_make fsg_opts =to_fsg_opts (&group->cg_item);if (num >=FSG_MAX_LUNS )return ERR_PTR (-ERANGE ); + num =array_index_nospec (num,FSG_MAX_LUNS );mutex_lock (&fsg_opts->lock);if (fsg_opts->refcnt || fsg_opts->common->luns[num]) {
PATCH 316/328 ptp: fix Spectre v1 vulnerability
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Gustavo A. R. Silva" <[email protected]>
commit efa61c8cf2950ab5c0e66cff3cabe2a2b24e81ba upstream.
pin_index can be indirectly controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability.
This issue was detected with the help of Smatch:
drivers/ptp/ptp_chardev.c:253 ptp_ioctl() warn: potential spectre issue 'ops->pin_config' [r] (local cap)
Fix this by sanitizing pin_index before using it to index ops->pin_config, and before passing it as an argument to function ptp_set_pinfunc(), in which it is used to index info->pin_config.
Notice that given that speculation windows are large, the policy is to kill the speculation on the first load and not worry if it can be completed with a dependent load/store [1].
[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2
--- drivers/ptp/ptp_chardev.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/ptp/ptp_chardev.c +4 -0
@@ -23,6 +23,8 @@#include <linux/sched.h> #include <linux/slab.h> +#include <linux/nospec.h> +#include "ptp_private.h" static int ptp_disable_pinfunc(struct ptp_clock_info *ops,
@@ -228,6 +230,7 @@ long ptp_ioctl(struct posix_clock *pc, u err = -EINVAL ;break ; } + pin_index =array_index_nospec (pin_index, ops->n_pins);if (mutex_lock_interruptible (&ptp->pincfg_mux))return -ERESTARTSYS ; pd = ops->pin_config[pin_index];
@@ -246,6 +249,7 @@ long ptp_ioctl(struct posix_clock *pc, u err = -EINVAL ;break ; } + pin_index =array_index_nospec (pin_index, ops->n_pins);if (mutex_lock_interruptible (&ptp->pincfg_mux))return -ERESTARTSYS ; err =ptp_set_pinfunc (ptp, pin_index, pd.func, pd.chan);
PATCH 320/328 mtd: fsl-quadspi: fix macro collision problems with READ/WRITE
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Han Xu <[email protected]>
commit 04850c4d8613127a9b488321c0ad83bff7519311 upstream.
Change the READ/WRITE to FSL_READ/FSL_WRITE to resolve any possible namespace collisions with READ/WRITE macros (e.g., from <linux/fs.h>).
Problems have been seen, for example, on mips:
Quoted 1 line
Quoted 1 line
drivers/mtd/spi-nor/fsl-quadspi.c:186:5: error: 'LUT_0' undeclared (first use in this function)
((LUT_##ins) << INSTR0_SHIFT))
^Quoted 1 line
Quoted 1 line
drivers/mtd/spi-nor/fsl-quadspi.c:188:30: note: in expansion of macro 'LUT0'
On SPARC:
drivers/mtd/spi-nor/fsl-quadspi.c: In function 'fsl_qspi_init_lut':drivers/mtd/spi-nor/fsl-quadspi.c:369:1: error: 'LUT_0' undeclared (first use in this function) drivers/mtd/spi-nor/fsl-quadspi.c:418:1: error: pasting "LUT_" and "(" does not give a valid preprocessing token drivers/mtd/spi-nor/fsl-quadspi.c:418:2: error: implicit declaration of function 'LUT_'
And surely on others.
--- drivers/mtd/spi-nor/fsl-quadspi.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/mtd/spi-nor/fsl-quadspi.c +10 -10
@@ -138,15 +138,15 @@#define LUT_MODE 4#define LUT_MODE2 5#define LUT_MODE4 6 -#define LUT_READ 7 -#define LUT_WRITE 8 +#define LUT_FSL_READ 7 +#define LUT_FSL_WRITE 8#define LUT_JMP_ON_CS 9#define LUT_ADDR_DDR 10#define LUT_MODE_DDR 11#define LUT_MODE2_DDR 12#define LUT_MODE4_DDR 13 -#define LUT_READ_DDR 14 -#define LUT_WRITE_DDR 15 +#define LUT_FSL_READ_DDR 14 +#define LUT_FSL_WRITE_DDR 15#define LUT_DATA_LEARN 16/*
@@ -306,7 +306,7 @@ static void fsl_qspi_init_lut(struct fslwritel (LUT0 (CMD ,PAD1 , cmd) |LUT1 (ADDR ,PAD1 , addrlen), base +QUADSPI_LUT (lut_base)); -writel (LUT0 (DUMMY ,PAD1 , dummy) |LUT1 (READ ,PAD4 , rxfifo), +writel (LUT0 (DUMMY ,PAD1 , dummy) |LUT1 (FSL_READ ,PAD4 , rxfifo), base +QUADSPI_LUT (lut_base +1 ));/* Write enable */
@@ -327,11 +327,11 @@ static void fsl_qspi_init_lut(struct fslwritel (LUT0 (CMD ,PAD1 , cmd) |LUT1 (ADDR ,PAD1 , addrlen), base +QUADSPI_LUT (lut_base)); -writel (LUT0 (WRITE ,PAD1 ,0 ), base +QUADSPI_LUT (lut_base +1 )); +writel (LUT0 (FSL_WRITE ,PAD1 ,0 ), base +QUADSPI_LUT (lut_base +1 ));/* Read Status */ lut_base =SEQID_RDSR *4 ; -writel (LUT0 (CMD ,PAD1 ,SPINOR_OP_RDSR ) |LUT1 (READ ,PAD1 ,0x1 ), +writel (LUT0 (CMD ,PAD1 ,SPINOR_OP_RDSR ) |LUT1 (FSL_READ ,PAD1 ,0x1 ), base +QUADSPI_LUT (lut_base));/* Erase a sector */
@@ -356,17 +356,17 @@ static void fsl_qspi_init_lut(struct fsl/* READ ID */ lut_base =SEQID_RDID *4 ; -writel (LUT0 (CMD ,PAD1 ,SPINOR_OP_RDID ) |LUT1 (READ ,PAD1 ,0x8 ), +writel (LUT0 (CMD ,PAD1 ,SPINOR_OP_RDID ) |LUT1 (FSL_READ ,PAD1 ,0x8 ), base +QUADSPI_LUT (lut_base));/* Write Register */ lut_base =SEQID_WRSR *4 ; -writel (LUT0 (CMD ,PAD1 ,SPINOR_OP_WRSR ) |LUT1 (WRITE ,PAD1 ,0x2 ), +writel (LUT0 (CMD ,PAD1 ,SPINOR_OP_WRSR ) |LUT1 (FSL_WRITE ,PAD1 ,0x2 ), base +QUADSPI_LUT (lut_base));/* Read Configuration Register */ lut_base =SEQID_RDCR *4 ; -writel (LUT0 (CMD ,PAD1 ,SPINOR_OP_RDCR ) |LUT1 (READ ,PAD1 ,0x1 ), +writel (LUT0 (CMD ,PAD1 ,SPINOR_OP_RDCR ) |LUT1 (FSL_READ ,PAD1 ,0x1 ), base +QUADSPI_LUT (lut_base));/* Write disable */
PATCH 322/328 KEYS: encrypted: fix buffer overread in valid_master_desc()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 794b4bc292f5d31739d89c0202c54e7dc9bc3add upstream.
With the 'encrypted' key type it was possible for userspace to provide a data blob ending with a master key description shorter than expected, e.g. 'keyctl add encrypted desc "new x" @s'. When validating such a master key description, validate_master_desc() could read beyond the end of the buffer. Fix this by using strncmp() instead of memcmp(). [Also clean up the code to deduplicate some logic.]
--- security/keys/encrypted-keys/encrypted.c | 31 ++++++++++++------------ 1 file changed, 15 insertions(+), 16 deletions(-)
security/keys/encrypted-keys/encrypted.c +15 -16
@@ -141,23 +141,22 @@ static int valid_ecryptfs_desc(const cha*/ static int valid_master_desc (const char *new_desc,const char *orig_desc) { -if (!memcmp (new_desc,KEY_TRUSTED_PREFIX ,KEY_TRUSTED_PREFIX_LEN )) { -if (strlen (new_desc) ==KEY_TRUSTED_PREFIX_LEN ) - goto out; -if (orig_desc) -if (memcmp (new_desc, orig_desc,KEY_TRUSTED_PREFIX_LEN )) - goto out; - }else if (!memcmp (new_desc,KEY_USER_PREFIX ,KEY_USER_PREFIX_LEN )) { -if (strlen (new_desc) ==KEY_USER_PREFIX_LEN ) - goto out; -if (orig_desc) -if (memcmp (new_desc, orig_desc,KEY_USER_PREFIX_LEN )) - goto out; - }else - goto out; +int prefix_len; + +if (!strncmp (new_desc,KEY_TRUSTED_PREFIX ,KEY_TRUSTED_PREFIX_LEN )) + prefix_len =KEY_TRUSTED_PREFIX_LEN ; +else if (!strncmp (new_desc,KEY_USER_PREFIX ,KEY_USER_PREFIX_LEN )) + prefix_len =KEY_USER_PREFIX_LEN ; +else +return -EINVAL ; + +if (!new_desc[prefix_len]) +return -EINVAL ; + +if (orig_desc &&strncmp (new_desc, orig_desc, prefix_len)) +return -EINVAL ; +return 0 ; -out: -return -EINVAL ; }/*
PATCH 323/328 wil6210: missing length check in wmi_set_ie
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lior David <[email protected]>
commit b5a8ffcae4103a9d823ea3aa3a761f65779fbe2a upstream.
Add a length check in wmi_set_ie to detect unsigned integer overflow.
---
drivers/net/wireless/ath/wil6210/wmi.c +6 -1
@@ -958,7 +958,12 @@ int wmi_set_ie(struct wil6210_priv *wil, {int rc;u16 len =sizeof (struct wmi_set_appie_cmd ) + ie_len; -struct wmi_set_appie_cmd *cmd =kzalloc (len,GFP_KERNEL ); +struct wmi_set_appie_cmd *cmd; + +if (len < ie_len) +return -EINVAL ; + + cmd =kzalloc (len,GFP_KERNEL );if (!cmd)return -ENOMEM ;
PATCH 324/328 posix-timers: Sanitize overrun handling
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 78c9c4dfbf8c04883941445a195276bb4bb92c76 upstream.
The posix timer overrun handling is broken because the forwarding functions can return a huge number of overruns which does not fit in an int. As a consequence timer_getoverrun(2) and siginfo::si_overrun can turn into random number generators.
The k_clock::timer_forward() callbacks return a 64 bit value now. Make k_itimer::ti_overrun[_last] 64bit as well, so the kernel internal accounting is correct. 3Remove the temporary (int) casts.
Add a helper function which clamps the overrun value returned to user space via timer_getoverrun(2) or siginfo::si_overrun limited to a positive value between 0 and INT_MAX. INT_MAX is an indicator for user space that the overrun value has been clamped.
--- include/linux/posix-timers.h | 4 ++-- kernel/posix-cpu-timers.c | 2 +- kernel/posix-timers.c | 31 ++++++++++++++++++++----------- 3 files changed, 23 insertions(+), 14 deletions(-)
include/linux/posix-timers.h +2 -2
@@ -65,8 +65,8 @@ struct k_itimer {spinlock_t it_lock;clockid_t it_clock;/* which timer type */ timer_t it_id;/* timer id */ -int it_overrun;/* overrun on pending signal */ -int it_overrun_last;/* overrun on last delivered signal */ +s64 it_overrun;/* overrun on pending signal */ +s64 it_overrun_last;/* overrun on last delivered signal */ int it_requeue_pending;/* waiting to requeue this timer */ #define REQUEUE_PENDING 1int it_sigev_notify;/* notify word of sigevent struct */
kernel/posix-cpu-timers.c +1 -1
@@ -103,7 +103,7 @@ static void bump_cpu_timer(struct k_itimcontinue ; timer->it.cpu.expires += incr; - timer->it_overrun +=1 << i; + timer->it_overrun +=1LL << i; delta -= incr; } }
kernel/posix-timers.c +20 -11
@@ -347,6 +347,17 @@ static __init int init_posix_timers(void__initcall (init_posix_timers); +/* +* The siginfo si_overrun field and the return value of timer_getoverrun(2) +* are of type int. Clamp the overrun value to INT_MAX +*/ +static inline int timer_overrun_to_int (struct k_itimer *timr,int baseval) +{ +s64 sum = timr->it_overrun_last + (s64 )baseval; + +return sum > (s64 )INT_MAX ?INT_MAX : (int )sum; +} +static void schedule_next_timer (struct k_itimer *timr) {struct hrtimer *timer = &timr->it.real.timer;
@@ -354,12 +365,11 @@ static void schedule_next_timer(struct kif (timr->it.real.interval.tv64 ==0 )return ; - timr->it_overrun += (unsigned int )hrtimer_forward (timer, - timer->base->get_time (), - timr->it.real.interval); + timr->it_overrun +=hrtimer_forward (timer, timer->base->get_time (), + timr->it.real.interval); timr->it_overrun_last = timr->it_overrun; - timr->it_overrun =-1 ; + timr->it_overrun =-1LL ; ++timr->it_requeue_pending;hrtimer_restart (timer); }
@@ -388,7 +398,7 @@ void do_schedule_next_timer(struct siginelse schedule_next_timer (timr); - info->si_overrun += timr->it_overrun_last; + info->si_overrun =timer_overrun_to_int (timr, info->si_overrun); }if (timr)
@@ -483,9 +493,8 @@ static enum hrtimer_restart posix_timer_ now = ktime_add(now, kj); }#endif - timr->it_overrun += (unsigned int ) -hrtimer_forward (timer, now, - timr->it.real.interval); + timr->it_overrun +=hrtimer_forward (timer, now, + timr->it.real.interval); ret =HRTIMER_RESTART ; ++timr->it_requeue_pending; }
@@ -633,7 +642,7 @@ SYSCALL_DEFINE3(timer_create, const cloc it_id_set =IT_ID_SET ; new_timer->it_id = (timer_t ) new_timer_id; new_timer->it_clock = which_clock; - new_timer->it_overrun =-1 ; + new_timer->it_overrun =-1LL ;if (timer_event_spec) {if (copy_from_user (&event, timer_event_spec,sizeof (event))) {
@@ -763,7 +772,7 @@ common_timer_get(struct k_itimer *timr,* expiry is > now. */ if (iv.tv64 && (timr->it_requeue_pending &REQUEUE_PENDING || sig_none)) - timr->it_overrun += (unsigned int )hrtimer_forward (timer, now, iv); + timr->it_overrun +=hrtimer_forward (timer, now, iv); remaining =ktime_sub (hrtimer_get_expires (timer), now);/* Return 0 only, when the timer is expired and not pending */
@@ -825,7 +834,7 @@ SYSCALL_DEFINE1(timer_getoverrun, timer_if (!timr)return -EINVAL ; - overrun = timr->it_overrun_last; + overrun =timer_overrun_to_int (timr,0 );unlock_timer (timr, flags);return overrun;
PATCH 325/328 mm: cleancache: fix corruption on missed inode invalidation
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Tikhomirov <[email protected]>
commit 6ff38bd40230af35e446239396e5fc8ebd6a5248 upstream.
If all pages are deleted from the mapping by memory reclaim and also moved to the cleancache:
__delete_from_page_cache
(no shadow case)
unaccount_page_cache_page
cleancache_put_page
page_cache_delete
mapping->nrpages -= nr
(nrpages becomes 0)
We don't clean the cleancache for an inode after final file truncation (removal).
truncate_inode_pages_final
check (nrpages || nrexceptional) is false
no truncate_inode_pages
no cleancache_invalidate_inode(mapping)
These way when reading the new file created with same inode we may get these trash leftover pages from cleancache and see wrong data instead of the contents of the new file.
Fix it by always doing truncate_inode_pages which is already ready for nrpages == 0 && nrexceptional == 0 case and just invalidates inode.
--- mm/truncate.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
mm/truncate.c +6 -2
@@ -461,9 +461,13 @@ void truncate_inode_pages_final(struct a*/ spin_lock_irq (&mapping->tree_lock);spin_unlock_irq (&mapping->tree_lock); - -truncate_inode_pages (mapping,0 ); } + +/* +* Cleancache needs notification even if there are no pages or shadow +* entries. +*/ +truncate_inode_pages (mapping,0 ); }EXPORT_SYMBOL (truncate_inode_pages_final);
PATCH 327/328 xfs: don't fail when converting shortform attr to long form during ATTR_REPLACE
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <[email protected]>
commit 7b38460dc8e4eafba06c78f8e37099d3b34d473c upstream.
Kanda Motohiro reported that expanding a tiny xattr into a large xattr fails on XFS because we remove the tiny xattr from a shortform fork and then try to re-add it after converting the fork to extents format having not removed the ATTR_REPLACE flag. This fails because the attr is no longer present, causing a fs shutdown.
This is derived from the patch in his bug report, but we really shouldn't ignore a nonzero retval from the remove call.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199119
--- fs/xfs/xfs_attr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/xfs/xfs_attr.c +8 -1
@@ -540,7 +540,14 @@ xfs_attr_shortform_addname(xfs_da_args_tif (args->flags &ATTR_CREATE )return (retval); retval =xfs_attr_shortform_remove (args); -ASSERT (retval ==0 ); +if (retval) +return retval; +/* +* Since we have removed the old attr, clear ATTR_REPLACE so +* that the leaf format add routine won't trip over the attr +* not being around. +*/ + args->flags &= ~ATTR_REPLACE ; } if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||
PATCH 2/328 EDAC: i7core: Return proper error codes for kzalloc() errors
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit e97d7e38162dc305b4734a316ca758a2bbd1fa6e upstream.
... instead of possibly uninitialized return value.
--- drivers/edac/i7core_edac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/edac/i7core_edac.c +2 -2
@@ -1177,7 +1177,7 @@ static int i7core_create_sysfs_devices(s pvt->addrmatch_dev =kzalloc (sizeof (*pvt->addrmatch_dev),GFP_KERNEL );if (!pvt->addrmatch_dev) -return rc; +return -ENOMEM ; pvt->addrmatch_dev->type = &addrmatch_type; pvt->addrmatch_dev->bus = mci->dev.bus;
@@ -1198,7 +1198,7 @@ static int i7core_create_sysfs_devices(sif (!pvt->chancounts_dev) {put_device (pvt->addrmatch_dev);device_del (pvt->addrmatch_dev); -return rc; +return -ENOMEM ; } pvt->chancounts_dev->type = &all_channel_counts_type;
PATCH 6/328 s390/qdio: reset old sbal_state flags
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Julian Wiedmann <[email protected]>
commit 64e03ff72623b8c2ea89ca3cb660094e019ed4ae upstream.
When allocating a new AOB fails, handle_outbound() is still capable of transmitting the selected buffer (just without async completion).
But if a previous transfer on this queue slot used async completion, its sbal_state flags field is still set to QDIO_OUTBUF_STATE_FLAG_PENDING. So when the upper layer driver sees this stale flag, it expects an async completion that never happens.
Fix this by unconditionally clearing the flags field.
--- arch/s390/include/asm/qdio.h | 1 - drivers/s390/cio/qdio_main.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-)
arch/s390/include/asm/qdio.h +0 -1
@@ -271,7 +271,6 @@ struct qdio_outbuf_state {void *user; }; -#define QDIO_OUTBUF_STATE_FLAG_NONE 0x00#define QDIO_OUTBUF_STATE_FLAG_PENDING 0x01#define CHSC_AC1_INITIATE_INPUTQ 0x80
drivers/s390/cio/qdio_main.c +2 -3
@@ -640,21 +640,20 @@ static inline unsigned long qdio_aob_forunsigned long phys_aob =0 ;if (!q->use_cq) - goto out; +return 0 ;if (!q->aobs[bufnr]) {struct qaob *aob =qdio_allocate_aob (); q->aobs[bufnr] = aob; }if (q->aobs[bufnr]) { - q->sbal_state[bufnr].flags =QDIO_OUTBUF_STATE_FLAG_NONE ; q->sbal_state[bufnr].aob = q->aobs[bufnr]; q->aobs[bufnr]->user1 = (u64 ) q->sbal_state[bufnr].user; phys_aob =virt_to_phys (q->aobs[bufnr]);WARN_ON_ONCE (phys_aob &0xFF ); } -out: + q->sbal_state[bufnr].flags =0 ;return phys_aob; }
PATCH 11/328 serial: pxa: Fix an error handling path in 'serial_pxa_probe()'
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
commit 95a0e656580fab3128c7bee5f660c50784f53651 upstream.
If port.line is out of range, we still need to release some resources, or we will leak them.
--- drivers/tty/serial/pxa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/pxa.c +2 -1
@@ -890,7 +890,8 @@ static int serial_pxa_probe(struct platf goto err_clk;if (sport->port.line >=ARRAY_SIZE (serial_pxa_ports)) {dev_err (&dev->dev,"serial%d out of range\n" , sport->port.line); -return -EINVAL ; + ret = -EINVAL ; + goto err_clk; }snprintf (sport->name,PXA_NAME_LEN -1 ,"UART%d" , sport->port.line +1 );
PATCH 13/328 ALSA: snd-aoa: add of_node_put() in error path
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Mc Guire <[email protected]>
commit 222bce5eb88d1af656419db04bcd84b2419fb900 upstream.
Both calls to of_find_node_by_name() and of_get_next_child() return a
node pointer with refcount incremented thus it must be explicidly decremented here after the last usage. As we are assured to have a refcounted np either from the initial of_find_node_by_name(NULL, name); or from the of_get_next_child(gpio, np) in the while loop if we reached the error code path below, an x of_node_put(np) is needed.
--- sound/aoa/core/gpio-feature.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/aoa/core/gpio-feature.c +3 -1
@@ -88,8 +88,10 @@ static struct device_node *get_gpio(char } reg =of_get_property (np,"reg" ,NULL ); -if (!reg) +if (!reg) { +of_node_put (np);return NULL ; + } *gpioptr = *reg;
PATCH 18/328 alarmtimer: Prevent overflow for relative nanosleep
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 5f936e19cc0ef97dbe3a56e9498922ad5ba1edef upstream.
Air Icy reported:
UBSAN: Undefined behaviour in kernel/time/alarmtimer.c:811:7 signed integer overflow: 1529859276030040771 + 9223372036854775807 cannot be represented in type 'long long int' Call Trace: alarm_timer_nsleep+0x44c/0x510 kernel/time/alarmtimer.c:811 __do_sys_clock_nanosleep kernel/time/posix-timers.c:1235 [inline] __se_sys_clock_nanosleep kernel/time/posix-timers.c:1213 [inline] __x64_sys_clock_nanosleep+0x326/0x4e0 kernel/time/posix-timers.c:1213 do_syscall_64+0xb8/0x3a0 arch/x86/entry/common.c:290
alarm_timer_nsleep() uses ktime_add() to add the current time and the relative expiry value. ktime_add() has no sanity checks so the addition can overflow when the relative timeout is large enough.
Use ktime_add_safe() which has the necessary sanity checks in place and limits the result to the valid range.
--- kernel/time/alarmtimer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/time/alarmtimer.c +2 -1
@@ -775,7 +775,8 @@ static int alarm_timer_nsleep(const cloc/* Convert (if necessary) to absolute time */ if (flags !=TIMER_ABSTIME ) {ktime_t now = alarm_bases[type].gettime (); - exp =ktime_add (now, exp); + + exp =ktime_add_safe (now, exp); }if (alarmtimer_do_nsleep (&alarm, exp))
cover 3.16.62-rc1 review
This is the start of the stable review cycle for the 3.16.62 release. There are 328 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 Fri Dec 14 18:00:00 UTC 2018. Anything received after that time might be too late.
All the patches have also been committed to the linux-3.16.y-rc branch of
https://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-stable-rc.git . A shortlog and diffstat can be found below.
Ben.
-------------
Aaron Knister (1):
IB/ipoib: Avoid a race condition between start_xmit and cm_rep_handler
[816e846c2eb9129a3e0afa5f920c8bbc71efecaa]
Aaron Ma (1):
Input: elantech - enable middle button of touchpad on ThinkPad P72
[91a97507323e1ad4bfc10f4a5922e67cdaf8b3cd]
Akihiro Tsukada (1):
media: dvb-usb-v2/gl861: ensure USB message buffers DMA'able
[86f65c218123c4e36fd855fbbc38147ffaf29974]
Al Viro (1):
cachefiles: fix the race between cachefiles_bury_object() and rmdir(2)
[169b803397499be85bdd1e3d07d6f5e3d4bd669e]
Alan Stern (6):
USB: fix error handling in usb_driver_claim_interface()
[bd729f9d67aa9a303d8925bb8c4f06af25f407d1]
USB: fix the usbfs flag sanitization for control transfers
[665c365a77fbfeabe52694aedf3446d5f2f1ce42]
USB: handle NULL config in usb_find_alt_setting()
[c9a4cb204e9eb7fa7dfbe3f7d3a674fa530aa193]
USB: leave LPM alone if possible when binding/unbinding interface drivers
[6fb650d43da3e7054984dc548eaa88765a94d49f]
USB: net2280: Fix erroneous synchronization change
[dec3c23c9aa1815f07d98ae0375b4cbc10971e13]
USB: remove LPM management from usb_driver_claim_interface()
[c183813fcee44a249339b7c46e1ad271ca1870aa]
Alexander Aring (4):
mac802154: tx: cleanup crc calculation
[b7eec52bcb7ab93a8cce0f718f42fa17d6d91745]
mac802154: tx: use put_unaligned_le16 for copy crc
[061ef8f915988839b12460c47ebfcf3700e124f0]
net: 6lowpan: fix reserved space for single frames
[ac74f87c789af40936a80131c4759f3e72579c3a]
net: mac802154: tx: expand tailroom if necessary
[f9c52831133050c6b82aa8b6831c92da2bbf2a0b]
Anand Jain (1):
btrfs: rename total_bytes to avoid confusion
[3c1dbdf54a31f4f049a33214c3096595988786bf]
Andi Kleen (2):
x86/spectre: Add missing family 6 check to microcode check
[1ab534e85c93945f7862378d8c8adcf408205b19]
x86/speculation/l1tf: Increase l1tf memory limit for Nehalem+
[cc51e5428ea54f575d49cfcede1d4cb3a72b4ec4]
Andrei Otcheretianski (1):
cfg80211: reg: Init wiphy_idx in regulatory_hint_core()
[24f33e64fcd0d50a4b1a8e5b41bd0257aa66b0e8]
Andrey Ryabinin (1):
fuse: Don't access pipe->buffers without pipe_lock()
[a2477b0e67c52f4364a47c3ad70902bc2a61bd4c]Andy Lutomirski (1):
x86/vdso: Fix asm constraints on vDSO syscall fallbacks
[715bd9d12f84d8f5cc8ad21d888f9bc304a8eb0b]
Anssi Hannula (1):
net: macb: do not disable MDIO bus at open/close time
[0da70f808029476001109b6cb076737bc04cea2e]
Arunk Khandavalli (1):
cfg80211: nl80211_update_ft_ies() to validate NL80211_ATTR_IE
[4f0223bfe9c3e62d8f45a85f1ef1b18a8a263ef9]Ashish Samant (1):
ocfs2: fix locking for res->tracking and dlm->tracking_list
[cbe355f57c8074bc4f452e5b6e35509044c6fa23]Ashok Raj (1):
x86/microcode/intel: Check microcode revision before updating sibling threads
[c182d2b7d0ca48e0d6ff16f7d883161238c447ed]
Aurelien Aptel (1):
smb2: fix missing files in root share directory listing
[0595751f267994c3c7027377058e4185b3a28e75]
Bart Van Assche (4):
IB/srpt: Support HCAs with more than two ports
[e620ebfc228dcbef7519e3d16f43c6c6f1a1d0cb]
scsi: core: Avoid that SCSI device removal through sysfs triggers a deadlock
[0ee223b2e1f67cb2de9c0e3247c510d846e74d63]
scsi: sysfs: Introduce sysfs_{un,}break_active_protection()
[2afc9166f79b8f6da5f347f48515215ceee4ae37]
scsi: target/iscsi: Make iscsit_ta_authentication() respect the output buffer size
[35bea5c84fd13c643cce63f0b5cd4b148f8c901d]
Ben Hutchings (1):
USB: yurex: Fix buffer over-read in yurex_write()
[7e10f14ebface44a48275c8d6dc1caae3668d5a9]
Benjamin Herrenschmidt (1):
powerpc/powernv/pci: Work around races in PCI bridge enabling
[db2173198b9513f7add8009f225afa1f1c79bcc6]
Bhaktipriya Shridhar (1):
bcache: Remove deprecated create_workqueue
[81baf90af2dcc8259e99e2f236024524b55313fc]
Bin Yang (1):
pstore: Fix incorrect persistent ram buffer mapping
[831b624df1b420c8f9281ed1307a8db23afb72df]
Boris Ostrovsky (1):
x86/EISA: Don't probe EISA bus for Xen PV guests
[6a92b11169a65b3f8cc512c75a252cbd0d096ba0]
Borislav Petkov (1):
x86/microcode/intel: Add a helper which gives the microcode revision
[4167709bbf826512a52ebd6aafda2be104adaec9]
Catalin Marinas (1):
cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE
[9bd616e3dbedfc103f158197c8ad93678849b1ed]
Chirantan Ekbote (1):
9p/net: Fix zero-copy path in the 9p virtio transport
[d28c756caee6e414d9ba367d0b92da24145af2a8]
Christian Brauner (1):
getxattr: use correct xattr length
[82c9a927bc5df6e06b72d206d24a9d10cced4eb5]
Christophe JAILLET (1):
serial: pxa: Fix an error handling path in 'serial_pxa_probe()'
[95a0e656580fab3128c7bee5f660c50784f53651]
Christophe Leroy (1):
serial: cpm_uart: return immediately from console poll
[be28c1e3ca29887e207f0cbcd294cefe5074bab6]
Claudio Imbrenda (1):
s390/kvm: fix deadlock when killed by oom
[306d6c49ac9ded11114cb53b0925da52f2c2ada1]
Colin Ian King (2):
leds: max8997: use mode when calling max8997_led_set_mode
[7a5de56db902ea632a0ff0c2b47481d278db645f]
staging: rts5208: fix missing error check on call to rtsx_write_register
[c5fae4f4fd28189b1062fb8ef7b21fec37cb8b17]
Corey Minyard (1):
ipmi: Move BT capabilities detection to the detect call
[c86ba91be75702c013bbf7379542920b6920e98f]
Dan Carpenter (16):
CIFS: fix wrapping bugs in num_entries()
[56446f218af1133c802dad8e9e116f07f381846c]
cifs: integer overflow in in SMB2_ioctl()
[2d204ee9d671327915260071c19350d84344e096]
cifs: prevent integer overflow in nxt_dir_entry()
[8ad8aa353524d89fa2e09522f3078166ff78ec42]
drm/panel: type promotion bug in s6e8aa0_read_mtp_id()
[cd0e0ca69109d025b1a1b6609f70682db62138b0]
fbdev: omapfb: off by one in omapfb_register_client()
[5ec1ec35b2979b59d0b33381e7c9aac17e159d16]
hwmon: (nct6775) Set weight source to zero correctly
[e3f3d7ab00cd459d0f7a839758a4542f4d4b8ac8]
mei: bus: type promotion bug in mei_nfc_if_version()
[b40b3e9358fbafff6a4ba0f4b9658f6617146f9c]
net: sched: act_ipt: check for underflow in __tcf_ipt_init()
[aeadd93f2b0a609f603ac33e574b97a9832d1b90]
pinctrl: freescale: off by one in imx1_pinconf_group_dbg_show()
[19da44cd33a3a6ff7c97fff0189999ff15b241e4]
pinctrl: imx: off by one in imx_pinconf_group_dbg_show()
[b4859f3edb47825f62d1b2efdd75fe7945996f49]
powerpc: Fix size calculation using resource_size()
[c42d3be0c06f0c1c416054022aa535c08a1f9b39]
rndis_wlan: potential buffer overflow in rndis_wlan_auth_indication()
[ae636fb1554833ee5133ca47bf4b2791b6739c52]
scsi: aic94xx: fix an error code in aic94xx_init()
[0756c57bce3d26da2592d834d8910b6887021701]
uio: potential double frees if __uio_register_device() fails
[f019f07ecf6a6b8bd6d7853bce70925d90af02d1]
vmci: type promotion bug in qp_host_get_user_memory()
[7fb2fd4e25fc1fb10dcb30b5519de257cfeae84c]
x86/paravirt: Fix some warning messages
[571d0563c8881595f4ab027aef9ed1c55e3e7b7c]
Daniel Black (1):
mm: madvise(MADV_DODUMP): allow hugetlbfs pages
[d41aa5252394c065d1f04d1ceea885b70d00c9c6]
Daniel Borkmann (2):
bpf, net: add skb_mac_header_len helper
[0daf4349406074fc03e4889ba5e97e6fb5311bab]
crypto: memzero_explicit - make sure to clear out sensitive data
[7185ad2672a7d50bc384de0e38d90b75d99f3d82]
Daniel Drake (1):
PCI: Reprogram bridge prefetch registers on resume
[083874549fdfefa629dfa752785e20427dde1511]
Daniel Mack (2):
libertas: call into generic suspend code before turning off power
[4f666675cdff0b986195413215eb062b7da6586f]
libertas: fix suspend and resume for SDIO connected cards
[7444a8092906ed44c09459780c56ba57043e39b1]
Darrick J. Wong (1):
xfs: don't fail when converting shortform attr to long form during ATTR_REPLACE
[7b38460dc8e4eafba06c78f8e37099d3b34d473c]
Dave Chinner (1):
percpu_counter: batch size aware __percpu_counter_compare()
[80188b0d77d7426b494af739ac129e0e684acb84]
Dave Martin (1):
arm64: KVM: Tighten guest core register access from userspace
[d26c25a9d19b5976b319af528886f89cf455692d]
David Ahern (1):
net/ipv6: Fix index counter for unicast addresses in in6_dump_addrs
[4ba4c566ba8448a05e6257e0b98a21f1a0d55315]
Denis Drozdov (1):
IB/IPoIB: Set ah valid flag in multicast send flow
[75da96067ade4e7854379ec2f7834f3497652b1a]
Dexuan Cui (1):
Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect()
[41e270f6898e7502be9fd6920ee0a108ca259d36]
Douglas Anderson (1):
pinctrl: msm: Fix msm_config_group_get() to be compliant
[05e0c828955c1cab58dd71a04539442e5375d917]
Emil Lundmark (1):
drm: udl: Destroy framebuffer only if it was initialized
[fcb74da1eb8edd3a4ef9b9724f88ed709d684227]
Eric Biggers (5):
KEYS: encrypted: fix buffer overread in valid_master_desc()
[794b4bc292f5d31739d89c0202c54e7dc9bc3add]
crypto: ablkcipher - fix crash flushing dcache in error path
[318abdfbe708aaaa652c79fb500e9bd60521f9dc]
crypto: blkcipher - fix crash flushing dcache in error path
[0868def3e4100591e7a1fdbf3eed1439cc8f7ca3]
crypto: vmac - require a block cipher with 128-bit block size
[73bf20ef3df262026c3470241ae4ac8196943ffa]
crypto: vmac - separate tfm and request context
[bb29648102335586e9a66289a1d98a0cb392b6e5]
Eric Dumazet (3):
ipv6: fix possible use-after-free in ip6_xmit()
[bbd6528d28c1b8e80832b3b018ec402b6f5c3215]
net: make skb_partial_csum_set() more robust against overflows
[52b5d6f5dcf0e5201392f7d417148ccb537dbf6f]
rtnl: limit IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES to 4096
[0e1d6eca5113858ed2caea61a5adc03c595f6096]
Eric W. Biederman (1):
ipv6: Compute net once in raw6_send_hdrinc
[adb28c9d3371c845c7a28bfd4fb163aca0d0dc37]
Ethan Lien (1):
btrfs: use correct compare function of dirty_metadata_bytes
[d814a49198eafa6163698bdd93961302f3a877a4]
Eugeniy Paltsev (1):
drm: fb-helper: Reject all pixel format changing requests
[db05c481977599236f12a85e55de9f5ab37b0a2c]
Evgenii Lepikhin (1):
ISCSI: fix minor memory leak
[a928d28d4487402e6bd18bea1b8cc2b2ec6e6d8f]
Felipe Balbi (1):
usb: gadget: udc: net2280: do not rely on 'driver' argument
[bfd0ed576dbf9cc71af7dbe42841fc9246524961]
Felix Fietkau (1):
mac80211: fix setting IEEE80211_KEY_FLAG_RX_MGMT for AP mode keys
[211710ca74adf790b46ab3867fcce8047b573cd1]
Filippo Sironi (1):
x86/microcode: Update the new microcode revision unconditionally
[8da38ebaad23fe1b0c4a205438676f6356607cfc]
Florian Fainelli (6):
asix: Check for supported Wake-on-LAN modes
[c4ce446e33d7a0e978256ac6fea4c80e59d9de5f]
ax88179_178a: Check for supported Wake-on-LAN modes
[5ba6b4aa9a410c5e2c6417df52b5e2118ea9b467]
r8152: Check for supported Wake-on-LAN Modes
[f2750df1548bd8a2b060eb609fc43ca82811af4c]
smsc75xx: Check for Wake-on-LAN modes
[9c734b2769a73eea2e9e9767c0e0bf839ff23679]
smsc95xx: Check for Wake-on-LAN modes
[c530c471ba37bdd9fe1c7185b01455c00ae606fb]
sr9800: Check for supported Wake-on-LAN modes
[c5cb93e994ffb43b7b3b1ff10b9f928f54574a36]
Florian Schmaus (1):
bcache: do not assign in if condition in bcache_init()
[16c1fdf4cfd6c0091e59b93ec2cb7e99973f8244]
Florian Westphal (1):
netfilter: nf_tables: fix register ordering
[d209df3e7f7002d9099fdb0f6df0f972b4386a63]
Geert Uytterhoeven (5):
spi: rspi: Fix interrupted DMA transfers
[8dbbaa47b96f6ea5f09f922b4effff3c505cd8cf]
spi: rspi: Fix invalid SPI use during system suspend
[c1ca59c22c56930b377a665fdd1b43351887830b]
spi: rspi: Fix leaking of unused DMA descriptors
[3819bc8752367eae0d72fa1c473dc88ea45631a7]
spi: rspi: Handle dmaengine_prep_slave_sg() failures gracefully
[85912a88c1ebcad04a5cfec971771195ce8d6691]
spi: sh-msiof: Add more register documentation
[2e2b36872d7b45b1f88a590283b14c67931b777f]
Greg Edwards (2):
block: move bio_integrity_{intervals,bytes} into blkdev.h
[359f642700f2ff05d9c94cd9216c97af7b8e9553]
scsi: virtio_scsi: fix pi_bytes{out,in} on 4 KiB block size devices
[cdcdcaae8450a975e7d07e1bfec21f9b8c016d0c]
Greg Hackmann (1):
arm64: mm: check for upper PAGE_SHIFT bits in pfn_valid()
[5ad356eabc47d26a92140a0c4b20eba471c10de3]
Guenter Roeck (3):
hwmon: (nct6775) Fix access to fan pulse registers
[c793279c77035053e67937f5743c6ebfc303e7c5]
mfd: sm501: Set coherent_dma_mask when creating subdevices
[2f606da78230f09cf1a71fde6ee91d0c710fa2b2]
of: unittest: Disable interrupt node tests for old world MAC systems
[8894891446c9380709451b99ab45c5c53adfd2fc]
Guillaume Nault (1):
pppoe: fix reception of frames with no mac header
[8540827ebac6b654ab2f69c8fbce9e4fbd6304a0]
Guoju Fang (1):
bcache: add separate workqueue for journal_write to avoid deadlock
[0f843e65d9eef4936929bb036c5f771fb261eea4]
Gustavo A. R. Silva (9):
ASoC: wm8994: Fix missing break in switch
[ad0eaee6195db1db1749dd46b9e6f4466793d178]
ASoC: wm8994: Mark expected switch fall-through
[2cea1542859bc812f1ec51ea71c06e927e5b922e]
IB/ucm: Fix Spectre v1 vulnerability
[0295e39595e1146522f2722715dba7f7fba42217]
RDMA/ucma: Fix Spectre v1 vulnerability
[a3671a4f973ee9d9621d60166cc3b037c397d604]
hwmon: (nct6775) Fix potential Spectre v1
[d49dbfade96d5b0863ca8a90122a805edd5ef50a]
misc: hmc6352: fix potential Spectre v1
[de916736aaaadddbd6061472969f667b14204aa9]
ptp: fix Spectre v1 vulnerability
[efa61c8cf2950ab5c0e66cff3cabe2a2b24e81ba]
tty: vt_ioctl: fix potential Spectre v1
[e97267cb4d1ee01ca0929638ec0fcbb0904f903d]
usb: gadget: storage: Fix Spectre v1 vulnerability
[9ae24af3669111d418242caec8dd4ebd9ba26860]
H. Nikolaus Schaller (2):
power: generic-adc-battery: check for duplicate properties copied from iio channels
[a427503edaaed9b75ed9746a654cece7e93e60a8]
power: generic-adc-battery: fix out-of-bounds write when copying channel properties
[932d47448c3caa0fa99e84d7f5bc302aa286efd8]
Haishuang Yan (1):
vxlan: fix a potential issue when create a new vxlan fdb entry.
[17b463654f41f0aa334efd5a6efeab8a6e9496f7]
Han Xu (1):
mtd: fsl-quadspi: fix macro collision problems with READ/WRITE
[04850c4d8613127a9b488321c0ad83bff7519311]
Hangbin Liu (2):
igmp: fix incorrect unsolicit report count after link down and up
[ff06525fcb8ae3c302ac1319bf6c07c026dea964]
igmp: fix incorrect unsolicit report count when join group
[4fb7253e4f9a8f06a986a3b317e2f79d9b43d552]
Hari Bathini (1):
powerpc/fadump: handle crash memory ranges array index overflow
[1bd6a1c4b80a28d975287630644e6b47d0f977a5]
Heiner Kallweit (1):
r8169: fix NAPI handling under high load
[6b839b6cf9eada30b086effb51e5d6076bafc761]
Hiromitsu Yamasaki (1):
spi: sh-msiof: Fix handling of write value for SISTR register
[31a5fae4c5a009898da6d177901d5328051641ff]
Huacai Chen (1):
MIPS: Change definition of cpu_relax() for Loongson-3
[a30718868915fbb991a9ae9e45594b059f28e9ae]
Ido Schimmel (1):
team: Forbid enslaving team device to itself
[471b83bd8bbe4e89743683ef8ecb78f7029d8288]
Imre Deak (1):
drm/i915/bdw: Increase IPS disable timeout to 100ms
[acb3ef0ee40ea657280a4a11d9f60eb2937c0dca]
Jani Nikula (1):
drm/i915: set DP Main Stream Attribute for color range on DDI platforms
[dc5977da99ea28094b8fa4e9bacbd29bedc41de5]
Jann Horn (6):
RDMA/ucma: check fd type in ucma_migrate_id()
[0d23ba6034b9cf48b8918404367506da3e4b3ee5]
mm/vmstat.c: skip NR_TLB_REMOTE_FLUSH* properly
[58bc4c34d249bf1bc50730a9a209139347cfacfe]
mtdchar: fix overflows in adjustment of count
[6c6bc9ea84d0008024606bf5ba10519e20d851bf]
proc: restrict kernel stack dumps to root
[f8a00cef17206ecd1b30d3d9f99e10d9fa707aa7]
reiserfs: fix broken xattr handling (heap corruption, bad retval)
[a13f085d111e90469faf2d9965eb39b11c114d7e]
x86/process: Don't mix user/kernel regs in 64bit __show_regs()
[9fe6299dde587788f245e9f7a5a1b296fad4e8c7]
Javier Martinez Canillas (1):
media: omap3isp: zero-initialize the isp cam_xclk{a,b} initial data
[2ec7debd44b49927a6e2861521994cc075a389ed]
Jean Delvare (1):
ACPI / bus: Only call dmi_check_system() on X86
[5d128fbd8b20f8a48cb13c3eced789d1f9573ecd]
Jens Axboe (2):
bcache: don't embed 'return' statements in closure macros
[77b5a08427e87514c33730afc18cd02c9475e2c3]
nbd: don't allow invalid blocksize settings
[bc811f05d77f47059c197a98b6ad242eb03999cb]
Jeremy Cline (2):
ext4: fix spectre gadget in ext4_mb_regular_allocator()
[1a5d5e5d51e75a5bca67dadbcea8c841934b7b85]
fs/quota: Fix spectre gadget in do_quotactl
[7b6924d94a60c6b8c1279ca003e8744e6cd9e8b1]
Jia-Ju Bai (2):
usb: host: u132-hcd: Fix a sleep-in-atomic-context bug in u132_get_frame()
[6d4f268fa132742fe96dad22307c68d237356d88]
usb: misc: uss720: Fix two sleep-in-atomic-context bugs
[bc8acc214d3f1cafebcbcd101a695bbac716595d]
Jiangyiwen (1):
9p/virtio: fix off-by-one error in sg list bounds check
[23cba9cbde0bba05d772b335fe5f66aa82b9ad19]
Jiri Olsa (2):
perf/core: Protect PMU device removal with a 'pmu_bus_running' check, to fix CONFIG_DEBUG_TEST_DRIVER_REMOVE=y kernel panic
[0933840acf7b65d6d30a5b6089d882afea57aca3]
perf/ring_buffer: Prevent concurent ring buffer access
[cd6fb677ce7e460c25bdd66f689734102ec7d642]
Joel Fernandes (1):
mm: shmem.c: Correctly annotate new inodes for lockdep
[b45d71fb89ab8adfe727b9d0ee188ed58582a647]
Johan Hovold (8):
EDAC, i7core: Fix memleaks and use-after-free on probe and remove
[6c974d4dfafe5e9ee754f2a6fba0eb1864f1649e]
EDAC: Fix memleak in module init error path
[4708aa85d50cc6e962dfa8acf5ad4e0d290a21db]
USB: serial: io_ti: fix array underflow in completion handler
[691a03cfe8ca483f9c48153b869d354e4ae3abef]
USB: serial: kobil_sct: fix modem-status error handling
[a420b5d939ee58f1d950f0ea782834056520aeaa]
USB: serial: simple: add Motorola Tetra MTP6550 id
[f5fad711c06e652f90f581fc7c2caee327c33d31]
USB: serial: ti_usb_3410_5052: fix array underflow in completion handler
[5dfdd24eb3d39d815bc952ae98128e967c9bba49]
tty: fix termios input-speed encoding
[fada18c48d774b9e837928ecdce6a5d5fdd11ee7]
tty: fix termios input-speed encoding when using BOTHER
[1cee38f0363a88db374e50b232ca17b9a4c12fa0]
John Johansen (1):
apparmor: remove no-op permission check in policy_unpack
[c037bd615885f1d9d3bdb48531bace79fae1505d]
John Ogness (1):
USB: serial: sierra: fix potential deadlock at close
[e60870012e5a35b1506d7b376fddfb30e9da0b27]
Jon Hunter (1):
ARM: tegra: Fix Tegra30 Cardhu PCA954x reset
[6e1811900b6fe6f2b4665dba6bd6ed32c6b98575]
Josef Bacik (1):
Btrfs: fix btrfs_write_inode vs delayed iput deadlock
[3c4276936f6fbe52884b4ea4e6cc120b890a0f9f]
Julian Wiedmann (1):
s390/qdio: reset old sbal_state flags
[64e03ff72623b8c2ea89ca3cb660094e019ed4ae]
Junxiao Bi (1):
ocfs2: fix ocfs2 read block panic
[234b69e3e089d850a98e7b3145bd00e9b52b1111]
K. Y. Srinivasan (1):
Tools: hv: Fix a bug in the key delete code
[86503bd35dec0ce363e9fdbf5299927422ed3899]
Kees Cook (1):
pstore/ram: Fix failure-path memory leak in ramoops_init
[bac6f6cda206ad7cbe0c73c35e494377ce9c4749]
Kirill Tkhai (1):
fuse: Add missed unlock_page() to fuse_readpages_fill()
[109728ccc5933151c68d1106e4065478a487a323]
Ladislav Michl (2):
video: udlfb: Fix unaligned access
[115e77597efcc94cb1f6cbb7df5cf7ce8feb8632]
video: udlfb: Remove noisy warnings
[de4b74bda8e87a4ed45ebc2c26cc3e2eaae38429]
Lars-Peter Clausen (2):
iio: ad9523: Fix displayed phase
[5a4e33c1c53ae7d4425f7d94e60e4458a37b349e]
iio: ad9523: Fix return value for ad952x_store()
[9a5094ca29ea9b1da301b31fd377c0c0c4c23034]
Leonard Crestez (1):
crypto: mxs-dcp - Fix wait logic on chan threads
[d80771c08363ad7fbf0f56f5301e7ca65065c582]
Li Dongyang (1):
ext4: don't mark mmp buffer head dirty
[fe18d649891d813964d3aaeebad873f281627fbc]
Liang Chen (1):
bcache: explicitly destroy mutex while exiting
[330a4db89d39a6b43f36da16824eaa7a7509d34d]
Linus Torvalds (2):
Make file credentials available to the seqfile interfaces
[34dbbcdbf63360661ff7bda6c5f52f99ac515f92]
mremap: properly flush TLB before releasing the page
[eb66ae030829605d61fbef1909ce310e29f78821]
Lior David (1):
wil6210: missing length check in wmi_set_ie
[b5a8ffcae4103a9d823ea3aa3a761f65779fbe2a]
Lukas Wunner (3):
PCI: hotplug: Don't leak pci_slot on registration failure
[4ce6435820d1f1cc2c2788e232735eb244bcc8a3]
PCI: pciehp: Fix unprotected list iteration in IRQ handler
[1204e35bedf4e5015cda559ed8c84789a6dae24e]
PCI: pciehp: Fix use-after-free on unplug
[281e878eab191cce4259abbbf1a0322e3adae02c]
Lyude Paul (1):
drm/nouveau/drm/nouveau: Use pm_runtime_get_noresume() in connector_detect()
[6833fb1ec120bf078e1a527c573a09d4de286224]
Maciej W. Rozycki (3):
MIPS: Correct the 64-bit DSP accumulator register size
[f5958b4cf4fc38ed4583ab83fb7c4cd1ab05f47b]
MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression
[148b9aba99e0bbadf361747d21456e1589015f74]
binfmt_elf: Respect error return from `regset->active'
[2f819db565e82e5f73cd42b39925098986693378]Mahesh Salgaonkar (2):
powerpc/pseries: Avoid using the size greater than RTAS_ERROR_LOG_MAX.
[74e96bf44f430cf7a01de19ba6cf49b361cdfd6e]
powerpc/pseries: Fix endianness while restoring of r3 in MCE handler.
[cd813e1cd7122f2c261dce5b54d1e0c97f80e1a5]
Marcel Ziswiler (1):
spi: tegra20-slink: explicitly enable/disable clock
[7001cab1dabc0b72b2b672ef58a90ab64f5e2343]
Mario Limonciello (1):
platform/x86: alienware-wmi: Correct a memory leak
[ff0e9f26288d2daee4950f42b37a3d3d30d36ec1]
Martin Kaiser (1):
mtd: rawnand: mxc: remove __init qualifier from mxcnd_probe_dt
[24f0ae995deb728076e3ea93fea1949a9775debf]
Masami Hiramatsu (1):
kprobes: Make list and blacklist root user read only
[f2a3ab36077222437b4826fc76111caa14562b7c]
Mathias Nyman (3):
usb: Avoid use-after-free by flushing endpoints early in usb_set_interface()
[f9a5b4f58b280c1d26255376713c132f93837621]
usb: Don't die twice if PCI xhci host is not responding in resume
[f3dc41c5d22b2ca14a0802a65d8cdc33a3882d4e]
xhci: Add missing CAS workaround for Intel Sunrise Point xHCI
[ffe84e01bb1b38c7eb9c6b6da127a6c136d251df]
Mathieu OTHACEHE (1):
USB: serial: ti_usb_3410_5052: use functions rather than macros
[d8d841e8332779fae2b18420d39ef407ea3729da]
Matthias Brugger (1):
tty: fix typo in comment of tty_termios_encode_baud_rate
[a1d51aa2214cea3f91611893610a2f769cada0e7]
Mauricio Faria de Oliveira (2):
partitions/aix: append null character to print data from disk
[d43fdae7bac2def8c4314b5a49822cb7f08a45f1]
partitions/aix: fix usage of uninitialized lv_info and lvname structures
[14cb2c8a6c5dae57ee3e2da10fa3db2b9087e39e]
Mauro Carvalho Chehab (1):
media: rtl28xxu: be sure that it won't go past the array size
[845b978a871bff3707eee611b32e4be0b9a94dd2]
Max Filippov (2):
xtensa: increase ranges in ___invalidate_{i,d}cache_all
[fec3259c9f747c039f90e99570540114c8d81a14]
xtensa: limit offsets in __loop_cache_{all,page}
[be75de25251f7cf3e399ca1f584716a95510d24a]Maxence Duprès (1):
USB: add quirk for WORLDE Controller KS49 or Prodipe MIDI 49C USB controller
[9b83a1c301ad6d24988a128c69b42cbaaf537d82]
Mian Yousaf Kaukab (1):
usb: gadget: net2280: fix pullup handling
[11bece5e063ca567e631c6ea3b1611c10dbc3282]
Michael Bringmann (1):
powerpc/pseries: Fix unitialized timer reset on migration
[8604895a34d92f5e186ceb931b0d1b384030ea3d]
Michael Büsch (2):
b43/leds: Ensure NUL-termination of LED name string
[2aa650d1950fce94f696ebd7db30b8830c2c946f]
b43legacy/leds: Ensure NUL-termination of LED name string
[4d77a89e3924b12f4a5628b21237e57ab4703866]
Mika Båtsman (1):
media: gl861: fix probe of dvb_usb_gl861
[48db0089bff6f9154f6bd98ce7a6ae3786fa8ebe]
Mike Christie (1):
iscsi target: fix session creation failure handling
[26abc916a898d34c5ad159315a2f683def3c5555]
Mike Snitzer (1):
dm cache metadata: save in-core policy_hint_size to on-disk superblock
[fd2fa95416188a767a63979296fa3e169a9ef5ec]
Miklos Szeredi (3):
fuse: Fix oops at process_init_reply()
[e8f3bd773d22f488724dffb886a1618da85c2966]
fuse: don't wake up reserved req in fuse_conn_kill()
[0c4dd4ba1426c599072511dcf95a15ee5e12725b]
fuse: flush requests on umount
[580640ba5d331eb5631a5de46941c98f5ed90886]
Mikulas Patocka (13):
dm: disable CRYPTO_TFM_REQ_MAY_SLEEP to fix a GFP_KERNEL recursion deadlock
[432061b3da64e488be3403124a72a9250bbe96d4]
fb: fix lost console when the user unplugs a USB adapter
[8c5b044299951acd91e830a688dd920477ea1eda]
mach64: detect the dot clock divider correctly on sparc
[76ebebd2464c5c8a4453c98b6dbf9c95a599e810]
udl-kms: change down_interruptible to down
[8456b99c16d193c4c3b7df305cf431e027f0189c]
udl-kms: fix crash due to uninitialized memory
[09a00abe3a9941c2715ca83eb88172cd2f54d8fd]
udl-kms: handle allocation failure
[542bb9788a1f485eb1a2229178f665d8ea166156]
udlfb: don't switch if we are switching to the same videomode
[564f1807379298dfdb12ed0d5b25fcb89c238527]
udlfb: fix display corruption of the last line
[4e705e17ce3409a1f492cfd5dadcf6a4f6075842]
udlfb: fix semaphore value leak
[9d0aa601e4cd9c0892f90d36e8488d79b72f4073]
udlfb: handle allocation failure
[080fb5240bdcabed7387b814139c3ea172d59fc5]
udlfb: make a local copy of fb_ops
[2c29cfc3eaf11779176bf41475cfca49bccba11c]
udlfb: set line_length in dlfb_ops_set_par
[0ac319b7af1bb24a33365d0ec82a2f56a59b2a78]
udlfb: set optimal write delay
[bb24153a3f13dd0dbc1f8055ad97fe346d598f66]
Nadav Amit (1):
x86/mm: Use WRITE_ONCE() when setting PTEs
[9bc4f28af75a91aea0ae383f50b0a430c4509303]
Nicholas Mc Guire (3):
ALSA: snd-aoa: add of_node_put() in error path
[222bce5eb88d1af656419db04bcd84b2419fb900]
ARM: hisi: handle of_iomap and fix missing of_node_put
[d396cb185c0337aae5664b250cdd9a73f6eb1503]
cifs: check kmalloc before use
[126c97f4d0d1b5b956e8b0740c81a2b2a2ae548c]
Nicholas Piggin (1):
mm: move tlb_table_flush to tlb_flush_mmu_free
[db7ddef301128dad394f1c0f77027f86ee9a4edb]
Oliver Neukum (3):
USB: usbdevfs: restore warning for nonsensical flags
[81e0403b26d94360abd1f6a57311337973bc82cd]
USB: usbdevfs: sanitize flags more
[7a68d9fb851012829c29e770621905529bd9490b]
usb: uas: add support for more quirk flags
[42d1c6d4a06a77b3ab206a919b9050c3080f3a71]
Olle Liljenzin (1):
platform/x86: ideapad-laptop: Add Y520-15IKBN to no_hw_rfkill
[5d9f40b56630a8702b5f7a61a770f9b73aa07464]
Ondrej Mosnáček (1):
audit: Fix extended comparison of GID/EGID
[af85d1772e31fed34165a1b3decef340cf4080c0]
Paolo Abeni (2):
ip6_tunnel: be careful when accessing the inner header
[76c0ddd8c3a683f6e2c6e60e11dc1a1558caf4bc]
ip_tunnel: be careful when accessing the inner header
[ccfec9e5cb2d48df5a955b7bf47f7782157d3bc2]
Parav Pandit (1):
RDMA/cma: Protect cma dev list with lock
[954a8e3aea87e896e320cf648c1a5bbe47de443e]
Paul Mackerras (1):
KVM: PPC: Book3S HV: Don't truncate HPTE index in xlate function
[46dec40fb741f00f1864580130779aeeaf24fb3d]
Pavel Tikhomirov (1):
mm: cleancache: fix corruption on missed inode invalidation
[6ff38bd40230af35e446239396e5fc8ebd6a5248]
Peter Zijlstra (3):
mm/tlb: Remove tlb_remove_table() non-concurrent condition
[a6f572084fbee8b30f91465f4a085d7a90901c57]
perf/core: Fix perf_pmu_unregister() locking
[a9f9772114c8b07ae75bcb3654bd017461248095]
x86/percpu: Fix this_cpu_read()
[b59167ac7bafd804c91e49ad53c6d33a7394d4c8]Piaojun (1):
fs/9p/xattr.c: catch the error of p9_client_clunk when setting xattr failed
[3111784bee81591ea2815011688d28b65df03627]
Prarit Bhargava (1):
x86/microcode: Make sure boot_cpu_data.microcode is up-to-date
[370a132bb2227ff76278f98370e0e701d86ff752]
Punit Agrawal (2):
KVM: arm/arm64: Skip updating PMD entry if no change
[86658b819cd0a9aa584cd84453ed268a6f013770]
KVM: arm/arm64: Skip updating PTE entry if no change
[976d34e2dab10ece5ea8fe7090b7692913f89084]
Rafael J. Wysocki (1):
PM / core: Clear the direct_complete flag on errors
[69e445ab8b66a9f30519842ef18be555d3ee9b51]
Rian Hunter (1):
x86/process: Re-export start_thread()
[dc76803e57cc86589c4efcb5362918f9b0c0436f]
Richard Weinberger (4):
ubifs: Check data node size before truncate
[95a22d2084d72ea067d8323cc85677dba5d97cae]
ubifs: Check for name being NULL while mounting
[37f31b6ca4311b94d985fb398a72e5399ad57925]
ubifs: Fix memory leak in lprobs self-check
[eef19816ada3abd56d9f20c88794cc2fea83ebb2]
ubifs: Fix synced_i_size calculation for xattr inodes
[59965593205fa4044850d35ee3557cf0b7edcd14]
Roopa Prabhu (2):
vxlan: add new fdb alloc and create helpers
[25e20e730d56471cffa25419bf2a66078bd55330]
vxlan: fix default fdb entry netlink notify ordering during netdev create
[0241b836732f5f43c3f0fd9e9073c1fb24ea6757]
Sabrina Dubroca (2):
ipv6: fix cleanup ordering for pingv6 registration
[a03dc36bdca6b614651fedfcd8559cf914d2d21d]
net: ipv4: update fnhe_pmtu when first hop's MTU changes
[af7d6cce53694a88d6a1bb60c9a239a6a5144459]
Sagi Grimberg (1):
iscsi-target: nullify session in failed login sequence
[a0b3b9b2409b409c677f7eb1e0485b816a5848f7]
Sebastian Ott (1):
s390/pci: fix out of bounds access during irq setup
[866f3576a72b2233a76dffb80290f8086dc49e17]
Shahed Shaikh (1):
qlcnic: fix Tx descriptor corruption on 82xx devices
[c333fa0c4f220f8f7ea5acd6b0ebf3bf13fd684d]
Shenghui Wang (1):
dm cache: destroy migration_cache if cache target registration failed
[c7cd55504a5b0fc826a2cd9540845979d24ae542]
Shuah Khan (1):
usb: usbip: Fix BUG: KASAN: slab-out-of-bounds in vhci_hub_control()
[81f7567c51ad97668d1c3a48e8ecc482e64d4161]
Shubhrajyoti Datta (1):
i2c: xiic: Make the start and the byte count write atomic
[ae7304c3ea28a3ba47a7a8312c76c654ef24967e]
Simon Vincent (1):
ieee802154: 6lowpan: ensure header compression does not corrupt ipv6 header
[f19f4f9525cf32f97341fac20ce66392e86a1b67]
Steffen Klassert (1):
xfrm: Validate address prefix lengths in the xfrm selector.
[07bf7908950a8b14e81aa1807e3c667eab39287a]
Steve French (4):
SMB3: Backup intent flag missing for directory opens with backupuid mounts
[5e19697b56a64004e2d0ff1bb952ea05493c088f]
cifs: add missing debug entries for kconfig options
[950132afd59385caf6e2b84e5235d069fa10681d]
smb3: check for and properly advertise directory lease support
[f801568332321e2b1e7a8bd26c3e4913a312a2ec]
smb3: fill in statfs fsid and correct namelen
[21ba3845b59c733a79ed4fe1c4f3732e7ece9df7]
Steve Wise (3):
RDMA/cxgb4: Only call CQ completion handler if it is armed
[678ea9b5baab6800692b249bdba77c3c07261d61]
iw_cxgb4: atomically flush the qp
[bc52e9ca74b9a395897bb640c6671b2cbf716032]
iw_cxgb4: only allow 1 flush on user qps
[308aa2b8f7b7db3332a7d41099fd37851fb793b2]
Steven Rostedt (3):
tracing/blktrace: Fix to allow setting same value
[757d9140072054528b13bbe291583d9823cde195]
tracing: Do not call start/stop() functions when tracing_on does not change
[f143641bfef9a4a60c57af30de26c63057e7e695]
uprobes: Use synchronize_rcu() not synchronize_sched()
[016f8ffc48cb01d1e7701649c728c5d2e737d295]
Sven Eckelmann (8):
ath10k: prevent active scans on potential unusable channels
[3f259111583801013cb605bb4414aa529adccf1c]
batman-adv: Place kref_get for softif_vlan near use
[df28ca6bb3282a4c8dc5b65f60b0136fc190ee52]
batman-adv: Prevent duplicated gateway_node entry
[dff9bc42ab0b2d38c5e90ddd79b238fed5b4c7ad]
batman-adv: Prevent duplicated global TT entry
[e7136e48ffdfb9f37b0820f619380485eb407361]
batman-adv: Prevent duplicated nc_node entry
[fa122fec8640eb7186ce5a41b83a4c1744ceef8f]
batman-adv: Prevent duplicated softif_vlan entry
[94cb82f594ed86be303398d6dfc7640a6f1d45d4]
batman-adv: Prevent duplicated tvlv handler
[ae3cdc97dc10c7a3b31f297dab429bfb774c9ccb]
batman-adv: Use kref_get for batadv_nc_get_nc_node
[0de32ceee156787429035c974316f4e5098cf722]
Sylwester Nawrocki (1):
media: exynos4-is: Prevent NULL pointer dereference in __isp_video_try_fmt()
[7c1b9a5aeed91bef98988ac0fcf38c8c1f4f9a3a]
Taehee Yoo (1):
netfilter: nft_set: fix allocation size overflow in privsize callback.
[4ef360dd6a65f6ef337645e1b65e744034754b19]
Takashi Iwai (9):
ALSA: cs5535audio: Fix invalid endian conversion
[69756930f2de0457d51db7d505a1e4f40e9fd116]
ALSA: memalloc: Don't exceed over the requested size
[dfef01e150824b0e6da750cacda8958188d29aea]
ALSA: seq: Fix poll() error return
[a49a71f6e25da2acc637fcd31e73debd96ca18f8]
ALSA: virmidi: Fix too long output trigger loop
[50e9ffb1996a5d11ff5040a266585bad4ceeca0a]
ALSA: vx222: Fix invalid endian conversions
[fff71a4c050ba46e305d910c837b99ba1728135e]
ALSA: vx: Fix possible transfer overflow
[874e1f6fad9a5184b67f4cee37c1335cd2cc5677]
ALSA: vxpocket: Fix invalid endian conversions
[3acd3e3bab95ec3622ff98da313290ee823a0f68]
EDAC: i7core: Return proper error codes for kzalloc() errors
[e97d7e38162dc305b4734a316ca758a2bbd1fa6e]
platform/x86: ideapad-laptop: Apply no_hw_rfkill to Y20-15IKBM, too
[58e73aa177850babb947555257fd4f79e5275cf1]
Takashi Sakamoto (1):
ALSA: bebob: use address returned by kmalloc() instead of kernel stack for streaming DMA mapping
[493626f2d87a74e6dbea1686499ed6e7e600484e]
Thadeu Lima de Souza Cascardo (1):
xfrm6: call kfree_skb when skb is toobig
[215ab0f021c9fea3c18b75e7d522400ee6a49990]
Theodore Ts'o (6):
ext4: avoid divide by zero fault when deleting corrupted inline directories
[4d982e25d0bdc83d8c64e66fdeca0b89240b3b85]
ext4: check for NUL characters in extended attribute's name
[7d95178c77014dbd8dce36ee40bbbc5e6c121ff5]
ext4: check to make sure the rename(2)'s destination is not freed
[b50282f3241acee880514212d88b6049fb5039c8]
ext4: fix online resize's handling of a too-small final block group
[f0a459dec5495a3580f8d784555e6f8f3bf7f263]
ext4: fix online resizing for bigalloc file systems with a 1k block size
[5f8c10936fab2b69a487400f2872902e597dd320]
ext4: prevent online resize with backup superblock
[011fa99404bea3f5d897c4983f6bd51170e3b18f]
Thomas Gleixner (3):
alarmtimer: Prevent overflow for relative nanosleep
[5f936e19cc0ef97dbe3a56e9498922ad5ba1edef]
posix-timers: Sanitize overrun handling
[78c9c4dfbf8c04883941445a195276bb4bb92c76]
x86/boot: Move EISA setup to a separate file
[f7eaf6e00fd581043bb540dfe865f1d81769b189]
Thomas Petazzoni (2):
ARM: 8799/1: mm: fix pci_ioremap_io() offset check
[3a58ac65e2d7969bcdf1b6acb70fa4d12a88e53e]
PCI: mvebu: Fix I/O space end address calculation
[dfd0309fd7b30a5baffaf47b2fccb88b46d64d69]Thomas Werschlein (1):
cifs: connect to servername instead of IP for IPC$ share
[395a2076b4064f97d3fce03af15210ff2a7bb7f9]
Tim Anderson (1):
USB: Add quirk to support DJI CineSSD
[f45681f9becaa65111ed0a691ccf080a0cd5feb8]
Tomas Bortoli (3):
9p: fix multiple NULL-pointer-dereferences
[10aa14527f458e9867cf3d2cc6b8cb0f6704448b]
net/9p/client.c: version pointer uninitialized
[7913690dcc5e18e235769fd87c34143072f5dbea]
net/9p/trans_fd.c: fix race-condition by flushing workqueue before the kfree()
[430ac66eb4c5b5c4eb846b78ebf65747510b30f1]
Tomi Valkeinen (1):
fbdev/omapfb: fix omapfb_memory_read infoleak
[1bafcbf59fed92af58955024452f45430d3898c5]
Tycho Andersen (1):
uart: fix race between uart_put_char() and uart_shutdown()
[a5ba1d95e46ecaea638ddd7cd144107c783acb5d]
Vaibhav Nagarnaik (1):
ring-buffer: Allow for rescheduling when removing pages
[83f365554e47997ec68dc4eca3f5dce525cd15c3]
Varka Bhadram (1):
mac802154: common tx error path
[f55889128a776b51581394b20abd0b470304cf95]
Vignesh R (2):
pwm: tiehrpwm: Don't use emulation mode bits to control PWM output
[aa49d628f6e016bcec8c6f8e704b9b18ee697329]
pwm: tiehrpwm: Fix disabling of output of PWMs
[38dabd91ff0bde33352ca3cc65ef515599b77a05]
Vineet Gupta (1):
ARC: clone syscall to setp r25 as thread pointer
[c58a584f05e35d1d4342923cd7aac07d9c3d3d16]
Vitaly Kuznetsov (2):
tools: hv: fcopy: set 'error' in case an unknown operation was requested
[c2d68afba86d1ff01e7300c68bc16a9234dcd8e9]
xen-netfront: fix queue name setting
[2d408c0d4574b01b9ed45e02516888bf925e11a9]
Wei Wang (2):
ipv6: take rcu lock in rawv6_send_hdrinc()
[a688caa34beb2fd2a92f1b6d33e40cde433ba160]
l2tp: use sk_dst_check() to avoid race on sk->sk_dst_cache
[6d37fa49da1e8db8fb1995be22ac837ca41ac8a8]Willy Tarreau (1):
ALSA: emu10k1: fix possible info leak to userspace on SNDRV_EMU10K1_IOCTL_INFO
[49434c6c575d2008c0abbc93e615019f39e01252]
Yelena Krivosheev (1):
net: mvneta: fix mtu change on port without link
[8466baf788ec3e18836bd9c91ba0b1a07af25878]
Young_X (1):
cdrom: fix improper type cast, which can leat to information leak.
[e4f3aa2e1e67bb48dfbaaf1cad59013d5a5bc276]
Yu Zhao (1):
regulator: fix crash caused by null driver data
[fb6de923ca3358a91525552b4907d4cb38730bdd]
YueHaibing (2):
pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state
[b5031b7db77dc47f474f0efc2b2552c32b7bb59d]
xfrm: fix 'passing zero to ERR_PTR()' warning
[934ffce1343f22ed5e2d0bd6da4440f4848074de]Makefile | 4 +- arch/arc/kernel/process.c | 20 + arch/arm/boot/dts/tegra30-cardhu.dtsi | 1 + arch/arm/kvm/mmu.c | 42 ++- arch/arm/mach-hisi/hotplug.c | 19 +- arch/arm/mm/ioremap.c | 2 +- arch/arm64/kvm/guest.c | 45 +++ arch/arm64/mm/init.c | 6 +- arch/mips/include/asm/processor.h | 15 +- arch/mips/kernel/ptrace.c | 2 +- arch/mips/kernel/ptrace32.c | 2 +- arch/mips/lib/memset.S | 4 +- arch/powerpc/include/asm/fadump.h | 3 - arch/powerpc/kernel/fadump.c | 92 ++++- arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 +- arch/powerpc/mm/numa.c | 4 +- arch/powerpc/platforms/powernv/pci-ioda.c | 37 ++ arch/powerpc/platforms/pseries/ras.c | 4 +- arch/powerpc/sysdev/mpic_msgr.c | 2 +- arch/s390/include/asm/qdio.h | 1 - arch/s390/mm/fault.c | 2 + arch/s390/pci/pci.c | 2 + arch/x86/include/asm/kdebug.h | 12 +- arch/x86/include/asm/microcode_intel.h | 15 + arch/x86/include/asm/percpu.h | 8 +- arch/x86/include/asm/pgtable_64.h | 16 +- arch/x86/include/asm/processor.h | 4 +- arch/x86/kernel/Makefile | 1 + arch/x86/kernel/cpu/bugs.c | 46 ++- arch/x86/kernel/cpu/common.c | 1 + arch/x86/kernel/cpu/intel.c | 14 +- arch/x86/kernel/cpu/microcode/amd.c | 22 +- arch/x86/kernel/cpu/microcode/intel.c | 31 +- arch/x86/kernel/cpu/microcode/intel_early.c | 33 +- arch/x86/kernel/dumpstack_32.c | 2 +- arch/x86/kernel/dumpstack_64.c | 2 +- arch/x86/kernel/paravirt.c | 4 +- arch/x86/kernel/process_32.c | 4 +- arch/x86/kernel/process_64.c | 11 +- arch/x86/kernel/traps.c | 13 - arch/x86/mm/kmemcheck/error.c | 2 +- arch/x86/mm/pgtable.c | 6 +- arch/x86/vdso/vclock_gettime.c | 18 +- arch/xtensa/include/asm/cacheasm.h | 69 ++-- block/bio-integrity.c | 26 -- block/partitions/aix.c | 13 +- crypto/ablkcipher.c | 57 ++- crypto/blkcipher.c | 54 ++- crypto/cts.c | 3 +- crypto/sha1_generic.c | 2 +- crypto/sha256_generic.c | 5 +- crypto/sha512_generic.c | 2 +- crypto/tgr192.c | 4 +- crypto/vmac.c | 412 +++++++++------------ crypto/wp512.c | 8 +- drivers/acpi/bus.c | 13 +- drivers/base/power/main.c | 5 +- drivers/block/nbd.c | 3 + drivers/cdrom/cdrom.c | 2 +- drivers/char/ipmi/ipmi_bt_sm.c | 92 ++--- drivers/crypto/mxs-dcp.c | 53 +-- drivers/edac/edac_mc_sysfs.c | 6 +- drivers/edac/i7core_edac.c | 24 +- drivers/gpu/drm/drm_fb_helper.c | 91 ++--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_ddi.c | 4 + drivers/gpu/drm/i915/intel_display.c | 8 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 20 +- drivers/gpu/drm/panel/panel-s6e8aa0.c | 2 +- drivers/gpu/drm/udl/udl_fb.c | 10 +- drivers/gpu/drm/udl/udl_main.c | 35 +- drivers/hv/connection.c | 8 +- drivers/hwmon/nct6775.c | 28 +- drivers/i2c/busses/i2c-xiic.c | 4 + drivers/iio/frequency/ad9523.c | 4 +- drivers/infiniband/core/cma.c | 12 +- drivers/infiniband/core/ucm.c | 3 + drivers/infiniband/core/ucma.c | 9 + drivers/infiniband/hw/cxgb4/ev.c | 1 + drivers/infiniband/hw/cxgb4/qp.c | 62 +++- drivers/infiniband/hw/cxgb4/t4.h | 11 + drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 + drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 1 + drivers/infiniband/ulp/srpt/ib_srpt.c | 6 +- drivers/infiniband/ulp/srpt/ib_srpt.h | 4 +- drivers/input/mouse/elantech.c | 2 + drivers/leds/leds-max8997.c | 2 +- drivers/md/bcache/bcache.h | 1 + drivers/md/bcache/closure.h | 3 - drivers/md/bcache/io.c | 1 + drivers/md/bcache/journal.c | 8 +- drivers/md/bcache/request.c | 14 +- drivers/md/bcache/super.c | 29 +- drivers/md/dm-cache-metadata.c | 3 +- drivers/md/dm-cache-target.c | 5 +- drivers/md/dm-crypt.c | 8 +- drivers/media/platform/exynos4-is/fimc-isp-video.c | 11 +- drivers/media/platform/omap3isp/isp.c | 2 +- drivers/media/usb/dvb-usb-v2/gl861.c | 17 +- drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 2 +- drivers/mfd/sm501.c | 1 + drivers/misc/hmc6352.c | 2 + drivers/misc/mei/nfc.c | 2 +- drivers/misc/vmw_vmci/vmci_queue_pair.c | 4 +- drivers/mtd/mtdchar.c | 10 +- drivers/mtd/nand/mxc_nand.c | 4 +- drivers/mtd/spi-nor/fsl-quadspi.c | 20 +- drivers/net/ethernet/cadence/macb.c | 10 +- drivers/net/ethernet/marvell/mvneta.c | 1 - drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 8 +- .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 3 +- .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | 3 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h | 3 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 12 +- drivers/net/ethernet/realtek/r8169.c | 8 +- drivers/net/ppp/pppoe.c | 3 + drivers/net/team/team.c | 5 + drivers/net/usb/asix_common.c | 3 + drivers/net/usb/ax88179_178a.c | 3 + drivers/net/usb/r8152.c | 3 + drivers/net/usb/smsc75xx.c | 3 + drivers/net/usb/smsc95xx.c | 3 + drivers/net/usb/sr9800.c | 3 + drivers/net/vxlan.c | 103 ++++-- drivers/net/wireless/ath/ath10k/mac.c | 7 + drivers/net/wireless/ath/wil6210/wmi.c | 7 +- drivers/net/wireless/b43/leds.c | 2 +- drivers/net/wireless/b43legacy/leds.c | 2 +- drivers/net/wireless/libertas/dev.h | 1 + drivers/net/wireless/libertas/if_sdio.c | 34 +- drivers/net/wireless/rndis_wlan.c | 2 + drivers/net/xen-netfront.c | 2 +- drivers/of/selftest.c | 28 +- drivers/pci/host/pci-mvebu.c | 2 +- drivers/pci/hotplug/pci_hotplug_core.c | 9 + drivers/pci/hotplug/pciehp.h | 1 + drivers/pci/hotplug/pciehp_core.c | 5 + drivers/pci/hotplug/pciehp_hpc.c | 18 +- drivers/pci/pci.c | 27 +- drivers/pinctrl/berlin/berlin.c | 13 +- drivers/pinctrl/pinctrl-imx.c | 2 +- drivers/pinctrl/pinctrl-imx1-core.c | 2 +- drivers/pinctrl/pinctrl-msm.c | 10 +- drivers/platform/x86/alienware-wmi.c | 1 + drivers/platform/x86/ideapad-laptop.c | 7 + drivers/power/generic-adc-battery.c | 25 +- drivers/ptp/ptp_chardev.c | 4 + drivers/pwm/pwm-tiehrpwm.c | 13 +- drivers/regulator/core.c | 3 +- drivers/s390/cio/qdio_main.c | 5 +- drivers/scsi/aic94xx/aic94xx_init.c | 4 +- drivers/scsi/scsi_sysfs.c | 20 +- drivers/scsi/virtio_scsi.c | 6 +- drivers/spi/spi-rspi.c | 140 +++++-- drivers/spi/spi-sh-msiof.c | 57 ++- drivers/spi/spi-tegra20-slink.c | 31 +- drivers/staging/rts5208/sd.c | 2 +- drivers/staging/usbip/vhci_hcd.c | 43 ++- drivers/target/iscsi/iscsi_target_login.c | 35 +- drivers/target/iscsi/iscsi_target_tpg.c | 3 +- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 10 +- drivers/tty/serial/pxa.c | 3 +- drivers/tty/serial/serial_core.c | 17 +- drivers/tty/tty_ioctl.c | 15 +- drivers/tty/vt/vt_ioctl.c | 4 + drivers/uio/uio.c | 3 +- drivers/usb/core/devio.c | 24 +- drivers/usb/core/driver.c | 50 +-- drivers/usb/core/hcd-pci.c | 2 - drivers/usb/core/message.c | 11 + drivers/usb/core/quirks.c | 7 + drivers/usb/core/usb.c | 2 + drivers/usb/gadget/f_mass_storage.c | 3 + drivers/usb/gadget/net2280.c | 36 +- drivers/usb/host/u132-hcd.c | 2 +- drivers/usb/host/xhci-pci.c | 2 + drivers/usb/misc/uss720.c | 4 +- drivers/usb/misc/yurex.c | 5 +- drivers/usb/serial/io_ti.h | 2 +- drivers/usb/serial/kobil_sct.c | 12 +- drivers/usb/serial/sierra.c | 4 +- drivers/usb/serial/ti_usb_3410_5052.c | 13 +- drivers/usb/serial/ti_usb_3410_5052.h | 2 - drivers/usb/serial/usb-serial-simple.c | 3 +- drivers/usb/storage/scsiglue.c | 9 + drivers/usb/storage/uas.c | 20 + drivers/usb/storage/unusual_devs.h | 7 + drivers/video/fbdev/aty/atyfb.h | 3 +- drivers/video/fbdev/aty/atyfb_base.c | 7 +- drivers/video/fbdev/aty/mach64_ct.c | 10 +- drivers/video/fbdev/core/fbmem.c | 38 +- drivers/video/fbdev/omap/omapfb_main.c | 2 +- drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c | 5 +- drivers/video/fbdev/udlfb.c | 140 ++++--- fs/9p/xattr.c | 6 +- fs/binfmt_elf.c | 2 +- fs/btrfs/disk-io.c | 10 +- fs/btrfs/inode.c | 25 -- fs/btrfs/super.c | 1 - fs/btrfs/volumes.c | 10 +- fs/cachefiles/namei.c | 2 +- fs/cifs/cifs_debug.c | 30 +- fs/cifs/cifsfs.c | 20 +- fs/cifs/connect.c | 9 +- fs/cifs/inode.c | 2 + fs/cifs/readdir.c | 11 +- fs/cifs/sess.c | 6 + fs/cifs/smb2ops.c | 23 +- fs/cifs/smb2pdu.c | 40 +- fs/cifs/smb2pdu.h | 11 + fs/ext4/dir.c | 20 +- fs/ext4/inline.c | 4 +- fs/ext4/mballoc.c | 4 +- fs/ext4/mmp.c | 1 - fs/ext4/namei.c | 6 + fs/ext4/resize.c | 45 ++- fs/ext4/xattr.c | 2 + fs/fuse/cuse.c | 2 +- fs/fuse/dev.c | 7 +- fs/fuse/file.c | 1 + fs/fuse/fuse_i.h | 2 - fs/fuse/inode.c | 37 +- fs/ocfs2/buffer_head_io.c | 1 + fs/ocfs2/dlm/dlmmaster.c | 4 +- fs/proc/base.c | 14 + fs/pstore/ram.c | 29 +- fs/pstore/ram_core.c | 17 +- fs/quota/quota.c | 5 +- fs/reiserfs/xattr.c | 6 +- fs/seq_file.c | 7 +- fs/sysfs/file.c | 44 +++ fs/ubifs/journal.c | 16 +- fs/ubifs/lprops.c | 8 +- fs/ubifs/super.c | 3 + fs/xattr.c | 2 +- fs/xfs/xfs_attr.c | 9 +- include/crypto/vmac.h | 63 ---- include/linux/blkdev.h | 38 ++ include/linux/cpuidle.h | 3 + include/linux/netdevice.h | 7 + include/linux/percpu_counter.h | 13 +- include/linux/posix-timers.h | 4 +- include/linux/seq_file.h | 13 +- include/linux/skbuff.h | 5 + include/linux/sysfs.h | 14 + include/linux/usb.h | 2 +- include/net/ip_fib.h | 1 + include/net/netfilter/nf_tables.h | 4 +- include/video/udlfb.h | 5 +- kernel/auditsc.c | 8 +- kernel/events/core.c | 15 +- kernel/kprobes.c | 4 +- kernel/posix-cpu-timers.c | 2 +- kernel/posix-timers.c | 31 +- kernel/sched/idle.c | 2 +- kernel/time/alarmtimer.c | 3 +- kernel/trace/blktrace.c | 4 + kernel/trace/ring_buffer.c | 2 + kernel/trace/trace.c | 4 +- kernel/trace/trace_uprobe.c | 2 +- lib/percpu_counter.c | 6 +- mm/huge_memory.c | 6 +- mm/madvise.c | 2 +- mm/memory.c | 15 +- mm/mremap.c | 21 +- mm/shmem.c | 2 + mm/truncate.c | 8 +- mm/vmstat.c | 3 + net/9p/client.c | 2 +- net/9p/trans_fd.c | 7 +- net/9p/trans_rdma.c | 3 + net/9p/trans_virtio.c | 13 +- net/batman-adv/gateway_client.c | 11 +- net/batman-adv/main.c | 8 +- net/batman-adv/network-coding.c | 34 +- net/batman-adv/soft-interface.c | 27 +- net/batman-adv/translation-table.c | 6 +- net/core/dev.c | 28 +- net/core/rtnetlink.c | 6 + net/core/skbuff.c | 12 +- net/ieee802154/6lowpan_rtnl.c | 140 +++++-- net/ipv4/fib_frontend.c | 4 + net/ipv4/fib_semantics.c | 50 +++ net/ipv4/igmp.c | 8 +- net/ipv4/ip_tunnel.c | 9 + net/ipv6/addrconf.c | 6 +- net/ipv6/af_inet6.c | 4 +- net/ipv6/ip6_output.c | 3 +- net/ipv6/ip6_tunnel.c | 13 +- net/ipv6/raw.c | 34 +- net/ipv6/xfrm6_output.c | 2 + net/l2tp/l2tp_core.c | 2 +- net/mac80211/cfg.c | 2 +- net/mac802154/tx.c | 35 +- net/netfilter/nf_tables_api.c | 10 +- net/netfilter/nft_hash.c | 2 +- net/netfilter/nft_rbtree.c | 2 +- net/sched/act_ipt.c | 2 +- net/wireless/nl80211.c | 1 + net/wireless/reg.c | 1 + net/xfrm/xfrm_policy.c | 5 +- net/xfrm/xfrm_user.c | 12 + security/apparmor/policy_unpack.c | 32 -- security/keys/encrypted-keys/encrypted.c | 31 +- sound/aoa/core/gpio-feature.c | 4 +- sound/core/memalloc.c | 8 +- sound/core/seq/oss/seq_oss.c | 2 +- sound/core/seq/seq_clientmgr.c | 2 +- sound/core/seq/seq_virmidi.c | 10 + sound/drivers/vx/vx_pcm.c | 6 +- sound/firewire/bebob/bebob_maudio.c | 24 +- sound/pci/cs5535audio/cs5535audio.h | 6 +- sound/pci/cs5535audio/cs5535audio_pcm.c | 4 +- sound/pci/emu10k1/emufx.c | 2 +- sound/pci/vx222/vx222_ops.c | 20 +- sound/pcmcia/vx/vxp_ops.c | 22 +- sound/soc/codecs/wm8994.c | 1 + tools/hv/hv_fcopy_daemon.c | 1 + tools/hv/hv_kvp_daemon.c | 2 +- 319 files changed, 2983 insertions(+), 1647 deletions(-)
Signature · 3 lines
Ben Hutchings
The generation of random numbers is too important to be left to chance.
- Robert CoveyouPATCH 3/328 EDAC, i7core: Fix memleaks and use-after-free on probe and remove
3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 6c974d4dfafe5e9ee754f2a6fba0eb1864f1649e upstream.
Make sure to free and deregister the addrmatch and chancounts devices allocated during probe in all error paths. Also fix use-after-free in a probe error path and in the remove success path where the devices were being put before before deregistration.
--- drivers/edac/i7core_edac.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/edac/i7core_edac.c +15 -7
@@ -1190,15 +1190,14 @@ static int i7core_create_sysfs_devices(s rc =device_add (pvt->addrmatch_dev);if (rc <0 ) -return rc; + goto err_put_addrmatch;if (!pvt->is_registered) { pvt->chancounts_dev =kzalloc (sizeof (*pvt->chancounts_dev),GFP_KERNEL );if (!pvt->chancounts_dev) { -put_device (pvt->addrmatch_dev); -device_del (pvt->addrmatch_dev); -return -ENOMEM ; + rc = -ENOMEM ; + goto err_del_addrmatch; } pvt->chancounts_dev->type = &all_channel_counts_type;
@@ -1212,9 +1211,18 @@ static int i7core_create_sysfs_devices(s rc =device_add (pvt->chancounts_dev);if (rc <0 ) -return rc; + goto err_put_chancounts; }return 0 ; + +err_put_chancounts: +put_device (pvt->chancounts_dev); +err_del_addrmatch: +device_del (pvt->addrmatch_dev); +err_put_addrmatch: +put_device (pvt->addrmatch_dev); + +return rc; }static void i7core_delete_sysfs_devices (struct mem_ctl_info *mci)
@@ -1229,11 +1237,11 @@ static void i7core_delete_sysfs_devices(device_remove_file (&mci->dev, &dev_attr_inject_enable);if (!pvt->is_registered) { -put_device (pvt->chancounts_dev);device_del (pvt->chancounts_dev); +put_device (pvt->chancounts_dev); } -put_device (pvt->addrmatch_dev);device_del (pvt->addrmatch_dev); +put_device (pvt->addrmatch_dev); }/****************************************************************************
PATCH 19/328 scsi: target/iscsi: Make iscsit_ta_authentication() respect the output buffer size
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 35bea5c84fd13c643cce63f0b5cd4b148f8c901d upstream.
--- drivers/target/iscsi/iscsi_target_tpg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/target/iscsi/iscsi_target_tpg.c +1 -2
@@ -652,8 +652,7 @@ int iscsit_ta_authentication(struct iscs none =strstr (buf1,NONE );if (none) goto out; -strncat (buf1,"," ,strlen ("," )); -strncat (buf1,NONE ,strlen (NONE )); +strlcat (buf1,"," NONE ,sizeof (buf1));if (iscsi_update_param_value (param, buf1) <0 )return -EINVAL ; }
PATCH 1/328 EDAC: Fix memleak in module init error path
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 4708aa85d50cc6e962dfa8acf5ad4e0d290a21db upstream.
Make sure to use put_device() to free the initialised struct device so that resources managed by driver core also gets released in the event of a registration failure.
--- drivers/edac/edac_mc_sysfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/edac/edac_mc_sysfs.c +3 -3
@@ -1161,14 +1161,14 @@ int __init edac_mc_sysfs_init(void) err =device_add (mci_pdev);if (err <0 ) - goto out_dev_free; + goto out_put_device;edac_dbg (0 ,"device %s created\n" ,dev_name (mci_pdev));return 0 ; - out_dev_free: -kfree (mci_pdev); + out_put_device: +put_device (mci_pdev); out_put_sysfs:edac_put_sysfs_subsys (); out:
PATCH 9/328 platform/x86: ideapad-laptop: Apply no_hw_rfkill to Y20-15IKBM, too
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 58e73aa177850babb947555257fd4f79e5275cf1 upstream.
The commit 5d9f40b56630 ("platform/x86: ideapad-laptop: Add Y520-15IKBN to no_hw_rfkill") added the entry for Y20-15IKBN, and it turned out that another variant, Y20-15IKBM, also requires the no_hw_rfkill.
Trim the last letter from the string so that it matches to both Y20-15IKBN and Y20-15IKBM models.
Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=1098626
--- drivers/platform/x86/ideapad-laptop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/ideapad-laptop.c +2 -2
@@ -860,10 +860,10 @@ static struct dmi_system_id no_hw_rfkill }, }, { - .ident = "Lenovo Legion Y520-15IKBN", + .ident = "Lenovo Legion Y520-15IKB", .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), - DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Y520-15IKBN"), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Y520-15IKB"), }, }, {
PATCH 15/328 crypto: vmac - require a block cipher with 128-bit block size
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 73bf20ef3df262026c3470241ae4ac8196943ffa upstream.
The VMAC template assumes the block cipher has a 128-bit block size, but it failed to check for that. Thus it was possible to instantiate it using a 64-bit block size cipher, e.g. "vmac(cast5)", causing uninitialized memory to be used.
Add the needed check when instantiating the template.
--- crypto/vmac.c | 4 ++++ 1 file changed, 4 insertions(+)
crypto/vmac.c +4 -0
@@ -655,6 +655,10 @@ static int vmac_create(struct crypto_temif (IS_ERR (alg))return PTR_ERR (alg); + err = -EINVAL ; +if (alg->cra_blocksize !=16 ) + goto out_put_alg; + inst =shash_alloc_instance ("vmac" , alg); err =PTR_ERR (inst);if (IS_ERR (inst))
PATCH 17/328 crypto: vmac - separate tfm and request context
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit bb29648102335586e9a66289a1d98a0cb392b6e5 upstream.
syzbot reported a crash in vmac_final() when multiple threads concurrently use the same "vmac(aes)" transform through AF_ALG. The bug is pretty fundamental: the VMAC template doesn't separate per-request state from per-tfm (per-key) state like the other hash algorithms do, but rather stores it all in the tfm context. That's wrong.
Also, vmac_final() incorrectly zeroes most of the state including the derived keys and cached pseudorandom pad. Therefore, only the first VMAC invocation with a given key calculates the correct digest.
Fix these bugs by splitting the per-tfm state from the per-request state and using the proper init/update/final sequencing for requests.
Reproducer for the crash:
#include <linux/if_alg.h>
#include <sys/socket.h>
#include <unistd.h>
int main()
{
int fd;
struct sockaddr_alg addr = {
.salg_type = "hash",
.salg_name = "vmac(aes)",
};
char buf[256] = { 0 };
fd = socket(AF_ALG, SOCK_SEQPACKET, 0);
bind(fd, (void *)&addr, sizeof(addr));
setsockopt(fd, SOL_ALG, ALG_SET_KEY, buf, 16);
fork();
fd = accept(fd, NULL, NULL);
for (;;)
write(fd, buf, 256);
}The immediate cause of the crash is that vmac_ctx_t.partial_size exceeds VMAC_NHBYTES, causing vmac_final() to memset() a negative length.
--- crypto/vmac.c | 408 +++++++++++++++++++----------------------- include/crypto/vmac.h | 63 ------- 2 files changed, 181 insertions(+), 290 deletions(-) delete mode 100644 include/crypto/vmac.h
crypto/vmac.c +184 -230
@@ -1,6 +1,10 @@/* -* Modified to interface to the Linux kernel +* VMAC: Message Authentication Code using Universal Hashing +* +* Reference: https://tools.ietf.org/html/draft-krovetz-vmac-01 +* * Copyright (c) 2009, Intel Corporation. +* Copyright (c) 2018, Google Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -16,14 +20,15 @@* Place - Suite 330, Boston, MA 02111-1307 USA. */ -/* -------------------------------------------------------------------------- -* VMAC and VHASH Implementation by Ted Krovetz ([email protected]) and Wei Dai. -* This implementation is herby placed in the public domain. -* The authors offers no warranty. Use at your own risk. -* Please send bug reports to the authors. -* Last modified: 17 APR 08, 1700 PDT -* ----------------------------------------------------------------------- */ +/* +* Derived from: +* VMAC and VHASH Implementation by Ted Krovetz ([email protected]) and Wei Dai. +* This implementation is herby placed in the public domain. +* The authors offers no warranty. Use at your own risk. +* Last modified: 17 APR 08, 1700 PDT +*/ +#include <asm/unaligned.h> #include <linux/init.h> #include <linux/types.h> #include <linux/crypto.h>
@@ -31,10 +36,36 @@#include <linux/scatterlist.h> #include <asm/byteorder.h> #include <crypto/scatterwalk.h> -#include <crypto/vmac.h> #include <crypto/internal/hash.h> /* +* User definable settings. +*/ +#define VMAC_TAG_LEN 64 +#define VMAC_KEY_SIZE 128/* Must be 128, 192 or 256 */ +#define VMAC_KEY_LEN (VMAC_KEY_SIZE/8) +#define VMAC_NHBYTES 128/* Must 2^i for any 3 < i < 13 Standard = 128*/ + +/* per-transform (per-key) context */ +struct vmac_tfm_ctx { +struct crypto_cipher *cipher; +u64 nhkey[(VMAC_NHBYTES /8 )+2 *(VMAC_TAG_LEN /64 -1 )]; +u64 polykey[2 *VMAC_TAG_LEN /64 ]; +u64 l3key[2 *VMAC_TAG_LEN /64 ]; +}; + +/* per-request context */ +struct vmac_desc_ctx { +union { +u8 partial[VMAC_NHBYTES ];/* partial block */ +__le64 partial_words[VMAC_NHBYTES /8 ]; + }; +unsigned int partial_size;/* size of the partial block */ +bool first_block_processed; +u64 polytmp[2 *VMAC_TAG_LEN /64 ];/* running total of L2-hash */ +}; + +/* * Constants and masks */ #define UINT64_C (x) x##ULL
@@ -318,13 +349,6 @@ static void poly_step_func(u64 *ahi, u64 } while (0)#endif -static void vhash_abort (struct vmac_ctx *ctx) -{ - ctx->polytmp[0 ] = ctx->polykey[0 ] ; - ctx->polytmp[1 ] = ctx->polykey[1 ] ; - ctx->first_block_processed =0 ; -} -static u64 l3hash (u64 p1,u64 p2,u64 k1,u64 k2,u64 len) {u64 rh, rl, t, z =0 ;
@@ -364,280 +388,209 @@ static u64 l3hash(u64 p1, u64 p2, u64 k1return rl; } -static void vhash_update (const unsigned char *m, -unsigned int mbytes,/* Pos multiple of VMAC_NHBYTES */ -struct vmac_ctx *ctx) -{ -u64 rh, rl, *mptr; -const u64 *kptr = (u64 *)ctx->nhkey; -int i; -u64 ch, cl; -u64 pkh = ctx->polykey[0 ]; -u64 pkl = ctx->polykey[1 ]; - -if (!mbytes) -return ; - -BUG_ON (mbytes %VMAC_NHBYTES ); +/* L1 and L2-hash one or more VMAC_NHBYTES-byte blocks */ +static void vhash_blocks (const struct vmac_tfm_ctx *tctx, +struct vmac_desc_ctx *dctx, +const __le64 *mptr,unsigned int blocks) +{ +const u64 *kptr = tctx->nhkey; +const u64 pkh = tctx->polykey[0 ]; +const u64 pkl = tctx->polykey[1 ]; +u64 ch = dctx->polytmp[0 ]; +u64 cl = dctx->polytmp[1 ]; +u64 rh, rl; - mptr = (u64 *)m; - i = mbytes /VMAC_NHBYTES ;/* Must be non-zero */ - - ch = ctx->polytmp[0 ]; - cl = ctx->polytmp[1 ]; - -if (!ctx->first_block_processed) { - ctx->first_block_processed =1 ; +if (!dctx->first_block_processed) { + dctx->first_block_processed = true;nh_vmac_nhbytes (mptr, kptr,VMAC_NHBYTES /8 , rh, rl); rh &= m62;ADD128 (ch, cl, rh, rl); mptr += (VMAC_NHBYTES /sizeof (u64)); - i--; + blocks--; } -while (i--) { +while (blocks--) {nh_vmac_nhbytes (mptr, kptr,VMAC_NHBYTES /8 , rh, rl); rh &= m62;poly_step (ch, cl, pkh, pkl, rh, rl); mptr += (VMAC_NHBYTES /sizeof (u64)); } - ctx->polytmp[0 ] = ch; - ctx->polytmp[1 ] = cl; + dctx->polytmp[0 ] = ch; + dctx->polytmp[1 ] = cl; } -static u64 vhash (unsigned char m[],unsigned int mbytes, -u64 *tagl,struct vmac_ctx *ctx) +static int vmac_setkey (struct crypto_shash *tfm, +const u8 *key,unsigned int keylen) { -u64 rh, rl, *mptr; -const u64 *kptr = (u64 *)ctx->nhkey; -int i, remaining; -u64 ch, cl; -u64 pkh = ctx->polykey[0 ]; -u64 pkl = ctx->polykey[1 ]; - - mptr = (u64 *)m; - i = mbytes /VMAC_NHBYTES ; - remaining = mbytes %VMAC_NHBYTES ; - -if (ctx->first_block_processed) { - ch = ctx->polytmp[0 ]; - cl = ctx->polytmp[1 ]; - }else if (i) { -nh_vmac_nhbytes (mptr, kptr,VMAC_NHBYTES /8 , ch, cl); - ch &= m62; -ADD128 (ch, cl, pkh, pkl); - mptr += (VMAC_NHBYTES /sizeof (u64)); - i--; - }else if (remaining) { -nh_16 (mptr, kptr,2 *((remaining+15 )/16 ), ch, cl); - ch &= m62; -ADD128 (ch, cl, pkh, pkl); - mptr += (VMAC_NHBYTES /sizeof (u64)); - goto do_l3; - }else {/* Empty String */ - ch = pkh; cl = pkl; - goto do_l3; - } - -while (i--) { -nh_vmac_nhbytes (mptr, kptr,VMAC_NHBYTES /8 , rh, rl); - rh &= m62; -poly_step (ch, cl, pkh, pkl, rh, rl); - mptr += (VMAC_NHBYTES /sizeof (u64)); - } -if (remaining) { -nh_16 (mptr, kptr,2 *((remaining+15 )/16 ), rh, rl); - rh &= m62; -poly_step (ch, cl, pkh, pkl, rh, rl); - } - -do_l3: -vhash_abort (ctx); - remaining *=8 ; -return l3hash (ch, cl, ctx->l3key[0 ], ctx->l3key[1 ], remaining); -} - -static u64 vmac (unsigned char m[],unsigned int mbytes, -const unsigned char n[16 ],u64 *tagl, -struct vmac_ctx_t *ctx) -{ -u64 *in_n, *out_p; -u64 p, h; -int i; - - in_n = ctx->__vmac_ctx.cached_nonce; - out_p = ctx->__vmac_ctx.cached_aes; - - i = n[15 ] &1 ; -if ((*(u64 *)(n+8 ) != in_n[1 ]) || (*(u64 *)(n) != in_n[0 ])) { - in_n[0 ] = *(u64 *)(n); - in_n[1 ] = *(u64 *)(n+8 ); - ((unsigned char *)in_n)[15 ] &=0xFE ; -crypto_cipher_encrypt_one (ctx->child, - (unsigned char *)out_p, (unsigned char *)in_n); +struct vmac_tfm_ctx *tctx =crypto_shash_ctx (tfm); +__be64 out[2 ]; +u8 in[16 ] = {0 }; +unsigned int i; +int err; - ((unsigned char *)in_n)[15 ] |= (unsigned char )(1 -i); +if (keylen !=VMAC_KEY_LEN ) { +crypto_shash_set_flags (tfm,CRYPTO_TFM_RES_BAD_KEY_LEN ); +return -EINVAL ; } - p =be64_to_cpup (out_p + i); - h =vhash (m, mbytes, (u64 *)0 , &ctx->__vmac_ctx); -return le64_to_cpu (p + h); -} - -static int vmac_set_key (unsigned char user_key[],struct vmac_ctx_t *ctx) -{ -u64 in[2 ] = {0 }, out[2 ]; -unsigned i; -int err =0 ; - err =crypto_cipher_setkey (ctx->child, user_key,VMAC_KEY_LEN ); + err =crypto_cipher_setkey (tctx->cipher, key, keylen);if (err)return err;/* Fill nh key */ - ((unsigned char *)in)[0 ] =0x80 ; -for (i =0 ; i <sizeof (ctx->__vmac_ctx.nhkey)/8 ; i +=2 ) { -crypto_cipher_encrypt_one (ctx->child, - (unsigned char *)out, (unsigned char *)in); - ctx->__vmac_ctx.nhkey[i] =be64_to_cpup (out); - ctx->__vmac_ctx.nhkey[i+1 ] =be64_to_cpup (out+1 ); - ((unsigned char *)in)[15 ] +=1 ; + in[0 ] =0x80 ; +for (i =0 ; i <ARRAY_SIZE (tctx->nhkey); i +=2 ) { +crypto_cipher_encrypt_one (tctx->cipher, (u8 *)out, in); + tctx->nhkey[i] =be64_to_cpu (out[0 ]); + tctx->nhkey[i+1 ] =be64_to_cpu (out[1 ]); + in[15 ]++; }/* Fill poly key */ - ((unsigned char *)in)[0 ] =0xC0 ; - in[1 ] =0 ; -for (i =0 ; i <sizeof (ctx->__vmac_ctx.polykey)/8 ; i +=2 ) { -crypto_cipher_encrypt_one (ctx->child, - (unsigned char *)out, (unsigned char *)in); - ctx->__vmac_ctx.polytmp[i] = - ctx->__vmac_ctx.polykey[i] = -be64_to_cpup (out) & mpoly; - ctx->__vmac_ctx.polytmp[i+1 ] = - ctx->__vmac_ctx.polykey[i+1 ] = -be64_to_cpup (out+1 ) & mpoly; - ((unsigned char *)in)[15 ] +=1 ; + in[0 ] =0xC0 ; + in[15 ] =0 ; +for (i =0 ; i <ARRAY_SIZE (tctx->polykey); i +=2 ) { +crypto_cipher_encrypt_one (tctx->cipher, (u8 *)out, in); + tctx->polykey[i] =be64_to_cpu (out[0 ]) & mpoly; + tctx->polykey[i+1 ] =be64_to_cpu (out[1 ]) & mpoly; + in[15 ]++; }/* Fill ip key */ - ((unsigned char *)in)[0 ] =0xE0 ; - in[1 ] =0 ; -for (i =0 ; i <sizeof (ctx->__vmac_ctx.l3key)/8 ; i +=2 ) { + in[0 ] =0xE0 ; + in[15 ] =0 ; +for (i =0 ; i <ARRAY_SIZE (tctx->l3key); i +=2 ) {do { -crypto_cipher_encrypt_one (ctx->child, - (unsigned char *)out, (unsigned char *)in); - ctx->__vmac_ctx.l3key[i] =be64_to_cpup (out); - ctx->__vmac_ctx.l3key[i+1 ] =be64_to_cpup (out+1 ); - ((unsigned char *)in)[15 ] +=1 ; - }while (ctx->__vmac_ctx.l3key[i] >= p64 - || ctx->__vmac_ctx.l3key[i+1 ] >= p64); +crypto_cipher_encrypt_one (tctx->cipher, (u8 *)out, in); + tctx->l3key[i] =be64_to_cpu (out[0 ]); + tctx->l3key[i+1 ] =be64_to_cpu (out[1 ]); + in[15 ]++; + }while (tctx->l3key[i] >= p64 || tctx->l3key[i+1 ] >= p64); } -/* Invalidate nonce/aes cache and reset other elements */ - ctx->__vmac_ctx.cached_nonce[0 ] = (u64)-1 ;/* Ensure illegal nonce */ - ctx->__vmac_ctx.cached_nonce[1 ] = (u64 )0 ;/* Ensure illegal nonce */ - ctx->__vmac_ctx.first_block_processed =0 ; - -return err; +return 0 ; } -static int vmac_setkey (struct crypto_shash *parent, -const u8 *key,unsigned int keylen) +static int vmac_init (struct shash_desc *desc) { -struct vmac_ctx_t *ctx =crypto_shash_ctx (parent); +const struct vmac_tfm_ctx *tctx =crypto_shash_ctx (desc->tfm); +struct vmac_desc_ctx *dctx =shash_desc_ctx (desc); -if (keylen !=VMAC_KEY_LEN ) { -crypto_shash_set_flags (parent,CRYPTO_TFM_RES_BAD_KEY_LEN ); -return -EINVAL ; - } - -return vmac_set_key ((u8 *)key, ctx); -} - -static int vmac_init (struct shash_desc *pdesc) -{ + dctx->partial_size =0 ; + dctx->first_block_processed = false; +memcpy (dctx->polytmp, tctx->polykey,sizeof (dctx->polytmp));return 0 ; } -static int vmac_update (struct shash_desc *pdesc,const u8 *p, -unsigned int len) +static int vmac_update (struct shash_desc *desc,const u8 *p,unsigned int len) { -struct crypto_shash *parent = pdesc->tfm; -struct vmac_ctx_t *ctx =crypto_shash_ctx (parent); -int expand; -int min; - - expand =VMAC_NHBYTES - ctx->partial_size >0 ? -VMAC_NHBYTES - ctx->partial_size :0 ; - - min = len < expand ? len : expand; - -memcpy (ctx->partial + ctx->partial_size, p, min); - ctx->partial_size += min; - -if (len < expand) -return 0 ; - -vhash_update (ctx->partial,VMAC_NHBYTES , &ctx->__vmac_ctx); - ctx->partial_size =0 ; - - len -= expand; - p += expand; - -if (len %VMAC_NHBYTES ) { -memcpy (ctx->partial, p + len - (len %VMAC_NHBYTES ), - len %VMAC_NHBYTES ); - ctx->partial_size = len %VMAC_NHBYTES ; +const struct vmac_tfm_ctx *tctx =crypto_shash_ctx (desc->tfm); +struct vmac_desc_ctx *dctx =shash_desc_ctx (desc); +unsigned int n; + +if (dctx->partial_size) { + n =min (len,VMAC_NHBYTES - dctx->partial_size); +memcpy (&dctx->partial[dctx->partial_size], p, n); + dctx->partial_size += n; + p += n; + len -= n; +if (dctx->partial_size ==VMAC_NHBYTES ) { +vhash_blocks (tctx, dctx, dctx->partial_words,1 ); + dctx->partial_size =0 ; + } + } + +if (len >=VMAC_NHBYTES ) { + n =round_down (len,VMAC_NHBYTES ); +/* TODO: 'p' may be misaligned here */ +vhash_blocks (tctx, dctx, (const __le64 *)p, n /VMAC_NHBYTES ); + p += n; + len -= n; + } + +if (len) { +memcpy (dctx->partial, p, len); + dctx->partial_size = len; } -vhash_update (p, len - len %VMAC_NHBYTES , &ctx->__vmac_ctx); -return 0 ; } -static int vmac_final (struct shash_desc *pdesc,u8 *out) +static u64 vhash_final (const struct vmac_tfm_ctx *tctx, +struct vmac_desc_ctx *dctx) { -struct crypto_shash *parent = pdesc->tfm; -struct vmac_ctx_t *ctx =crypto_shash_ctx (parent); -vmac_t mac; -u8 nonce[16 ] = {}; - -/* vmac() ends up accessing outside the array bounds that -* we specify. In appears to access up to the next 2-word -* boundary. We'll just be uber cautious and zero the -* unwritten bytes in the buffer. -*/ -if (ctx->partial_size) { -memset (ctx->partial + ctx->partial_size,0 , -VMAC_NHBYTES - ctx->partial_size); - } - mac =vmac (ctx->partial, ctx->partial_size, nonce,NULL , ctx); -memcpy (out, &mac,sizeof (vmac_t)); -memzero_explicit (&mac,sizeof (vmac_t)); -memset (&ctx->__vmac_ctx,0 ,sizeof (struct vmac_ctx )); - ctx->partial_size =0 ; +unsigned int partial = dctx->partial_size; +u64 ch = dctx->polytmp[0 ]; +u64 cl = dctx->polytmp[1 ]; + +/* L1 and L2-hash the final block if needed */ +if (partial) { +/* Zero-pad to next 128-bit boundary */ +unsigned int n =round_up (partial,16 ); +u64 rh, rl; + +memset (&dctx->partial[partial],0 , n - partial); +nh_16 (dctx->partial_words, tctx->nhkey, n /8 , rh, rl); + rh &= m62; +if (dctx->first_block_processed) +poly_step (ch, cl, tctx->polykey[0 ], tctx->polykey[1 ], + rh, rl); +else +ADD128 (ch, cl, rh, rl); + } + +/* L3-hash the 128-bit output of L2-hash */ +return l3hash (ch, cl, tctx->l3key[0 ], tctx->l3key[1 ], partial *8 ); +} + +static int vmac_final (struct shash_desc *desc,u8 *out) +{ +const struct vmac_tfm_ctx *tctx =crypto_shash_ctx (desc->tfm); +struct vmac_desc_ctx *dctx =shash_desc_ctx (desc); +static const u8 nonce[16 ] = {};/* TODO: this is insecure */ +union { +u8 bytes[16 ]; +__be64 pads[2 ]; + } block; +int index; +u64 hash, pad; + +/* Finish calculating the VHASH of the message */ + hash =vhash_final (tctx, dctx); + +/* Generate pseudorandom pad by encrypting the nonce */ +memcpy (&block, nonce,16 ); + index = block.bytes[15 ] &1 ; + block.bytes[15 ] &= ~1 ; +crypto_cipher_encrypt_one (tctx->cipher, block.bytes, block.bytes); + pad =be64_to_cpu (block.pads[index]); + +/* The VMAC is the sum of VHASH and the pseudorandom pad */ +put_unaligned_le64 (hash + pad, out);return 0 ; }static int vmac_init_tfm (struct crypto_tfm *tfm) { -struct crypto_cipher *cipher; -struct crypto_instance *inst = (void *)tfm->__crt_alg; +struct crypto_instance *inst =crypto_tfm_alg_instance (tfm);struct crypto_spawn *spawn =crypto_instance_ctx (inst); -struct vmac_ctx_t *ctx =crypto_tfm_ctx (tfm); +struct vmac_tfm_ctx *tctx =crypto_tfm_ctx (tfm); +struct crypto_cipher *cipher; cipher =crypto_spawn_cipher (spawn);if (IS_ERR (cipher))return PTR_ERR (cipher); - ctx->child = cipher; + tctx->cipher = cipher;return 0 ; }static void vmac_exit_tfm (struct crypto_tfm *tfm) { -struct vmac_ctx_t *ctx =crypto_tfm_ctx (tfm); -crypto_free_cipher (ctx->child); +struct vmac_tfm_ctx *tctx =crypto_tfm_ctx (tfm); + +crypto_free_cipher (tctx->cipher); }static int vmac_create (struct crypto_template *tmpl,struct rtattr **tb)
@@ -674,11 +627,12 @@ static int vmac_create(struct crypto_tem inst->alg.base.cra_blocksize = alg->cra_blocksize; inst->alg.base.cra_alignmask = alg->cra_alignmask; - inst->alg.digestsize =sizeof (vmac_t); - inst->alg.base.cra_ctxsize =sizeof (struct vmac_ctx_t ); + inst->alg.base.cra_ctxsize =sizeof (struct vmac_tfm_ctx ); inst->alg.base.cra_init = vmac_init_tfm; inst->alg.base.cra_exit = vmac_exit_tfm; + inst->alg.descsize =sizeof (struct vmac_desc_ctx ); + inst->alg.digestsize =VMAC_TAG_LEN /8 ; inst->alg.init = vmac_init; inst->alg.update = vmac_update; inst->alg.final = vmac_final;
include/crypto/vmac.h deleted +0 -63
63 lines not on this page · raw message
PATCH 25/328 power: generic-adc-battery: fix out-of-bounds write when copying channel properties
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "H. Nikolaus Schaller" <[email protected]>
commit 932d47448c3caa0fa99e84d7f5bc302aa286efd8 upstream.
We did have sporadic problems in the pinctrl framework during boot where a pin group name unexpectedly became NULL leading to a NULL dereference in strcmp.
Detailled analysis of the failing cases did reveal that there were two devm allocated objects close to each other. The second one was the affected group_desc in pinmux and the first one was the psy_desc->properties buffer of the gab driver.
Review of the gab code showed that the address calculation for one memcpy() is wrong. It does
properties + sizeof(type) * index
but C is defined to do the index multiplication already for pointer + integer additions. Hence the factor was applied twice and the memcpy() does write outside of the properties buffer. Sometimes it happened to be the pinctrl and triggered the strcmp(NULL).
Anyways, it is overkill to use a memcpy() here instead of a simple assignment, which is easier to read and has less risk for wrong address calculations. So we change code to a simple assignment.
If we initialize the index to the first free location, we can even remove the local variable 'properties'.
This bug seems to exist right from the beginning in 3.7-rc1 in
commit e60fea794e6e ("power: battery: Generic battery driver using IIO")
[bwh: Backported to 3.16:
- s/psy_desc/psy/g
- Adjust filename]
--- drivers/power/generic-adc-battery.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/power/generic-adc-battery.c +4 -10
@@ -241,10 +241,9 @@ static int gab_probe(struct platform_devstruct gab *adc_bat;struct power_supply *psy;struct gab_platform_data *pdata = pdev->dev.platform_data; -enum power_supply_property *properties;int ret =0 ;int chan; -int index =0 ; +int index =ARRAY_SIZE (gab_props); adc_bat =devm_kzalloc (&pdev->dev,sizeof (*adc_bat),GFP_KERNEL );if (!adc_bat) {
@@ -276,8 +275,6 @@ static int gab_probe(struct platform_dev }memcpy (psy->properties, gab_props,sizeof (gab_props)); - properties = (enum power_supply_property *) - ((char *)psy->properties +sizeof (gab_props));/* * getting channel from iio and copying the battery properties
@@ -291,15 +288,12 @@ static int gab_probe(struct platform_dev adc_bat->channel[chan] =NULL ; }else {/* copying properties for supported channels only */ -memcpy (properties +sizeof (*(psy->properties)) * index, - &gab_dyn_props[chan], -sizeof (gab_dyn_props[chan])); - index++; + psy->properties[index++] = gab_dyn_props[chan]; } }/* none of the channels are supported so let's bail out */ -if (index ==0 ) { +if (index ==ARRAY_SIZE (gab_props)) { ret = -ENODEV ; goto second_mem_fail; }
@@ -310,7 +304,7 @@ static int gab_probe(struct platform_dev* as come channels may be not be supported by the device.So * we need to take care of that. */ - psy->num_properties =ARRAY_SIZE (gab_props) + index; + psy->num_properties = index; ret =power_supply_register (&pdev->dev, psy);if (ret)
PATCH 26/328 power: generic-adc-battery: check for duplicate properties copied from iio channels
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "H. Nikolaus Schaller" <[email protected]>
commit a427503edaaed9b75ed9746a654cece7e93e60a8 upstream.
If an iio channel defines a basic property, there are duplicate entries in /sys/class/power/*/uevent.
So add a check to avoid duplicates. Since all channels may be duplicates, we have to modify the related error check.
[bwh: Backported to 3.16:
- s/psy_desc/psy/
- Adjust filename]
--- drivers/power/generic-adc-battery.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/power/generic-adc-battery.c +13 -2
@@ -244,6 +244,7 @@ static int gab_probe(struct platform_devint ret =0 ;int chan;int index =ARRAY_SIZE (gab_props); +bool any = false; adc_bat =devm_kzalloc (&pdev->dev,sizeof (*adc_bat),GFP_KERNEL );if (!adc_bat) {
@@ -288,12 +289,22 @@ static int gab_probe(struct platform_dev adc_bat->channel[chan] =NULL ; }else {/* copying properties for supported channels only */ - psy->properties[index++] = gab_dyn_props[chan]; +int index2; + +for (index2 =0 ; index2 < index; index2++) { +if (psy->properties[index2] == + gab_dyn_props[chan]) +break ;/* already known */ + } +if (index2 == index)/* really new */ + psy->properties[index++] = + gab_dyn_props[chan]; + any = true; } }/* none of the channels are supported so let's bail out */ -if (index ==ARRAY_SIZE (gab_props)) { +if (!any) { ret = -ENODEV ; goto second_mem_fail; }
PATCH 28/328 vxlan: add new fdb alloc and create helpers
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Roopa Prabhu <[email protected]>
commit 25e20e730d56471cffa25419bf2a66078bd55330 upstream.
- Add new vxlan_fdb_alloc helper
- rename existing vxlan_fdb_create into vxlan_fdb_update:
because it really creates or updates an existing fdb entry
- move new fdb creation into a separate vxlan_fdb_create
Main motivation for this change is to introduce the ability to decouple vxlan fdb creation and notify, used in a later patch.
[bwh: Backported to 3.16:
- s/vxlan->cfg\.addrmax/vxlan->addrmax/g
- Drop src_vni parameters and initialisation of vxlan_fdb::vni
- Drop last argument to vxlan_fdb_head()
- Drop change to vxlan_changelink()]
--- drivers/net/vxlan.c | 91 ++++++++++++++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 29 deletions(-)
drivers/net/vxlan.c +59 -26
@@ -685,9 +685,60 @@ static void vxlan_notify_del_rx_port(strudp_del_offload (&vs->udp_offloads); } -/* Add new entry to forwarding table -- assumes lock held */ +static struct vxlan_fdb *vxlan_fdb_alloc (struct vxlan_dev *vxlan, +const u8 *mac,__u16 state, +__u8 ndm_flags) +{ +struct vxlan_fdb *f; + + f =kmalloc (sizeof (*f),GFP_ATOMIC ); +if (!f) +return NULL ; + f->state = state; + f->flags = ndm_flags; + f->updated = f->used = jiffies; +INIT_LIST_HEAD (&f->remotes); +memcpy (f->eth_addr, mac,ETH_ALEN ); + +return f; +} +static int vxlan_fdb_create (struct vxlan_dev *vxlan,const u8 *mac,union vxlan_addr *ip, +__u16 state,__be16 port, +__be32 vni,__u32 ifindex,__u8 ndm_flags, +struct vxlan_fdb **fdb) +{ +struct vxlan_rdst *rd =NULL ; +struct vxlan_fdb *f; +int rc; + +if (vxlan->addrmax && vxlan->addrcnt >= vxlan->addrmax) +return -ENOSPC ; + +netdev_dbg (vxlan->dev,"add %pM -> %pIS\n" , mac, ip); + f =vxlan_fdb_alloc (vxlan, mac, state, ndm_flags); +if (!f) +return -ENOMEM ; + + rc =vxlan_fdb_append (f, ip, port, vni, ifindex, &rd); +if (rc <0 ) { +kfree (f); +return rc; + } + + ++vxlan->addrcnt; +hlist_add_head_rcu (&f->hlist, +vxlan_fdb_head (vxlan, mac)); + + *fdb = f; + +return 0 ; +} + +/* Add new entry to forwarding table -- assumes lock held */ +static int vxlan_fdb_update (struct vxlan_dev *vxlan, +const u8 *mac,union vxlan_addr *ip,__u16 state,__u16 flags,__be16 port,__u32 vni,__u32 ifindex,__u8 ndm_flags)
@@ -740,35 +791,17 @@ static int vxlan_fdb_create(struct vxlanif (!(flags &NLM_F_CREATE ))return -ENOENT ; -if (vxlan->addrmax && vxlan->addrcnt >= vxlan->addrmax) -return -ENOSPC ; -/* Disallow replace to add a multicast entry */ if ((flags &NLM_F_REPLACE ) && (is_multicast_ether_addr (mac) ||is_zero_ether_addr (mac)))return -EOPNOTSUPP ;netdev_dbg (vxlan->dev,"add %pM -> %pIS\n" , mac, ip); - f =kmalloc (sizeof (*f),GFP_ATOMIC ); -if (!f) -return -ENOMEM ; - - notify =1 ; - f->state = state; - f->flags = ndm_flags; - f->updated = f->used = jiffies; -INIT_LIST_HEAD (&f->remotes); -memcpy (f->eth_addr, mac,ETH_ALEN ); - - rc =vxlan_fdb_append (f, ip, port, vni, ifindex, &rd); -if (rc <0 ) { -kfree (f); + rc =vxlan_fdb_create (vxlan, mac, ip, state, port, + vni, ifindex, ndm_flags, &f); +if (rc <0 )return rc; - } - - ++vxlan->addrcnt; -hlist_add_head_rcu (&f->hlist, -vxlan_fdb_head (vxlan, mac)); + notify =1 ; }if (notify) {
@@ -886,7 +919,7 @@ static int vxlan_fdb_add(struct ndmsg *nreturn -EAFNOSUPPORT ;spin_lock_bh (&vxlan->hash_lock); - err =vxlan_fdb_create (vxlan, addr, &ip, ndm->ndm_state, flags, + err =vxlan_fdb_update (vxlan, addr, &ip, ndm->ndm_state, flags, port, vni, ifindex, ndm->ndm_flags);spin_unlock_bh (&vxlan->hash_lock);
@@ -1012,7 +1045,7 @@ static bool vxlan_snoop(struct net_devic/* close off race between vxlan_flush and incoming packets */ if (netif_running (dev)) - vxlan_fdb_create(vxlan, src_mac, src_ip, + vxlan_fdb_update(vxlan, src_mac, src_ip, NUD_REACHABLE, NLM_F_EXCL|NLM_F_CREATE, vxlan->dst_port,
@@ -2718,7 +2751,7 @@ static int vxlan_newlink(struct net *net/* create an fdb entry for a valid default destination */ if (!vxlan_addr_any (&vxlan->default_dst.remote_ip)) { - err = vxlan_fdb_create(vxlan, all_zeros_mac, + err = vxlan_fdb_update(vxlan, all_zeros_mac, &vxlan->default_dst.remote_ip, NUD_REACHABLE|NUD_PERMANENT, NLM_F_EXCL|NLM_F_CREATE,
PATCH 14/328 IB/srpt: Support HCAs with more than two ports
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit e620ebfc228dcbef7519e3d16f43c6c6f1a1d0cb upstream.
Since there are adapters that have four ports, increase the size of the srpt_device.port[] array. This patch avoids that the following warning is hit with quad port Chelsio adapters:
WARN_ON(sdev->device->phys_port_cnt > ARRAY_SIZE(sdev->port));
[bwh: Backported to 3.16:
- Use inline calculation instead of struct_size; the number of ports is not user-controlled so no overflow check is needed
- Adjust context]
---
drivers/infiniband/ulp/srpt/ib_srpt.c +3 -3
@@ -3147,7 +3147,9 @@ static void srpt_add_one(struct ib_devicpr_debug ("device = %p, device->dma_ops = %p\n" , device, device->dma_ops); - sdev =kzalloc (sizeof *sdev,GFP_KERNEL ); + sdev =kzalloc (sizeof (*sdev) + + device->phys_port_cnt *sizeof (*sdev->port), +GFP_KERNEL );if (!sdev) goto err;
@@ -3220,8 +3222,6 @@ static void srpt_add_one(struct ib_devicfor (i =0 ; i < sdev->srq_size; ++i)srpt_post_recv (sdev, sdev->ioctx_ring[i]); -WARN_ON (sdev->device->phys_port_cnt >ARRAY_SIZE (sdev->port)); -for (i =1 ; i <= sdev->device->phys_port_cnt; i++) { sport = &sdev->port[i -1 ]; sport->sdev = sdev;
drivers/infiniband/ulp/srpt/ib_srpt.h +2 -2
@@ -387,9 +387,9 @@ struct srpt_port {* @rch_list: Per-device channel list -- see also srpt_rdma_ch.list. * @ch_releaseQ: Enables waiting for removal from rch_list. * @spinlock: Protects rch_list and tpg. -* @port: Information about the ports owned by this HCA. * @event_handler: Per-HCA asynchronous IB event handler. * @list: Node in srpt_dev_list. +* @port: Information about the ports owned by this HCA. */ struct srpt_device {struct ib_device *device;
@@ -403,9 +403,9 @@ struct srpt_device {struct list_head rch_list;wait_queue_head_t ch_releaseQ;spinlock_t spinlock; -struct srpt_port port[2 ];struct ib_event_handler event_handler;struct list_head list; +struct srpt_port port[]; };/**
PATCH 21/328 libertas: fix suspend and resume for SDIO connected cards
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Mack <[email protected]>
commit 7444a8092906ed44c09459780c56ba57043e39b1 upstream.
Prior to commit 573185cc7e64 ("mmc: core: Invoke sdio func driver's PM callbacks from the sdio bus"), the MMC core used to call into the power management functions of SDIO clients itself and removed the card if the return code was non-zero. IOW, the mmc handled errors gracefully and didn't upchain them to the pm core.
Since this change, the mmc core relies on generic power management functions which treat all errors as a reason to cancel the suspend immediately. This causes suspend attempts to fail when the libertas driver is loaded.
To fix this, power down the card explicitly in if_sdio_suspend() when we know we're about to lose power and return success. Also set a flag in these cases, and power up the card again in if_sdio_resume().
--- drivers/net/wireless/libertas/dev.h | 1 + drivers/net/wireless/libertas/if_sdio.c | 30 +++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-)
drivers/net/wireless/libertas/dev.h +1 -0
@@ -102,6 +102,7 @@ struct lbs_private {u8 fw_ready;u8 surpriseremoved;u8 setup_fw_on_resume; +u8 power_up_on_resume;int (*hw_host_to_card) (struct lbs_private *priv,u8 type,u8 *payload,u16 nb);void (*reset_card) (struct lbs_private *priv);int (*power_save) (struct lbs_private *priv);
drivers/net/wireless/libertas/if_sdio.c +24 -6
@@ -1342,15 +1342,23 @@ static void if_sdio_remove(struct sdio_fstatic int if_sdio_suspend (struct device *dev) {struct sdio_func *func =dev_to_sdio_func (dev); -int ret;struct if_sdio_card *card =sdio_get_drvdata (func); +struct lbs_private *priv = card->priv; +int ret;mmc_pm_flag_t flags =sdio_get_host_pm_caps (func); + priv->power_up_on_resume = false;/* If we're powered off anyway, just let the mmc layer remove the * card. */ -if (!lbs_iface_active (card->priv)) -return -ENOSYS ; +if (!lbs_iface_active (priv)) { +if (priv->fw_ready) { + priv->power_up_on_resume = true; +if_sdio_power_off (card); + } + +return 0 ; + }dev_info (dev,"%s: suspend: PM flags = 0x%x\n" ,sdio_func_id (func), flags);
@@ -1358,9 +1366,14 @@ static int if_sdio_suspend(struct device/* If we aren't being asked to wake on anything, we should bail out * and let the SD stack power down the card. */ -if (card->priv->wol_criteria ==EHS_REMOVE_WAKEUP ) { +if (priv->wol_criteria ==EHS_REMOVE_WAKEUP ) {dev_info (dev,"Suspend without wake params -- powering down card\n" ); -return -ENOSYS ; +if (priv->fw_ready) { + priv->power_up_on_resume = true; +if_sdio_power_off (card); + } + +return 0 ; }if (!(flags &MMC_PM_KEEP_POWER )) {
@@ -1373,7 +1386,7 @@ static int if_sdio_suspend(struct deviceif (ret)return ret; - ret =lbs_suspend (card->priv); + ret =lbs_suspend (priv);if (ret)return ret;
@@ -1388,6 +1401,11 @@ static int if_sdio_resume(struct devicedev_info (dev,"%s: resume: we're back\n" ,sdio_func_id (func)); +if (card->priv->power_up_on_resume) { +if_sdio_power_on (card); +wait_event (card->pwron_waitq, card->priv->fw_ready); + } + ret =lbs_resume (card->priv);return ret;
PATCH 22/328 media: exynos4-is: Prevent NULL pointer dereference in __isp_video_try_fmt()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sylwester Nawrocki <[email protected]>
commit 7c1b9a5aeed91bef98988ac0fcf38c8c1f4f9a3a upstream.
This patch fixes potential NULL pointer dereference as indicated by the following static checker warning:
drivers/media/platform/exynos4-is/fimc-isp-video.c:408 isp_video_try_fmt_mplane()
error: NULL dereference inside function '__isp_video_try_fmt(isp, &f->fmt.pix_mp, (0))()'.
--- drivers/media/platform/exynos4-is/fimc-isp-video.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/media/platform/exynos4-is/fimc-isp-video.c +8 -3
@@ -390,12 +390,17 @@ static void __isp_video_try_fmt(struct fstruct v4l2_pix_format_mplane *pixm, const struct fimc_fmt **fmt) { - *fmt =fimc_isp_find_format (&pixm->pixelformat,NULL ,2 ); + const struct fimc_fmt *__fmt; + + __fmt =fimc_isp_find_format (&pixm->pixelformat,NULL ,2 ); + +if (fmt) + *fmt = __fmt; pixm->colorspace =V4L2_COLORSPACE_SRGB ; pixm->field =V4L2_FIELD_NONE ; - pixm->num_planes = (*fmt)->memplanes; - pixm->pixelformat = (*fmt)->fourcc; + pixm->num_planes = __fmt->memplanes; + pixm->pixelformat = __fmt->fourcc;/* * TODO: double check with the docmentation these width/height * constraints are correct.
PATCH 24/328 staging: rts5208: fix missing error check on call to rtsx_write_register
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit c5fae4f4fd28189b1062fb8ef7b21fec37cb8b17 upstream.
Currently the check on error return from the call to rtsx_write_register is checking the error status from the previous call. Fix this by adding in the missing assignment of retval.
Detected by CoverityScan, CID#709877
--- drivers/staging/rts5208/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rts5208/sd.c +1 -1
@@ -4276,7 +4276,7 @@ int sd_execute_write_data(struct scsi_cmif (retval !=STATUS_SUCCESS )TRACE_GOTO (chip, SD_Execute_Write_Cmd_Failed); -rtsx_write_register (chip,SD_BYTE_CNT_L ,0xFF ,0x00 ); + retval =rtsx_write_register (chip,SD_BYTE_CNT_L ,0xFF ,0x00 );if (retval !=STATUS_SUCCESS )TRACE_GOTO (chip, SD_Execute_Write_Cmd_Failed); }
PATCH 27/328 vxlan: fix a potential issue when create a new vxlan fdb entry.
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Haishuang Yan <[email protected]>
commit 17b463654f41f0aa334efd5a6efeab8a6e9496f7 upstream.
vxlan_fdb_append may return error, so add the proper check, otherwise it will cause memory leak.
Changes in v2:
- Unnecessary to initialize rc to zero.
--- drivers/net/vxlan.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/vxlan.c +7 -3
@@ -695,6 +695,7 @@ static int vxlan_fdb_create(struct vxlanstruct vxlan_rdst *rd =NULL ;struct vxlan_fdb *f;int notify =0 ; +int rc; f =__vxlan_find_mac (vxlan, mac);if (f) {
@@ -729,8 +730,7 @@ static int vxlan_fdb_create(struct vxlanif ((flags &NLM_F_APPEND ) && (is_multicast_ether_addr (f->eth_addr) ||is_zero_ether_addr (f->eth_addr))) { -int rc =vxlan_fdb_append (f, ip, port, vni, ifindex, - &rd); + rc =vxlan_fdb_append (f, ip, port, vni, ifindex, &rd);if (rc <0 )return rc;
@@ -760,7 +760,11 @@ static int vxlan_fdb_create(struct vxlanINIT_LIST_HEAD (&f->remotes);memcpy (f->eth_addr, mac,ETH_ALEN ); -vxlan_fdb_append (f, ip, port, vni, ifindex, &rd); + rc =vxlan_fdb_append (f, ip, port, vni, ifindex, &rd); +if (rc <0 ) { +kfree (f); +return rc; + } ++vxlan->addrcnt; hlist_add_head_rcu(&f->hlist,
PATCH 30/328 vmci: type promotion bug in qp_host_get_user_memory()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 7fb2fd4e25fc1fb10dcb30b5519de257cfeae84c upstream.
The problem is that if get_user_pages_fast() fails and returns a negative error code, it gets type promoted to a high positive value and treated as a success.
--- drivers/misc/vmw_vmci/vmci_queue_pair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/vmw_vmci/vmci_queue_pair.c +2 -2
@@ -735,7 +735,7 @@ static int qp_host_get_user_memory(u64 p retval =get_user_pages_fast ((uintptr_t ) produce_uva, produce_q->kernel_if->num_pages,1 , produce_q->kernel_if->u.h.header_page); -if (retval < produce_q->kernel_if->num_pages) { +if (retval < (int )produce_q->kernel_if->num_pages) {pr_warn ("get_user_pages(produce) failed (retval=%d)" , retval);qp_release_pages (produce_q->kernel_if->u.h.header_page, retval, false);
@@ -746,7 +746,7 @@ static int qp_host_get_user_memory(u64 p retval =get_user_pages_fast ((uintptr_t ) consume_uva, consume_q->kernel_if->num_pages,1 , consume_q->kernel_if->u.h.header_page); -if (retval < consume_q->kernel_if->num_pages) { +if (retval < (int )consume_q->kernel_if->num_pages) {pr_warn ("get_user_pages(consume) failed (retval=%d)" , retval);qp_release_pages (consume_q->kernel_if->u.h.header_page, retval, false);
PATCH 31/328 pinctrl: msm: Fix msm_config_group_get() to be compliant
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit 05e0c828955c1cab58dd71a04539442e5375d917 upstream.
If you do this on an sdm845 board:
cat /sys/kernel/debug/pinctrl/3400000.pinctrl/pinconf-groups
...it looks like nonsense. For every pin you see listed:
input bias bus hold, input bias disabled, input bias pull down, input bias pull up
That's because msm_config_group_get() isn't complying with the rules that pinconf_generic_dump_one() expects. Specifically for boolean parameters (anything with a "struct pin_config_item" where has_arg is false) the function expects that the function should return its value not through the "config" parameter but should return "0" if the value is set and "-EINVAL" if the value isn't set.
Let's fix this.
=46roma quick sample of other pinctrl drivers, it appears to be tradition to also return 1 through the config parameter for these boolean parameters when they exist. I'm not one to knock tradition, so I'll follow tradition and return 1 in these cases. While I'm at it, I'll also continue searching for four leaf clovers, kocking on wood three times, and trying not to break mirrors.
[bwh: Backported to 3.16:
- Drop change to case PIN_CONFIG_BIAS_BUS_HOLD
- Adjust filename, context]
--- drivers/pinctrl/pinctrl-msm.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-msm.c +8 -2
@@ -275,13 +275,19 @@ static int msm_config_group_get(struct p/* Convert register value to pinconf value */ switch (param) {case PIN_CONFIG_BIAS_DISABLE : - arg = arg ==MSM_NO_PULL ; +if (arg !=MSM_NO_PULL ) +return -EINVAL ; + arg =1 ;break ;case PIN_CONFIG_BIAS_PULL_DOWN : - arg = arg ==MSM_PULL_DOWN ; +if (arg !=MSM_PULL_DOWN ) +return -EINVAL ; + arg =1 ;break ;case PIN_CONFIG_BIAS_PULL_UP : arg = arg ==MSM_PULL_UP ; +if (!arg) +return -EINVAL ;break ;case PIN_CONFIG_DRIVE_STRENGTH : arg =msm_regval_to_drive (arg);
PATCH 32/328 ARM: tegra: Fix Tegra30 Cardhu PCA954x reset
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jon Hunter <[email protected]>
commit 6e1811900b6fe6f2b4665dba6bd6ed32c6b98575 upstream.
On all versions of Tegra30 Cardhu, the reset signal to the NXP PCA9546 I2C mux is connected to the Tegra GPIO BB0. Currently, this pin on the Tegra is not configured as a GPIO but as a special-function IO (SFIO) that is multiplexing the pin to an I2S controller. On exiting system suspend, I2C commands sent to the PCA9546 are failing because there is no ACK. Although it is not possible to see exactly what is happening to the reset during suspend, by ensuring it is configured as a GPIO and driven high, to de-assert the reset, the failures are no longer seen.
Please note that this GPIO is also used to drive the reset signal going to the camera connector on the board. However, given that there is no camera support currently for Cardhu, this should not have any impact.
--- arch/arm/boot/dts/tegra30-cardhu.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/tegra30-cardhu.dtsi +1 -0
@@ -193,6 +193,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x70>; + reset-gpio = <&gpio TEGRA_GPIO(BB, 0) GPIO_ACTIVE_LOW>; }; };
PATCH 33/328 pwm: tiehrpwm: Don't use emulation mode bits to control PWM output
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vignesh R <[email protected]>
commit aa49d628f6e016bcec8c6f8e704b9b18ee697329 upstream.
As per AM335x TRM SPRUH73P "15.2.2.11 ePWM Behavior During Emulation", TBCTL[15:14] only have effect during emulation suspend events (IOW, to stop PWM when debugging using a debugger). These bits have no effect on PWM output during normal running of system. Hence, remove code accessing these bits as they have no role in enabling/disabling PWMs.
---
drivers/pwm/pwm-tiehrpwm.c +1 -10
@@ -35,10 +35,6 @@#define TBCTL 0x00#define TBPRD 0x0A -#define TBCTL_RUN_MASK (BIT(15) | BIT(14)) -#define TBCTL_STOP_NEXT 0 -#define TBCTL_STOP_ON_CYCLE BIT(14) -#define TBCTL_FREE_RUN (BIT(15) | BIT(14))#define TBCTL_PRDLD_MASK BIT(3)#define TBCTL_PRDLD_SHDW 0#define TBCTL_PRDLD_IMDT BIT(3)
@@ -357,7 +353,7 @@ static int ehrpwm_pwm_enable(struct pwm_/* Channels polarity can be configured from action qualifier module */ configure_polarity (pc, pwm->hwpwm); -/* Enable TBCLK before enabling PWM device */ +/* Enable TBCLK */ ret =clk_enable (pc->tbclk);if (ret) { dev_err(chip->dev, "Failed to enable TBCLK for %s\n",
@@ -365,8 +361,6 @@ static int ehrpwm_pwm_enable(struct pwm_return ret; } -/* Enable time counter for free_run */ -ehrpwm_modify (pc->mmio_base,TBCTL ,TBCTL_RUN_MASK ,TBCTL_FREE_RUN );return 0 ; }
@@ -396,9 +390,6 @@ static void ehrpwm_pwm_disable(struct pw/* Disabling TBCLK on PWM disable */ clk_disable (pc->tbclk); -/* Stop Time base counter */ -ehrpwm_modify (pc->mmio_base,TBCTL ,TBCTL_RUN_MASK ,TBCTL_STOP_NEXT ); -/* Disable clock on PWM disable */ pm_runtime_put_sync (chip->dev); }
PATCH 34/328 pwm: tiehrpwm: Fix disabling of output of PWMs
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vignesh R <[email protected]>
commit 38dabd91ff0bde33352ca3cc65ef515599b77a05 upstream.
pwm-tiehrpwm driver disables PWM output by putting it in low output state via active AQCSFRC register in ehrpwm_pwm_disable(). But, the AQCSFRC shadow register is not updated. Therefore, when shadow AQCSFRC register is re-enabled in ehrpwm_pwm_enable() (say to enable second PWM output), previous settings are lost as shadow register value is loaded into active register. This results in things like PWMA getting enabled automatically, when PWMB is enabled and vice versa. Fix this by updating AQCSFRC shadow register as well during ehrpwm_pwm_disable().
--- drivers/pwm/pwm-tiehrpwm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pwm/pwm-tiehrpwm.c +2 -0
@@ -378,6 +378,8 @@ static void ehrpwm_pwm_disable(struct pw aqcsfrc_mask =AQCSFRC_CSFA_MASK ; } +/* Update shadow register first before modifying active register */ +ehrpwm_modify (pc->mmio_base,AQCSFRC , aqcsfrc_mask, aqcsfrc_val);/* * Changes to immediate action on Action Qualifier. This puts * Action Qualifier control on PWM output from next TBCLK
PATCH 10/328 rndis_wlan: potential buffer overflow in rndis_wlan_auth_indication()
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit ae636fb1554833ee5133ca47bf4b2791b6739c52 upstream.
This is a static checker fix, not something I have tested. The issue is that on the second iteration through the loop, we jump forward by le32_to_cpu(auth_req->length) bytes. The problem is that if the length is more than "buflen" then we end up with a negative "buflen". A negative buflen is type promoted to a high positive value and the loop continues but it's accessing beyond the end of the buffer.
I believe the "auth_req->length" comes from the firmware and if the firmware is malicious or buggy, you're already toasted so the impact of this bug is probably not very severe.
--- drivers/net/wireless/rndis_wlan.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/rndis_wlan.c +2 -0
@@ -2917,6 +2917,8 @@ static void rndis_wlan_auth_indication(swhile (buflen >=sizeof (*auth_req)) { auth_req = (void *)buf; +if (buflen <le32_to_cpu (auth_req->length)) +return ; type ="unknown" ; flags =le32_to_cpu (auth_req->flags); pairwise_error = false;
PATCH 90/328 ext4: check for NUL characters in extended attribute's name
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 7d95178c77014dbd8dce36ee40bbbc5e6c121ff5 upstream.
Extended attribute names are defined to be NUL-terminated, so the name must not contain a NUL character. This is important because there are places when remove extended attribute, the code uses strlen to determine the length of the entry. That should probably be fixed at some point, but code is currently really messy, so the simplest fix for now is to simply validate that the extended attributes are sane.
https://bugzilla.kernel.org/show_bug.cgi?id=200401
--- fs/ext4/xattr.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ext4/xattr.c +2 -0
@@ -193,6 +193,8 @@ ext4_xattr_check_names(struct ext4_xattrstruct ext4_xattr_entry *next =EXT4_XATTR_NEXT (e);if ((void *)next >= end)return -EIO ; +if (strnlen (e->e_name, e->e_name_len) != e->e_name_len) +return -EIO ; e = next; }
PATCH 140/328 ubifs: Check data node size before truncate
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 95a22d2084d72ea067d8323cc85677dba5d97cae upstream.
Check whether the size is within bounds before using it. If the size is not correct, abort and dump the bad data node.
--- fs/ubifs/journal.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/ubifs/journal.c +10 -1
@@ -1186,7 +1186,16 @@ int ubifs_jnl_truncate(struct ubifs_infoelse if (err) goto out_free;else { -if (le32_to_cpu (dn->size) <= dlen) +int dn_len =le32_to_cpu (dn->size); + +if (dn_len <=0 || dn_len >UBIFS_BLOCK_SIZE ) { +ubifs_err ("bad data node (block %u, inode %lu)" , + blk, inode->i_ino); +ubifs_dump_node (c, dn); + goto out_free; + } + +if (dn_len <= dlen) dlen =0 ;/* Nothing to do */ else {int compr_type =le16_to_cpu (dn->compr_type);
PATCH 142/328 mfd: sm501: Set coherent_dma_mask when creating subdevices
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 2f606da78230f09cf1a71fde6ee91d0c710fa2b2 upstream.
Instantiating the sm501 OHCI subdevice results in a kernel warning.
sm501-usb sm501-usb: SM501 OHCI
sm501-usb sm501-usb: new USB bus registered, assigned bus number 1
WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 ohci_init+0x194/0x2d8 Modules linked in: CPU: 0 PID: 1 Comm: swapper Tainted: G W
4.18.0-rc7-00178-g0b5b1f9a78b5 #1
PC is at ohci_init+0x194/0x2d8
PR is at ohci_init+0x168/0x2d8
PC : 8c27844c SP : 8f81dd94 SR : 40008001
TEA : 29613060
R0 : 00000000 R1 : 00000000 R2 : 00000000 R3 : 00000202 R4 : 8fa98b88 R5 : 8c277e68 R6 : 00000000 R7 : 00000000 R8 : 8f965814 R9 : 8c388100 R10 : 8fa98800 R11 : 8fa98928 R12 : 8c48302c R13 : 8fa98920 R14 : 8c48302c
MACH: 00000096 MACL: 0000017c GBR : 00000000 PR : 8c278420
Call trace: [<(ptrval)>] usb_add_hcd+0x1e8/0x6ec [<(ptrval)>] _dev_info+0x0/0x54 [<(ptrval)>] arch_local_save_flags+0x0/0x8 [<(ptrval)>] arch_local_irq_restore+0x0/0x24 [<(ptrval)>] ohci_hcd_sm501_drv_probe+0x114/0x2d8
...
Initialize coherent_dma_mask when creating SM501 subdevices to fix the problem.
--- drivers/mfd/sm501.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/sm501.c +1 -0
@@ -714,6 +714,7 @@ sm501_create_subdev(struct sm501_devdata smdev->pdev.name = name; smdev->pdev.id = sm->pdev_id; smdev->pdev.dev.parent = sm->dev; + smdev->pdev.dev.coherent_dma_mask =0xffffffff ;if (res_count) { smdev->pdev.resource = (struct resource *)(smdev+1 );
PATCH 94/328 IB/IPoIB: Set ah valid flag in multicast send flow
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Denis Drozdov <[email protected]>
commit 75da96067ade4e7854379ec2f7834f3497652b1a upstream.
The change of ipoib_ah data structure with adding "valid" flag and checks of ah->valid in ipoib_start_xmit affected multicast packet flow.
Since the multicast flow doesn't invoke path_rec_start, "ah->valid" flag remains unset, so that ipoib_start_xmit end up with neigh_refresh_path instead of sending the packet using neigh.
"ah->valid" has to be set in multicast send flow. As a result IPoIB starts sending packets via neigh immediately and eliminates 60sec delay of neigh keep alive interval.
The typical example of this issue are two sequential arpings:
arping 11.134.208.9 -> got response (mcast_send) arping 11.134.208.9 -> no response (ah->valid = 0)
--- drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/ipoib/ipoib_multicast.c +1 -0
@@ -734,6 +734,7 @@ out:if (neigh &&list_empty (&neigh->list)) {kref_get (&mcast->ah->ref); neigh->ah = mcast->ah; + neigh->ah->valid =1 ;list_add_tail (&neigh->list, &mcast->neigh_list); } }
PATCH 95/328 uio: potential double frees if __uio_register_device() fails
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit f019f07ecf6a6b8bd6d7853bce70925d90af02d1 upstream.
The uio_unregister_device() function assumes that if "info->uio_dev" is non-NULL that means "info" is fully allocated. Setting info->uio_de has to be the last thing in the function.
In the current code, if request_threaded_irq() fails then we return with info->uio_dev set to non-NULL but info is not fully allocated and it can lead to double frees.
--- drivers/uio/uio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/uio/uio.c +1 -2
@@ -852,8 +852,6 @@ int __uio_register_device(struct moduleif (ret) goto err_uio_dev_add_attributes; - info->uio_dev = idev; -if (info->irq && (info->irq !=UIO_IRQ_CUSTOM )) { ret =devm_request_irq (idev->dev, info->irq, uio_interrupt, info->irq_flags, info->name, idev);
@@ -861,6 +859,7 @@ int __uio_register_device(struct module goto err_request_irq; } + info->uio_dev = idev;return 0 ; err_request_irq:
PATCH 97/328 scsi: core: Avoid that SCSI device removal through sysfs triggers a deadlock
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 0ee223b2e1f67cb2de9c0e3247c510d846e74d63 upstream.
A long time ago the unfortunate decision was taken to add a self-deletion attribute to the sysfs SCSI device directory. That decision was unfortunate because self-deletion is really tricky. We can't drop that attribute because widely used user space software depends on it, namely the rescan-scsi-bus.sh script. Hence this patch that avoids that writing into that attribute triggers a deadlock. See also commit 7973cbd9fbd9 ("[PATCH] add sysfs attributes to scan and delete scsi_devices").
This patch avoids that self-removal triggers the following deadlock:
======================================================
WARNING: possible circular locking dependency detected 4.18.0-rc2-dbg+ #5 Not tainted
------------------------------------------------------
modprobe/6539 is trying to acquire lock:000000008323c4cd (kn->count#202){++++}, at: kernfs_remove_by_name_ns+0x45/0x90
but task is already holding lock:00000000a6ec2c69 (&shost->scan_mutex){+.+.}, at: scsi_remove_host+0x21/0x150 [scsi_mod]
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&shost->scan_mutex){+.+.}:
__mutex_lock+0xfe/0xc70
mutex_lock_nested+0x1b/0x20
scsi_remove_device+0x26/0x40 [scsi_mod]
sdev_store_delete+0x27/0x30 [scsi_mod]
dev_attr_store+0x3e/0x50
sysfs_kf_write+0x87/0xa0
kernfs_fop_write+0x190/0x230
__vfs_write+0xd2/0x3b0
vfs_write+0x101/0x270
ksys_write+0xab/0x120
__x64_sys_write+0x43/0x50
do_syscall_64+0x77/0x230
entry_SYSCALL_64_after_hwframe+0x49/0xbe-> #0 (kn->count#202){++++}:
lock_acquire+0xd2/0x260
__kernfs_remove+0x424/0x4a0
kernfs_remove_by_name_ns+0x45/0x90
remove_files.isra.1+0x3a/0x90
sysfs_remove_group+0x5c/0xc0
sysfs_remove_groups+0x39/0x60
device_remove_attrs+0x82/0xb0
device_del+0x251/0x580
__scsi_remove_device+0x19f/0x1d0 [scsi_mod]
scsi_forget_host+0x37/0xb0 [scsi_mod]
scsi_remove_host+0x9b/0x150 [scsi_mod]
sdebug_driver_remove+0x4b/0x150 [scsi_debug]
device_release_driver_internal+0x241/0x360
device_release_driver+0x12/0x20
bus_remove_device+0x1bc/0x290
device_del+0x259/0x580
device_unregister+0x1a/0x70
sdebug_remove_adapter+0x8b/0xf0 [scsi_debug]
scsi_debug_exit+0x76/0xe8 [scsi_debug]
__x64_sys_delete_module+0x1c1/0x280
do_syscall_64+0x77/0x230
entry_SYSCALL_64_after_hwframe+0x49/0xbeother info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&shost->scan_mutex);
lock(kn->count#202);
lock(&shost->scan_mutex); lock(kn->count#202);
*** DEADLOCK ***
2 locks held by modprobe/6539:
#0: 00000000efaf9298 (&dev->mutex){....}, at: device_release_driver_internal+0x68/0x360 #1: 00000000a6ec2c69 (&shost->scan_mutex){+.+.}, at: scsi_remove_host+0x21/0x150 [scsi_mod]
stack backtrace: CPU: 10 PID: 6539 Comm: modprobe Not tainted 4.18.0-rc2-dbg+ #5 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014 Call Trace: dump_stack+0xa4/0xf5 print_circular_bug.isra.34+0x213/0x221 __lock_acquire+0x1a7e/0x1b50 lock_acquire+0xd2/0x260 __kernfs_remove+0x424/0x4a0 kernfs_remove_by_name_ns+0x45/0x90 remove_files.isra.1+0x3a/0x90 sysfs_remove_group+0x5c/0xc0 sysfs_remove_groups+0x39/0x60 device_remove_attrs+0x82/0xb0 device_del+0x251/0x580 __scsi_remove_device+0x19f/0x1d0 [scsi_mod] scsi_forget_host+0x37/0xb0 [scsi_mod] scsi_remove_host+0x9b/0x150 [scsi_mod] sdebug_driver_remove+0x4b/0x150 [scsi_debug] device_release_driver_internal+0x241/0x360 device_release_driver+0x12/0x20 bus_remove_device+0x1bc/0x290 device_del+0x259/0x580 device_unregister+0x1a/0x70 sdebug_remove_adapter+0x8b/0xf0 [scsi_debug] scsi_debug_exit+0x76/0xe8 [scsi_debug] __x64_sys_delete_module+0x1c1/0x280 do_syscall_64+0x77/0x230 entry_SYSCALL_64_after_hwframe+0x49/0xbe
See also https://www.mail-archive.com/[email protected]/msg54525.html.
--- drivers/scsi/scsi_sysfs.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/scsi/scsi_sysfs.c +18 -2
@@ -651,8 +651,24 @@ static ssize_t sdev_store_delete(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - if (device_remove_file_self(dev, attr)) - scsi_remove_device(to_scsi_device(dev)); + struct kernfs_node *kn; + + kn =sysfs_break_active_protection (&dev->kobj, &attr->attr); +WARN_ON_ONCE (!kn); +/* +* Concurrent writes into the "delete" sysfs attribute may trigger +* concurrent calls to device_remove_file() and scsi_remove_device(). +* device_remove_file() handles concurrent removal calls by +* serializing these and by ignoring the second and later removal +* attempts. Concurrent calls of scsi_remove_device() are +* serialized. The second and later calls of scsi_remove_device() are +* ignored because the first call of that function changes the device +* state into SDEV_DEL. +*/ +device_remove_file (dev, attr); +scsi_remove_device (to_scsi_device (dev)); +if (kn) +sysfs_unbreak_active_protection (kn);return count; }; static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
PATCH 141/328 drm/i915: set DP Main Stream Attribute for color range on DDI platforms
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
commit 6209c285e7a5e68dbcdf8fd2456c6dd68433806b upstream.
Since Haswell we have no color range indication either in the pipe or port registers for DP. Instead, there's a separate register for setting the DP Main Stream Attributes (MSA) directly. The MSA register definition makes no references to colorimetry, just a vague reference to the DP spec. The connection to the color range was lost.
Apparently we've failed to set the proper MSA bit for limited, or CEA, range ever since the first DDI platforms. We've started setting other MSA parameters since commit dae847991a43 ("drm/i915: add intel_ddi_set_pipe_settings").
Without the crucial bit of information, the DP sink has no way of knowing the source is actually transmitting limited range RGB, leading to "washed out" colors. With the colorimetry information, compliant sinks should be able to handle the limited range properly. Native (i.e. non-LSPCON) HDMI was not affected because we do pass the color range via AVI infoframes.
Though not the root cause, the problem was made worse for DDI platforms with commit 55bc60db5988 ("drm/i915: Add "Automatic" mode for the "Broadcast RGB" property"), which selects limited range RGB automatically based on the mode, as per the DP, HDMI and CEA specs.
After all these years, the fix boils down to flipping one bit.
[Per testing reports, this fixes DP sinks, but not the LSPCON. My
educated guess is that the LSPCON fails to turn the CEA range MSA into AVI infoframes for HDMI.]
References: https://bugs.freedesktop.org/show_bug.cgi?id=100023
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107476
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94921
[bwh: Backported to 3.16:
- s/crtc_state->/intel_crtc->config./
- Adjust context, indentation]
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_ddi.c | 4 ++++ 2 files changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -5918,6 +5918,7 @@ enum punit_power_well {#define TRANS_MSA_10_BPC (2<<5)#define TRANS_MSA_12_BPC (3<<5)#define TRANS_MSA_16_BPC (4<<5) +#define TRANS_MSA_CEA_RANGE (1 << 3)/* LCPLL Control */ #define LCPLL_CTL 0x130040
drivers/gpu/drm/i915/intel_ddi.c +4 -0
@@ -929,6 +929,10 @@ void intel_ddi_set_pipe_settings(structif (type ==INTEL_OUTPUT_DISPLAYPORT || type ==INTEL_OUTPUT_EDP ) { temp =TRANS_MSA_SYNC_CLK ; + +if (intel_crtc->config.limited_color_range) + temp |=TRANS_MSA_CEA_RANGE ; +switch (intel_crtc->config.pipe_bpp) {case 18 : temp |=TRANS_MSA_6_BPC ;
PATCH 99/328 crypto: blkcipher - fix crash flushing dcache in error path
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 0868def3e4100591e7a1fdbf3eed1439cc8f7ca3 upstream.
Like the skcipher_walk case:
scatterwalk_done() is only meant to be called after a nonzero number of bytes have been processed, since scatterwalk_pagedone() will flush the dcache of the *previous* page. But in the error case of blkcipher_walk_done(), e.g. if the input wasn't an integer number of blocks, scatterwalk_done() was actually called after advancing 0 bytes. This caused a crash ("BUG: unable to handle kernel paging request") during '!PageSlab(page)' on architectures like arm and arm64 that define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE, provided that the input was page-aligned as in that case walk->offset == 0.
Fix it by reorganizing blkcipher_walk_done() to skip the scatterwalk_advance() and scatterwalk_done() if an error has occurred.
This bug was found by syzkaller fuzzing.
Reproducer, assuming ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE:
#include <linux/if_alg.h>
#include <sys/socket.h>
#include <unistd.h>
int main()
{
struct sockaddr_alg addr = {
.salg_type = "skcipher",
.salg_name = "ecb(aes-generic)",
};
char buffer[4096] __attribute__((aligned(4096))) = { 0 };
int fd;
fd = socket(AF_ALG, SOCK_SEQPACKET, 0);
bind(fd, (void *)&addr, sizeof(addr));
setsockopt(fd, SOL_ALG, ALG_SET_KEY, buffer, 16);
fd = accept(fd, NULL, NULL);
write(fd, buffer, 15);
read(fd, buffer, 15);
}--- crypto/blkcipher.c | 54 ++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 28 deletions(-)
crypto/blkcipher.c +26 -28
@@ -70,19 +70,18 @@ static inline u8 *blkcipher_get_spot(u8return max (start, end_page); } -static inline unsigned int blkcipher_done_slow (struct blkcipher_walk *walk, -unsigned int bsize) +static inline void blkcipher_done_slow (struct blkcipher_walk *walk, +unsigned int bsize) {u8 *addr; addr = (u8 *)ALIGN ((unsigned long )walk->buffer, walk->alignmask +1 ); addr =blkcipher_get_spot (addr, bsize);scatterwalk_copychunks (addr, &walk->out, bsize,1 ); -return bsize; } -static inline unsigned int blkcipher_done_fast (struct blkcipher_walk *walk, -unsigned int n) +static inline void blkcipher_done_fast (struct blkcipher_walk *walk, +unsigned int n) {if (walk->flags &BLKCIPHER_WALK_COPY ) {blkcipher_map_dst (walk);
@@ -96,49 +95,48 @@ static inline unsigned int blkcipher_donscatterwalk_advance (&walk->in, n);scatterwalk_advance (&walk->out, n); - -return n; }int blkcipher_walk_done (struct blkcipher_desc *desc,struct blkcipher_walk *walk,int err) { -unsigned int nbytes =0 ; +unsigned int n;/* bytes processed */ +bool more; -if (likely (err >=0 )) { -unsigned int n = walk->nbytes - err; +if (unlikely (err <0 )) + goto finish; -if (likely (!(walk->flags &BLKCIPHER_WALK_SLOW ))) - n =blkcipher_done_fast (walk, n); -else if (WARN_ON (err)) { + n = walk->nbytes - err; + walk->total -= n; + more = (walk->total !=0 ); + +if (likely (!(walk->flags &BLKCIPHER_WALK_SLOW ))) { +blkcipher_done_fast (walk, n); + }else { +if (WARN_ON (err)) { +/* unexpected case; didn't process all bytes */ err = -EINVAL ; - goto err; - }else - n =blkcipher_done_slow (walk, n); - - nbytes = walk->total - n; - err =0 ; + goto finish; + } +blkcipher_done_slow (walk, n); } -scatterwalk_done (&walk->in,0 , nbytes); -scatterwalk_done (&walk->out,1 , nbytes); - -err: - walk->total = nbytes; - walk->nbytes = nbytes; +scatterwalk_done (&walk->in,0 , more); +scatterwalk_done (&walk->out,1 , more); -if (nbytes) { +if (more) {crypto_yield (desc->flags);return blkcipher_walk_next (desc, walk); } - + err =0 ; +finish: + walk->nbytes =0 ;if (walk->iv != desc->info)memcpy (desc->info, walk->iv, walk->ivsize);if (walk->buffer != walk->page)kfree (walk->buffer);if (walk->page)free_page ((unsigned long )walk->page); -return err; }EXPORT_SYMBOL_GPL (blkcipher_walk_done);
PATCH 100/328 crypto: ablkcipher - fix crash flushing dcache in error path
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 318abdfbe708aaaa652c79fb500e9bd60521f9dc upstream.
Like the skcipher_walk and blkcipher_walk cases:
scatterwalk_done() is only meant to be called after a nonzero number of bytes have been processed, since scatterwalk_pagedone() will flush the dcache of the *previous* page. But in the error case of ablkcipher_walk_done(), e.g. if the input wasn't an integer number of blocks, scatterwalk_done() was actually called after advancing 0 bytes. This caused a crash ("BUG: unable to handle kernel paging request") during '!PageSlab(page)' on architectures like arm and arm64 that define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE, provided that the input was page-aligned as in that case walk->offset == 0.
Fix it by reorganizing ablkcipher_walk_done() to skip the scatterwalk_advance() and scatterwalk_done() if an error has occurred.
--- crypto/ablkcipher.c | 57 +++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 31 deletions(-)
crypto/ablkcipher.c +26 -31
@@ -72,11 +72,9 @@ static inline u8 *ablkcipher_get_spot(u8return max (start, end_page); } -static inline unsigned int ablkcipher_done_slow (struct ablkcipher_walk *walk, -unsigned int bsize) +static inline void ablkcipher_done_slow (struct ablkcipher_walk *walk, +unsigned int n) { -unsigned int n = bsize; -for (;;) {unsigned int len_this_page =scatterwalk_pagelen (&walk->out);
@@ -88,17 +86,13 @@ static inline unsigned int ablkcipher_do n -= len_this_page;scatterwalk_start (&walk->out,scatterwalk_sg_next (walk->out.sg)); } - -return bsize; } -static inline unsigned int ablkcipher_done_fast (struct ablkcipher_walk *walk, -unsigned int n) +static inline void ablkcipher_done_fast (struct ablkcipher_walk *walk, +unsigned int n) {scatterwalk_advance (&walk->in, n);scatterwalk_advance (&walk->out, n); - -return n; } static int ablkcipher_walk_next(struct ablkcipher_request *req,
@@ -108,39 +102,40 @@ int ablkcipher_walk_done(struct ablkciph struct ablkcipher_walk *walk, int err) {struct crypto_tfm *tfm = req->base.tfm; -unsigned int nbytes =0 ; +unsigned int n;/* bytes processed */ +bool more; -if (likely (err >=0 )) { -unsigned int n = walk->nbytes - err; +if (unlikely (err <0 )) + goto finish; -if (likely (!(walk->flags &ABLKCIPHER_WALK_SLOW ))) - n =ablkcipher_done_fast (walk, n); -else if (WARN_ON (err)) { + n = walk->nbytes - err; + walk->total -= n; + more = (walk->total !=0 ); + +if (likely (!(walk->flags &ABLKCIPHER_WALK_SLOW ))) { +ablkcipher_done_fast (walk, n); + }else { +if (WARN_ON (err)) { +/* unexpected case; didn't process all bytes */ err = -EINVAL ; - goto err; - }else - n =ablkcipher_done_slow (walk, n); - - nbytes = walk->total - n; - err =0 ; + goto finish; + } +ablkcipher_done_slow (walk, n); } -scatterwalk_done (&walk->in,0 , nbytes); -scatterwalk_done (&walk->out,1 , nbytes); +scatterwalk_done (&walk->in,0 , more); +scatterwalk_done (&walk->out,1 , more); -err: - walk->total = nbytes; - walk->nbytes = nbytes; - -if (nbytes) { +if (more) {crypto_yield (req->base.flags);return ablkcipher_walk_next (req, walk); } - + err =0 ; +finish: + walk->nbytes =0 ;if (walk->iv != req->info)memcpy (req->info, walk->iv, tfm->crt_ablkcipher.ivsize);kfree (walk->iv_buffer); -return err; }EXPORT_SYMBOL_GPL (ablkcipher_walk_done);
PATCH 101/328 pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: YueHaibing <[email protected]>
commit b5031b7db77dc47f474f0efc2b2552c32b7bb59d upstream.
fixes following Smatch static check warning:
drivers/pinctrl/berlin/berlin.c:237 berlin_pinctrl_build_state()
warn: passing devm_ allocated variable to kfree. 'pctrl->functions'
As we will be calling krealloc() on pointer 'pctrl->functions', which means kfree() will be called in there, devm_kzalloc() shouldn't be used with the allocation in the first place. Fix the warning by calling kcalloc() and managing the free procedure in error path on our own.
[bwh: Backported to 3.16: berlin_pinctrl_state() was not yet converted
to devm_kcalloc()]
--- drivers/pinctrl/berlin/berlin.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/pinctrl/berlin/berlin.c +8 -5
@@ -237,9 +237,8 @@ static int berlin_pinctrl_build_state(st }/* we will reallocate later */ - pctrl->functions =devm_kzalloc (&pdev->dev, - max_functions *sizeof (*pctrl->functions), -GFP_KERNEL ); + pctrl->functions =kcalloc (max_functions, +sizeof (*pctrl->functions),GFP_KERNEL );if (!pctrl->functions)return -ENOMEM ;
@@ -277,8 +276,10 @@ static int berlin_pinctrl_build_state(st function++; } -if (!found) +if (!found) { +kfree (pctrl->functions);return -EINVAL ; + }if (!function->groups) { function->groups =
@@ -286,8 +287,10 @@ static int berlin_pinctrl_build_state(st function->ngroups *sizeof (char *), GFP_KERNEL); -if (!function->groups) +if (!function->groups) { +kfree (pctrl->functions);return -ENOMEM ; + } } groups = function->groups;
PATCH 102/328 ieee802154: 6lowpan: ensure header compression does not corrupt ipv6 header
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Simon Vincent <[email protected]>
commit f19f4f9525cf32f97341fac20ce66392e86a1b67 upstream.
The 6lowpan ipv6 header compression was causing problems for other interfaces that expected a ipv6 header to still be in place, as we were replacing the ipv6 header with a compressed version. This happened if you sent a packet to a multicast address as the packet would be output on 802.15.4, ethernet, and also be sent to the loopback interface. The skb data was shared between these interfaces so all interfaces ended up with a compressed ipv6 header.
The solution is to ensure that before we do any header compression we are not sharing the skb or skb data with any other interface. If we are then we must take a copy of the skb and skb data before modifying the ipv6 header. The only place we can copy the skb is inside the xmit function so we don't leave dangling references to skb.
This patch moves all the header compression to inside the xmit function. Very little code has been changed it has mostly been moved from lowpan_header_create to lowpan_xmit. At the top of the xmit function we now check if the skb is shared and if so copy it. In lowpan_header_create all we do now is store the source and destination addresses for use later when we compress the header.
--- net/ieee802154/6lowpan_rtnl.c | 125 ++++++++++++++++++++++++---------- 1 file changed, 89 insertions(+), 36 deletions(-)
net/ieee802154/6lowpan_rtnl.c +89 -36
@@ -71,6 +71,21 @@ struct lowpan_dev_record {struct list_head list; }; +/* don't save pan id, it's intra pan */ +struct lowpan_addr { +u8 mode; +union { +/* IPv6 needs big endian here */ +__be64 extended_addr; +__be16 short_addr; + } u; +}; + +struct lowpan_addr_info { +struct lowpan_addr daddr; +struct lowpan_addr saddr; +}; +static inline struct lowpan_dev_info *lowpan_dev_info (const struct net_device *dev) {
@@ -84,6 +99,14 @@ static inline void lowpan_address_flip(u (dest)[IEEE802154_ADDR_LEN - i -1 ] = (src)[i]; } +static inline struct +lowpan_addr_info *lowpan_skb_priv (const struct sk_buff *skb) +{ +WARN_ON_ONCE (skb_headroom (skb) <sizeof (struct lowpan_addr_info )); +return (struct lowpan_addr_info *)(skb->data - +sizeof (struct lowpan_addr_info )); +} + static int lowpan_header_create(struct sk_buff *skb, struct net_device *dev, unsigned short type, const void *_daddr,
@@ -91,8 +114,7 @@ static int lowpan_header_create(struct s {const u8 *saddr = _saddr;const u8 *daddr = _daddr; -struct ieee802154_addr sa, da; -struct ieee802154_mac_cb *cb =mac_cb_init (skb); +struct lowpan_addr_info *info;/* TODO: * if this package isn't ipv6 one, where should it be routed?
@@ -106,41 +128,17 @@ static int lowpan_header_create(struct sraw_dump_inline (__func__,"saddr" , (unsigned char *)saddr,8 );raw_dump_inline (__func__,"daddr" , (unsigned char *)daddr,8 ); -lowpan_header_compress (skb, dev, type, daddr, saddr, len); - -/* NOTE1: I'm still unsure about the fact that compression and WPAN -* header are created here and not later in the xmit. So wait for -* an opinion of net maintainers. -*/ -/* NOTE2: to be absolutely correct, we must derive PANid information -* from MAC subif of the 'dev' and 'real_dev' network devices, but -* this isn't implemented in mainline yet, so currently we assign 0xff -*/ - cb->type =IEEE802154_FC_TYPE_DATA ; + info =lowpan_skb_priv (skb); -/* prepare wpan address data */ - sa.mode =IEEE802154_ADDR_LONG ; - sa.pan_id =ieee802154_mlme_ops (dev)->get_pan_id (dev); - sa.extended_addr =ieee802154_devaddr_from_raw (saddr); +/* TODO: Currently we only support extended_addr */ + info->daddr.mode =IEEE802154_ADDR_LONG ; +memcpy (&info->daddr.u.extended_addr, daddr, +sizeof (info->daddr.u.extended_addr)); + info->saddr.mode =IEEE802154_ADDR_LONG ; +memcpy (&info->saddr.u.extended_addr, saddr, +sizeof (info->daddr.u.extended_addr)); -/* intra-PAN communications */ - da.pan_id = sa.pan_id; - -/* if the destination address is the broadcast address, use the -* corresponding short address -*/ -if (lowpan_is_addr_broadcast (daddr)) { - da.mode =IEEE802154_ADDR_SHORT ; - da.short_addr =cpu_to_le16 (IEEE802154_ADDR_BROADCAST ); - }else { - da.mode =IEEE802154_ADDR_LONG ; - da.extended_addr =ieee802154_devaddr_from_raw (daddr); - } - - cb->ackreq = !lowpan_is_addr_broadcast (daddr); - -return dev_hard_header (skb,lowpan_dev_info (dev)->real_dev, - type, (void *)&da, (void *)&sa,0 ); +return 0 ; } static int lowpan_give_skb_to_devices(struct sk_buff *skb,
@@ -338,13 +336,68 @@ err:return rc; } +static int lowpan_header (struct sk_buff *skb,struct net_device *dev) +{ +struct ieee802154_addr sa, da; +struct ieee802154_mac_cb *cb =mac_cb_init (skb); +struct lowpan_addr_info info; +void *daddr, *saddr; + +memcpy (&info,lowpan_skb_priv (skb),sizeof (info)); + +/* TODO: Currently we only support extended_addr */ + daddr = &info.daddr.u.extended_addr; + saddr = &info.saddr.u.extended_addr; + +lowpan_header_compress (skb, dev,ETH_P_IPV6 , daddr, saddr, skb->len); + + cb->type =IEEE802154_FC_TYPE_DATA ; + +/* prepare wpan address data */ + sa.mode =IEEE802154_ADDR_LONG ; + sa.pan_id =ieee802154_mlme_ops (dev)->get_pan_id (dev); + sa.extended_addr =ieee802154_devaddr_from_raw (saddr); + +/* intra-PAN communications */ + da.pan_id = sa.pan_id; + +/* if the destination address is the broadcast address, use the +* corresponding short address +*/ +if (lowpan_is_addr_broadcast ((const u8 *)daddr)) { + da.mode =IEEE802154_ADDR_SHORT ; + da.short_addr =cpu_to_le16 (IEEE802154_ADDR_BROADCAST ); + cb->ackreq = false; + }else { + da.mode =IEEE802154_ADDR_LONG ; + da.extended_addr =ieee802154_devaddr_from_raw (daddr); + cb->ackreq = true; + } + +return dev_hard_header (skb,lowpan_dev_info (dev)->real_dev, +ETH_P_IPV6 , (void *)&da, (void *)&sa,0 ); +} +static netdev_tx_t lowpan_xmit (struct sk_buff *skb,struct net_device *dev) {struct ieee802154_hdr wpan_hdr; -int max_single; +int max_single, ret;pr_debug ("package xmit\n" ); +/* We must take a copy of the skb before we modify/replace the ipv6 +* header as the header could be used elsewhere +*/ + skb =skb_unshare (skb,GFP_ATOMIC ); +if (!skb) +return NET_XMIT_DROP ; + + ret =lowpan_header (skb, dev); +if (ret <0 ) { +kfree_skb (skb); +return NET_XMIT_DROP ; + } +if (ieee802154_hdr_peek (skb, &wpan_hdr) <0 ) {kfree_skb (skb);return NET_XMIT_DROP ;
PATCH 104/328 mac802154: common tx error path
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Varka Bhadram <[email protected]>
commit f55889128a776b51581394b20abd0b470304cf95 upstream.
This patch introduce the common error path on failure of Tx by inserting the label 'err_tx'.
--- net/mac802154/tx.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
net/mac802154/tx.c +8 -7
@@ -89,8 +89,7 @@ netdev_tx_t mac802154_tx(struct mac80215if (!(priv->phy->channels_supported[page] & (1 << chan))) {WARN_ON (1 ); -kfree_skb (skb); -return NETDEV_TX_OK ; + goto err_tx; }mac802154_monitors_rx (mac802154_to_priv (&priv->hw), skb);
@@ -102,12 +101,10 @@ netdev_tx_t mac802154_tx(struct mac80215 data[1 ] = crc >>8 ; } -if (skb_cow_head (skb, priv->hw.extra_tx_headroom)) { -kfree_skb (skb); -return NETDEV_TX_OK ; - } +if (skb_cow_head (skb, priv->hw.extra_tx_headroom)) + goto err_tx; - work =kzalloc (sizeof (struct xmit_work ),GFP_ATOMIC ); + work =kzalloc (sizeof (*work),GFP_ATOMIC );if (!work) {kfree_skb (skb);return NETDEV_TX_BUSY ;
@@ -128,4 +125,8 @@ netdev_tx_t mac802154_tx(struct mac80215queue_work (priv->dev_workqueue, &work->work);return NETDEV_TX_OK ; + +err_tx: +kfree_skb (skb); +return NETDEV_TX_OK ; }
PATCH 163/328 ext4: check to make sure the rename(2)'s destination is not freed
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit b50282f3241acee880514212d88b6049fb5039c8 upstream.
If the destination of the rename(2) system call exists, the inode's link count (i_nlinks) must be non-zero. If it is, the inode can end up on the orphan list prematurely, leading to all sorts of hilarity, including a use-after-free.
https://bugzilla.kernel.org/show_bug.cgi?id=200931
[bwh: Backported to 3.16:
- Return -EIO on error
- Adjust context]
--- fs/ext4/namei.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ext4/namei.c +6 -0
@@ -3211,6 +3211,12 @@ static int ext4_rename(struct inode *oldint force_reread;int retval; +if (new.inode && new.inode->i_nlink ==0 ) { +EXT4_ERROR_INODE (new.inode, +"target of rename is already freed" ); +return -EIO ; + } +dquot_initialize (old.dir);dquot_initialize (new.dir);
PATCH 164/328 x86/spectre: Add missing family 6 check to microcode check
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andi Kleen <[email protected]>
commit 1ab534e85c93945f7862378d8c8adcf408205b19 upstream.
The check for Spectre microcodes does not check for family 6, only the model numbers.
Add a family 6 check to avoid ambiguity with other families.
--- arch/x86/kernel/cpu/intel.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kernel/cpu/intel.c +3 -0
@@ -75,6 +75,9 @@ static bool bad_spectre_microcode(structif (cpu_has (c,X86_FEATURE_HYPERVISOR ))return false; +if (c->x86 !=6 ) +return false; +for (i =0 ; i <ARRAY_SIZE (spectre_bad_microcodes); i++) {if (c->x86_model == spectre_bad_microcodes[i].model && c->x86_mask == spectre_bad_microcodes[i].stepping)
PATCH 167/328 USB: serial: ti_usb_3410_5052: use functions rather than macros
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mathieu OTHACEHE <[email protected]>
commit d8d841e8332779fae2b18420d39ef407ea3729da upstream.
Functions are preferable to macros resembling functions.
---
drivers/usb/serial/ti_usb_3410_5052.c +11 -2
@@ -925,6 +925,15 @@ static void ti_break(struct tty_struct *dev_dbg (&port->dev,"%s - error setting break, %d\n" , __func__, status); } +static int ti_get_port_from_code (unsigned char code) +{ +return (code >>4 ) -3 ; +} + +static int ti_get_func_from_code (unsigned char code) +{ +return code &0x0f ; +}static void ti_interrupt_callback (struct urb *urb) {
@@ -966,8 +975,8 @@ static void ti_interrupt_callback(struct goto exit; } - port_number =TI_GET_PORT_FROM_CODE (data[0 ]); - function =TI_GET_FUNC_FROM_CODE (data[0 ]); + port_number =ti_get_port_from_code (data[0 ]); + function =ti_get_func_from_code (data[0 ]);dev_dbg (dev,"%s - port_number %d, function %d, data 0x%02X\n" , __func__, port_number, function, data[1 ]);
drivers/usb/serial/ti_usb_3410_5052.h +0 -2
@@ -227,8 +227,6 @@ struct ti_interrupt { } __attribute__((packed));/* Interrupt codes */ -#define TI_GET_PORT_FROM_CODE (c) (((c) >> 4) - 3) -#define TI_GET_FUNC_FROM_CODE (c) ((c) & 0x0f)#define TI_CODE_HARDWARE_ERROR 0xFF#define TI_CODE_DATA_ERROR 0x03#define TI_CODE_MODEM_STATUS 0x04
PATCH 168/328 USB: serial: ti_usb_3410_5052: fix array underflow in completion handler
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 5dfdd24eb3d39d815bc952ae98128e967c9bba49 upstream.
Similarly to a recently reported bug in io_ti, a malicious USB device could set port_number to a negative value and we would underflow the port array in the interrupt completion handler.
As these devices only have one or two ports, fix this by making sure we only consider the seventh bit when determining the port number (and ignore bits 0xb0 which are typically set to 0x30).
--- drivers/usb/serial/ti_usb_3410_5052.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/ti_usb_3410_5052.c +1 -1
@@ -927,7 +927,7 @@ static void ti_break(struct tty_struct *static int ti_get_port_from_code (unsigned char code) { -return (code >>4 ) -3 ; +return (code >>6 ) &0x01 ; }static int ti_get_func_from_code (unsigned char code)
PATCH 158/328 mm: move tlb_table_flush to tlb_flush_mmu_free
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Piggin <[email protected]>
commit db7ddef301128dad394f1c0f77027f86ee9a4edb upstream.
There is no need to call this from tlb_flush_mmu_tlbonly, it logically belongs with tlb_flush_mmu_free. This makes future fixes simpler.
[ This was originally done to allow code consolidation for the
mmu_notifier fix, but it also ends up helping simplify the
HAVE_RCU_TABLE_INVALIDATE fix. - Linus ]
--- mm/memory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/memory.c +3 -3
@@ -236,15 +236,15 @@ static void tlb_flush_mmu_tlbonly(struct { tlb->need_flush =0 ;tlb_flush (tlb); -#ifdef CONFIG_HAVE_RCU_TABLE_FREE -tlb_table_flush (tlb); -#endif }static void tlb_flush_mmu_free (struct mmu_gather *tlb) {struct mmu_gather_batch *batch; +#ifdef CONFIG_HAVE_RCU_TABLE_FREE +tlb_table_flush (tlb); +#endif for (batch = &tlb->local; batch; batch = batch->next) {free_pages_and_swap_cache (batch->pages, batch->nr); batch->nr =0 ;
PATCH 160/328 cifs: check kmalloc before use
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Mc Guire <[email protected]>
commit 126c97f4d0d1b5b956e8b0740c81a2b2a2ae548c upstream.
The kmalloc was not being checked - if it fails issue a warning and return -ENOMEM to the caller.
--- fs/cifs/sess.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/cifs/sess.c +6 -0
@@ -398,6 +398,12 @@ int build_ntlmssp_auth_blob(unsigned cha goto setup_ntlmv2_ret; } *pbuffer =kmalloc (size_of_ntlmssp_blob (ses),GFP_KERNEL ); +if (!*pbuffer) { + rc = -ENOMEM ; +cifs_dbg (VFS ,"Error %d during NTLMSSP allocation\n" , rc); + *buflen =0 ; + goto setup_ntlmv2_ret; + } sec_blob = (AUTHENTICATE_MESSAGE *)*pbuffer;memcpy (sec_blob->Signature,NTLMSSP_SIGNATURE ,8 );
PATCH 162/328 hwmon: (nct6775) Fix potential Spectre v1
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Gustavo A. R. Silva" <[email protected]>
commit d49dbfade96d5b0863ca8a90122a805edd5ef50a upstream.
val can be indirectly controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability.
This issue was detected with the help of Smatch:
vers/hwmon/nct6775.c:2698 store_pwm_weight_temp_sel() warn: potential spectre issue 'data->temp_src' [r]
Fix this by sanitizing val before using it to index data->temp_src
Notice that given that speculation windows are large, the policy is to kill the speculation on the first load and not worry if it can be completed with a dependent load/store [1].
[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2
--- drivers/hwmon/nct6775.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hwmon/nct6775.c +2 -0
@@ -57,6 +57,7 @@#include <linux/mutex.h> #include <linux/acpi.h> #include <linux/io.h> +#include <linux/nospec.h> #include "lm75.h" #define USE_ALTERNATE
@@ -2438,6 +2439,7 @@ store_pwm_weight_temp_sel(struct devicereturn err;if (val >NUM_TEMP )return -EINVAL ; + val =array_index_nospec (val,NUM_TEMP +1 );if (val && (!(data->have_temp & (1 << (val -1 ))) || !data->temp_src[val -1 ]))return -EINVAL ;
PATCH 169/328 ext4: avoid divide by zero fault when deleting corrupted inline directories
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 4d982e25d0bdc83d8c64e66fdeca0b89240b3b85 upstream.
A specially crafted file system can trick empty_inline_dir() into reading past the last valid entry in a inline directory, and then run into the end of xattr marker. This will trigger a divide by zero fault. Fix this by using the size of the inline directory instead of dir->i_size.
Also clean up error reporting in __ext4_check_dir_entry so that the message is clearer and more understandable --- and avoids the division by zero trap if the size passed in is zero. (I'm not sure why we coded it that way in the first place; printing offset % size is actually more confusing and less useful.)
https://bugzilla.kernel.org/show_bug.cgi?id=200933
--- fs/ext4/dir.c | 20 +++++++++----------- fs/ext4/inline.c | 4 +++- 2 files changed, 12 insertions(+), 12 deletions(-)
fs/ext4/dir.c +9 -11
@@ -77,7 +77,7 @@ int __ext4_check_dir_entry(const char *felse if (unlikely (rlen <EXT4_DIR_REC_LEN (de->name_len))) error_msg ="rec_len is too small for name_len" ;else if (unlikely (((char *) de - buf) + rlen > size)) - error_msg ="directory entry across range" ; + error_msg ="directory entry overrun" ;else if (unlikely (le32_to_cpu (de->inode) >le32_to_cpu (EXT4_SB (dir->i_sb)->s_es->s_inodes_count))) error_msg ="inode out of bounds" ;
@@ -86,18 +86,16 @@ int __ext4_check_dir_entry(const char *fif (filp)ext4_error_file (filp, function, line, bh->b_blocknr, -"bad entry in directory: %s - offset=%u(%u), " -"inode=%u, rec_len=%d, name_len=%d" , - error_msg, (unsigned ) (offset % size), - offset,le32_to_cpu (de->inode), - rlen, de->name_len); +"bad entry in directory: %s - offset=%u, " +"inode=%u, rec_len=%d, name_len=%d, size=%d" , + error_msg, offset,le32_to_cpu (de->inode), + rlen, de->name_len, size);else ext4_error_inode (dir, function, line, bh->b_blocknr, -"bad entry in directory: %s - offset=%u(%u), " -"inode=%u, rec_len=%d, name_len=%d" , - error_msg, (unsigned ) (offset % size), - offset,le32_to_cpu (de->inode), - rlen, de->name_len); +"bad entry in directory: %s - offset=%u, " +"inode=%u, rec_len=%d, name_len=%d, size=%d" , + error_msg, offset,le32_to_cpu (de->inode), + rlen, de->name_len, size);return 1 ; }
fs/ext4/inline.c +3 -1
@@ -1741,6 +1741,7 @@ int empty_inline_dir(struct inode *dir, {int err, inline_size;struct ext4_iloc iloc; +size_t inline_len;void *inline_pos;unsigned int offset;struct ext4_dir_entry_2 *de;
@@ -1768,8 +1769,9 @@ int empty_inline_dir(struct inode *dir, goto out; } + inline_len =ext4_get_inline_size (dir); offset =EXT4_INLINE_DOTDOT_SIZE ; -while (offset < dir->i_size) { +while (offset < inline_len) { de =ext4_get_inline_entry (dir, &iloc, offset, &inline_pos, &inline_size); if (ext4_check_dir_entry(dir, NULL, de,
PATCH 170/328 usb: gadget: udc: net2280: do not rely on 'driver' argument
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Felipe Balbi <[email protected]>
commit bfd0ed576dbf9cc71af7dbe42841fc9246524961 upstream.
future patches will remove the extra 'driver' argument to ->udc_stop(), in order to do that, we must make sure that our UDC does not rely on it first.
--- drivers/usb/gadget/net2280.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/gadget/net2280.c +3 -4
@@ -1956,11 +1956,9 @@ static int net2280_stop(struct usb_gadge dev = container_of (_gadget, struct net2280, gadget);spin_lock_irqsave (&dev->lock, flags); -stop_activity (dev, driver); +stop_activity (dev,NULL );spin_unlock_irqrestore (&dev->lock, flags); - dev->driver =NULL ; -net2280_led_active (dev,0 );/* Disable full-speed test mode */
@@ -1970,7 +1968,8 @@ static int net2280_stop(struct usb_gadgedevice_remove_file (&dev->pdev->dev, &dev_attr_queues);DEBUG (dev,"unregistered driver '%s'\n" , - driver ? driver->driver.name :"" ); + dev->driver ? dev->driver->driver.name :"" ); + dev->driver =NULL ;return 0 ; }
PATCH 171/328 usb: gadget: net2280: fix pullup handling
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mian Yousaf Kaukab <[email protected]>
commit 11bece5e063ca567e631c6ea3b1611c10dbc3282 upstream.
Gadget must be informed about disconnection when pullup is removed.
---
drivers/usb/gadget/net2280.c +12 -5
@@ -139,6 +139,10 @@ static char *type_string (u8 bmAttribute#define valid_bit cpu_to_le32 (1 << VALID_BIT)#define dma_done_ie cpu_to_le32 (1 << DMA_DONE_INTERRUPT_ENABLE) +static void stop_activity (struct net2280 *dev, +struct usb_gadget_driver *driver); +static void ep0_start (struct net2280 *dev); +/*-------------------------------------------------------------------------*/ static int
@@ -1390,11 +1394,14 @@ static int net2280_pullup(struct usb_gadspin_lock_irqsave (&dev->lock, flags); tmp =readl (&dev->usb->usbctl); dev->softconnect = (is_on !=0 ); -if (is_on) - tmp |= (1 <<USB_DETECT_ENABLE ); -else - tmp &= ~(1 <<USB_DETECT_ENABLE ); -writel (tmp, &dev->usb->usbctl); +if (is_on) { +ep0_start (dev); +writel (tmp |BIT (USB_DETECT_ENABLE ), &dev->usb->usbctl); + }else { +writel (tmp & ~BIT (USB_DETECT_ENABLE ), &dev->usb->usbctl); +stop_activity (dev, dev->driver); + } +spin_unlock_irqrestore (&dev->lock, flags);return 0 ;
PATCH 173/328 ipv6: fix cleanup ordering for pingv6 registration
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
commit a03dc36bdca6b614651fedfcd8559cf914d2d21d upstream.
Commit 6d0bfe226116 ("net: ipv6: Add IPv6 support to the ping socket.") contains an error in the cleanup path of inet6_init(): when proto_register(&pingv6_prot, 1) fails, we try to unregister &pingv6_prot. When rawv6_init() fails, we skip unregistering &pingv6_prot.
Example of panic (triggered by faking a failure of
proto_register(&pingv6_prot, 1)):
general protection fault: 0000 [#1] PREEMPT SMP KASAN PTI
[...]
RIP: 0010:__list_del_entry_valid+0x79/0x160
[...]
Call Trace:
proto_unregister+0xbb/0x550
? trace_preempt_on+0x6f0/0x6f0
? sock_no_shutdown+0x10/0x10
inet6_init+0x153/0x1b8--- net/ipv6/af_inet6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv6/af_inet6.c +2 -2
@@ -860,14 +860,14 @@ static int __init inet6_init(void) err =proto_register (&pingv6_prot,1 );if (err) - goto out_unregister_ping_proto; + goto out_unregister_raw_proto;/* We MUST register RAW sockets before we create the ICMP6, * IGMP6, or NDISC control sockets. */ err =rawv6_init ();if (err) - goto out_unregister_raw_proto; + goto out_unregister_ping_proto;/* Register the family here so that the init calls below will * be able to create sockets. (?? is this dangerous ??)
PATCH 174/328 cfg80211: nl80211_update_ft_ies() to validate NL80211_ATTR_IE
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arunk Khandavalli <[email protected]>
commit 4f0223bfe9c3e62d8f45a85f1ef1b18a8a263ef9 upstream.
nl80211_update_ft_ies() tried to validate NL80211_ATTR_IE with is_valid_ie_attr() before dereferencing it, but that helper function returns true in case of NULL pointer (i.e., attribute not included). This can result to dereferencing a NULL pointer. Fix that by explicitly checking that NL80211_ATTR_IE is included.
--- net/wireless/nl80211.c | 1 + 1 file changed, 1 insertion(+)
net/wireless/nl80211.c +1 -0
@@ -9185,6 +9185,7 @@ static int nl80211_update_ft_ies(structreturn -EOPNOTSUPP ;if (!info->attrs[NL80211_ATTR_MDID ] || + !info->attrs[NL80211_ATTR_IE ] || !is_valid_ie_attr (info->attrs[NL80211_ATTR_IE ]))return -EINVAL ;
PATCH 176/328 x86/microcode/intel: Add a helper which gives the microcode revision
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <[email protected]>
commit 4167709bbf826512a52ebd6aafda2be104adaec9 upstream.
Since on Intel we're required to do CPUID(1) first, before reading the microcode revision MSR, let's add a special helper which does the required steps so that we don't forget to do them next time, when we want to read the microcode revision.
[bwh: Backported to 3.16:
- Don't touch prev_rev variable in apply_microcode()
- Keep using sync_core(), which will alway includes the necessary CPUID
- Adjust filename, context]
---
arch/x86/include/asm/microcode_intel.h +15 -0
@@ -63,6 +63,21 @@ extern int get_matching_sig(unsigned intextern int update_match_revision (struct microcode_header_intel *mc_header,int rev); +static inline u32 intel_get_microcode_revision (void ) +{ +u32 rev, dummy; + +native_wrmsrl (MSR_IA32_UCODE_REV ,0 ); + +/* As documented in the SDM: Do a CPUID 1 here */ +sync_core (); + +/* get the current revision from MSR 0x8B */ +native_rdmsr (MSR_IA32_UCODE_REV , dummy, rev); + +return rev; +} +#ifdef CONFIG_MICROCODE_INTEL_EARLY extern void __init load_ucode_intel_bsp (void );extern void load_ucode_intel_ap (void );
arch/x86/kernel/cpu/intel.c +3 -8
@@ -14,6 +14,7 @@#include <asm/bugs.h> #include <asm/cpu.h> #include <asm/intel-family.h> +#include <asm/microcode_intel.h> #ifdef CONFIG_X86_64 #include <linux/topology.h>
@@ -103,14 +104,8 @@ static void early_init_intel(struct cpui (c->x86 == 0x6 && c->x86_model >= 0x0e))set_cpu_cap (c,X86_FEATURE_CONSTANT_TSC ); -if (c->x86 >=6 && !cpu_has (c,X86_FEATURE_IA64 )) { -unsigned lower_word; - -wrmsr (MSR_IA32_UCODE_REV ,0 ,0 ); -/* Required by the SDM */ -sync_core (); -rdmsr (MSR_IA32_UCODE_REV , lower_word, c->microcode); - } +if (c->x86 >=6 && !cpu_has (c,X86_FEATURE_IA64 )) + c->microcode =intel_get_microcode_revision ();/* Now if any of them are set, check the blacklist and clear the lot */ if ((cpu_has(c, X86_FEATURE_SPEC_CTRL) ||
arch/x86/kernel/cpu/microcode/intel.c +6 -11
@@ -134,9 +134,9 @@ int apply_microcode(int cpu) {struct microcode_intel *mc_intel;struct ucode_cpu_info *uci; -unsigned int val[2 ];int cpu_num =raw_smp_processor_id ();struct cpuinfo_x86 *c = &cpu_data (cpu_num); +u32 rev; uci = ucode_cpu_info + cpu; mc_intel = uci->mc;
@@ -159,27 +159,22 @@ int apply_microcode(int cpu)wrmsr (MSR_IA32_UCODE_WRITE , (unsigned long ) mc_intel->bits, (unsigned long ) mc_intel->bits >>16 >>16 ); -wrmsr (MSR_IA32_UCODE_REV ,0 ,0 ); -/* As documented in the SDM: Do a CPUID 1 here */ -sync_core (); + rev =intel_get_microcode_revision (); -/* get the current revision from MSR 0x8B */ -rdmsr (MSR_IA32_UCODE_REV , val[0 ], val[1 ]); - -if (val[1 ] != mc_intel->hdr.rev) { +if (rev != mc_intel->hdr.rev) {pr_err ("CPU%d update to revision 0x%x failed\n" , cpu_num, mc_intel->hdr.rev);return -1 ; }pr_info ("CPU%d updated to revision 0x%x, date = %04x-%02x-%02x\n" , - cpu_num, val[1 ], + cpu_num, rev, mc_intel->hdr.date &0xffff , mc_intel->hdr.date >>24 , (mc_intel->hdr.date >>16 ) &0xff ); - uci->cpu_sig.rev = val[1 ]; - c->microcode = val[1 ]; + uci->cpu_sig.rev = rev; + c->microcode = rev;return 0 ; }
arch/x86/kernel/cpu/microcode/intel_early.c +5 -17
@@ -391,15 +391,8 @@ static int collect_cpu_info_early(structnative_rdmsr (MSR_IA32_PLATFORM_ID , val[0 ], val[1 ]); csig.pf =1 << ((val[1 ] >>18 ) &7 ); } -native_wrmsr (MSR_IA32_UCODE_REV ,0 ,0 ); -/* As documented in the SDM: Do a CPUID 1 here */ -sync_core (); - -/* get the current revision from MSR 0x8B */ -native_rdmsr (MSR_IA32_UCODE_REV , val[0 ], val[1 ]); - - csig.rev = val[1 ]; + csig.rev =intel_get_microcode_revision (); uci->cpu_sig = csig; uci->valid =1 ;
@@ -654,7 +647,7 @@ static int apply_microcode_early(struct struct ucode_cpu_info *uci) {struct microcode_intel *mc_intel; -unsigned int val[2 ]; +u32 rev; mc_intel = uci->mc;if (mc_intel ==NULL )
@@ -664,21 +657,16 @@ static int apply_microcode_early(structnative_wrmsr (MSR_IA32_UCODE_WRITE , (unsigned long ) mc_intel->bits, (unsigned long ) mc_intel->bits >>16 >>16 ); -native_wrmsr (MSR_IA32_UCODE_REV ,0 ,0 ); - -/* As documented in the SDM: Do a CPUID 1 here */ -sync_core (); -/* get the current revision from MSR 0x8B */ -native_rdmsr (MSR_IA32_UCODE_REV , val[0 ], val[1 ]); -if (val[1 ] != mc_intel->hdr.rev) + rev =intel_get_microcode_revision (); +if (rev != mc_intel->hdr.rev)return -1 ;#ifdef CONFIG_X86_64 /* Flush global tlb. This is precaution. */ flush_tlb_early ();#endif - uci->cpu_sig.rev = val[1 ]; + uci->cpu_sig.rev = rev;print_ucode (uci);
PATCH 161/328 net: macb: do not disable MDIO bus at open/close time
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Anssi Hannula <[email protected]>
commit 0da70f808029476001109b6cb076737bc04cea2e upstream.
macb_reset_hw() is called from macb_close() and indirectly from macb_open(). macb_reset_hw() zeroes the NCR register, including the MPE (Management Port Enable) bit.
This will prevent accessing any other PHYs for other Ethernet MACs on the MDIO bus, which remains registered at macb_reset_hw() time, until macb_init_hw() is called from macb_open() which sets the MPE bit again.
I.e. currently the MDIO bus has a short disruption at open time and is disabled at close time until the interface is opened again.
Fix that by only touching the RE and TE bits when enabling and disabling RX/TX.
v2: Make macb_init_hw() NCR write a single statement.
---
drivers/net/ethernet/cadence/macb.c +7 -3
@@ -1257,14 +1257,18 @@ static void macb_init_rings(struct macbstatic void macb_reset_hw (struct macb *bp) { +u32 ctrl =macb_readl (bp,NCR ); +/* * Disable RX and TX (XXX: Should we halt the transmission * more gracefully?) */ -macb_writel (bp,NCR ,0 ); + ctrl &= ~(MACB_BIT (RE ) |MACB_BIT (TE ));/* Clear the stats registers (XXX: Update stats first?) */ -macb_writel (bp,NCR ,MACB_BIT (CLRSTAT )); + ctrl |=MACB_BIT (CLRSTAT ); + +macb_writel (bp,NCR , ctrl);/* Clear all status flags */ macb_writel (bp,TSR ,-1 );
@@ -1400,7 +1404,7 @@ static void macb_init_hw(struct macb *bpmacb_writel (bp,TBQP , bp->tx_ring_dma);/* Enable TX and RX */ -macb_writel (bp,NCR ,MACB_BIT (RE ) |MACB_BIT (TE ) |MACB_BIT (MPE )); +macb_writel (bp,NCR ,macb_readl (bp,NCR ) |MACB_BIT (RE ) |MACB_BIT (TE ));/* Enable interrupts */ macb_writel(bp, IER, (MACB_RX_INT_FLAGS
PATCH 172/328 USB: net2280: Fix erroneous synchronization change
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit dec3c23c9aa1815f07d98ae0375b4cbc10971e13 upstream.
Commit f16443a034c7 ("USB: gadgetfs, dummy-hcd, net2280: fix locking for callbacks") was based on a serious misunderstanding. It introduced regressions into both the dummy-hcd and net2280 drivers.
The problem in dummy-hcd was fixed by commit 7dbd8f4cabd9 ("USB:
dummy-hcd: Fix erroneous synchronization change"), but the problem in net2280 remains. Namely: the ->disconnect(), ->suspend(), ->resume(), and ->reset() callbacks must be invoked without the private lock held; otherwise a deadlock will occur when the callback routine tries to interact with the UDC driver.
This patch largely is a reversion of the relevant parts of f16443a034c7. It also drops the private lock around the calls to ->suspend() and ->resume() (something the earlier patch forgot to do). This is safe from races with device interrupts because it occurs within the interrupt handler.
Finally, the patch changes where the ->disconnect() callback is invoked when net2280_pullup() turns the pullup off. Rather than making the callback from within stop_activity() at a time when dropping the private lock could be unsafe, the callback is moved to a point after the lock has already been dropped.
[bwh: Backported to 3.16:
- Drop inapplicable change to disconnection handling in handle_stat1_irqs()
- Adjust filename, context]
---
drivers/usb/gadget/net2280.c +12 -2
@@ -1399,11 +1399,14 @@ static int net2280_pullup(struct usb_gadwritel (tmp |BIT (USB_DETECT_ENABLE ), &dev->usb->usbctl); }else {writel (tmp & ~BIT (USB_DETECT_ENABLE ), &dev->usb->usbctl); -stop_activity (dev, dev->driver); +stop_activity (dev,NULL ); }spin_unlock_irqrestore (&dev->lock, flags); +if (!is_on && dev->driver) + dev->driver->disconnect (&dev->gadget); +return 0 ; }
@@ -1948,8 +1951,11 @@ stop_activity (struct net2280 *dev, strunuke (&dev->ep [i]);/* report disconnect; the driver is already quiesced */ -if (driver) +if (driver) { +spin_unlock (&dev->lock); driver->disconnect (&dev->gadget); +spin_lock (&dev->lock); + }usb_reinit (dev); }
@@ -2452,6 +2458,8 @@ next_endpoints: | (1 << PCI_RETRY_ABORT_INTERRUPT))static void handle_stat1_irqs (struct net2280 *dev,u32 stat) +__releases(dev->lock) +__acquires(dev->lock) {struct net2280_ep *ep;u32 tmp, num, mask, scratch;
@@ -2494,6 +2502,7 @@ static void handle_stat1_irqs (struct ne tmp = (1 <<SUSPEND_REQUEST_CHANGE_INTERRUPT );if (stat & tmp) {writel (tmp, &dev->regs->irqstat1); +spin_unlock (&dev->lock);if (stat & (1 <<SUSPEND_REQUEST_INTERRUPT )) {if (dev->driver->suspend) dev->driver->suspend (&dev->gadget);
@@ -2504,6 +2513,7 @@ static void handle_stat1_irqs (struct ne dev->driver->resume (&dev->gadget);/* at high speed, note erratum 0133 */ } +spin_lock (&dev->lock); stat &= ~tmp; }
PATCH 159/328 mm/tlb: Remove tlb_remove_table() non-concurrent condition
In reply to Ben Hutchings3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit a6f572084fbee8b30f91465f4a085d7a90901c57 upstream.
Will noted that only checking mm_users is incorrect; we should also check mm_count in order to cover CPUs that have a lazy reference to this mm (and could do speculative TLB operations).
If removing this turns out to be a performance issue, we can re-instate a more complete check, but in tlb_table_flush() eliding the call_rcu_sched().
--- mm/memory.c | 9 --------- 1 file changed, 9 deletions(-)
mm/memory.c +0 -9
@@ -359,15 +359,6 @@ void tlb_remove_table(struct mmu_gather tlb->need_flush =1 ; -/* -* When there's less then two users of this mm there cannot be a -* concurrent page-table walk. -*/ -if (atomic_read (&tlb->mm->mm_users) <2 ) { -__tlb_remove_table (table); -return ; - } -if (*batch ==NULL ) { *batch = (struct mmu_table_batch *)__get_free_page (GFP_NOWAIT | __GFP_NOWARN);if (*batch ==NULL ) {