Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2678106pxb; Mon, 19 Apr 2021 11:03:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNlaus8iujyN821VOTz0wik1aiqK5nikxAf1SizChHQtYyDONmlXAhvxNottXGeSuIYHuk X-Received: by 2002:adf:ce07:: with SMTP id p7mr16335646wrn.53.1618855394199; Mon, 19 Apr 2021 11:03:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618855394; cv=none; d=google.com; s=arc-20160816; b=lnCegIBdAzMLqVSj03R4Qi9qz3AxF8gdMloIt1a02ABiuUifA3Wj7mITXcCrqC+Lvs wCb+A8ZqHXRWbJHL33+n+Nz5eCuTbQGB6I97nwcPhvm5RKk1iqDdZR07w+yldpuvBRtd fif+86NH7Lo4Dfc4q55b4+UaTnCwTDTD27d0Oin0K8AE2iFWHOWETk38jW+etHwCdKqG H3S++Rhq6o4qGZLulQXTjA7WrB9gUv81pcbXDZutJ6CgiaLm34DNRTuAx6nE277agGCo 3zERb++LSnrh3OHoTTlvaaySSp2XQPNwvHciU6LfZ0aOxZSXCvqd5wQUEn4VrybcpQre j8sw== 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=plwmrVh3/zqDwSpLtJ+2d/Nj9qnMgCGGzuA/gFJQm7Y=; b=hkI6V3TbmCkqgC0vG2jsHSXnVnt3eegMARPjNeaPv0F3TYDF794PpbKa6+mDKILO0F rMHzRMScaLIMXYWXmXwS3Twx4RHPYsr6U98I0IedV3pFjdu9aPzFUUcO0//ww2jwdFzy uJcJj7PUm4Ps4XA4FcBng8pOmL4i0QmzneXs69sYv/hO/yfvQ9bSnUsGpP+9DeWM16Db qvzMm1K1DdN/JJdFE/L21Dge4y6pRN8itIysy5L3WOvsDiXa63A1Smc/l14sEfviCcoS 8VPaKS8C1DyRKw3bDxLe6R+4cOJSn6k1iKFL8KsvKe7X62F5e5gKKnIIYuWrIWSGV3vD sReA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sa31m7vu; 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 y15si12686943ejb.688.2021.04.19.11.02.50; Mon, 19 Apr 2021 11:03:14 -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=Sa31m7vu; 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 S241721AbhDSNhh (ORCPT + 99 others); Mon, 19 Apr 2021 09:37:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:34814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242064AbhDSNZQ (ORCPT ); Mon, 19 Apr 2021 09:25:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5624C613C2; Mon, 19 Apr 2021 13:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618838424; bh=a5wCfOGJQWW5KdkqJShWnNNebQHSGOal7vr47/aMm/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sa31m7vuKekbmTr0brXtKBfGzyQOUJI7irp3wsKheFx38HBpmFCwLMGLdMQIacMqu Ej1KmOCzSP06sUtCLdTwqgWrDnQhXq5LmSoTl1slCXeHJjBHnT1aIzlz+hVBKtAZLM XooWTMEiECukh3P3t8MrytGA/Lqov0ZRrASDmQPE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , "David S. Miller" Subject: [PATCH 5.4 54/73] net: macb: fix the restore of cmp registers Date: Mon, 19 Apr 2021 15:06:45 +0200 Message-Id: <20210419130525.570992940@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419130523.802169214@linuxfoundation.org> References: <20210419130523.802169214@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: Claudiu Beznea commit a714e27ea8bdee2b238748029d31472d0a65b611 upstream. Commit a14d273ba159 ("net: macb: restore cmp registers on resume path") introduces the restore of CMP registers on resume path. In case the IP doesn't support type 2 screeners (zero on DCFG8 register) the struct macb::rx_fs_list::list is not initialized and thus the list_for_each_entry(item, &bp->rx_fs_list.list, list) loop introduced in commit a14d273ba159 ("net: macb: restore cmp registers on resume path") will access an uninitialized list leading to crash. Thus, initialize the struct macb::rx_fs_list::list without taking into account if the IP supports type 2 screeners or not. Fixes: a14d273ba159 ("net: macb: restore cmp registers on resume path") Signed-off-by: Claudiu Beznea Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3590,6 +3590,7 @@ static int macb_init(struct platform_dev reg = gem_readl(bp, DCFG8); bp->max_tuples = min((GEM_BFEXT(SCR2CMP, reg) / 3), GEM_BFEXT(T2SCR, reg)); + INIT_LIST_HEAD(&bp->rx_fs_list.list); if (bp->max_tuples > 0) { /* also needs one ethtype match to check IPv4 */ if (GEM_BFEXT(SCR2ETH, reg) > 0) { @@ -3600,7 +3601,6 @@ static int macb_init(struct platform_dev /* Filtering is supported in hw but don't enable it in kernel now */ dev->hw_features |= NETIF_F_NTUPLE; /* init Rx flow definitions */ - INIT_LIST_HEAD(&bp->rx_fs_list.list); bp->rx_fs_list.count = 0; spin_lock_init(&bp->rx_fs_lock); } else