From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH v2] socket: fix struct ifreq size in compat ioctl Date: Thu, 13 Sep 2018 16:01:55 -0700 (PDT) Message-ID: <20180913.160155.409568197887579582.davem@davemloft.net> References: <20180913124055.14082-1-johannes@sipsolutions.net> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, robert@ocallahan.org, viro@zeniv.linux.org.uk, johannes.berg@intel.com To: johannes@sipsolutions.net Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:55620 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726558AbeINENb (ORCPT ); Fri, 14 Sep 2018 00:13:31 -0400 In-Reply-To: <20180913124055.14082-1-johannes@sipsolutions.net> Sender: netdev-owner@vger.kernel.org List-ID: From: Johannes Berg Date: Thu, 13 Sep 2018 14:40:55 +0200 > From: Johannes Berg > > As reported by Reobert O'Callahan, since Viro's commit to kill > dev_ifsioc() we attempt to copy too much data in compat mode, > which may lead to EFAULT when the 32-bit version of struct ifreq > sits at/near the end of a page boundary, and the next page isn't > mapped. > > Fix this by passing the approprate compat/non-compat size to copy > and using that, as before the dev_ifsioc() removal. This works > because only the embedded "struct ifmap" has different size, and > this is only used in SIOCGIFMAP/SIOCSIFMAP which has a different > handler. All other parts of the union are naturally compatible. > > This fixes https://bugzilla.kernel.org/show_bug.cgi?id=199469. > > Fixes: bf4405737f9f ("kill dev_ifsioc()") > Reported-by: Robert O'Callahan > Signed-off-by: Johannes Berg Applied and queued up for -stable, thanks Johannes.