summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco/main.c
diff options
context:
space:
mode:
authorSantosh Nayak <santoshprasadnayak@gmail.com>2012-03-22 08:12:41 +0100
committerJohn W. Linville <linville@tuxdriver.com>2012-03-28 20:25:35 +0200
commite90c7e712980bf794f88f749e2a1270e4a4a116e (patch)
treee037a02e279b449c6889dcbee8b76424655f4036 /drivers/net/wireless/orinoco/main.c
parentnet/wireless: ipw2x00: fix a typo in wiphy struct initilization (diff)
downloadlinux-e90c7e712980bf794f88f749e2a1270e4a4a116e.tar.xz
linux-e90c7e712980bf794f88f749e2a1270e4a4a116e.zip
net: orinoco: add error handling for failed kmalloc().
With flag 'GFP_ATOMIC', probability of allocation failure is more. Add error handling after kmalloc() call to avoid null dereference. Signed-off-by: Santosh Nayak <santoshprasadnayak@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco/main.c')
-rw-r--r--drivers/net/wireless/orinoco/main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index dd6c64ac406e..88e3ad2d1db8 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -1336,6 +1336,10 @@ static void qbuf_scan(struct orinoco_private *priv, void *buf,
unsigned long flags;
sd = kmalloc(sizeof(*sd), GFP_ATOMIC);
+ if (!sd) {
+ printk(KERN_ERR "%s: failed to alloc memory\n", __func__);
+ return;
+ }
sd->buf = buf;
sd->len = len;
sd->type = type;
@@ -1353,6 +1357,10 @@ static void qabort_scan(struct orinoco_private *priv)
unsigned long flags;
sd = kmalloc(sizeof(*sd), GFP_ATOMIC);
+ if (!sd) {
+ printk(KERN_ERR "%s: failed to alloc memory\n", __func__);
+ return;
+ }
sd->len = -1; /* Abort */
spin_lock_irqsave(&priv->scan_lock, flags);