Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2121152lkv; Thu, 20 May 2021 03:55:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzz18zVwTbK9unvyPFwqvcY8WLg1xHF6/UWqXD0+rTKiAxMMJPfBkAXkFJ3FOOq0gpsFD7Y X-Received: by 2002:a17:906:a294:: with SMTP id i20mr4212100ejz.86.1621508115860; Thu, 20 May 2021 03:55:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621508115; cv=none; d=google.com; s=arc-20160816; b=OGg5uVVw7Jdq3+1Gqjo795RxpNJpSTB+X6nsq3s8J0aJDoHpjaMrfME3rZ3+ITkeMw kTYHLdT7WmplxwiQQd9OXOfrXsNOXhbRcI0pHY4ti/t3MowOOxNv8K47tE9D/9h0XzNX HQFQBmywXiLYQtdf6X8RfowaLcOSJLk/BXVEqS81zIHNQu3uJOiBezGHS/VcsyXX1yU4 t1heuB9d5ZTXkD2HS0luiMAuBkKfSHJhIEflfRYRtbyD3y2AgDdi6rtoXLuxPX7C6fly aiBpeJ8z2IGpup1aRhsB4AoSRwbBi6RA10yICPAIYX1nYuWXl1oeV+Jf+r3XmL/aaqO5 D7+g== 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=VzJPFhwwwV98CG3pFr7YF4zo3MXKycw78TDeFiCG2Kc=; b=FKAcM5FixwCZ4jfUDac72aeRB8KDEYZYrpuq+fqgVcYTh7sKgW/m8gFkCFyNicZu9Y UMNQQ/29uoI94sM+MCYF2orNNRw4AxauQrWbUN/ZnkM9ugBYwvVslkL1O9vFxiH53XHr kSUbtOXG71sLQ6ikmGeHwVcwxjDcKzgeFRP+O2EevlE/UjOU1b2N6xQitz5aD4IESAYa AurYozoj1bU7IYPD1emKI0GVAptu7s4PbRdB4FCANzI+sfbcK7qSXAJzK/wn76z0WnkE GMJzP1fCMLLSW36Hv7gL6t/NmMu+ZLlPuMjoRgiXO1R3odp94UNlCeg2qOEyuk0ouOnc iuIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kh7RgF1l; 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 z25si1705162edx.141.2021.05.20.03.54.42; Thu, 20 May 2021 03:55: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=kh7RgF1l; 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 S238503AbhETKyK (ORCPT + 99 others); Thu, 20 May 2021 06:54:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:39658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237731AbhETKil (ORCPT ); Thu, 20 May 2021 06:38:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 25DF061C7A; Thu, 20 May 2021 09:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504501; bh=pf4q7Vz/P4NkC7ZWOtLeCuVejZZZaIaYpAQ4N/mJNlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kh7RgF1lIDQSaP05sLrlUb3t4YMheWZAZXM9DhX5b3ReA3SJHM8zJ36zQLRPKpYXS 3ssqa/pogub2N5VCpF4T8jdCydoagpYGn+H+K9GIO5BN5E7usp8GTT8Ec9sPYPZXgG HoNu2GuBmnehlZV2ksf2unN3WaPEne1VSBMfOs9c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nucca Chen , Cong Wang , David Ahern , "David S. Miller" , Jakub Kicinski , Jamal Hadi Salim , Jiri Pirko , Jiri Pirko , Sasha Levin Subject: [PATCH 4.14 273/323] net: fix nla_strcmp to handle more then one trailing null character Date: Thu, 20 May 2021 11:22:45 +0200 Message-Id: <20210520092129.580420942@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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: Maciej Żenczykowski [ Upstream commit 2c16db6c92b0ee4aa61e88366df82169e83c3f7e ] Android userspace has been using TCA_KIND with a char[IFNAMESIZ] many-null-terminated buffer containing the string 'bpf'. This works on 4.19 and ceases to work on 5.10. I'm not entirely sure what fixes tag to use, but I think the issue was likely introduced in the below mentioned 5.4 commit. Reported-by: Nucca Chen Cc: Cong Wang Cc: David Ahern Cc: David S. Miller Cc: Jakub Kicinski Cc: Jamal Hadi Salim Cc: Jiri Pirko Cc: Jiri Pirko Fixes: 62794fc4fbf5 ("net_sched: add max len check for TCA_KIND") Change-Id: I66dc281f165a2858fc29a44869a270a2d698a82b Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- lib/nlattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nlattr.c b/lib/nlattr.c index 3d8295c85505..5cf179aeefe6 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c @@ -379,7 +379,7 @@ int nla_strcmp(const struct nlattr *nla, const char *str) int attrlen = nla_len(nla); int d; - if (attrlen > 0 && buf[attrlen - 1] == '\0') + while (attrlen > 0 && buf[attrlen - 1] == '\0') attrlen--; d = attrlen - len; -- 2.30.2