From: Dmitry Shmidt Date: Fri, 4 Nov 2011 20:56:28 +0000 (-0700) Subject: net: wireless: bcmdhd: Fix possible memory leak in escan/iscan X-Git-Tag: firefly_0821_release~7613^2~227 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=766aaa604cda5d23a88eb0f8495b49ec59ca6db7;p=firefly-linux-kernel-4.4.55.git net: wireless: bcmdhd: Fix possible memory leak in escan/iscan Signed-off-by: Dmitry Shmidt --- diff --git a/drivers/net/wireless/bcmdhd/wl_cfg80211.c b/drivers/net/wireless/bcmdhd/wl_cfg80211.c index 526ba47895bc..daa7d2605aaf 100644 --- a/drivers/net/wireless/bcmdhd/wl_cfg80211.c +++ b/drivers/net/wireless/bcmdhd/wl_cfg80211.c @@ -1245,8 +1245,7 @@ wl_run_iscan(struct wl_iscan_ctrl *iscan, struct cfg80211_scan_request *request, } params = (struct wl_iscan_params *)kzalloc(params_size, GFP_KERNEL); if (!params) { - err = -ENOMEM; - goto done; + return -ENOMEM; } if (request != NULL) @@ -1270,8 +1269,8 @@ wl_run_iscan(struct wl_iscan_ctrl *iscan, struct cfg80211_scan_request *request, WL_ERR(("error (%d)\n", err)); } } - kfree(params); done: + kfree(params); return err; } @@ -1348,6 +1347,7 @@ wl_run_escan(struct wl_priv *wl, struct net_device *ndev, params->sync_id = htod16(0x1234); if (params_size + sizeof("escan") >= WLC_IOCTL_MEDLEN) { WL_ERR(("ioctl buffer length not sufficient\n")); + kfree(params); err = -ENOMEM; goto exit; }