Skip to content

Commit 3a98be0

Browse files
committed
Merge tag 'char-misc-4.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc fixes from Greg KH: "Here are a handful of char/misc driver fixes for 4.14-rc4. Nothing major, some binder fixups, hyperv fixes, and other tiny things. All of these have been sitting in my tree for way too long, sorry for the delay in getting them to you. All have been in linux-next for a few weeks, and despite some people's feeling about if linux-next actually tests things, I think it's a good "soak test" for patches" * tag 'char-misc-4.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: Drivers: hv: fcopy: restore correct transfer length vmbus: don't acquire the mutex in vmbus_hvsock_device_unregister() intel_th: pci: Add Lewisburg PCH support intel_th: pci: Add Cedar Fork PCH support stm class: Fix a use-after-free nvmem: add missing of_node_put() in of_nvmem_cell_get() nvmem: core: return EFBIG on out-of-range write auxdisplay: charlcd: properly restore atomic counter on error path binder: fix memory corruption in binder_transaction binder binder: fix an ret value override android: binder: fix type mismatch warning
2 parents 9e66317 + 549e658 commit 3a98be0

File tree

8 files changed

+39
-14
lines changed

8 files changed

+39
-14
lines changed

drivers/android/binder.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
22172217
debug_id, (u64)fda->num_fds);
22182218
continue;
22192219
}
2220-
fd_array = (u32 *)(parent_buffer + fda->parent_offset);
2220+
fd_array = (u32 *)(parent_buffer + (uintptr_t)fda->parent_offset);
22212221
for (fd_index = 0; fd_index < fda->num_fds; fd_index++)
22222222
task_close_fd(proc, fd_array[fd_index]);
22232223
} break;
@@ -2326,7 +2326,6 @@ static int binder_translate_handle(struct flat_binder_object *fp,
23262326
(u64)node->ptr);
23272327
binder_node_unlock(node);
23282328
} else {
2329-
int ret;
23302329
struct binder_ref_data dest_rdata;
23312330

23322331
binder_node_unlock(node);
@@ -2442,7 +2441,7 @@ static int binder_translate_fd_array(struct binder_fd_array_object *fda,
24422441
*/
24432442
parent_buffer = parent->buffer -
24442443
binder_alloc_get_user_buffer_offset(&target_proc->alloc);
2445-
fd_array = (u32 *)(parent_buffer + fda->parent_offset);
2444+
fd_array = (u32 *)(parent_buffer + (uintptr_t)fda->parent_offset);
24462445
if (!IS_ALIGNED((unsigned long)fd_array, sizeof(u32))) {
24472446
binder_user_error("%d:%d parent offset not aligned correctly.\n",
24482447
proc->pid, thread->pid);
@@ -2508,7 +2507,7 @@ static int binder_fixup_parent(struct binder_transaction *t,
25082507
proc->pid, thread->pid);
25092508
return -EINVAL;
25102509
}
2511-
parent_buffer = (u8 *)(parent->buffer -
2510+
parent_buffer = (u8 *)((uintptr_t)parent->buffer -
25122511
binder_alloc_get_user_buffer_offset(
25132512
&target_proc->alloc));
25142513
*(binder_uintptr_t *)(parent_buffer + bp->parent_offset) = bp->buffer;
@@ -3083,6 +3082,7 @@ static void binder_transaction(struct binder_proc *proc,
30833082
err_dead_proc_or_thread:
30843083
return_error = BR_DEAD_REPLY;
30853084
return_error_line = __LINE__;
3085+
binder_dequeue_work(proc, tcomplete);
30863086
err_translate_failed:
30873087
err_bad_object_type:
30883088
err_bad_offset:

drivers/auxdisplay/charlcd.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,18 +647,25 @@ static ssize_t charlcd_write(struct file *file, const char __user *buf,
647647
static int charlcd_open(struct inode *inode, struct file *file)
648648
{
649649
struct charlcd_priv *priv = to_priv(the_charlcd);
650+
int ret;
650651

652+
ret = -EBUSY;
651653
if (!atomic_dec_and_test(&charlcd_available))
652-
return -EBUSY; /* open only once at a time */
654+
goto fail; /* open only once at a time */
653655

656+
ret = -EPERM;
654657
if (file->f_mode & FMODE_READ) /* device is write-only */
655-
return -EPERM;
658+
goto fail;
656659

657660
if (priv->must_clear) {
658661
charlcd_clear_display(&priv->lcd);
659662
priv->must_clear = false;
660663
}
661664
return nonseekable_open(inode, file);
665+
666+
fail:
667+
atomic_inc(&charlcd_available);
668+
return ret;
662669
}
663670

664671
static int charlcd_release(struct inode *inode, struct file *file)

drivers/auxdisplay/panel.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,14 +1105,21 @@ static ssize_t keypad_read(struct file *file,
11051105

11061106
static int keypad_open(struct inode *inode, struct file *file)
11071107
{
1108+
int ret;
1109+
1110+
ret = -EBUSY;
11081111
if (!atomic_dec_and_test(&keypad_available))
1109-
return -EBUSY; /* open only once at a time */
1112+
goto fail; /* open only once at a time */
11101113

1114+
ret = -EPERM;
11111115
if (file->f_mode & FMODE_WRITE) /* device is read-only */
1112-
return -EPERM;
1116+
goto fail;
11131117

11141118
keypad_buflen = 0; /* flush the buffer on opening */
11151119
return 0;
1120+
fail:
1121+
atomic_inc(&keypad_available);
1122+
return ret;
11161123
}
11171124

11181125
static int keypad_release(struct inode *inode, struct file *file)

drivers/hv/channel_mgmt.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -936,14 +936,10 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)
936936

937937
void vmbus_hvsock_device_unregister(struct vmbus_channel *channel)
938938
{
939-
mutex_lock(&vmbus_connection.channel_mutex);
940-
941939
BUG_ON(!is_hvsock_channel(channel));
942940

943941
channel->rescind = true;
944942
vmbus_device_unregister(channel->device_obj);
945-
946-
mutex_unlock(&vmbus_connection.channel_mutex);
947943
}
948944
EXPORT_SYMBOL_GPL(vmbus_hvsock_device_unregister);
949945

drivers/hv/hv_fcopy.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ static void fcopy_send_data(struct work_struct *dummy)
170170
out_src = smsg_out;
171171
break;
172172

173+
case WRITE_TO_FILE:
174+
out_src = fcopy_transaction.fcopy_msg;
175+
out_len = sizeof(struct hv_do_fcopy);
176+
break;
173177
default:
174178
out_src = fcopy_transaction.fcopy_msg;
175179
out_len = fcopy_transaction.recv_len;

drivers/hwtracing/intel_th/pci.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
143143
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x19e1),
144144
.driver_data = (kernel_ulong_t)0,
145145
},
146+
{
147+
/* Lewisburg PCH */
148+
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa1a6),
149+
.driver_data = (kernel_ulong_t)0,
150+
},
146151
{
147152
/* Gemini Lake */
148153
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x318e),
@@ -158,6 +163,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
158163
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x9da6),
159164
.driver_data = (kernel_ulong_t)&intel_th_2x,
160165
},
166+
{
167+
/* Cedar Fork PCH */
168+
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x18e1),
169+
.driver_data = (kernel_ulong_t)&intel_th_2x,
170+
},
161171
{ 0 },
162172
};
163173

drivers/hwtracing/stm/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ void stm_source_unregister_device(struct stm_source_data *data)
11191119

11201120
stm_source_link_drop(src);
11211121

1122-
device_destroy(&stm_source_class, src->dev.devt);
1122+
device_unregister(&src->dev);
11231123
}
11241124
EXPORT_SYMBOL_GPL(stm_source_unregister_device);
11251125

drivers/nvmem/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj,
135135

136136
/* Stop the user from writing */
137137
if (pos >= nvmem->size)
138-
return 0;
138+
return -EFBIG;
139139

140140
if (count < nvmem->word_size)
141141
return -EINVAL;
@@ -789,6 +789,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np,
789789
return ERR_PTR(-EINVAL);
790790

791791
nvmem = __nvmem_device_get(nvmem_np, NULL, NULL);
792+
of_node_put(nvmem_np);
792793
if (IS_ERR(nvmem))
793794
return ERR_CAST(nvmem);
794795

0 commit comments

Comments
 (0)