aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2007-04-26 04:36:49 -0400
committerDavid S. Miller <davem@davemloft.net>2007-04-26 04:36:49 -0400
commit1c8ea5aee0b16409295d96a5e8984bd902f06a77 (patch)
tree9761ea7c4fc8a315549529303d7842ed968e6763
parent14690fc649f4c59712f497135f7323eb8ceceaaf (diff)
[IRDA] irda_device_dongle_init: fix kzalloc(GFP_KERNEL) in spinlock
Fix http://bugzilla.kernel.org/show_bug.cgi?id=8343 Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Samuel Ortiz <samuel@sortiz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/irda/irda_device.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c
index e717801b38f9..7b5def1ea633 100644
--- a/net/irda/irda_device.c
+++ b/net/irda/irda_device.c
@@ -375,7 +375,7 @@ EXPORT_SYMBOL(alloc_irdadev);
375dongle_t *irda_device_dongle_init(struct net_device *dev, int type) 375dongle_t *irda_device_dongle_init(struct net_device *dev, int type)
376{ 376{
377 struct dongle_reg *reg; 377 struct dongle_reg *reg;
378 dongle_t *dongle = NULL; 378 dongle_t *dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL);
379 379
380 might_sleep(); 380 might_sleep();
381 381
@@ -397,19 +397,14 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type)
397 if (!reg || !try_module_get(reg->owner) ) { 397 if (!reg || !try_module_get(reg->owner) ) {
398 IRDA_ERROR("IrDA: Unable to find requested dongle type %x\n", 398 IRDA_ERROR("IrDA: Unable to find requested dongle type %x\n",
399 type); 399 type);
400 goto out; 400 kfree(dongle);
401 dongle = NULL;
402 }
403 if (dongle) {
404 /* Bind the registration info to this particular instance */
405 dongle->issue = reg;
406 dongle->dev = dev;
401 } 407 }
402
403 /* Allocate dongle info for this instance */
404 dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL);
405 if (!dongle)
406 goto out;
407
408 /* Bind the registration info to this particular instance */
409 dongle->issue = reg;
410 dongle->dev = dev;
411
412 out:
413 spin_unlock(&dongles->hb_spinlock); 408 spin_unlock(&dongles->hb_spinlock);
414 return dongle; 409 return dongle;
415} 410}