Skip to content

Commit b2ce002

Browse files
committed
ALSA: rawmidi: Fix NULL dereference at proc read
At the implementation of the optional proc fs in rawmidi, I forgot that rmidi->ops itself is optional and can be NULL. Add the proper NULL check for avoiding the Oops. Fixes: fa030f6 ("ALSA: ump: Additional proc output") Reported-and-tested-by: Mark Hills <mark@xwax.org> Closes: https://lore.kernel.org/r/ef9118c3-a2eb-d0ff-1efa-cc5fb6416bde@xwax.org Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20230916060725.11726-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 322e0c5 commit b2ce002

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

sound/core/rawmidi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,7 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry,
17701770
if (IS_ENABLED(CONFIG_SND_UMP))
17711771
snd_iprintf(buffer, "Type: %s\n",
17721772
rawmidi_is_ump(rmidi) ? "UMP" : "Legacy");
1773-
if (rmidi->ops->proc_read)
1773+
if (rmidi->ops && rmidi->ops->proc_read)
17741774
rmidi->ops->proc_read(entry, buffer);
17751775
mutex_lock(&rmidi->open_mutex);
17761776
if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT) {

0 commit comments

Comments
 (0)