Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp721479imm; Thu, 13 Sep 2018 06:49:38 -0700 (PDT) X-Google-Smtp-Source: ANB0VdasYZLVqi3OZwYfgbTWmSZY1uJmDZVg5BC/MZopb657JmSQHSM4nnR+WF/pOg72w1KU80Q5 X-Received: by 2002:a17:902:49:: with SMTP id 67-v6mr7591180pla.206.1536846578105; Thu, 13 Sep 2018 06:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846578; cv=none; d=google.com; s=arc-20160816; b=GfemCvkgHEacu79v07cJAy6/VN64UkH6YR1GxLTlAltsgx1oi2qTN2zhvS+EqmzOjh P92bcCm9I7dQXcqXa29EjVexWzG+uz1+2eF5WDi9P4kXSaLZYib1qlMclhVHRaa7h/1I G1+FEMr7ETxaTNDxjCzgqy0XqRQEf2tHiLMGX52S4TRFnx7JorvWIbOAZqMZ0IwcI6pp wOIRL4TCYwBhABPzZX+9mj0pubOxHake9aDeEtjbPv4JF5v2DbhJgqU8MmLxyShQBalR /OLK/6fnWKnBGO+e/WzlIIQPGB/vHShaEQiXpG7bnFW9tRu0vLsFmtXWAzcIibAmIJLB yZqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=qOXO6TLVQgycmeS2VJWdvLcits71F+lY346ozWGhYpA=; b=ySTXIc8pKENzufRqRNVbwXoj8yRQ2sIs0uJH3iMqIgPB4IIWkzWI5kpquxXxaHiRi7 mjWU5Owtb7QvRyF8M6o/o6Kajbtn31+KCGqq9qf+RjAoNH2a6cocxTk6fNutWH0vy7FL ErP1nQ//6PfdHfnEbsMkIxDSBol9DBEiEGk4+oTIRcurqteTCCcO+mYAWtrO/MkJpl/O oNJ1VBTx9kryyb65T9oA3lhIVXcQ4zKya0aZuoJDbqc5OAw3LLoBsG2l6VADngwKdnBm n8jDhRyBSHS6Nviluu18r1N7WovhLGakw1u3RTdg2G4omElchys9leIsar8vwBo9171C 8axw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7-v6si4317635pfj.245.2018.09.13.06.49.23; Thu, 13 Sep 2018 06:49:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730544AbeIMS60 (ORCPT + 99 others); Thu, 13 Sep 2018 14:58:26 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:32962 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730413AbeIMS60 (ORCPT ); Thu, 13 Sep 2018 14:58:26 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 30E92D1A; Thu, 13 Sep 2018 13:48:52 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Tyler Hicks , Seth Arnold , Stefan Bader Subject: [PATCH 4.14 108/115] irda: Only insert new objects into the global database via setsockopt Date: Thu, 13 Sep 2018 15:32:08 +0200 Message-Id: <20180913131829.954526389@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131823.327472833@linuxfoundation.org> References: <20180913131823.327472833@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tyler Hicks 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") Signed-off-by: Tyler Hicks Reviewed-by: Seth Arnold Reviewed-by: Stefan Bader Signed-off-by: Greg Kroah-Hartman --- drivers/staging/irda/net/af_irda.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/staging/irda/net/af_irda.c +++ b/drivers/staging/irda/net/af_irda.c @@ -2019,7 +2019,11 @@ static int irda_setsockopt(struct socket 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: