Skip to content

Commit 77be945

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 <[email protected]> Reviewed-by: Seth Arnold <[email protected]> Reviewed-by: Stefan Bader <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 63fd9d4 commit 77be945

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/staging/irda/net/af_irda.c

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

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

0 commit comments

Comments
 (0)