Skip to content

Commit ce54bf4

Browse files
tyhicksgregkh
authored andcommitted
irda: Fix memory leak caused by repeated binds of irda socket
The irda_bind() function allocates memory for self->ias_obj without checking to see if the socket is already bound. A userspace process could repeatedly bind the socket, have each new object added into the LM-IAS database, and lose the reference to the old object assigned to the socket to exhaust memory resources. This patch errors out of the bind operation when self->ias_obj is already assigned. CVE-2018-6554 Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Tyler Hicks <tyhicks@canonical.com> Reviewed-by: Seth Arnold <seth.arnold@canonical.com> Reviewed-by: Stefan Bader <stefan.bader@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a752280 commit ce54bf4

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

net/irda/af_irda.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,13 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
774774
return -EINVAL;
775775

776776
lock_sock(sk);
777+
778+
/* Ensure that the socket is not already bound */
779+
if (self->ias_obj) {
780+
err = -EINVAL;
781+
goto out;
782+
}
783+
777784
#ifdef CONFIG_IRDA_ULTRA
778785
/* Special care for Ultra sockets */
779786
if ((sk->sk_type == SOCK_DGRAM) &&

0 commit comments

Comments
 (0)