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

Commit b2ace40b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "diag: Protect memory allocation in diagfwd_mhi_read_work_fn"

parents 500f8f1c b4a235f5
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2018, 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
@@ -434,9 +434,10 @@ static void mhi_read_work_fn(struct work_struct *work)
	do {
		if (!(atomic_read(&(read_ch->opened))))
			break;

		spin_lock_irqsave(&read_ch->lock, flags);
		buf = diagmem_alloc(driver, DIAG_MDM_BUF_SIZE,
				    mhi_info->mempool);
		spin_unlock_irqrestore(&read_ch->lock, flags);
		if (!buf)
			break;

@@ -743,4 +744,3 @@ void diag_mhi_exit(void)
			diagmem_exit(driver, mhi_info->mempool);
	}
}