From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 379943803F3 for ; Thu, 9 Apr 2026 12:53:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775739181; cv=none; b=iaasLbsFsfldklWXmLUlOM77Op38sykweUWTko1u/s43GNC3nfwaDIsRDDdHqz/79sr7YN5bZeGImsnA48cCNZstzHmJbFrXZUpJkVXQ8qmkb5WWGF3jm4IDnz7cHLQpyNQCdtvE7R86WYLIDpLPs8gqd7sn/mczGFhdmz5iSpY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775739181; c=relaxed/simple; bh=rR3I96td5Fb7sMzKN7K6rnakhBmE145nsvZyacL0L2I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=m7ZqYtIKN3jx8p6rJA15zzy5LT5FoPdGCdn4G2C3mjxF9+nTqtemZeh8CT4gOyAk6ZyNuyANHMCvjF5MM9kC43IVWw3TdCpZJ1KTEqhSfXEwgUjwXfM/2tj6qQStNaEsbsd52Ns2T9W0Uv0hfJLe/ytmFR9MvJ7D2MsDv7kcDb4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LczClAb/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LczClAb/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FE98C4CEF7; Thu, 9 Apr 2026 12:52:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775739180; bh=rR3I96td5Fb7sMzKN7K6rnakhBmE145nsvZyacL0L2I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LczClAb/LRbUmKYYPH9OTWIJARoyFSqmlaXBmM1APMyoniy/Bqf7W9ZeeZarcuPyh iPgsO3rWwQLALEcc8UI8erCd0t49abxlHHlRfgEpeAA5qzEqh8m6QWa2fWxLHpfN94 9moviaDptq5jChY8TsU2LAosDVo9LcuhFttd1fniQkEOj5xeGnTWHehHqwHvAc3USt TyPJRwjZ5tCzJCogcIgDo/qtEhYAU5S22hUo08OBe83FRj3gfkVk5jQ7Ngc/5i04/3 GhUU3CK5XAtJzXJSkbExmQpkgfIGLoBAWToxRg8tHSwUjAHWnwP1uAiUIWSOGpHiiP BWfWpX8APIaig== Date: Thu, 9 Apr 2026 14:52:56 +0200 From: Christian Brauner To: "Ritesh Harjani (IBM)" Cc: linuxppc-dev@lists.ozlabs.org, Haren Myneni , Madhavan Srinivasan , Christophe Leroy , Venkat Rao Bagalkote , Nicholas Piggin , linux-kernel@vger.kernel.org Subject: Re: [RFC v1 1/6] pseries/papr-hvpipe: Fix null ptr deref in papr_hvpipe_dev_create_handle Message-ID: <20260409-viadukt-szenarien-4544001038fa@brauner> References: <5984bd91ad6d3541d08dc9f3c99e6de0214dbfcc.1775569027.git.ritesh.list@gmail.com> 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=utf-8 Content-Disposition: inline In-Reply-To: <5984bd91ad6d3541d08dc9f3c99e6de0214dbfcc.1775569027.git.ritesh.list@gmail.com> On Tue, Apr 07, 2026 at 08:01:35PM +0530, Ritesh Harjani (IBM) wrote: > Getting the following kernel panic in papr_hvpipe_dev_create_handle() > when trying to add src_info to the list. > Kernel attempted to write user page (0) - exploit attempt? (uid: 0) > BUG: Kernel NULL pointer dereference on write at 0x00000000 > Faulting instruction address: 0xc0000000001b44a0 > Oops: Kernel access of bad area, sig: 11 [#1] > ... > Call Trace: > papr_hvpipe_dev_ioctl+0x1f4/0x48c (unreliable) > sys_ioctl+0x528/0x1064 > system_call_exception+0x128/0x360 > system_call_vectored_common+0x15c/0x2ec > > The error handling with FD_PREPARE's file cleanup and __free(kfree) auto > cleanup is getting too convoluted. This is mainly because we need to > ensure only 1 user get the srcID handle. To simplify this, we allocate > prepare the src_info in the beginning and add it to the global list > under a spinlock after checking that no duplicates exist. > > This simplify the error handling where if the FD_ADD fails, we can > simply remove the src_info from the list. > > Cc: Christian Brauner > Fixes: 6d3789d347a7 ("papr-hvpipe: convert papr_hvpipe_dev_create_handle() to FD_PREPARE()") > Reported-by: Haren Myneni > Signed-off-by: Ritesh Harjani (IBM) > --- Thanks for fixing this! Reviewed-by: Christian Brauner