diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-25 22:50:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-25 22:50:59 -0400 |
commit | e433b6560dd4e83a4241b702c2890bbf2eac64e7 (patch) | |
tree | 56b3a67f4b8b7a1bfdf037b97af12b2fb299e84f | |
parent | 763e326c8bcded22460fb25def2ed0e2459dcc8d (diff) | |
parent | 4e5a74f1db8d6bea48306126fd445e2720f07a95 (diff) |
Merge tag 'char-misc-4.2-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 char and misc driver fixes for reported issues.
One parport patch is reverted as it was incorrect, thanks to testing
by the 0-day bot"
* tag 'char-misc-4.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
parport: Revert "parport: fix memory leak"
mei: prevent unloading mei hw modules while the device is opened.
misc: mic: scif bug fix for vmalloc_to_page crash
parport: fix freeing freed memory
parport: fix memory leak
parport: fix error handling
-rw-r--r-- | drivers/misc/mei/main.c | 2 | ||||
-rw-r--r-- | drivers/misc/mic/scif/scif_nodeqp.c | 15 | ||||
-rw-r--r-- | drivers/parport/share.c | 11 |
3 files changed, 12 insertions, 16 deletions
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 8eb0a9500a90..e9513d651cd3 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
@@ -682,7 +682,7 @@ int mei_register(struct mei_device *dev, struct device *parent) | |||
682 | /* Fill in the data structures */ | 682 | /* Fill in the data structures */ |
683 | devno = MKDEV(MAJOR(mei_devt), dev->minor); | 683 | devno = MKDEV(MAJOR(mei_devt), dev->minor); |
684 | cdev_init(&dev->cdev, &mei_fops); | 684 | cdev_init(&dev->cdev, &mei_fops); |
685 | dev->cdev.owner = mei_fops.owner; | 685 | dev->cdev.owner = parent->driver->owner; |
686 | 686 | ||
687 | /* Add the device */ | 687 | /* Add the device */ |
688 | ret = cdev_add(&dev->cdev, devno, 1); | 688 | ret = cdev_add(&dev->cdev, devno, 1); |
diff --git a/drivers/misc/mic/scif/scif_nodeqp.c b/drivers/misc/mic/scif/scif_nodeqp.c index 41e3bdb10061..6dfdae3452d6 100644 --- a/drivers/misc/mic/scif/scif_nodeqp.c +++ b/drivers/misc/mic/scif/scif_nodeqp.c | |||
@@ -357,7 +357,7 @@ static void scif_p2p_freesg(struct scatterlist *sg) | |||
357 | } | 357 | } |
358 | 358 | ||
359 | static struct scatterlist * | 359 | static struct scatterlist * |
360 | scif_p2p_setsg(void __iomem *va, int page_size, int page_cnt) | 360 | scif_p2p_setsg(phys_addr_t pa, int page_size, int page_cnt) |
361 | { | 361 | { |
362 | struct scatterlist *sg; | 362 | struct scatterlist *sg; |
363 | struct page *page; | 363 | struct page *page; |
@@ -368,16 +368,11 @@ scif_p2p_setsg(void __iomem *va, int page_size, int page_cnt) | |||
368 | return NULL; | 368 | return NULL; |
369 | sg_init_table(sg, page_cnt); | 369 | sg_init_table(sg, page_cnt); |
370 | for (i = 0; i < page_cnt; i++) { | 370 | for (i = 0; i < page_cnt; i++) { |
371 | page = vmalloc_to_page((void __force *)va); | 371 | page = pfn_to_page(pa >> PAGE_SHIFT); |
372 | if (!page) | ||
373 | goto p2p_sg_err; | ||
374 | sg_set_page(&sg[i], page, page_size, 0); | 372 | sg_set_page(&sg[i], page, page_size, 0); |
375 | va += page_size; | 373 | pa += page_size; |
376 | } | 374 | } |
377 | return sg; | 375 | return sg; |
378 | p2p_sg_err: | ||
379 | kfree(sg); | ||
380 | return NULL; | ||
381 | } | 376 | } |
382 | 377 | ||
383 | /* Init p2p mappings required to access peerdev from scifdev */ | 378 | /* Init p2p mappings required to access peerdev from scifdev */ |
@@ -395,14 +390,14 @@ scif_init_p2p_info(struct scif_dev *scifdev, struct scif_dev *peerdev) | |||
395 | p2p = kzalloc(sizeof(*p2p), GFP_KERNEL); | 390 | p2p = kzalloc(sizeof(*p2p), GFP_KERNEL); |
396 | if (!p2p) | 391 | if (!p2p) |
397 | return NULL; | 392 | return NULL; |
398 | p2p->ppi_sg[SCIF_PPI_MMIO] = scif_p2p_setsg(psdev->mmio->va, | 393 | p2p->ppi_sg[SCIF_PPI_MMIO] = scif_p2p_setsg(psdev->mmio->pa, |
399 | PAGE_SIZE, num_mmio_pages); | 394 | PAGE_SIZE, num_mmio_pages); |
400 | if (!p2p->ppi_sg[SCIF_PPI_MMIO]) | 395 | if (!p2p->ppi_sg[SCIF_PPI_MMIO]) |
401 | goto free_p2p; | 396 | goto free_p2p; |
402 | p2p->sg_nentries[SCIF_PPI_MMIO] = num_mmio_pages; | 397 | p2p->sg_nentries[SCIF_PPI_MMIO] = num_mmio_pages; |
403 | sg_page_shift = get_order(min(psdev->aper->len, (u64)(1 << 30))); | 398 | sg_page_shift = get_order(min(psdev->aper->len, (u64)(1 << 30))); |
404 | num_aper_chunks = num_aper_pages >> (sg_page_shift - PAGE_SHIFT); | 399 | num_aper_chunks = num_aper_pages >> (sg_page_shift - PAGE_SHIFT); |
405 | p2p->ppi_sg[SCIF_PPI_APER] = scif_p2p_setsg(psdev->aper->va, | 400 | p2p->ppi_sg[SCIF_PPI_APER] = scif_p2p_setsg(psdev->aper->pa, |
406 | 1 << sg_page_shift, | 401 | 1 << sg_page_shift, |
407 | num_aper_chunks); | 402 | num_aper_chunks); |
408 | p2p->sg_nentries[SCIF_PPI_APER] = num_aper_chunks; | 403 | p2p->sg_nentries[SCIF_PPI_APER] = num_aper_chunks; |
diff --git a/drivers/parport/share.c b/drivers/parport/share.c index 8067f54ce050..5ce5ef211bdb 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c | |||
@@ -891,8 +891,10 @@ parport_register_dev_model(struct parport *port, const char *name, | |||
891 | par_dev->dev.release = free_pardevice; | 891 | par_dev->dev.release = free_pardevice; |
892 | par_dev->devmodel = true; | 892 | par_dev->devmodel = true; |
893 | ret = device_register(&par_dev->dev); | 893 | ret = device_register(&par_dev->dev); |
894 | if (ret) | 894 | if (ret) { |
895 | goto err_put_dev; | 895 | put_device(&par_dev->dev); |
896 | goto err_put_port; | ||
897 | } | ||
896 | 898 | ||
897 | /* Chain this onto the list */ | 899 | /* Chain this onto the list */ |
898 | par_dev->prev = NULL; | 900 | par_dev->prev = NULL; |
@@ -907,7 +909,8 @@ parport_register_dev_model(struct parport *port, const char *name, | |||
907 | spin_unlock(&port->physport->pardevice_lock); | 909 | spin_unlock(&port->physport->pardevice_lock); |
908 | pr_debug("%s: cannot grant exclusive access for device %s\n", | 910 | pr_debug("%s: cannot grant exclusive access for device %s\n", |
909 | port->name, name); | 911 | port->name, name); |
910 | goto err_put_dev; | 912 | device_unregister(&par_dev->dev); |
913 | goto err_put_port; | ||
911 | } | 914 | } |
912 | port->flags |= PARPORT_FLAG_EXCL; | 915 | port->flags |= PARPORT_FLAG_EXCL; |
913 | } | 916 | } |
@@ -938,8 +941,6 @@ parport_register_dev_model(struct parport *port, const char *name, | |||
938 | 941 | ||
939 | return par_dev; | 942 | return par_dev; |
940 | 943 | ||
941 | err_put_dev: | ||
942 | put_device(&par_dev->dev); | ||
943 | err_free_devname: | 944 | err_free_devname: |
944 | kfree(devname); | 945 | kfree(devname); |
945 | err_free_par_dev: | 946 | err_free_par_dev: |