]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: ctxfi: Fix out-of-range access
authorTakashi Iwai <tiwai@suse.de>
Thu, 18 Nov 2021 21:57:29 +0000 (22:57 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 18 Nov 2021 21:57:55 +0000 (22:57 +0100)
commit614916b93bf397c3f0178350db2c7fa011fdfed2
treea38e16cda06a243bed08f01c81e9965af7447146
parent058d4e78a1d51405f60ff73c4ecb3e254c3b038d
ALSA: ctxfi: Fix out-of-range access

The master and next_conj of rcs_ops are used for iterating the
resource list entries, and currently those are supposed to return the
current value.  The problem is that next_conf may go over the last
entry before the loop abort condition is evaluated, and it may return
the "current" value that is beyond the array size.  It was caught
recently as a GPF, for example.

Those return values are, however, never actually evaluated, hence
basically we don't have to consider the current value as the return at
all.  By dropping those return values, the potential out-of-range
access above is also fixed automatically.

This patch changes the return type of master and next_conj callbacks
to void and drop the superfluous code accordingly.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214985
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20211118215729.26257-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/ctxfi/ctamixer.c
sound/pci/ctxfi/ctdaio.c
sound/pci/ctxfi/ctresource.c
sound/pci/ctxfi/ctresource.h
sound/pci/ctxfi/ctsrc.c