• Takashi Iwai's avatar
    ALSA: memalloc: Don't exceed over the requested size · 79018e17
    Takashi Iwai authored
    commit dfef01e150824b0e6da750cacda8958188d29aea upstream.
    
    snd_dma_alloc_pages_fallback() tries to allocate pages again when the
    allocation fails with reduced size.  But the first try actually
    *increases* the size to power-of-two, which may give back a larger
    chunk than the requested size.  This confuses the callers, e.g. sgbuf
    assumes that the size is equal or less, and it may result in a bad
    loop due to the underflow and eventually lead to Oops.
    
    The code of this function seems incorrectly assuming the usage of
    get_order().  We need to decrease at first, then align to
    power-of-two.
    Reported-and-tested-by: 's avatarhe, bo <bo.he@intel.com>
    Reported-by: 's avatarzhang jun <jun.zhang@intel.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    79018e17
Name
Last commit
Last update
..
aoa Loading commit data...
arm Loading commit data...
atmel Loading commit data...
core Loading commit data...
drivers Loading commit data...
firewire Loading commit data...
hda Loading commit data...
i2c Loading commit data...
isa Loading commit data...
mips Loading commit data...
oss Loading commit data...
parisc Loading commit data...
pci Loading commit data...
pcmcia Loading commit data...
ppc Loading commit data...
sh Loading commit data...
soc Loading commit data...
sparc Loading commit data...
spi Loading commit data...
synth Loading commit data...
usb Loading commit data...
x86 Loading commit data...
Kconfig Loading commit data...
Makefile Loading commit data...
ac97_bus.c Loading commit data...
last.c Loading commit data...
sound_core.c Loading commit data...