Received: by 10.213.65.16 with SMTP id m16csp43042imf; Sun, 11 Mar 2018 14:11:19 -0700 (PDT) X-Google-Smtp-Source: AG47ELsBPOQC6JmMk14J0dIsIgFZemuV0NI4yfsX7kRerERA+YSylvGhovo98eb7x8HEezk57mCg X-Received: by 10.98.70.198 with SMTP id o67mr5664667pfi.173.1520802679032; Sun, 11 Mar 2018 14:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520802679; cv=none; d=google.com; s=arc-20160816; b=Sjgh16f+kUVHv3XQD54PIPD/c6ILdi5rhIgqV8ZEGCQ3DJdb15/bl6nctCFAuWPqkJ kd5WznmIP7vYtif/8oVWpVkNg5Mu2mwrpql9C8h3xD8ydDXp41JO3KzCb9QrTfbmvR7Y 4iSG31gPSFyIDEEY7oBe4ONZMns+fbZKOWY+1zJr4DbNnTSGw+XIIBnjI7eiCF8QISqn Y/4SuEZ+TvFInv6NrokXATs+OOdEPjFPQVIVhHpOOKNZvU0fFD8BgNSV5hZ9Z0fAiAYh m1e49JH23Uf+ogArN3fhxArI11OYB0j/ZyVPPeGa1HYNFROE09SnAlxCo8/cHQxzwAlE m8UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=M4Md3pv3NeiD1GgCHnYlv2PH6GeQaI2kGLg20hAVPaM=; b=T5y8ociOeijbFdPbZEC1XGkpc58DKM3XuC5cp3lroF9nXUDC0xRLkh40URndvIwz6k J+3kI8KIdtoblCnZDttxsbtWeAqpLTx3ZzbhOMqduAvfWc/1Vo5FcM+1qXotrZd5wXIG K/CG8a1I51TQb+2/gnH88IssmXXhkvF+gH9m6FSXhkZp21cBCb8boToGQjoaWkepoWIF 5nGECI+dsBRFNQwjZpuil7c6VDsFuSKXI8NabGXwB0mpSk1XfAnZ4byy29MxFXVuobme 6zVQac0TFO+4Fz45qT1XgdGpUiDhbC6it+y0Ss6looneZVebjA0TgYGG7dG+WAiMqdoY 0sDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kMOkZF63; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b17si4680482pfd.155.2018.03.11.14.11.05; Sun, 11 Mar 2018 14:11:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kMOkZF63; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932430AbeCKVKK (ORCPT + 99 others); Sun, 11 Mar 2018 17:10:10 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:50220 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932235AbeCKVKH (ORCPT ); Sun, 11 Mar 2018 17:10:07 -0400 Received: by mail-wm0-f68.google.com with SMTP id w128so12851089wmw.0; Sun, 11 Mar 2018 14:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=M4Md3pv3NeiD1GgCHnYlv2PH6GeQaI2kGLg20hAVPaM=; b=kMOkZF63utp4cyGXEpU56jnhaIG9LfUdVXgXJXc2O/xCd/BJ68zMaUwBFX0XG3w3y8 iXauNBFUZJEsgxppFi8zDNt4rWq4OZVurU72KLKPKH11mo6NgQ3B0Rrzwr0bHxuNzGbv 1JjQpF/1ypIoC+kffLlny7cZdq6hOTdLVzQD9Yv8mW+qNZZfYj8hhNC+mKWgl5z8Hk+Y a7epfbWCfz+YxGUEmEWfdkwrBrWaO5Xe1/9I8odUReY291lWZES4cn4rUcBjkZX65k6O 8Zj3KVO52kYRlr9omJFoiUUZ1cnDyBg+gfRHkeSxW9UyMrse7vRqNWE7VJ0PaJ04E3be riSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=M4Md3pv3NeiD1GgCHnYlv2PH6GeQaI2kGLg20hAVPaM=; b=DnwLyTwxBuMGHNNNBVqeSWVsOb7H8liluXm73J8kVYRIwrbPLLvFhEPVgxSkt8j97T kfjwTEZA9sq/ndOGViDHGpmWE3EuMEBzdi2On2Q2d1B3sjyuRBxsPpmwJlEL9UgY4Q03 E1CfTK8dq3t8hsaRxe6Ld4unhbIA20zvNpVn0Rtxx0zNEoe0QrRPGVS2wQaYAoHu6c6W +fzI9/99S6EvffyzvGUaNnr8EDGXGsXtKv5vl97FlcS18irT8BrVNbMEBVfLUf+M/EU4 zEpcKkJC5GOXSnjifRXacOyZ8qTVy8+M3DyHGfq0eFQSPhNZFqKFnJtVHT9zd+tFqynY 3hHA== X-Gm-Message-State: AElRT7HgG0rrCBcoq9mUI/zCWOE772MeIul8bDpdrOru2Sky2hwZpOBG kAhnLmEbfZxQh6ABm9Z+RM/psAveB/0= X-Received: by 10.28.23.74 with SMTP id 71mr3752990wmx.23.1520802606285; Sun, 11 Mar 2018 14:10:06 -0700 (PDT) Received: from localhost ([37.177.59.159]) by smtp.gmail.com with ESMTPSA id 10sm10053988wrv.95.2018.03.11.14.09.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 11 Mar 2018 14:10:05 -0700 (PDT) From: Salvatore Mesoraca To: linux-kernel@vger.kernel.org Cc: kernel-hardening@lists.openwall.com, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , Kees Cook , Salvatore Mesoraca , Santosh Shilimkar Subject: [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info() Date: Sun, 11 Mar 2018 22:07:50 +0100 Message-Id: <1520802470-17374-2-git-send-email-s.mesoraca16@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520802470-17374-1-git-send-email-s.mesoraca16@gmail.com> References: <1520802470-17374-1-git-send-email-s.mesoraca16@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Avoid VLA[1] by using an already allocated buffer passed by the caller. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Salvatore Mesoraca --- net/rds/connection.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/rds/connection.c b/net/rds/connection.c index f80792c..abef75d 100644 --- a/net/rds/connection.c +++ b/net/rds/connection.c @@ -578,9 +578,9 @@ static void rds_walk_conn_path_info(struct socket *sock, unsigned int len, struct rds_info_iterator *iter, struct rds_info_lengths *lens, int (*visitor)(struct rds_conn_path *, void *), + u64 *buffer, size_t item_len) { - u64 buffer[(item_len + 7) / 8]; struct hlist_head *head; struct rds_connection *conn; size_t i; @@ -649,8 +649,11 @@ static void rds_conn_info(struct socket *sock, unsigned int len, struct rds_info_iterator *iter, struct rds_info_lengths *lens) { + u64 buffer[(sizeof(struct rds_info_connection) + 7) / 8]; + rds_walk_conn_path_info(sock, len, iter, lens, rds_conn_info_visitor, + buffer, sizeof(struct rds_info_connection)); } -- 1.9.1