Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp694766ybt; Wed, 17 Jun 2020 11:27:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzP7sHneugYbccPkjdhuw8bH1VLz+Gm289EPwaThrMdxfzpzKxwE3y+e51T7uyTa9RY7weS X-Received: by 2002:a50:bb29:: with SMTP id y38mr463046ede.358.1592418435241; Wed, 17 Jun 2020 11:27:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592418435; cv=none; d=google.com; s=arc-20160816; b=VV8T9C381tHVJWQ0cH/Rfe6pRM230ZQ2hB5nj1sEf+Yq9kPKz+CzgRvI+Q4BS5zGyW MMb8CqNSQtIeLAXHIi/+MjpPXFznNH+d0F6vb0DpvuaWv94Y2cf4Kjfv4Ohy2fazNwxR stUHkCEBUz1QAPre0aUHKbIbYtdP8hWLultVIe0oehJ5brAsYzQMX4Dhxd3PyJpADM2q tPLUMm+uARcZsFoM8v6xodXdtqfdwRlXgugPS9RJFe6ShF5j3CTiKYCA+2JvEtHmVUJH QrbnGt6n6Ic3MiHswaWv/+KXH1RZpdsVMpgqXthdoshF55TgOjC+DE0S/sjXbf/Bl3OS 6AHg== 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=yx0AFE8bnkOZ+0HVx0qf6qzKz6YFaE2RtkaHNSdil4Q=; b=ATQSekNOYpo3RSq5WdKyxTbJhUCMqLj/IFoOG+QIrYm8jN1/LoEMkVw1/pMWNrrlEb FP5tygv4yZNtavhF3wFs1KkSPtQg6HAJhQpqniRFvPJe/ctaB1A63X0daqwYdRPMl1XP fgZElLwUg7/8Gm2M0ZtSNHpUKuLI6WudQMFhiRoJvlpHWlg+7W+m40oXQltftLMKB1xb 997L4dGoincJ24MzFSyIQl8c0sk7Kv9DW/LquuaZRxyB2sKN91Cw0xXDl8zRic94Q8+Z JAN7XdJnSxnCacaBCBwW9SeQnnj+GpA3SsVD8eNGBMrWOEpgqvSt1Mas+B7ZBJT3ipqF J0FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=Rl+zBYdf; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a25si327701ejb.697.2020.06.17.11.26.52; Wed, 17 Jun 2020 11:27:15 -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=@ziepe.ca header.s=google header.b=Rl+zBYdf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727883AbgFQSXD (ORCPT + 99 others); Wed, 17 Jun 2020 14:23:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726835AbgFQSXC (ORCPT ); Wed, 17 Jun 2020 14:23:02 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6ADB9C06174E for ; Wed, 17 Jun 2020 11:23:02 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id i4so1477332pjd.0 for ; Wed, 17 Jun 2020 11:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=yx0AFE8bnkOZ+0HVx0qf6qzKz6YFaE2RtkaHNSdil4Q=; b=Rl+zBYdfFS3UwL0fHb2iZoQ9Mc0+vQWPd3YXCCRD1mPlxoeRAcVPDQkxKV8SJrTMw1 0uVOGChTPPkRXt2gXmGHyHS7MuBR5lINpp+c1q8L4VIrLfva85BsqCqe0Q/lQ6hbyqYw M7z8dS62N0oA81W8wwi5f7w6ypjp5Ha/apnbNJhYccBZOhTAqA5kI0oP6iXrQ7mxM750 SGxtVl3LOsDfWu/N65yyLkiqgaRtHKfbRCBnpX3duQtiXd7vSgu08C/cyqK6onmC38Eg sLrjq65a14O+OqVEnlAbCOB1wrQV40nEhY+n3uw1YZ6HvsxfohLyT56332gWPtq2F8fT 1r+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=yx0AFE8bnkOZ+0HVx0qf6qzKz6YFaE2RtkaHNSdil4Q=; b=Vrjdilu2wMbbRlHQupLij4pfJTwUyGGThJZVY+XofjqGr7JNppJx0r9rQBDNhdOji0 gy7vJxiSOpxgeQ/8+Jrm3IRog5cg8BdZpgYtCcfOQcmBMsi2fFjLZAJInMs2lpgo9dlE n8L3iNPIMQ7f6wcXFj4jSGOGaE7XBaZ5ErZs9JPUD1v4rMNh/0ZRirfTaAC1/ike1S9Z kJOAgM+n8iaU7/B65mNwFppBL8UgvLjxeDULVfmAjiqG8EEtZAU5a0ZAarE8DuKQkG8+ xH5QNQC7jSTFlQ/UajbdosDD+CgEhP+WBSyKYpdS7tLqmfxhxAmpUVfVLhAgAZU8TL0d mHiA== X-Gm-Message-State: AOAM530dYA/mCaHIDaBoiR9XY5ha5LNzVmi9dg15X2sekNhPMj8o5yVK KF3Wn5zdZhpUwUJ1Ui0dcr4xCQ== X-Received: by 2002:a17:90b:307:: with SMTP id ay7mr370815pjb.48.1592418181918; Wed, 17 Jun 2020 11:23:01 -0700 (PDT) Received: from ziepe.ca ([206.223.160.26]) by smtp.gmail.com with ESMTPSA id b1sm525823pfr.89.2020.06.17.11.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 11:23:01 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.93) (envelope-from ) id 1jlciC-009iIR-1W; Wed, 17 Jun 2020 15:23:00 -0300 Date: Wed, 17 Jun 2020 15:23:00 -0300 From: Jason Gunthorpe To: Leon Romanovsky Cc: Divya Indi , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Kaike Wan , Gerd Rausch , =?utf-8?B?SMOla29u?= Bugge , Srinivas Eeda , Rama Nichanamatlu , Doug Ledford Subject: Re: [PATCH v3] IB/sa: Resolving use-after-free in ib_nl_send_msg Message-ID: <20200617182300.GJ6578@ziepe.ca> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200617051739.GH2383158@unreal> 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 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. 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 Jason