From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF0B5C432BE for ; Tue, 31 Aug 2021 16:30:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D6CDA603E7 for ; Tue, 31 Aug 2021 16:30:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240055AbhHaQbD (ORCPT ); Tue, 31 Aug 2021 12:31:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:49534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232154AbhHaQbC (ORCPT ); Tue, 31 Aug 2021 12:31:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F346161059; Tue, 31 Aug 2021 16:30:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630427407; bh=oS6FPhfGA9uHONj8JonlYpU1cjtCApQRJpGyzgauwhU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=WLfASnLau17NvNBWuflwQHWHajfCbILPqOro93Ch+gCamwOMa2WrNWPnrBa2RPkE0 NxRJLmcN5RK+2mDmT+pFYJPqSvCRnncQjpOIpDNTGBsSCijdecCSl7bXwBWF1Tqi9F nV4/6a51lkKiIOXGFj/fbxxYqutVeGX58nF7sCbVstaYobEGv0jtAse6C7ZCjcucrQ nTooisKp9R4uG0agQQ1wSY/OpgilVkO9q38EpEUooxTFfSllgpEzG2e2fl5N1m20/L bE7VRDPVYjqQutzxucQFP50NYzQsHgNAPVNGRI6dxRPOdzfU1iPhqo7Z2NOiRBBHk1 BMxKyhfzoi/HA== Date: Tue, 31 Aug 2021 09:30:06 -0700 From: Jakub Kicinski To: Peter Collingbourne Cc: "David S. Miller" , Colin Ian King , Cong Wang , Al Viro , Greg KH , David Laight , Arnd Bergmann , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] net: don't unconditionally copy_from_user a struct ifreq for socket ioctls Message-ID: <20210831093006.6db30672@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20210826194601.3509717-1-pcc@google.com> References: <20210826194601.3509717-1-pcc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 26 Aug 2021 12:46:01 -0700 Peter Collingbourne wrote: > @@ -3306,6 +3308,8 @@ static int compat_ifr_data_ioctl(struct net *net, unsigned int cmd, > struct ifreq ifreq; > u32 data32; > > + if (!is_socket_ioctl_cmd(cmd)) > + return -ENOTTY; > if (copy_from_user(ifreq.ifr_name, u_ifreq32->ifr_name, IFNAMSIZ)) > return -EFAULT; > if (get_user(data32, &u_ifreq32->ifr_data)) Hi Peter, when resolving the net -> net-next merge conflict I couldn't figure out why this chunk is needed. It seems all callers of compat_ifr_data_ioctl() already made sure it's a socket IOCTL. Please double check my resolution (tip of net-next) and if this is indeed unnecessary perhaps send a cleanup? Thanks!