From patchwork Mon Oct 24 11:29:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9755 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp549821wru; Mon, 24 Oct 2022 09:44:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4aoIzNjAnZAFkBnj4VQwWWbh7prGb5d7vh79zodbLVQHLB3KS+JET21crubM0PksKY5wlK X-Received: by 2002:a17:902:ce8a:b0:186:b051:1c8d with SMTP id f10-20020a170902ce8a00b00186b0511c8dmr4046367plg.82.1666629880994; Mon, 24 Oct 2022 09:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629880; cv=none; d=google.com; s=arc-20160816; b=G5cAqSRNvGyPHME1DMCZCnyS+67evpKbvJZepe7xl6ajmRs/25thRpEfGX7+D/WITR WeU6t7c1ZAP0etdZH4VPHV78eOA1VXnHD2MuLxCtllisIKXTekeL6xI0MZ7HdJVr0xoT 79IJ3B5PnqNzLE651zWOYe5gk5f6zA9z4lV6v07vb63dFw5H7ulrrirvBW20+TWZo0F3 x6NTTJURO1xrq56lnyIrpLKLVcDcB9nbi1raDCrIuZHTUKnxZAZ4Q/6Sg3A/XrdK6f+G M54QJ+LYjP43n85JE+n9WkUyMSaT9ZDdeavv3jlc1g65mXeODzbjkALaDvo+XtY0LjfK Irvw== 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=ePys4YDktupZEK7QU8RJeoMJwyCSOlKfEXFMJxL3S+o=; b=Q9+I4JE+305UDlKtcpPZ4YIx9ts8IW403bT8pJmPJZovRNNNfI5hRshlODpMhsOzWi Q31pDEKSKbQB2ZHLICpnE8/Y8FGw2lkkKb32GpOAg7X3IG6Ta4AFm8lt8hwjl6I7Qedd bKx2r7jfQm3CimTROyPDatcdeaiWXbaG9m0fSr/kXbZJ+wv1VVGHf2ddOZ9P9L1IhwSo hEVyrnVur6hXiMuFVZ/AqAgJVdJ1glw0QJ6B/mXVPIGOPEbBBH67KD6KIRScWmXpvB1s oRfxPoC1MqAWi5g8w0Re9dtGTOcLqjOS4hQ4j6a3BitX+M0Hb+qMPPPsng99qC9Z/Yln KCSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QMS7f0fU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020aa79e0b000000b005669711bcabsi164642pfq.80.2022.10.24.09.44.27; Mon, 24 Oct 2022 09:44:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QMS7f0fU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234145AbiJXQnu (ORCPT + 99 others); Mon, 24 Oct 2022 12:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234682AbiJXQnX (ORCPT ); Mon, 24 Oct 2022 12:43:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB6494E857; Mon, 24 Oct 2022 08:29:55 -0700 (PDT) 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 0A572B81977; Mon, 24 Oct 2022 12:41:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55869C433D7; Mon, 24 Oct 2022 12:41:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615316; bh=rGbOW2KA5RNMBsAhBoGg/Eu+vDYfU83Edy8YwCl2VV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QMS7f0fUjhKCkXqwvpKnU0x+sL8ZrsiTtYJnng6hS5XQiwnYaPJ+LgY66QeXlNj/x GuKOAINo6sxwp+nT4YYzwVjVF6nsIUxBeTCIcXalmcL//ktg1s/kxF0pZ4k5jtv+6c udzpiAZPJCF5cHLpxM0WCJUTVm1m0dmiHKJXCba8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 205/530] net/ieee802154: reject zero-sized raw_sendmsg() Date: Mon, 24 Oct 2022 13:29:09 +0200 Message-Id: <20221024113054.341441619@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588094252480339?= X-GMAIL-MSGID: =?utf-8?q?1747588094252480339?= From: Tetsuo Handa [ Upstream commit 3a4d061c699bd3eedc80dc97a4b2a2e1af83c6f5 ] syzbot is hitting skb_assert_len() warning at raw_sendmsg() for ieee802154 socket. What commit dc633700f00f726e ("net/af_packet: check len when min_header_len equals to 0") does also applies to ieee802154 socket. Link: https://syzkaller.appspot.com/bug?extid=5ea725c25d06fb9114c4 Reported-by: syzbot Fixes: fd1894224407c484 ("bpf: Don't redirect packets with invalid pkt_len") Signed-off-by: Tetsuo Handa Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ieee802154/socket.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index fd5862f9e26a..f160cfc3e8f0 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -251,6 +251,9 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) return -EOPNOTSUPP; } + if (!size) + return -EINVAL; + lock_sock(sk); if (!sk->sk_bound_dev_if) dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154);