Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3631405pxb; Mon, 24 Jan 2022 13:59:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyaiybN5KFLZN99J1sU17rHczUraqGXuAsfApsZahaIdk2PyJvoPAJf4GlZisS/XndtnEcC X-Received: by 2002:a17:903:32c8:b0:14b:1902:2d71 with SMTP id i8-20020a17090332c800b0014b19022d71mr15963929plr.23.1643061561304; Mon, 24 Jan 2022 13:59:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061561; cv=none; d=google.com; s=arc-20160816; b=mJkm4W6Y2KG+ZpNVU8kOigTPwq9VLMl1mIE1oQkAA8M5gCp4rVLREsBCJe1RUzO+GM z4IrH7Y4ODmzcGRvu1M9HRNmCk4bGNpABT5PNQ+iNA8gfPOsyDmFH1MpUoxeVoItpV6Q AJBFdMkY2JWaI2ZWdMDvqEU2vo2Rwg6BOMhtZ/Nk6XjWuCN/rwZzI3tNOFXUysXr2stV T9ZHxkoC7QX4KqWQrAZdQt02xHlyWrnF1UUKbbW4HktRxvDOBhwesjeU/OcMGuErGHGx +6juWjqjp+sFN16R0jWKDn7KajGigFun/5S8OEl9vRC4b4wJyIy++D1OwH6sFIlRzjYX 6LKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PznyltB4Xjwc3PgKAGKfvpQKwkW+Se0MZl8FgJpWlLA=; b=edlR8c0E3K7rjBE63ghFW+KKs17j6IQr7QSjBhSy+52istrOL8RDHvH+FfFIxnX0Jt 78tLXmUYgRY9XvQr2K/Jc3FXp6WbaZ5h35pmIjF/S8Oij1h9xWqhlvNqeLjGJuXsF5Y/ RpmHAUHeI3ellczaiiNbfrKTyey8ww4l8yj0yig6ViOS3o9Szc1el2kVGRkFJGkaWyoo cH+rrzoNrZaEfqwn1nWIREcnjh7qwHmEnIPPcLKRxhPfhyl5BEZOGz1hvC7qpHznqjia FgxU0aicic6XSnWcyGpduLH2MAu97jbhBjKk/D1/SXuZzB6Bf2/BCY0dvkCTlYaLffp1 T4mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="C/IjIU8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si15566052plh.459.2022.01.24.13.59.09; Mon, 24 Jan 2022 13:59:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="C/IjIU8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574451AbiAXVtX (ORCPT + 99 others); Mon, 24 Jan 2022 16:49:23 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:34670 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448834AbiAXVNy (ORCPT ); Mon, 24 Jan 2022 16:13:54 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 26373B811A2; Mon, 24 Jan 2022 21:13:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 384DCC340E5; Mon, 24 Jan 2022 21:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058831; bh=I6eodZE1LcEU8Q+OsMt9Qrl7f05Xen+Z8HM/mrSDGKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C/IjIU8/nUTcwnh+OYRKuBCyJz7fVKMwNC7fs/idICvFpQwUkDaq8jgKPgyLkV3BS 2LtYhO0eJCsOQtkBtPk4ye6Z6fykcImebsvKj8qwz2emffYoKHTXlD6qKBfl+wfTJY O6tCRyOD3+6itBwEPJMC7wDEQ3LxDQfe/LVsV08I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 0417/1039] Bluetooth: hci_sock: fix endian bug in hci_sock_setsockopt() Date: Mon, 24 Jan 2022 19:36:46 +0100 Message-Id: <20220124184139.328443652@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit b9f9dbad0bd1c302d357fdd327c398f51f5fc2b1 ] This copies a u16 into the high bits of an int, which works on a big endian system but not on a little endian system. Fixes: 09572fca7223 ("Bluetooth: hci_sock: Add support for BT_{SND,RCV}BUF") Signed-off-by: Dan Carpenter Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/hci_sock.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index d0dad1fafe079..f2506e656f3e4 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -1915,7 +1915,8 @@ static int hci_sock_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval, unsigned int len) { struct sock *sk = sock->sk; - int err = 0, opt = 0; + int err = 0; + u16 opt; BT_DBG("sk %p, opt %d", sk, optname); @@ -1941,7 +1942,7 @@ static int hci_sock_setsockopt(struct socket *sock, int level, int optname, goto done; } - if (copy_from_sockptr(&opt, optval, sizeof(u16))) { + if (copy_from_sockptr(&opt, optval, sizeof(opt))) { err = -EFAULT; break; } -- 2.34.1