Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Commit

Permalink
Merge tag 'for-linus-5.1-2' of git://github.com/cminyard/linux-ipmi
Browse files Browse the repository at this point in the history
Pull IPMI fixes from Corey Minyard:
 "Fixes for some bugs cause by recent changes. One crash if you feed bad
  data to the module parameters, one BUG that sometimes occurs when a
  user closes the connection, and one bug that cause the driver to not
  work if the configuration information only comes in from SMBIOS"

* tag 'for-linus-5.1-2' of git://github.com/cminyard/linux-ipmi:
  ipmi: fix sleep-in-atomic in free_user at cleanup SRCU user->release_barrier
  ipmi: ipmi_si_hardcode.c: init si_type array to fix a crash
  ipmi: Fix failure on SMBIOS specified devices
  • Loading branch information
torvalds committed Apr 17, 2019
2 parents 2a3a028 + 3b9a907 commit fe5cdef
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
1 change: 0 additions & 1 deletion drivers/char/ipmi/ipmi_dmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr,
return;
}

memset(&p, 0, sizeof(p));
p.addr = base_addr;
p.space = space;
p.regspacing = offset;
Expand Down
19 changes: 17 additions & 2 deletions drivers/char/ipmi/ipmi_msghandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ struct ipmi_user {

/* Does this interface receive IPMI events? */
bool gets_events;

/* Free must run in process context for RCU cleanup. */
struct work_struct remove_work;
};

static struct ipmi_user *acquire_ipmi_user(struct ipmi_user *user, int *index)
Expand Down Expand Up @@ -1157,6 +1160,15 @@ static int intf_err_seq(struct ipmi_smi *intf,
return rv;
}

static void free_user_work(struct work_struct *work)
{
struct ipmi_user *user = container_of(work, struct ipmi_user,
remove_work);

cleanup_srcu_struct(&user->release_barrier);
kfree(user);
}

int ipmi_create_user(unsigned int if_num,
const struct ipmi_user_hndl *handler,
void *handler_data,
Expand Down Expand Up @@ -1200,6 +1212,8 @@ int ipmi_create_user(unsigned int if_num,
goto out_kfree;

found:
INIT_WORK(&new_user->remove_work, free_user_work);

rv = init_srcu_struct(&new_user->release_barrier);
if (rv)
goto out_kfree;
Expand Down Expand Up @@ -1260,8 +1274,9 @@ EXPORT_SYMBOL(ipmi_get_smi_info);
static void free_user(struct kref *ref)
{
struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount);
cleanup_srcu_struct(&user->release_barrier);
kfree(user);

/* SRCU cleanup must happen in task context. */
schedule_work(&user->remove_work);
}

static void _ipmi_destroy_user(struct ipmi_user *user)
Expand Down
2 changes: 2 additions & 0 deletions drivers/char/ipmi/ipmi_si_hardcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ void __init ipmi_hardcode_init(void)
char *str;
char *si_type[SI_MAX_PARMS];

memset(si_type, 0, sizeof(si_type));

/* Parse out the si_type string into its components. */
str = si_type_str;
if (*str != '\0') {
Expand Down

0 comments on commit fe5cdef

Please sign in to comment.