Linux Framebuffer Layer development
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Swaraj Gaikwad <swarajgaikwad1925@gmail.com>
Cc: Helge Deller <deller@gmx.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Hans Verkuil <hverkuil+cisco@kernel.org>, Zi Yan <ziy@nvidia.com>,
	Frank Li <Frank.Li@nxp.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Qianfeng Rong <rongqianfeng@vivo.com>,
	Vivek Kasireddy <vivek.kasireddy@intel.com>,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	"open list:FRAMEBUFFER LAYER" <linux-fbdev@vger.kernel.org>,
	"open list:FRAMEBUFFER LAYER" <dri-devel@lists.freedesktop.org>,
	open list <linux-kernel@vger.kernel.org>,
	skhan@linuxfoundation.org, david.hunter.linux@gmail.com
Subject: Re: [PATCH] fbdev: arkfb: Request legacy VGA I/O region
Date: Sat, 13 Dec 2025 06:22:00 -0800	[thread overview]
Message-ID: <202512130621.7FE2C04639@keescook> (raw)
In-Reply-To: <20251213154937.104301-1-swarajgaikwad1925@gmail.com>

On Sat, Dec 13, 2025 at 03:49:32PM +0000, Swaraj Gaikwad wrote:
> The arkfb driver uses the legacy VGA I/O range (0x3c0+) but does not
> request it. This can cause conflicts with other drivers that try to
> reserve these ports.

Eek, nice catch!

> 
> Fix this by using devm_request_region() during the probe function.
> This ensures the region is properly reserved and automatically released
> on driver detach.
> 
> Signed-off-by: Swaraj Gaikwad <swarajgaikwad1925@gmail.com>
> ---
> Compile-tested only on x86_64.
> 
>  drivers/video/fbdev/arkfb.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c
> index ec084323115f..24e4c20d1a32 100644
> --- a/drivers/video/fbdev/arkfb.c
> +++ b/drivers/video/fbdev/arkfb.c
> @@ -1018,6 +1018,12 @@ static int ark_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
> 
>  	pcibios_bus_to_resource(dev->bus, &vga_res, &bus_reg);
> 
> +	if (!devm_request_region(&dev->dev, vga_res.start, 64 * 1024, "arkfb-vga")) {

I was expecting to see vga_res.end as the third argument instead of
repeating the open-coded value.

-Kees

> +		dev_err(info->device, "cannot reserve legacy VGA ports\n");
> +		rc = -EBUSY;
> +		goto err_find_mode;
> +	}
> +
>  	par->state.vgabase = (void __iomem *) (unsigned long) vga_res.start;
> 
>  	/* FIXME get memsize */
> 
> base-commit: a859eca0e4cc96f63ff125dbe5388d961558b0e9
> --
> 2.52.0
> 

-- 
Kees Cook

      reply	other threads:[~2025-12-13 14:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-13 15:49 [PATCH] fbdev: arkfb: Request legacy VGA I/O region Swaraj Gaikwad
2025-12-13 14:22 ` Kees Cook [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202512130621.7FE2C04639@keescook \
    --to=kees@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=akpm@linux-foundation.org \
    --cc=andersson@kernel.org \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=david.hunter.linux@gmail.com \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hverkuil+cisco@kernel.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rongqianfeng@vivo.com \
    --cc=skhan@linuxfoundation.org \
    --cc=swarajgaikwad1925@gmail.com \
    --cc=vivek.kasireddy@intel.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox