Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3336027rwa; Tue, 23 Aug 2022 03:05:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR4DU6ox4jEFsLUKNKIwwsJKi5Eo+ybJrF7odr2NGRaG4LqluOMEWzdHQ0tEXtP1lMKt7kjK X-Received: by 2002:a05:6402:270a:b0:446:c9e9:6e00 with SMTP id y10-20020a056402270a00b00446c9e96e00mr2905901edd.315.1661249131821; Tue, 23 Aug 2022 03:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661249131; cv=none; d=google.com; s=arc-20160816; b=VSQhZ5ep1MerJO/IBoO6IhqwKHcy/XIVWE6E8gX5uphiu4kLTbzdC9c4wC6isqcY2I z13fC+2Rq3JRDvSBSbvWDA9r4jao3e4mpmdm3pspDxsx0PwSGRVaTdkGas4FQOpMMylO DvaRglxB5V6V8Ntm1SDqTMFnir4XOAqEfJMASraZqhpNjw9lb6j+pR073Pvz5FDT3gXM E9fAPplWs1WpEUxGTEAmdBnp5XiJ8rN+E/iQZI5DmIeFMeVeDyNFmp5Fby+0x8pgLBCY ev7ZXQ0VroxUdA6KRicT7zQwUWQnvnI+YZsnMeMNLM3FF2qqZHJMc4/pKlQUX9Ee1XoN wymg== 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=xdwZTRXOYyjTfliGxktKcJSgORjTraWJoBML8JX+8X8=; b=biftrFkbhu1YZPjbRrvhsvZcK3Z5NPKCxA0cxXebmQDFq08HDHtKH+P5KGtTWMZCa/ fT1r3D7ZnGhTwwNqC2wCnhVglezaRlk8B4MHzSV3SYHF2u4Ya8SW23cYUnPvgqvgcibX PE9Kgv1yjnr+Uzs01l3IOewXrkwCVEfSJr+rSUVQpJYCakvB9sCf/BTI6fNalx2uwzrs vVnv5uU+cDO8gwwTGdQJD6jiETV7En+ptGTUb4fE7+IDroNLzcls+2WURKmuhIWegExR EiBQgvf7k90+HDsO14/Bmg9yq2o0hmJzdxsMJTDQxcl6dpm+E5nroRdPVM2LmBn8ZJ1a Goaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y0CA77cj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020a056402358200b004460976236bsi1942767edc.144.2022.08.23.03.05.02; Tue, 23 Aug 2022 03:05:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y0CA77cj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1344774AbiHWJ6z (ORCPT + 99 others); Tue, 23 Aug 2022 05:58:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241531AbiHWJye (ORCPT ); Tue, 23 Aug 2022 05:54:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20ADC9FA8E; Tue, 23 Aug 2022 01:46:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BC87E61485; Tue, 23 Aug 2022 08:46:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF6CFC433C1; Tue, 23 Aug 2022 08:46:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244389; bh=gOe0zsjTFaGKaX1+mWyZEMX/nJdtJ2M8NjiPmFYYEEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y0CA77cjIkKGVTR+0x7a5Nhd59Vohcthm3ZbFAuczU0JWvjkwsTIYbUrHFhCTagwf gr+bN1UpT5+0ghlKPd7iUMTW963CRfIf/9MuTCE1Ly5Amb1KChspkDdOCDaNR87ihS THlbR5IWuc4LDiwaPdWZzAy3bfQpPo4xugHo9rKA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Yonghong Song , Martin KaFai Lau , Alexei Starovoitov Subject: [PATCH 5.15 048/244] bpf: Check the validity of max_rdwr_access for sock local storage map iterator Date: Tue, 23 Aug 2022 10:23:27 +0200 Message-Id: <20220823080100.671938641@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hou Tao commit 52bd05eb7c88e1ad8541a48873188ccebca9da26 upstream. The value of sock local storage map is writable in map iterator, so check max_rdwr_access instead of max_rdonly_access. Fixes: 5ce6e77c7edf ("bpf: Implement bpf iterator for sock local storage map") Signed-off-by: Hou Tao Acked-by: Yonghong Song Acked-by: Martin KaFai Lau Link: https://lore.kernel.org/r/20220810080538.1845898-6-houtao@huaweicloud.com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman --- net/core/bpf_sk_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/core/bpf_sk_storage.c +++ b/net/core/bpf_sk_storage.c @@ -894,7 +894,7 @@ static int bpf_iter_attach_map(struct bp if (map->map_type != BPF_MAP_TYPE_SK_STORAGE) goto put_map; - if (prog->aux->max_rdonly_access > map->value_size) { + if (prog->aux->max_rdwr_access > map->value_size) { err = -EACCES; goto put_map; }