Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2566960yba; Mon, 6 May 2019 08:06:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdC6THAgvARn6ebrn8Kdp2UFkJxE/gmAtN1bt8WaYj4ivq2fcUqEW2krvvbjPKU5JV5apc X-Received: by 2002:aa7:8008:: with SMTP id j8mr33692473pfi.120.1557155198396; Mon, 06 May 2019 08:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557155198; cv=none; d=google.com; s=arc-20160816; b=cn0ZMhTfbLuAqPCBk+8IM9DOVhM5rBsicEqYjXfqiRNVuwNZGMz1p25CgLm2YBCVWr ZxyCUz/iDlrx8HyP3Df5s4VME++QVaNCce4wzdDRGdW3xcSlq5Nqp4GcCYKjnGoA9hLU c7pnuJlBNLylXDe8VWWjbdJm6ScDBYuSwFEenJazdP9rCgIRSreMiVe3t7//U1JdRMJu EpEKEhj7XkoQKkSXdfpvs6MVFFd8Cfzw83TPslKjMRjjK4Nrm1mBLZMnM2y8dJOEO4st KRb40ZT1OPcHzW9RnCXVKO536PPt2tleu8OVIddMo+CMnFzMmM1SekVx0spV1niQzT5r fCew== 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:dkim-signature; bh=hUX6K2GDCd0zfUXgDCk9PTOXjX0sEtDA1EVa5EDhk7w=; b=cY90EGGZp2KV3hkHevjmUEZ81bYa0U9hTS13EvSQbRzRSqAy0laJjlz2fWUJL9YeFl S4mhIW1vpkKXPCNBW/kW43XHf9FXWizFG9WRXozn6BAZE/6L0fX8ZnqHoAfJrL4zPfRB CE4HPMskcIk1/CwbrYObHbHAZBXErQT7VjSLRNxZ6Y9XAFk4+wS2rowTxrxBYEm50Lvj yMaFSQvUgzJNhNKV1VQTsjlLrU5PEvrpSPeoRGDSi2FT8t5EqF0VrqmbgPETHH+O92fV tN6JIKZntykD1+ZXWuJ+yAqpr1bxSyQbztyjuLnDeJ0d70MeZRGUiDLtMlOsgjiCkCc5 YhuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VEdqUyTL; 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 d4si15167828pgc.304.2019.05.06.08.06.09; Mon, 06 May 2019 08:06: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; dkim=pass header.i=@kernel.org header.s=default header.b=VEdqUyTL; 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 S1727415AbfEFPE7 (ORCPT + 99 others); Mon, 6 May 2019 11:04:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:60356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727704AbfEFOjA (ORCPT ); Mon, 6 May 2019 10:39:00 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C73B020449; Mon, 6 May 2019 14:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153540; bh=uKMG32aR6XD0AtLePyWTs52oPupPMpoNb530NBGu0Uo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VEdqUyTLWucGBa4/M1hZICJmJvDzA8VoGfhoIkt1VniFvpoipCRJvnXT1riFBmKN4 4qYrR6gqegzotFfJFsLVT894UUsmHx1ie/CQaAAgZUm5UHFMosFJOQHZ4IAdmBADUd B0wiHTptupJgIcwHTelO4zjMu7vVLfbmGk5wULtQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Jurgens , Parav Pandit , Leon Romanovsky , Jason Gunthorpe Subject: [PATCH 5.0 106/122] IB/core: Unregister notifier before freeing MAD security Date: Mon, 6 May 2019 16:32:44 +0200 Message-Id: <20190506143104.143017284@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Daniel Jurgens commit d60667fc398ed34b3c7456b020481c55c760e503 upstream. If the notifier runs after the security context is freed an access of freed memory can occur. Fixes: 47a2b338fe63 ("IB/core: Enforce security on management datagrams") Signed-off-by: Daniel Jurgens Reviewed-by: Parav Pandit Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/security.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/infiniband/core/security.c +++ b/drivers/infiniband/core/security.c @@ -727,9 +727,10 @@ void ib_mad_agent_security_cleanup(struc if (!rdma_protocol_ib(agent->device, agent->port_num)) return; - security_ib_free_security(agent->security); if (agent->lsm_nb_reg) unregister_lsm_notifier(&agent->lsm_nb); + + security_ib_free_security(agent->security); } int ib_mad_enforce_security(struct ib_mad_agent_private *map, u16 pkey_index)