History

Merge tag 'char-misc-4.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver fixes from Greg KH: "Here are five small bugfixes for reported issues with 4.12-rc1 and earlier kernels. Nothing huge here, just a lp, mem, vpd, and uio driver fix, along with a Kconfig fixup for one of the misc drivers. All of these have been in linux-next with no reported issues" * tag 'char-misc-4.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: firmware: Google VPD: Fix memory allocation error handling drivers: char: mem: Check for address space wraparound with mmap() uio: fix incorrect memory leak cleanup misc: pci_endpoint_test: select CRC32 char: lp: fix possible integer overflow in lp_setup()

Linus Torvalds committed 9 years ago

Commit 331da102 parents ec53c02 9434cec5 files · +30 −11Browse files

Unified · Split

5 files
  1. drivers/char/lp.c +5 −1
  2. drivers/char/mem.c +5 −0
  3. drivers/firmware/google/vpd.c +15 −6
  4. drivers/misc/Kconfig +1 −0
  5. drivers/uio/uio.c +4 −4
drivers/char/lp.c+5−1
@@ -859,7 +859,11 @@ static int __init lp_setup (char *str) · 858 unmodified lines
859859 } else if (!strcmp(str, "auto")) {
860860 parport_nr[0] = LP_PARPORT_AUTO;
861861 } else if (!strcmp(str, "none")) {
862− parport_nr[parport_ptr++] = LP_PARPORT_NONE;
862+ if (parport_ptr < LP_NO)
863+ parport_nr[parport_ptr++] = LP_PARPORT_NONE;
864+ else
865+ printk(KERN_INFO "lp: too many ports, %s ignored.\n",
866+ str);
863867 } else if (!strcmp(str, "reset")) {
864868 reset = 1;
865869 }
drivers/char/mem.c+5−0
@@ -340,6 +340,11 @@ static const struct vm_operations_struct mmap_mem_ops = { · 339 unmodified lines
340340 static int mmap_mem(struct file *file, struct vm_area_struct *vma)
341341 {
342342 size_t size = vma->vm_end - vma->vm_start;
343+ phys_addr_t offset = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT;
344+
345+ /* It's illegal to wrap around the end of the physical address space. */
346+ if (offset + (phys_addr_t)size < offset)
347+ return -EINVAL;
343348
344349 if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size))
345350 return -EINVAL;
drivers/firmware/google/vpd.c+15−6
@@ -116,9 +116,13 @@ static int vpd_section_attrib_add(const u8 *key, s32 key_len, · 115 unmodified lines
116116 return VPD_OK;
117117
118118 info = kzalloc(sizeof(*info), GFP_KERNEL);
119− info->key = kzalloc(key_len + 1, GFP_KERNEL);
120− if (!info->key)
119+ if (!info)
121120 return -ENOMEM;
121+ info->key = kzalloc(key_len + 1, GFP_KERNEL);
122+ if (!info->key) {
123+ ret = -ENOMEM;
124+ goto free_info;
125+ }
122126
123127 memcpy(info->key, key, key_len);
124128
@@ -135,12 +139,17 @@ static int vpd_section_attrib_add(const u8 *key, s32 key_len, · 10 unmodified lines
135139 list_add_tail(&info->list, &sec->attribs);
136140
137141 ret = sysfs_create_bin_file(sec->kobj, &info->bin_attr);
138− if (ret) {
139− kfree(info->key);
140− return ret;
141− }
142+ if (ret)
143+ goto free_info_key;
142144
143145 return 0;
146+
147+free_info_key:
148+ kfree(info->key);
149+free_info:
150+ kfree(info);
151+
152+ return ret;
144153 }
145154
146155 static void vpd_section_attrib_destroy(struct vpd_section *sec)
drivers/misc/Kconfig+1−0
@@ -492,6 +492,7 @@ config ASPEED_LPC_CTRL · 491 unmodified lines
492492
493493 config PCI_ENDPOINT_TEST
494494 depends on PCI
495+ select CRC32
495496 tristate "PCI Endpoint Test driver"
496497 ---help---
497498 Enable this configuration option to enable the host side test driver
drivers/uio/uio.c+4−4
@@ -279,7 +279,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) · 278 unmodified lines
279279 map = kzalloc(sizeof(*map), GFP_KERNEL);
280280 if (!map) {
281281 ret = -ENOMEM;
282− goto err_map_kobj;
282+ goto err_map;
283283 }
284284 kobject_init(&map->kobj, &map_attr_type);
285285 map->mem = mem;
@@ -289,7 +289,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) · 3 unmodified lines
289289 goto err_map_kobj;
290290 ret = kobject_uevent(&map->kobj, KOBJ_ADD);
291291 if (ret)
292− goto err_map;
292+ goto err_map_kobj;
293293 }
294294
295295 for (pi = 0; pi < MAX_UIO_PORT_REGIONS; pi++) {
@@ -308,7 +308,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) · 12 unmodified lines
308308 portio = kzalloc(sizeof(*portio), GFP_KERNEL);
309309 if (!portio) {
310310 ret = -ENOMEM;
311− goto err_portio_kobj;
311+ goto err_portio;
312312 }
313313 kobject_init(&portio->kobj, &portio_attr_type);
314314 portio->port = port;
@@ -319,7 +319,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) · 4 unmodified lines
319319 goto err_portio_kobj;
320320 ret = kobject_uevent(&portio->kobj, KOBJ_ADD);
321321 if (ret)
322− goto err_portio;
322+ goto err_portio_kobj;
323323 }
324324
325325 return 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t