From nobody Fri Oct 2 01:56:56 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 0D4123D47D4 for ; Thu, 6 Aug 2026 07:25:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786001140; cv=none; b=HnIYj/FLjtvtJ8IvgKHGendc6zq9Jn7GBfJcCXNx0poiS4bygvhHZ2NpZqA6sGoSicGY95qFeeNW9DjWjCFwDU7W0VcB7E9XuEGaTVQrup4bcsFV4v24/X8EKNp8Leix2/Iym2U/R2lvOSF3aXEH1Jw+4KcBsOM9OKLOOmoELuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786001140; c=relaxed/simple; bh=C5tOHxYmtwwhrsuXljBmoh0tbkOnm8MUJtPVkTWIiRo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=m+g1JIqH9kabz8F5HZSyNAUD47yDXntED0oCxIwjxZzAIUsqUYYbJIMa7tckzk56e/6rFmA8uZof0mOdn9fhWdkcn6qQycRRXhH6LrlqgUTFyHGYoonuEvqRdq8eg+GIq5R1Xk+SrqWqgQ+BzYtEwEIgJfO0TfTpJAf0LExlfec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 014a762e916811f1aa26b74ffac11d73-20260806 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:dd0c6b73-9b6b-44f5-868f-36f3aeba32b5,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:e7bac3a,CLOUDID:ba71a51bf87a3b1883f3edba4beb94ad,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:102|850|865|898,TC:nil,Content:0|15|50,E DM:-3,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA :0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 014a762e916811f1aa26b74ffac11d73-20260806 X-User: gonglinkai@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 16639317; Thu, 06 Aug 2026 15:25:30 +0800 From: Linkai Gong To: Dave Penkler , Greg Kroah-Hartman Cc: =?UTF-8?q?Dominik=20Karol=20Pi=C4=85tkowski?= , Luke Yang , Kees Cook , linux-kernel@vger.kernel.org, Linkai Gong Subject: [PATCH] gpib: ines: check ioremap() before writeb() Date: Thu, 6 Aug 2026 15:25:26 +0800 Message-Id: <20260806072526.1918151-1-gonglinkai@kylinos.cn> X-Mailer: git-send-email 2.25.1 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" ines_gpib_config() maps attribute memory with ioremap() and immediately writes the IO window base via writeb(). ioremap() can return NULL; writing through that pointer is a NULL pointer dereference. Check the mapping, report the error, and unwind the PCMCIA configuration on failure. Fixes: bb1bd92fa0f2 ("staging: gpib: Add ines GPIB driver") Signed-off-by: Linkai Gong --- drivers/gpib/ines/ines_gpib.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpib/ines/ines_gpib.c b/drivers/gpib/ines/ines_gpib.c index 3562f3184c28..d7f2a42d063a 100644 --- a/drivers/gpib/ines/ines_gpib.c +++ b/drivers/gpib/ines/ines_gpib.c @@ -1226,6 +1226,11 @@ static int ines_gpib_config(struct pcmcia_device *li= nk) return -ENODEV; } virt =3D ioremap(link->resource[2]->start, resource_size(link->resource[2= ])); + if (!virt) { + dev_err(&link->dev, "Could not map I/O memory\n"); + ines_gpib_release(link); + return -ENOMEM; + } writeb((link->resource[2]->start >> 2) & 0xff, virt + 0xf0); // IOWindow = base iounmap(virt); =20 --=20 2.25.1