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

Commit 943014c3 authored by Siva Kumar Akkireddi's avatar Siva Kumar Akkireddi Committed by Ajay Prathi
Browse files

msm: mhi_dev: Avoid re-alloc of netdev interface



If netdev interface_init gets called by mhi,
when the channels are not actually closed.
trying to do a reinit results in error from mhi
(like re-opening a already opened channel).
that leads to kernel crashes.
Add a check to avoid re-allocating netdev interface if it
has been already allocated.

Change-Id: I3835312a3e1fb09e979cc1dcf0b23815d77b7b57
Signed-off-by: default avatarSiva Kumar Akkireddi <sivaa@codeaurora.org>
parent 39641649
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2020, 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
@@ -638,6 +638,12 @@ int mhi_dev_net_interface_init(void)
	int index = 0;
	struct mhi_dev_net_client *mhi_net_client = NULL;

	if (mhi_net_ctxt.client_handle) {
		mhi_dev_net_log(MHI_INFO,
			"MHI Netdev interface already initialized\n");
		return ret_val;
	}

	mhi_net_client = kzalloc(sizeof(struct mhi_dev_net_client), GFP_KERNEL);
	if (!mhi_net_client)
		return -ENOMEM;