From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2322F391E4B for ; Mon, 27 Jul 2026 08:09:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785139799; cv=none; b=l18FqspnCK56+nz1QJFOVs/6Qu1fGXh1L+VA3EfBOjbjaQcHeCXKYyV3pDiKZbkJfLqBUzOZMbQV3tnwlAGXfEEKBGraj/fz9zfslbct2rf/om9YjeBHFLlqB3rZCgo7g5fXTdT0RjeWj6QTZhC4d0NDi/a1nqhQnaRxgBqUpnY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785139799; c=relaxed/simple; bh=IVStQpxupI3++T0v1KlrlNXANhXKt6YSNyYcroSsO04=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FPxYdJJErYD+iO9LNURa5XKjbGNNq7HIMMI9WCyFyORI+IuZLS2XJ3aKx8nMtzv7RuyNcBt/jZQf1DiVecaOas4oAJivqES/jjG/8Su8n0Qta4vZtTbfoqQKuZxUNSfO8wZzMpsfYbQXo85ypdHRVrhGgSKLGUQY6FmaYqk+q5Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=s8jhTc9r; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="s8jhTc9r" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2caced6038eso26320925ad.0 for ; Mon, 27 Jul 2026 01:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785139797; x=1785744597; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=RJwzAimVGycrhKNGBvE4w6/5g4VYMwXiGvlwcbR2Rvk=; b=s8jhTc9rW2JI30Un6gI+760SbDNLOXjPA7AkUuWuTabKEAD7ue7YBWtb0eUKODfawm Gqnr4biGqv+Z+1uOVU7w5IlNxs60HJGob7KnIk64ItN7da5mj4P38esU6au+u9if0pfn 5r695e0VOZ4DATGuvEmoxP+bhVIOMPWQbJWNIFmoolUgAwfor0wRxsxLu7INddYR79U4 KyhmzbHFQLAQqXVYo7zmlm4nP8S2PEv3Q6nZ+zjtbHClzZ6bHX2XYBnMMD7s2TN6XzmK bDP8aklVHNd17ssC/kkDMmBVGBSTQcpcXcB8yb1tXtboobIRG7SdULDBeliTaMKwKwcu Xwgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785139797; x=1785744597; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=RJwzAimVGycrhKNGBvE4w6/5g4VYMwXiGvlwcbR2Rvk=; b=YwCXGVjmiGdfXq+jzVAL0cwHjdvyCKz6tlg7G7DPhrdCvJ8XiUwjIxTiX6FM+gD3Ez YxXlNQWFc02o1wFe+JkQaBXZUOfSy8yes3KtzFpPFxW0GrRhbLuOVoqj0wL1cATC6kVq o2qO0xCKbzRcC+MIw/TJa4I5tzxitf1nBwL0Ho7K/UN1fVrS8RcWacTRY28E2quTiaSr nUj3rNBdoS1dA5gvYdNa1N4fuLLf27EAUdSpxu70tkVWMXqvXt6NFwUXawZZGCsmelPm t3swyG/kvIpzhgi0c1q9r0GfHDKJKyVWrDqHBLiKfIprtHkh/Wd3NejTztALXHiclfq9 5GZg== X-Forwarded-Encrypted: i=1; AHgh+RpHr0CH65A65I+ikT/UsLwSOzUJExxkPzO/NfoAYtxFVWohEgrt0gkVOSe5IECRNF20yeYFk9D4RmvbsjU=@vger.kernel.org X-Gm-Message-State: AOJu0Yz3mxQWqMQ+a6Iv2kS9T4UrYEiiM7u6QJdQ6/8sgHOxmWYfhVXk HewuPJdi/6e/AUiootz1qquSVQfTt22nN3F0ZL6hSz7nBlzrNYwSWcZJ X-Gm-Gg: AR+sD109b56UcOpsGZyhBjwFhRIoo/oDzbTs5xhsvewnXU6pY5nLl9LgMdEMfGLS7ry vNoUPCU3TkKgOFxBcJjfjNs3OkFW0aUELIPQcNdmCVXR/NfDjwbG3XpGlIpqZWNWhGM7I9r/VIO Rqa3OTCRJli7AEzAyrLDzFX2sWfjfstxOsDjcDggzpC63hZPdKU3yeqv1ChV4Z2afYjAbpuQe97 SC8ofeBweozcjqIDXlDO6EFshRGSj8yHxv51HEZIjtjUYPy/oDQgd99E+vKeBPDXVoEFZf/pVD0 g41Fw3qjpLUe/5it89QUKIHg1tmfovs8NwmhOsowJZgeHDf4VUVonGUNS2SaxP6GRaoqoeWKd/m u1/U+K0c132EMghXBAvMcaNdZR2G9ri/i50W6S/klGsEfn7xVxqYbkVdXwqOs03hHSOKyB8FS X-Received: by 2002:a17:903:384d:b0:2cc:bdb9:3c04 with SMTP id d9443c01a7336-2cfd7179882mr86036385ad.17.1785139797422; Mon, 27 Jul 2026 01:09:57 -0700 (PDT) Received: from localhost ([172.216.252.11]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cfde5e2a78sm31344795ad.26.2026.07.27.01.09.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2026 01:09:56 -0700 (PDT) Date: Mon, 27 Jul 2026 11:09:50 +0300 From: Dan Carpenter To: James Kim Cc: Andrew Morton , linux-kernel@vger.kernel.org, mporter@kernel.crashing.org, alex.bou9@gmail.com, dan.carpenter@linaro.org, stable@vger.kernel.org, gregkh@linuxfoundation.org Subject: Re: [PATCH v2] rapidio: mport_cdev: fix use-after-free in dma_req_free() Message-ID: References: <20260615070530.371640-1-james010kim@gmail.com> <20260722172135.4fb1e64ce415fb6b8d1d1b59@linux-foundation.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Jul 23, 2026 at 09:48:41AM +0900, James Kim wrote: > Hi Andrew, > > Thanks for the review. > > Yes, this path is reachable from userspace through the RapidIO mport > character-device interface. When the final mapping reference is dropped > while releasing a DMA request, the subsequent mutex_unlock() may > dereference freed memory, leading to a kernel crash or a KASAN report. > > I'll send a v3 which: > - updates the Fixes tag to the correct commit, > - clears req->map while holding md->buf_mutex as suggested, and > - clarifies the userspace reachability in the commit message. > > I'll also review the additional Sashiko findings separately rather than > mixing them into this fix. > These kinds of use after free bugs are hard to detect at runtime unless you have poisoning enabled. It's freed and then used immediately so it would be hard for a race condition to change the memory between the free and the use. regards, dan carpenter