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>
The vt6656 is prone to resetting on the usb bus.
It seems there is a race condition and wpa supplicant is
trying to open the device via iw_handlers before its actually
closed at a stage that the buffers are being removed.
The device is longer considered open when the
buffers are being removed. So move ~DEVICE_FLAGS_OPENED
flag to before freeing the device buffers.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
There seems to be race condition that the device is ndo_start_xmit
at a point where the device is closing and apTD is NULL resulting
in dead lock.
Add a NULL check to apTD and return NULL to calling functions.
This is more likely on 64 bit systems.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The indentation in the swGetOFDMControlRate function is screwed up.
At first it appears that there are missing braces on a multi-line if, but
looking at history, commit dd0a774fc7
("staging: vt6656: card/main_usb/device use new structure names")
incorrectly indented the two lines below.
Signed-off-by: Dave Jones <davej@fedoraproject.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sparse warnings: (new ones prefixed by >>)
...
>> drivers/staging/vt6656/baseband.c:877:26: sparse: incorrect type in assignment (different base types)
drivers/staging/vt6656/baseband.c:877:26: expected unsigned short [unsigned] [usertype] len
drivers/staging/vt6656/baseband.c:877:26: got restricted __le16 [usertype] <noident>
>> drivers/staging/vt6656/baseband.c:880:26: sparse: incorrect type in assignment (different base types)
drivers/staging/vt6656/baseband.c:880:26: expected unsigned short [unsigned] [usertype] len
drivers/staging/vt6656/baseband.c:880:26: got restricted __le16 [usertype] <noident>
vnt_phy_field member len should be __le16.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: kbuild-all@01.org
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Move
s_vFillRTSHead union vnt_tx_data_head to void *pvRTS argument.
s_vFillCTSHead union vnt_tx_data_head to void *pvCTS argument.
In s_vGenerateTxParameter create union vnt_tx_data_head
pointing to rts_cts;
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
As result of patch
rxtx.c s_vGenerateTxParameter create argument bool need rts
RTS and CTS void pointers can be merged.
Create new pointer rts_cts so that unions in s_vFillCTSHead/s_vFillRTSHead
can be joined.
If rts_cts is NULL neither exist.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Allow conditional statements to be based on true/false instead of
NULL or not pointer pvRTS.
Harmonise all call functions will bool type.
If need_rts is true then rts is needed.
If need_rts is false then
cts is needed only when byPktType == PK_TYPE_11GB || PK_TYPE_11GA.
none no rts/cts other byPktTypes.
This allow the joining of pointers pvRTS/pvCTS in to single pointer.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Only one of vnt_rts*/vnt_cts* structures are accessed at any one time.
structures vnt_cts and vnt_cts_fb are members of union vnt_tx_data_head.
Create pointer union head and point structures to the correct member.
Point the union to pvCTS.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
s_vFillCTSHead is only called when byPktType == PK_TYPE_11GB ||
byPktType == PK_TYPE_11GA so remove unnecessary if on byPktType.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
byFBOption == AUTO_FB_NONE (0) is the same as PK_TYPE_11B
Reverse if condition to break and allow fall through.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Allowing fall through where necessary.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Only one of vnt_rts*/vnt_cts* structures are accessed at any one time.
Join these structures in to a single union.
These will eventually form the tail structure of vnt_tx_buffer and
include structures vnt_tx_datahead*
Structures in s_vFillCTSHead will join in next patch series.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Parse out vnt_rts_a_fb code to new function vnt_rxtx_rts_a_fb_head.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Parse out vnt_rts_ab code to new function vnt_rxtx_rts_ab_head.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Parse out vnt_rts_g_fb code to new function vnt_rxtx_rts_g_fb_head.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Parse out vnt_rts_g code to new function vnt_rxtx_rts_g_head.
Also create a new common calling function vnt_fill_ieee80211_rts
to fill the ieee80211_rts structure.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
If pvRrvTime is NULL the whole structure is NULL, so
remove if statements and consolidate to single return.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
As result of patch
vt6656: rxtx.c s_vFillCTSHead remove dead code bDisCRC
bDisCRC is unused.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
As result of patch
vt6656: device.h Remove dead code bSoftwareGenCrcErr.
dDiscCRC is unused.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
As result of patch
vt6656: device.h Remove dead code bSoftwareGenCrcErr.
dDiscCRC is unused.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Probably an error in earlier firmware is never enabled so remove.
bPacketToWirelessUsb remove dead if/else and variables.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Replace the pointer offsets with structure of mic_hdr with
endian conversion where needed.
Replace vFillTxKey argument u8 *pMICHDR with struct vnt_mic_hdr *mic_hdr
and fix type of calling functions.
An extra check that mic_hdr is not NULL
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
wTimeStampOff needs to be endian corrected
Create new function vnt_time_stamp_off to return little endian u16 value.
Private variable byPreambleType is common to all calling functions is included.
variable rate to set the desired rate.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
We can't endian correct uGetTxRsvTime because it is called by other functions.
Create new function to vnt_rxtx_rsvtime_le16 to return little endian u16
value.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
When byDurType == DATADUR_B then byPktType == PK_TYPE_11B
Drop argument byDurType and filter on byPktType == PK_TYPE_11B.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The return always be u16 endian corrected. For the
large part this is missing.
Fix uGetDataDuration to return u16 endian corrected.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Create single packed structure vnt_phy_field for rxtx.h structures.
In card.c CARDvSetRSPINF a vnt_phy_field replaces abyServ,
abySignal, awLen variables.
In rxtx.c point BBvCalculateParameter to relevant field.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In rxtx.c many calls to BBvCaculateParameter are not endian
corrected all calls here need to be endian corrected.
Correct the endian in BBvCaculateParameter.
In card.c: CARDvSetRSPINF pwPhyLen points to awLen and is
manually applied to abyData. Because it is now endian
corrected put_unaligned is needed to correct it.
In rxtx.c remove were endian is corrected.
This allows to merge BBvCalculateParameter *pwPhyLen,*pbyPhySrv
and *pbyPhySgn to singles structure for tx buffers.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Both TYPE_ATIMDMA/TYPE_BEACONDMA are not used in driver for the value of uDMAIdx.
Remove dead code.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To new structure.
typedef struct tagSTxDataHead_a_FB -> struct vnt_tx_datahead_a_fb
This is only needed by rxtc.c so moved to rxtx.h visible to
vnt_rts* structures which it will eventually form part of
their structure.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To new structure.
typedef struct tagSTxDataHead_ab -> struct vnt_tx_datahead_ab
This is only needed by rxtc.c so moved to rxtx.h visible to
vnt_rts* structures which it will eventually form part of
their structure.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To new structure.
typedef struct tagSTxDataHead_g_FB -> struct vnt_tx_datahead_g_fb
This is only needed by rxtc.c so moved to rxtx.h visible to
vnt_rts*/vnt_cts* structures which it will eventually form part of
their structure.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To new structure.
typedef struct tagSTxDataHead_g -> struct vnt_tx_datahead_g
This is only needed by rxtc.c so moved to rxtx.h visible to
vnt_rts*/vnt_cts* structures which it will eventually form part of
their structure.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To new structure.
typedef struct tagSRrvTime_ab -> struct vnt_rrv_time_ab
This is only needed by rxtc.c so moved to rxtx.h and
will eventually form part of the structure of
struct vnt_tx_buffer.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To new structure.
typedef struct tagSRrvTime_gCTS -> struct vnt_rrv_time_cts
This is only needed by rxtc.c so moved to rxtx.h and
will eventually form part of the structure of
struct vnt_tx_buffer.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To new structure.
typedef struct tagSRrvTime_gRTS -> struct vnt_rrv_time_rts
This is only needed by rxtc.c so moved to rxtx.h and
will eventually form part of the structure of
struct vnt_tx_buffer.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The new structures being
typedef struct tagSCTS -> struct vnt_cts
typedef struct tagSCTS_FB -> struct vnt_cts_fb
These are only needed by rxtc.c so moved to rxtx.h and
will eventually form part of the structure of
struct vnt_tx_buffer.
The linux/ieee80211.h in desc.h is no longer needed.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The new structures being
typedef struct tagSRTS_g -> struct vnt_rts_g
typedef struct tagSRTS_g_FB -> struct vnt_rts_g_fb
typedef struct tagSRTS_ab -> struct vnt_rts_ab
typedef struct tagSRTS_a_FB -> struct vnt_rts_a_fb
These are only needed by rxtc.c so moved to rxtx.h and
will eventually form part of the structure of
struct vnt_tx_buffer.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Move vnt_tx_buffer *pTxBufHead to argument u8 *usbPacketBuf position.
Fix the calling to s_bPacketToWirelessUsb so it attached to
the calling struct vnt_tx_buffer pTX_Buffer.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>