Skip to content

Commit e698642

Browse files
arndbdavem330
authored andcommitted
socket: fix compat SO_RCVTIMEO_NEW/SO_SNDTIMEO_NEW
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 <deepa.kernel@gmail.com> Fixes: a9beb86 ("sock: Add SO_RCVTIMEO_NEW and SO_SNDTIMEO_NEW") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Deepa Dinamani <deepa.kernel@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 50ce163 commit e698642

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎net/core/sock.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static int sock_get_timeout(long timeo, void *optval, bool old_timeval)
348348
tv.tv_usec = ((timeo % HZ) * USEC_PER_SEC) / HZ;
349349
}
350350

351-
if (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) {
351+
if (old_timeval && in_compat_syscall() && !COMPAT_USE_64BIT_TIME) {
352352
struct old_timeval32 tv32 = { tv.tv_sec, tv.tv_usec };
353353
*(struct old_timeval32 *)optval = tv32;
354354
return sizeof(tv32);
@@ -372,7 +372,7 @@ static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen, bool
372372
{
373373
struct __kernel_sock_timeval tv;
374374

375-
if (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) {
375+
if (old_timeval && in_compat_syscall() && !COMPAT_USE_64BIT_TIME) {
376376
struct old_timeval32 tv32;
377377

378378
if (optlen < sizeof(tv32))

0 commit comments

Comments
 (0)