Skip to content

Commit fe5cdef

Browse files
committed
Merge tag 'for-linus-5.1-2' of git://github.com/cminyard/linux-ipmi
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
2 parents 2a3a028 + 3b9a907 commit fe5cdef

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

‎drivers/char/ipmi/ipmi_dmi.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr,
6666
return;
6767
}
6868

69-
memset(&p, 0, sizeof(p));
7069
p.addr = base_addr;
7170
p.space = space;
7271
p.regspacing = offset;

‎drivers/char/ipmi/ipmi_msghandler.c‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ struct ipmi_user {
214214

215215
/* Does this interface receive IPMI events? */
216216
bool gets_events;
217+
218+
/* Free must run in process context for RCU cleanup. */
219+
struct work_struct remove_work;
217220
};
218221

219222
static struct ipmi_user *acquire_ipmi_user(struct ipmi_user *user, int *index)
@@ -1157,6 +1160,15 @@ static int intf_err_seq(struct ipmi_smi *intf,
11571160
return rv;
11581161
}
11591162

1163+
static void free_user_work(struct work_struct *work)
1164+
{
1165+
struct ipmi_user *user = container_of(work, struct ipmi_user,
1166+
remove_work);
1167+
1168+
cleanup_srcu_struct(&user->release_barrier);
1169+
kfree(user);
1170+
}
1171+
11601172
int ipmi_create_user(unsigned int if_num,
11611173
const struct ipmi_user_hndl *handler,
11621174
void *handler_data,
@@ -1200,6 +1212,8 @@ int ipmi_create_user(unsigned int if_num,
12001212
goto out_kfree;
12011213

12021214
found:
1215+
INIT_WORK(&new_user->remove_work, free_user_work);
1216+
12031217
rv = init_srcu_struct(&new_user->release_barrier);
12041218
if (rv)
12051219
goto out_kfree;
@@ -1260,8 +1274,9 @@ EXPORT_SYMBOL(ipmi_get_smi_info);
12601274
static void free_user(struct kref *ref)
12611275
{
12621276
struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount);
1263-
cleanup_srcu_struct(&user->release_barrier);
1264-
kfree(user);
1277+
1278+
/* SRCU cleanup must happen in task context. */
1279+
schedule_work(&user->remove_work);
12651280
}
12661281

12671282
static void _ipmi_destroy_user(struct ipmi_user *user)

‎drivers/char/ipmi/ipmi_si_hardcode.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ void __init ipmi_hardcode_init(void)
118118
char *str;
119119
char *si_type[SI_MAX_PARMS];
120120

121+
memset(si_type, 0, sizeof(si_type));
122+
121123
/* Parse out the si_type string into its components. */
122124
str = si_type_str;
123125
if (*str != '\0') {

0 commit comments

Comments
 (0)