]> www.infradead.org Git - users/jedix/linux-maple.git/commit
rds: Calling getsockname() on unbounded socket generates seg fault
authorKa-Cheong Poon <ka-cheong.poon@oracle.com>
Mon, 18 Dec 2017 15:45:18 +0000 (07:45 -0800)
committerJack Vogel <jack.vogel@oracle.com>
Thu, 1 Feb 2018 23:08:47 +0000 (15:08 -0800)
commit56c2ca2103a914455c166f363b5d7d28551b9cbb
treeccf889ee6fe2f288c5aeb983d594a3da008dcfa9
parent9df5fd9575a428505c1b0294355ac532cc511a98
rds: Calling getsockname() on unbounded socket generates seg fault

If a socket is not yet bound, calling getsockname() should return an
unspecified address with family AF_UNSPEC as an RDS socket can be
bound to either an IPv4 or an IPv6 address.  Hence returning either
family is incorrect.  Currently, the returned address is set to an
unspecified address with family AF_INET6.  If the passed in buffer is
smaller than sizeof(struct sockaddr_in6), the app may get a
segmentation fault error.  This is similar to passing a buffer smaller
than sizeof(struct sockaddr_in) before the IPv6 changes.

Orabug: 27463484

Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: HÃ¥kon Bugge <haakon.bugge@oracle.com>
net/rds/af_rds.c