From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05117366551 for ; Thu, 22 Jan 2026 18:11:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769105494; cv=none; b=EHhdMCNh86stNeoKyrUEM8CeKjcJxRxKLbk+qkjDoRvQZEbfPCwy8KgQvJsKVonOFh6ia/3AtaAHXg06bOKZiObN6DtGyYkcIJRB2nRn9ZBRPtdAhDTQViNtMq4iE9D2Xre/pS1adwjv5V+ckTQtaxy47sPAuXijzzGWn1dA4To= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769105494; c=relaxed/simple; bh=tYM5UC9SSsqxFoxnsUD+fb34UZyp35wuUETsu4zZA1A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=k8PTTdu7vtn6Jq3TiglBLFfnb477C6YyNnYV79hZF7nQfMtMtKF2Iv8CKUAsucnHCWUKNk/q9R/Je+f1+4okY2iMr5x5LLWz4KggaBqzjsV08qR9LPKWCE/7K1ZjajsmMWfBBgG7P6nJqIC0G5mQ/IJWtJmAWlCKznmga7SMMok= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=r+wgyCpi; arc=none smtp.client-ip=91.218.175.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="r+wgyCpi" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1769105483; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y3qF3Oh1VVPLvk+yk9IepnLjR5SkTZ5MYLgq+jNxdc8=; b=r+wgyCpinHDM2tEJdLICy5l6d2m4Bu1VxpdtRkYHnMbY6sKUoyK8bCnzaM4DC9FqPC2QWZ kMgnsuwmsZiPno7O3rbkygCcDP3+IYauGsz7xSWA7NdtAb7bTTIPe4b98u9gJlB5kTcTSr 8AdahcVPsqKa0h749xQpgbFBBpLy6pU= Date: Thu, 22 Jan 2026 18:11:20 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH net] octeon_ep: Fix memory leak in octep_device_setup() To: Zilin Guan , vburru@marvell.com Cc: sedara@marvell.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jianhao.xu@seu.edu.cn References: <20260121130551.3717090-1-zilin@seu.edu.cn> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Vadim Fedorenko In-Reply-To: <20260121130551.3717090-1-zilin@seu.edu.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 21/01/2026 13:05, Zilin Guan wrote: > In octep_device_setup(), if octep_ctrl_net_init() fails, the function > returns directly without unmapping the mapped resources and freeing the > allocated configuration memory. > > Fix this by jumping to the unsupported_dev label, which performs the > necessary cleanup. This aligns with the error handling logic of other > paths in this function. > > Compile tested only. Issue found using a prototype static analysis tool > and code review. > > Fixes: 577f0d1b1c5f ("octeon_ep: add separate mailbox command and response queues") > Signed-off-by: Zilin Guan > --- > drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c > index bcea3fc26a8c..57db7ea2f5be 100644 > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c > @@ -1338,7 +1338,7 @@ int octep_device_setup(struct octep_device *oct) > > ret = octep_ctrl_net_init(oct); > if (ret) > - return ret; > + goto unsupported_dev; > > INIT_WORK(&oct->tx_timeout_task, octep_tx_timeout_task); > INIT_WORK(&oct->ctrl_mbox_task, octep_ctrl_mbox_task); Reviewed-by: Vadim Fedorenko