提交 c9281627 编写于 作者: L Linus Torvalds

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
...@@ -132,9 +132,9 @@ config HT16K33 ...@@ -132,9 +132,9 @@ config HT16K33
tristate "Holtek Ht16K33 LED controller with keyscan" tristate "Holtek Ht16K33 LED controller with keyscan"
depends on FB && OF && I2C && INPUT depends on FB && OF && I2C && INPUT
select FB_SYS_FOPS select FB_SYS_FOPS
select FB_CFB_FILLRECT select FB_SYS_FILLRECT
select FB_CFB_COPYAREA select FB_SYS_COPYAREA
select FB_CFB_IMAGEBLIT select FB_SYS_IMAGEBLIT
select INPUT_MATRIXKMAP select INPUT_MATRIXKMAP
select FB_BACKLIGHT select FB_BACKLIGHT
help help
......
...@@ -381,9 +381,6 @@ static ssize_t read_kmem(struct file *file, char __user *buf, ...@@ -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 */ char *kbuf; /* k-addr because vread() takes vmlist_lock rwlock */
int err = 0; int err = 0;
if (!pfn_valid(PFN_DOWN(p)))
return -EIO;
read = 0; read = 0;
if (p < (unsigned long) high_memory) { if (p < (unsigned long) high_memory) {
low_count = count; low_count = count;
...@@ -412,6 +409,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf, ...@@ -412,6 +409,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
* by the kernel or data corruption may occur * by the kernel or data corruption may occur
*/ */
kbuf = xlate_dev_kmem_ptr((void *)p); kbuf = xlate_dev_kmem_ptr((void *)p);
if (!virt_addr_valid(kbuf))
return -ENXIO;
if (copy_to_user(buf, kbuf, sz)) if (copy_to_user(buf, kbuf, sz))
return -EFAULT; return -EFAULT;
...@@ -482,6 +481,8 @@ static ssize_t do_write_kmem(unsigned long p, const char __user *buf, ...@@ -482,6 +481,8 @@ static ssize_t do_write_kmem(unsigned long p, const char __user *buf,
* corruption may occur. * corruption may occur.
*/ */
ptr = xlate_dev_kmem_ptr((void *)p); ptr = xlate_dev_kmem_ptr((void *)p);
if (!virt_addr_valid(ptr))
return -ENXIO;
copied = copy_from_user(ptr, buf, sz); copied = copy_from_user(ptr, buf, sz);
if (copied) { if (copied) {
...@@ -512,9 +513,6 @@ static ssize_t write_kmem(struct file *file, const char __user *buf, ...@@ -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 */ char *kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */
int err = 0; int err = 0;
if (!pfn_valid(PFN_DOWN(p)))
return -EIO;
if (p < (unsigned long) high_memory) { if (p < (unsigned long) high_memory) {
unsigned long to_write = min_t(unsigned long, count, unsigned long to_write = min_t(unsigned long, count,
(unsigned long)high_memory - p); (unsigned long)high_memory - p);
......
...@@ -290,6 +290,7 @@ static int register_device(int minor, struct pp_struct *pp) ...@@ -290,6 +290,7 @@ static int register_device(int minor, struct pp_struct *pp)
struct pardevice *pdev = NULL; struct pardevice *pdev = NULL;
char *name; char *name;
struct pardev_cb ppdev_cb; struct pardev_cb ppdev_cb;
int rc = 0;
name = kasprintf(GFP_KERNEL, CHRDEV "%x", minor); name = kasprintf(GFP_KERNEL, CHRDEV "%x", minor);
if (name == NULL) if (name == NULL)
...@@ -298,8 +299,8 @@ static int register_device(int minor, struct pp_struct *pp) ...@@ -298,8 +299,8 @@ static int register_device(int minor, struct pp_struct *pp)
port = parport_find_number(minor); port = parport_find_number(minor);
if (!port) { if (!port) {
pr_warn("%s: no associated port!\n", name); pr_warn("%s: no associated port!\n", name);
kfree(name); rc = -ENXIO;
return -ENXIO; goto err;
} }
memset(&ppdev_cb, 0, sizeof(ppdev_cb)); memset(&ppdev_cb, 0, sizeof(ppdev_cb));
...@@ -308,16 +309,18 @@ static int register_device(int minor, struct pp_struct *pp) ...@@ -308,16 +309,18 @@ static int register_device(int minor, struct pp_struct *pp)
ppdev_cb.private = pp; ppdev_cb.private = pp;
pdev = parport_register_dev_model(port, name, &ppdev_cb, minor); pdev = parport_register_dev_model(port, name, &ppdev_cb, minor);
parport_put_port(port); parport_put_port(port);
kfree(name);
if (!pdev) { if (!pdev) {
pr_warn("%s: failed to register device!\n", name); pr_warn("%s: failed to register device!\n", name);
return -ENXIO; rc = -ENXIO;
goto err;
} }
pp->pdev = pdev; pp->pdev = pdev;
dev_dbg(&pdev->dev, "registered pardevice\n"); dev_dbg(&pdev->dev, "registered pardevice\n");
return 0; err:
kfree(name);
return rc;
} }
static enum ieee1284_phase init_phase(int mode) static enum ieee1284_phase init_phase(int mode)
......
...@@ -453,7 +453,7 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id) ...@@ -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"); dev_err(&edev->dev, "out of memory in extcon_set_state\n");
kobject_uevent(&edev->dev.kobj, KOBJ_CHANGE); kobject_uevent(&edev->dev.kobj, KOBJ_CHANGE);
return 0; return -ENOMEM;
} }
length = name_show(&edev->dev, NULL, prop_buf); length = name_show(&edev->dev, NULL, prop_buf);
......
...@@ -152,6 +152,9 @@ static void mei_mkhi_fix(struct mei_cl_device *cldev) ...@@ -152,6 +152,9 @@ static void mei_mkhi_fix(struct mei_cl_device *cldev)
{ {
int ret; int ret;
if (!cldev->bus->hbm_f_os_supported)
return;
ret = mei_cldev_enable(cldev); ret = mei_cldev_enable(cldev);
if (ret) if (ret)
return; return;
......
...@@ -180,6 +180,8 @@ static ssize_t mei_dbgfs_read_devstate(struct file *fp, char __user *ubuf, ...@@ -180,6 +180,8 @@ static ssize_t mei_dbgfs_read_devstate(struct file *fp, char __user *ubuf,
dev->hbm_f_ev_supported); dev->hbm_f_ev_supported);
pos += scnprintf(buf + pos, bufsz - pos, "\tFA: %01d\n", pos += scnprintf(buf + pos, bufsz - pos, "\tFA: %01d\n",
dev->hbm_f_fa_supported); 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", pos += scnprintf(buf + pos, bufsz - pos, "pg: %s, %s\n",
......
...@@ -989,6 +989,10 @@ static void mei_hbm_config_features(struct mei_device *dev) ...@@ -989,6 +989,10 @@ static void mei_hbm_config_features(struct mei_device *dev)
/* Fixed Address Client Support */ /* Fixed Address Client Support */
if (dev->version.major_version >= HBM_MAJOR_VERSION_FA) if (dev->version.major_version >= HBM_MAJOR_VERSION_FA)
dev->hbm_f_fa_supported = 1; 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;
} }
/** /**
......
...@@ -76,6 +76,12 @@ ...@@ -76,6 +76,12 @@
#define HBM_MINOR_VERSION_FA 0 #define HBM_MINOR_VERSION_FA 0
#define HBM_MAJOR_VERSION_FA 2 #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 */ /* Host bus message command opcode */
#define MEI_HBM_CMD_OP_MSK 0x7f #define MEI_HBM_CMD_OP_MSK 0x7f
/* Host bus message command RESPONSE */ /* Host bus message command RESPONSE */
......
...@@ -406,6 +406,7 @@ const char *mei_pg_state_str(enum mei_pg_state state); ...@@ -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_ev_supported : hbm feature event notification
* @hbm_f_fa_supported : hbm feature fixed address client * @hbm_f_fa_supported : hbm feature fixed address client
* @hbm_f_ie_supported : hbm feature immediate reply to enum request * @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_rwsem: rw lock over me_clients list
* @me_clients : list of FW clients * @me_clients : list of FW clients
...@@ -487,6 +488,7 @@ struct mei_device { ...@@ -487,6 +488,7 @@ struct mei_device {
unsigned int hbm_f_ev_supported:1; unsigned int hbm_f_ev_supported:1;
unsigned int hbm_f_fa_supported:1; unsigned int hbm_f_fa_supported:1;
unsigned int hbm_f_ie_supported:1; unsigned int hbm_f_ie_supported:1;
unsigned int hbm_f_os_supported:1;
struct rw_semaphore me_clients_rwsem; struct rw_semaphore me_clients_rwsem;
struct list_head me_clients; struct list_head me_clients;
......
...@@ -464,7 +464,7 @@ static int ca91cx42_slave_get(struct vme_slave_resource *image, int *enabled, ...@@ -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]); vme_bound = ioread32(bridge->base + CA91CX42_VSI_BD[i]);
pci_offset = ioread32(bridge->base + CA91CX42_VSI_TO[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); *size = (unsigned long long)((vme_bound - *vme_base) + granularity);
*enabled = 0; *enabled = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册