Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1823636ybt; Sun, 21 Jun 2020 00:14:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRMLonbd5fZYZAZGWZ8zbG5+lGEp/IST3pW/RrMK4kR1TCem5ueFQCYDqQgBz+JuH/1a2Y X-Received: by 2002:a17:906:481b:: with SMTP id w27mr10354994ejq.27.1592723682577; Sun, 21 Jun 2020 00:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592723682; cv=none; d=google.com; s=arc-20160816; b=OpQa+aOnVav7XoUXPP6nwNsiHZ3doZoG3JtsyKYJ90bpH3enGV3gA0pLKWzekDklsO roczUHSQ1+pXkIeoNx53JLxNA/hB3MYeuUkI0+my8ryHxJ6YCMivgbAsxdP1PtNVY9xK gEW8UsMtrkkfGYU1yLIKctprcdD3SWHgx1K4vh22r5VCkSKKFO6CJKC3Rkb0jo5ocldE McHXyH52RDpzAkI18r7JOGYtonQgpQY4HJbkAaxgamw5Tfi72N5A6TXfqlMavpVBfUEw gDozZ98Y3/TzGD09/yyyGvPG0NKSzqhEsDj6MCFqPCdN0Mo3y3XWzGn4kASg9U921kqY pV7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Z+QJGF0WzCBKj4J91I+6z8NCJI6iL5RWmILWL2hWspQ=; b=OU1fOSHIIlv9/VgsiAWu4CRqwx+c0/fq461xz0rSYSIC+so5yCHRpT8DsavdIdQOgE Vf8l4BxP+1INGSpTL6L75b5ilQ+pwxe+qHYhTAtFJvB8aJYsBfvEWnLijPBm7oRzXR5c GYjF4048QMCJzwcrgjuB/9eorDZ46NmvXlDW4MMWaEC5fqdaT72KOy46q62t3OBIzhV3 fQI0JcareOrEO/W/FfqWa1sWeMuBwuV7ijgrFV4uf0jMK/j7RNA3tK+td0+nAwkTK4Pf ZOY+ia4RU5A1ekkWHwRPDByLXmf2Z4CGnr+BsPsA96FLcplj7V3ppDONpK0WM0B5VYrq 70Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=m7NO7dVd; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bf2si741581edb.300.2020.06.21.00.14.20; Sun, 21 Jun 2020 00:14:42 -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=@kernel.org header.s=default header.b=m7NO7dVd; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729424AbgFUHMb (ORCPT + 99 others); Sun, 21 Jun 2020 03:12:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:60076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729381AbgFUHMb (ORCPT ); Sun, 21 Jun 2020 03:12:31 -0400 Received: from localhost (unknown [213.57.247.131]) (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 379DE24844; Sun, 21 Jun 2020 07:12:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592723550; bh=Z+QJGF0WzCBKj4J91I+6z8NCJI6iL5RWmILWL2hWspQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m7NO7dVdORmug87M+76ahS95y3bwUuPiQePyQ259x8Ml46zA5QYz/SwnfMk6PqXj4 rNgfYA2I1Lw1B3QXoUTCKs8Spos7QL7Q613KU8VllRAYSvcmNrU4NVdYAH2CJHRd3w X6ex9YAr5MIaXruiK4v4baawuEgKl4jD0OKs5rRY= Date: Sun, 21 Jun 2020 10:12:27 +0300 From: Leon Romanovsky To: Jason Gunthorpe Cc: Divya Indi , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Kaike Wan , Gerd Rausch , =?iso-8859-1?Q?H=E5kon?= Bugge , Srinivas Eeda , Rama Nichanamatlu , Doug Ledford Subject: Re: [PATCH v3] IB/sa: Resolving use-after-free in ib_nl_send_msg Message-ID: <20200621071227.GA6698@unreal> References: <1591627576-920-1-git-send-email-divya.indi@oracle.com> <1591627576-920-2-git-send-email-divya.indi@oracle.com> <20200609070026.GJ164174@unreal> <20200614064156.GB2132762@unreal> <09bbe749-7eb2-7caa-71a9-3ead4e51e5ed@oracle.com> <20200617051739.GH2383158@unreal> <20200617182300.GJ6578@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200617182300.GJ6578@ziepe.ca> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 17, 2020 at 03:23:00PM -0300, Jason Gunthorpe wrote: > On Wed, Jun 17, 2020 at 08:17:39AM +0300, Leon Romanovsky wrote: > > > > My thoughts that everything here hints me that state machine and > > locking are implemented wrongly. In ideal world, the expectation > > is that REQ message will have a state in it (PREPARED, SENT, ACK > > e.t.c.) and list manipulations are done accordingly with proper > > locks, while rdma_nl_multicast() is done outside of the locks. > > It can't be done outside the lock without creating races - once > rdma_nl_multicast happens it is possible for the other leg of the > operation to begin processing. It means that the state machine is wrong, not complete. > > The list must be updated before this happens. > > What is missing here is refcounting - the lifetime model of this data > is too implicit, but it is not worth adding I think I have same feeling for now, but it will flip if new fixes be in this area. Thanks > > Jason