Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp676947pxb; Mon, 25 Oct 2021 16:28:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhcvMY0LKqppPz6hCTIZ4xMwcH31md8cuvFN7fxBp3WBq8fuabEMpJsxbIY/Ags6Gw+7AC X-Received: by 2002:a17:907:3e0b:: with SMTP id hp11mr25730420ejc.549.1635204511317; Mon, 25 Oct 2021 16:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635204511; cv=none; d=google.com; s=arc-20160816; b=LKEOu/6nglJ5FbU0xxRDXxBEcIpe/WwDk4c0Nrh3JfzNrVnyGxq/67Tv/nqBInJ6z9 hhkSbvNeQrDAuz0KuvfupP5+/0mC/zWkNJBT3gNB/pTnW5RYhZeOxmFNASPJmZyOCPfa mMxEkv7mKJGEYL+wVXC8bDtGNXVdjTpn8aJpltrnQb4PNDdu6+Q8Y1INYvdt3UevFcw5 CfEfEWsIE//EOtrV7nDT6u0552w77qhcPYxmjscoJ5Iylh1kr92mYDlLjDUlfqLbCDiW GYT2Qna5pWN+Jfr0abcUxEC7RacQwYM0mJ3lqtq0iOOnTzdoZ/KrBJ87sm9iEsfFi9Tp 7N1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F1yaJeFNlwZh+HVLByRrlU2K3HuFhd9G6EV5uNerSsY=; b=Mu/NptX2AdAO/Krzr0Sh/tgXD6RrdRSfbjREz4Jgm0Gcge+9SE8INaJeid9trJuBdH UyqngNqFnqjzrZP5rNdZVUy6Zew5icrhExSRQnVB/KcuH+C+ewe8RQdP0nLLLeRFXJy8 2xKZ3Yxoss2XUARMuGRnF+Pv6Csp3jOjYhHLb6t6KIL3vbVKjP4EejDD1Ov7iwwW5KYs 1LloSHyp0IshWtwqWbpdRJ5OdX4xx+FslWCzT7iWrqLR/LE3nGE6WDep88d5BmIQ3wST lBmaPa7GbsC/++ohtEcSemhd51vFM4dg6LBrAMwVVIwtGoOi5pinmjobAutjjzcStwnH /OBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mvSaS118; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nc21si4753225ejc.596.2021.10.25.16.28.07; Mon, 25 Oct 2021 16:28:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mvSaS118; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235225AbhJYT11 (ORCPT + 99 others); Mon, 25 Oct 2021 15:27:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:42554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235110AbhJYTZR (ORCPT ); Mon, 25 Oct 2021 15:25:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A0B5B60FDC; Mon, 25 Oct 2021 19:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635189750; bh=ZrsSBy57D8kFBiyUQ0yK6wBXOGDqNSH03H8z0Pjfs1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mvSaS118kcwdse+zP0BHBIZUTHZ3w4aXqPq37RrXNhUdmt70qk4GC50m7mWk1BLgU EY2QfKj6EbOmgDrhy5ZX+5QYYq6fzpAH1bfQRfNFhd+x/pbf/Vo8LAK0nkE+2AE71V raGoVmSS2YndxcQd0dvmpQpwFVUED2dT3nfeVcsI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Lin Ma , "David S. Miller" Subject: [PATCH 4.14 17/30] nfc: nci: fix the UAF of rf_conn_info object Date: Mon, 25 Oct 2021 21:14:37 +0200 Message-Id: <20211025190927.150505682@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190922.089277904@linuxfoundation.org> References: <20211025190922.089277904@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lin Ma commit 1b1499a817c90fd1ce9453a2c98d2a01cca0e775 upstream. The nci_core_conn_close_rsp_packet() function will release the conn_info with given conn_id. However, it needs to set the rf_conn_info to NULL to prevent other routines like nci_rf_intf_activated_ntf_packet() to trigger the UAF. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Lin Ma Signed-off-by: Krzysztof Kozlowski Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/nfc/nci/rsp.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/nfc/nci/rsp.c +++ b/net/nfc/nci/rsp.c @@ -289,6 +289,8 @@ static void nci_core_conn_close_rsp_pack ndev->cur_conn_id); if (conn_info) { list_del(&conn_info->list); + if (conn_info == ndev->rf_conn_info) + ndev->rf_conn_info = NULL; devm_kfree(&ndev->nfc_dev->dev, conn_info); } }