From patchwork Mon Oct 24 11:31:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8541 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416858wru; Mon, 24 Oct 2022 05:12:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5uzwIHcHF+dXFv9QUBs3KNJdT32ApkATxJOUbupsmJElbimMhi64fnsnwHF9vK4v/4mS3B X-Received: by 2002:a17:907:983:b0:77b:6e40:8435 with SMTP id bf3-20020a170907098300b0077b6e408435mr26012862ejc.570.1666613539717; Mon, 24 Oct 2022 05:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613539; cv=none; d=google.com; s=arc-20160816; b=A2RSVuH9IunlvhK3X+6Z0gujfzBl3kX4XI6AGkJk3PtMastskSb+IYeaC06i/HLJzH jNDbRhsXdid12JubsUSdOi0lREEI49yvPda3U/hw6MkCb/T2OAAVOWRYeK5yEWAWT6Qb eG+QzAxWCJTTL/59T5bcfCKOzeXzdzAtkLnAfVyNV88giWJXGnPokbHD0Vw6DAvJDp5o mc13mQr3wRO53ezzq2BoVVinbm2pMRQTE1heyXDl5StxO7q5ft6Bcyketgycgck1ruRb Zs3dcACXU5lk2CKr+sAdaTHY2SzNymm85bip5o5sFDBqSsrcRC6cbdBmovHlRTzoe8Oc Ff/w== 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=1BZa5pg8ez/v1arBqntjsbw9ELfkZlHaXsZ5+RKp3A4=; b=BPJiWcm1kAk6BaiXBYslI8Cc17tLy6XxtnVYbHWWJ4p6hu/ngxD2akKW/HqRFmy0f2 eivHgQNx68ql4amRhnPed1o7DtTcnMnZS5yMNgvbegntQq4PMYwPT+VuLQl3F+BNwhE8 qtCqWuXg7V67VlcpH/ATknZkCxN2CldUYBkIKU74TmgVnKEf0D6pwlsMGrvg88G/SXe/ WDodZ8X4yZsIDBa/B1/02W7brXN7AKnlhgRQBk8QmEFuCxisso2V1lv6IbsHa69on4hX xvKJTGctmoxAsGTZGptbqGPdAIyG/+jX1B4XfPc6qH4XoZ0au+0aG2/p1KiV/+JftR90 9xCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=18MiyHvn; 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 e26-20020a170906c01a00b007826cb6f57csi24203317ejz.407.2022.10.24.05.11.55; Mon, 24 Oct 2022 05:12:19 -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=18MiyHvn; 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 S232382AbiJXMA1 (ORCPT + 99 others); Mon, 24 Oct 2022 08:00:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232399AbiJXL63 (ORCPT ); Mon, 24 Oct 2022 07:58:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD8EC7B78F; Mon, 24 Oct 2022 04:47:45 -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 9E013B8118F; Mon, 24 Oct 2022 11:45:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F15E8C433C1; Mon, 24 Oct 2022 11:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611933; bh=nv0Xta5zNXOXSNDgY+pzkso/6hKXbxPTC/9RJLP/Unc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=18MiyHvnmxzh46IAsYawy+hDkVrH0rb4Nee9hHKFH6WK3sUNGX8BA2fxgmSbZcRI3 LOkeKEkcvt7v/WWpL+cpX4Zf+IhlzCbvbQfgYJijgDHxVgXsLaR9y1muOCjYwixTEp j9AKYwsV9uZM88W20+/hbZTZ5jQIOWNXAIrCPJGg= 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 4.9 155/159] net/ieee802154: dont warn zero-sized raw_sendmsg() Date: Mon, 24 Oct 2022 13:31:49 +0200 Message-Id: <20221024112955.076463623@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570958784086527?= X-GMAIL-MSGID: =?utf-8?q?1747570958784086527?= 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 c624a54502f3..aadd445ea88a 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -284,6 +284,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;