Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3879879pxb; Tue, 17 Nov 2020 06:05:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyULtU48RiukRvq59MX65mtTy4AIVxTb9c1Y7QXAdMucNadIcB6g2trIqAy92B3Oz8NaPO9 X-Received: by 2002:adf:82f5:: with SMTP id 108mr1593069wrc.269.1605621922182; Tue, 17 Nov 2020 06:05:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605621922; cv=none; d=google.com; s=arc-20160816; b=gk22YsbaUUZ/+gr1SKhZsMZ2U04edj4ByP9thN3wkSq4ZCMA0XLgzELBa9HrrN8b1a DxGkmFw49Hb3toctEupQSeJm7VdhRxCPnvv+xtzrY1S8xtoPcAajeA0g57t3sGcfSHbd uY2bFblkpMuFunlPq2Y6h46S2OuBoDq3wJGiX3AC/meoLyfM30WHNAtZrzJpbuSqXVo0 APh++nAu0Ob0KXw2uSpuNWbUv2THvkfEvLMAociZAhzoHytEW7xnlrA5xW+NNSLKGavu 6CVMIKXKzhj8RfOAPgJzRm6eijZSmtEOPAFFvsRw2t78DuRz0lkhvDOUfgPBM4JQlQ31 oTEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KA2OYmGEdOS6gWMI4Wz+X63KRNuCYXVkYMaV7B0ckfA=; b=M2EZ7uBbv1/ibiCH+D8YpMphYU+SqdvljzSkgU0K7ggx7jNvsLHjkdW1kVPgAsOxSa /MlHj8EMjh62qrGd4GhKnQQpZUPVJPBwnn4WRf8sA9/GqerXKSuq2KBXX041GxL0FwLO xVJNfLbVdhitbpoyMJ9FZ7ANdDKKJumiAP+NO+/01cTU8xm0/A2Lk59vymoYPJHKdoBB NnkSOA87dyXpMpA/Sg2nbTZWJBy0iALTppgCb0RUGrgy00bG56338dNNhSyPJAgKaGtl OXr5pxzJz/gL2v31suJqsvwe2wyoJefxrjqrJIyDyHhQZGFV/GNOsJLJDL3mWvTBy522 GjeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CR7Rgi94; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a3si14313980ejd.407.2020.11.17.06.04.50; Tue, 17 Nov 2020 06:05:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CR7Rgi94; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387511AbgKQOAa (ORCPT + 99 others); Tue, 17 Nov 2020 09:00:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:45950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730099AbgKQNOt (ORCPT ); Tue, 17 Nov 2020 08:14:49 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A525B2151B; Tue, 17 Nov 2020 13:14:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605618887; bh=k+LFi0kw5fEHYSJMKe8xuMsDPL29D2VhAhQVUFmwjhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CR7Rgi940p/vj6dt1q7RBayY9iZVwd8ApgLmyf2jmVXoEz4ak30VTV0Lg/qiykaaf 5svCD0piNG8uzL9ViYZaiCaShIGomcdmDxzMTzGCeYwAzSqD4O6SczfBEexSaBJJ0T 8Q0wbCDJ6bMHlbC3WXCMJvfJadWobmaXbNkSI5pc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Hai , =?UTF-8?q?Jan=20 Yenya =20Kasprzak?= , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.14 42/85] cosa: Add missing kfree in error path of cosa_write Date: Tue, 17 Nov 2020 14:05:11 +0100 Message-Id: <20201117122113.080281542@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122111.018425544@linuxfoundation.org> References: <20201117122111.018425544@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wang Hai [ Upstream commit 52755b66ddcef2e897778fac5656df18817b59ab ] If memory allocation for 'kbuf' succeed, cosa_write() doesn't have a corresponding kfree() in exception handling. Thus add kfree() for this function implementation. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Hulk Robot Signed-off-by: Wang Hai Acked-by: Jan "Yenya" Kasprzak Link: https://lore.kernel.org/r/20201110144614.43194-1-wanghai38@huawei.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/wan/cosa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 6ea16260ec760..1a1f2d1069fb8 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c @@ -902,6 +902,7 @@ static ssize_t cosa_write(struct file *file, chan->tx_status = 1; spin_unlock_irqrestore(&cosa->lock, flags); up(&chan->wsem); + kfree(kbuf); return -ERESTARTSYS; } } -- 2.27.0