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

Merge branch 'ipmi' (minor ipmi fixes from Corey)

Merge ipmi fixes from Corey Minyard:
 "Some minor fixes I had queued up.  The last one came in recently
  (patch 4) and it and patch 2 are candidates for stable-kernel."

* emailed patches from Corey Minyard <cminyard@mvista.com>:
  ipmi: ipmi_devintf: compat_ioctl method fails to take ipmi_mutex
  ipmi: Improve error messages on failed irq enable
  drivers/char/ipmi: memcpy, need additional 2 bytes to avoid memory overflow
  drivers: char: ipmi: Replaced kmalloc and strcpy with kstrdup
......@@ -95,9 +95,9 @@ struct si_sm_data {
enum bt_states state;
unsigned char seq; /* BT sequence number */
struct si_sm_io *io;
unsigned char write_data[IPMI_MAX_MSG_LENGTH];
unsigned char write_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */
int write_count;
unsigned char read_data[IPMI_MAX_MSG_LENGTH];
unsigned char read_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */
int read_count;
int truncated;
long timeout; /* microseconds countdown */
......
......@@ -837,13 +837,25 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
return ipmi_ioctl(filep, cmd, arg);
}
}
static long unlocked_compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
unsigned long arg)
{
int ret;
mutex_lock(&ipmi_mutex);
ret = compat_ipmi_ioctl(filep, cmd, arg);
mutex_unlock(&ipmi_mutex);
return ret;
}
#endif
static const struct file_operations ipmi_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = ipmi_unlocked_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = compat_ipmi_ioctl,
.compat_ioctl = unlocked_compat_ipmi_ioctl,
#endif
.open = ipmi_open,
.release = ipmi_release,
......
......@@ -2037,12 +2037,11 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
entry = kmalloc(sizeof(*entry), GFP_KERNEL);
if (!entry)
return -ENOMEM;
entry->name = kmalloc(strlen(name)+1, GFP_KERNEL);
entry->name = kstrdup(name, GFP_KERNEL);
if (!entry->name) {
kfree(entry);
return -ENOMEM;
}
strcpy(entry->name, name);
file = proc_create_data(name, 0, smi->proc_dir, proc_ops, data);
if (!file) {
......
......@@ -663,8 +663,10 @@ static void handle_transaction_done(struct smi_info *smi_info)
/* We got the flags from the SMI, now handle them. */
smi_info->handlers->get_result(smi_info->si_sm, msg, 4);
if (msg[2] != 0) {
dev_warn(smi_info->dev, "Could not enable interrupts"
", failed get, using polled mode.\n");
dev_warn(smi_info->dev,
"Couldn't get irq info: %x.\n", msg[2]);
dev_warn(smi_info->dev,
"Maybe ok, but ipmi might run very slowly.\n");
smi_info->si_state = SI_NORMAL;
} else {
msg[0] = (IPMI_NETFN_APP_REQUEST << 2);
......@@ -685,10 +687,12 @@ static void handle_transaction_done(struct smi_info *smi_info)
/* We got the flags from the SMI, now handle them. */
smi_info->handlers->get_result(smi_info->si_sm, msg, 4);
if (msg[2] != 0)
dev_warn(smi_info->dev, "Could not enable interrupts"
", failed set, using polled mode.\n");
else
if (msg[2] != 0) {
dev_warn(smi_info->dev,
"Couldn't set irq info: %x.\n", msg[2]);
dev_warn(smi_info->dev,
"Maybe ok, but ipmi might run very slowly.\n");
} else
smi_info->interrupt_disabled = 0;
smi_info->si_state = SI_NORMAL;
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册