From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796221098; b=ubDDQ+g0nmA4FTNMEV3n0Xsj6bK0tpyiJ4vbv+IUZfeLAqoGvqI3vcI4SIomK0ogYZFm ioLG1GmusZDpVYaGHBxCLkYL5Jn6K0Y+NZyY1rG9+InEDS2qUdSUySJMhz+mzQwzMepaz t8ZFQDpovzCUsvdmWaKgUJiyNkA+BhdigzxxScfqmo81n3VO9oi+JVtX8Bw13AfMdSYQg gTXGWInsOtBKTp/615DV9xTB9lxsIQsxDSpHWUzkKtRCYdSBBlAmDPXWPn9u7U7lk92LN r8rvq7EUbf0NvccROmvthbOBEElB9515D5g899wb7sSdk9epbddoOcZ9owfZN4VI4cw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221098; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=U2cMVOfW6EsYoVo25H1w7B7ZqQW6S29JwLLLyuwqL8o=; b=DDt3exHHuiyhjLdmoaj+qWwdou50Wkdv0eqzdO2dGS/T0s5nUS5ZFwUknp1y4tGL8/lc RTI9HalvFvDxvNJrY2LJOuqRKIjFrjFEqzboYU/sap3zlxXJy3XRkYxKE/FJ8ojHk1KxL CiK2QDps2Vsea4T2+JU6+LJW6g5taTGC7DmWT0C1CKEl3kVz2t7Tmjtqg89a9hfXNa4z2 zRKtqW2s33gZkvdDAgzZ0boNwoQoEWXZMWcGUm63dvfCDlJ7lqdfGiQYN0ojdGlukYnLs lrbrHAbik7FIikKh04ObT4jbVgUgGOIV4TBnqWc2z0vcMoekmu85z7hMticuSFNySmw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="k/6KvrId"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E98F1606A322 for ; Wed, 2 Dec 2026 14:18:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=k/6KvrId Received: by smtp.kernel.org (Postfix) with ESMTPSA id D44511F0089B; Wed, 2 Dec 2026 14:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221097; bh=U2cMVOfW6EsYoVo25H1w7B7ZqQW6S29JwLLLyuwqL8o=; h=Subject:To:Cc:From:Date; b=k/6KvrId4OVCHyBUd64fQD6b78B9DjQNDTqXbaUjJIFfeJJ+EdJzGxoA5uYsl4/5p ckyizIK5pCAM97aImfjVyR99J3wGnvKy8dSyDTrz6iUMEpH6IU0lTWFRUCDnJsGnau N9kLCk4/1cHfXqd+4TA1YEOC7G+DMX3a66N9ef4M= Subject: FAILED: patch "[PATCH] gpiolib: don't overwrite the entire flags field in" failed to apply to 6.12-stable tree To: bartosz.golaszewski@oss.qualcomm.com,warthog618@gmail.com Cc: From: Date: Wed, 02 Dec 2026 14:06:27 +0100 Message-ID: <2026120226-attitude-radial-6af0@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.12-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y git checkout FETCH_HEAD git cherry-pick -x 8ed87a9adf48703b5729f9d020eb15fa79ffb099 # git commit -s git send-email --to '' --in-reply-to '2026120226-attitude-radial-6af0@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 8ed87a9adf48703b5729f9d020eb15fa79ffb099 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Tue, 10 Nov 2026 14:47:01 +0100 Subject: [PATCH] gpiolib: don't overwrite the entire flags field in gpiod_get_direction() gpiod_get_direction() snapshots desc->flags with READ_ONCE(), updates FLAG_IS_OUT in the local copy and writes the whole word back with WRITE_ONCE(). Any bit that a concurrent user sets or clears atomically in between - for instance: FLAG_USED_AS_IRQ from gpiochip_lock_as_irq() - is silently lost. Update FLAG_IS_OUT with a single atomic assign_bit() directly on desc->flags. The earlier READ_ONCE() snapshot is only used for the open-drain check and stays. Cc: stable@vger.kernel.org Fixes: 2559f2e09211 ("gpio: reinforce desc->flags handling") Reviewed-by: Kent Gibson Link: https://patch.msgid.link/20261110-gpio-desc-flags-atomic-v3-1-2f463bce8086@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index acd3a1710f84..91041ce0fd49 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -489,8 +489,7 @@ int gpiod_get_direction(struct gpio_desc *desc) if (ret > 0) ret = 1; - assign_bit(GPIOD_FLAG_IS_OUT, &flags, !ret); - WRITE_ONCE(desc->flags, flags); + assign_bit(GPIOD_FLAG_IS_OUT, &desc->flags, !ret); return ret; }