Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1978338pxb; Fri, 5 Mar 2021 04:38:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyi0QZ0s9LaiBflGRPzYZ9xBKs30+RK/QBfKMQVipoCLoo8SmMUqXsKI7YP7I1QYmkVN3jD X-Received: by 2002:a17:906:5d06:: with SMTP id g6mr2084799ejt.216.1614947883823; Fri, 05 Mar 2021 04:38:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614947883; cv=none; d=google.com; s=arc-20160816; b=Pq8NIbjZvYbBS8YZnehtytVBixiIzoK5M28FQz4IdnBThmzafvAqXsa/oO2FKZobQd jiGgfvGfHjIGJbFh0bQp3mCvwri1bn1dpxKauK4c7r83vVSUrjsahf3HyG65UQ7Zu76m dE1NFKrUlWQOpPK0oYjA6uvVQTz7GfFqcuz7/fEPfQhz/H3J5Xl5HPNmWh10CHzk+URJ kdGfze7Cp4g69BwH/Yvn9TxKoLWoTIFa2++MWqexOaqFrJOL6xg8xMHWPbqrGhS0ENbm +AEYb4kVveIdM1t6wAQFVlzPw41eGd1DHvM/f01/Sb6DkH8dNCrxAspjiEl11olmCgod H3CQ== 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=MjXHplbOiTDuVQL0Zp/rWiIsT2bNd98Bz7l8Pk/pmR0=; b=PVrsBzDZ/1IFdDJky+XOU0MxtN5781/C6L+r3hST2B4jl5SKjqOkflT8ADw/bAwHK+ MfPyQ05BUE4cKNZz6SKKTeFPeHsdRwUsprYbLgymOwwqASmBCjngiqevYlm9DqBCZSP+ mPmZL6QMaF3mkOLuD9WYBtRydqUNFRq+U2MkWB4XiRNUTsWJcm95/VcLKxS7QNYUR6kq rdmNT1yKEEtPfXuudJP/NsOsphwMWRC1EGaZ1iWFKxtxWfbCZraX+qkUh/gakIXGBxfq y9CklVWwyvcsQ9UYLv7WaiKjfljkZ8kvrBKWFXzRMAF5Cr4+oRehLvci7C5utie3wyTj IMHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KOM4/N/W"; 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 x11si1410083edd.560.2021.03.05.04.37.39; Fri, 05 Mar 2021 04:38:03 -0800 (PST) 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="KOM4/N/W"; 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 S232569AbhCEMew (ORCPT + 99 others); Fri, 5 Mar 2021 07:34:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:45674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231387AbhCEMeN (ORCPT ); Fri, 5 Mar 2021 07:34:13 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9E2B16501D; Fri, 5 Mar 2021 12:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947653; bh=Mz+lubvSBGbLo+GRYUVMAnYBklGNM92y7SYL1IZQJbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KOM4/N/WmGokRf84jhjI20kiTS2mvr3XfRbpGlZB0e2vzrNXD7L4afuvXTOVOqw6N 6nMfUfcWfzGF530GcTwYzwQFe/abSZf2PSnTnCxjTF9yF3XT26+5+xYJlzlufUGMda xLsc52h42UeVwtNyxf8DMtSGFJIGDiRIpVAaw+CE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gopal Tiwari , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.4 36/72] Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data Date: Fri, 5 Mar 2021 13:21:38 +0100 Message-Id: <20210305120859.105809493@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120857.341630346@linuxfoundation.org> References: <20210305120857.341630346@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: Gopal Tiwari [ Upstream commit e8bd76ede155fd54d8c41d045dda43cd3174d506 ] kernel panic trace looks like: #5 [ffffb9e08698fc80] do_page_fault at ffffffffb666e0d7 #6 [ffffb9e08698fcb0] page_fault at ffffffffb70010fe [exception RIP: amp_read_loc_assoc_final_data+63] RIP: ffffffffc06ab54f RSP: ffffb9e08698fd68 RFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff8c8845a5a000 RCX: 0000000000000004 RDX: 0000000000000000 RSI: ffff8c8b9153d000 RDI: ffff8c8845a5a000 RBP: ffffb9e08698fe40 R8: 00000000000330e0 R9: ffffffffc0675c94 R10: ffffb9e08698fe58 R11: 0000000000000001 R12: ffff8c8b9cbf6200 R13: 0000000000000000 R14: 0000000000000000 R15: ffff8c8b2026da0b ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 #7 [ffffb9e08698fda8] hci_event_packet at ffffffffc0676904 [bluetooth] #8 [ffffb9e08698fe50] hci_rx_work at ffffffffc06629ac [bluetooth] #9 [ffffb9e08698fe98] process_one_work at ffffffffb66f95e7 hcon->amp_mgr seems NULL triggered kernel panic in following line inside function amp_read_loc_assoc_final_data set_bit(READ_LOC_AMP_ASSOC_FINAL, &mgr->state); Fixed by checking NULL for mgr. Signed-off-by: Gopal Tiwari Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/amp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c index 9c711f0dfae3..be2d469d6369 100644 --- a/net/bluetooth/amp.c +++ b/net/bluetooth/amp.c @@ -297,6 +297,9 @@ void amp_read_loc_assoc_final_data(struct hci_dev *hdev, struct hci_request req; int err; + if (!mgr) + return; + cp.phy_handle = hcon->handle; cp.len_so_far = cpu_to_le16(0); cp.max_len = cpu_to_le16(hdev->amp_assoc_size); -- 2.30.1