Skip to content

Commit e379573

Browse files
tyhicksgregkh
authored andcommitted
irda: Only insert new objects into the global database via setsockopt
The irda_setsockopt() function conditionally allocates memory for a new self->ias_object or, in some cases, reuses the existing self->ias_object. Existing objects were incorrectly reinserted into the LM_IAS database which corrupted the doubly linked list used for the hashbin implementation of the LM_IAS database. When combined with a memory leak in irda_bind(), this issue could be leveraged to create a use-after-free vulnerability in the hashbin list. This patch fixes the issue by only inserting newly allocated objects into the database. CVE-2018-6555 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 77be945 commit e379573

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/staging/irda/net/af_irda.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,11 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
20192019
err = -EINVAL;
20202020
goto out;
20212021
}
2022-
irias_insert_object(ias_obj);
2022+
2023+
/* Only insert newly allocated objects */
2024+
if (free_ias)
2025+
irias_insert_object(ias_obj);
2026+
20232027
kfree(ias_opt);
20242028
break;
20252029
case IRLMP_IAS_DEL:

0 commit comments

Comments
 (0)