[PATCH] sctp: Fix len returned by getsockopt(sk, SCTP_GET_LOCAL_ADDRS, opt, &len)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A call to
  getsockopt(sk, SCTP_GET_LOCAL_ADDRS, opt, &optlen)
returns a wrong value in optlen, because it doesn't account struct sctp_getaddrs
preceding the actual addresses.

Signed-off-by: Petr Malat <petr.malat.ext@xxxxxxxxx>
---
 net/sctp/socket.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 6f45d17..9082269 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5560,6 +5560,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
 		err = -EFAULT;
 		goto out;
 	}
+	bytes_copied += offsetof(struct sctp_getaddrs, addrs);
 	if (put_user(bytes_copied, optlen))
 		err = -EFAULT;
 out:
-- 
1.7.11.3

--
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Networking Development]     [Linux OMAP]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux