Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d040e85a authored by Amadeusz Sławiński's avatar Amadeusz Sławiński Committed by Greg Kroah-Hartman
Browse files

ALSA: info: Fix llseek return value when using callback



commit 9be080edcca330be4af06b19916c35227891e8bc upstream.

When using callback there was a flow of

	ret = -EINVAL
	if (callback) {
		offset = callback();
		goto out;
	}
	...
	offset = some other value in case of no callback;
	ret = offset;
out:
	return ret;

which causes the snd_info_entry_llseek() to return -EINVAL when there is
callback handler. Fix this by setting "ret" directly to callback return
value before jumping to "out".

Fixes: 73029e0f ("ALSA: info - Implement common llseek for binary mode")
Signed-off-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220817124924.3974577-1-amadeuszx.slawinski@linux.intel.com


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 99248013
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ static loff_t snd_info_entry_llseek(struct file *file, loff_t offset, int orig)
	entry = data->entry;
	mutex_lock(&entry->access);
	if (entry->c.ops->llseek) {
		offset = entry->c.ops->llseek(entry,
		ret = entry->c.ops->llseek(entry,
					   data->file_private_data,
					   file, offset, orig);
		goto out;