Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3538353yba; Tue, 16 Apr 2019 13:32:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWiHSo5cfDTew2N8uR1E/nDBLhIluoTDyx2E0iGbfPDY4ZNJwId7bFWZRz/dg7CSyxvkyK X-Received: by 2002:a65:6091:: with SMTP id t17mr42067267pgu.328.1555446759156; Tue, 16 Apr 2019 13:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555446759; cv=none; d=google.com; s=arc-20160816; b=HlHR21Ss6OdHn8FPn6L/xMHr/fPjlQ4WmwipK9TaisvuC5W1f+bVkY1zkVwYaY/eDZ B7yQ3aL1hUErB/wy9fp84rK0ubxRVK8sPBh21ssTlUTlaMBUpBy41kd81L/ShEGVMe09 NrLx1eLjHR+lJFy+b4CQY4OyL/Um6qPn9scLltVbBoPLXpjTsg8siIQl600kWgAyX4Qe 34MHz1mG8YzaK0/x+aCdF5jaeNxlPBe3UTajjmUL9Ag7ub9kWwL9i2WIJJZmaAACIOA+ RgbBGlJnt/Dg0jk4jy6PWDvjBzCfP4F6hWhH82tCUSIWF+AI1Jp/Ro89xoGIB7rZgwoH ycfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=IjYh6gxVYrmfMcNZUQJZz3WAeZeSwGLw5vyAwUc4yyI=; b=s3CIwQ7Ve6LO+8ELbxAm4g6ZpGx+vKILHU8Uu8LboleSPygjsajmYJ7hccNH8QN0PW UevG+DuIUesTr1XhiKEZsaXqiQRzEwGjiCeCfLbDx0eevfNPJCkfuiycxQR37VX89sXV ILC+xRB8dtKBusHd5HLkdNFakMykBiqXCupm/SyLusXR7i2lKva/Ni0mPguZjfnRuh9/ f+Hmsk9xDNCJnnT/ltv0CY4R6gHrBEO00kYtWVj9OOan1TpSJp2NsfVvHw1PAN7WVW8Y snDKzLMcBikIJacdxXD3SGrV62uj5qC4TfddX0wjOdCelrKAp0kkThGKzWYZF+ZFraB2 My7Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h189si36642277pfc.283.2019.04.16.13.32.23; Tue, 16 Apr 2019 13:32:39 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730749AbfDPUbw (ORCPT + 99 others); Tue, 16 Apr 2019 16:31:52 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:43555 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730325AbfDPUbw (ORCPT ); Tue, 16 Apr 2019 16:31:52 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPA (Nemesis) id 1N2mS2-1grMbt2AaS-0134ab; Tue, 16 Apr 2019 22:31:45 +0200 From: Arnd Bergmann To: "David S. Miller" , Eric Dumazet , Willem de Bruijn , Deepa Dinamani , Arnd Bergmann Cc: Yafang Shao , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net] socket: fix compat SO_RCVTIMEO_NEW/SO_SNDTIMEO_NEW Date: Tue, 16 Apr 2019 22:31:14 +0200 Message-Id: <20190416203143.408835-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1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-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It looks like the new socket options only work correctly for native execution, but in case of compat mode fall back to the old behavior as we ignore the 'old_timeval' flag. Rework so we treat SO_RCVTIMEO_NEW/SO_SNDTIMEO_NEW the same way in compat and native 32-bit mode. Cc: Deepa Dinamani Fixes: a9beb86ae6e5 ("sock: Add SO_RCVTIMEO_NEW and SO_SNDTIMEO_NEW") Signed-off-by: Arnd Bergmann --- net/core/sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c index dc7c31d66200..1e418c0b3b73 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -348,7 +348,7 @@ static int sock_get_timeout(long timeo, void *optval, bool old_timeval) tv.tv_usec = ((timeo % HZ) * USEC_PER_SEC) / HZ; } - if (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) { + if (old_timeval && in_compat_syscall() && !COMPAT_USE_64BIT_TIME) { struct old_timeval32 tv32 = { tv.tv_sec, tv.tv_usec }; *(struct old_timeval32 *)optval = tv32; return sizeof(tv32); @@ -372,7 +372,7 @@ static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen, bool { struct __kernel_sock_timeval tv; - if (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) { + if (old_timeval && in_compat_syscall() && !COMPAT_USE_64BIT_TIME) { struct old_timeval32 tv32; if (optlen < sizeof(tv32)) -- 2.20.0