Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2487963pxj; Mon, 10 May 2021 04:18:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAQa6h7y0Q+hs0lALwsDfc2AETFeZBDgviMydw+95BmOfOKghGYKKkTu1z/7V4dJr+KAMa X-Received: by 2002:a05:6402:34c7:: with SMTP id w7mr29231264edc.42.1620645495562; Mon, 10 May 2021 04:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645495; cv=none; d=google.com; s=arc-20160816; b=JBIosAQtPpqASwlJz4aUv8BsRuhkg71+iyImeVv+K07v8zCwPX7LUyH9A/nxhhWTKb peXDO+YDLmabRidTIpjWuCb3Qu/5SkakbJ6l+GSWJFVMzbIL6izfe5rN1EEzyKSJrGpX bYkrGX8hbmw1x8+sIEMgCBxHb1cJvF4Hk5dcLf5bgyVAf/mTYOcPVIu1nr7d3lMuM5yI l5z9izML/6kgwnEROj9kObSHBkBOfopb1zD1q4LHBVxS+kjVP/Z9h1/ooomwgBbeUXVQ wxyTo8XcyljmuJ1kejBebGME8W1i6+vtZLsqdizioaq8M8cEyBDOjmkfgR0iHjVEll44 Hgjg== 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=q61OPrQXZO7qy8eYVsfgrpb0PhSaSXjiud3U4wDC58U=; b=jrtK9lowe/BzOOaqto+z4OX5DX8zNaxZEYFvXVY0DsJV53TJ+NYJ14yUaF7+WGO55D 9EAbqXOyRsCj8/TZsF3NrShVFU16gBcJCW9taXXovL5M0Xc3aoAlQCwZuDOSsH9STV8L VtYCrJzd17OlNHmEQ+1Xgi2LPvSdt4i9A1xgj+/4EjQpBV2axBTkLcWFwaehRhI31dIF kr8H0sBeVUCLahHKE5VIgRMHE/0NejWD8U4pIMGNi2Zp4UDU6jbi15C0HzcjNJj2RSxk 6c0BU0jQJskSs9piaa69olmPKzjhLtKUzO7uyQlIrdSJBFs9oQ/6nIBtnubgKzUEFt/o HmbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sp7RiJem; 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=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 o18si13373375edc.137.2021.05.10.04.17.52; Mon, 10 May 2021 04:18:15 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=Sp7RiJem; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235459AbhEJLNX (ORCPT + 99 others); Mon, 10 May 2021 07:13:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:41914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233599AbhEJKuR (ORCPT ); Mon, 10 May 2021 06:50:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5380761A13; Mon, 10 May 2021 10:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643172; bh=Xf+puenA/PUhO6WkOQj7oPaNgZ6nEmCspFlKaCdmti0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sp7RiJemB+F0yGEoFKIk6tmMxtRtA5lKZ/lO2eB+bHgecrZvuPrAEsQ+xdNpaCQSo kXbg9p8R38NZWwzS8ucM7cdhV+X5XCz24TeR5bfbNQdmIdztHgJpqRkFoPfjr0gK+j TdgLYJQpjEI4nSxe9x4zLi/ZEcGBf+h/GVApwJIk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guangqing Zhu , Tony Lindgren , Carl Philipp Klemm , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.10 208/299] power: supply: cpcap-battery: fix invalid usage of list cursor Date: Mon, 10 May 2021 12:20:05 +0200 Message-Id: <20210510102011.818616470@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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: Guangqing Zhu [ Upstream commit d0a43c12ee9f57ddb284272187bd18726c2c2c98 ] Fix invalid usage of a list_for_each_entry in cpcap_battery_irq_thread(). Empty list or fully traversed list points to list head, which is not NULL (and before the first element containing real data). Signed-off-by: Guangqing Zhu Reviewed-by: Tony Lindgren Reviewed-by: Carl Philipp Klemm Tested-by: Carl Philipp Klemm Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/power/supply/cpcap-battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c index cebc5c8fda1b..793d4ca52f8a 100644 --- a/drivers/power/supply/cpcap-battery.c +++ b/drivers/power/supply/cpcap-battery.c @@ -626,7 +626,7 @@ static irqreturn_t cpcap_battery_irq_thread(int irq, void *data) break; } - if (!d) + if (list_entry_is_head(d, &ddata->irq_list, node)) return IRQ_NONE; latest = cpcap_battery_latest(ddata); -- 2.30.2