summaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
AgeCommit message (Collapse)AuthorFilesLines
2022-04-22staging: rtl8192u: change get_key functions to return 0 instead of -1Rebecca Mckeever1-1/+1
Currently, these three get_key functions return -1 when the provided len value is less a specific key length value, which can result in buffer overflow depending on how the returned value is used. These functions are used in three places in ieee80211/ieee80211_wx.c: ieee80211_wx_get_encode() : The behavior of this function will be unchanged. ieee80211_wx_get_encode_ext() : The result of the get_key function is written to ext->key_len, resulting in a buffer overflow if the result is negative. ieee80211_wx_set_encode() : The behavior of this function will change. When len is less than the key length value, it will set a default key of all 0. Suggested-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com> Link: https://lore.kernel.org/r/Yl/7QPKXer7YtXOs@bertie Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-25staging: rtl8192u: rework init and exit functionTong Zhang1-1/+1
The init and exit functions are not releasing resource properly. An error can be observed when we load/unload/load r8192u_usb module due to this issue. This patch rework init and exit functions to do proper resource release on init error and module unload. The __exit attribute is stripped from some functions since they are now being used by module init functions. [ 493.068012] proc_dir_entry 'net/ieee80211' already registered [ 493.271973] proc_mkdir+0x18/0x20 [ 493.272136] ieee80211_debug_init+0x28/0xde8 [r8192u_usb] [ 493.272404] rtl8192_usb_module_init+0x10/0x161 [r8192u_usb] [ 13.910616] proc_dir_entry 'net/rtl819xU' already registered [ 13.918931] proc_mkdir+0x18/0x20 [ 13.919098] rtl8192_usb_module_init+0x142/0x16d [r8192u_usb] Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Tong Zhang <ztong0001@gmail.com> Link: https://lore.kernel.org/r/20220224064033.1530924-3-ztong0001@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-25mm: remove kzfree() compatibility definitionEric Biggers1-1/+1
Commit 453431a54934 ("mm, treewide: rename kzfree() to kfree_sensitive()") renamed kzfree() to kfree_sensitive(), but it left a compatibility definition of kzfree() to avoid being too disruptive. Since then a few more instances of kzfree() have slipped in. Just get rid of them and remove the compatibility definition once and for all. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-09-11staging/rtl8192u: switch to RC4 library interfaceArd Biesheuvel1-67/+14
Switch to the ARC4 library interface, to remove the pointless dependency on the skcipher API, from which we will hopefully be able to drop ecb(arc4) skcipher support. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2020-03-26Staging: rtl8192u: ieee80211: Use netdev_dbg() for debug messages.Sam Muhammed1-10/+9
Replace printk(KERN_DEBUG ...) with netdev_dbg() across the driver. since netdev_dbg() is preferable and specific for printing debug messages for network devices. Signed-off-by: Sam Muhammed <jane.pnx9@gmail.com> Link: https://lore.kernel.org/r/84dc7e33954509457efce2a35fb293e631845a96.1585233434.git.jane.pnx9@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-21staging: rtl8192u: fix spacing in ieee80211Stephen Brennan1-11/+11
Checkpatch emits several errors, warnings, and checks about spacing. Apply checkpatch's suggested spacing rules. Signed-off-by: Stephen Brennan <stephen@brennan.io> Link: https://lore.kernel.org/r/20190821143540.4501-4-stephen@brennan.io Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-07Merge tag 'staging-5.2-rc1' of ↵Linus Torvalds1-7/+3
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging / IIO driver updates from Greg KH: "Here is the big staging and iio driver update for 5.2-rc1. Lots of tiny fixes all over the staging and IIO driver trees here, along with some new IIO drivers. The "counter" subsystem was added in here as well, as it is needed by the IIO drivers and subsystem. Also we ended up deleting two drivers, making this pull request remove a few hundred thousand lines of code, always a nice thing to see. Both of the drivers removed have been replaced with "real" drivers in their various subsystem directories, and they will be coming to you from those locations during this merge window. There are some core vt/selection changes in here, that was due to some cleanups needed for the speakup fixes. Those have all been acked by the various subsystem maintainers (i.e. me), so those are ok. We also added a few new drivers, for some odd hardware, giving new developers plenty to work on with basic coding style cleanups to come in the near future. Other than that, nothing unusual here. All of these have been in linux-next for a while with no reported issues, other than an odd gcc warning for one of the new drivers that should be fixed up soon" [ I fixed up the warning myself - Linus ] * tag 'staging-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (663 commits) staging: kpc2000: kpc_spi: Fix build error for {read,write}q Staging: rtl8192e: Remove extra space before break statement Staging: rtl8192u: ieee80211: Fix if-else indentation warning Staging: rtl8192u: ieee80211: Fix indentation errors by removing extra spaces staging: most: cdev: fix chrdev_region leak in mod_exit staging: wlan-ng: Fix improper SPDX comment style staging: rtl8192u: ieee80211: Resolve ERROR reported by checkpatch staging: vc04_services: bcm2835-camera: Compress two lines into one line staging: rtl8723bs: core: Use !x in place of NULL comparison. staging: rtl8723bs: core: Prefer using the BIT Macro. staging: fieldbus: anybus-s: fix wait_for_completion_timeout return handling staging: kpc2000: fix up build problems with readq() staging: rtlwifi: move remaining phydm .h files staging: rtlwifi: strip down phydm .h files staging: rtlwifi: delete the staging driver staging: fieldbus: anybus-s: rename bus id field to avoid confusion staging: fieldbus: anybus-s: keep device bus id in bus endianness Staging: sm750fb: Change *array into *const array staging: rtl8192u: ieee80211: Fix spelling mistake staging: rtl8192u: ieee80211: Replace bit shifting with BIT macro ...
2019-04-25crypto: shash - remove shash_desc::flagsEric Biggers1-1/+0
The flags field in 'struct shash_desc' never actually does anything. The only ostensibly supported flag is CRYPTO_TFM_REQ_MAY_SLEEP. However, no shash algorithm ever sleeps, making this flag a no-op. With this being the case, inevitably some users who can't sleep wrongly pass MAY_SLEEP. These would all need to be fixed if any shash algorithm actually started sleeping. For example, the shash_ahash_*() functions, which wrap a shash algorithm with the ahash API, pass through MAY_SLEEP from the ahash API to the shash API. However, the shash functions are called under kmap_atomic(), so actually they're assumed to never sleep. Even if it turns out that some users do need preemption points while hashing large buffers, we could easily provide a helper function crypto_shash_update_large() which divides the data into smaller chunks and calls crypto_shash_update() and cond_resched() for each chunk. It's not necessary to have a flag in 'struct shash_desc', nor is it necessary to make individual shash algorithms aware of this at all. Therefore, remove shash_desc::flags, and document that the crypto_shash_*() functions can be called from any context. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2019-04-03staging: rtl8192u: add proper SPDX identifiers on files that did not have them.Greg Kroah-Hartman1-5/+1
There were a few files for the rtl8192u driver that did not have SPDX identifiers on them, so fix that up. At the same time, remove the "free form" text that specified the license of the file, as that is impossible for any tool to properly parse. Cc: John Whitmore <johnfwhitmore@gmail.com> Cc: Bhanusree Pola <bhanusreemahesh@gmail.com> Cc: Sanjana Sanikommu <sanjana99reddy99@gmail.com> Cc: Jia-Ju Bai <baijiaju1990@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-02staging: rtl8192u: ieee80211: ieee80211_crypt_tkip.c: Replace bit shifting ↵Payal Kshirsagar1-2/+2
with BIT macro Challenge suggested by coccinelle. Prefer using BIT and replace bit shifting with the BIT(x) macro. Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-28lib80211: Remove VLA usage of skcipherKees Cook1-18/+16
In the quest to remove all stack VLA usage from the kernel[1], this replaces struct crypto_skcipher and SKCIPHER_REQUEST_ON_STACK() usage with struct crypto_sync_skcipher and SYNC_SKCIPHER_REQUEST_ON_STACK(), which uses a fixed stack size. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com Cc: Johannes Berg <johannes@sipsolutions.net> Cc: linux-wireless@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2018-07-29staging: rtl8192u: ieee80211: Convert from ahash to shashKees Cook1-29/+28
This is an identical change to the wireless/lib80211 of the same name. In preparing to remove all stack VLA usage from the kernel[1], this removes the discouraged use of AHASH_REQUEST_ON_STACK in favor of the smaller SHASH_DESC_ON_STACK by converting from ahash-wrapped-shash to direct shash. By removing a layer of indirection this both improves performance and reduces stack usage. The stack allocation will be made a fixed size in a later patch to the crypto subsystem. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23staging: rtl8192u: Replace GFP_ATOMIC with GFP_KERNEL in ieee80211_tkip_initJia-Ju Bai1-1/+1
ieee80211_tkip_init() is never called in atomic context. ieee80211_tkip_init() is only set as ".init" in struct ieee80211_crypto_ops. The call chains ending up at "->init" function are: [1] ->init() <- ieee80211_wpa_set_encryption() <- ieee80211_wpa_supplicant_ioctl() [2] ->init() <- ieee80211_wx_set_encode_ext_rsl() <- r8192_wx_set_enc_ext() [3] ->init() <- ieee80211_wx_set_encode_rsl() <- r8192_wx_set_enc() ieee80211_wpa_supplicant_ioctl(), r8192_wx_set_enc_ext() and r8192_wx_set_enc() call mutex_lock(), which indicates these functions are not called in atomic context. Despite never getting called from atomic context, ieee80211_tkip_init() calls kzalloc() with GFP_ATOMIC, which does not sleep for allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, which can sleep and improve the possibility of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15staging: rtl8192u: Fix type mismatch warnings reported by sparseSuniel Mahesh1-17/+10
Mk16_le() is an inline function returning le16_to_cpu() which is causing type mismatch warnings. Removed Mk16_le() and replaced it with le16_to_cpu() with appropriate argument type as suggested by Greg K-H. Signed-off-by: Suniel Mahesh <suniel.spartan@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09staging: rtl8192u: Clean up tests if NULL returned on failuresimran singhal1-1/+1
Some functions like kmalloc/kzalloc return NULL on failure. When NULL represents failure, !x is commonly used. This was done using Coccinelle: @@ expression *e; identifier l1; @@ e = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\)(...); ... - e == NULL + !e Signed-off-by: simran singhal <singhalsimran0@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-12staging: rtl8192u: Fixing no new typedef warningsimran singhal1-2/+2
This patch fixes following checkpatch.pl warnings: WARNING:do not add new typedefs. All the related files have been modified. Signed-off-by: simran singhal <singhalsimran0@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-25staging: rtl8192x: fix bogus maybe-uninitialized warningArnd Bergmann1-1/+1
The rtllib_rx_extract_addr() is supposed to set up the mac addresses for four possible cases, based on two bits of input data. For some reason, gcc decides that it's possible that none of the these four cases apply and the addresses remain uninitialized: drivers/staging/rtl8192e/rtllib_rx.c: In function ‘rtllib_rx_InfraAdhoc’: include/linux/etherdevice.h:316:61: error: ‘*((void *)&dst+4)’ may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/staging/rtl8192e/rtllib_rx.c:1318:5: note: ‘*((void *)&dst+4)’ was declared here ded from /git/arm-soc/drivers/staging/rtl8192e/rtllib_rx.c:40:0: include/linux/etherdevice.h:316:36: error: ‘dst’ may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/staging/rtl8192e/rtllib_rx.c:1318:5: note: ‘dst’ was declared here This warning is clearly nonsense, but changing the last case into 'default' makes it obvious to the compiler too, which avoids the warning and probably leads to better object code too. As the same warning appears in other files that have the exact same code, I'm fixing it in both rtl8192e and rtl8192u, even though I did not observe it for the latter. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-27staging: rtl8192u: Use skcipher and ahashHerbert Xu1-41/+51
This patch replaces uses of blkcipher with skcipher, and the long obsolete hash interface with ahash. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-29Staging: rtl8192u: ieee80211: added missing blank linesKurt Kanzenbach1-0/+5
This patch resolves the following checkpatch warnings: - WARNING: Missing a blank line after declarations Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-29Staging: rtl8192u: ieee80211: removed unnecessary bracesKurt Kanzenbach1-4/+2
This patch fixes the following checkpatch warning: - WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-29Staging: rtl8192u: ieee80211: corrected block commentsKurt Kanzenbach1-10/+21
This patch reformats some block comments in order to match the Linux kernel coding style. Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-29Staging: rtl8192u: ieee80211: corrected indentKurt Kanzenbach1-5/+5
This patch corrects the indentation in five instances in the ieee80211_crypt_tkip.c file. Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-29Staging: rtl8192u: ieee80211: added missing spaces after ifKurt Kanzenbach1-2/+2
This patch fixes the following checkpatch error: - ERROR: space required before the open parenthesis '(' Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-29Staging: rtl8192u: ieee80211: added missing space around '='Kurt Kanzenbach1-1/+1
This patch fixes the following checkpatch error: - ERROR: spaces required around that '=' Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-29Staging: rtl8192u: ieee80211: fixed position of else statementsKurt Kanzenbach1-4/+2
This patch fixes the following checkpatch error: - ERROR: else should follow close brace '}' Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-29Staging: rtl8192u: ieee80211: fixed open brace positionsKurt Kanzenbach1-12/+6
This patch fixes the following checkpatch error: - ERROR: that open brace { should be on the previous line Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-08rtl8192u: don't trample on <linux/ieee80211.h> struct namespacePaul Gortmaker1-13/+13
In order to start reducing the duplicated code/constants/macros in this driver, we need to include <linux/ieee80211.h> to provide the defacto versions. However this driver has structs with the same name as the ones in the main include, so namespace collision prevents us from doing step #1. Since the structs actually differ in their respective fields, we can't simply delete the local ones without impacting the runtime; a conversion to use the global ones can be considered at a later date if desired. Rename the ones here with a vendor specific prefix so that we won't have the namespace collision, and hence can continue on with the cleanup. Automated conversion done with: for i in `find . -name '*.[ch]'` ; do \ sed -i 's/struct ieee80211_hdr/struct rtl_80211_hdr/g' $i ; \ done Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-09Staging: rtl8192u: Added #include <linux/string.h> instead of <asm/string.h>Dilek Uzulmez1-1/+1
The following patch fixes the checkpatch.pl warning: WARNING: Use #include <linux/string.h> instead of #include <asm/string.h> Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26staging: rtl8192u: Remove commented header.Navya Sri Nizamkari1-1/+0
This patch removes the commented header <linux/config.h> as it is not used in modern linux systems. Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-25staging: Convert __FUNCTION__ to __func__Joe Perches1-1/+1
Use the normal mechanism for emitting a function name. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-13STAGING: rtl8192u/ieee80211: fix checkpatch error about pointer position in ↵Xenia Ragiadakou1-4/+4
ieee80211_crypt_tkip.c This patch fixes the pointer position in ieee80211_crypt_tkip.c to meet the kernel coding style conventions. Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2011-07-05Remove unneeded version.h includes from drivers/staging/rtl*/Jesper Juhl1-1/+0
It was pointed out by 'make versioncheck' that some includes of linux/version.h are not needed in drivers/staging/rtl8187se/, drivers/staging/rtl8192e/, drivers/staging/rtl8192u/ & drivers/staging/rtl8712/. This patch removes them. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-14Staging: Use kcalloc or kzallocJulia Lawall1-2/+1
Use kcalloc or kzalloc rather than the combination of kmalloc and memset. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression x,y,flags; statement S; type T; @@ x = - kmalloc + kcalloc ( - y * sizeof(T), + y, sizeof(T), flags); if (x == NULL) S -memset(x, 0, y * sizeof(T)); @@ expression x,size,flags; statement S; @@ -x = kmalloc(size,flags); +x = kzalloc(size,flags); if (x == NULL) S -memset(x, 0, size); // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk>
2010-03-03Staging: rtl8187x: Use %pM for mac address outputJoe Perches1-10/+10
Uncompiled. Doesn't currently build anyway. Converted MAC_FMT to %pM Converted some %02x%02x%02x%02x%02x%02x to %pm Converted MAC_ARG to direct use Removed MAC_FMT and MAC_ARG macros Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-12-11Staging: rtl8192u: remove bad whitespacesMauro Carvalho Chehab1-20/+20
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-12-11Staging: rtl8192u: make it compileMauro Carvalho Chehab1-263/+9
Add it to staging Kbuild and fixes some API differences that prevents compilation. It seems that the ieee80211 stack is very close to rtl8192su one. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-12-11Staging: Added Realtek rtl8192u driver to stagingJerry Chuang1-0/+1034
Add Realtek linux driver for rtl8192u as provided by Realtek rtl8192u_linux_2.6.0006.1031.2008.tar.gz, send to me C/C staging ML. This version won't compile against upstream, doesn't follow Linux CodingStyle and has their own ieee80211 stack. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>