aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2023-09-16 08:07:25 +0200
committerTakashi Iwai <tiwai@suse.de>2023-10-24 16:18:53 +0200
commita129813bde0de143e769558e17851764e9b6eaf2 (patch)
tree1bea3512eca55a21b97fb76d613d31261b30b611
parent7cd707c0e4634d613f618293f857b48e934e7d0c (diff)
downloadsound-topic/midi20-5.4.72.tar.gz
ALSA: rawmidi: Fix NULL dereference at proc readtopic/midi20-5.4.72
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: fa030f666d24 ("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> (cherry picked from commit b2ce0027d7b2905495021c5208f92043eb493146)
-rw-r--r--sound/core/rawmidi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 1c4ba5cc5624a..6215143d3b6d5 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -1699,7 +1699,7 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry,
if (IS_ENABLED(CONFIG_SND_UMP))
snd_iprintf(buffer, "Type: %s\n",
rawmidi_is_ump(rmidi) ? "UMP" : "Legacy");
- if (rmidi->ops->proc_read)
+ if (rmidi->ops && rmidi->ops->proc_read)
rmidi->ops->proc_read(entry, buffer);
mutex_lock(&rmidi->open_mutex);
if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT) {