Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3850815pxb; Tue, 17 Nov 2020 05:22:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyO5VKHPdkK0sf7phoN9M8eaLEKnMDeLLUjaXGljU9+D8bn6Gq3JfkCYZARKLqiF6h9WUQB X-Received: by 2002:a05:6402:181a:: with SMTP id g26mr21770851edy.8.1605619363402; Tue, 17 Nov 2020 05:22:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605619363; cv=none; d=google.com; s=arc-20160816; b=oo4IvdU1Iqlapzp3rpgTeNFIMUB+oA2UU1ENqiIpOPC0Tg/lHQBCDc5TVu7yeZPSaQ 4Oyj6dIdQGnBtU9I5YUP1tz6LgS284EgyQrzYGoYKnFIL5L6nlkBDrkukIS6fpDaHpQh Qn4poZoLwXYefo8noUC9bvM5tn+oOXAyVyQ452LQWfE107V67OZLUIJ+/o1lcLzdP2JJ dltpzLmRzoBdqeWvvSG7iG36k2hnnXteGv415jRSVNqfc4KxQg6D7rllfwiQQKf21Lvy bVgORpW6as+OxNlKxK7l/ngKaGbs8BwqHv1DTrFjuzFUMy3KEy1ee9snHTzLheBzp1w1 1AqA== 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=VBQWFx5rklrnuT7TY5cJ3xeybkJh1PiTolQtwLUZk6Y=; b=bH1+wu+uVLU9/dXYpOAPoQrKvSrx7iBNtvusnOnFrZ+3rzEZ0fsSCH3DxdiXUpl21d 437dFoPSktcPq7BbsCxxiT6l+JrR4hipmcgnelZu6FYWuEN+Duv88VamtHTCXG2lpF6n J6+leSDAHmHzYpQyRmvyaIOXyQVUrvsmOf8QaPgqyucCeisYAIg2zBlDnnl5sYH3NfDV eThQ+hRry8yPrPJ5axdlpqMjapZE5OCNZQSQP4Ov72yCVTiuGtnP6chTepl/7kP56oHH 7/nOamFocaB10MpN0cQ4M26DJ8BMBr9lfXVSA9e4GgdBRf3fi49vQp9LlTt04LEOcRA/ gkow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lEkAFy4V; 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 t19si14676320edw.563.2020.11.17.05.22.18; Tue, 17 Nov 2020 05:22:43 -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=lEkAFy4V; 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 S1730478AbgKQNUI (ORCPT + 99 others); Tue, 17 Nov 2020 08:20:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:53384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730464AbgKQNUC (ORCPT ); Tue, 17 Nov 2020 08:20:02 -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 6CC97241A5; Tue, 17 Nov 2020 13:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619202; bh=qN+/yH8/VBqsbUJXMUUWWlAybqPPDa6YVMXEHQtsC0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lEkAFy4V49UW3E/UypPdS48cvvO1q/lFaiZ6Irc5HzT/opL64aG1qdl54Si3Wo0n6 L3jm4EXkaz+k6o4ttYSy6WCmkKu0i8MSPmmsMnbdQTcmtFFUbBqLSAVgSJ4+jdiFq1 D9Cot0HL8V+v3heveboIqeaZVEqaXsvlcZKjpffs= 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.19 061/101] cosa: Add missing kfree in error path of cosa_write Date: Tue, 17 Nov 2020 14:05:28 +0100 Message-Id: <20201117122116.080197538@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122113.128215851@linuxfoundation.org> References: <20201117122113.128215851@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 f6b000ddcd151..b7bfc0caa5dc8 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