From nobody Sun Feb 8 00:50:09 2026 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (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 337342361C8 for ; Thu, 16 Jan 2025 19:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737054909; cv=none; b=B/pSyXE2lkNGrqE07uDBKMIrpQQJtneWH5MXRsfthE5uSJy4ukjFhMmPDF0B+PCCWvfUxeDi+6SphYHtoqtcqDqXtlJdpuq1pPhj6/8eI6JseiRgjUvUjy7nlBv0rva9wgJbI4lyO9TliU69cSkoMDR8L1hcxjvNxeLwSI/Jlnk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737054909; c=relaxed/simple; bh=tyQZjok2yRPXcgxU22Vk1b2fzwK0ZBzJy4b3RkttDEw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=mm3WXuW4tYT8A3YQYWBMt0QvMn97ksBPHr0/Uc/XmyIPdJxWRkEM7kaa56NfF/NxgWiJ0KI6j9L3l42g7zHJk0ey6nDiwsZ/vFBacgC4nQpSq06tNl8Bhsu7S89KFtsHFDI3M5l1tAcvXSkQeSJv8PRbChsypZbOCGbuPh42npI= 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=DUylcIXR; arc=none smtp.client-ip=209.85.216.51 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="DUylcIXR" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-2f4448bf96fso1871845a91.0 for ; Thu, 16 Jan 2025 11:15:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737054907; x=1737659707; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Qd8pNttPqEhyR/1jjFuD6JEelrFI8R1BhDQlrt0wU1Q=; b=DUylcIXRfdmeIOCVjk3HozxoeUQO6AeEB3E6nyw/eyGcMh7Wb6KcK+qyt2C43Lv23D kfdk3O9dF88330YO0TbdEFRD81YEECQeCuQtzv5i5O7Poruf7PiuBP8PGXbYNDJJxJBD wScXrmXRP03xmLEIiyJ3yw+dblJTivjr35NRUGUyKm6c1mi7vvdFhIQksD4cyJM/9IqT KhiYVmAxj7aqjNJuQpyV5GMvDwRYAA00u9EhVGKmz5nQNOu5osYgBNsILX1GchPKM/Bb NQvjQ56IjrugN32IMPWsmV2r00bIyzjhpEkf/YFYCznfWTttUY/iVZVlbHOoWa2MzHTr Sk0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737054907; x=1737659707; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Qd8pNttPqEhyR/1jjFuD6JEelrFI8R1BhDQlrt0wU1Q=; b=t6j8zkYII1dhKIN/6TVDBNjjZsbjb6VPH4LLDvI7ka8AHxl7t4U05UbFMn2Ajf8dQa MgY4B7p71YuvqOpB8ggD7WxSYaIUnlP6zAMh+gg1Ka1pRrgPzKYo8aVVncDdKRpMKucy rDcGzPJ4aQNmQuGvEAvroNklQqQg+tcOCEMshzdAgHiRoeOmrkPP/9KsIloBalbkC1k2 rz1NisrIDEz1RSy7lI3zbEDYd16LkrrOpsUrOncWyBY93nZ/oLcjdAm5ADrqPleDarr7 m7RrI9NXoIDEfrn9B+PaS9A209CKZnoDzu1rvjx7/DUKuNYTmzUPHJxvbxEIlO+ykA1s pXeQ== X-Gm-Message-State: AOJu0YzMDQBntS26ioiv28h6q23oUOY29ZR7yBNfPDC4oQuYBjYdnu+w 4JRredEuvzNb3ApDb+rrsaS+4ltJshaV8cxWWNjlUxk42ORUYHqP X-Gm-Gg: ASbGncsHycPvosz35iNBVSo74Na0Alj1zzWxli5v23cWsuefHVvG91RisgkLP+DD2vl QY5+WKUIBIxX0oe8vN7X1GJS4rMHeMFBLDvxLFk8zCZhrGYQ/ODx67itbSx2BWqDPWh19EIkUvu 207vGjAfnX8fdkudocYz5UEtIw0iUhSQjAWUT7nN9NGmweCUlS6C08Q/dnr17q8FOl8iViMJBrb ClrZaiPx9KBW7bhdI5oY8gmFiduGWSmElFiUSqNlwbvIm4AfslXTQ== X-Google-Smtp-Source: AGHT+IH3HVdxyAr1GgJQouzq1hgvxxHqML0UbjUGIKY7tKEbiUcszX4Au1d0xf+CdOK5LTF/ilXMdA== X-Received: by 2002:a17:90b:248a:b0:2f6:dc00:3af with SMTP id 98e67ed59e1d1-2f6dc000630mr24123569a91.34.1737054907484; Thu, 16 Jan 2025 11:15:07 -0800 (PST) Received: from s2lab02.. ([114.70.9.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f72c1cc867sm3654336a91.26.2025.01.16.11.15.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 11:15:06 -0800 (PST) From: Ingyu Jang To: phillip@squashfs.org.uk Cc: linux-kernel@vger.kernel.org, Ingyu Jang Subject: [PATCH] squashfs: Fix ambiguity in get_comp_opts() return value handling Date: Fri, 17 Jan 2025 04:11:49 +0900 Message-Id: <20250116191149.2288889-1-ingyujang25@gmail.com> X-Mailer: git-send-email 2.34.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" The return value of the function get_comp_opts() is checked using IS_ERR(). However, it can return NULL when squashfs_comp_opts() returns NULL, causing ambiguity in its return value. This makes it difficult for the caller to clearly determine whether the function succeeded or an error occurred. Additionally, it may cause a NULL pointer dereference. To address this issue, get_comp_opts() has been modified to always return an appropriate error code wrapped with ERR_PTR() in case of failure. With this change, the caller can reliably distinguish between success and error cases using IS_ERR(). Signed-off-by: Ingyu Jang --- fs/squashfs/decompressor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/squashfs/decompressor.c b/fs/squashfs/decompressor.c index a676084be27e..2988f2d4220c 100644 --- a/fs/squashfs/decompressor.c +++ b/fs/squashfs/decompressor.c @@ -117,6 +117,8 @@ static void *get_comp_opts(struct super_block *sb, unsi= gned short flags) } =20 comp_opts =3D squashfs_comp_opts(msblk, buffer, length); + if (!comp_opts) + comp_opts =3D ERR_PTR(-EINVAL); =20 out: kfree(actor); --=20 2.34.1