aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorTyler Hicks <tyhicks@canonical.com>2018-09-04 15:24:05 +0000
committerMoyster <oysterized@gmail.com>2019-05-03 18:55:13 +0200
commite3294a62938eb7d310d9fb1b0f430bef46a80beb (patch)
treece1ea9bc163cd0bcb25af7c6e83c7ffa94d8ac32 /net
parent8b10052924761b584d0cf156e265f14942bff9bf (diff)
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: 1da177e4c3f4 ("Linux-2.6.12-rc2") Change-Id: Ia3a3b6888ea40dec69bf950a65c53e054fb0029f 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> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'net')
-rw-r--r--net/irda/af_irda.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 624ccc9aa..3aa5e64db 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -2059,7 +2059,11 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
err = -EINVAL;
goto out;
}
- irias_insert_object(ias_obj);
+
+ /* Only insert newly allocated objects */
+ if (free_ias)
+ irias_insert_object(ias_obj);
+
kfree(ias_opt);
break;
case IRLMP_IAS_DEL: