History log of /linux-master/drivers/staging/rtl8712/xmit_linux.c
Revision Date Author Comments
# ac836312 13-Jul-2023 Larry Finger <Larry.Finger@lwfinger.net>

staging: r8712: Fix memory leak in _r8712_init_xmit_priv()

In the above mentioned routine, memory is allocated in several places.
If the first succeeds and a later one fails, the routine will leak memory.
This patch fixes commit 2865d42c78a9 ("staging: r8712u: Add the new driver
to the mainline kernel"). A potential memory leak in
r8712_xmit_resource_alloc() is also addressed.

Fixes: 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel")
Reported-by: syzbot+cf71097ffb6755df8251@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/x/log.txt?x=11ac3fa0a80000
Cc: stable@vger.kernel.org
Cc: Nam Cao <namcaov@gmail.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Reviewed-by: Nam Cao <namcaov@gmail.com>
Link: https://lore.kernel.org/r/20230714175417.18578-1-Larry.Finger@lwfinger.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 307d3436 05-Sep-2022 GUO Zihua <guozihua@huawei.com>

staging: rtl8712: Fix return type for implementation of ndo_start_xmit

CFI (Control Flow Integrity) is a safety feature allowing the system to
detect and react should a potential control flow hijacking occurs. In
particular, the Forward-Edge CFI protects indirect function calls by
ensuring the prototype of function that is actually called matches the
definition of the function hook.

Since Linux now supports CFI, it will be a good idea to fix mismatched
return type for implementation of hooks. Otherwise this would get
cought out by CFI and cause a panic.

Use enums from netdev_tx_t as return value instead, then change return
type to netdev_tx_t.

Signed-off-by: GUO Zihua <guozihua@huawei.com>
Link: https://lore.kernel.org/r/20220905130230.11230-1-guozihua@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b863ce8c 04-Sep-2022 Asif Khan <asif.kgauri@gmail.com>

staging: rtl8712: fix camelcase in UserPriority

Replace camelcase variable UserPriority with snake case
variable user_priority.

Signed-off-by: Asif Khan <asif.kgauri@gmail.com>
Link: https://lore.kernel.org/r/20220904192400.8309-1-asif.kgauri@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a3515f20 22-Mar-2022 Sathish Kumar <skumark1902@gmail.com>

staging: rtl8712: Use completions for signaling

r8712_sitesurvey_cmd() uses a variable to notify r8712_SetFilter() that it
has completed operation. There is no sort of assurance that the variable will
actually change and it could cache the value the first time it is read and
then never update it for the whole loop logic.

Use completion variables because they are better suited for the purpose.

This patch fixes the checkpatch.pl warnings like:
CHECK: Avoid CamelCase: <blnEnableRxFF0Filter>
+ u8 blnEnableRxFF0Filter;

Reviewed-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Sathish Kumar <skumark1902@gmail.com>
Link: https://lore.kernel.org/r/20220323045515.2513-1-skumark1902@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 939ef169 21-May-2021 Hriday Hegde <hridayhegde1999@gmail.com>

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>


# b013c5b8 08-Aug-2019 Nishka Dasgupta <nishkadg.linux@gmail.com>

staging: rtl8712: r8712_update_attrib(): Change return values and type

Change return values of r8712_update_attrib from _SUCCESS and _FAIL to 0
and -ENOMEM or -EINVAL respectively. Modify call site to check for the
new failure conditions. Also modify the return type from sint to int.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Link: https://lore.kernel.org/r/20190809052353.5308-2-nishkadg.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a4898e78 26-Jun-2019 Nishka Dasgupta <nishkadg.linux@gmail.com>

staging: rtl8712: r8712_xmit_resource_alloc(): Change return values

Change call site of function r8712_xmit_resource_alloc to add a check
for its return value.
Change return values of r8712_xmit_resource_alloc from
_SUCCESS/_FAIL to 0/-ENOMEM.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8810493f 11-Jun-2019 Deepak Mishra <linux.dkm@gmail.com>

staging: rtl8712: Fixed CamelCase wkFilterRxFF0 renamed to wk_filter_rx_ff0

In process of cleaning up struct _adapter in drv_types.h, wkFilterRxFF0
is renamed to to wk_filter_rx_ff0 to fix a checkpatch reported issue.

Signed-off-by: Deepak Mishra <linux.dkm@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6cc6677a 11-Jun-2019 Deepak Mishra <linux.dkm@gmail.com>

staging: rtl8712: Fixed CamelCase lockRxFF0Filter renamed to lock_rx_ff0_filter

In process of cleaning up struct _adapter in drv_types.h, lockRxFF0Filter
is renamed to to lock_rx_ff0_filter to fix a checkpatch reported issue.

Signed-off-by: Deepak Mishra <linux.dkm@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3f35d902 06-Jun-2019 Nishka Dasgupta <nishkadg.linux@gmail.com>

staging: rtl8712: xmit_linux.c: Remove leading p from variable names

Remove leading p from the names of the following pointer variables:
- padapter
- pxmitpriv
- pnetdev
- pxmitframe.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e24c1f86 03-Oct-2018 Michael Straube <straube.linux@gmail.com>

staging: rtl8712: add SPDX identifiers

This satisfies a checkpatch warning and is the preferred
method for notating the license.

The SPDX identifier is a legally binding shorthand, which
can be used instead of the full boiler plate text.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 580b4105 03-Jun-2016 Larry Finger <Larry.Finger@lwfinger.net>

staging: r8712u: Handle some false positives from kmemleak

When this driver preallocates some URBs, kmemleak is unable to find that
allocated memory when it scans. When the driver is unloaded, that memory
is reclaimed, therefore, the report is a false positive.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# af07477f 27-Jun-2016 Anuradha Weeraman <anuradha@weeraman.com>

Staging: rtl8712: Fixed brace and comment style issue

Fixed issues with coding style.

Signed-off-by: Anuradha Weeraman <anuradha@weeraman.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 40430f0c 25-Feb-2016 Bhaktipriya Shridhar <bhaktipriya96@gmail.com>

staging: rtl8712: Make return of 0 explicit

Delete unnecessary local variable whose value is always 0 and
return 0 as the result.

The following Coccinelle script was used:

@@
identifier ret; expression E;
type T;
@@
(
- T ret;
|
- T ret = 0;
)

... when != \(ret=E
\|ret--\|ret++\|--ret\|++ret\|ret-=E\|ret+=E\|ret|=E\|ret&=E\)
(
?-ret = 0;
)
... when != \(ret=E
\|ret--\|ret++\|--ret\|++ret\|ret-=E\|ret+=E\|ret|=E\|ret&=E\)
(
return
- ret
+ 0
;
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6e4eb869 22-Feb-2016 Bhaktipriya Shridhar <bhaktipriya96@gmail.com>

staging: rtl8712: Simplify return

Simplified the multiline check to a single return statement.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7cb07dc4 18-Feb-2016 Bhaktipriya Shridhar <bhaktipriya96@gmail.com>

staging: rtl8712: Replace explicit NULL comparison

Replace explicit NULL comparison with ! operator.
Found with Coccinelle.

@@
expression e;
@@
- e == NULL
+ !e

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1ca96884 19-Oct-2015 Luis de Bethencourt <luisbg@osg.samsung.com>

staging: rtl8712: Remove boolean comparisons

Boolean tests do not need explicit comparison to true or false.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8f47c28b 29-Mar-2015 Julia Lawall <Julia.Lawall@lip6.fr>

staging: rtl8712: Drop unneeded cast on netdev_priv

The result of netdev_priv is already implicitly cast to the type of the
left side of the assignment.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
T *x;
@@

x =
- (T *)
netdev_priv(...)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e29d3ebc 27-Oct-2014 Sudip Mukherjee <sudipm.mukherjee@gmail.com>

staging: rtl8712: remove unused variables

unused variables are removed. These variables were only assigned some
values and after that they were never being used. So they are safe to
be removed , and it has been build tested.

I left a call to r8712_read32(padapter, TCR) and
r8712_read8(padapter, SDIO_HCPWM) .

r8712_read32() and r8712_read8() is ultimately calling usb_read32()
and usb_read8() respectively. and they are again calling
r8712_usbctrl_vendorreq().
this r8712_usbctrl_vendorreq() is communicating through the usb bus
and is sending and receiving the control msg.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 77e73e8c 01-Oct-2013 Thomas Cort <linuxgeek@gmail.com>

Staging: rtl8712: fix spaces before semicolons

Resolve all of the 'WARNING: space prohibited before semicolon'
checkpatch warnings for rtl8712.

Signed-off-by: Thomas Cort <linuxgeek@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 87a573ad 10-Dec-2012 Przemo Firszt <przemo@firszt.eu>

rtl8712: replace printk with better solutions

Replace printk with netdev_printk helpers, dev_printk helpers or
pr_err/warn/info if there is no device info available.

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9a0fbbb5 09-May-2012 Paul Gortmaker <paul.gortmaker@windriver.com>

staging: delete all duplicated endian crap from rtl8712 driver

This driver had headers like big_endian.h, little_endian.h, swab.h
and yet we can throw them all in the trash can and the thing
still builds on x86-64 and ppc, just by deleting the references
to the deleted files.

Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>


# 20467825 09-May-2012 Paul Gortmaker <paul.gortmaker@windriver.com>

staging: wean rtl8712 off of its ancient duplicate of ip.h

This driver should not be carrying around ancient copies of
headers like <linux/ip.h> for its own use. Mapping it onto
the mainline one uncovers no build issues.

Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>


# be9a1204 09-May-2012 Paul Gortmaker <paul.gortmaker@windriver.com>

staging: wean rtl8712 off of its ancient duplicate of if_ether.h

This driver should not be carrying around ancient copies of
headers like <linux/if_ether.h> for its own use. Mapping it
onto the mainline one uncovers no build issues.

Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>


# f95302ee 03-Sep-2011 Ali Bahar <ali@internetdog.org>

staging: r8712u: Merging Realtek's latest (v2.6.6). tx: NULL _in_ spin lock.

In transmit path, r8712_free_xmitframe(), the pkt pointer is now
NULLed _within_ the spin lock.

Signed-off-by: Ali Bahar <ali@internetDog.org>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 359140aa 03-Sep-2011 Ali Bahar <ali@internetdog.org>

staging: r8712u: Merging Realtek's latest (v2.6.6). Updated include directives.

These are the new include directives for header files.
The following were (somehow!) not explicity in Realtek's, but proved necessary:
"linux/usb.h" is needed for usb_alloc_urb();
"linux/interrupt.h" is needed for tasklet_struct. It was often a nested
include.

Signed-off-by: Ali Bahar <ali@internetDog.org>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 68e9b249 03-Sep-2011 Ali Bahar <ali@internetdog.org>

staging: r8712u: Merging Realtek's latest (v2.6.6). Removed _usb_alloc_urb.

Replaced (Realtek's) _usb_alloc_urb by (linux's own) usb_alloc_urb.

Signed-off-by: Ali Bahar <ali@internetDog.org>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 7c1f4203 03-Sep-2011 Ali Bahar <ali@internetdog.org>

staging: r8712u: Merging Realtek's latest (v2.6.6). Renamed _netdev_priv.

Renamed _netdev_priv to netdev_priv.

Signed-off-by: Ali Bahar <ali@internetDog.org>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 2865d42c 20-Aug-2010 Larry Finger <Larry.Finger@lwfinger.net>

staging: r8712u: Add the new driver to the mainline kernel

This code is for a completely new version of the Realtek 8192 USB devices
such as the D-Link DWA-130. The Realtek code, which was originally for
Linux, Windows XP and Windows CE, has been stripped of all code not needed
for Linux. In addition, only one additional configuration variable, which
enables AP mode, remains.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Tested-by: Frederic Leroy <fredo@starox.org>