From patchwork Mon Mar 1 16:14:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 388742 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp3670678jap; Mon, 1 Mar 2021 12:29:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxaSSWg4b/odEdYy3fal8r+8iAlRr1z6l9mThFiF3Fmw4GreOBhJhuXqIa8rvZ8PQ6deD1i X-Received: by 2002:a17:906:b042:: with SMTP id bj2mr17278846ejb.261.1614630573137; Mon, 01 Mar 2021 12:29:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614630573; cv=none; d=google.com; s=arc-20160816; b=Y6Cl1ifWzyLK9c5qTeyYoG9/uWfcU5cl4tZflOeK9hWQM332MQRseWXDJQadwqtfBd l32C4tlGERPR79K+Liw6ckkGeKUTebGJi2BMrd3c2YOsKSGsnKPLY10GR01JLLqWJ1gp aXPsVlsZiIjc1Az/tqk3gHyboKBlf2m3f4Sq8yQPiLx0YyS03YJnKxkSZMKjWxyzVGvr pa5hjiAWeQ+/uUPtO5iP5MPcUjXVGPStbufMaKZzqTlJt4AHW1ZZSOQTqPAPq4hobiyX Rm7eAq/gy9zcV75IncmeB5Ez1GLPl7CU8phvupjZSoc8GrHdzZdd7vIKbg9bG4V28UCT u8ig== 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=t9g9V2lW+dnFVKGMwp7UC5qk+i/PT8dpSPl/oUOp+O8=; b=0tYqpEdL17TEgEHwM1CuU+QaTmMgp2yG8MqZUSl3LuauFvxs/OGe1prHZQ8QPp7m8g xG4BsSm9kUgN+JCMAGCJtpxqyVmgX1LMac8WarAdruVYAwnxg8AaPA2YFvHAy5+hevn5 UlWg+r92di++2by0wqL5QG3D+33C735L//4Wbofq9wcYEaPXJox6a/GE+cMf/IzoMIFF BolaIJNb4Hl1GJujQH+N/I+1hWFx6X08Jn+5oIPnMUAx87cxdJfgHkKXJK/ap86CiZbB E1hSy3R/asPB7iR1Li7OmdD1J0PRN1IZgPOdvkm32vBB1hEfR2iXxzShmAAvYK7+SjdV uALQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l1ThCMsO; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (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 y3si4137637eds.265.2021.03.01.12.29.32; Mon, 01 Mar 2021 12:29:33 -0800 (PST) Received-SPF: pass (google.com: domain of stable-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=@linuxfoundation.org header.s=korg header.b=l1ThCMsO; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237057AbhCAU3G (ORCPT + 13 others); Mon, 1 Mar 2021 15:29:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:48270 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243261AbhCAUXc (ORCPT ); Mon, 1 Mar 2021 15:23:32 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2BFCC653F9; Mon, 1 Mar 2021 18:04:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614621898; bh=ZQtOhT8VAwYbSnC+p1CHYZJsPMg+E0AMJanid25O/6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l1ThCMsOKBWWe0CXBUslW5sQM44/blSvEAbz1YIlCndVzXEmNC6/gTztC64QYk6cr GcDVC8OacBUsXfVZUU0zHjyCblYVs0HXRKXSg/PKNhjKnyUECIYr/mylLjHkZQKq/x s9LMjl0RZvdHKIiTLLpcjS9H0LhQ09bTo3GWUkc4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , Viresh Kumar , Jassi Brar Subject: [PATCH 5.11 684/775] mailbox: arm_mhuv2: Skip calling kfree() with invalid pointer Date: Mon, 1 Mar 2021 17:14:12 +0100 Message-Id: <20210301161235.181948940@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161201.679371205@linuxfoundation.org> References: <20210301161201.679371205@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Viresh Kumar commit 6b50df2b8c208a04d44b8df5b7baaf668ceb8fc3 upstream. It is possible that 'data' passed to kfree() is set to a error value instead of allocated space. Make sure it doesn't get called with invalid pointer. Fixes: 5a6338cce9f4 ("mailbox: arm_mhuv2: Add driver") Cc: v5.11 # v5.11 Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Viresh Kumar Signed-off-by: Jassi Brar Signed-off-by: Greg Kroah-Hartman --- drivers/mailbox/arm_mhuv2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/mailbox/arm_mhuv2.c +++ b/drivers/mailbox/arm_mhuv2.c @@ -699,7 +699,9 @@ static irqreturn_t mhuv2_receiver_interr ret = IRQ_HANDLED; } - kfree(data); + if (!IS_ERR(data)) + kfree(data); + return ret; }