From patchwork Sat Oct 22 07:29:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7709 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109484wrr; Sat, 22 Oct 2022 01:48:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4boGErbF0uOF4lkJ9a0mjFt2AT0HoLUMjHir6sgZVTtRFR6ZjJi35svi6nrzQMYJkArxmc X-Received: by 2002:aa7:c58e:0:b0:461:77b:7bd with SMTP id g14-20020aa7c58e000000b00461077b07bdmr10464853edq.387.1666428525343; Sat, 22 Oct 2022 01:48:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428525; cv=none; d=google.com; s=arc-20160816; b=e7GX4YDP/TgrlxPwzw61Bn2DlwSulZEhUkCVZGO33XbjsSFz1di2h+inZbz9vCwZL8 ZF510+UYOR3AlYF6bR/6imZ6yQ2eGO32SL+VKsElc/LP3RImdviFYafp23mX7DHEs8Dp BajiQu8peMIIsba2qsnGo7Zf8wUAy+5kBsoeI+Z3JspvCSpZTGA1CZUPKhS+gYutOUBp HH8h1CBCF1hEOM8O/56jDal2HK8XJlGp+TUDcYkoTtOen/55gIcqVHYx+itULJFjXKxi igjvNeHfBtuDEa8CKTs9SeJkAFMWo5mzr0EOuIyBKHlN8TKdvC9W+SYF85kSOpzmriDR geVg== 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=T7VFqri3vWZMyD1Z23N5CPaysfrStChxZB418zLMELk=; b=oVMhkqJo+eXaP2QtRMUWuGOvcOqtpdC7qBYhiX11GOVyOFT89gFQ9qLWb3RTbXNw3D m6TqhuFgdWVFuKhKh92Xn1Yusba69Mm+D9r0JiHtiWdVB+qZkfx8mOIxBZMSRbBYD9UZ DDXfy1ofF5vhM+lexjrzmY5JPOlEZ8sscQmca09Q3jfRGeXpAjSk1wgjYXhZaWU0/I/A uthHl6piiRFwDwmaUgpGeeh/e3z3PC5x6AdXyeeq7PLGACOMXE0/dUQNUeSB0SOVaHCV xpvF+AUVAkl33WoSbc2riVq2A/YiooMt12GyTmXHh6WZmbkSrX2lhu5ZFHXnLT2355PE P3EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yOa0tD1U; 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 g12-20020a1709065d0c00b007707ab4be23si23920783ejt.560.2022.10.22.01.48.21; Sat, 22 Oct 2022 01:48:45 -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=yOa0tD1U; 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 S234186AbiJVIry (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235238AbiJVIpA (ORCPT ); Sat, 22 Oct 2022 04:45:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E5C32CB8D1; Sat, 22 Oct 2022 01:09:12 -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 dfw.source.kernel.org (Postfix) with ESMTPS id C698060B76; Sat, 22 Oct 2022 08:07:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B81EDC433D6; Sat, 22 Oct 2022 08:07:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426063; bh=yYS4ckK6yz5zGnPL/ph/3qIwybyY33znX9KX1T7WhTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yOa0tD1U43dhQVu+VkD/OXCUM2P2bNWlq4+nv8lQb/R2rpmXo1u4mE4v4LVc5HK6s LEFJ8DsIezziScAZMmCNIHvo7O1xozo116h/LuuiNMYbYOOzyqnPIEr+lyyQcU6J54 FMCuf6nkQRtz+zPpByCmG4tbj/elzvpZU3mnWMr4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Alexander Aring , Stefan Schmidt , Sasha Levin Subject: [PATCH 5.19 706/717] net/ieee802154: dont warn zero-sized raw_sendmsg() Date: Sat, 22 Oct 2022 09:29:45 +0200 Message-Id: <20221022072529.669043843@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376957344599777?= X-GMAIL-MSGID: =?utf-8?q?1747376957344599777?= From: Tetsuo Handa [ Upstream commit b12e924a2f5b960373459c8f8a514f887adf5cac ] syzbot is hitting skb_assert_len() warning at __dev_queue_xmit() [1], for PF_IEEE802154 socket's zero-sized raw_sendmsg() request is hitting __dev_queue_xmit() with skb->len == 0. Since PF_IEEE802154 socket's zero-sized raw_sendmsg() request was able to return 0, don't call __dev_queue_xmit() if packet length is 0. ---------- #include #include int main(int argc, char *argv[]) { struct sockaddr_in addr = { .sin_family = AF_INET, .sin_addr.s_addr = htonl(INADDR_LOOPBACK) }; struct iovec iov = { }; struct msghdr hdr = { .msg_name = &addr, .msg_namelen = sizeof(addr), .msg_iov = &iov, .msg_iovlen = 1 }; sendmsg(socket(PF_IEEE802154, SOCK_RAW, 0), &hdr, 0); return 0; } ---------- Note that this might be a sign that commit fd1894224407c484 ("bpf: Don't redirect packets with invalid pkt_len") should be reverted, for skb->len == 0 was acceptable for at least PF_IEEE802154 socket. Link: https://syzkaller.appspot.com/bug?extid=5ea725c25d06fb9114c4 [1] Reported-by: syzbot Fixes: fd1894224407c484 ("bpf: Don't redirect packets with invalid pkt_len") Signed-off-by: Tetsuo Handa Signed-off-by: Alexander Aring Link: https://lore.kernel.org/r/20221005014750.3685555-2-aahringo@redhat.com Signed-off-by: Stefan Schmidt Signed-off-by: Sasha Levin --- net/ieee802154/socket.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index 7889e1ef7fad..6e55fae4c686 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -272,6 +272,10 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) err = -EMSGSIZE; goto out_dev; } + if (!size) { + err = 0; + goto out_dev; + } hlen = LL_RESERVED_SPACE(dev); tlen = dev->needed_tailroom;