Skip to content

Commit 4c6790c

Browse files
committed
Merge tag 'for-linus-4.16-1' of git://github.com/cminyard/linux-ipmi
Pull IPMI updates from Corey Minyard: "Small fixes for various things, been sitting in next for a while (some a long time)" * tag 'for-linus-4.16-1' of git://github.com/cminyard/linux-ipmi: ipmi_ssif: Remove duplicate NULL check ipmi/powernv: Fix error return code in ipmi_powernv_probe() ipmi: use dynamic memory for DMI driver override ipmi/ipmi_powernv: remove outdated todo in powernv IPMI driver ipmi: Clear smi_info->thread to prevent use-after-free during module unload ipmi: use correct string length ipmi_si: Fix error handling of platform device ipmi watchdog: fix typo in parameter description ipmi_si_platform: Fix typo in parameter description
2 parents 972058a + e45af3d commit 4c6790c

File tree

7 files changed

+21
-14
lines changed

7 files changed

+21
-14
lines changed

drivers/char/ipmi/ipmi_dmi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr,
106106
pr_err("ipmi:dmi: Error allocation IPMI platform device\n");
107107
return;
108108
}
109-
pdev->driver_override = override;
109+
pdev->driver_override = kasprintf(GFP_KERNEL, "%s",
110+
override);
111+
if (!pdev->driver_override)
112+
goto err;
110113

111114
if (type == IPMI_DMI_TYPE_SSIF) {
112115
set_prop_entry(p[pidx++], "i2c-addr", u16, base_addr);

drivers/char/ipmi/ipmi_msghandler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static int panic_op_write_handler(const char *val,
8484
char valcp[16];
8585
char *s;
8686

87-
strncpy(valcp, val, 16);
87+
strncpy(valcp, val, 15);
8888
valcp[15] = '\0';
8989

9090
s = strstrip(valcp);

drivers/char/ipmi/ipmi_powernv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,9 @@ static int ipmi_powernv_probe(struct platform_device *pdev)
250250
ipmi->irq = opal_event_request(prop);
251251
}
252252

253-
if (request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH,
254-
"opal-ipmi", ipmi)) {
253+
rc = request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH,
254+
"opal-ipmi", ipmi);
255+
if (rc) {
255256
dev_warn(dev, "Unable to request irq\n");
256257
goto err_dispose;
257258
}
@@ -264,7 +265,6 @@ static int ipmi_powernv_probe(struct platform_device *pdev)
264265
goto err_unregister;
265266
}
266267

267-
/* todo: query actual ipmi_device_id */
268268
rc = ipmi_register_smi(&ipmi_powernv_smi_handlers, ipmi, dev, 0);
269269
if (rc) {
270270
dev_warn(dev, "IPMI SMI registration failed (%d)\n", rc);

drivers/char/ipmi/ipmi_si_intf.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,8 +1938,10 @@ static void check_for_broken_irqs(struct smi_info *smi_info)
19381938

19391939
static inline void stop_timer_and_thread(struct smi_info *smi_info)
19401940
{
1941-
if (smi_info->thread != NULL)
1941+
if (smi_info->thread != NULL) {
19421942
kthread_stop(smi_info->thread);
1943+
smi_info->thread = NULL;
1944+
}
19431945

19441946
smi_info->timer_can_start = false;
19451947
if (smi_info->timer_running)
@@ -2045,6 +2047,7 @@ static int try_smi_init(struct smi_info *new_smi)
20452047
int rv = 0;
20462048
int i;
20472049
char *init_name = NULL;
2050+
bool platform_device_registered = false;
20482051

20492052
pr_info(PFX "Trying %s-specified %s state machine at %s address 0x%lx, slave address 0x%x, irq %d\n",
20502053
ipmi_addr_src_to_str(new_smi->io.addr_source),
@@ -2173,6 +2176,7 @@ static int try_smi_init(struct smi_info *new_smi)
21732176
rv);
21742177
goto out_err;
21752178
}
2179+
platform_device_registered = true;
21762180
}
21772181

21782182
dev_set_drvdata(new_smi->io.dev, new_smi);
@@ -2279,10 +2283,11 @@ static int try_smi_init(struct smi_info *new_smi)
22792283
}
22802284

22812285
if (new_smi->pdev) {
2282-
platform_device_unregister(new_smi->pdev);
2286+
if (platform_device_registered)
2287+
platform_device_unregister(new_smi->pdev);
2288+
else
2289+
platform_device_put(new_smi->pdev);
22832290
new_smi->pdev = NULL;
2284-
} else if (new_smi->pdev) {
2285-
platform_device_put(new_smi->pdev);
22862291
}
22872292

22882293
kfree(init_name);

drivers/char/ipmi/ipmi_si_platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ MODULE_PARM_DESC(tryacpi, "Setting this to zero will disable the"
4040
#endif
4141
#ifdef CONFIG_OF
4242
module_param_named(tryopenfirmware, si_tryopenfirmware, bool, 0);
43-
MODULE_PARM_DESC(tryacpi, "Setting this to zero will disable the"
43+
MODULE_PARM_DESC(tryopenfirmware, "Setting this to zero will disable the"
4444
" default scan of the interfaces identified via OpenFirmware");
4545
#endif
4646
#ifdef CONFIG_DMI

drivers/char/ipmi/ipmi_ssif.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,8 +2071,7 @@ static int ssif_platform_remove(struct platform_device *dev)
20712071
return 0;
20722072

20732073
mutex_lock(&ssif_infos_mutex);
2074-
if (addr_info->client)
2075-
i2c_unregister_device(addr_info->client);
2074+
i2c_unregister_device(addr_info->client);
20762075

20772076
list_del(&addr_info->link);
20782077
kfree(addr_info);

drivers/char/ipmi/ipmi_watchdog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static int set_param_str(const char *val, const struct kernel_param *kp)
232232
char valcp[16];
233233
char *s;
234234

235-
strncpy(valcp, val, 16);
235+
strncpy(valcp, val, 15);
236236
valcp[15] = '\0';
237237

238238
s = strstrip(valcp);
@@ -298,7 +298,7 @@ module_param(pretimeout, timeout, 0644);
298298
MODULE_PARM_DESC(pretimeout, "Pretimeout value in seconds.");
299299

300300
module_param(panic_wdt_timeout, timeout, 0644);
301-
MODULE_PARM_DESC(timeout, "Timeout value on kernel panic in seconds.");
301+
MODULE_PARM_DESC(panic_wdt_timeout, "Timeout value on kernel panic in seconds.");
302302

303303
module_param_cb(action, &param_ops_str, action_op, 0644);
304304
MODULE_PARM_DESC(action, "Timeout action. One of: "

0 commit comments

Comments
 (0)