Skip to content

Commit

Permalink
[IRDA] irda_device_dongle_init: fix kzalloc(GFP_KERNEL) in spinlock
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrew Morton authored and David S. Miller committed Apr 26, 2007
1 parent 14690fc commit 1c8ea5a
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions net/irda/irda_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ EXPORT_SYMBOL(alloc_irdadev);
dongle_t *irda_device_dongle_init(struct net_device *dev, int type)
{
struct dongle_reg *reg;
dongle_t *dongle = NULL;
dongle_t *dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL);

might_sleep();

Expand All @@ -397,19 +397,14 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type)
if (!reg || !try_module_get(reg->owner) ) {
IRDA_ERROR("IrDA: Unable to find requested dongle type %x\n",
type);
goto out;
kfree(dongle);
dongle = NULL;
}
if (dongle) {
/* Bind the registration info to this particular instance */
dongle->issue = reg;
dongle->dev = dev;
}

/* Allocate dongle info for this instance */
dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL);
if (!dongle)
goto out;

/* Bind the registration info to this particular instance */
dongle->issue = reg;
dongle->dev = dev;

out:
spin_unlock(&dongles->hb_spinlock);
return dongle;
}
Expand Down

0 comments on commit 1c8ea5a

Please sign in to comment.