From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 30268470441; Tue, 21 Jul 2026 19:24:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784661896; cv=none; b=hF9kXheE5mgbk7L81+3oKyXpQdN17guJo0tMwL10gP9pFyrE8zt24O7BuPgziRcAqLWNoul6RPyjgWW7GHTS9nXle0KnFxY+AifnYy9OpixwPLV9OKpGFPaRdshf3r5YGsFjVjQFjB3+w6RSj9L+BkE+IaNldRb3aJ91dE904G0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784661896; c=relaxed/simple; bh=Qvk1nMzbV8xDF0D/Fo8RN7uxnj2LB18zH4yFPGzrxvE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t04OgnzieDlI8bzOodqCNcDnf2TyPWhqnnz07tiUfR53JlN/enyqrBfHxtT6v/WjgaViaYgzxrkaBKQN7rgNpbfVUeMjonlBWpJmdD4FsZ/wNz4ZmnGJeUxH8UN8VBpwoMMcDy4xmVzsBFx5xLmIhc/H43HFOT0gkYmuun/3IqM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nMnu1SgZ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nMnu1SgZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E7091F000E9; Tue, 21 Jul 2026 19:24:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784661894; bh=0WhgJ9C6Mk7QpqrDdcHRDsQcqQmXI+cXj9p/otEbAuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nMnu1SgZhMK+7EJpfD6iGP/ZfIBm7vE2n9OHFOZH9iW/dNa2yz4XYuBINZJn4C8B7 TbvlXVhBUK1ysRURqBpS9yU+GTqjOf9ZQOEi9jfKmx00Rxuz41xm7NU9n7jOmreD+5 8cptMotCU7Y+OjuIRAGwI7QB3/+T6X4spJj7+k4w= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Fernando Fernandez Mancera , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 6.12 0240/1276] netfilter: nfnetlink_osf: fix mss parsing on big-endian architectures Date: Tue, 21 Jul 2026 17:11:23 +0200 Message-ID: <20260721152451.461110834@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152446.065700225@linuxfoundation.org> References: <20260721152446.065700225@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Fernando Fernandez Mancera [ Upstream commit a625c94144c9b66d32e1f374f909f38db46161c1 ] The MSS calculation in nf_osf_match_one() manually shifts bytes to construct a 16-bit value before passing it to ntohs(). This works on little-endian hosts but it does not work on big-endian as the bytes are being always shifted and set in the same way for all architectures. Use get_unaligned_be16() to fix this on big-endian systems. It also simplifies the code. Fixes: 11eeef41d5f6 ("netfilter: passive OS fingerprint xtables match") Signed-off-by: Fernando Fernandez Mancera Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nfnetlink_osf.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/net/netfilter/nfnetlink_osf.c b/net/netfilter/nfnetlink_osf.c index c89efb951994a9..b9a0257fa2bef7 100644 --- a/net/netfilter/nfnetlink_osf.c +++ b/net/netfilter/nfnetlink_osf.c @@ -95,11 +95,7 @@ static bool nf_osf_match_one(const struct sk_buff *skb, switch (*optp) { case OSFOPT_MSS: - mss = optp[3]; - mss <<= 8; - mss |= optp[2]; - - mss = ntohs((__force __be16)mss); + mss = get_unaligned_be16(&optp[2]); break; case OSFOPT_TS: break; -- 2.53.0