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

Commit 658656fa authored by Hamad Kadmany's avatar Hamad Kadmany
Browse files

media: dvb: Protect against invalid source



If user misses setting DVR source to demux,
the source or the input pipe may be invalid
which would result in an invalid pointer access.

Change-Id: Ib80556b57ef63a9c8682bde7093cbf2d21009f4e
Signed-off-by: default avatarHamad Kadmany <hkadmany@codeaurora.org>
parent 93277b2c
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -6067,6 +6067,14 @@ static int mpq_dmx_tspp2_map_buffer(struct dmx_demux *demux,
		if (mutex_lock_interruptible(&mpq_dmx_tspp2_info.mutex))
			return -ERESTARTSYS;

		if (!source_info || !source_info->input_pipe) {
			mutex_unlock(&mpq_dmx_tspp2_info.mutex);
			MPQ_DVB_ERR_PRINT(
				"%s: invalid source is set\n",
				__func__);
			return -EINVAL;
		}

		pipe_info = source_info->input_pipe;
		if (pipe_info->handle != TSPP2_INVALID_HANDLE) {
			mutex_unlock(&mpq_dmx_tspp2_info.mutex);