Skip to content

Commit c928162

Browse files
committed
Merge tag 'char-misc-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH: "Here are some small char/misc driver fixes for 4.10-rc4 that resolve some reported issues. The MEI driver issue resolves a lot of problems that people have been having, as does the mem driver fix. The other minor fixes resolve other reported issues. All of these have been in linux-next for a while" * tag 'char-misc-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: vme: Fix wrong pointer utilization in ca91cx42_slave_get auxdisplay: fix new ht16k33 build errors ppdev: don't print a free'd string extcon: return error code on failure drivers: char: mem: Fix thinkos in kmem address checks mei: bus: enable OS version only for SPT and newer
2 parents 2d5a710 + c8a6a09 commit c928162

File tree

10 files changed

+34
-16
lines changed

10 files changed

+34
-16
lines changed

drivers/auxdisplay/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ config HT16K33
132132
tristate "Holtek Ht16K33 LED controller with keyscan"
133133
depends on FB && OF && I2C && INPUT
134134
select FB_SYS_FOPS
135-
select FB_CFB_FILLRECT
136-
select FB_CFB_COPYAREA
137-
select FB_CFB_IMAGEBLIT
135+
select FB_SYS_FILLRECT
136+
select FB_SYS_COPYAREA
137+
select FB_SYS_IMAGEBLIT
138138
select INPUT_MATRIXKMAP
139139
select FB_BACKLIGHT
140140
help

drivers/char/mem.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,6 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
381381
char *kbuf; /* k-addr because vread() takes vmlist_lock rwlock */
382382
int err = 0;
383383

384-
if (!pfn_valid(PFN_DOWN(p)))
385-
return -EIO;
386-
387384
read = 0;
388385
if (p < (unsigned long) high_memory) {
389386
low_count = count;
@@ -412,6 +409,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
412409
* by the kernel or data corruption may occur
413410
*/
414411
kbuf = xlate_dev_kmem_ptr((void *)p);
412+
if (!virt_addr_valid(kbuf))
413+
return -ENXIO;
415414

416415
if (copy_to_user(buf, kbuf, sz))
417416
return -EFAULT;
@@ -482,6 +481,8 @@ static ssize_t do_write_kmem(unsigned long p, const char __user *buf,
482481
* corruption may occur.
483482
*/
484483
ptr = xlate_dev_kmem_ptr((void *)p);
484+
if (!virt_addr_valid(ptr))
485+
return -ENXIO;
485486

486487
copied = copy_from_user(ptr, buf, sz);
487488
if (copied) {
@@ -512,9 +513,6 @@ static ssize_t write_kmem(struct file *file, const char __user *buf,
512513
char *kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */
513514
int err = 0;
514515

515-
if (!pfn_valid(PFN_DOWN(p)))
516-
return -EIO;
517-
518516
if (p < (unsigned long) high_memory) {
519517
unsigned long to_write = min_t(unsigned long, count,
520518
(unsigned long)high_memory - p);

drivers/char/ppdev.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ static int register_device(int minor, struct pp_struct *pp)
290290
struct pardevice *pdev = NULL;
291291
char *name;
292292
struct pardev_cb ppdev_cb;
293+
int rc = 0;
293294

294295
name = kasprintf(GFP_KERNEL, CHRDEV "%x", minor);
295296
if (name == NULL)
@@ -298,8 +299,8 @@ static int register_device(int minor, struct pp_struct *pp)
298299
port = parport_find_number(minor);
299300
if (!port) {
300301
pr_warn("%s: no associated port!\n", name);
301-
kfree(name);
302-
return -ENXIO;
302+
rc = -ENXIO;
303+
goto err;
303304
}
304305

305306
memset(&ppdev_cb, 0, sizeof(ppdev_cb));
@@ -308,16 +309,18 @@ static int register_device(int minor, struct pp_struct *pp)
308309
ppdev_cb.private = pp;
309310
pdev = parport_register_dev_model(port, name, &ppdev_cb, minor);
310311
parport_put_port(port);
311-
kfree(name);
312312

313313
if (!pdev) {
314314
pr_warn("%s: failed to register device!\n", name);
315-
return -ENXIO;
315+
rc = -ENXIO;
316+
goto err;
316317
}
317318

318319
pp->pdev = pdev;
319320
dev_dbg(&pdev->dev, "registered pardevice\n");
320-
return 0;
321+
err:
322+
kfree(name);
323+
return rc;
321324
}
322325

323326
static enum ieee1284_phase init_phase(int mode)

drivers/extcon/extcon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id)
453453
dev_err(&edev->dev, "out of memory in extcon_set_state\n");
454454
kobject_uevent(&edev->dev.kobj, KOBJ_CHANGE);
455455

456-
return 0;
456+
return -ENOMEM;
457457
}
458458

459459
length = name_show(&edev->dev, NULL, prop_buf);

drivers/misc/mei/bus-fixup.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ static void mei_mkhi_fix(struct mei_cl_device *cldev)
152152
{
153153
int ret;
154154

155+
if (!cldev->bus->hbm_f_os_supported)
156+
return;
157+
155158
ret = mei_cldev_enable(cldev);
156159
if (ret)
157160
return;

drivers/misc/mei/debugfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ static ssize_t mei_dbgfs_read_devstate(struct file *fp, char __user *ubuf,
180180
dev->hbm_f_ev_supported);
181181
pos += scnprintf(buf + pos, bufsz - pos, "\tFA: %01d\n",
182182
dev->hbm_f_fa_supported);
183+
pos += scnprintf(buf + pos, bufsz - pos, "\tOS: %01d\n",
184+
dev->hbm_f_os_supported);
183185
}
184186

185187
pos += scnprintf(buf + pos, bufsz - pos, "pg: %s, %s\n",

drivers/misc/mei/hbm.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,10 @@ static void mei_hbm_config_features(struct mei_device *dev)
989989
/* Fixed Address Client Support */
990990
if (dev->version.major_version >= HBM_MAJOR_VERSION_FA)
991991
dev->hbm_f_fa_supported = 1;
992+
993+
/* OS ver message Support */
994+
if (dev->version.major_version >= HBM_MAJOR_VERSION_OS)
995+
dev->hbm_f_os_supported = 1;
992996
}
993997

994998
/**

drivers/misc/mei/hw.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@
7676
#define HBM_MINOR_VERSION_FA 0
7777
#define HBM_MAJOR_VERSION_FA 2
7878

79+
/*
80+
* MEI version with OS ver message support
81+
*/
82+
#define HBM_MINOR_VERSION_OS 0
83+
#define HBM_MAJOR_VERSION_OS 2
84+
7985
/* Host bus message command opcode */
8086
#define MEI_HBM_CMD_OP_MSK 0x7f
8187
/* Host bus message command RESPONSE */

drivers/misc/mei/mei_dev.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ const char *mei_pg_state_str(enum mei_pg_state state);
406406
* @hbm_f_ev_supported : hbm feature event notification
407407
* @hbm_f_fa_supported : hbm feature fixed address client
408408
* @hbm_f_ie_supported : hbm feature immediate reply to enum request
409+
* @hbm_f_os_supported : hbm feature support OS ver message
409410
*
410411
* @me_clients_rwsem: rw lock over me_clients list
411412
* @me_clients : list of FW clients
@@ -487,6 +488,7 @@ struct mei_device {
487488
unsigned int hbm_f_ev_supported:1;
488489
unsigned int hbm_f_fa_supported:1;
489490
unsigned int hbm_f_ie_supported:1;
491+
unsigned int hbm_f_os_supported:1;
490492

491493
struct rw_semaphore me_clients_rwsem;
492494
struct list_head me_clients;

drivers/vme/bridges/vme_ca91cx42.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ static int ca91cx42_slave_get(struct vme_slave_resource *image, int *enabled,
464464
vme_bound = ioread32(bridge->base + CA91CX42_VSI_BD[i]);
465465
pci_offset = ioread32(bridge->base + CA91CX42_VSI_TO[i]);
466466

467-
*pci_base = (dma_addr_t)vme_base + pci_offset;
467+
*pci_base = (dma_addr_t)*vme_base + pci_offset;
468468
*size = (unsigned long long)((vme_bound - *vme_base) + granularity);
469469

470470
*enabled = 0;

0 commit comments

Comments
 (0)