]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
wireless: ipw2100: check result of kzalloc()
authorChristoph Fritz <chf.fritz@googlemail.com>
Tue, 3 Aug 2010 10:54:20 +0000 (12:54 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 4 Aug 2010 19:28:37 +0000 (15:28 -0400)
If kzalloc() fails return with -ENOMEM from ipw2100_net_init() which is
called by register_netdev.

CC: Dan Carpenter <error27@gmail.com>
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ipw2x00/ipw2100.c

index 5bbff4c5a4895b51acc66351bfcf18b212eeea3d..a146240f7ddbf1d8f85f364ce3783d877789668c 100644 (file)
@@ -1924,6 +1924,10 @@ static int ipw2100_net_init(struct net_device *dev)
                bg_band->channels =
                        kzalloc(geo->bg_channels *
                                sizeof(struct ieee80211_channel), GFP_KERNEL);
+               if (!bg_band->channels) {
+                       ipw2100_down(priv);
+                       return -ENOMEM;
+               }
                /* translate geo->bg to bg_band.channels */
                for (i = 0; i < geo->bg_channels; i++) {
                        bg_band->channels[i].band = IEEE80211_BAND_2GHZ;