From patchwork Sun Mar 11 21:07:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salvatore Mesoraca X-Patchwork-Id: 10274949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0666D602C2 for ; Sun, 11 Mar 2018 21:10:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBDFA289E4 for ; Sun, 11 Mar 2018 21:10:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E08BD28AE6; Sun, 11 Mar 2018 21:10:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 26676289E4 for ; Sun, 11 Mar 2018 21:10:19 +0000 (UTC) Received: (qmail 9599 invoked by uid 550); 11 Mar 2018 21:10:18 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 9564 invoked from network); 11 Mar 2018 21:10:17 -0000 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=Q+PVUqc75L1MAf8OQVJH7ZuftL9WQD/apnXz6zqbnIf6y+nYhxhzO5c4JbgTV+IxSv e0/Vi2nXS/jDuYRJyjoa8WyWik60+A91DN6I506zQ32pId0EQgmxvJYf5FesN+8bjVWW QgI/xq6WpvC7dJtGZX6/Wb8sjf/9RRj9SP9BgsbFpHvf8Uy+VlRNk8AO2KaCv8J3fQSf RJw6IN2WDG/sl5O1C6Lhw0J/qpe42zMiMv6OgUbK7fgSTOZW0P6yfu7jZUwR4FPKx4JL dGn8YxbBfJyYzLWMwZj1ZHfhM6Y8qGOGeURDMBykbo8KVmqklWK7bJ+ORi7LetF3k9xC 55pw== X-Gm-Message-State: AElRT7FvrzKUZ8jFYfoIuVS/eyIHWYVM3tz19+PbtY6F+RAW4wpYFySn fethGjVC0tT+V9keZE33Vxk= X-Google-Smtp-Source: AG47ELvI2CnldQ5Nn9NioSOE7jxd1NLv2wCwXfq1rIx37SP3FJDRYKQFR5cGm6MPQq9AKHEHg/+vFA== X-Received: by 10.28.23.74 with SMTP id 71mr3752990wmx.23.1520802606285; Sun, 11 Mar 2018 14:10:06 -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> X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Santosh Shilimkar --- 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)); }