From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 76B0537C10C for ; Sun, 7 Jun 2026 09:34:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780824893; cv=none; b=ZRKseOohAPZiOQGp9FulyiU8aFBuvfkczYXrgqAy0Ou57ci+AXGLlBqwR/O5TpKosVxAwhcpnc2F3etHmrXPdLYgjrI4vAjlscMQdhuSW1asjZMC35YRwV0IW63EQcWsvbVfMXK6TbVXGAzoTr1sdaFgsBQ6UcIK4pmKX5yFeek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780824893; c=relaxed/simple; bh=nV7jj9oEtidnP93t1gZ5ssXLQbglh+R3MDulkYEA0EE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E7jLhfgmzM767fROJ4d2ZNrejbcFRccoqQfdh0MSAbe9A1yp6+DyjpK+IdskEC2G0rQCdc14vKqaWy4UK66gKTCqrq/iGjf6R9MJFuwOk557GqiBkp5dj1QztieLVPB66uNmLaSccNtm3u+hVyNp7ssR73kbn0twE/f9+q9XWuI= 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=iQ+Oh4zG; arc=none smtp.client-ip=209.85.214.178 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="iQ+Oh4zG" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2bf77d4a4e2so23163375ad.1 for ; Sun, 07 Jun 2026 02:34:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780824892; x=1781429692; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NgfdauwgRL7trNK0SmaN9Lw2oob/dhNR7EW4yBPO3yY=; b=iQ+Oh4zGRXBekFmRjNC/+oVlAFUGxglrrC7FdcopSAKUB3fBTeIsRLKb9fYqegtbJs yc7l/1yvbAdeWW/AU9VlLU8wXnq/sel4UsQCKpIvc+Po4XDPrB2In3SRrJpTOl/1N8TF 9+8lFqU3+UDn3p5BfAL2BIV7wpJRqQH0t2vpz6mXici5nPowr6g17alTIlgScnzhkF3U YgaXk4iBQeIMj+pJk2N5OIB3KMZVhCXtUQttfGR/vf6DwjgVung+dGZI2daYwFm8oo82 gU8NksBLJPye9PlxQpG6PXjT29e7CClRzJZFuWPuX+Ko5cNFm2MwSblANE2iW+OLzVPT 6GEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780824892; x=1781429692; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NgfdauwgRL7trNK0SmaN9Lw2oob/dhNR7EW4yBPO3yY=; b=ExGAvP85zwiSMZvrKR+ZSWwZ1gxJmX500sbAqCR7KIENadH5/Xvm3bQjPlIKEzDPW6 aMZkPkqzwyaOTXHmD4c2FiZxZjhc2EawCgMxirE39U+C1xrLyjuT9P74rYPXgBp2iFp7 1MAv0y7x6C6cwgu1oxIKYpNfiIMneWqE/13SPcoIjaybfOt+YSs3i8umD1yw4MSFrbdh DZDZO/qg0oXWftThV3+Zsq0NByABLTNeW7UdPDF4tYETeDCf/CFb+4dDsJsgTBDBi3jj SDEE7PhJexWxQmkfC43f1hcAhHFVFCIp7ruZRO4Bjcwz1GhXf9Mg+xXDNxFpEaIhAMsy 0Bow== X-Gm-Message-State: AOJu0YzyrhK37zHfk+nWRJtXxvJ1qJ4vDz6JhHktbVAiKKXDpltSn9cc pZ6qEDJTnPjCmTZtqnq/zE3GZO3nDr4l4LokDLkccl9zNOI4pz3yNQWp X-Gm-Gg: Acq92OHmRmM1ybJ6Ls1syo7CI9UhWnam0a5nyz+Hc64sWSwppB+uLclCpVui7pOJdL0 ba2bT/76tmiNlHCw4OJyBIkfjJ5SNf4OWfXe/JM/dnHul1+7XMm6+sJpWIoewv1TZ3h/OgTWgsq 7G+1O16tRZ9pQ8ZcFj/BUvITWJL4hWF5h+WMo0YsbFE6tS1EymreK7hg/HNtkaUtbbkcXqh1tZd wBLDpO2NbvfuAX3+3yG16zqCOhV6m66cExY+he13gc+2CpahQAKXptC3a4xz0I+35CD5jSCcZAZ 4afAPgwGWu4YrtUqyBgZ2TPhHOTHY7jqBFqkHJ8Yyz/2hiXIMft9++BANIMTZLSly+hcAqtB/CQ qWxP/PL37sBR8wq3lguaenTGmugKDCPO2lZzASsShlNCktZPOqNbDkCMbwGnyTvFf6n6o/PV509 StGGD7JtsLi2I5Up7kkgYj8HHts03BE2oa1rfD9OM4W29kATUit/ei X-Received: by 2002:a17:903:3b8c:b0:2bf:361e:3edc with SMTP id d9443c01a7336-2c1ec3f61a1mr90601425ad.2.1780824891631; Sun, 07 Jun 2026 02:34:51 -0700 (PDT) Received: from haichao.tail057a43.ts.net ([2001:da8:e000:1206:5d57:2cec:64ac:50a]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c164f6d59csm139016845ad.4.2026.06.07.02.34.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jun 2026 02:34:51 -0700 (PDT) From: Ruoyu Wang To: Dave Penkler Cc: linux-kernel@vger.kernel.org, Ruoyu Wang Subject: [PATCH 1/2] gpib: ines: check CIS register mapping Date: Sun, 7 Jun 2026 17:34:44 +0800 Message-ID: <20260607093445.3-2-ruoyuw560@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260607093445.3-1-ruoyuw560@gmail.com> References: <20260607093445.3-1-ruoyuw560@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ines_gpib_config() maps the PCMCIA attribute-memory window and then writes the I/O window base through the returned pointer. If ioremap() fails, the writeb() dereferences a NULL mapping. Check the mapping result and unwind the partially configured device before returning -ENOMEM. Signed-off-by: Ruoyu Wang --- drivers/gpib/ines/ines_gpib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpib/ines/ines_gpib.c b/drivers/gpib/ines/ines_gpib.c index c000f647f..0968a247e 100644 --- a/drivers/gpib/ines/ines_gpib.c +++ b/drivers/gpib/ines/ines_gpib.c @@ -1145,6 +1145,10 @@ static int ines_gpib_config(struct pcmcia_device *link) return -ENODEV; } virt = ioremap(link->resource[2]->start, resource_size(link->resource[2])); + if (!virt) { + ines_gpib_release(link); + return -ENOMEM; + } writeb((link->resource[2]->start >> 2) & 0xff, virt + 0xf0); // IOWindow base iounmap(virt); -- 2.51.0