From nobody Mon Dec 1 21:30:04 2025 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 E7F322C2376 for ; Fri, 28 Nov 2025 07:17:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764314234; cv=none; b=TTxSAkkO5/ZSUoxbSU9OpyllBxXoCEVDFvTF7NbOOmPAHdRg81JIIreBX+TjrCTXiWyAmfmLzRD4QyCYmfJLUiPCwLHWiXnPAbwwsWO1jJEd1oXE9eX0BSQStXkTkiUKzQ5qI2RKmx5IFqQ+n/VQSIkkGaoagX0e0n7tgEXxk+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764314234; c=relaxed/simple; bh=q3Pyh0mPfhHACxJpnFH02ODrDqfs/HGagIlO+IJ5DUs=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=c9QggabU7x2k5OZEngI8dF+17lJN8kz4iaMEQ9Kp1pipaFHPOrn9mULPpHTEeoPdllkJohpf/sUqN7lGjWQY50E1ANHeNO4JBH/l/vOoitpiYldESV7fU7FlZZeATcOOVBxnZCnW8p/Q6nI97QJBlquHMaH80Zerb+F/NYX1h6o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=OGnYRGaV; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OGnYRGaV" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-47798ded6fcso7655795e9.1 for ; Thu, 27 Nov 2025 23:17:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764314231; x=1764919031; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=QECuucpOB7mGdCP5CNDlQP92tCoOeBkJ5Et2tCmqPGs=; b=OGnYRGaVawR+DbLGlLs6I1WrzWes6l/hxz2uEGeRke4g+AADmvJJ4Zlr6BiidockMX T/VV5ZI9LlgYjOheuozpqnK/nkYLkzuoi2dITck9Q6eQaQuDyWLY2VmZMH/8EWjSl6D3 7XcWuhjkrfwy3Xjg8MuOsTzMYJTqajvXarcQwpUYXfeLP9RH96IHtv+IiQonnT4Q/sdE fxjMwGgs+XtxvAWHl/YkPH/jeUjvWw7BQUufSYM2UrlB/w6kdbXhmMEU5oUxTy7YMMHL SLFki1/odgjHb7sW6df+tlwtF8j4fbaEPHTHnFNxk+xuR6oDp9YbnLnxjf2LPB5K2o/q di7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764314231; x=1764919031; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QECuucpOB7mGdCP5CNDlQP92tCoOeBkJ5Et2tCmqPGs=; b=lzWKJm3zTVpVqZhkOE3D1fD6bAYrxHyASEReyNEZtHTpGtgB5I0wuOOeZuxLrMFOMP hCprD8/zzEqOfbn9roGf56v+9csRVINDdzyMsl3utlRwRxSQK9Qz7KFbCKDsB2kOFROv 9Rr7dtdk69cMsMlXszZy0h0gHNejCkOT15qSTMuVci5Xnx+yHjk0bwHy/tgHCkFrEmO0 r4yuunj7Rng7ClNFbECZ6O/6MZ7Nb17RAzi4Rqn7MTgNRiVXiMf5EnXEntwInC5wuMe9 vssfgl+0PMJVJWMon0pnkhkQ3z+WHDCOMX7EkwfdUsj8Tcvtu/O2bz7Y6Nc7Aq0kakgN GRyw== X-Forwarded-Encrypted: i=1; AJvYcCWxJ2TDX6/b0v21QQ3cHjfNhaM5vlPcarvhKEaC27kkPKOiRRg05gD3cVi/P8EZvmfWUP61NRPOtw1CFmM=@vger.kernel.org X-Gm-Message-State: AOJu0YzNqkNLWlngbkM77pri1SrR1IKrpFsabS4USkjEeuz6XgXwg5uN mGRpOAX+EM9+C6bNOxAWoslXVxT+cmpT566oyKgMWzz314N5R59OCSdAVkXXkqlJgpM= X-Gm-Gg: ASbGncvurgfYaoY83+0KKDRUjcIAdcBvQDi+J28Ow3C1L0ypI3r761eWZStu6EpBkH2 9c22sJ2nzkOHLOHy5/h4O2ulpU4exqp5sHAlW/lm2FxzkLA/Q8VMJO50G3jxqN8/HM08Ha6oKdZ 40Ddy7i7QaLUTEAUUhYvgiWvjcbpUEH7fJaFvKEIIPTBAZwSnwco7HFL6J8oby1oKF1yHmxq2qb TEIL5i5lIKKz74Ch/xUiaxY+JYKJAx+41HWXFSUmeDYZ59hk+ZjHl7Io+leYZ69X+VU3YgvLSVH Pf2B06B2+ifs4/DNPThKxMubw4861BNq9UEHECUrXl4CsonWTX9PwFPpyjNMnUPXAVxU3DUoFaq 2OvZpDNLm5A2Dhb8d7ZeapdBdXVtA4w9ysF1rxzdEgl50cqdfpgp6wn7Zt6Im6w6dpDOjMqaJC8 Q73ovSF7d2tEskA/Wn X-Google-Smtp-Source: AGHT+IF0PX+LalGUwW39EyN2VoluiKmvZRTiqaELlbwHxhz/OePewRHVvuqqnMneHZUO9bajq2AVFQ== X-Received: by 2002:a05:600c:4f82:b0:477:952d:fc11 with SMTP id 5b1f17b1804b1-477c11175a9mr311346275e9.16.1764314231084; Thu, 27 Nov 2025 23:17:11 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-4790b0c3a28sm140159725e9.9.2025.11.27.23.17.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Nov 2025 23:17:10 -0800 (PST) Date: Fri, 28 Nov 2025 10:17:07 +0300 From: Dan Carpenter To: Pasha Tatashin Cc: Mike Rapoport , Pratyush Yadav , Andrew Morton , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH next] liveupdate: luo_file: don't use invalid list iterator Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If we exit a list_for_each_entry() without hitting a break then the list iterator points to an offset from the list_head. It's a non-NULL but invalid pointer and dereferencing it isn't allowed. Introduce a new "found" variable to test instead. Fixes: 3ee1d673194e ("liveupdate: luo_file: implement file systems callback= s") Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202511280420.y9O4fyhX-lkp@intel.com/ Signed-off-by: Dan Carpenter Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Pasha Tatashin --- Presumably, this going to be folded into the original patch. I just added the tags because they are harmless. kernel/liveupdate/luo_file.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c index fca3806dae28..86b4d274d9aa 100644 --- a/kernel/liveupdate/luo_file.c +++ b/kernel/liveupdate/luo_file.c @@ -561,17 +561,20 @@ int luo_retrieve_file(struct luo_file_set *file_set, = u64 token, { struct liveupdate_file_op_args args =3D {0}; struct luo_file *luo_file; + bool found =3D false; int err; =20 if (list_empty(&file_set->files_list)) return -ENOENT; =20 list_for_each_entry(luo_file, &file_set->files_list, list) { - if (luo_file->token =3D=3D token) + if (luo_file->token =3D=3D token) { + found =3D true; break; + } } =20 - if (luo_file->token !=3D token) + if (!found) return -ENOENT; =20 guard(mutex)(&luo_file->mutex); --=20 2.51.0