Commit Graph

726 Commits

Author SHA1 Message Date
Pavel Skripkin e02a3b9458 staging: rtl8712: fix memory leak in rtl871x_load_fw_cb
There is a leak in rtl8712 driver.
The problem was in non-freed adapter data if
firmware load failed.

This leak can be reproduced with this code:
https://syzkaller.appspot.com/text?tag=ReproC&x=16612f02d00000,
Autoload must fail (to not hit memory leak reported by syzkaller)

There are 2 possible ways how rtl871x_load_fw_cb() and
r871xu_dev_remove() can be called (in case of fw load error).

1st case:
	r871xu_dev_remove() then rtl871x_load_fw_cb()

	In this case r871xu_dev_remove() will wait for
	completion and then will jump to the end, because
	rtl871x_load_fw_cb() set intfdata to NULL:

	if (pnetdev) {
		struct _adapter *padapter = netdev_priv(pnetdev);

		/* never exit with a firmware callback pending */
		wait_for_completion(&padapter->rtl8712_fw_ready);
		pnetdev = usb_get_intfdata(pusb_intf);
		usb_set_intfdata(pusb_intf, NULL);
		if (!pnetdev)
			goto firmware_load_fail;

		... clean up code here ...
	}

2nd case:
	rtl871x_load_fw_cb() then r871xu_dev_remove()

	In this case pnetdev (from code snippet above) will
	be zero (because rtl871x_load_fw_cb() set it to NULL)
	And clean up code won't be executed again.

So, in all cases we need to free adapted data in rtl871x_load_fw_cb(),
because disconnect function cannot take care of it. And there won't be
any race conditions, because complete() call happens after setting
intfdata to NULL.

In previous patch I moved out free_netdev() from r8712_free_drv_sw()
and that's why now it's possible to free adapter data and then call
complete.

Fixes: 8c213fa591 ("staging: r8712u: Use asynchronous firmware loading")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/81e68fe0194499cc2e7692d35bc4dcf167827d8f.1623620630.git.paskripkin@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-14 16:48:09 +02:00
Pavel Skripkin d1d3e3cdfd staging: rtl8712: fix error handling in r871xu_drv_init
Previous error handling path was unique for all
possible errors and there was unnecessary branching.
Also, one step for freeing drv_sw was missing. All
these problems was fixed by restructuring error
handling path.

Also, moved out free_netdev() from r8712_free_drv_sw() for
correct error handling.

Fixes: 2865d42c78 ("staging: r8712u: Add the new driver to the mainline kernel")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/febb00f72354449bb4d305f373d6d2f47e539ab4.1623620630.git.paskripkin@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-14 16:48:09 +02:00
Pavel Skripkin 69d998f1e5 staging: rtl8712: remove redundant check in r871xu_drv_init
padapter->dvobj_init is initialized rigth before
initialization check. There is no need for any
branching here.

Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/d367e5f39f22af44c545f8710cc18fb00f10e66c.1623620630.git.paskripkin@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-14 16:48:09 +02:00
Fabio M. De Francesco eff810f82e staging: rtl8712: Replace printk() with netdev_dbg()
Replaced printk() with netdev_dbg() because the latter is preferred in
network devices drivers.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20210609135659.4054-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-12 15:37:57 +02:00
Fabio M. De Francesco 54fd727f83 staging: rtl8712: Remove unnecessary alias of printk()
This module defines four alias for printk(). Removed them
all, because they are not used anywhere else in the driver.
Converted the only exception to the explicit use of printk().

Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20210606034038.9657-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-09 12:11:21 +02:00
Khoa Tran Minh 3efe8c49cc Staging: rtl8712: Cleanup coding style warning
This patch fixes checkpatch warning about multiple line dereference.

Signed-off-by: Khoa Tran Minh <ktm8@posteo.de>
Link: https://lore.kernel.org/r/YLZ1fc7BsaTo+ixQ@rue.localhost
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-03 15:57:37 +02:00
Hriday Hegde 939ef16943 staging: rtl8712: Removed unnecessary blank lines
Following lines were fixed as dictated by running checkpatch

CHECK: Please don't use multiple blank lines
65: FILE: drivers/staging/rtl8712/xmit_linux.c:65:
+

CHECK: Blank lines aren't necessary after an open brace '{'
39: FILE: drivers/staging/rtl8712/usb_intf.c:39:
+static const struct usb_device_id rtl871x_usb_id_tbl[] = {

CHECK: Blank lines aren't necessary after an open brace '{'
849: FILE: drivers/staging/rtl8712/rtl871x_xmit.c:849:
+{

CHECK: Please don't use multiple blank lines
260: FILE: drivers/staging/rtl8712/rtl871x_sta_mgt.c:260:
+

Signed-off-by: Hriday Hegde <hridayhegde1999@gmail.com>
Link: https://lore.kernel.org/r/20210521153924.22843-1-hridayhegde1999@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-25 18:23:26 +02:00
Dan Carpenter e2a0271094 staging: rtl8712: fix the bssid in mp_start_test()
We recently moved "bssid" off the stack, and allocated it with kmalloc()
instead.  Unfortunately, this one line was overlooked so it will copy
random data into the &tgt_network->network instead of the data we want.

Fixes: 0b18e5fe60 ("staging: rtl8712: rtl871x_mp_ioctl: Move a large data struct onto the heap")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YJ6IrfkbdaTHgpEv@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-19 16:02:51 +02:00
Christophe JAILLET 116138c3bd staging: rtl8712: Fix some tests against some 'data' subtype frames
Commit 6e2baa44c6 ("staging: rtl8712: remove enum WIFI_FRAME_SUBTYPE")
was wrong because:
	WIFI_DATA_NULL != IEEE80211_STYPE_NULLFUNC
	WIFI_DATA_CFACK != IEEE80211_STYPE_DATA_CFACK
	WIFI_DATA_CFPOLL != IEEE80211_STYPE_DATA_CFPOLL
	WIFI_DATA_CFACKPOLL != IEEE80211_STYPE_DATA_CFACKPOLL

the WIFI_DATA_xxx definitions include WIFI_DATA_TYPE, which is 'BIT(3)'.
Restore the previous behavior by adding the missing
'IEEE80211_FTYPE_DATA |' (0x0008, that is to say BIT(3)) when these values
are used.

Hopefully, the wrong commit was small enough and hand review is possible.

Fixes: 6e2baa44c6 ("staging: rtl8712: remove enum WIFI_FRAME_SUBTYPE")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/44aebfa3c5ce8f45ae05369c73e9ff77c6d271f9.1619939806.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10 11:19:34 +02:00
Alexander Vorwerk 62409b31db staging: rtl8712: remove multiple multiple assignments
Documentation/process/coding-style.rst says (in line 88)
"Don't put multiple assignments on a single line either."

This patch fixes the coding style issue reported by checkpatch.pl.

Signed-off-by: Alexander Vorwerk <alec@vc-celle.de>
Link: https://lore.kernel.org/r/20210501234501.5411-1-alec@vc-celle.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10 11:19:34 +02:00
Guenter Roeck 3580942c86 staging: rtl8712: Use list iterators and helpers
Use existing list iterators and helper functions.

The following coccinelle script was used to convert the code.

@@
identifier v1, v2, v3, v4;
symbol next;
expression e;
iterator name list_for_each;
statement S;
@@

<+...
(
- e = v1->next;
|
- e = get_next(v1);
)
  ... when != e
- while ( \( v1 != e \| e != v1 \) )
+ list_for_each (e, v1)
  {
    ...
-   v2 = container_of(e, struct v3, v4);
+   v2 = list_entry(e, struct v3, v4);
?-  if (!v2) S
    ...
(
-   e = e->next;
|
- e = get_next(e);
)
    ... when != e
  }
...+>

Compile tested only.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20210428173523.149958-1-linux@roeck-us.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10 11:19:33 +02:00
Lee Jones 0b18e5fe60 staging: rtl8712: rtl871x_mp_ioctl: Move a large data struct onto the heap
Fixes the following W=1 kernel build warning(s):

 drivers/staging/rtl8712/rtl871x_mp_ioctl.c: In function ‘mp_start_test’:
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c:204:1: warning: the frame size of 1136 bytes is larger than 1024 bytes [-Wframe-larger-than=]

Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Zhansaya Bagdauletkyzy <zhansayabagdaulet@gmail.com>
Cc: Michael Straube <straube.linux@gmail.com>
Cc: WLAN FAE <wlanfae@realtek.com>
Cc: linux-staging@lists.linux.dev
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210414181129.1628598-21-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10 11:19:24 +02:00
Lee Jones 02d06dd534 staging: rtl8712: rtl871x_mp_ioctl: Remove a bunch of unused tables
Fixes the following W=1 kernel build warning(s):

 drivers/staging/rtl8712/rtl871x_mp_ioctl.h:256:34: warning: ‘oid_rtl_seg_81_85’ defined but not used [-Wunused-const-variable=]
 drivers/staging/rtl8712/rtl871x_mp_ioctl.h:249:34: warning: ‘oid_rtl_seg_81_80_80’ defined but not used [-Wunused-const-variable=]
 drivers/staging/rtl8712/rtl871x_mp_ioctl.h:240:34: warning: ‘oid_rtl_seg_81_80_40’ defined but not used [-Wunused-const-variable=]
 drivers/staging/rtl8712/rtl871x_mp_ioctl.h:205:34: warning: ‘oid_rtl_seg_81_80_20’ defined but not used [-Wunused-const-variable=]
 drivers/staging/rtl8712/rtl871x_mp_ioctl.h:138:34: warning: ‘oid_rtl_seg_81_80_00’ defined but not used [-Wunused-const-variable=]

Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: WLAN FAE <wlanfae@realtek.com>
Cc: linux-staging@lists.linux.dev
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210414181129.1628598-13-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10 11:19:23 +02:00
Sergei Krainov 3f8f36da0c staging: rtl8712: fix wrong function output
Return NULL from r8712_find_network() if no matched wlan_network
was found. Code with a bug:

while (plist != phead) {
	pnetwork = container_of(plist, struct wlan_network, list);
	plist = plist->next;
	if (!memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN))
		break;
}
spin_unlock_irqrestore(&scanned_queue->lock, irqL);
return pnetwork;

In this code last processed pnetwork returned if list end was reached
and no pnetwork matched test condition.

Signed-off-by: Sergei Krainov <sergei.krainov.lkd@gmail.com>
Link: https://lore.kernel.org/r/20210409124611.GA3981@test-VirtualBox
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-09 16:16:10 +02:00
Christophe JAILLET 8b4fa9c356 staging: rtl8712: remove (most of) enum WIFI_FRAME_TYPE
The values defined in enum WIFI_FRAME_TYPE are the same the #define
IEEE80211_FTYPE_xxx from <linux/ieee80211.h>

Use these values to avoid code duplication.

WIFI_QOS_DATA_TYPE is a bit more tricky and doesn't have a direct
equivalence in <linux/ieee80211.h>. So leave this one as-is for now.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/e009a4ee6429a3f79742f9a912e3f6a650fb33ed.1617911201.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-09 16:14:33 +02:00
Christophe JAILLET 6e2baa44c6 staging: rtl8712: remove enum WIFI_FRAME_SUBTYPE
The values defined in enum WIFI_FRAME_SUBTYPE are the same the #define
IEEE80211_STYPE_xxx from <linux/ieee80211.h>

Use theses values to avoid code duplication.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/5a6fdcf0b5eb43c3d5511b5badd60bfac9389628.1617911201.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-09 16:14:33 +02:00
Christophe JAILLET 63ee275711 staging: rtl8712: remove struct rtl_ieee80211_ht_cap and ieee80211_ht_addt_info
struct 'ieee80211_ht_addt_info' is unused and can be removed.

struct 'rtl_ieee80211_ht_cap' can be replaced by 'ieee80211_ht_cap'
defined in <linux/ieee80211.h> which has the same layout.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/4291cb10744457cc12c89fc9fd414c37d732bc9d.1617911201.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-09 16:14:33 +02:00
Mitali Borkar bb40b33d30 staging: rtl8712: add spaces around '+'
Added spaces around '+' to improve readability and adhere to linux
kernel coding style.
Reported by checkpatch

Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
Link: https://lore.kernel.org/r/YG7uLQLGmAh97xB1@kali
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-09 16:11:23 +02:00
Mitali Borkar 73aba1b5f0 staging: rtl8712: removed extra blank line
Removed an extra blank line so that only one blank line is present in
between two functions which separates them out.
Reported by checkpatch

Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
Link: https://lore.kernel.org/r/YG5ppTlGhRp5WVgS@kali
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-08 09:27:59 +02:00
Mitali Borkar d03f499e64 staging: rtl8712: matched alignment with open parenthesis
Aligned arguments with open parenthesis to meet linux kernel coding
style
Reported by checkpatch

Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
Link: https://lore.kernel.org/r/YG5xV5q7ODTUTVK/@kali
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-08 09:27:58 +02:00
Christophe JAILLET f179515da9 staging: rtl8712: Use constants from <linux/ieee80211.h>
Some constants defined in wifi.h are already defined in <linux/ieee80211.h>
with some other (but similar) names.
Be consistent and use the ones from <linux/ieee80211.h>.

The conversions made are:
_SSID_IE_                -->  WLAN_EID_SSID
_SUPPORTEDRATES_IE_      -->  WLAN_EID_SUPP_RATES
_DSSET_IE_               -->  WLAN_EID_DS_PARAMS
_IBSS_PARA_IE_           -->  WLAN_EID_IBSS_PARAMS
_ERPINFO_IE_             -->  WLAN_EID_ERP_INFO
_EXT_SUPPORTEDRATES_IE_  -->  WLAN_EID_EXT_SUPP_RATES

_HT_CAPABILITY_IE_       -->  WLAN_EID_HT_CAPABILITY
_HT_EXTRA_INFO_IE_       -->  WLAN_EID_HT_OPERATION    (not used)
_HT_ADD_INFO_IE_         -->  WLAN_EID_HT_OPERATION

_VENDOR_SPECIFIC_IE_     -->  WLAN_EID_VENDOR_SPECIFIC

_RESERVED47_             --> (not used)

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/fe35fb45323adc3a30f31b7280cec7700fd325d8.1617741313.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-07 10:19:12 +02:00
Zhansaya Bagdauletkyzy e91cafdf3c staging: rtl8712: Remove extra blank lines
Remove extra blank lines after an open brace to adhere to Linux kernel
coding style.
Reported by checkpatch.

Signed-off-by: Zhansaya Bagdauletkyzy <zhansayabagdaulet@gmail.com>
Link: https://lore.kernel.org/r/f61f6d330bc3fa53d4d420754d1d461b6cfcb2de.1617708653.git.zhansayabagdaulet@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-06 14:16:20 +02:00
Zhansaya Bagdauletkyzy b0a7b3aee5 staging: rtl8712: Rewrite NULL comparisons
Replace NULL comparisons with boolean negation to be more consistent with
the rest of the Linux kernel code base.
Reported by checkpatch.

Signed-off-by: Zhansaya Bagdauletkyzy <zhansayabagdaulet@gmail.com>
Link: https://lore.kernel.org/r/74471865b399584d73a18696d2008006301dfd71.1617708653.git.zhansayabagdaulet@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-06 14:16:20 +02:00
Beatriz Martins de Carvalho a11fbe6bf1 drivers: staging: rtl8712: align arguments with open parenthesis
Clean up checks of "Alignment should match open parenthesis"
in file mlme_osdep.h

Signed-off-by: Beatriz Martins de Carvalho <martinsdecarvalhobeatriz@gmail.com>
Link: https://lore.kernel.org/r/20210406105124.78498-1-martinsdecarvalhobeatriz@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-06 14:15:56 +02:00
Zhansaya Bagdauletkyzy 5e1e55bc78 staging: rtl8712: Remove spaces after a cast
Remove extra spaces after a cast to conform with Linux kernel coding
style.
Reported by checkpatch.

Signed-off-by: Zhansaya Bagdauletkyzy <zhansayabagdaulet@gmail.com>
Link: https://lore.kernel.org/r/f8932bfa35eb7480b69a9c8296bb10fac5a28540.1617697237.git.zhansayabagdaulet@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-06 14:15:40 +02:00
Zhansaya Bagdauletkyzy 431c052b6e staging: rtl8712: remove extra blank lines
Remove extra blank lines to conform with Linux kernel coding style.
Reported by checkpatch.

Signed-off-by: Zhansaya Bagdauletkyzy <zhansayabagdaulet@gmail.com>
Link: https://lore.kernel.org/r/0bf3df788ca46a59ebb990bf2e3effca7080fd1e.1617697237.git.zhansayabagdaulet@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-06 14:15:40 +02:00
Zhansaya Bagdauletkyzy 7b2ede0bde staging: rtl8712: match parentheses alignment
Match next line with open parentheses by adding tabs/spaces
to conform with Linux kernel coding style.
Reported by checkpatch.

Signed-off-by: Zhansaya Bagdauletkyzy <zhansayabagdaulet@gmail.com>
Link: https://lore.kernel.org/r/664f324330611a78e184a203ece38d4facc9d791.1617697237.git.zhansayabagdaulet@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-06 14:15:40 +02:00
Zhansaya Bagdauletkyzy 59184278ee staging: rtl8712: add spaces around operators
Add spaces around operators to adhere to Linux kernel coding style.
Reported by checkpatch.

Signed-off-by: Zhansaya Bagdauletkyzy <zhansayabagdaulet@gmail.com>
Link: https://lore.kernel.org/r/1fa63e851a6fa403798b95b64d9147c9b3b02c93.1617697237.git.zhansayabagdaulet@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-06 14:15:39 +02:00
Deborah Brouwer 5fd0241d66 staging: rtl8712: add space before binary operator
Add a space before the binary operator "|" to comply with kernel coding
style.  Identified by checkpatch.

Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com>
Link: https://lore.kernel.org/r/6db3ca92022376d162289174e201c79017b366db.1617674639.git.deborahbrouwer3563@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-06 14:14:48 +02:00
Deborah Brouwer fe6ed4e02b staging: rtl8712: remove space after cast
Remove the unnecessary space immediately after a cast. Identified by
checkpatch: CHECK: No space is necessary after a cast.

Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com>
Link: https://lore.kernel.org/r/b1ba94644f5204505623ffc64614671aac30bbd8.1617674639.git.deborahbrouwer3563@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-06 14:14:48 +02:00
Deborah Brouwer 483a0f6d9d staging: rtl8712: remove a blank line
A duplicate blank line is removed so that only a single blank line
separates two functions. Identified by checkpatch.

Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com>
Link: https://lore.kernel.org/r/81801604460c8cad8770cb2e1290e1587bf88075.1617674639.git.deborahbrouwer3563@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-06 14:14:48 +02:00
Deborah Brouwer cc7790d14f staging: rtl8712: add period within a comment
Add a period to separate repeated words in a comment. The period preserves
the meaning of the comment while also stopping the checkpatch warning:
WARNING: Possible repeated word: 'fw'.

Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com>
Link: https://lore.kernel.org/r/f9f48ac6e93e814c51a7ed370d0b2988d2e3a602.1617674639.git.deborahbrouwer3563@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-06 14:14:48 +02:00
Zhansaya Bagdauletkyzy c75afdaf2e staging: rtl8712: remove extra blank lines
Remove extra blank lines to adhere to Linux kernel coding style.
Reported by checkpatch.

Signed-off-by: Zhansaya Bagdauletkyzy <zhansayabagdaulet@gmail.com>
Link: https://lore.kernel.org/r/d56183614a04590bdf3a6280b7f23664a5bb394c.1617568354.git.zhansayabagdaulet@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-05 12:12:26 +02:00
Zhansaya Bagdauletkyzy 69c7ec3b2b staging: rtl8712: add blank lines after declarations
Add blank lines after function/struct/union/enum declarations to adhere to
Linux kernel coding style.
Reported by checkpatch.

Signed-off-by: Zhansaya Bagdauletkyzy <zhansayabagdaulet@gmail.com>
Link: https://lore.kernel.org/r/ffe2ab70ef3cb73d3d6dd19d88804af7ecb568a2.1617568354.git.zhansayabagdaulet@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-05 12:12:26 +02:00
Wan Jiabing 6f08cc6c2f drivers: staging: rtl8712: _adapter is declared twice
struct _adapter has been declared at 23rd line.
Remove the duplicate.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Link: https://lore.kernel.org/r/20210325080050.861273-1-wanjiabing@vivo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-26 14:59:33 +01:00
Lee Gibson 105949497a staging: rtl8712: Fix a possible NULL pointer dereference in function r8712_joinbss_event_callback
GCC 10 analyzer reports a warning: dereference of NULL
The function r8712_find_network can return NULL and is usually checked but
no check is present is this case.
Fix by adding the check.

Signed-off-by: Lee Gibson <leegib@gmail.com>
Link: https://lore.kernel.org/r/20210319085836.8259-1-leegib@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-20 13:40:15 +01:00
Greg Kroah-Hartman b828324bba Merge 5.12-rc3 into staging-next
We need the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-15 07:52:17 +01:00
Selvakumar Elangovan 7b2b5d27cb staging: rtl8712: fixed whitespace coding style issue
Removed additional whitespaces in the rtl8712_xmit.h file.

Signed-off-by: Selvakumar Elangovan <selvakumar16197@gmail.com>
Link: https://lore.kernel.org/r/20210309150037.17883-1-selvakumar16197@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-12 17:31:01 +01:00
Selvakumar Elangovan f6a4ac8fd2 staging: rtl8712: fixed no space coding style issue
Added space around the binary operator for readability in
rtl8712_xmit.h file

Signed-off-by: Selvakumar Elangovan <selvakumar16197@gmail.com>
Link: https://lore.kernel.org/r/20210309142547.16974-1-selvakumar16197@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-12 17:28:40 +01:00
Ivan Safonov 5fc95c4034 staging:rtl8712: replace cap_* definitions with native kernel WLAN_CAPABILITY_*
cap_* definitions duplicate WLAN_CAPABILITY_*. Remove cap_* definitions,
improve code consistency.

Reviewed-by: Mike Ximing Chen <mike.ximing.chen@intel.com>
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Link: https://lore.kernel.org/r/20210227222236.581490-5-insafonov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10 09:25:31 +01:00
Ivan Safonov e93aa38475 staging:rtl8712: use IEEE80211_FCTL_* kernel definitions
_TO_DS_, _FROM_DS_, _MORE_FRAG_, _RETRY_, _PWRMGT_, _MORE_DATA_,
_PRIVACY_, _ORDER_ definitions are duplicate IEEE80211_FCTL_*
kernel definitions.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Link: https://lore.kernel.org/r/20210227222236.581490-4-insafonov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10 09:25:31 +01:00
Ivan Safonov 99b83fd48d staging:rtl8712: remove unused definitions from wifi.h
These definitions are not used and will not be useful in the future.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Link: https://lore.kernel.org/r/20210227222236.581490-3-insafonov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10 09:25:31 +01:00
Ivan Safonov c198059ed7 staging:rtl8712: replace get_(d|s)a with ieee80211_get_(D|S)A
get_da()/get_sa() duplicate native ieee80211_get_(D|S)A functions.
Remove get_(d|s)a, use ieee80211_get_(D|S)A instead.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Link: https://lore.kernel.org/r/20210227222236.581490-2-insafonov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10 09:25:31 +01:00
Lee Gibson b93c1e3981 staging: rtl8712: Fix possible buffer overflow in r8712_sitesurvey_cmd
Function r8712_sitesurvey_cmd calls memcpy without checking the length.
A user could control that length and trigger a buffer overflow.
Fix by checking the length is within the maximum allowed size.

Signed-off-by: Lee Gibson <leegib@gmail.com>
Link: https://lore.kernel.org/r/20210301132648.420296-1-leegib@gmail.com
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10 09:23:28 +01:00
Dan Carpenter d660f4f42c staging: rtl8712: unterminated string leads to read overflow
The memdup_user() function does not necessarily return a NUL terminated
string so this can lead to a read overflow.  Switch from memdup_user()
to strndup_user() to fix this bug.

Fixes: c6dc001f2a ("staging: r8712u: Merging Realtek's latest (v2.6.6). Various fixes.")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YDYSR+1rj26NRhvb@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10 09:23:28 +01:00
Aakash Hemadri 6953026f21 staging: rtl8712: Remove multiple blank lines
Fix checkpatch.pl CHECK:
CHECK: Please don't use multiple blank lines

Signed-off-by: Aakash Hemadri <aakashhemadri123@gmail.com>
Link: https://lore.kernel.org/r/20210209153709.128676-1-aakashhemadri123@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-09 18:42:16 +01:00
Kumar Kartikeya Dwivedi f64e4ab3c2 staging: rtl8712: Switch from strlcpy to strscpy
strlcpy is marked as deprecated in Documentation/process/deprecated.rst,
and there is no functional difference when the caller expects truncation
(when not checking the return value). strscpy is relatively better as it
also avoids scanning the whole source string.

This silences the related checkpatch warnings from:
5dbdb2d87c ("checkpatch: prefer strscpy to strlcpy")

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20210131172838.146706-12-memxor@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-04 17:16:07 +01:00
Ivan Safonov d267cfb062 staging:rtl8712: remove unused enum WIFI_STATUS_CODE
Improve readability.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Link: https://lore.kernel.org/r/20210131080912.25264-1-insafonov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-31 13:37:52 +01:00
Dan Carpenter 29838144f2 staging: rtl8712: Fix enqueue_reorder_recvframe()
The logic of this function was accidentally broken by a checkpatch
inspired cleanup.  I've modified the code to restore the original
behavior and also make checkpatch happy.

Fixes: 98fe05e21a ("staging: rtl8712: Remove unnecesary else after return statement.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200929103548.GA493135@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-01 10:55:17 +02:00
Michael Straube 4ed7f05244 staging: rtl8712: use shorter array initializations
Use empty brace syntax to initialize zero valued arrays.
Simplifies and shortens the code a little bit.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20200919085032.32453-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-22 09:49:59 +02:00