From: Malcolm Priestley Date: Mon, 23 Sep 2013 19:30:42 +0000 (+0100) Subject: staging: vt6656: [BUG] iwctl_siwencodeext return if device not open X-Git-Tag: firefly_0821_release~6453^2~678 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=54cff964637d840e7860afa49a369c84c8cfbf61;p=firefly-linux-kernel-4.4.55.git staging: vt6656: [BUG] iwctl_siwencodeext return if device not open commit 5e8c3d3e41b0bf241e830a1ee0752405adecc050 upstream. Don't allow entry to iwctl_siwencodeext if device not open. This fixes a race condition where wpa supplicant/network manager enters the function when the device is already closed. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index d0cf7d8a20e5..8872e0f84f40 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -1634,6 +1634,9 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, if (pMgmt == NULL) return -EFAULT; + if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) + return -ENODEV; + buf = kzalloc(sizeof(struct viawget_wpa_param), GFP_KERNEL); if (buf == NULL) return -ENOMEM;