aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2013-07-03 18:04:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:07:41 -0400
commitd8537548c924db3c44afde7646b6e220c7beb79d (patch)
tree619ef33bab975df1946eb118f7d03e6aaed77515 /drivers
parent02aa2a37636c8fa4fb9322d91be46ff8225b7de0 (diff)
drivers: avoid format strings in names passed to alloc_workqueue()
For the workqueue creation interfaces that do not expect format strings, make sure they cannot accidently be parsed that way. Additionally, clean up calls made with a single parameter that would be handled as a format string. Many callers are passing potentially dynamic string content, so use "%s" in those cases to avoid any potential accidents. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/pci/cx18/cx18-driver.c2
-rw-r--r--drivers/message/i2o/driver.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c2
-rw-r--r--drivers/net/wireless/rtlwifi/base.c2
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c4
-rw-r--r--drivers/pci/hotplug/shpchp_core.c3
-rw-r--r--drivers/scsi/be2iscsi/be_main.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c4
-rw-r--r--drivers/scsi/scsi_transport_fc.c6
9 files changed, 13 insertions, 16 deletions
diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c
index 67b61cf3e03a..004d8ace5019 100644
--- a/drivers/media/pci/cx18/cx18-driver.c
+++ b/drivers/media/pci/cx18/cx18-driver.c
@@ -695,7 +695,7 @@ static int cx18_create_in_workq(struct cx18 *cx)
695{ 695{
696 snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in", 696 snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
697 cx->v4l2_dev.name); 697 cx->v4l2_dev.name);
698 cx->in_work_queue = alloc_ordered_workqueue(cx->in_workq_name, 0); 698 cx->in_work_queue = alloc_ordered_workqueue("%s", 0, cx->in_workq_name);
699 if (cx->in_work_queue == NULL) { 699 if (cx->in_work_queue == NULL) {
700 CX18_ERR("Unable to create incoming mailbox handler thread\n"); 700 CX18_ERR("Unable to create incoming mailbox handler thread\n");
701 return -ENOMEM; 701 return -ENOMEM;
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c
index 8a5b2d8f4daf..813eaa33fa14 100644
--- a/drivers/message/i2o/driver.c
+++ b/drivers/message/i2o/driver.c
@@ -84,8 +84,8 @@ int i2o_driver_register(struct i2o_driver *drv)
84 osm_debug("Register driver %s\n", drv->name); 84 osm_debug("Register driver %s\n", drv->name);
85 85
86 if (drv->event) { 86 if (drv->event) {
87 drv->event_queue = alloc_workqueue(drv->name, 87 drv->event_queue = alloc_workqueue("%s", WQ_MEM_RECLAIM, 1,
88 WQ_MEM_RECLAIM, 1); 88 drv->name);
89 if (!drv->event_queue) { 89 if (!drv->event_queue) {
90 osm_err("Could not initialize event queue for driver " 90 osm_err("Could not initialize event queue for driver "
91 "%s\n", drv->name); 91 "%s\n", drv->name);
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 90dc14336980..c8b9ef0c21f8 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -1321,7 +1321,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
1321 * Initialize work. 1321 * Initialize work.
1322 */ 1322 */
1323 rt2x00dev->workqueue = 1323 rt2x00dev->workqueue =
1324 alloc_ordered_workqueue(wiphy_name(rt2x00dev->hw->wiphy), 0); 1324 alloc_ordered_workqueue("%s", 0, wiphy_name(rt2x00dev->hw->wiphy));
1325 if (!rt2x00dev->workqueue) { 1325 if (!rt2x00dev->workqueue) {
1326 retval = -ENOMEM; 1326 retval = -ENOMEM;
1327 goto exit; 1327 goto exit;
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index af59dd5718e1..a5f223145b0f 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -380,7 +380,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
380 380
381 /* <2> work queue */ 381 /* <2> work queue */
382 rtlpriv->works.hw = hw; 382 rtlpriv->works.hw = hw;
383 rtlpriv->works.rtl_wq = alloc_workqueue(rtlpriv->cfg->name, 0, 0); 383 rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name);
384 INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, 384 INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq,
385 (void *)rtl_watchdog_wq_callback); 385 (void *)rtl_watchdog_wq_callback);
386 INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, 386 INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq,
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 5127f3f41821..b2255736ac81 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -773,14 +773,12 @@ static void pcie_shutdown_notification(struct controller *ctrl)
773static int pcie_init_slot(struct controller *ctrl) 773static int pcie_init_slot(struct controller *ctrl)
774{ 774{
775 struct slot *slot; 775 struct slot *slot;
776 char name[32];
777 776
778 slot = kzalloc(sizeof(*slot), GFP_KERNEL); 777 slot = kzalloc(sizeof(*slot), GFP_KERNEL);
779 if (!slot) 778 if (!slot)
780 return -ENOMEM; 779 return -ENOMEM;
781 780
782 snprintf(name, sizeof(name), "pciehp-%u", PSN(ctrl)); 781 slot->wq = alloc_workqueue("pciehp-%u", 0, 0, PSN(ctrl));
783 slot->wq = alloc_workqueue(name, 0, 0);
784 if (!slot->wq) 782 if (!slot->wq)
785 goto abort; 783 goto abort;
786 784
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index 3100c52c837c..d3f757df691c 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -128,8 +128,7 @@ static int init_slots(struct controller *ctrl)
128 slot->hpc_ops = ctrl->hpc_ops; 128 slot->hpc_ops = ctrl->hpc_ops;
129 slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i); 129 slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i);
130 130
131 snprintf(name, sizeof(name), "shpchp-%d", slot->number); 131 slot->wq = alloc_workqueue("shpchp-%d", 0, 0, slot->number);
132 slot->wq = alloc_workqueue(name, 0, 0);
133 if (!slot->wq) { 132 if (!slot->wq) {
134 retval = -ENOMEM; 133 retval = -ENOMEM;
135 goto error_info; 134 goto error_info;
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index d24a2867bc21..a1f5ac7a9806 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4996,7 +4996,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
4996 4996
4997 snprintf(phba->wq_name, sizeof(phba->wq_name), "beiscsi_%02x_wq", 4997 snprintf(phba->wq_name, sizeof(phba->wq_name), "beiscsi_%02x_wq",
4998 phba->shost->host_no); 4998 phba->shost->host_no);
4999 phba->wq = alloc_workqueue(phba->wq_name, WQ_MEM_RECLAIM, 1); 4999 phba->wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, phba->wq_name);
5000 if (!phba->wq) { 5000 if (!phba->wq) {
5001 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 5001 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
5002 "BM_%d : beiscsi_dev_probe-" 5002 "BM_%d : beiscsi_dev_probe-"
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 4d231c12463e..b246b3c26912 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -7060,8 +7060,8 @@ skip_retry_init:
7060 } 7060 }
7061 INIT_WORK(&ha->dpc_work, qla4xxx_do_dpc); 7061 INIT_WORK(&ha->dpc_work, qla4xxx_do_dpc);
7062 7062
7063 sprintf(buf, "qla4xxx_%lu_task", ha->host_no); 7063 ha->task_wq = alloc_workqueue("qla4xxx_%lu_task", WQ_MEM_RECLAIM, 1,
7064 ha->task_wq = alloc_workqueue(buf, WQ_MEM_RECLAIM, 1); 7064 ha->host_no);
7065 if (!ha->task_wq) { 7065 if (!ha->task_wq) {
7066 ql4_printk(KERN_WARNING, ha, "Unable to start task thread!\n"); 7066 ql4_printk(KERN_WARNING, ha, "Unable to start task thread!\n");
7067 ret = -ENODEV; 7067 ret = -ENODEV;
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index e106c276aa00..4628fd5e0688 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -435,7 +435,7 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,
435 435
436 snprintf(fc_host->work_q_name, sizeof(fc_host->work_q_name), 436 snprintf(fc_host->work_q_name, sizeof(fc_host->work_q_name),
437 "fc_wq_%d", shost->host_no); 437 "fc_wq_%d", shost->host_no);
438 fc_host->work_q = alloc_workqueue(fc_host->work_q_name, 0, 0); 438 fc_host->work_q = alloc_workqueue("%s", 0, 0, fc_host->work_q_name);
439 if (!fc_host->work_q) 439 if (!fc_host->work_q)
440 return -ENOMEM; 440 return -ENOMEM;
441 441
@@ -443,8 +443,8 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,
443 snprintf(fc_host->devloss_work_q_name, 443 snprintf(fc_host->devloss_work_q_name,
444 sizeof(fc_host->devloss_work_q_name), 444 sizeof(fc_host->devloss_work_q_name),
445 "fc_dl_%d", shost->host_no); 445 "fc_dl_%d", shost->host_no);
446 fc_host->devloss_work_q = 446 fc_host->devloss_work_q = alloc_workqueue("%s", 0, 0,
447 alloc_workqueue(fc_host->devloss_work_q_name, 0, 0); 447 fc_host->devloss_work_q_name);
448 if (!fc_host->devloss_work_q) { 448 if (!fc_host->devloss_work_q) {
449 destroy_workqueue(fc_host->work_q); 449 destroy_workqueue(fc_host->work_q);
450 fc_host->work_q = NULL; 450 fc_host->work_q = NULL;