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

[PATCH] mwave: interesting flags savings

Flags from spin_lock_irqsave() are saved into global variable and restored
from it. My gut feeling this is very racy.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alexey Dobriyan and committed by
Linus Torvalds
ae6b95d4 91e4ee38

+12 -2
+12 -2
drivers/char/mwave/3780i.c
··· 63 63 #include "3780i.h" 64 64 65 65 static DEFINE_SPINLOCK(dsp_lock); 66 - static unsigned long flags; 67 - 68 66 69 67 static void PaceMsaAccess(unsigned short usDspBaseIO) 70 68 { ··· 74 76 unsigned short dsp3780I_ReadMsaCfg(unsigned short usDspBaseIO, 75 77 unsigned long ulMsaAddr) 76 78 { 79 + unsigned long flags; 77 80 unsigned short val; 78 81 79 82 PRINTK_3(TRACE_3780I, ··· 95 96 void dsp3780I_WriteMsaCfg(unsigned short usDspBaseIO, 96 97 unsigned long ulMsaAddr, unsigned short usValue) 97 98 { 99 + unsigned long flags; 98 100 99 101 PRINTK_4(TRACE_3780I, 100 102 "3780i::dsp3780i_WriteMsaCfg entry usDspBaseIO %x ulMsaAddr %lx usValue %x\n", ··· 175 175 unsigned short *pIrqMap, 176 176 unsigned short *pDmaMap) 177 177 { 178 + unsigned long flags; 178 179 unsigned short usDspBaseIO = pSettings->usDspBaseIO; 179 180 int i; 180 181 DSP_UART_CFG_1 rUartCfg1; ··· 355 354 356 355 int dsp3780I_DisableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings) 357 356 { 357 + unsigned long flags; 358 358 unsigned short usDspBaseIO = pSettings->usDspBaseIO; 359 359 DSP_ISA_SLAVE_CONTROL rSlaveControl; 360 360 ··· 385 383 386 384 int dsp3780I_Reset(DSP_3780I_CONFIG_SETTINGS * pSettings) 387 385 { 386 + unsigned long flags; 388 387 unsigned short usDspBaseIO = pSettings->usDspBaseIO; 389 388 DSP_BOOT_DOMAIN rBootDomain; 390 389 DSP_HBRIDGE_CONTROL rHBridgeControl; ··· 430 427 431 428 int dsp3780I_Run(DSP_3780I_CONFIG_SETTINGS * pSettings) 432 429 { 430 + unsigned long flags; 433 431 unsigned short usDspBaseIO = pSettings->usDspBaseIO; 434 432 DSP_BOOT_DOMAIN rBootDomain; 435 433 DSP_HBRIDGE_CONTROL rHBridgeControl; ··· 477 473 int dsp3780I_ReadDStore(unsigned short usDspBaseIO, void __user *pvBuffer, 478 474 unsigned uCount, unsigned long ulDSPAddr) 479 475 { 476 + unsigned long flags; 480 477 unsigned short __user *pusBuffer = pvBuffer; 481 478 unsigned short val; 482 479 ··· 519 514 void __user *pvBuffer, unsigned uCount, 520 515 unsigned long ulDSPAddr) 521 516 { 517 + unsigned long flags; 522 518 unsigned short __user *pusBuffer = pvBuffer; 523 519 unsigned short val; 524 520 ··· 561 555 int dsp3780I_WriteDStore(unsigned short usDspBaseIO, void __user *pvBuffer, 562 556 unsigned uCount, unsigned long ulDSPAddr) 563 557 { 558 + unsigned long flags; 564 559 unsigned short __user *pusBuffer = pvBuffer; 565 560 566 561 ··· 603 596 int dsp3780I_ReadIStore(unsigned short usDspBaseIO, void __user *pvBuffer, 604 597 unsigned uCount, unsigned long ulDSPAddr) 605 598 { 599 + unsigned long flags; 606 600 unsigned short __user *pusBuffer = pvBuffer; 607 601 608 602 PRINTK_5(TRACE_3780I, ··· 651 643 int dsp3780I_WriteIStore(unsigned short usDspBaseIO, void __user *pvBuffer, 652 644 unsigned uCount, unsigned long ulDSPAddr) 653 645 { 646 + unsigned long flags; 654 647 unsigned short __user *pusBuffer = pvBuffer; 655 648 656 649 PRINTK_5(TRACE_3780I, ··· 700 691 int dsp3780I_GetIPCSource(unsigned short usDspBaseIO, 701 692 unsigned short *pusIPCSource) 702 693 { 694 + unsigned long flags; 703 695 DSP_HBRIDGE_CONTROL rHBridgeControl; 704 696 unsigned short temp; 705 697