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 2911720EB; Mon, 14 Oct 2024 14:41:47 +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=1728916907; cv=none; b=nnK+QQoJJooGoW5T10nTec6UC9JmjTtpx3e84EBrXLLgM0gFmNMSmkDJitfAbvbNhKgmGQzGAj+SvKRAjPGsdhx6716n5DeDaFjjyVTn7Z4pDqWzsUhiYloHvL5JSRhEfXqALUZkWPNnhCmH8rw6Tho8UFBULz42ojmBomgLHkA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728916907; c=relaxed/simple; bh=t7I48BFwI7szDBY4hTphbkFSWEGmskcnVgiHZ+HixVk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K1c8fAOY4DIern9WwPz96EI/FyOsb/YOrPvBVri7rYZyBGFLAmENTxQoBN/GoZKIpL2ApUA0/lMzmQdpXjUlmV2053+/nRVjYg1igp2Ft1HA5gwN5CY59ft3g8ev/NcNhJGfJvG2Zh3IQIsLPYLiIemTSCHM9hSvY8z3zAQfKIo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eSzdfP7F; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eSzdfP7F" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60351C4CEC3; Mon, 14 Oct 2024 14:41:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728916907; bh=t7I48BFwI7szDBY4hTphbkFSWEGmskcnVgiHZ+HixVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eSzdfP7Ft3vkVmTIHvs4jSbIx45NmCCHOPFR1+S8fizbQIjaynhOkqDDb8kII4JmW RR2HNY5ikvk5R4Pej5v3ErnNu7yJPcmvYTlOxc5aLELoKhLPt0N+IOdq1wnIAPEm63 Z+JNmZq/h23LJvhkaoFnAMb+ySyyflIKnroXhq9c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Riyan Dhiman , Dan Carpenter , Sasha Levin Subject: [PATCH 6.6 098/213] staging: vme_user: added bound check to geoid Date: Mon, 14 Oct 2024 16:20:04 +0200 Message-ID: <20241014141046.794045976@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241014141042.954319779@linuxfoundation.org> References: <20241014141042.954319779@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Riyan Dhiman [ Upstream commit a8a8b54350229f59c8ba6496fb5689a1632a59be ] The geoid is a module parameter that allows users to hardcode the slot number. A bound check for geoid was added in the probe function because only values between 0 and less than VME_MAX_SLOT are valid. Signed-off-by: Riyan Dhiman Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/20240827125604.42771-2-riyandhiman14@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/vme_user/vme_fake.c | 6 ++++++ drivers/staging/vme_user/vme_tsi148.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/staging/vme_user/vme_fake.c b/drivers/staging/vme_user/vme_fake.c index 7c53a8a7b79b8..95730d1270af8 100644 --- a/drivers/staging/vme_user/vme_fake.c +++ b/drivers/staging/vme_user/vme_fake.c @@ -1064,6 +1064,12 @@ static int __init fake_init(void) struct vme_slave_resource *slave_image; struct vme_lm_resource *lm; + if (geoid < 0 || geoid >= VME_MAX_SLOTS) { + pr_err("VME geographical address must be between 0 and %d (exclusive), but got %d\n", + VME_MAX_SLOTS, geoid); + return -EINVAL; + } + /* We need a fake parent device */ vme_root = root_device_register("vme"); if (IS_ERR(vme_root)) diff --git a/drivers/staging/vme_user/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c index 2f5eafd509340..4566e391d913f 100644 --- a/drivers/staging/vme_user/vme_tsi148.c +++ b/drivers/staging/vme_user/vme_tsi148.c @@ -2252,6 +2252,12 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct vme_dma_resource *dma_ctrlr; struct vme_lm_resource *lm; + if (geoid < 0 || geoid >= VME_MAX_SLOTS) { + dev_err(&pdev->dev, "VME geographical address must be between 0 and %d (exclusive), but got %d\n", + VME_MAX_SLOTS, geoid); + return -EINVAL; + } + /* If we want to support more than one of each bridge, we need to * dynamically generate this so we get one per device */ -- 2.43.0