3.16.39-rc1 review
Subsystems (11)
PATCH 329/346 arm64: perf: reject groups spanning multiple HW PMUs
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Suzuki K. Poulose" <[email protected]>
commit 8fff105e13041e49b82f92eef034f363a6b1c071 upstream.
The perf core implicitly rejects events spanning multiple HW PMUs, as in these cases the event->ctx will differ. However this validation is performed after pmu::event_init() is called in perf_init_event(), and thus pmu::event_init() may be called with a group leader from a different HW PMU.
The ARM64 PMU driver does not take this fact into account, and when validating groups assumes that it can call to_arm_pmu(event->pmu) for any HW event. When the event in question is from another HW PMU this is wrong, and results in dereferencing garbage.
This patch updates the ARM64 PMU driver to first test for and reject events from other PMUs, moving the to_arm_pmu and related logic after this test. Fixes a crash triggered by perf_fuzzer on Linux-4.0-rc2, with a CCI PMU present:
Bad mode in Synchronous Abort handler detected, code 0x86000006 -- IABT (current EL)
CPU: 0 PID: 1371 Comm: perf_fuzzer Not tainted 3.19.0+ #249 Hardware name: V2F-1XV7 Cortex-A53x2 SMM (DT) task: ffffffc07c73a280 ti: ffffffc07b0a0000 task.ti: ffffffc07b0a0000 PC is at 0x0 LR is at validate_event+0x90/0xa8 pc : [<0000000000000000>] lr : [<ffffffc000090228>] pstate: 00000145
sp : ffffffc07b0a3ba0
[< (null)>] (null)
[<ffffffc0000907d8>] armpmu_event_init+0x174/0x3cc [<ffffffc00015d870>] perf_try_init_event+0x34/0x70 [<ffffffc000164094>] perf_init_event+0xe0/0x10c [<ffffffc000164348>] perf_event_alloc+0x288/0x358 [<ffffffc000164c5c>] SyS_perf_event_open+0x464/0x98c Code: bad PC value
Also cleans up the code to use the arm_pmu only when we know that we are dealing with an arm pmu event.
--- arch/arm64/kernel/perf_event.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
arch/arm64/kernel/perf_event.c +15 -6
@@ -316,22 +316,31 @@ out: }static int -validate_event (struct pmu_hw_events *hw_events, -struct perf_event *event) +validate_event (struct pmu *pmu,struct pmu_hw_events *hw_events, +struct perf_event *event) { -struct arm_pmu *armpmu =to_arm_pmu (event->pmu); +struct arm_pmu *armpmu;struct hw_perf_event fake_event = event->hw;struct pmu *leader_pmu = event->group_leader->pmu;if (is_software_event (event))return 1 ; +/* +* Reject groups spanning multiple HW PMUs (e.g. CPU + CCI). The +* core perf code won't check that the pmu->ctx == leader->ctx +* until after pmu->event_init(event). +*/ +if (event->pmu != pmu) +return 0 ; +if (event->pmu != leader_pmu || event->state <PERF_EVENT_STATE_OFF )return 1 ;if (event->state ==PERF_EVENT_STATE_OFF && !event->attr.enable_on_exec)return 1 ; + armpmu =to_arm_pmu (event->pmu);return armpmu->get_event_idx (hw_events, &fake_event) >=0 ; }
@@ -349,15 +358,15 @@ validate_group(struct perf_event *event)memset (fake_used_mask,0 ,sizeof (fake_used_mask)); fake_pmu.used_mask = fake_used_mask; -if (!validate_event (&fake_pmu, leader)) +if (!validate_event (event->pmu, &fake_pmu, leader))return -EINVAL ;list_for_each_entry (sibling, &leader->sibling_list, group_entry) { -if (!validate_event (&fake_pmu, sibling)) +if (!validate_event (event->pmu, &fake_pmu, sibling))return -EINVAL ; } -if (!validate_event (&fake_pmu, event)) +if (!validate_event (event->pmu, &fake_pmu, event))return -EINVAL ;return 0 ;
PATCH 330/346 Bluetooth: Fix potential NULL dereference in RFCOMM bind callback
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jaganath Kanakkassery <[email protected]>
commit 951b6a0717db97ce420547222647bcc40bf1eacd upstream.
addr can be NULL and it should not be dereferenced before NULL checking.
--- net/bluetooth/rfcomm/sock.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
net/bluetooth/rfcomm/sock.c +12 -8
@@ -334,16 +334,19 @@ static int rfcomm_sock_create(struct netstatic int rfcomm_sock_bind (struct socket *sock,struct sockaddr *addr,int addr_len) { -struct sockaddr_rc *sa = (struct sockaddr_rc *) addr; +struct sockaddr_rc sa;struct sock *sk = sock->sk; -int chan = sa->rc_channel; -int err =0 ; - -BT_DBG ("sk %p %pMR" , sk, &sa->rc_bdaddr); +int len, err =0 ;if (!addr || addr->sa_family !=AF_BLUETOOTH )return -EINVAL ; +memset (&sa,0 ,sizeof (sa)); + len = min_t(unsigned int, sizeof(sa), addr_len); +memcpy (&sa, addr, len); + +BT_DBG ("sk %p %pMR" , sk, &sa.rc_bdaddr); +lock_sock (sk);if (sk->sk_state !=BT_OPEN ) {
@@ -358,12 +361,13 @@ static int rfcomm_sock_bind(struct sockewrite_lock (&rfcomm_sk_list.lock); -if (chan &&__rfcomm_get_listen_sock_by_addr (chan, &sa->rc_bdaddr)) { +if (sa.rc_channel && +__rfcomm_get_listen_sock_by_addr (sa.rc_channel, &sa.rc_bdaddr)) { err = -EADDRINUSE ; }else {/* Save source address */ -bacpy (&rfcomm_pi (sk)->src, &sa->rc_bdaddr); -rfcomm_pi (sk)->channel = chan; +bacpy (&rfcomm_pi (sk)->src, &sa.rc_bdaddr); +rfcomm_pi (sk)->channel = sa.rc_channel; sk->sk_state =BT_BOUND ; }
PATCH 331/346 KEYS: Fix short sprintf buffer in /proc/keys show function
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
commit 03dab869b7b239c4e013ec82aea22e181e441cfc upstream.
This fixes CVE-2016-7042.
Fix a short sprintf buffer in proc_keys_show(). If the gcc stack protector is turned on, this can cause a panic due to stack corruption.
The problem is that xbuf[] is not big enough to hold a 64-bit timeout rendered as weeks:
(gdb) p 0xffffffffffffffffULL/(60*60*24*7) $2 = 30500568904943
That's 14 chars plus NUL, not 11 chars plus NUL.
Expand the buffer to 16 chars.
I think the unpatched code apparently works if the stack-protector is not enabled because on a 32-bit machine the buffer won't be overflowed and on a 64-bit machine there's a 64-bit aligned pointer at one side and an int that isn't checked again on the other side.
The panic incurred looks something like:
Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff81352ebe CPU: 0 PID: 1692 Comm: reproducer Not tainted 4.7.2-201.fc24.x86_64 #1 Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 0000000000000086 00000000fbbd2679 ffff8800a044bc00 ffffffff813d941f ffffffff81a28d58 ffff8800a044bc98 ffff8800a044bc88 ffffffff811b2cb6 ffff880000000010 ffff8800a044bc98 ffff8800a044bc30 00000000fbbd2679 Call Trace: [<ffffffff813d941f>] dump_stack+0x63/0x84 [<ffffffff811b2cb6>] panic+0xde/0x22a [<ffffffff81352ebe>] ? proc_keys_show+0x3ce/0x3d0 [<ffffffff8109f7f9>] __stack_chk_fail+0x19/0x30 [<ffffffff81352ebe>] proc_keys_show+0x3ce/0x3d0 [<ffffffff81350410>] ? key_validate+0x50/0x50 [<ffffffff8134db30>] ? key_default_cmp+0x20/0x20 [<ffffffff8126b31c>] seq_read+0x2cc/0x390 [<ffffffff812b6b12>] proc_reg_read+0x42/0x70 [<ffffffff81244fc7>] __vfs_read+0x37/0x150 [<ffffffff81357020>] ? security_file_permission+0xa0/0xc0 [<ffffffff81246156>] vfs_read+0x96/0x130 [<ffffffff81247635>] SyS_read+0x55/0xc0 [<ffffffff817eb872>] entry_SYSCALL_64_fastpath+0x1a/0xa4
--- security/keys/proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/proc.c +1 -1
@@ -187,7 +187,7 @@ static int proc_keys_show(struct seq_filstruct timespec now;unsigned long timo;key_ref_t key_ref, skey_ref; -char xbuf[12 ]; +char xbuf[16 ];int rc;struct keyring_search_context ctx = {
PATCH 332/346 scsi: arcmsr: Buffer overflow in arcmsr_iop_message_xfer()
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 7bc2b55a5c030685b399bb65b6baa9ccc3d1f167 upstream.
We need to put an upper bound on "user_len" so the memcpy() doesn't overflow.
[bwh: Backported to 3.16:
- Adjust context
- Use literal 1032 insetad of ARCMSR_API_DATA_BUFLEN]
---
drivers/scsi/arcmsr/arcmsr_hba.c +7 -1
@@ -1802,7 +1802,8 @@ static int arcmsr_iop_message_xfer(struccase ARCMSR_MESSAGE_WRITE_WQBUFFER : {unsigned char *ver_addr; -int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex; +uint32_t user_len; +int32_t my_empty_len, wqbuf_firstindex, wqbuf_lastindex;uint8_t *pQbuffer, *ptmpuserbuffer; ver_addr =kmalloc (1032 ,GFP_ATOMIC );
@@ -1819,6 +1820,11 @@ static int arcmsr_iop_message_xfer(struc } ptmpuserbuffer = ver_addr; user_len = pcmdmessagefld->cmdmessage.Length; +if (user_len >1032 ) { + retvalue =ARCMSR_MESSAGE_FAIL ; +kfree (ver_addr); + goto message_out; + }memcpy (ptmpuserbuffer, pcmdmessagefld->messagedatabuffer, user_len); wqbuf_lastindex = acb->wqbuf_lastindex; wqbuf_firstindex = acb->wqbuf_firstindex;
PATCH 333/346 firewire: net: guard against rx buffer overflows
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Richter <[email protected]>
commit 667121ace9dbafb368618dbabcf07901c962ddac upstream.
The IP-over-1394 driver firewire-net lacked input validation when handling incoming fragmented datagrams. A maliciously formed fragment with a respectively large datagram_offset would cause a memcpy past the datagram buffer.
So, drop any packets carrying a fragment with offset + length larger than datagram_size.
In addition, ensure that
- GASP header, unfragmented encapsulation header, or fragment encapsulation header actually exists before we access it,
- the encapsulated datagram or fragment is of nonzero size.
--- drivers/firewire/net.c | 51 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 16 deletions(-)
drivers/firewire/net.c +35 -16
@@ -591,6 +591,9 @@ static int fwnet_incoming_packet(structint retval;u16 ether_type; +if (len <=RFC2374_UNFRAG_HDR_SIZE ) +return 0 ; + hdr.w0 =be32_to_cpu (buf[0 ]); lf =fwnet_get_hdr_lf (&hdr);if (lf ==RFC2374_HDR_UNFRAG ) {
@@ -615,7 +618,12 @@ static int fwnet_incoming_packet(structreturn fwnet_finish_incoming_packet (net, skb, source_node_id, is_broadcast, ether_type); } +/* A datagram fragment has been received, now the fun begins. */ + +if (len <=RFC2374_FRAG_HDR_SIZE ) +return 0 ; + hdr.w1 =ntohl (buf[1 ]); buf +=2 ; len -=RFC2374_FRAG_HDR_SIZE ;
@@ -629,6 +637,9 @@ static int fwnet_incoming_packet(struct datagram_label =fwnet_get_hdr_dgl (&hdr); dg_size =fwnet_get_hdr_dg_size (&hdr);/* ??? + 1 */ +if (fg_off + len > dg_size) +return 0 ; +spin_lock_irqsave (&dev->lock, flags); peer =fwnet_peer_find_by_node_id (dev, source_node_id, generation);
@@ -735,6 +746,22 @@ static void fwnet_receive_packet(structfw_send_response (card, r, rcode); } +static int gasp_source_id (__be32 *p) +{ +return be32_to_cpu (p[0 ]) >>16 ; +} + +static u32 gasp_specifier_id (__be32 *p) +{ +return (be32_to_cpu (p[0 ]) &0xffff ) <<8 | + (be32_to_cpu (p[1 ]) &0xff000000 ) >>24 ; +} + +static u32 gasp_version (__be32 *p) +{ +return be32_to_cpu (p[1 ]) &0xffffff ; +} +static void fwnet_receive_broadcast (struct fw_iso_context *context,u32 cycle,size_t header_length,void *header,void *data) {
@@ -744,9 +771,6 @@ static void fwnet_receive_broadcast(stru__be32 *buf_ptr;int retval;u32 length; -u16 source_node_id; -u32 specifier_id; -u32 ver;unsigned long offset;unsigned long flags;
@@ -763,22 +787,17 @@ static void fwnet_receive_broadcast(struspin_unlock_irqrestore (&dev->lock, flags); - specifier_id = (be32_to_cpu (buf_ptr[0 ]) &0xffff ) <<8 - | (be32_to_cpu (buf_ptr[1 ]) &0xff000000 ) >>24 ; - ver =be32_to_cpu (buf_ptr[1 ]) &0xffffff ; - source_node_id =be32_to_cpu (buf_ptr[0 ]) >>16 ; - -if (specifier_id ==IANA_SPECIFIER_ID && - (ver == RFC2734_SW_VERSION +if (length >IEEE1394_GASP_HDR_SIZE && +gasp_specifier_id (buf_ptr) ==IANA_SPECIFIER_ID && + (gasp_version(buf_ptr) == RFC2734_SW_VERSION #if IS_ENABLED(CONFIG_IPV6) - || ver ==RFC3146_SW_VERSION + ||gasp_version (buf_ptr) ==RFC3146_SW_VERSION #endif - )) { - buf_ptr +=2 ; - length -=IEEE1394_GASP_HDR_SIZE ; -fwnet_incoming_packet (dev, buf_ptr, length, source_node_id, + )) +fwnet_incoming_packet (dev, buf_ptr +2 , + length -IEEE1394_GASP_HDR_SIZE , +gasp_source_id (buf_ptr), context->card->generation, true); - } packet.payload_length = dev->rcv_buffer_size; packet.interrupt =1 ;
PATCH 334/346 brcmfmac: avoid potential stack overflow in brcmf_cfg80211_start_ap()
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arend Van Spriel <[email protected]>
commit ded89912156b1a47d940a0c954c43afbabd0c42c upstream.
User-space can choose to omit NL80211_ATTR_SSID and only provide raw IE TLV data. When doing so it can provide SSID IE with length exceeding the allowed size. The driver further processes this IE copying it into a local variable without checking the length. Hence stack can be corrupted and used as exploit.
--- drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +1 -1
@@ -3822,7 +3822,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi (u8 *)&settings->beacon.head[ie_offset], settings->beacon.head_len - ie_offset, WLAN_EID_SSID); -if (!ssid_ie) +if (!ssid_ie || ssid_ie->len >IEEE80211_MAX_SSID_LEN )return -EINVAL ;memcpy (ssid_le.SSID, ssid_ie->data, ssid_ie->len);
PATCH 335/346 vfio/pci: Fix integer overflows, bitmask check
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vlad Tsyrklevich <[email protected]>
commit 05692d7005a364add85c6e25a6c4447ce08f913a upstream.
The VFIO_DEVICE_SET_IRQS ioctl did not sufficiently sanitize user-supplied integers, potentially allowing memory corruption. This patch adds appropriate integer overflow checks, checks the range bounds for VFIO_IRQ_SET_DATA_NONE, and also verifies that only single element in the VFIO_IRQ_SET_DATA_TYPE_MASK bitmask is set. VFIO_IRQ_SET_ACTION_TYPE_MASK is already correctly checked later in vfio_pci_set_irqs_ioctl().
Furthermore, a kzalloc is changed to a kcalloc because the use of a kzalloc with an integer multiplication allowed an integer overflow condition to be reached without this patch. kcalloc checks for overflow and should prevent a similar occurrence.
--- drivers/vfio/pci/vfio_pci.c | 33 +++++++++++++++++++++------------ drivers/vfio/pci/vfio_pci_intrs.c | 2 +- 2 files changed, 22 insertions(+), 13 deletions(-)
drivers/vfio/pci/vfio_pci.c +22 -13
@@ -460,8 +460,9 @@ static long vfio_pci_ioctl(void *device_ }else if (cmd ==VFIO_DEVICE_SET_IRQS ) {struct vfio_irq_set hdr; +size_t size;u8 *data =NULL ; -int ret =0 ; +int max, ret =0 ; minsz = offsetofend(struct vfio_irq_set, count);
@@ -469,23 +470,31 @@ static long vfio_pci_ioctl(void *device_return -EFAULT ;if (hdr.argsz < minsz || hdr.index >=VFIO_PCI_NUM_IRQS || + hdr.count >= (U32_MAX - hdr.start) || hdr.flags & ~(VFIO_IRQ_SET_DATA_TYPE_MASK |VFIO_IRQ_SET_ACTION_TYPE_MASK ))return -EINVAL ; -if (!(hdr.flags &VFIO_IRQ_SET_DATA_NONE )) { -size_t size; -int max =vfio_pci_get_irq_count (vdev, hdr.index); - -if (hdr.flags &VFIO_IRQ_SET_DATA_BOOL ) - size =sizeof (uint8_t ); -else if (hdr.flags &VFIO_IRQ_SET_DATA_EVENTFD ) - size =sizeof (int32_t ); -else -return -EINVAL ; + max =vfio_pci_get_irq_count (vdev, hdr.index); +if (hdr.start >= max || hdr.start + hdr.count > max) +return -EINVAL ; + +switch (hdr.flags &VFIO_IRQ_SET_DATA_TYPE_MASK ) { +case VFIO_IRQ_SET_DATA_NONE : + size =0 ; +break ; +case VFIO_IRQ_SET_DATA_BOOL : + size =sizeof (uint8_t ); +break ; +case VFIO_IRQ_SET_DATA_EVENTFD : + size =sizeof (int32_t ); +break ; +default : +return -EINVAL ; + } -if (hdr.argsz - minsz < hdr.count * size || - hdr.start >= max || hdr.start + hdr.count > max) +if (size) { +if (hdr.argsz - minsz < hdr.count * size)return -EINVAL ; data = memdup_user((void __user *)(arg + minsz),
drivers/vfio/pci/vfio_pci_intrs.c +1 -1
@@ -465,7 +465,7 @@ static int vfio_msi_enable(struct vfio_pif (!is_irq_none (vdev))return -EINVAL ; - vdev->ctx =kzalloc (nvec *sizeof (struct vfio_pci_irq_ctx ),GFP_KERNEL ); + vdev->ctx =kcalloc (nvec,sizeof (struct vfio_pci_irq_ctx ),GFP_KERNEL );if (!vdev->ctx)return -ENOMEM ;
PATCH 336/346 fs: Give dentry to inode_change_ok() instead of inode
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 31051c85b5e2aaaf6315f74c72a732673632a905 upstream.
inode_change_ok() will be resposible for clearing capabilities and IMA extended attributes and as such will need dentry. Give it as an argument to inode_change_ok() instead of an inode. Also rename inode_change_ok() to setattr_prepare() to better relect that it does also some modifications in addition to checks.
[bwh: Backported to 3.16:
- Drop changes to orangefs, overlayfs
- Adjust filenames, context
- In fuse, pass dentry to fuse_do_setattr()
- In nfsd, pass dentry to nfsd_sanitize_attrs()
- In xfs, pass dentry to xfs_setattr_nonsize() and xfs_setattr_size()
- Update ext3 as well]
---
Documentation/filesystems/porting +2 -2
@@ -287,8 +287,8 @@ implementing on-disk size changes. Star and vmtruncate, and the reorder the vmtruncate + foofs_vmtruncate sequence to be in order of zeroing blocks using block_truncate_page or similar helpers, size update and on finally on-disk truncation which should not fail. -inode_change_ok now includes the size checks for ATTR_SIZE and must be called -in the beginning of ->setattr unconditionally. +setattr_prepare (which used to be inode_change_ok) now includes the size checks +for ATTR_SIZE and must be called in the beginning of ->setattr unconditionally. [mandatory]
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -1
@@ -1386,7 +1386,7 @@ int ll_setattr_raw(struct dentry *dentry attr->ia_valid |=ATTR_MTIME |ATTR_CTIME ; } -/* POSIX: check before ATTR_*TIME_SET set (from inode_change_ok) */ +/* POSIX: check before ATTR_*TIME_SET set (from setattr_prepare) */ if (attr->ia_valid &TIMES_SET_FLAGS ) {if ((!uid_eq (current_fsuid (), inode->i_uid)) && !capable (CFS_CAP_FOWNER ))
fs/9p/vfs_inode.c +1 -1
@@ -1094,7 +1094,7 @@ static int v9fs_vfs_setattr(struct dentrstruct p9_wstat wstat;p9_debug (P9_DEBUG_VFS ,"\n" ); - retval =inode_change_ok (dentry->d_inode, iattr); + retval =setattr_prepare (dentry, iattr);if (retval)return retval;
fs/9p/vfs_inode_dotl.c +1 -1
@@ -560,7 +560,7 @@ int v9fs_vfs_setattr_dotl(struct dentryp9_debug (P9_DEBUG_VFS ,"\n" ); - retval =inode_change_ok (inode, iattr); + retval =setattr_prepare (dentry, iattr);if (retval)return retval;
fs/adfs/inode.c +1 -1
@@ -303,7 +303,7 @@ adfs_notify_change(struct dentry *dentryunsigned int ia_valid = attr->ia_valid;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);/* * we can't change the UID or GID of any file -
fs/affs/inode.c +1 -1
@@ -222,7 +222,7 @@ affs_notify_change(struct dentry *dentrypr_debug ("notify_change(%lu,0x%x)\n" , inode->i_ino, attr->ia_valid); - error =inode_change_ok (inode,attr); + error =setattr_prepare (dentry, attr);if (error) goto out;
fs/attr.c +9 -6
@@ -17,19 +17,22 @@#include <linux/ima.h> /** -* inode_change_ok - check if attribute changes to an inode are allowed -* @inode: inode to check +* setattr_prepare - check if attribute changes to a dentry are allowed +* @dentry: dentry to check * @attr: attributes to change * * Check if we are allowed to change the attributes contained in @attr -* in the given inode. This includes the normal unix access permission -* checks, as well as checks for rlimits and others. +* in the given dentry. This includes the normal unix access permission +* checks, as well as checks for rlimits and others. The function also clears +* SGID bit from mode if user is not allowed to set it. Also file capabilities +* and IMA extended attributes are cleared if ATTR_KILL_PRIV is set. * * Should be called as the first thing in ->setattr implementations, * possibly after taking additional locks. */ -int inode_change_ok (const struct inode *inode,struct iattr *attr) +int setattr_prepare (struct dentry *dentry,struct iattr *attr) { +struct inode *inode =d_inode (dentry);unsigned int ia_valid = attr->ia_valid;/*
@@ -79,7 +82,7 @@ int inode_change_ok(const struct inode *return 0 ; } -EXPORT_SYMBOL (inode_change_ok); +EXPORT_SYMBOL (setattr_prepare);/** * inode_newsize_ok - may this inode be truncated to a given size
fs/btrfs/inode.c +1 -1
@@ -4690,7 +4690,7 @@ static int btrfs_setattr(struct dentry *if (btrfs_root_readonly (root))return -EROFS ; - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err)return err;
fs/ceph/inode.c +1 -1
@@ -1708,7 +1708,7 @@ int ceph_setattr(struct dentry *dentry,if (ceph_snap (inode) !=CEPH_NOSNAP )return -EROFS ; - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err !=0 )return err;
fs/cifs/inode.c +2 -2
@@ -2074,7 +2074,7 @@ cifs_setattr_unix(struct dentry *direntrif (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_NO_PERM ) attrs->ia_valid |=ATTR_FORCE ; - rc =inode_change_ok (inode, attrs); + rc =setattr_prepare (direntry, attrs);if (rc <0 ) goto out;
@@ -2215,7 +2215,7 @@ cifs_setattr_nounix(struct dentry *direnif (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_NO_PERM ) attrs->ia_valid |=ATTR_FORCE ; - rc =inode_change_ok (inode, attrs); + rc =setattr_prepare (direntry, attrs);if (rc <0 ) {free_xid (xid);return rc;
fs/ecryptfs/inode.c +1 -1
@@ -952,7 +952,7 @@ static int ecryptfs_setattr(struct dentr }mutex_unlock (&crypt_stat->cs_mutex); - rc =inode_change_ok (inode, ia); + rc =setattr_prepare (dentry, ia);if (rc) goto out;if (ia->ia_valid &ATTR_SIZE ) {
fs/exofs/inode.c +1 -1
@@ -1039,7 +1039,7 @@ int exofs_setattr(struct dentry *dentry,if (unlikely (error))return error; - error =inode_change_ok (inode, iattr); + error =setattr_prepare (dentry, iattr);if (unlikely (error))return error;
fs/ext2/inode.c +1 -1
@@ -1547,7 +1547,7 @@ int ext2_setattr(struct dentry *dentry,struct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, iattr); + error =setattr_prepare (dentry, iattr);if (error)return error;
fs/ext3/inode.c +1 -1
@@ -3244,7 +3244,7 @@ int ext3_setattr(struct dentry *dentry,int error, rc =0 ;const unsigned int ia_valid = attr->ia_valid; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/ext4/inode.c +1 -1
@@ -4672,7 +4672,7 @@ int ext4_setattr(struct dentry *dentry,int orphan =0 ;const unsigned int ia_valid = attr->ia_valid; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/f2fs/file.c +1 -1
@@ -500,7 +500,7 @@ int f2fs_setattr(struct dentry *dentry,struct f2fs_inode_info *fi =F2FS_I (inode);int err; - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err)return err;
fs/fat/file.c +1 -1
@@ -394,7 +394,7 @@ int fat_setattr(struct dentry *dentry, s attr->ia_valid &= ~TIMES_SET_FLAGS ; } - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr); attr->ia_valid = ia_valid;if (error) {if (sbi->options.quiet)
fs/fuse/dir.c +5 -4
@@ -1704,9 +1704,10 @@ int fuse_flush_times(struct inode *inode* vmtruncate() doesn't allow for this case, so do the rlimit checking * and the actual truncation by hand. */ -int fuse_do_setattr (struct inode *inode,struct iattr *attr, +int fuse_do_setattr (struct dentry *dentry,struct iattr *attr,struct file *file) { +struct inode *inode = dentry->d_inode;struct fuse_conn *fc =get_fuse_conn (inode);struct fuse_inode *fi =get_fuse_inode (inode);struct fuse_req *req;
@@ -1721,7 +1722,7 @@ int fuse_do_setattr(struct inode *inode,if (!(fc->flags &FUSE_DEFAULT_PERMISSIONS )) attr->ia_valid |=ATTR_FORCE ; - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err)return err;
@@ -1826,9 +1827,9 @@ static int fuse_setattr(struct dentry *ereturn -EACCES ;if (attr->ia_valid &ATTR_FILE ) -return fuse_do_setattr (inode, attr, attr->ia_file); +return fuse_do_setattr (entry, attr, attr->ia_file);else -return fuse_do_setattr (inode, attr,NULL ); +return fuse_do_setattr (entry, attr,NULL ); } static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
fs/fuse/fuse_i.h +1 -1
@@ -894,7 +894,7 @@ bool fuse_write_update_size(struct inodeint fuse_flush_times (struct inode *inode,struct fuse_file *ff);int fuse_write_inode (struct inode *inode,struct writeback_control *wbc); -int fuse_do_setattr (struct inode *inode,struct iattr *attr, +int fuse_do_setattr (struct dentry *dentry,struct iattr *attr,struct file *file);#endif /* _FS_FUSE_I_H */
fs/gfs2/inode.c +1 -1
@@ -1774,7 +1774,7 @@ static int gfs2_setattr(struct dentry *dif (IS_IMMUTABLE (inode) ||IS_APPEND (inode)) goto out; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error) goto out;
fs/hfs/inode.c +1 -1
@@ -604,7 +604,7 @@ int hfs_inode_setattr(struct dentry *denstruct hfs_sb_info *hsb =HFS_SB (inode->i_sb);int error; - error =inode_change_ok (inode, attr);/* basic permission checks */ + error =setattr_prepare (dentry, attr);/* basic permission checks */ if (error)return error;
fs/hfsplus/inode.c +1 -1
@@ -247,7 +247,7 @@ static int hfsplus_setattr(struct dentrystruct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/hostfs/hostfs_kern.c +1 -1
@@ -792,7 +792,7 @@ static int hostfs_setattr(struct dentryint fd =HOSTFS_I (inode)->fd; - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err)return err;
fs/hpfs/inode.c +1 -1
@@ -272,7 +272,7 @@ int hpfs_setattr(struct dentry *dentry,if ((attr->ia_valid &ATTR_SIZE ) && attr->ia_size > inode->i_size) goto out_unlock; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error) goto out_unlock;
fs/hugetlbfs/inode.c +1 -1
@@ -429,7 +429,7 @@ static int hugetlbfs_setattr(struct dentBUG_ON (!inode); - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/jffs2/fs.c +1 -1
@@ -193,7 +193,7 @@ int jffs2_setattr(struct dentry *dentry,struct inode *inode = dentry->d_inode;int rc; - rc =inode_change_ok (inode, iattr); + rc =setattr_prepare (dentry, iattr);if (rc)return rc;
fs/jfs/file.c +1 -1
@@ -103,7 +103,7 @@ int jfs_setattr(struct dentry *dentry, sstruct inode *inode = dentry->d_inode;int rc; - rc =inode_change_ok (inode, iattr); + rc =setattr_prepare (dentry, iattr);if (rc)return rc;
fs/kernfs/inode.c +1 -1
@@ -131,7 +131,7 @@ int kernfs_iop_setattr(struct dentry *dereturn -EINVAL ;mutex_lock (&kernfs_mutex); - error =inode_change_ok (inode, iattr); + error =setattr_prepare (dentry, iattr);if (error) goto out;
fs/libfs.c +1 -1
@@ -371,7 +371,7 @@ int simple_setattr(struct dentry *dentrystruct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, iattr); + error =setattr_prepare (dentry, iattr);if (error)return error;
fs/logfs/file.c +1 -1
@@ -244,7 +244,7 @@ static int logfs_setattr(struct dentry *struct inode *inode = dentry->d_inode;int err =0 ; - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err)return err;
fs/minix/file.c +1 -1
@@ -28,7 +28,7 @@ static int minix_setattr(struct dentry *struct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/ncpfs/inode.c +1 -1
@@ -885,7 +885,7 @@ int ncp_notify_change(struct dentry *den/* ageing the dentry to force validation */ ncp_age_dentry (server, dentry); - result =inode_change_ok (inode, attr); + result =setattr_prepare (dentry, attr);if (result <0 ) goto out;
fs/nfsd/vfs.c +7 -5
@@ -300,17 +300,19 @@ commit_metadata(struct svc_fh *fhp)* NFS semantics and what Linux expects. */ static void -nfsd_sanitize_attrs (struct inode *inode,struct iattr *iap) +nfsd_sanitize_attrs (struct dentry *dentry,struct iattr *iap) { +struct inode *inode = dentry->d_inode; +/* * NFSv2 does not differentiate between "set-[ac]time-to-now" * which only requires access, and "set-[ac]time-to-X" which * requires ownership. * So if it looks like it might be "set both to the same time which -* is close to now", and if inode_change_ok fails, then we +* is close to now", and if setattr_prepare fails, then we * convert to "set to now" instead of "set to explicit time" * -* We only call inode_change_ok as the last test as technically +* We only call setattr_prepare as the last test as technically * it is not an interface that we should be using. */ #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET)
@@ -328,7 +330,7 @@ nfsd_sanitize_attrs(struct inode *inode,if (delta <0 ) delta = -delta;if (delta <MAX_TOUCH_TIME_ERROR && -inode_change_ok (inode, iap) !=0 ) { +setattr_prepare (dentry, iap) !=0 ) {/* * Turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME. * This will cause notify_change to set these times
@@ -435,7 +437,7 @@ nfsd_setattr(struct svc_rqst *rqstp, strif (!iap->ia_valid) goto out; -nfsd_sanitize_attrs (inode, iap); +nfsd_sanitize_attrs (dentry, iap);/* * The size case is special, it changes the file in addition to the
fs/nilfs2/inode.c +1 -1
@@ -839,7 +839,7 @@ int nilfs_setattr(struct dentry *dentry,struct super_block *sb = inode->i_sb;int err; - err =inode_change_ok (inode, iattr); + err =setattr_prepare (dentry, iattr);if (err)return err;
fs/ntfs/inode.c +1 -1
@@ -2891,7 +2891,7 @@ int ntfs_setattr(struct dentry *dentry,int err;unsigned int ia_valid = attr->ia_valid; - err =inode_change_ok (vi, attr); + err =setattr_prepare (dentry, attr);if (err) goto out;/* We do not support NTFS ACLs yet. */
fs/ocfs2/dlmfs/dlmfs.c +1 -1
@@ -211,7 +211,7 @@ static int dlmfs_file_setattr(struct denstruct inode *inode = dentry->d_inode; attr->ia_valid &= ~ATTR_SIZE ; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/ocfs2/file.c +1 -1
@@ -1144,7 +1144,7 @@ int ocfs2_setattr(struct dentry *dentry,if (!(attr->ia_valid &OCFS2_VALID_ATTRS ))return 0 ; - status =inode_change_ok (inode, attr); + status =setattr_prepare (dentry, attr);if (status)return status;
fs/omfs/file.c +1 -1
@@ -351,7 +351,7 @@ static int omfs_setattr(struct dentry *dstruct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/proc/base.c +1 -1
@@ -536,7 +536,7 @@ int proc_setattr(struct dentry *dentry,if (attr->ia_valid &ATTR_MODE )return -EPERM ; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/proc/generic.c +1 -1
@@ -41,7 +41,7 @@ static int proc_notify_change(struct denstruct proc_dir_entry *de =PDE (inode);int error; - error =inode_change_ok (inode, iattr); + error =setattr_prepare (dentry, iattr);if (error)return error;
fs/proc/proc_sysctl.c +1 -1
@@ -753,7 +753,7 @@ static int proc_sys_setattr(struct dentrif (attr->ia_valid & (ATTR_MODE |ATTR_UID |ATTR_GID ))return -EPERM ; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/ramfs/file-nommu.c +1 -1
@@ -163,7 +163,7 @@ static int ramfs_nommu_setattr(struct deint ret =0 ;/* POSIX UID/GID verification for setting inode attributes */ - ret =inode_change_ok (inode, ia); + ret =setattr_prepare (dentry, ia);if (ret)return ret;
fs/reiserfs/inode.c +1 -1
@@ -3312,7 +3312,7 @@ int reiserfs_setattr(struct dentry *dentunsigned int ia_valid;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/sysv/file.c +1 -1
@@ -35,7 +35,7 @@ static int sysv_setattr(struct dentry *dstruct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/ubifs/file.c +1 -1
@@ -1262,7 +1262,7 @@ int ubifs_setattr(struct dentry *dentry,dbg_gen ("ino %lu, mode %#x, ia_valid %#x" , inode->i_ino, inode->i_mode, attr->ia_valid); - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err)return err;
fs/udf/file.c +1 -1
@@ -269,7 +269,7 @@ static int udf_setattr(struct dentry *destruct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/ufs/truncate.c +1 -1
@@ -496,7 +496,7 @@ int ufs_setattr(struct dentry *dentry, sunsigned int ia_valid = attr->ia_valid;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/utimes.c +2 -2
@@ -81,7 +81,7 @@ static int utimes_common(struct path *pa newattrs.ia_valid |=ATTR_MTIME_SET ; }/* -* Tell inode_change_ok(), that this is an explicit time +* Tell setattr_prepare(), that this is an explicit time * update, even if neither ATTR_ATIME_SET nor ATTR_MTIME_SET * were used. */
@@ -90,7 +90,7 @@ static int utimes_common(struct path *pa/* * If times is NULL (or both times are UTIME_NOW), * then we need to check permissions, because -* inode_change_ok() won't do it. +* setattr_prepare() won't do it. */ error = -EACCES ;if (IS_IMMUTABLE (inode))
fs/xfs/xfs_acl.c +2 -1
@@ -244,7 +244,8 @@ xfs_set_mode(struct inode *inode, umode_ iattr.ia_mode = mode; iattr.ia_ctime =current_fs_time (inode->i_sb); - error = -xfs_setattr_nonsize (XFS_I (inode), &iattr,XFS_ATTR_NOACL ); + error = -xfs_setattr_nonsize (NULL ,XFS_I (inode), &iattr, +XFS_ATTR_NOACL ); }return error;
fs/xfs/xfs_file.c +1 -1
@@ -862,7 +862,7 @@ xfs_file_fallocate( iattr.ia_valid =ATTR_SIZE ; iattr.ia_size = new_size; - error =xfs_setattr_size (ip, &iattr); + error =xfs_setattr_size (file->f_dentry, &iattr); } out_unlock:
fs/xfs/xfs_ioctl.c +1 -1
@@ -717,7 +717,7 @@ xfs_ioc_space( iattr.ia_valid =ATTR_SIZE ; iattr.ia_size = bf->l_start; - error =xfs_setattr_size (ip, &iattr); + error =xfs_setattr_size (filp->f_dentry, &iattr);if (!error) clrprealloc = true;break ;
fs/xfs/xfs_iops.c +9 -7
@@ -527,6 +527,7 @@ xfs_setattr_time(int xfs_setattr_nonsize ( +struct dentry *dentry,struct xfs_inode *ip,struct iattr *iattr,int flags)
@@ -551,7 +552,7 @@ xfs_setattr_nonsize(if (XFS_FORCED_SHUTDOWN (mp))return XFS_ERROR (EIO ); - error = -inode_change_ok (inode, iattr); + error = -setattr_prepare (dentry, iattr);if (error)return XFS_ERROR (error); }
@@ -734,11 +735,12 @@ out_dqrele:*/ int xfs_setattr_size ( -struct xfs_inode *ip, +struct dentry *dentry,struct iattr *iattr) { +struct inode *inode = dentry->d_inode; +struct xfs_inode *ip =XFS_I (inode);struct xfs_mount *mp = ip->i_mount; -struct inode *inode =VFS_I (ip);xfs_off_t oldsize, newsize;struct xfs_trans *tp;int error;
@@ -754,7 +756,7 @@ xfs_setattr_size(if (XFS_FORCED_SHUTDOWN (mp))return XFS_ERROR (EIO ); - error = -inode_change_ok (inode, iattr); + error = -setattr_prepare (dentry, iattr);if (error)return XFS_ERROR (error);
@@ -778,7 +780,7 @@ xfs_setattr_size(* Use the regular setattr path to update the timestamps. */ iattr->ia_valid &= ~ATTR_SIZE ; -return xfs_setattr_nonsize (ip, iattr,0 ); +return xfs_setattr_nonsize (dentry, ip, iattr,0 ); }/*
@@ -939,10 +941,10 @@ xfs_vn_setattr(if (iattr->ia_valid &ATTR_SIZE ) {xfs_ilock (ip,XFS_IOLOCK_EXCL |XFS_MMAPLOCK_EXCL ); - error =xfs_setattr_size (ip, iattr); + error =xfs_setattr_size (dentry, iattr);xfs_iunlock (ip,XFS_IOLOCK_EXCL |XFS_MMAPLOCK_EXCL ); }else { - error =xfs_setattr_nonsize (ip, iattr,0 ); + error =xfs_setattr_nonsize (dentry, ip, iattr,0 ); }return -error;
fs/xfs/xfs_iops.h +3 -3
@@ -32,8 +32,8 @@ extern void xfs_setup_inode(struct xfs_i*/ #define XFS_ATTR_NOACL 0x01/* Don't call posix_acl_chmod */ -extern int xfs_setattr_nonsize (struct xfs_inode *ip,struct iattr *vap, -int flags); -extern int xfs_setattr_size (struct xfs_inode *ip,struct iattr *vap); +extern int xfs_setattr_nonsize (struct dentry *dentry,struct xfs_inode *ip, +struct iattr *vap,int flags); +extern int xfs_setattr_size (struct dentry *dentry,struct iattr *vap);#endif /* __XFS_IOPS_H__ */
include/linux/fs.h +1 -1
@@ -2627,7 +2627,7 @@ extern int buffer_migrate_page(struct ad#define buffer_migrate_page NULL#endif -extern int inode_change_ok (const struct inode *,struct iattr *); +extern int setattr_prepare (struct dentry *,struct iattr *);extern int inode_newsize_ok (const struct inode *,loff_t offset);extern void setattr_copy (struct inode *inode,const struct iattr *attr);
mm/shmem.c +1 -1
@@ -540,7 +540,7 @@ static int shmem_setattr(struct dentry *struct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
PATCH 337/346 fs: Avoid premature clearing of capabilities
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 030b533c4fd4d2ec3402363323de4bb2983c9cee upstream.
Currently, notify_change() clears capabilities or IMA attributes by calling security_inode_killpriv() before calling into ->setattr. Thus it happens before any other permission checks in inode_change_ok() and user is thus allowed to trigger clearing of capabilities or IMA attributes for any file he can look up e.g. by calling chown for that file. This is unexpected and can lead to user DoSing a system.
Fix the problem by calling security_inode_killpriv() at the end of inode_change_ok() instead of from notify_change(). At that moment we are sure user has permissions to do the requested change.
References: CVE-2015-1350
--- fs/attr.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
fs/attr.c +14 -6
@@ -47,7 +47,7 @@ int setattr_prepare(struct dentry *dentr/* If force is set do it anyway. */ if (ia_valid &ATTR_FORCE ) -return 0 ; + goto kill_priv;/* Make sure a caller can chown. */ if ((ia_valid & ATTR_UID) &&
@@ -80,6 +80,16 @@ int setattr_prepare(struct dentry *dentrreturn -EPERM ; } +kill_priv: +/* User has permission for the change */ +if (ia_valid &ATTR_KILL_PRIV ) { +int error; + + error =security_inode_killpriv (dentry); +if (error) +return error; + } +return 0 ; }EXPORT_SYMBOL (setattr_prepare);
@@ -220,13 +230,11 @@ int notify_change(struct dentry * dentryif (!(ia_valid &ATTR_MTIME_SET )) attr->ia_mtime = now;if (ia_valid &ATTR_KILL_PRIV ) { - attr->ia_valid &= ~ATTR_KILL_PRIV ; - ia_valid &= ~ATTR_KILL_PRIV ; error =security_inode_need_killpriv (dentry); -if (error >0 ) - error =security_inode_killpriv (dentry); -if (error) +if (error <0 )return error; +if (error ==0 ) + ia_valid = attr->ia_valid &= ~ATTR_KILL_PRIV ; }/*
PATCH 338/346 posix_acl: Clear SGID bit when setting file permissions
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 073931017b49d9458aa351605b43a7e34598caef upstream.
When file permissions are modified via chmod(2) and the user is not in the owning group or capable of CAP_FSETID, the setgid bit is cleared in inode_change_ok(). Setting a POSIX ACL via setxattr(2) sets the file permissions as well as the new ACL, but doesn't clear the setgid bit in a similar way; this allows to bypass the check in chmod(2). Fix that.
References: CVE-2016-7097
[bwh: Backported to 3.16:
- Drop changes to orangefs
- Adjust context
- Update ext3 as well]
---
fs/9p/acl.c +17 -23
@@ -320,32 +320,26 @@ static int v9fs_xattr_set_acl(struct dencase ACL_TYPE_ACCESS : name =POSIX_ACL_XATTR_ACCESS ;if (acl) { -umode_t mode = inode->i_mode; - retval =posix_acl_equiv_mode (acl, &mode); -if (retval <0 ) +struct iattr iattr; + + retval =posix_acl_update_mode (inode, &iattr.ia_mode, &acl); +if (retval) goto err_out; -else { -struct iattr iattr; -if (retval ==0 ) { -/* -* ACL can be represented -* by the mode bits. So don't -* update ACL. -*/ - acl =NULL ; - value =NULL ; - size =0 ; - } -/* Updte the mode bits */ - iattr.ia_mode = ((mode &S_IALLUGO ) | - (inode->i_mode & ~S_IALLUGO )); - iattr.ia_valid =ATTR_MODE ; -/* FIXME should we update ctime ? -* What is the following setxattr update the -* mode ? +if (!acl) { +/* +* ACL can be represented +* by the mode bits. So don't +* update ACL. */ -v9fs_vfs_setattr_dotl (dentry, &iattr); + value =NULL ; + size =0 ; } + iattr.ia_valid =ATTR_MODE ; +/* FIXME should we update ctime ? +* What is the following setxattr update the +* mode ? +*/ +v9fs_vfs_setattr_dotl (dentry, &iattr); }break ;case ACL_TYPE_DEFAULT :
fs/btrfs/acl.c +2 -4
@@ -83,11 +83,9 @@ static int __btrfs_set_acl(struct btrfs_case ACL_TYPE_ACCESS : name =POSIX_ACL_XATTR_ACCESS ;if (acl) { - ret =posix_acl_equiv_mode (acl, &inode->i_mode); -if (ret <0 ) + ret =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (ret)return ret; -if (ret ==0 ) - acl =NULL ; } ret =0 ;break ;
fs/ceph/acl.c +2 -4
@@ -108,11 +108,9 @@ int ceph_set_acl(struct inode *inode, stcase ACL_TYPE_ACCESS : name =POSIX_ACL_XATTR_ACCESS ;if (acl) { - ret =posix_acl_equiv_mode (acl, &new_mode); -if (ret <0 ) + ret =posix_acl_update_mode (inode, &new_mode, &acl); +if (ret) goto out; -if (ret ==0 ) - acl =NULL ; }break ;case ACL_TYPE_DEFAULT :
fs/ext2/acl.c +4 -8
@@ -193,15 +193,11 @@ ext2_set_acl(struct inode *inode, structcase ACL_TYPE_ACCESS : name_index =EXT2_XATTR_INDEX_POSIX_ACL_ACCESS ;if (acl) { - error =posix_acl_equiv_mode (acl, &inode->i_mode); -if (error <0 ) + error =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (error)return error; -else { - inode->i_ctime =CURRENT_TIME_SEC ; -mark_inode_dirty (inode); -if (error ==0 ) - acl =NULL ; - } + inode->i_ctime =CURRENT_TIME_SEC ; +mark_inode_dirty (inode); }break ;
fs/ext3/acl.c +4 -8
@@ -195,15 +195,11 @@ __ext3_set_acl(handle_t *handle, structcase ACL_TYPE_ACCESS : name_index =EXT3_XATTR_INDEX_POSIX_ACL_ACCESS ;if (acl) { - error =posix_acl_equiv_mode (acl, &inode->i_mode); -if (error <0 ) + error =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (error)return error; -else { - inode->i_ctime =CURRENT_TIME_SEC ; -ext3_mark_inode_dirty (handle, inode); -if (error ==0 ) - acl =NULL ; - } + inode->i_ctime =CURRENT_TIME_SEC ; +ext3_mark_inode_dirty (handle, inode); }break ;
fs/ext4/acl.c +4 -8
@@ -201,15 +201,11 @@ __ext4_set_acl(handle_t *handle, structcase ACL_TYPE_ACCESS : name_index =EXT4_XATTR_INDEX_POSIX_ACL_ACCESS ;if (acl) { - error =posix_acl_equiv_mode (acl, &inode->i_mode); -if (error <0 ) + error =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (error)return error; -else { - inode->i_ctime =ext4_current_time (inode); -ext4_mark_inode_dirty (handle, inode); -if (error ==0 ) - acl =NULL ; - } + inode->i_ctime =ext4_current_time (inode); +ext4_mark_inode_dirty (handle, inode); }break ;
fs/f2fs/acl.c +2 -4
@@ -213,12 +213,10 @@ static int __f2fs_set_acl(struct inode *case ACL_TYPE_ACCESS : name_index =F2FS_XATTR_INDEX_POSIX_ACL_ACCESS ;if (acl) { - error =posix_acl_equiv_mode (acl, &inode->i_mode); -if (error <0 ) + error =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (error)return error;set_acl_inode (fi, inode->i_mode); -if (error ==0 ) - acl =NULL ; }break ;
fs/gfs2/acl.c +3 -9
@@ -79,17 +79,11 @@ int gfs2_set_acl(struct inode *inode, stif (type ==ACL_TYPE_ACCESS ) {umode_t mode = inode->i_mode; - error =posix_acl_equiv_mode (acl, &mode); -if (error <0 ) + error =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (error)return error; - -if (error ==0 ) - acl =NULL ; - -if (mode != inode->i_mode) { - inode->i_mode = mode; +if (mode != inode->i_mode)mark_inode_dirty (inode); - } }if (acl) {
fs/hfsplus/posix_acl.c +2 -2
@@ -68,8 +68,8 @@ int hfsplus_set_posix_acl(struct inode *case ACL_TYPE_ACCESS : xattr_name =POSIX_ACL_XATTR_ACCESS ;if (acl) { - err =posix_acl_equiv_mode (acl, &inode->i_mode); -if (err <0 ) + err =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (err)return err; } err =0 ;
fs/jffs2/acl.c +4 -5
@@ -236,9 +236,10 @@ int jffs2_set_acl(struct inode *inode, scase ACL_TYPE_ACCESS : xprefix =JFFS2_XPREFIX_ACL_ACCESS ;if (acl) { -umode_t mode = inode->i_mode; - rc =posix_acl_equiv_mode (acl, &mode); -if (rc <0 ) +umode_t mode; + + rc =posix_acl_update_mode (inode, &mode, &acl); +if (rc)return rc;if (inode->i_mode != mode) {struct iattr attr;
@@ -250,8 +251,6 @@ int jffs2_set_acl(struct inode *inode, sif (rc <0 )return rc; } -if (rc ==0 ) - acl =NULL ; }break ;case ACL_TYPE_DEFAULT :
fs/jfs/acl.c +2 -4
@@ -84,13 +84,11 @@ static int __jfs_set_acl(tid_t tid, strucase ACL_TYPE_ACCESS : ea_name =POSIX_ACL_XATTR_ACCESS ;if (acl) { - rc =posix_acl_equiv_mode (acl, &inode->i_mode); -if (rc <0 ) + rc =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (rc)return rc; inode->i_ctime =CURRENT_TIME ;mark_inode_dirty (inode); -if (rc ==0 ) - acl =NULL ; }break ;case ACL_TYPE_DEFAULT :
fs/ocfs2/acl.c +3 -6
@@ -241,14 +241,11 @@ int ocfs2_set_acl(handle_t *handle,case ACL_TYPE_ACCESS : name_index =OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS ;if (acl) { -umode_t mode = inode->i_mode; - ret =posix_acl_equiv_mode (acl, &mode); -if (ret <0 ) +umode_t mode; + ret =posix_acl_update_mode (inode, &mode, &acl); +if (ret)return ret;else { -if (ret ==0 ) - acl =NULL ; - ret =ocfs2_acl_set_mode (inode, di_bh, handle, mode);if (ret)
fs/posix_acl.c +31 -0
@@ -594,6 +594,37 @@ no_acl: }EXPORT_SYMBOL_GPL (posix_acl_create); +/** +* posix_acl_update_mode - update mode in set_acl +* +* Update the file mode when setting an ACL: compute the new file permission +* bits based on the ACL. In addition, if the ACL is equivalent to the new +* file mode, set *acl to NULL to indicate that no ACL should be set. +* +* As with chmod, clear the setgit bit if the caller is not in the owning group +* or capable of CAP_FSETID (see inode_change_ok). +* +* Called from set_acl inode operations. +*/ +int posix_acl_update_mode (struct inode *inode,umode_t *mode_p, +struct posix_acl **acl) +{ +umode_t mode = inode->i_mode; +int error; + + error =posix_acl_equiv_mode (*acl, &mode); +if (error <0 ) +return error; +if (error ==0 ) + *acl =NULL ; +if (!in_group_p (inode->i_gid) && + !capable_wrt_inode_uidgid (inode,CAP_FSETID )) + mode &= ~S_ISGID ; + *mode_p = mode; +return 0 ; +} +EXPORT_SYMBOL (posix_acl_update_mode); +/* * Fix up the uids and gids in posix acl extended attributes in place. */
fs/reiserfs/xattr_acl.c +2 -6
@@ -246,13 +246,9 @@ __reiserfs_set_acl(struct reiserfs_transcase ACL_TYPE_ACCESS : name =POSIX_ACL_XATTR_ACCESS ;if (acl) { - error =posix_acl_equiv_mode (acl, &inode->i_mode); -if (error <0 ) + error =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (error)return error; -else { -if (error ==0 ) - acl =NULL ; - } }break ;case ACL_TYPE_DEFAULT :
fs/xfs/xfs_acl.c +4 -9
@@ -287,16 +287,11 @@ xfs_set_acl(struct inode *inode, structreturn error;if (type ==ACL_TYPE_ACCESS ) { -umode_t mode = inode->i_mode; - error =posix_acl_equiv_mode (acl, &mode); - -if (error <=0 ) { - acl =NULL ; - -if (error <0 ) -return error; - } +umode_t mode; + error =posix_acl_update_mode (inode, &mode, &acl); +if (error) +return error; error =xfs_set_mode (inode, mode);if (error)return error;
include/linux/posix_acl.h +1 -0
@@ -95,6 +95,7 @@ extern int set_posix_acl(struct inode *,extern int posix_acl_chmod (struct inode *,umode_t );extern int posix_acl_create (struct inode *,umode_t *,struct posix_acl **,struct posix_acl **); +extern int posix_acl_update_mode (struct inode *,umode_t *,struct posix_acl **);extern int simple_set_acl (struct inode *,struct posix_acl *,int );extern int simple_acl_create (struct inode *,struct inode *);
PATCH 339/346 ARC: use ASL assembler mnemonic
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <[email protected]>
commit a6416f57ce57fb390b6ee30b12c01c29032a26af upstream.
ARCompact and ARCv2 only have ASL, while binutils used to support LSL as a alias mnemonic.
Newer binutils (upstream) don't want to do that so replace it.
--- arch/arc/mm/tlbex.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arc/mm/tlbex.S +3 -3
@@ -89,7 +89,7 @@ ex_saved_reg1: #ifdef CONFIG_SMP sr r0, [ARC_REG_SCRATCH_DATA0] ; freeup r0 to code with GET_CPU_ID r0 ; get to per cpu scratch mem, - lsl r0, r0, L1_CACHE_SHIFT ; cache line wide per cpu + asl r0, r0, L1_CACHE_SHIFT ; cache line wide per cpu add r0, @ex_saved_reg1, r0 #else st r0, [@ex_saved_reg1]
@@ -108,7 +108,7 @@ ex_saved_reg1: .macro TLBMISS_RESTORE_REGS #ifdef CONFIG_SMP GET_CPU_ID r0 ; get to per cpu scratch mem - lsl r0, r0, L1_CACHE_SHIFT ; each is cache line wide + asl r0, r0, L1_CACHE_SHIFT ; each is cache line wide add r0, @ex_saved_reg1, r0 ld_s r3, [r0,12] ld_s r2, [r0, 8]
@@ -220,7 +220,7 @@ ex_saved_reg1: .macro CONV_PTE_TO_TLB and r3, r0, PTE_BITS_RWX ; r w x - lsl r2, r3, 3 ; r w x 0 0 0 + asl r2, r3, 3 ; r w x 0 0 0 and.f 0, r0, _PAGE_GLOBAL or.z r2, r2, r3 ; r w x r w x
PATCH 340/346 usbvision: revert commit 588afcc1
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vladis Dronov <[email protected]>
commit d5468d7afaa9c9e961e150f0455a14a9f4872a98 upstream.
Commit 588afcc1c0e4 ("[media] usbvision fix overflow of interfaces array")' should be reverted, because:
* "!dev->actconfig->interface[ifnum]" won't catch a case where the value is not NULL but some garbage. This way the system may crash later with GPF.
* "(ifnum >= USB_MAXINTERFACES)" does not cover all the error conditions. "ifnum" should be compared to "dev->actconfig-> desc.bNumInterfaces", i.e. compared to the number of "struct usb_interface" kzalloc()-ed, not to USB_MAXINTERFACES.
* There is a "struct usb_device" leak in this error path, as there is usb_get_dev(), but no usb_put_dev() on this path.
* There is a bug of the same type several lines below with number of endpoints. The code is accessing hard-coded second endpoint ("interface->endpoint[1].desc") which may not exist. It would be great to handle this in the same patch too.
* All the concerns above are resolved by already-accepted commit fa52bd50 ("[media] usbvision: fix crash on detecting device with invalid configuration")
* Mailing list message:
http://www.spinics.net/lists/linux-media/msg94832.html
--- drivers/media/usb/usbvision/usbvision-video.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/media/usb/usbvision/usbvision-video.c +0 -7
@@ -1537,13 +1537,6 @@ static int usbvision_probe(struct usb_inprintk (KERN_INFO "%s: %s found\n" , __func__, usbvision_device_data[model].model_string); -/* -* this is a security check. -* an exploit using an incorrect bInterfaceNumber is known -*/ -if (ifnum >=USB_MAXINTERFACES || !dev->actconfig->interface[ifnum]) -return -ENODEV ; -if (usbvision_device_data[model].interface >=0 ) interface = &dev->actconfig->interface[usbvision_device_data[model].interface]->altsetting[0 ];else if (ifnum < dev->actconfig->desc.bNumInterfaces)
PATCH 341/346 staging: comedi: ni_mio_common: fix wrong insn_write handler
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 5ca05345c56cb979e1a25ab6146437002f95cac8 upstream.
For counter subdevices, the s->insn_write handler is being set to the wrong function, ni_tio_insn_read(). It should be ni_tio_insn_write().
proper comedi (*insn_write)")
--- drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/ni_mio_common.c +1 -1
@@ -4415,7 +4415,7 @@ static int ni_E_init(struct comedi_devicelse s->maxdata =0xffffff ; s->insn_read = ni_tio_insn_read; - s->insn_write = ni_tio_insn_read; + s->insn_write = ni_tio_insn_write; s->insn_config = ni_tio_insn_config;#ifdef PCIDMA s->subdev_flags |=SDF_CMD_READ /* | SDF_CMD_WRITE */ ;
PATCH 342/346 xenbus: don't BUG() on user mode induced condition
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Beulich <[email protected]>
commit 0beef634b86a1350c31da5fcc2992f0d7c8a622b upstream.
Inability to locate a user mode specified transaction ID should not lead to a kernel crash. For other than XS_TRANSACTION_START also don't issue anything to xenbus if the specified ID doesn't match that of any active transaction.
--- drivers/xen/xenbus/xenbus_dev_frontend.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/xen/xenbus/xenbus_dev_frontend.c +8 -6
@@ -316,11 +316,18 @@ static int xenbus_write_transaction(unsi rc = -ENOMEM ; goto out; } + }else { +list_for_each_entry (trans, &u->transactions, list) +if (trans->handle.id == u->u.msg.tx_id) +break ; +if (&trans->list == &u->transactions) +return -ESRCH ; } reply =xenbus_dev_request_and_reply (&u->u.msg);if (IS_ERR (reply)) { -kfree (trans); +if (msg_type ==XS_TRANSACTION_START ) +kfree (trans); rc =PTR_ERR (reply); goto out; }
@@ -330,12 +337,7 @@ static int xenbus_write_transaction(unsilist_add (&trans->list, &u->transactions); }else if (msg_type ==XS_TRANSACTION_END ) { -list_for_each_entry (trans, &u->transactions, list) -if (trans->handle.id == u->u.msg.tx_id) -break ; -BUG_ON (&trans->list == &u->transactions);list_del (&trans->list); -kfree (trans); }
PATCH 343/346 xenbus: don't look up transaction IDs for ordinary writes
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Beulich <[email protected]>
commit 9a035a40f7f3f6708b79224b86c5777a3334f7ea upstream.
This should really only be done for XS_TRANSACTION_END messages, or else at least some of the xenstore-* tools don't work anymore.
--- drivers/xen/xenbus/xenbus_dev_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/xenbus/xenbus_dev_frontend.c +1 -1
@@ -316,7 +316,7 @@ static int xenbus_write_transaction(unsi rc = -ENOMEM ; goto out; } - }else { + }else if (msg_type ==XS_TRANSACTION_END ) {list_for_each_entry (trans, &u->transactions, list)if (trans->handle.id == u->u.msg.tx_id)break ;
PATCH 344/346 compiler-gcc: disable -ftracer for __noclone functions
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit 95272c29378ee7dc15f43fa2758cb28a5913a06d upstream.
-ftracer can duplicate asm blocks causing compilation to fail in noclone functions. For example, KVM declares a global variable in an asm like
asm("2: ... \n
.pushsection data \n
.global vmx_return \n
vmx_return: .long 2b");
and -ftracer causes a double declaration.
--- include/linux/compiler-gcc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/compiler-gcc.h +1 -1
@@ -177,7 +177,7 @@#define unreachable () __builtin_unreachable()/* Mark a function definition as prohibited from being cloned. */ -#define __noclone __attribute__((__noclone__)) +#define __noclone __attribute__((__noclone__, __optimize__("no-tracer")))#endif /* GCC_VERSION >= 40500 */
PATCH 345/346 PM / devfreq: Fix incorrect type issue.
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Xiaolong Ye <[email protected]>
commit 5f25f066f75a67835abb5e400471a27abd09395b upstream.
time_in_state in struct devfreq is defined as unsigned long, so devm_kzalloc should use sizeof(unsigned long) as argument instead of sizeof(unsigned int), otherwise it will cause unexpected result in 64bit system.
--- drivers/devfreq/devfreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/devfreq/devfreq.c +1 -1
@@ -483,7 +483,7 @@ struct devfreq *devfreq_add_device(struc devfreq->profile->max_state * devfreq->profile->max_state, GFP_KERNEL); - devfreq->time_in_state =devm_kzalloc (dev,sizeof (unsigned int ) * + devfreq->time_in_state =devm_kzalloc (dev,sizeof (unsigned long ) * devfreq->profile->max_state,GFP_KERNEL ); devfreq->last_stat_updated = jiffies;
PATCH 346/346 KVM: MIPS: Drop other CPU ASIDs on guest MMU changes
In reply to Ben Hutchings3.16.39-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
commit 91e4f1b6073dd680d86cdb7e42d7cccca9db39d8 upstream.
When a guest TLB entry is replaced by TLBWI or TLBWR, we only invalidate TLB entries on the local CPU. This doesn't work correctly on an SMP host when the guest is migrated to a different physical CPU, as it could pick up stale TLB mappings from the last time the vCPU ran on that physical CPU.
Therefore invalidate both user and kernel host ASIDs on other CPUs, which will cause new ASIDs to be generated when it next runs on those CPUs.
We're careful only to do this if the TLB entry was already valid, and only for the kernel ASID where the virtual address it mapped is outside of the guest user address range.
--- arch/mips/kvm/kvm_mips_emul.c | 61 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 8 deletions(-)
arch/mips/kvm/kvm_mips_emul.c +53 -8
@@ -817,6 +817,47 @@ enum emulation_result kvm_mips_emul_tlbrreturn er; } +/** +* kvm_mips_invalidate_guest_tlb() - Indicates a change in guest MMU map. +* @vcpu: VCPU with changed mappings. +* @tlb: TLB entry being removed. +* +* This is called to indicate a single change in guest MMU mappings, so that we +* can arrange TLB flushes on this and other CPUs. +*/ +static void kvm_mips_invalidate_guest_tlb (struct kvm_vcpu *vcpu, +struct kvm_mips_tlb *tlb) +{ +int cpu, i; +bool user; + +/* No need to flush for entries which are already invalid */ +if (!((tlb->tlb_lo0 | tlb->tlb_lo1) &MIPS3_PG_V )) +return ; +/* User address space doesn't need flushing for KSeg2/3 changes */ + user = tlb->tlb_hi <KVM_GUEST_KSEG0 ; + +preempt_disable (); + +/* +* Probe the shadow host TLB for the entry being overwritten, if one +* matches, invalidate it +*/ +kvm_mips_host_tlb_inv (vcpu, tlb->tlb_hi); + +/* Invalidate the whole ASID on other CPUs */ + cpu =smp_processor_id (); +for_each_possible_cpu (i) { +if (i == cpu) +continue ; +if (user) + vcpu->arch.guest_user_asid[i] =0 ; + vcpu->arch.guest_kernel_asid[i] =0 ; + } + +preempt_enable (); +} +/* Write Guest TLB Entry @ Index */ enum emulation_result kvm_mips_emul_tlbwi (struct kvm_vcpu *vcpu) {
@@ -838,10 +879,8 @@ enum emulation_result kvm_mips_emul_tlbw } tlb = &vcpu->arch.guest_tlb[index]; -#if 1 -/* Probe the shadow host TLB for the entry being overwritten, if one matches, invalidate it */ -kvm_mips_host_tlb_inv (vcpu, tlb->tlb_hi); -#endif + +kvm_mips_invalidate_guest_tlb (vcpu, tlb); tlb->tlb_mask =kvm_read_c0_guest_pagemask (cop0); tlb->tlb_hi =kvm_read_c0_guest_entryhi (cop0);
@@ -880,10 +919,7 @@ enum emulation_result kvm_mips_emul_tlbw tlb = &vcpu->arch.guest_tlb[index]; -#if 1 -/* Probe the shadow host TLB for the entry being overwritten, if one matches, invalidate it */ -kvm_mips_host_tlb_inv (vcpu, tlb->tlb_hi); -#endif +kvm_mips_invalidate_guest_tlb (vcpu, tlb); tlb->tlb_mask =kvm_read_c0_guest_pagemask (cop0); tlb->tlb_hi =kvm_read_c0_guest_entryhi (cop0);
@@ -926,6 +962,7 @@ kvm_mips_emulate_CP0(uint32_t inst, uintint32_t rt, rd, copz, sel, co_bit, op;uint32_t pc = vcpu->arch.pc;unsigned long curr_pc; +int cpu, i;/* * Update PC and hold onto current PC in case there is
@@ -1037,8 +1074,16 @@ kvm_mips_emulate_CP0(uint32_t inst, uintASID_MASK , vcpu->arch.gprs[rt] & ASID_MASK); +preempt_disable ();/* Blow away the shadow host TLBs */ kvm_mips_flush_host_tlb (1 ); + cpu =smp_processor_id (); +for_each_possible_cpu (i) +if (i != cpu) { + vcpu->arch.guest_user_asid[i] =0 ; + vcpu->arch.guest_kernel_asid[i] =0 ; + } +preempt_enable (); }kvm_write_c0_guest_entryhi (cop0, vcpu->arch.gprs[rt]);
This is the combined diff for 3.16.39-rc1 relative to 3.16.38.
Ben.
Signature · 2 lines
Ben Hutchings If more than one person is responsible for a bug, no one is at fault.
Documentation/filesystems/porting +2 -2
@@ -287,8 +287,8 @@ implementing on-disk size changes. Start with a copy of the old inode_setattr and vmtruncate, and the reorder the vmtruncate + foofs_vmtruncate sequence to be in order of zeroing blocks using block_truncate_page or similar helpers, size update and on finally on-disk truncation which should not fail. -inode_change_ok now includes the size checks for ATTR_SIZE and must be called -in the beginning of ->setattr unconditionally. +setattr_prepare (which used to be inode_change_ok) now includes the size checks +for ATTR_SIZE and must be called in the beginning of ->setattr unconditionally. [mandatory]
Documentation/module-signing.txt +6 -0
@@ -239,3 +239,9 @@ Since the private key is used to sign modules, viruses and malware could use the private key to sign modules and compromise the operating system. The private key must be either destroyed or moved to a secure location and not kept in the root node of the kernel source tree. + +If you use the same private key to sign modules for multiple kernel +configurations, you must ensure that the module version information is +sufficient to prevent loading a module into a different kernel. Either +set CONFIG_MODVERSIONS=y or ensure that each configuration has a different +kernel release string by changing EXTRAVERSION or CONFIG_LOCALVERSION.
Makefile +2 -2
@@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 16 -SUBLEVEL = 38 -EXTRAVERSION = +SUBLEVEL = 39 +EXTRAVERSION = -rc1 NAME = Museum of Fishiegoodies # *DOCUMENTATION*
arch/alpha/include/asm/uaccess.h +8 -11
@@ -371,14 +371,6 @@ __copy_tofrom_user_nocheck(void *to, const void *from, long len)return __cu_len; } -extern inline long -__copy_tofrom_user (void *to,const void *from,long len,const void __user *validate) -{ -if (__access_ok ((unsigned long )validate, len,get_fs ())) - len =__copy_tofrom_user_nocheck (to, from, len); -return len; -} -#define __copy_to_user (to,from,n) \ ({ \ __chk_user_ptr(to); \
@@ -393,17 +385,22 @@ __copy_tofrom_user(void *to, const void *from, long len, const void __user *vali#define __copy_to_user_inatomic __copy_to_user#define __copy_from_user_inatomic __copy_from_user -extern inline long copy_to_user (void __user *to,const void *from,long n) { -return __copy_tofrom_user ((__force void *)to, from, n, to); +if (likely (__access_ok ((unsigned long )to, n,get_fs ()))) + n =__copy_tofrom_user_nocheck ((__force void *)to, from, n); +return n; }extern inline long copy_from_user (void *to,const void __user *from,long n) { -return __copy_tofrom_user (to, (__force void *)from, n, from); +if (likely (__access_ok ((unsigned long )from, n,get_fs ()))) + n =__copy_tofrom_user_nocheck (to, (__force void *)from, n); +else +memset (to,0 , n); +return n; }extern void __do_clear_user (void );
arch/arc/include/asm/irqflags.h +1 -1
@@ -179,10 +179,10 @@ static inline void arch_unmask_irq(unsigned int irq) .endm .macro IRQ_ENABLE scratch +TRACE_ASM_IRQ_ENABLE lr \scratch, [status32] or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) flag \scratch - TRACE_ASM_IRQ_ENABLE .endm #endif /* __ASSEMBLY__ */
arch/arc/include/asm/uaccess.h +9 -2
@@ -83,7 +83,10 @@"2: ;nop\n" \" .section .fixup, \"ax\"\n" \" .align 4\n" \ -"3: mov %0, %3\n" \ +"3: # return -EFAULT\n" \ +" mov %0, %3\n" \ +" # zero out dst ptr\n" \ +" mov %1, 0\n" \" j 2b\n" \" .previous\n" \" .section __ex_table, \"a\"\n" \
@@ -101,7 +104,11 @@"2: ;nop\n" \" .section .fixup, \"ax\"\n" \" .align 4\n" \ -"3: mov %0, %3\n" \ +"3: # return -EFAULT\n" \ +" mov %0, %3\n" \ +" # zero out dst ptr\n" \ +" mov %1, 0\n" \ +" mov %R1, 0\n" \" j 2b\n" \" .previous\n" \" .section __ex_table, \"a\"\n" \
arch/arc/mm/tlbex.S +3 -3
@@ -89,7 +89,7 @@ ex_saved_reg1: #ifdef CONFIG_SMP sr r0, [ARC_REG_SCRATCH_DATA0] ; freeup r0 to code with GET_CPU_ID r0 ; get to per cpu scratch mem, - lsl r0, r0, L1_CACHE_SHIFT ; cache line wide per cpu + asl r0, r0, L1_CACHE_SHIFT ; cache line wide per cpu add r0, @ex_saved_reg1, r0 #else st r0, [@ex_saved_reg1]
@@ -108,7 +108,7 @@ ex_saved_reg1: .macro TLBMISS_RESTORE_REGS #ifdef CONFIG_SMP GET_CPU_ID r0 ; get to per cpu scratch mem - lsl r0, r0, L1_CACHE_SHIFT ; each is cache line wide + asl r0, r0, L1_CACHE_SHIFT ; each is cache line wide add r0, @ex_saved_reg1, r0 ld_s r3, [r0,12] ld_s r2, [r0, 8]
@@ -220,7 +220,7 @@ ex_saved_reg1: .macro CONV_PTE_TO_TLB and r3, r0, PTE_BITS_RWX ; r w x - lsl r2, r3, 3 ; r w x 0 0 0 + asl r2, r3, 3 ; r w x 0 0 0 and.f 0, r0, _PAGE_GLOBAL or.z r2, r2, r3 ; r w x r w x
arch/arm/boot/compressed/head.S +1 -1
@@ -726,7 +726,7 @@ __armv7_mmu_cache_on: orrne r0, r0, #1 @ MMU enabled movne r1, #0xfffffffd @ domain 0 = client bic r6, r6, #1 << 31 @ 32-bit translation system - bic r6, r6, #3 << 0 @ use only ttbr0 + bic r6, r6, #(7 << 0) | (1 << 4) @ use only ttbr0 mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer mcrne p15, 0, r1, c3, c0, 0 @ load domain access control mcrne p15, 0, r6, c2, c0, 2 @ load ttb control
arch/arm/boot/dts/kirkwood-ib62x0.dts +1 -1
@@ -113,7 +113,7 @@ partition@e0000 { label = "u-boot environment"; - reg = <0xe0000 0x100000>; + reg = <0xe0000 0x20000>; }; partition@100000 {
arch/arm/common/sa1111.c +13 -9
@@ -872,9 +872,9 @@ struct sa1111_save_data {#ifdef CONFIG_PM -static int sa1111_suspend (struct platform_device *dev,pm_message_t state) +static int sa1111_suspend_noirq (struct device *dev) { -struct sa1111 *sachip =platform_get_drvdata (dev); +struct sa1111 *sachip =dev_get_drvdata (dev);struct sa1111_save_data *save;unsigned long flags;unsigned int val;
@@ -937,9 +937,9 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state)* restored by their respective drivers, and must be called * via LDM after this function. */ -static int sa1111_resume (struct platform_device *dev) +static int sa1111_resume_noirq (struct device *dev) { -struct sa1111 *sachip =platform_get_drvdata (dev); +struct sa1111 *sachip =dev_get_drvdata (dev);struct sa1111_save_data *save;unsigned long flags, id;void __iomem *base;
@@ -955,7 +955,7 @@ static int sa1111_resume(struct platform_device *dev) id =sa1111_readl (sachip->base +SA1111_SKID );if ((id &SKID_ID_MASK ) !=SKID_SA1111_ID ) {__sa1111_remove (sachip); -platform_set_drvdata (dev,NULL ); +dev_set_drvdata (dev,NULL );kfree (save);return 0 ; }
@@ -1006,8 +1006,8 @@ static int sa1111_resume(struct platform_device *dev) }#else -#define sa1111_suspend NULL -#define sa1111_resume NULL +#define sa1111_suspend_noirq NULL +#define sa1111_resume_noirq NULL#endif static int sa1111_probe (struct platform_device *pdev)
@@ -1041,6 +1041,11 @@ static int sa1111_remove(struct platform_device *pdev)return 0 ; } +static struct dev_pm_ops sa1111_pm_ops = { + .suspend_noirq = sa1111_suspend_noirq, + .resume_noirq = sa1111_resume_noirq, +}; +/* * Not sure if this should be on the system bus or not yet. * We really want some way to register a system device at
@@ -1053,11 +1058,10 @@ static int sa1111_remove(struct platform_device *pdev)static struct platform_driver sa1111_device_driver = { .probe = sa1111_probe, .remove = sa1111_remove, - .suspend = sa1111_suspend, - .resume = sa1111_resume, .driver = { .name ="sa1111" , .owner =THIS_MODULE , + .pm = &sa1111_pm_ops, }, };
arch/arm/include/asm/dma-mapping.h +1 -1
@@ -117,7 +117,7 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)/* The ARM override for dma_max_pfn() */ static inline unsigned long dma_max_pfn (struct device *dev) { -return PHYS_PFN_OFFSET +dma_to_pfn (dev, *dev->dma_mask); +return dma_to_pfn (dev, *dev->dma_mask); }#define dma_max_pfn (dev) dma_max_pfn(dev)
arch/arm/kernel/sys_oabi-compat.c +7 -1
@@ -279,8 +279,12 @@ asmlinkage long sys_oabi_epoll_wait(int epfd,mm_segment_t fs;long ret, err, i; -if (maxevents <=0 || maxevents > (INT_MAX /sizeof (struct epoll_event ))) +if (maxevents <=0 || + maxevents > (INT_MAX /sizeof (*kbuf)) || + maxevents > (INT_MAX /sizeof (*events)))return -EINVAL ; +if (!access_ok (VERIFY_WRITE , events,sizeof (*events) * maxevents)) +return -EFAULT ; kbuf =kmalloc (sizeof (*kbuf) * maxevents,GFP_KERNEL );if (!kbuf)return -ENOMEM ;
@@ -317,6 +321,8 @@ asmlinkage long sys_oabi_semtimedop(int semid,if (nsops <1 || nsops >SEMOPM )return -EINVAL ; +if (!access_ok (VERIFY_READ , tsops,sizeof (*tsops) * nsops)) +return -EFAULT ; sops =kmalloc (sizeof (*sops) * nsops,GFP_KERNEL );if (!sops)return -ENOMEM ;
arch/arm/kvm/arm.c +0 -2
@@ -164,8 +164,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm) {int i; -kvm_free_stage2_pgd (kvm); -for (i =0 ; i <KVM_MAX_VCPUS ; ++i) {if (kvm->vcpus[i]) {kvm_arch_vcpu_free (kvm->vcpus[i]);
arch/arm/kvm/mmu.c +1 -0
@@ -1257,6 +1257,7 @@ void kvm_arch_memslots_updated(struct kvm *kvm)void kvm_arch_flush_shadow_all (struct kvm *kvm) { +kvm_free_stage2_pgd (kvm); } void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
arch/arm/mach-mvebu/coherency.c +8 -14
@@ -315,22 +315,16 @@ static void __init armada_370_coherency_init(struct device_node *np) }/* -* This ioremap hook is used on Armada 375/38x to ensure that PCIe -* memory areas are mapped as MT_UNCACHED instead of MT_DEVICE. This -* is needed as a workaround for a deadlock issue between the PCIe -* interface and the cache controller. +* This ioremap hook is used on Armada 375/38x to ensure that all MMIO +* areas are mapped as MT_UNCACHED instead of MT_DEVICE. This is +* needed for the HW I/O coherency mechanism to work properly without +* deadlock. */ static void __iomem * -armada_pcie_wa_ioremap_caller (phys_addr_t phys_addr,size_t size, -unsigned int mtype,void *caller) +armada_wa_ioremap_caller (phys_addr_t phys_addr,size_t size, +unsigned int mtype,void *caller) { -struct resource pcie_mem; - -mvebu_mbus_get_pcie_mem_aperture (&pcie_mem); - -if (pcie_mem.start <= phys_addr && (phys_addr + size) <= pcie_mem.end) - mtype =MT_UNCACHED ; - + mtype =MT_UNCACHED ;return __arm_ioremap_caller (phys_addr, size, mtype, caller); }
@@ -339,7 +333,7 @@ static void __init armada_375_380_coherency_init(struct device_node *np)struct device_node *cache_dn; coherency_cpu_base =of_iomap (np,0 ); - arch_ioremap_caller = armada_pcie_wa_ioremap_caller; + arch_ioremap_caller = armada_wa_ioremap_caller;/* * We should switch the PL310 to I/O coherency mode only if
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c +1 -0
@@ -1460,6 +1460,7 @@ static void omap_hwmod_am43xx_rst(void) {RSTCTRL (am33xx_pruss_hwmod,AM43XX_RM_PER_RSTCTRL_OFFSET );RSTCTRL (am33xx_gfx_hwmod,AM43XX_RM_GFX_RSTCTRL_OFFSET ); +RSTST (am33xx_pruss_hwmod,AM43XX_RM_PER_RSTST_OFFSET );RSTST (am33xx_gfx_hwmod,AM43XX_RM_GFX_RSTST_OFFSET ); }
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +12 -0
@@ -724,8 +724,20 @@ static struct omap_hwmod omap3xxx_dss_dispc_hwmod = {* display serial interface controller */ +static struct omap_hwmod_class_sysconfig omap3xxx_dsi_sysc = { + .rev_offs =0x0000 , + .sysc_offs =0x0010 , + .syss_offs =0x0014 , + .sysc_flags = (SYSC_HAS_AUTOIDLE |SYSC_HAS_CLOCKACTIVITY | +SYSC_HAS_ENAWAKEUP |SYSC_HAS_SIDLEMODE | +SYSC_HAS_SOFTRESET |SYSS_HAS_RESET_STATUS ), + .idlemodes = (SIDLE_FORCE |SIDLE_NO |SIDLE_SMART ), + .sysc_fields = &omap_hwmod_sysc_type1, +}; +static struct omap_hwmod_class omap3xxx_dsi_hwmod_class = { .name ="dsi" , + .sysc = &omap3xxx_dsi_sysc, };static struct omap_hwmod_irq_info omap3xxx_dsi1_irqs[] = {
arch/arm/mach-omap2/prcm43xx.h +1 -0
@@ -32,6 +32,7 @@/* RM RSTST offsets */ #define AM43XX_RM_GFX_RSTST_OFFSET 0x0014 +#define AM43XX_RM_PER_RSTST_OFFSET 0x0014#define AM43XX_RM_WKUP_RSTST_OFFSET 0x0014/* CM instances */
arch/arm/mach-sa1100/generic.c +3 -0
@@ -31,6 +31,7 @@#include <mach/hardware.h> #include <mach/irqs.h> +#include <mach/reset.h> #include "generic.h"
@@ -91,6 +92,8 @@ static void sa1100_power_off(void)void sa11x0_restart (enum reboot_mode mode,const char *cmd) { +clear_reset_status (RESET_STATUS_ALL ); +if (mode ==REBOOT_SOFT ) {/* Jump into ROM at address 0 */ soft_restart (0 );
arch/arm/mm/dma-mapping.c +39 -20
170 lines not on this page · raw message
arch/arm64/crypto/aes-glue.c +1 -1
@@ -205,7 +205,7 @@ static int ctr_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, err =blkcipher_walk_done (desc, &walk, walk.nbytes %AES_BLOCK_SIZE ); } -if (nbytes) { +if (walk.nbytes %AES_BLOCK_SIZE ) {u8 *tdst = walk.dst.virt.addr + blocks *AES_BLOCK_SIZE ;u8 *tsrc = walk.src.virt.addr + blocks *AES_BLOCK_SIZE ;u8 __aligned(8) tail[AES_BLOCK_SIZE ];
arch/arm64/include/asm/elf.h +1 -0
@@ -137,6 +137,7 @@ extern unsigned long randomize_et_dyn(unsigned long base);#define SET_PERSONALITY (ex) clear_thread_flag(TIF_32BIT); +/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */ #define ARCH_DLINFO \ do { \ NEW_AUX_ENT(AT_SYSINFO_EHDR, \
arch/arm64/include/asm/spinlock.h +10 -0
@@ -231,4 +231,14 @@ static inline int arch_read_trylock(arch_rwlock_t *rw)#define arch_read_relax (lock) cpu_relax()#define arch_write_relax (lock) cpu_relax() +/* +* Accesses appearing in program order before a spin_lock() operation +* can be reordered with accesses inside the critical section, by virtue +* of arch_spin_lock being constructed using acquire semantics. +* +* In cases where this is problematic (e.g. try_to_wake_up), an +* smp_mb__before_spinlock() can restore the required ordering. +*/ +#define smp_mb__before_spinlock () smp_mb() +#endif /* __ASM_SPINLOCK_H */
arch/arm64/include/uapi/asm/auxvec.h +2 -0
@@ -19,4 +19,6 @@/* vDSO location */ #define AT_SYSINFO_EHDR 33 +#define AT_VECTOR_SIZE_ARCH 1/* entries in ARCH_DLINFO */ +#endif
arch/arm64/kernel/debug-monitors.c +0 -1
@@ -159,7 +159,6 @@ static int debug_monitors_init(void)/* Clear the OS lock. */ on_each_cpu (clear_os_lock,NULL ,1 );isb (); -local_dbg_enable ();/* Register hotplug handler. */ __register_cpu_notifier (&os_lock_nb);
arch/arm64/kernel/perf_event.c +15 -6
@@ -316,22 +316,31 @@ out: }static int -validate_event (struct pmu_hw_events *hw_events, -struct perf_event *event) +validate_event (struct pmu *pmu,struct pmu_hw_events *hw_events, +struct perf_event *event) { -struct arm_pmu *armpmu =to_arm_pmu (event->pmu); +struct arm_pmu *armpmu;struct hw_perf_event fake_event = event->hw;struct pmu *leader_pmu = event->group_leader->pmu;if (is_software_event (event))return 1 ; +/* +* Reject groups spanning multiple HW PMUs (e.g. CPU + CCI). The +* core perf code won't check that the pmu->ctx == leader->ctx +* until after pmu->event_init(event). +*/ +if (event->pmu != pmu) +return 0 ; +if (event->pmu != leader_pmu || event->state <PERF_EVENT_STATE_OFF )return 1 ;if (event->state ==PERF_EVENT_STATE_OFF && !event->attr.enable_on_exec)return 1 ; + armpmu =to_arm_pmu (event->pmu);return armpmu->get_event_idx (hw_events, &fake_event) >=0 ; }
@@ -349,15 +358,15 @@ validate_group(struct perf_event *event)memset (fake_used_mask,0 ,sizeof (fake_used_mask)); fake_pmu.used_mask = fake_used_mask; -if (!validate_event (&fake_pmu, leader)) +if (!validate_event (event->pmu, &fake_pmu, leader))return -EINVAL ;list_for_each_entry (sibling, &leader->sibling_list, group_entry) { -if (!validate_event (&fake_pmu, sibling)) +if (!validate_event (event->pmu, &fake_pmu, sibling))return -EINVAL ; } -if (!validate_event (&fake_pmu, event)) +if (!validate_event (event->pmu, &fake_pmu, event))return -EINVAL ;return 0 ;
arch/arm64/kernel/smp.c +0 -1
@@ -174,7 +174,6 @@ asmlinkage void secondary_start_kernel(void)set_cpu_online (cpu, true);complete (&cpu_running); -local_dbg_enable ();local_irq_enable ();local_async_enable ();
arch/arm64/mm/proc.S +2 -0
@@ -189,6 +189,8 @@ ENTRY(__cpu_setup) msr cpacr_el1, x0 // Enable FP/ASIMD mov x0, #1 << 12 // Reset mdscr_el1 and disable msr mdscr_el1, x0 // access to the DCC from EL0 + isb // Unmask debug exceptions now, + enable_dbg // since this is per-cpu reset_pmuserenr_el0 x0 // Disable PMU access from EL0 /* * Memory region attributes for LPAE:
arch/avr32/include/asm/uaccess.h +10 -1
@@ -74,7 +74,7 @@ extern __kernel_size_t __copy_user(void *to, const void *from,extern __kernel_size_t copy_to_user (void __user *to,const void *from,__kernel_size_t n); -extern __kernel_size_t copy_from_user (void *to,const void __user *from, +extern __kernel_size_t ___copy_from_user (void *to,const void __user *from,__kernel_size_t n); static inline __kernel_size_t __copy_to_user(void __user *to, const void *from,
@@ -88,6 +88,15 @@ static inline __kernel_size_t __copy_from_user(void *to, {return __copy_user (to, (const void __force *)from, n); } +static inline __kernel_size_t copy_from_user (void *to, +const void __user *from, +__kernel_size_t n) +{ +size_t res =___copy_from_user (to, from, n); +if (unlikely (res)) +memset (to + (n - res),0 , res); +return res; +}#define __copy_to_user_inatomic __copy_to_user#define __copy_from_user_inatomic __copy_from_user
arch/avr32/kernel/avr32_ksyms.c +1 -1
@@ -36,7 +36,7 @@ EXPORT_SYMBOL(copy_page);/* * Userspace access stuff. */ -EXPORT_SYMBOL (copy_from_user); +EXPORT_SYMBOL (___copy_from_user);EXPORT_SYMBOL (copy_to_user);EXPORT_SYMBOL (__copy_user);EXPORT_SYMBOL (strncpy_from_user);
arch/avr32/lib/copy_user.S +4 -4
@@ -23,13 +23,13 @@ */ .text .align 1 - .global copy_from_user - .type copy_from_user, @function -copy_from_user: + .global ___copy_from_user + .type ___copy_from_user, @function +___copy_from_user: branch_if_kernel r8, __copy_user ret_if_privileged r8, r11, r10, r10 rjmp __copy_user - .size copy_from_user, . - copy_from_user + .size ___copy_from_user, . - ___copy_from_user .global copy_to_user .type copy_to_user, @function
arch/avr32/mach-at32ap/pio.c +1 -1
@@ -435,7 +435,7 @@ void __init at32_init_pio(struct platform_device *pdev)struct resource *regs;struct pio_device *pio; -if (pdev->id >MAX_NR_PIO_DEVICES ) { +if (pdev->id >=MAX_NR_PIO_DEVICES ) {dev_err (&pdev->dev,"only %d PIO devices supported\n" ,MAX_NR_PIO_DEVICES );return ;
arch/blackfin/include/asm/uaccess.h +5 -4
@@ -177,11 +177,12 @@ static inline int bad_user_access_length(void)static inline unsigned long __must_check copy_from_user (void *to,const void __user *from,unsigned long n) { -if (access_ok (VERIFY_READ , from, n)) +if (likely (access_ok (VERIFY_READ , from, n))) {memcpy (to, (const void __force *)from, n); -else -return n; -return 0 ; +return 0 ; + } +memset (to,0 , n); +return n; } static inline unsigned long __must_check
arch/cris/include/asm/uaccess.h +32 -39
102 lines not on this page · raw message
arch/frv/include/asm/uaccess.h +9 -3
@@ -263,19 +263,25 @@ do { \extern long __memset_user (void *dst,unsigned long count);extern long __memcpy_user (void *dst,const void *src,unsigned long count); -#define clear_user (dst,count) __memset_user(____force(dst), (count)) +#define __clear_user (dst,count) __memset_user(____force(dst), (count))#define __copy_from_user_inatomic (to, from, n) __memcpy_user((to), ____force(from), (n))#define __copy_to_user_inatomic (to, from, n) __memcpy_user(____force(to), (from), (n))#else -#define clear_user (dst,count) (memset(____force(dst), 0, (count)), 0) +#define __clear_user (dst,count) (memset(____force(dst), 0, (count)), 0)#define __copy_from_user_inatomic (to, from, n) (memcpy((to), ____force(from), (n)), 0)#define __copy_to_user_inatomic (to, from, n) (memcpy(____force(to), (from), (n)), 0)#endif -#define __clear_user clear_user +static inline unsigned long __must_check +clear_user (void __user *to,unsigned long n) +{ +if (likely (__access_ok (to, n))) + n =__clear_user (to, n); +return n; +}static inline unsigned long __must_check __copy_to_user (void __user *to,const void *from,unsigned long n)
arch/hexagon/include/asm/uaccess.h +2 -1
@@ -102,7 +102,8 @@ static inline long hexagon_strncpy_from_user(char *dst, const char __user *src, {long res =__strnlen_user (src, n); -/* return from strnlen can't be zero -- that would be rubbish. */ +if (unlikely (!res)) +return -EFAULT ;if (res > n) {copy_from_user (dst, src, n);
arch/ia64/include/asm/uaccess.h +9 -11
@@ -262,17 +262,15 @@ __copy_from_user (void *to, const void __user *from, unsigned long count) __cu_len; \ }) -#define copy_from_user (to, from, n) \ -({ \ - void *__cu_to = (to); \ - const void __user *__cu_from = (from); \ - long __cu_len = (n); \ - \ - __chk_user_ptr(__cu_from); \ - if (__access_ok(__cu_from, __cu_len, get_fs())) \ - __cu_len = __copy_user((__force void __user *) __cu_to, __cu_from, __cu_len); \ - __cu_len; \ -}) +static inline unsigned long +copy_from_user (void *to,const void __user *from,unsigned long n) +{ +if (likely (__access_ok (from, n,get_fs ()))) + n =__copy_user ((__force void __user *) to, from, n); +else +memset (to,0 , n); +return n; +}#define __copy_in_user (to, from, size) __copy_user((to), (from), (size))
arch/m32r/include/asm/uaccess.h +1 -1
@@ -215,7 +215,7 @@ extern int fixup_exception(struct pt_regs *regs);#define __get_user_nocheck (x,ptr,size) \ ({ \ long __gu_err = 0; \ - unsigned long __gu_val; \ + unsigned long __gu_val = 0; \ might_fault(); \ __get_user_size(__gu_val,(ptr),(size),__gu_err); \ (x) = (__typeof__(*(ptr)))__gu_val; \
arch/metag/include/asm/cmpxchg_lnkget.h +1 -1
@@ -73,7 +73,7 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old, " DCACHE [%2], %0\n" #endif "2:\n" - : "=&d" (temp), "=&da" (retval) + : "=&d" (temp), "=&d" (retval) : "da" (m), "bd" (old), "da" (new) : "cc" );
arch/metag/include/asm/uaccess.h +2 -1
@@ -199,8 +199,9 @@ extern unsigned long __must_check __copy_user_zeroing(void *to,static inline unsigned long copy_from_user (void *to,const void __user *from,unsigned long n) { -if (access_ok (VERIFY_READ , from, n)) +if (likely (access_ok (VERIFY_READ , from, n)))return __copy_user_zeroing (to, from, n); +memset (to,0 , n);return n; }
arch/microblaze/include/asm/uaccess.h +7 -4
@@ -226,7 +226,7 @@ extern long __user_bad(void);#define __get_user (x, ptr) \ ({ \ - unsigned long __gu_val; \ + unsigned long __gu_val = 0; \/*unsigned long __gu_ptr = (unsigned long)(ptr);*/ \long __gu_err; \switch (sizeof (*(ptr))) { \
@@ -371,10 +371,13 @@ extern long __user_bad(void);static inline long copy_from_user (void *to,const void __user *from,unsigned long n) { +unsigned long res = n;might_fault (); -if (access_ok (VERIFY_READ , from, n)) -return __copy_from_user (to, from, n); -return n; +if (likely (access_ok (VERIFY_READ , from, n))) + res =__copy_from_user (to, from, n); +if (unlikely (res)) +memset (to + (n - res),0 , res); +return res; }#define __copy_to_user (to, from, n) \
arch/mips/include/asm/mach-paravirt/kernel-entry-init.h +2 -0
@@ -11,11 +11,13 @@#define CP0_EBASE $15, 1 .macro kernel_entry_setup +#ifdef CONFIG_SMP mfc0 t0,CP0_EBASE andi t0, t0, 0x3ff # CPUNum beqz t0, 1f # CPUs other than zero goto smp_bootstrap j smp_bootstrap +#endif /* CONFIG_SMP */ 1: .endm
arch/mips/include/asm/pgtable.h +5 -1
@@ -572,7 +572,11 @@ static inline struct page *pmd_page(pmd_t pmd)static inline pmd_t pmd_modify (pmd_t pmd,pgprot_t newprot) { -pmd_val (pmd) = (pmd_val (pmd) & _PAGE_CHG_MASK) |pgprot_val (newprot); +pmd_val (pmd) = (pmd_val (pmd) & (_PAGE_CHG_MASK +#ifdef _PAGE_HUGE + | _PAGE_HUGE +#endif + )) |pgprot_val (newprot);return pmd; }
arch/mips/include/asm/r4kcache.h +4 -0
@@ -263,7 +263,11 @@ static inline void protected_writeback_dcache_line(unsigned long addr)static inline void protected_writeback_scache_line (unsigned long addr) { +#ifdef CONFIG_EVA +protected_cachee_op (Hit_Writeback_Inv_SD, addr); +#else protected_cache_op (Hit_Writeback_Inv_SD, addr); +#endif }/*
arch/mips/include/asm/uaccess.h +3 -0
@@ -14,6 +14,7 @@#include <linux/kernel.h> #include <linux/errno.h> #include <linux/thread_info.h> +#include <linux/string.h> #include <asm/asm-eva.h> /*
@@ -1139,6 +1140,8 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n); __cu_len =__invoke_copy_from_user (__cu_to, \ __cu_from, \ __cu_len); \ + }else { \ +memset (__cu_to,0 , __cu_len); \ } \ } \ __cu_len; \
arch/mips/kernel/scall64-n32.S +1 -1
@@ -353,7 +353,7 @@ EXPORT(sysn32_call_table) PTR sys_ni_syscall /* available, was setaltroot */ PTR sys_add_key PTR sys_request_key - PTR sys_keyctl /* 6245 */ + PTR compat_sys_keyctl /* 6245 */ PTR sys_set_thread_area PTR sys_inotify_init PTR sys_inotify_add_watch
arch/mips/kernel/scall64-o32.S +1 -1
@@ -491,7 +491,7 @@ EXPORT(sys32_call_table) PTR sys_ni_syscall /* available, was setaltroot */ PTR sys_add_key /* 4280 */ PTR sys_request_key - PTR sys_keyctl + PTR compat_sys_keyctl PTR sys_set_thread_area PTR sys_inotify_init PTR sys_inotify_add_watch /* 4285 */
arch/mips/kvm/kvm_mips.c +1 -1
@@ -1211,7 +1211,7 @@ int __init kvm_mips_init(void)*/ kvm_mips_gfn_to_pfn = gfn_to_pfn; kvm_mips_release_pfn_clean = kvm_release_pfn_clean; - kvm_mips_is_error_pfn = is_error_pfn; + kvm_mips_is_error_pfn = is_error_noslot_pfn;pr_info ("KVM/MIPS Initialized\n" );return 0 ;
arch/mips/kvm/kvm_mips_emul.c +80 -18
148 lines not on this page · raw message
arch/mips/kvm/kvm_tlb.c +44 -20
98 lines not on this page · raw message
arch/mips/mm/sc-rm7k.c +1 -1
@@ -161,7 +161,7 @@ static void rm7k_tc_disable(void)local_irq_save (flags);blast_rm7k_tcache ();clear_c0_config (RM7K_CONF_TE ); -local_irq_save (flags); +local_irq_restore (flags); }static void rm7k_sc_disable (void )
arch/mips/mti-malta/malta-setup.c +7 -1
@@ -36,6 +36,9 @@#include <linux/console.h> #endif +#define ROCIT_CONFIG_GEN0 0x1f403000 +#define ROCIT_CONFIG_GEN0_PCI_IOCU BIT(7) +extern void malta_be_init (void );extern int malta_be_handler (struct pt_regs *regs,int is_fixup);
@@ -104,6 +107,8 @@ static void __init fd_activate(void)static int __init plat_enable_iocoherency (void ) {int supported =0 ; +u32 cfg; +if (mips_revision_sconid ==MIPS_REVISION_SCON_BONITO ) {if (BONITO_PCICACHECTRL &BONITO_PCICACHECTRL_CPUCOH_PRES ) {BONITO_PCICACHECTRL |=BONITO_PCICACHECTRL_CPUCOH_EN ;
@@ -126,7 +131,8 @@ static int __init plat_enable_iocoherency(void) }else if (mips_cm_numiocu () !=0 ) {/* Nothing special needs to be done to enable coherency */ pr_info ("CMP IOCU detected\n" ); -if ((*(unsigned int *)0xbf403000 &0x81 ) !=0x81 ) { + cfg =__raw_readl ((u32 *)CKSEG1ADDR (ROCIT_CONFIG_GEN0 )); +if (!(cfg &ROCIT_CONFIG_GEN0_PCI_IOCU )) {pr_crit ("IOCU OPERATION DISABLED BY SWITCH - DEFAULTING TO SW IO COHERENCY\n" );return 0 ; }
arch/mips/net/bpf_jit.c +1 -1
@@ -1365,7 +1365,7 @@ void bpf_jit_compile(struct sk_filter *fp)memset (&ctx,0 ,sizeof (ctx)); - ctx.offsets =kcalloc (fp->len,sizeof (*ctx.offsets),GFP_KERNEL ); + ctx.offsets =kcalloc (fp->len +1 ,sizeof (*ctx.offsets),GFP_KERNEL );if (ctx.offsets ==NULL )return ;
arch/mn10300/include/asm/uaccess.h +1 -0
@@ -181,6 +181,7 @@ struct __large_struct { unsigned long buf[100]; };"2:\n" \" .section .fixup,\"ax\"\n" \"3:\n\t" \ +" mov 0,%1\n" \" mov %3,%0\n" \" jmp 2b\n" \" .previous\n" \
arch/mn10300/lib/usercopy.c +3 -1
@@ -9,7 +9,7 @@* as published by the Free Software Foundation; either version * 2 of the Licence, or (at your option) any later version. */ -#include <asm/uaccess.h> +#include <linux/uaccess.h> unsigned long __generic_copy_to_user (void *to,const void *from,unsigned long n)
@@ -24,6 +24,8 @@ __generic_copy_from_user(void *to, const void *from, unsigned long n) {if (access_ok (VERIFY_READ , from, n))__copy_user_zeroing (to, from, n); +else +memset (to,0 , n);return n; }
arch/openrisc/include/asm/uaccess.h +11 -24
@@ -273,28 +273,20 @@ __copy_tofrom_user(void *to, const void *from, unsigned long size);static inline unsigned long copy_from_user (void *to,const void *from,unsigned long n) { -unsigned long over; - -if (access_ok (VERIFY_READ , from, n)) -return __copy_tofrom_user (to, from, n); -if ((unsigned long )from <TASK_SIZE ) { - over = (unsigned long )from + n -TASK_SIZE ; -return __copy_tofrom_user (to, from, n - over) + over; - } -return n; +unsigned long res = n; + +if (likely (access_ok (VERIFY_READ , from, n))) + res =__copy_tofrom_user (to, from, n); +if (unlikely (res)) +memset (to + (n - res),0 , res); +return res; }static inline unsigned long copy_to_user (void *to,const void *from,unsigned long n) { -unsigned long over; - -if (access_ok (VERIFY_WRITE , to, n)) -return __copy_tofrom_user (to, from, n); -if ((unsigned long )to <TASK_SIZE ) { - over = (unsigned long )to + n -TASK_SIZE ; -return __copy_tofrom_user (to, from, n - over) + over; - } +if (likely (access_ok (VERIFY_WRITE , to, n))) + n =__copy_tofrom_user (to, from, n);return n; }
@@ -303,13 +295,8 @@ extern unsigned long __clear_user(void *addr, unsigned long size);static inline __must_check unsigned long clear_user (void *addr,unsigned long size) { - -if (access_ok (VERIFY_WRITE , addr, size)) -return __clear_user (addr, size); -if ((unsigned long )addr <TASK_SIZE ) { -unsigned long over = (unsigned long )addr + size -TASK_SIZE ; -return __clear_user (addr, size - over) + over; - } +if (likely (access_ok (VERIFY_WRITE , addr, size))) + size =__clear_user (addr, size);return size; }
arch/parisc/include/asm/uaccess.h +5 -2
@@ -9,6 +9,8 @@#include <asm/errno.h> #include <asm-generic/uaccess-unaligned.h> +#include <linux/string.h> +#define VERIFY_READ 0#define VERIFY_WRITE 1
@@ -248,13 +250,14 @@ static inline unsigned long __must_check copy_from_user(void *to, unsigned long n) {int sz =__compiletime_object_size (to); -int ret = -EFAULT ; +unsigned long ret = n;if (likely (sz ==-1 || !__builtin_constant_p (n) || sz >= n)) ret =__copy_from_user (to, from, n);else copy_from_user_overflow (); - +if (unlikely (ret)) +memset (to + (n - ret),0 , ret);return ret; }
arch/parisc/include/uapi/asm/errno.h +2 -2
@@ -97,10 +97,10 @@#define ENOTCONN 235/* Transport endpoint is not connected */ #define ESHUTDOWN 236/* Cannot send after transport endpoint shutdown */ #define ETOOMANYREFS 237/* Too many references: cannot splice */ -#define EREFUSED ECONNREFUSED/* for HP's NFS apparently */ #define ETIMEDOUT 238/* Connection timed out */ #define ECONNREFUSED 239/* Connection refused */ -#define EREMOTERELEASE 240/* Remote peer released connection */ +#define EREFUSED ECONNREFUSED/* for HP's NFS apparently */ +#define EREMOTERELEASE 240/* Remote peer released connection */ #define EHOSTDOWN 241/* Host is down */ #define EHOSTUNREACH 242/* No route to host */
arch/powerpc/include/asm/pci-bridge.h +1 -0
@@ -246,6 +246,7 @@ extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,/* Allocate & free a PCI host bridge structure */ extern struct pci_controller *pcibios_alloc_controller (struct device_node *dev);extern void pcibios_free_controller (struct pci_controller *phb); +extern void pcibios_free_controller_deferred (struct pci_host_bridge *bridge);#ifdef CONFIG_PCI extern int pcibios_vaddr_is_ioport (void __iomem *address);
arch/powerpc/include/asm/uaccess.h +2 -19
@@ -323,30 +323,17 @@ extern unsigned long __copy_tofrom_user(void __user *to,static inline unsigned long copy_from_user (void *to,const void __user *from,unsigned long n) { -unsigned long over; - -if (access_ok (VERIFY_READ , from, n)) +if (likely (access_ok (VERIFY_READ , from, n)))return __copy_tofrom_user ((__force void __user *)to, from, n); -if ((unsigned long )from <TASK_SIZE ) { - over = (unsigned long )from + n -TASK_SIZE ; -return __copy_tofrom_user ((__force void __user *)to, from, - n - over) + over; - } +memset (to,0 , n);return n; }static inline unsigned long copy_to_user (void __user *to,const void *from,unsigned long n) { -unsigned long over; -if (access_ok (VERIFY_WRITE , to, n))return __copy_tofrom_user (to, (__force void __user *)from, n); -if ((unsigned long )to <TASK_SIZE ) { - over = (unsigned long )to + n -TASK_SIZE ; -return __copy_tofrom_user (to, (__force void __user *)from, - n - over) + over; - }return n; }
@@ -437,10 +424,6 @@ static inline unsigned long clear_user(void __user *addr, unsigned long size)might_fault ();if (likely (access_ok (VERIFY_WRITE , addr, size)))return __clear_user (addr, size); -if ((unsigned long )addr <TASK_SIZE ) { -unsigned long over = (unsigned long )addr + size -TASK_SIZE ; -return __clear_user (addr, size - over) + over; - }return size; }
arch/powerpc/kernel/exceptions-64s.S +12 -27
@@ -153,29 +153,14 @@ machine_check_pSeries_1: */ HMT_MEDIUM_PPR_DISCARD SET_SCRATCH0(r13) /* save r13 */ -#ifdef CONFIG_PPC_P7_NAP -BEGIN_FTR_SECTION - /* Running native on arch 2.06 or later, check if we are - * waking up from nap. We only handle no state loss and - * supervisor state loss. We do -not- handle hypervisor - * state loss at this time. + /* + * Running native on arch 2.06 or later, we may wakeup from winkle + * inside machine check. If yes, then last bit of HSPGR0 would be set + * to 1. Hence clear it unconditionally. */ - mfspr r13,SPRN_SRR1 - rlwinm. r13,r13,47-31,30,31 - OPT_GET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR) - beq 9f - - mfspr r13,SPRN_SRR1 - rlwinm. r13,r13,47-31,30,31 - /* waking up from powersave (nap) state */ - cmpwi cr1,r13,2 - /* Total loss of HV state is fatal. let's just stay stuck here */ - OPT_GET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR) - bgt cr1,. -9: - OPT_SET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR) -END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206) -#endif /* CONFIG_PPC_P7_NAP */ + GET_PACA(r13) + clrrdi r13,r13,1 + SET_PACA(r13) EXCEPTION_PROLOG_0(PACA_EXMC) BEGIN_FTR_SECTION b machine_check_pSeries_early
@@ -1418,17 +1403,17 @@ machine_check_handle_early: * Check if thread was in power saving mode. We come here when any * of the following is true: * a. thread wasn't in power saving mode - * b. thread was in power saving mode with no state loss or - * supervisor state loss + * b. thread was in power saving mode with no state loss, + * supervisor state loss or hypervisor state loss. * - * Go back to nap again if (b) is true. + * Go back to nap/sleep/winkle mode again if (b) is true. */ rlwinm. r11,r12,47-31,30,31 /* Was it in power saving mode? */ beq 4f /* No, it wasn;t */ /* Thread was in power saving mode. Go back to nap again. */ cmpwi r11,2 - bne 3f - /* Supervisor state loss */ + blt 3f + /* Supervisor/Hypervisor state loss */ li r0,1 stb r0,PACA_NAPSTATELOST(r13) 3: bl machine_check_queue_event
arch/powerpc/kernel/mce.c +2 -1
@@ -92,7 +92,8 @@ void save_mce_event(struct pt_regs *regs, long handled, mce->in_use =1 ; mce->initiator =MCE_INITIATOR_CPU ; -if (handled) +/* Mark it recovered if we have handled it and MSR(RI=1). */ +if (handled && (regs->msr &MSR_RI )) mce->disposition =MCE_DISPOSITION_RECOVERED ;else mce->disposition =MCE_DISPOSITION_NOT_RECOVERED ;
arch/powerpc/kernel/pci-common.c +36 -0
@@ -102,6 +102,42 @@ void pcibios_free_controller(struct pci_controller *phb) }/* +* This function is used to call pcibios_free_controller() +* in a deferred manner: a callback from the PCI subsystem. +* +* _*DO NOT*_ call pcibios_free_controller() explicitly if +* this is used (or it may access an invalid *phb pointer). +* +* The callback occurs when all references to the root bus +* are dropped (e.g., child buses/devices and their users). +* +* It's called as .release_fn() of 'struct pci_host_bridge' +* which is associated with the 'struct pci_controller.bus' +* (root bus) - it expects .release_data to hold a pointer +* to 'struct pci_controller'. +* +* In order to use it, register .release_fn()/release_data +* like this: +* +* pci_set_host_bridge_release(bridge, +* pcibios_free_controller_deferred +* (void *) phb); +* +* e.g. in the pcibios_root_bridge_prepare() callback from +* pci_create_root_bus(). +*/ +void pcibios_free_controller_deferred (struct pci_host_bridge *bridge) +{ +struct pci_controller *phb = (struct pci_controller *) + bridge->release_data; + +pr_debug ("domain %d, dynamic %d\n" , phb->global_number, phb->is_dynamic); + +pcibios_free_controller (phb); +} +EXPORT_SYMBOL_GPL (pcibios_free_controller_deferred); + +/* * The function is used to return the minimal alignment * for memory or I/O windows of the associated P2P bridge. * By default, 4KiB alignment for I/O windows and 1MiB for
arch/powerpc/kernel/prom_init.c +6 -3
@@ -685,7 +685,7 @@ unsigned char ibm_architecture_vec[] = {OV4_MIN_ENT_CAP ,/* minimum VP entitled capacity */ /* option vector 5: PAPR/OF options */ -19 -2 ,/* length */ +22 -2 ,/* length */ 0 ,/* don't ignore, don't halt */ OV5_FEAT (OV5_LPAR ) |OV5_FEAT (OV5_SPLPAR ) |OV5_FEAT (OV5_LARGE_PAGES ) | OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) |
@@ -716,8 +716,11 @@ unsigned char ibm_architecture_vec[] = {0 ,0 ,OV5_FEAT (OV5_PFO_HW_RNG ) |OV5_FEAT (OV5_PFO_HW_ENCR ) | -OV5_FEAT (OV5_PFO_HW_842 ), -OV5_FEAT (OV5_SUB_PROCESSORS ), +OV5_FEAT (OV5_PFO_HW_842 ),/* Byte 17 */ +0 ,/* Byte 18 */ +0 ,/* Byte 19 */ +0 ,/* Byte 20 */ +OV5_FEAT (OV5_SUB_PROCESSORS ),/* Byte 21 */ /* option vector 6: IBM PAPR hints */ 4 -2 ,/* length */ 0,
arch/powerpc/kernel/tm.S +1 -2
@@ -338,8 +338,6 @@ _GLOBAL(__tm_recheckpoint) */ subi r7, r7, STACK_FRAME_OVERHEAD - SET_SCRATCH0(r1) - mfmsr r6 /* R4 = original MSR to indicate whether thread used FP/Vector etc. */
@@ -468,6 +466,7 @@ restore_gprs: * until we turn MSR RI back on. */ + SET_SCRATCH0(r1) ld r5, -8(r1) ld r1, -16(r1)
arch/powerpc/platforms/powernv/opal-dump.c +6 -1
@@ -365,6 +365,7 @@ static int process_dump(void)uint32_t dump_id, dump_size, dump_type;struct dump_obj *dump;char name[22 ]; +struct kobject *kobj; rc =dump_read_info (&dump_id, &dump_size, &dump_type);if (rc !=OPAL_SUCCESS )
@@ -376,8 +377,12 @@ static int process_dump(void)* that gracefully and not create two conflicting * entries. */ -if (kset_find_obj (dump_kset, name)) + kobj =kset_find_obj (dump_kset, name); +if (kobj) { +/* Drop reference added by kset_find_obj() */ +kobject_put (kobj);return 0 ; + } dump =create_dump_obj (dump_id, dump_size, dump_type);if (!dump)
arch/powerpc/platforms/powernv/opal-elog.c +6 -1
@@ -246,6 +246,7 @@ static void elog_work_fn(struct work_struct *work)uint64_t elog_type;int rc;char name[2 +16 +1 ]; +struct kobject *kobj; rc =opal_get_elog_size (&id, &size, &type);if (rc !=OPAL_SUCCESS ) {
@@ -268,8 +269,12 @@ static void elog_work_fn(struct work_struct *work)* that gracefully and not create two conflicting * entries. */ -if (kset_find_obj (elog_kset, name)) + kobj =kset_find_obj (elog_kset, name); +if (kobj) { +/* Drop reference added by kset_find_obj() */ +kobject_put (kobj);return ; + }create_elog_obj (log_id, elog_size, elog_type); }
arch/powerpc/platforms/powernv/opal.c +1 -0
@@ -459,6 +459,7 @@ static int opal_recover_mce(struct pt_regs *regs,if (!(regs->msr &MSR_RI )) {/* If MSR_RI isn't set, we cannot recover */ +pr_err ("Machine check interrupt unrecoverable: MSR(RI=0)\n" ); recovered =0 ; }else if (evt->disposition ==MCE_DISPOSITION_RECOVERED ) {/* Platform corrected itself */
arch/powerpc/platforms/pseries/pci.c +4 -0
@@ -118,6 +118,10 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) bus = bridge->bus; +/* Rely on the pcibios_free_controller_deferred() callback. */ +pci_set_host_bridge_release (bridge, pcibios_free_controller_deferred, + (void *)pci_bus_to_host (bus)); + dn =pcibios_get_phb_of_node (bus);if (!dn)return 0 ;
arch/powerpc/platforms/pseries/pci_dlpar.c +5 -2
@@ -135,8 +135,11 @@ int remove_phb_dynamic(struct pci_controller *phb)release_resource (res); } -/* Free pci_controller data structure */ -pcibios_free_controller (phb); +/* +* The pci_controller data structure is freed by +* the pcibios_free_controller_deferred() callback; +* see pseries_root_bridge_prepare(). +*/ return 0 ; }
arch/s390/include/asm/elf.h +1 -0
@@ -210,6 +210,7 @@ do { \#define STACK_RND_MASK 0x7ffUL +/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */ #define ARCH_DLINFO \ do { \ if (vdso_enabled) \
arch/s390/include/asm/tlbflush.h +2 -1
@@ -88,7 +88,8 @@ static inline void __tlb_flush_full(struct mm_struct *mm) }/* -* Flush TLB entries for a specific ASCE on all CPUs. +* Flush TLB entries for a specific ASCE on all CPUs. Should never be used +* when more than one asce (e.g. gmap) ran on this mm. */ static inline void __tlb_flush_asce (struct mm_struct *mm,unsigned long asce) {
arch/s390/include/asm/uaccess.h +4 -4
@@ -213,28 +213,28 @@ int __put_user_bad(void) __attribute__((noreturn));__chk_user_ptr (ptr); \switch (sizeof (*(ptr))) { \case 1 : { \ -unsigned char __x; \ +unsigned char __x =0 ; \ __gu_err =__get_user_fn (&__x, ptr, \sizeof (*(ptr))); \ (x) = *(__force __typeof__(*(ptr)) *) &__x; \break ; \ }; \case 2 : { \ -unsigned short __x; \ +unsigned short __x =0 ; \ __gu_err =__get_user_fn (&__x, ptr, \sizeof (*(ptr))); \ (x) = *(__force __typeof__(*(ptr)) *) &__x; \break ; \ }; \case 4 : { \ -unsigned int __x; \ +unsigned int __x =0 ; \ __gu_err =__get_user_fn (&__x, ptr, \sizeof (*(ptr))); \ (x) = *(__force __typeof__(*(ptr)) *) &__x; \break ; \ }; \case 8 : { \ -unsigned long long __x; \ +unsigned long long __x =0 ; \ __gu_err =__get_user_fn (&__x, ptr, \sizeof (*(ptr))); \ (x) = *(__force __typeof__(*(ptr)) *) &__x; \
arch/s390/include/uapi/asm/auxvec.h +2 -0
@@ -3,4 +3,6 @@#define AT_SYSINFO_EHDR 33 +#define AT_VECTOR_SIZE_ARCH 1/* entries in ARCH_DLINFO */ +#endif
arch/s390/mm/pgtable.c +2 -2
@@ -202,7 +202,7 @@ static int gmap_unlink_segment(struct gmap *gmap, unsigned long *table)static void gmap_flush_tlb (struct gmap *gmap) {if (MACHINE_HAS_IDTE ) -__tlb_flush_asce (gmap->mm, (unsigned long ) gmap->table | +__tlb_flush_idte ((unsigned long ) gmap->table | _ASCE_TYPE_REGION1);else __tlb_flush_global ();
@@ -221,7 +221,7 @@ void gmap_free(struct gmap *gmap)/* Flush tlb. */ if (MACHINE_HAS_IDTE ) -__tlb_flush_asce (gmap->mm, (unsigned long ) gmap->table | +__tlb_flush_idte ((unsigned long ) gmap->table | _ASCE_TYPE_REGION1);else __tlb_flush_global ();
arch/score/include/asm/uaccess.h +24 -22
95 lines not on this page · raw message
arch/sh/include/asm/uaccess.h +4 -1
@@ -151,7 +151,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n)__kernel_size_t __copy_size = (__kernel_size_t ) n;if (__copy_size &&__access_ok (__copy_from, __copy_size)) -return __copy_user (to, from, __copy_size); + __copy_size =__copy_user (to, from, __copy_size); + +if (unlikely (__copy_size)) +memset (to + (n - __copy_size),0 , __copy_size);return __copy_size; }
arch/sh/include/asm/uaccess_64.h +1 -0
@@ -24,6 +24,7 @@#define __get_user_size (x,ptr,size,retval) \ do { \ retval = 0; \ + x = 0; \ switch (size) { \ case 1: \ retval = __get_user_asm_b((void *)&x, \
arch/sparc/include/asm/uaccess_32.h +3 -1
@@ -265,8 +265,10 @@ static inline unsigned long copy_from_user(void *to, const void __user *from, un {if (n &&__access_ok ((unsigned long ) from, n))return __copy_user ((__force void __user *) to, from, n); -else +else { +memset (to,0 , n);return n; + } }static inline unsigned long __copy_from_user (void *to,const void __user *from,unsigned long n)
arch/tile/include/asm/elf.h +1 -0
@@ -131,6 +131,7 @@ extern int dump_task_regs(struct task_struct *, elf_gregset_t *);struct linux_binprm ;extern int arch_setup_additional_pages (struct linux_binprm *bprm,int executable_stack); +/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */ #define ARCH_DLINFO \ do { \ NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \
arch/tile/include/uapi/asm/auxvec.h +2 -0
@@ -18,4 +18,6 @@/* The vDSO location. */ #define AT_SYSINFO_EHDR 33 +#define AT_VECTOR_SIZE_ARCH 1/* entries in ARCH_DLINFO */ +#endif /* _ASM_TILE_AUXVEC_H */
arch/x86/boot/compressed/eboot.c +13 -7
@@ -1266,7 +1266,7 @@ static efi_status_t exit_boot(struct boot_params *boot_params, void *handle, bool is64) {struct efi_info *efi = &boot_params->efi_info; -unsigned long map_sz, key, desc_size; +unsigned long map_sz, key, desc_size, buff_size;efi_memory_desc_t *mem_map;struct setup_data *e820ext;const char *signature;
@@ -1277,14 +1277,20 @@ static efi_status_t exit_boot(struct boot_params *boot_params,bool called_exit = false;u8 nr_entries;int i; - - nr_desc =0 ; - e820ext =NULL ; - e820ext_size =0 ; +struct efi_boot_memmap map; + + nr_desc =0 ; + e820ext =NULL ; + e820ext_size =0 ; + map.map = &mem_map; + map.map_size = &map_sz; + map.desc_size = &desc_size; + map.desc_ver = &desc_version; + map.key_ptr = &key; + map.buff_size = &buff_size; get_map: - status =efi_get_memory_map (sys_table, &mem_map, &map_sz, &desc_size, - &desc_version, &key); + status =efi_get_memory_map (sys_table, &map);if (status !=EFI_SUCCESS )return status;
arch/x86/include/asm/tlbflush.h +7 -0
@@ -17,7 +17,14 @@static inline void __native_flush_tlb (void ) { +/* +* If current->mm == NULL then we borrow a mm which may change during a +* task switch and therefore we must not be preempted while we write CR3 +* back: +*/ +preempt_disable ();native_write_cr3 (native_read_cr3 ()); +preempt_enable (); }static inline void __native_flush_tlb_global_irq_disabled (void )
arch/x86/kernel/apic/apic.c +3 -0
@@ -1615,6 +1615,9 @@ void __init enable_IR_x2apic(void)int ret, x2apic_enabled =0 ;int hardware_init_ret; +if (skip_ioapic_setup) +return ; +/* Make sure irq_remap_ops are initialized */ setup_irq_remapping_ops ();
arch/x86/kernel/cpu/amd.c +14 -0
@@ -522,6 +522,17 @@ static const int amd_erratum_383[];static const int amd_erratum_400[];static bool cpu_has_amd_erratum (struct cpuinfo_x86 *cpu,const int *erratum); +#define MSR_AMD64_DE_CFG 0xC0011029 + +static void init_amd_ln (struct cpuinfo_x86 *c) +{ +/* +* Apply erratum 665 fix unconditionally so machines without a BIOS +* fix work. +*/ +msr_set_bit (MSR_AMD64_DE_CFG ,31 ); +} +static void init_amd (struct cpuinfo_x86 *c) {u32 dummy;
@@ -614,6 +625,9 @@ static void init_amd(struct cpuinfo_x86 *c) } } +if (c->x86 ==0x12 ) +init_amd_ln (c); +/* re-enable TopologyExtensions if switched off by BIOS */ if ((c->x86 == 0x15) && (c->x86_model >= 0x10) && (c->x86_model <= 0x1f) &&
arch/x86/kernel/cpu/perf_event_amd.c +2 -2
@@ -119,8 +119,8 @@ static const u64 amd_perfmon_event_map[] = { [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, - [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0080, - [PERF_COUNT_HW_CACHE_MISSES] = 0x0081, + [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d, + [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */
arch/x86/kernel/early-quirks.c +92 -13
176 lines not on this page · raw message
arch/x86/kernel/paravirt.c +2 -2
@@ -55,12 +55,12 @@ asm (".pushsection .entry.text, \"ax\"\n" ".popsection");/* identity function, which can be inlined */ -u32 _paravirt_ident_32 (u32 x) +u32 notrace _paravirt_ident_32(u32 x) {return x; } -u64 _paravirt_ident_64 (u64 x) +u64 notrace _paravirt_ident_64(u64 x) {return x; }
arch/x86/kvm/vmx.c +61 -16
133 lines not on this page · raw message
arch/x86/syscalls/syscall_32.tbl +1 -1
@@ -294,7 +294,7 @@ # 285 sys_setaltroot 286 i386 add_key sys_add_key 287 i386 request_key sys_request_key -288 i386 keyctl sys_keyctl +288 i386 keyctl sys_keyctl compat_sys_keyctl 289 i386 ioprio_set sys_ioprio_set 290 i386 ioprio_get sys_ioprio_get 291 i386 inotify_init sys_inotify_init
block/genhd.c +2 -1
@@ -611,7 +611,7 @@ void add_disk(struct gendisk *disk)/* Register BDI before referencing it from bdev */ bdi = &disk->queue->backing_dev_info; -bdi_register_dev (bdi,disk_devt (disk)); +bdi_register_owner (bdi,disk_to_dev (disk));blk_register_region (disk_devt (disk), disk->minors,NULL , exact_match, exact_lock, disk);
@@ -829,6 +829,7 @@ static void disk_seqf_stop(struct seq_file *seqf, void *v)if (iter) {class_dev_iter_exit (iter);kfree (iter); + seqf->private =NULL ; } }
crypto/blkcipher.c +2 -1
@@ -233,6 +233,8 @@ static int blkcipher_walk_next(struct blkcipher_desc *desc,return blkcipher_walk_done (desc, walk, -EINVAL ); } + bsize =min (walk->walk_blocksize, n); + walk->flags &= ~(BLKCIPHER_WALK_SLOW |BLKCIPHER_WALK_COPY |BLKCIPHER_WALK_DIFF ); if (!scatterwalk_aligned(&walk->in, walk->alignmask) ||
@@ -245,7 +247,6 @@ static int blkcipher_walk_next(struct blkcipher_desc *desc, } } - bsize =min (walk->walk_blocksize, n); n =scatterwalk_clamp (&walk->in, n); n =scatterwalk_clamp (&walk->out, n);
crypto/cryptd.c +7 -2
@@ -565,9 +565,14 @@ static int cryptd_hash_export(struct ahash_request *req, void *out)static int cryptd_hash_import (struct ahash_request *req,const void *in) { -struct cryptd_hash_request_ctx *rctx =ahash_request_ctx (req); +struct crypto_ahash *tfm =crypto_ahash_reqtfm (req); +struct cryptd_hash_ctx *ctx =crypto_ahash_ctx (tfm); +struct shash_desc *desc =cryptd_shash_desc (req); + + desc->tfm = ctx->child; + desc->flags = req->base.flags; -return crypto_shash_import (&rctx->desc, in); +return crypto_shash_import (desc, in); } static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
crypto/gcm.c +3 -1
@@ -716,7 +716,9 @@ static struct crypto_instance *crypto_gcm_alloc_common(struct rtattr **tb, ghash_alg =crypto_find_alg (ghash_name, &crypto_ahash_type,CRYPTO_ALG_TYPE_HASH , -CRYPTO_ALG_TYPE_AHASH_MASK ); +CRYPTO_ALG_TYPE_AHASH_MASK | +crypto_requires_sync (algt->type, + algt->mask));if (IS_ERR (ghash_alg))return ERR_CAST (ghash_alg);
crypto/scatterwalk.c +2 -1
@@ -68,7 +68,8 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out,void scatterwalk_done (struct scatter_walk *walk,int out,int more) { -if (!(scatterwalk_pagelen (walk) & (PAGE_SIZE -1 )) || !more) +if (!more || walk->offset >= walk->sg->offset + walk->sg->length || + !(walk->offset & (PAGE_SIZE -1 )))scatterwalk_pagedone (walk, out, more); }EXPORT_SYMBOL_GPL (scatterwalk_done);
drivers/bcma/bcma_private.h +0 -2
@@ -8,8 +8,6 @@#include <linux/bcma/bcma.h> #include <linux/delay.h> -#define BCMA_CORE_SIZE 0x1000 -#define bcma_err (bus, fmt, ...) \ pr_err("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)#define bcma_warn (bus, fmt, ...) \
drivers/bluetooth/ath3k.c +4 -0
@@ -122,6 +122,8 @@ static const struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x13d3, 0x3432) }, { USB_DEVICE(0x13d3, 0x3472) }, { USB_DEVICE(0x13d3, 0x3474) }, + { USB_DEVICE(0x13d3, 0x3487) }, + { USB_DEVICE(0x13d3, 0x3490) },/* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) },
@@ -188,6 +190,8 @@ static const struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3472), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3474), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3487), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3490), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE036), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c +2 -0
@@ -216,6 +216,8 @@ static const struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3472), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3474), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3487), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3490), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
drivers/char/hw_random/omap-rng.c +14 -2
@@ -384,7 +384,12 @@ static int omap_rng_probe(struct platform_device *pdev) }pm_runtime_enable (&pdev->dev); -pm_runtime_get_sync (&pdev->dev); + ret =pm_runtime_get_sync (&pdev->dev); +if (ret) { +dev_err (&pdev->dev,"Failed to runtime_get device: %d\n" , ret); +pm_runtime_put_noidle (&pdev->dev); + goto err_ioremap; + } ret = (dev->of_node) ?of_get_omap_rng_device_details (priv, pdev) :get_omap_rng_device_details (priv);
@@ -437,8 +442,15 @@ static int omap_rng_suspend(struct device *dev)static int omap_rng_resume (struct device *dev) {struct omap_rng_dev *priv =dev_get_drvdata (dev); +int ret; + + ret =pm_runtime_get_sync (dev); +if (ret) { +dev_err (dev,"Failed to runtime_get device: %d\n" , ret); +pm_runtime_put_noidle (dev); +return ret; + } -pm_runtime_get_sync (dev); priv->pdata->init (priv);return 0 ;
drivers/char/random.c +9 -4
@@ -956,6 +956,7 @@ static void _xfer_secondary_pool(struct entropy_store *r, size_t nbytes)mix_pool_bytes (r, tmp, bytes,NULL );credit_entropy_bits (r, bytes*8 ); } +EXPORT_SYMBOL_GPL (add_interrupt_randomness);/* * Used as a workqueue function so that when the input pool is getting
@@ -1379,12 +1380,16 @@ random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)static ssize_t urandom_read (struct file *file,char __user *buf,size_t nbytes,loff_t *ppos) { +static int maxwarn =10 ;int ret; -if (unlikely (nonblocking_pool.initialized ==0 )) -printk_once (KERN_NOTICE "random: %s urandom read " -"with %d bits of entropy available\n" , - current->comm, nonblocking_pool.entropy_total); +if (unlikely (nonblocking_pool.initialized ==0 ) && + maxwarn >0 ) { + maxwarn--; +printk (KERN_NOTICE "random: %s: uninitialized urandom read " +"(%zd bytes read, %d bits of entropy available)\n" , + current->comm, nbytes, nonblocking_pool.entropy_total); + } nbytes =min_t (size_t, nbytes,INT_MAX >> (ENTROPY_SHIFT +3 )); ret =extract_entropy_user (&nonblocking_pool, buf, nbytes);
drivers/char/tpm/tpm_tis.c +4 -5
@@ -197,16 +197,15 @@ static int get_burstcount(struct tpm_chip *chip) {unsigned long stop;int burstcnt; +u32 value;/* wait for burstcount */ /* which timeout value, spec has 2 answers (c & d) */ stop = jiffies + chip->vendor.timeout_d; do { - burstcnt = ioread8(chip->vendor.iobase + - TPM_STS(chip->vendor.locality) + 1); - burstcnt += ioread8(chip->vendor.iobase + - TPM_STS(chip->vendor.locality) + - 2) << 8; + value = ioread32(chip->vendor.iobase + + TPM_STS(chip->vendor.locality)); + burstcnt = (value >> 8) & 0xFFFF; if (burstcnt) return burstcnt; msleep(TPM_TIMEOUT);
drivers/clocksource/sun4i_timer.c +8 -1
@@ -120,12 +120,16 @@ static struct clock_event_device sun4i_clockevent = { .set_next_event = sun4i_clkevt_next_event, }; +static void sun4i_timer_clear_interrupt (void ) +{ +writel (TIMER_IRQ_EN (0 ), timer_base +TIMER_IRQ_ST_REG ); +}static irqreturn_t sun4i_timer_interrupt (int irq,void *dev_id) {struct clock_event_device *evt = (struct clock_event_device *)dev_id; -writel (0x1 , timer_base +TIMER_IRQ_ST_REG ); +sun4i_timer_clear_interrupt (); evt->event_handler (evt);return IRQ_HANDLED ;
@@ -182,6 +186,9 @@ static void __init sun4i_timer_init(struct device_node *node)/* Make sure timer is stopped before playing with interrupts */ sun4i_clkevt_time_stop (0 ); +/* clear timer0 interrupt */ +sun4i_timer_clear_interrupt (); + sun4i_clockevent.cpumask = cpu_possible_mask; sun4i_clockevent.irq = irq;
drivers/crypto/caam/caamhash.c +1 -0
@@ -1778,6 +1778,7 @@ caam_hash_alloc(struct caam_hash_template *template, template->name);snprintf (alg->cra_driver_name,CRYPTO_MAX_ALG_NAME ,"%s" , template->driver_name); + t_alg->ahash_alg.setkey =NULL ; } alg->cra_module =THIS_MODULE ; alg->cra_init = caam_hash_cra_init;
drivers/crypto/nx/nx.c +1 -1
@@ -330,7 +330,7 @@ static void nx_of_update_msc(struct device *dev, ((bytes_so_far +sizeof (struct msc_triplet )) <= lenp) && i < msc->triplets; i++) { -if (msc->fc >NX_MAX_FC || msc->mode >NX_MAX_MODE ) { +if (msc->fc >=NX_MAX_FC || msc->mode >=NX_MAX_MODE ) {dev_err (dev,"unknown function code/mode " "combo: %d/%d (ignored)\n" , msc->fc, msc->mode);
drivers/devfreq/devfreq.c +1 -1
@@ -483,7 +483,7 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->profile->max_state * devfreq->profile->max_state, GFP_KERNEL); - devfreq->time_in_state =devm_kzalloc (dev,sizeof (unsigned int ) * + devfreq->time_in_state =devm_kzalloc (dev,sizeof (unsigned long ) * devfreq->profile->max_state,GFP_KERNEL ); devfreq->last_stat_updated = jiffies;
drivers/firewire/net.c +35 -16
91 lines not on this page · raw message
drivers/firmware/efi/efi-stub-helper.c +66 -30
163 lines not on this page · raw message
drivers/firmware/efi/fdt.c +10 -3
@@ -178,12 +178,20 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, unsigned long fdt_addr, unsigned long fdt_size) { -unsigned long map_size, desc_size; +unsigned long map_size, desc_size, buff_size;u32 desc_ver;unsigned long mmap_key;efi_memory_desc_t *memory_map;unsigned long new_fdt_size;efi_status_t status; +struct efi_boot_memmap map; + + map.map = &memory_map; + map.map_size = &map_size; + map.desc_size = &desc_size; + map.desc_ver = &desc_ver; + map.key_ptr = &mmap_key; + map.buff_size = &buff_size;/* * Estimate size of new FDT, and allocate memory for it. We
@@ -204,8 +212,7 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table,* we can get the memory map key needed for * exit_boot_services(). */ - status =efi_get_memory_map (sys_table, &memory_map, &map_size, - &desc_size, &desc_ver, &mmap_key); + status =efi_get_memory_map (sys_table, &map);if (status !=EFI_SUCCESS ) goto fail_free_new_fdt;
drivers/gpio/Kconfig +1 -0
@@ -50,6 +50,7 @@ config GPIO_DEVRES config OF_GPIO def_bool y depends on OF + depends on HAS_IOMEM config GPIO_ACPI def_bool y
drivers/gpio/gpio-intel-mid.c +0 -19
@@ -17,7 +17,6 @@* Moorestown platform Langwell chip. * Medfield platform Penwell chip. * Clovertrail platform Cloverview chip. -* Merrifield platform Tangier chip. */ #include <linux/module.h>
@@ -66,10 +65,6 @@ enum GPIO_REG {/* intel_mid gpio driver data */ struct intel_mid_gpio_ddata {u16 ngpio;/* number of gpio pins */ -u32 gplr_offset;/* offset of first GPLR register from base */ -u32 flis_base;/* base address of FLIS registers */ -u32 flis_len;/* length of FLIS registers */ -u32 (*get_flis_offset)(int gpio);u32 chip_irq_type;/* chip interrupt type */ };
@@ -284,15 +279,6 @@ static const struct intel_mid_gpio_ddata gpio_cloverview_core = { .chip_irq_type = INTEL_MID_IRQ_TYPE_EDGE, }; -static const struct intel_mid_gpio_ddata gpio_tangier = { - .ngpio =192 , - .gplr_offset =4 , - .flis_base =0xff0c0000 , - .flis_len =0x8000 , - .get_flis_offset =NULL , - .chip_irq_type =INTEL_MID_IRQ_TYPE_EDGE , -}; -static const struct pci_device_id intel_gpio_ids[] = { {/* Lincroft */
@@ -319,11 +305,6 @@ static const struct pci_device_id intel_gpio_ids[] = { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x08f7), .driver_data = (kernel_ulong_t)&gpio_cloverview_core, }, - { -/* Tangier */ -PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x1199 ), - .driver_data = (kernel_ulong_t)&gpio_tangier, - }, { 0 } };MODULE_DEVICE_TABLE (pci, intel_gpio_ids);
drivers/gpio/gpio-pca953x.c +1 -1
@@ -76,7 +76,7 @@ MODULE_DEVICE_TABLE(i2c, pca953x_id);#define MAX_BANK 5#define BANK_SZ 8 -#define NBANK (chip) (chip->gpio_chip.ngpio / BANK_SZ) +#define NBANK (chip) DIV_ROUND_UP(chip->gpio_chip.ngpio, BANK_SZ)struct pca953x_chip {unsigned gpio_start;
drivers/gpu/drm/drm_crtc.c +3 -0
@@ -4236,6 +4236,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,unsigned long flags;int ret = -EINVAL ; +if (!drm_core_check_feature (dev,DRIVER_MODESET )) +return -EINVAL ; +if (page_flip->flags & ~DRM_MODE_PAGE_FLIP_FLAGS || page_flip->reserved !=0 )return -EINVAL ;
drivers/gpu/drm/drm_edid.c +8 -0
@@ -72,6 +72,8 @@#define EDID_QUIRK_FORCE_8BPC (1 << 8)/* Force 12bpc */ #define EDID_QUIRK_FORCE_12BPC (1 << 9) +/* Force 6bpc */ +#define EDID_QUIRK_FORCE_6BPC (1 << 10)struct detailed_mode_closure {struct drm_connector *connector;
@@ -98,6 +100,9 @@ static struct edid_quirk {/* Unknown Acer */ { "ACR", 2423, EDID_QUIRK_FIRST_DETAILED_PREFERRED }, +/* AEO model 0 reports 8 bpc, but is a 6 bpc panel */ + { "AEO", 0, EDID_QUIRK_FORCE_6BPC }, +/* Belinea 10 15 55 */ { "MAX", 1516, EDID_QUIRK_PREFER_LARGE_60 }, { "MAX", 0x77e, EDID_QUIRK_PREFER_LARGE_60 },
@@ -3667,6 +3672,9 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)drm_add_display_info (edid, &connector->display_info, connector); +if (quirks &EDID_QUIRK_FORCE_6BPC ) + connector->display_info.bpc =6 ; +if (quirks &EDID_QUIRK_FORCE_8BPC ) connector->display_info.bpc =8 ;
drivers/gpu/drm/i915/intel_display.c +5 -15
@@ -9475,21 +9475,11 @@ connected_sink_compute_bpp(struct intel_connector *connector, pipe_config->pipe_bpp = connector->base.display_info.bpc*3 ; } -/* Clamp bpp to default limit on screens without EDID 1.4 */ -if (connector->base.display_info.bpc ==0 ) { -int type = connector->base.connector_type; -int clamp_bpp =24 ; - -/* Fall back to 18 bpp when DP sink capability is unknown. */ -if (type == DRM_MODE_CONNECTOR_DisplayPort || - type == DRM_MODE_CONNECTOR_eDP) - clamp_bpp =18 ; - -if (bpp > clamp_bpp) { -DRM_DEBUG_KMS ("clamping display bpp (was %d) to default limit of %d\n" , - bpp, clamp_bpp); - pipe_config->pipe_bpp = clamp_bpp; - } +/* Clamp bpp to 8 on screens without EDID 1.4 */ +if (connector->base.display_info.bpc ==0 && bpp >24 ) { +DRM_DEBUG_KMS ("clamping display bpp (was %d) to default limit of 24\n" , + bpp); + pipe_config->pipe_bpp =24 ; } }
drivers/gpu/drm/msm/msm_drv.h +6 -0
@@ -124,6 +124,12 @@ struct msm_drm_private {*/ struct drm_mm mm; } vram; + +/* task holding struct_mutex.. currently only used in submit path +* to detect and reject faults from copy_from_user() for submit +* ioctl. +*/ +struct task_struct *struct_mutex_task; };struct msm_format {
drivers/gpu/drm/msm/msm_gem.c +9 -0
@@ -188,11 +188,20 @@ int msm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) {struct drm_gem_object *obj = vma->vm_private_data;struct drm_device *dev = obj->dev; +struct msm_drm_private *priv = dev->dev_private;struct page **pages;unsigned long pfn;pgoff_t pgoff;int ret; +/* This should only happen if userspace tries to pass a mmap'd +* but unfaulted gem bo vaddr into submit ioctl, triggering +* a page fault while struct_mutex is already held. This is +* not a valid use-case so just bail. +*/ +if (priv->struct_mutex_task == current) +return VM_FAULT_SIGBUS ; +/* Make sure we don't parallel update on a fault, nor move or remove * something from beneath our feet */
drivers/gpu/drm/msm/msm_gem_submit.c +30 -7
@@ -55,6 +55,14 @@ static struct msm_gem_submit *submit_create(struct drm_device *dev,return submit; } +static inline unsigned long __must_check +copy_from_user_inatomic (void *to,const void __user *from,unsigned long n) +{ +if (access_ok (VERIFY_READ , from, n)) +return __copy_from_user_inatomic (to, from, n); +return -EFAULT ; +} +static int submit_lookup_objects (struct msm_gem_submit *submit,struct drm_msm_gem_submit *args,struct drm_file *file) {
@@ -62,6 +70,7 @@ static int submit_lookup_objects(struct msm_gem_submit *submit,int ret =0 ;spin_lock (&file->table_lock); +pagefault_disable ();for (i =0 ; i < args->nr_bos; i++) {struct drm_msm_gem_submit_bo submit_bo;
@@ -70,10 +79,15 @@ static int submit_lookup_objects(struct msm_gem_submit *submit,void __user *userptr =to_user_ptr (args->bos + (i *sizeof (submit_bo))); - ret =copy_from_user (&submit_bo, userptr,sizeof (submit_bo)); -if (ret) { - ret = -EFAULT ; - goto out_unlock; + ret =copy_from_user_inatomic (&submit_bo, userptr,sizeof (submit_bo)); +if (unlikely (ret)) { +pagefault_enable (); +spin_unlock (&file->table_lock); + ret =copy_from_user (&submit_bo, userptr,sizeof (submit_bo)); +if (ret) + goto out; +spin_lock (&file->table_lock); +pagefault_disable (); }if (submit_bo.flags & ~MSM_SUBMIT_BO_FLAGS ) {
@@ -113,9 +127,12 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, } out_unlock: - submit->nr_bos = i; +pagefault_enable ();spin_unlock (&file->table_lock); +out: + submit->nr_bos = i; +return ret; }
@@ -339,12 +356,16 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,if (args->nr_cmds >MAX_CMDS )return -EINVAL ; -mutex_lock (&dev->struct_mutex); + ret =mutex_lock_interruptible (&dev->struct_mutex); +if (ret) +return ret; + + priv->struct_mutex_task = current; submit =submit_create (dev, gpu, args->nr_bos);if (!submit) { ret = -ENOMEM ; - goto out; + goto out_unlock; } ret =submit_lookup_objects (submit, args, file);
@@ -422,6 +443,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, out:if (submit)submit_cleanup (submit, !!ret);
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/nouveau/nouveau_acpi.c +40 -36
76 lines not on this page · raw message
drivers/gpu/drm/radeon/atombios_encoders.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/radeon/radeon_atombios.c +2 -2
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/radeon/radeon_atpx_handler.c +5 -0
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/radeon/radeon_connectors.c +9 -6
Lines of this file are not shown. View the raw message.
drivers/iio/common/hid-sensors/hid-sensor-attributes.c +2 -2
Lines of this file are not shown. View the raw message.
drivers/infiniband/ulp/ipoib/ipoib_cm.c +16 -0
Lines of this file are not shown. View the raw message.
drivers/infiniband/ulp/ipoib/ipoib_ib.c +9 -0
Lines of this file are not shown. View the raw message.
drivers/infiniband/ulp/ipoib/ipoib_main.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/media/dvb-core/dvb_ringbuffer.c +85 -11
96 lines not on this page · raw message
drivers/media/dvb-core/dvb_ringbuffer.h +2 -0
Lines of this file are not shown. View the raw message.
drivers/media/platform/s5p-mfc/s5p_mfc.c +11 -0
Lines of this file are not shown. View the raw message.
drivers/media/usb/usbvision/usbvision-video.c +0 -7
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +54 -31
85 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +3 -1
Lines of this file are not shown. View the raw message.
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/wireless/brcm80211/brcmsmac/dma.c +3 -1
Lines of this file are not shown. View the raw message.
drivers/net/wireless/brcm80211/brcmsmac/stf.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/scsi/megaraid/megaraid_sas_base.c +3 -3
Lines of this file are not shown. View the raw message.
drivers/scsi/megaraid/megaraid_sas_fusion.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/staging/comedi/drivers/daqboard2000.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/staging/comedi/drivers/ni_mio_common.c +10 -2
Lines of this file are not shown. View the raw message.
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/target/iscsi/iscsi_target_login.c +3 -2
Lines of this file are not shown. View the raw message.
drivers/tty/serial/8250/8250_pci.c +139 -0
139 lines not on this page · raw message
drivers/usb/core/config.c +79 -14
93 lines not on this page · raw message
drivers/vfio/pci/vfio_pci_intrs.c +43 -26
69 lines not on this page · raw message
drivers/xen/xenbus/xenbus_dev_frontend.c +8 -6
Lines of this file are not shown. View the raw message.
mm/filemap.c +43 -43
86 lines not on this page · raw message
net/batman-adv/bridge_loop_avoidance.c +115 -22
137 lines not on this page · raw message
net/batman-adv/routing.c +66 -14
80 lines not on this page · raw message
net/ceph/osdmap.c +113 -43
156 lines not on this page · raw message
net/netfilter/x_tables.c +50 -0
50 lines not on this page · raw message
sound/firewire/fireworks/fireworks_hwdep.c +52 -19
71 lines not on this page · raw message
sound/firewire/fireworks/fireworks_proc.c +2 -2
Lines of this file are not shown. View the raw message.
sound/firewire/fireworks/fireworks_transaction.c +2 -3
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.39 release. There are 346 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 Sat Nov 10 00:00:00 UTC 2016. Anything received after that time might be too late.
Build results:
total: 140 pass: 140 fail: 0 Qemu test results: total: 99 pass: 99 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Quoted 13 lines · Guenter Roeck
Quoted 11 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.39 release.
There are 346 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 Sat Nov 10 00:00:00 UTC 2016. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 140 pass: 140 fail: 0 Qemu test results: total: 99 pass: 99 fail: 0Details are available at http://kerneltests.org/builders.
Thanks for checking.
Ben.
Signature · 2 lines
Ben Hutchings If more than one person is responsible for a bug, no one is at fault.