提交 73d58588 编写于 作者: B Benjamin Herrenschmidt 提交者: Linus Torvalds

[PATCH] pcmcia Oopses fixes

Fix some NULL dereferences in the pcmcia code when using old userland
tools.
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: NDominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 94585136
......@@ -426,7 +426,7 @@ static int ds_open(struct inode *inode, struct file *file)
if (!warning_printed) {
printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl "
"usage.\n");
"usage from process: %s.\n", current->comm);
printk(KERN_INFO "pcmcia: This interface will soon be removed from "
"the kernel; please expect breakage unless you upgrade "
"to new tools.\n");
......@@ -601,9 +601,13 @@ static int ds_ioctl(struct inode * inode, struct file * file,
ret = CS_BAD_ARGS;
else {
struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function);
if (p_dev == NULL)
ret = CS_BAD_ARGS;
else {
ret = pccard_get_configuration_info(s, p_dev, &buf->config);
pcmcia_put_dev(p_dev);
}
}
break;
case DS_GET_FIRST_TUPLE:
mutex_lock(&s->skt_mutex);
......@@ -632,9 +636,13 @@ static int ds_ioctl(struct inode * inode, struct file * file,
ret = CS_BAD_ARGS;
else {
struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function);
if (p_dev == NULL)
ret = CS_BAD_ARGS;
else {
ret = pccard_get_status(s, p_dev, &buf->status);
pcmcia_put_dev(p_dev);
}
}
break;
case DS_VALIDATE_CIS:
mutex_lock(&s->skt_mutex);
......@@ -665,10 +673,11 @@ static int ds_ioctl(struct inode * inode, struct file * file,
if (!(buf->conf_reg.Function &&
(buf->conf_reg.Function >= s->functions))) {
struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function);
if (p_dev)
if (p_dev) {
ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg);
pcmcia_put_dev(p_dev);
}
}
break;
case DS_GET_FIRST_REGION:
case DS_GET_NEXT_REGION:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册