Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rt2x00: fix order of entry flags modification

In rt2800usb_work_txdone we check flags in order:

- ENTRY_OWNER_DEVICE_DATA
- ENTRY_DATA_STATUS_PENDING
- ENTRY_DATA_IO_FAILED

Modify flags in separate order in rt2x00usb_interrupt_txdone, to avoid
processing entries in _txdone with wrong flags or skip processing
ready entries.

Reported-by: Justin Piszcz <jpiszcz@lucidpixels.com>
Cc: stable@kernel.org
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Stanislaw Gruszka and committed by
John W. Linville
df71c9cf 4b1bfb7d

+7 -10
+7 -10
drivers/net/wireless/rt2x00/rt2x00usb.c
··· 262 262 struct queue_entry *entry = (struct queue_entry *)urb->context; 263 263 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 264 264 265 - if (!test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) 265 + if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) 266 266 return; 267 - 268 - if (rt2x00dev->ops->lib->tx_dma_done) 269 - rt2x00dev->ops->lib->tx_dma_done(entry); 270 - 271 - /* 272 - * Report the frame as DMA done 273 - */ 274 - rt2x00lib_dmadone(entry); 275 - 276 267 /* 277 268 * Check if the frame was correctly uploaded 278 269 */ 279 270 if (urb->status) 280 271 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); 272 + /* 273 + * Report the frame as DMA done 274 + */ 275 + rt2x00lib_dmadone(entry); 281 276 277 + if (rt2x00dev->ops->lib->tx_dma_done) 278 + rt2x00dev->ops->lib->tx_dma_done(entry); 282 279 /* 283 280 * Schedule the delayed work for reading the TX status 284 281 * from the device.