浏览代码

staging: vt6656: [BUG] iwctl_siwencodeext return if device not open

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 <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org # 3.8+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Malcolm Priestley 11 年之前
父节点
当前提交
5e8c3d3e41
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      drivers/staging/vt6656/iwctl.c

+ 3 - 0
drivers/staging/vt6656/iwctl.c

@@ -1634,6 +1634,9 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info,
 	if (pMgmt == NULL)
 	if (pMgmt == NULL)
 		return -EFAULT;
 		return -EFAULT;
 
 
+	if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
+		return -ENODEV;
+
 	buf = kzalloc(sizeof(struct viawget_wpa_param), GFP_KERNEL);
 	buf = kzalloc(sizeof(struct viawget_wpa_param), GFP_KERNEL);
 	if (buf == NULL)
 	if (buf == NULL)
 		return -ENOMEM;
 		return -ENOMEM;