w35und: fixed nasty stack overflow, I can actually ssh over this
Subsystems (2)
Removed nasty stack overflow, and got transmit of big packets to work. I can now actually do ssh over softmac-based driver.
Unindent code to make it more readable.
---
commit 0cfb0fd5cde408c154de69fa1c5521d5288ca506
tree 2814afd5b2b385bd3885c2095e94f03ca7dd8e20
parent 5b251c6315097d5f9ab5d30c43813fe74c1db4e4
author Pavel <[email protected]> Mon, 05 May 2008 22:40:29 +0200 committer Pavel <[email protected]> Mon, 05 May 2008 22:40:29 +0200
arch/x86/kernel/traps_32.c | 5 + .../wireless/winbond/winbondport/linux/wb35tx.c | 19 +- .../net/wireless/winbond/winbondport/linux/wbusb.c | 8 + drivers/net/wireless/winbond/winbondport/mds.c | 192 ++++++++++---------- .../net/wireless/winbond/winbondport/mlmetxrx.c | 12 + 5 files changed, 118 insertions(+), 118 deletions(-)
arch/x86/kernel/traps_32.c +5 -0
@@ -146,11 +146,16 @@ static inline unsigned long print_contex unsigned long *stack, unsigned long bp, const struct stacktrace_ops *ops, void *data) { + int max = 5;struct stack_frame *frame = (struct stack_frame *)bp;while (valid_stack_ptr (tinfo, stack,sizeof (*stack))) {unsigned long addr; +if (!max) +return ; + max--; + addr = *stack;if (__kernel_text_address (addr)) {if ((unsigned long ) stack == bp +4 ) {
drivers/net/wireless/winbond/winbondport/linux/wb35tx.c +6 -13
@@ -67,15 +67,13 @@ void Wb35Tx(phw_data_t pHwData) pWb35Tx->EP4vm_state =VM_RUNNING ; retv =wb_usb_submit_urb ( pUrb );if (retv<0 ) { -#ifdef _PE_TX_DUMP_ -WBDEBUG (("EP4 Tx Irp sending error\n" )); -#endif +printk ("EP4 Tx Irp sending error\n" ); goto cleanup; }// Check if driver needs issue Irp for EP2 pWb35Tx->TxFillCount += pMds->TxCountInBuffer[SendIndex]; -if ( pWb35Tx->TxFillCount >12 )// Fixed to 12. 20060928 +if (pWb35Tx->TxFillCount >12 )Wb35Tx_EP2VM_start ( pHwData ); pWb35Tx->ByteTransfer += pMds->TxBufferSize[SendIndex];
@@ -96,13 +94,12 @@ void Wb35Tx_complete(struct urb * pUrb)// Variable setting pWb35Tx->EP4vm_state =VM_COMPLETED ; - pWb35Tx->EP4VM_status = pUrb->status;//Store the last result of Irp + pWb35Tx->EP4VM_status = pUrb->status;//Store the last result of Irp pMds->TxOwner[ pWb35Tx->TxSendIndex ] =0 ;// Set the owner. Free the owner bit always. pWb35Tx->TxSendIndex++; pWb35Tx->TxSendIndex %=MAX_USB_TX_BUFFER_NUMBER ; - do - { + do { if (pHwData->SurpriseRemove || pHwData->HwStop) // Let WbWlanHalt to handle surprise remove break;
@@ -111,15 +108,11 @@ void Wb35Tx_complete(struct urb * pUrb)// The URB is completed, check the result if (pWb35Tx->EP4VM_status !=0 ) { -#ifdef _PE_USB_STATE_DUMP_ -WBDEBUG (("EP4 IoCompleteRoutine return error\n" )); -DebugUsbdStatusInformation ( pWb35Tx->EP4VM_status ); -#endif +printk ("URB submission failed\n" ); pWb35Tx->EP4vm_state =VM_STOP ;break ;// Exit while(FALSE); } -// Do the next send Mds_Tx (Adapter);Wb35Tx (pHwData);return ;
@@ -131,7 +124,7 @@ void Wb35Tx_complete(struct urb * pUrb)void Wb35Tx_reset_descriptor (phw_data_t pHwData ) { -PWB35TX pWb35Tx = &pHwData->Wb35Tx; +PWB35TX pWb35Tx = &pHwData->Wb35Tx; pWb35Tx->TxSendIndex =0 ; pWb35Tx->tx_halt =0 ;
drivers/net/wireless/winbond/winbondport/linux/wbusb.c +6 -2
@@ -113,7 +113,9 @@ static void wbsoft_configure_filter(strustatic int wbsoft_tx (struct ieee80211_hw *dev,struct sk_buff *skb,struct ieee80211_tx_control *control) { -if (1 ==MLMESendFrame (my_adapter, skb->data, skb->len,FRAME_TYPE_802_11_MANAGEMENT )) +char *buffer =kmalloc (skb->len,GFP_ATOMIC ); +memcpy (buffer, skb->data, skb->len); +if (1 ==MLMESendFrame (my_adapter, buffer, skb->len,FRAME_TYPE_802_11_MANAGEMENT ))printk ("frame sent ok?\n" );return NETDEV_TX_OK ; }
@@ -330,8 +332,10 @@ void packet_came(char *pRxBufferAddress,return ; skb =dev_alloc_skb (PacketSize); -if (!skb) +if (!skb) {printk ("Not enough memory for packet, FIXME\n" ); +return ; + } memcpy(skb_put(skb, PacketSize), pRxBufferAddress,
drivers/net/wireless/winbond/winbondport/mds.c +96 -96
222 lines not on this page · raw message
drivers/net/wireless/winbond/winbondport/mlmetxrx.c +5 -7
@@ -75,8 +75,8 @@ u8 MLMESendFrame(PWB32_ADAPTER Adapter,/* DataType : FRAME_TYPE_802_11_MANAGEMENT, FRAME_TYPE_802_11_MANAGEMENT_CHALLENGE, FRAME_TYPE_802_11_DATA */ { -if ( Adapter->sMlmeFrame.IsInUsed !=PACKET_FREE_TO_USE ) { - Adapter->sMlmeFrame.wNumTxMMPDUDiscarded ++; +if (Adapter->sMlmeFrame.IsInUsed !=PACKET_FREE_TO_USE ) { + Adapter->sMlmeFrame.wNumTxMMPDUDiscarded++;return FALSE; } Adapter->sMlmeFrame.IsInUsed =PACKET_COME_FROM_MLME ;
@@ -84,17 +84,15 @@ u8 MLMESendFrame(PWB32_ADAPTER Adapter,// Keep information for sending Adapter->sMlmeFrame.pMMPDU = pMMPDU; Adapter->sMlmeFrame.DataType = DataType; - Adapter->sMlmeFrame.len = len;// It must be the last setting due to QUERY_SIZE_SECOND of Mds +// len must be the last setting due to QUERY_SIZE_SECOND of Mds + Adapter->sMlmeFrame.len = len; Adapter->sMlmeFrame.wNumTxMMPDU++;// H/W will enter power save by set the register. S/W don't send null frame //with PWRMgt bit enbled to enter power save now. // Transmit NDIS packet -Mds_Tx ( Adapter ); -#ifdef _PE_TX_DUMP_ -WBDEBUG (("MLMESendFrame->mds_tx_ok\n" )); -#endif +Mds_Tx (Adapter);return TRUE; }
!-------------------------------------------------------------flip-
Removed nasty stack overflow, and got transmit of big packets to work. I can now actually do ssh over softmac-based driver.
---
commit 78b9049df56fbd5fc785b4e7e9c93dbfb8390d2a
tree 2290532e477ee36bd33a7e6e91c6f3207420c9e2
parent 0cfb0fd5cde408c154de69fa1c5521d5288ca506
author Pavel <[email protected]> Mon, 05 May 2008 22:54:25 +0200 committer Pavel <[email protected]> Mon, 05 May 2008 22:54:25 +0200
.../wireless/winbond/winbondport/linux/wb35tx.c | 1 + .../net/wireless/winbond/winbondport/linux/wbusb.c | 3 ++- drivers/net/wireless/winbond/winbondport/mlme_s.h | 2 +- .../net/wireless/winbond/winbondport/mlmetxrx.c | 11 +---------- 4 files changed, 5 insertions(+), 12 deletions(-)
drivers/net/wireless/winbond/winbondport/linux/wb35tx.c +1 -0
@@ -92,6 +92,7 @@ void Wb35Tx_complete(struct urb * pUrb)PWB35TX pWb35Tx = &pHwData->Wb35Tx;PMDS pMds = &Adapter->Mds; +printk ("wb35: tx complete\n" );// Variable setting pWb35Tx->EP4vm_state =VM_COMPLETED ; pWb35Tx->EP4VM_status = pUrb->status;//Store the last result of Irp
drivers/net/wireless/winbond/winbondport/linux/wbusb.c +2 -1
@@ -114,9 +114,10 @@ static int wbsoft_tx(struct ieee80211_hw struct ieee80211_tx_control *control) {char *buffer =kmalloc (skb->len,GFP_ATOMIC ); +printk ("Sending frame %d bytes\n" , skb->len);memcpy (buffer, skb->data, skb->len);if (1 ==MLMESendFrame (my_adapter, buffer, skb->len,FRAME_TYPE_802_11_MANAGEMENT )) -printk ("frame sent ok?\n" ); +printk ("frame sent ok (%d bytes)?\n" , skb->len);return NETDEV_TX_OK ; }
drivers/net/wireless/winbond/winbondport/mlme_s.h +1 -1
@@ -112,7 +112,7 @@ #define MLMEMSG_TIMEOUT 0x50/////////////////////////////////////////////////////////////////////////// //Global data structures #define MAX_NUM_TX_MMPDU 2 -#define MAX_MMPDU_SIZE 512 +#define MAX_MMPDU_SIZE 1512#define MAX_NUM_RX_MMPDU 6
drivers/net/wireless/winbond/winbondport/mlmetxrx.c +1 -10
@@ -134,22 +134,13 @@ void MLME_SendComplete(PADAPTER Adapter, u8 PacketID, unsigned char SendOK) { MLME_TXCALLBACK TxCallback; -u8 DataTmp[200 ]; - -memcpy (DataTmp, Adapter->sMlmeFrame.pMMPDU, Adapter->sMlmeFrame.len);// Reclaim the data buffer Adapter->sMlmeFrame.len =0 ;MLMEfreeMMPDUBuffer ( Adapter, Adapter->sMlmeFrame.pMMPDU ); -//TODO : ?? The pData has been returned, but we still use it to know what kind -// of mlme frame it is. Will it be dangerous?? - TxCallback.psFramePtr = DataTmp; -if (SendOK) - TxCallback.bResult =MLME_SUCCESS ; -else - TxCallback.bResult =TRANSMIT_FRAME_FAIL ; + TxCallback.bResult =MLME_SUCCESS ;// Return resource Adapter->sMlmeFrame.IsInUsed =PACKET_FREE_TO_USE ;
!-------------------------------------------------------------flip-
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 11 lines · Pavel Machek
Removed nasty stack overflow, and got transmit of big packets to work. I can now actually do ssh over softmac-based driver.
Unindent code to make it more readable.
arch/x86/kernel/traps_32.c +0
-0@@ -146,11 +146,16 @@ static inline unsigned long print_contex unsigned long *stack, unsigned long bp, const struct stacktrace_ops *ops, void *data) {
arch/x86/kernel/traps_32.c static inline unsigned long print_contex · line 158
Quoted 10 lines
arch/x86/kernel/traps_32.c +5
-0+int max =5 ;struct stack_frame *frame = (struct stack_frame *)bp;while (valid_stack_ptr (tinfo, stack,sizeof (*stack))) {unsigned long addr; +if (!max) +return ; + max--; +
hm, you got into an infinite loop here, right? Could you please send this bit as a separate patch - and i guess it should use kstack_depth_to_print instead of '5'?
Ingo
Hi!
Quoted 17 lines
Quoted 17 lines
Removed nasty stack overflow, and got transmit of big packets to work. I can now actually do ssh over softmac-based driver.
Unindent code to make it more readable.
arch/x86/kernel/traps_32.c +1
-0@@ -146,11 +146,16 @@ static inline unsigned long print_contex unsigned long *stack, unsigned long bp, const struct stacktrace_ops *ops, void *data) { + int max = 5;struct stack_frame *frame = (struct stack_frame *)bp;while (valid_stack_ptr (tinfo, stack,sizeof (*stack))) {unsigned long addr;
Quoted 8 lines
arch/x86/kernel/traps_32.c static inline unsigned long print_contex · line 158
Quoted 4 lines
arch/x86/kernel/traps_32.c +4
-0+if (!max) +return ; + max--; +hm, you got into an infinite loop here, right? Could you please send this bit as a separate patch - and i guess it should use
kstack_depth_to_printinstead of '5'?
No, sorry, this should not have been in this patch. (And no, this is not the overflow I was talking about).
What happened to me is that current oops is too long even for vga=1, and I was trying to see where it dies.
I was trying to only print first few lines of the backtrace, but then I fix the nasty bug...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html