From nobody Fri Dec 19 01:11:56 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B00317623C; Thu, 29 Aug 2024 07:13:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724915616; cv=none; b=ClAghSugblbs+AkybGAGgpvUnM/1MLmLUpId+zwsU3iH7+hlZBlJL635XtUv4/ISaWC6zG9Cmc22rLfdC5kP5NUzBUo67oLi20qs3H/29qBMd6AlK13M54vXXIc361QSK1mCDOqYzIruxOB2KPNmNXTuXhveTHpmoRELhEHcCjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724915616; c=relaxed/simple; bh=ldKBYdUvNHYeeJ6vlalxxpge6bh+839fygUyeHLhNOM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WOtpDgNnIrG7RbMJhXUM82Hnhd0GpwdiCpUOCVft/ejFe4+5BYn+49cMmsofqwieZ4ShT/M0bK/9VGKJK9RSwQRiPXp9F5uHWRcXQUu1gHlkxZ74ByN+IM8toLqOojH6+mQe00+CU+KXBqBmTBLTy1VXsQZzv7HNjBiQ9g2bi08= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=NkGBduH/; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="NkGBduH/" Received: from namjain-Virtual-Machine.mshome.net (unknown [167.220.238.141]) by linux.microsoft.com (Postfix) with ESMTPSA id D4CE720B7127; Thu, 29 Aug 2024 00:13:25 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D4CE720B7127 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1724915609; bh=JU+1ZnX25glSX/NUmIYc8XIrpbMICNUqMV7QnaM/p2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NkGBduH/iS/S0iVDwtv50gxtkGD3ewotMDEiyj+r3irQPjvWTe4SlI7QROUezpbT8 vF8S91rdB9emj7sOkUZekSwZlMLW7S22C3Sp9fu/Euq3YiZYpamMip2K2qjKORFJeQ WS72j1tF6nXNP3ZSz81FAx7p65sIcZpI32TneBJI= From: Naman Jain To: "K . Y . Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Greg Kroah-Hartman , Stephen Hemminger , Michael Kelley Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, Saurabh Sengar , Naman Jain , stable@vger.kernel.org Subject: [PATCH v2 1/2] uio_hv_generic: Fix kernel NULL pointer dereference in hv_uio_rescind Date: Thu, 29 Aug 2024 12:43:11 +0530 Message-Id: <20240829071312.1595-2-namjain@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829071312.1595-1-namjain@linux.microsoft.com> References: <20240829071312.1595-1-namjain@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Saurabh Sengar For primary VM Bus channels, primary_channel pointer is always NULL. This pointer is valid only for the secondary channels. Also, rescind callback is meant for primary channels only. Fix NULL pointer dereference by retrieving the device_obj from the parent for the primary channel. Cc: stable@vger.kernel.org Fixes: ca3cda6fcf1e ("uio_hv_generic: add rescind support") Signed-off-by: Saurabh Sengar Signed-off-by: Naman Jain --- drivers/uio/uio_hv_generic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c index b45653752301..e3e66a3e85a8 100644 --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c @@ -106,10 +106,11 @@ static void hv_uio_channel_cb(void *context) =20 /* * Callback from vmbus_event when channel is rescinded. + * It is meant for rescind of primary channels only. */ static void hv_uio_rescind(struct vmbus_channel *channel) { - struct hv_device *hv_dev =3D channel->primary_channel->device_obj; + struct hv_device *hv_dev =3D channel->device_obj; struct hv_uio_private_data *pdata =3D hv_get_drvdata(hv_dev); =20 /* --=20 2.34.1