Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3884688pxb; Tue, 17 Nov 2020 06:10:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJyADplt6+urQd2PV42Gg2KJZ8m96C2FPsnsj3xr8DUNvx+QRm5sDTZalakihW5f7KrQLXzn X-Received: by 2002:a05:6402:21a:: with SMTP id t26mr3457194edv.173.1605622252767; Tue, 17 Nov 2020 06:10:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605622252; cv=none; d=google.com; s=arc-20160816; b=CUiYTkXviXEIpgUFIQkQoLkJKdYlj/Ot8sCBoCFuJxqHS2wMCKdGENJz1mUpqcVeoz A0MxR8DBXJhPxhD2lJz9S3IT7z5lsMhJIV3b9agmHnZZbW9O9P6q0Wdd/s7BWNjxrVq0 qJTJS3sbA+xTqPtS3z2EmQDeiMQ7aDAxh6QmsNDUDl9uYDTRMKyQE7Vup4IQBPlKPr+e buwlTHCQ84lNPYuhtH/nLnvTtGxRNxHmsU+UETfu8E/hXJpBaJeBG8Ycl204WTIrGbGw vkasWtjnozlraAvutfLrj9+vYuH02W4YI3hRPQx4GOtn4VfjMtwccIW/BUKhnQmJC2gI jaTQ== 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=f491wndlkC6d5yf9tv+MKnyK57UZ7ftAE/sCZK6LPb0=; b=eYksxPASaD8DrVoz7IE3IcCUxk0LQDAl4DFNdLbqvtOiObPoW2D5bDwdRrxuPIwdHe aT3YpxdF+pgD1p5LsELLl0xy0jtXAiDfV/8+nsX25Psnn6nKXKsh8pNXM5IBW/ittn2g WiYlT492WR9/2qwTYwfNHZ2mkDE/NauRGe2UE/mVukdypvtEK7K83+j2KxqEJmH1QS2n gKtlYcN8XD6OkGYDHkGaEQLxZratp9G3MGmi8BbRFxt+oj/0rnevQIsF9wMMeAosOBYR n1VFXMTzsoF1jMORfA2q54+9+/TxyLrCZZhBkVuaiQNJbw7nI0NwHR3DHq3wdmXQixYo w3yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PtpHXBtf; 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 j1si13778715edf.417.2020.11.17.06.10.27; Tue, 17 Nov 2020 06:10:52 -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=PtpHXBtf; 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 S1729156AbgKQOGG (ORCPT + 99 others); Tue, 17 Nov 2020 09:06:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:37164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729285AbgKQNIb (ORCPT ); Tue, 17 Nov 2020 08:08:31 -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 894422468F; Tue, 17 Nov 2020 13:08:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605618511; bh=DxkkgTtrPZbYCopD7O4N1V/qXoIssIfiTtsLiiIsIoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PtpHXBtfnjUY3gbeY2ZbNMt1lDwC6PwBIrkqVxFPPe92lFPEsUvNom2zVLJiCeo3T mip0LzIv/G4eQKr7NbH6hdaMrk0JXwlL6EuST2bW7jM4UwdPOnH4qh91jV529vzzVF xDfm2r/5VbxhRRC6cRhRlwyleIlHRoDsqf7BWqgc= 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.4 30/64] cosa: Add missing kfree in error path of cosa_write Date: Tue, 17 Nov 2020 14:04:53 +0100 Message-Id: <20201117122107.631309139@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122106.144800239@linuxfoundation.org> References: <20201117122106.144800239@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 848ea6a399f23..cbda69e58e084 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c @@ -903,6 +903,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