Skip to content

Commit

Permalink
Merge tag 'char-misc-4.10-rc4' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
torvalds committed Jan 15, 2017
2 parents 2d5a710 + c8a6a09 commit c928162
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 16 deletions.
6 changes: 3 additions & 3 deletions drivers/auxdisplay/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ config HT16K33
tristate "Holtek Ht16K33 LED controller with keyscan"
depends on FB && OF && I2C && INPUT
select FB_SYS_FOPS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
select FB_SYS_FILLRECT
select FB_SYS_COPYAREA
select FB_SYS_IMAGEBLIT
select INPUT_MATRIXKMAP
select FB_BACKLIGHT
help
Expand Down
10 changes: 4 additions & 6 deletions drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,6 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
char *kbuf; /* k-addr because vread() takes vmlist_lock rwlock */
int err = 0;

if (!pfn_valid(PFN_DOWN(p)))
return -EIO;

read = 0;
if (p < (unsigned long) high_memory) {
low_count = count;
Expand Down Expand Up @@ -412,6 +409,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
* by the kernel or data corruption may occur
*/
kbuf = xlate_dev_kmem_ptr((void *)p);
if (!virt_addr_valid(kbuf))
return -ENXIO;

if (copy_to_user(buf, kbuf, sz))
return -EFAULT;
Expand Down Expand Up @@ -482,6 +481,8 @@ static ssize_t do_write_kmem(unsigned long p, const char __user *buf,
* corruption may occur.
*/
ptr = xlate_dev_kmem_ptr((void *)p);
if (!virt_addr_valid(ptr))
return -ENXIO;

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

if (!pfn_valid(PFN_DOWN(p)))
return -EIO;

if (p < (unsigned long) high_memory) {
unsigned long to_write = min_t(unsigned long, count,
(unsigned long)high_memory - p);
Expand Down
13 changes: 8 additions & 5 deletions drivers/char/ppdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ static int register_device(int minor, struct pp_struct *pp)
struct pardevice *pdev = NULL;
char *name;
struct pardev_cb ppdev_cb;
int rc = 0;

name = kasprintf(GFP_KERNEL, CHRDEV "%x", minor);
if (name == NULL)
Expand All @@ -298,8 +299,8 @@ static int register_device(int minor, struct pp_struct *pp)
port = parport_find_number(minor);
if (!port) {
pr_warn("%s: no associated port!\n", name);
kfree(name);
return -ENXIO;
rc = -ENXIO;
goto err;
}

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

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

pp->pdev = pdev;
dev_dbg(&pdev->dev, "registered pardevice\n");
return 0;
err:
kfree(name);
return rc;
}

static enum ieee1284_phase init_phase(int mode)
Expand Down
2 changes: 1 addition & 1 deletion drivers/extcon/extcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id)
dev_err(&edev->dev, "out of memory in extcon_set_state\n");
kobject_uevent(&edev->dev.kobj, KOBJ_CHANGE);

return 0;
return -ENOMEM;
}

length = name_show(&edev->dev, NULL, prop_buf);
Expand Down
3 changes: 3 additions & 0 deletions drivers/misc/mei/bus-fixup.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ static void mei_mkhi_fix(struct mei_cl_device *cldev)
{
int ret;

if (!cldev->bus->hbm_f_os_supported)
return;

ret = mei_cldev_enable(cldev);
if (ret)
return;
Expand Down
2 changes: 2 additions & 0 deletions drivers/misc/mei/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ static ssize_t mei_dbgfs_read_devstate(struct file *fp, char __user *ubuf,
dev->hbm_f_ev_supported);
pos += scnprintf(buf + pos, bufsz - pos, "\tFA: %01d\n",
dev->hbm_f_fa_supported);
pos += scnprintf(buf + pos, bufsz - pos, "\tOS: %01d\n",
dev->hbm_f_os_supported);
}

pos += scnprintf(buf + pos, bufsz - pos, "pg: %s, %s\n",
Expand Down
4 changes: 4 additions & 0 deletions drivers/misc/mei/hbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,10 @@ static void mei_hbm_config_features(struct mei_device *dev)
/* Fixed Address Client Support */
if (dev->version.major_version >= HBM_MAJOR_VERSION_FA)
dev->hbm_f_fa_supported = 1;

/* OS ver message Support */
if (dev->version.major_version >= HBM_MAJOR_VERSION_OS)
dev->hbm_f_os_supported = 1;
}

/**
Expand Down
6 changes: 6 additions & 0 deletions drivers/misc/mei/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
#define HBM_MINOR_VERSION_FA 0
#define HBM_MAJOR_VERSION_FA 2

/*
* MEI version with OS ver message support
*/
#define HBM_MINOR_VERSION_OS 0
#define HBM_MAJOR_VERSION_OS 2

/* Host bus message command opcode */
#define MEI_HBM_CMD_OP_MSK 0x7f
/* Host bus message command RESPONSE */
Expand Down
2 changes: 2 additions & 0 deletions drivers/misc/mei/mei_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ const char *mei_pg_state_str(enum mei_pg_state state);
* @hbm_f_ev_supported : hbm feature event notification
* @hbm_f_fa_supported : hbm feature fixed address client
* @hbm_f_ie_supported : hbm feature immediate reply to enum request
* @hbm_f_os_supported : hbm feature support OS ver message
*
* @me_clients_rwsem: rw lock over me_clients list
* @me_clients : list of FW clients
Expand Down Expand Up @@ -487,6 +488,7 @@ struct mei_device {
unsigned int hbm_f_ev_supported:1;
unsigned int hbm_f_fa_supported:1;
unsigned int hbm_f_ie_supported:1;
unsigned int hbm_f_os_supported:1;

struct rw_semaphore me_clients_rwsem;
struct list_head me_clients;
Expand Down
2 changes: 1 addition & 1 deletion drivers/vme/bridges/vme_ca91cx42.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ static int ca91cx42_slave_get(struct vme_slave_resource *image, int *enabled,
vme_bound = ioread32(bridge->base + CA91CX42_VSI_BD[i]);
pci_offset = ioread32(bridge->base + CA91CX42_VSI_TO[i]);

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

*enabled = 0;
Expand Down

0 comments on commit c928162

Please sign in to comment.