[CHECKER][PATCH] pnpbios dereferencing user pointer

Hollis Blanchard (hollisb@us.ibm.com)
Mon, 2 Jun 2003 15:10:12 -0500


--Apple-Mail-15--1031998591
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed

Another simple case of a memcpy that should be copy_from_user...

-- 
Hollis Blanchard
IBM Linux Technology Center

--Apple-Mail-15--1031998591 Content-Disposition: attachment; filename=pnpbios-memcpy.diff Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="pnpbios-memcpy.diff"

--- linux-2.5.70/drivers/pnp/pnpbios/proc.c.orig Mon Mar 24 16:30:11 2003 +++ linux-2.5.70/drivers/pnp/pnpbios/proc.c Tue May 27 13:18:57 2003 @@ -185,7 +185,10 @@ return -EIO; if (count != node->size - sizeof(struct pnp_bios_node)) return -EINVAL; - memcpy(node->data, buf, count); + if (copy_from_user(node->data, buf, count)) { + kfree(node); + return -EFAULT; + } if (pnp_bios_set_dev_node(node->handle, boot, node) != 0) return -EINVAL; kfree(node);

--Apple-Mail-15--1031998591--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/