Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp959255pxb; Wed, 6 Apr 2022 05:20:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBtHsH+mw/X6vVjFXyRiiR+5NqDOjEUOsDD58hiTbs1GvgrnKfqsWk7JGPMzjiGVXkW8no X-Received: by 2002:a63:d955:0:b0:398:b864:ab71 with SMTP id e21-20020a63d955000000b00398b864ab71mr6973073pgj.515.1649247641275; Wed, 06 Apr 2022 05:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649247641; cv=none; d=google.com; s=arc-20160816; b=b2pHMgiIvdc3RePiBnF+EIRlaMxx6qTn7IdPRwkkEpKpaF/bvj5/+yCdmRVx/bp5il g/DShxWSR9M4OgJxNDb90mNUCOkAjS1QboOyXYVT4NH9sQwduQoo5lqQYPiSmZgajbo+ RIQuIp6BkH85Y2qYlbcI3Bc0MAbvbjnIueTrLoV8TkQkzOYw8SZxd+I8Y2v+1T6kG+i+ ACvpnYfN3W213sQ+zWr8qHkBBBhjoGQCkXhfXQbLZwGeYrXq6gmKAAONn+KIOaCUBVJ9 Ot4F17s8Fxa/9bbrWz4cN4B8CCtjOM1laDd3Yjmcq0Y4YMeATNPk3t7NKktU18eC0xVG 0/tQ== 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=sof14yQKMw9OybOQ2KFHJUWaaAAx0+4UG7iWBbdPruk=; b=HPaLhf/yMcLIWx35hw07hoO1yj11W0jG5SStwKfj8SngdSN8nGPZuABrV551xGdtzL 7QigWn0VcZ0mXN9cXhtQRwFl+c0sLj6IgBGp1tMuw8R0C/g+AIFvzI/j1Hmyo7GT2hrV 7IPH+JPnVsnpolBonAWTi7++txXkkPru5afR4aES3BmSWAcj2BQGd9RiGlMcgPNVmzYl 7hjWKuVvhc1jHwNEriLFTIAA+uTYH7+HmemspJ4vpR1kL1rnjwsiuK95h0UaBXp0NQga 9T9kaB3kGHeUZYJVvKDQ4i2tOA3dX/LDNuHuJG9xoHNh/0d2eU5SO3ikfumeuojIGhiZ K2Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xl8GJnBe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p1-20020a170902e74100b00153f6255da2si16352593plf.227.2022.04.06.05.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:20:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xl8GJnBe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EC5815DCE8F; Wed, 6 Apr 2022 04:17:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229839AbiDEWl1 (ORCPT + 99 others); Tue, 5 Apr 2022 18:41:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354187AbiDEKMP (ORCPT ); Tue, 5 Apr 2022 06:12:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F0C652B33; Tue, 5 Apr 2022 02:58:08 -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 D7BBFB817D3; Tue, 5 Apr 2022 09:58:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45AC9C385A1; Tue, 5 Apr 2022 09:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152685; bh=f19IgujV/yw7D/q+fpx39ycuktKtJQPW23eKnN0ZCdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xl8GJnBeQ/3DzyJ7GtataMBRZvZgIjmR/fDXc1n31XSAqJNr5ztof5Rc1phJ2Dd0r ruuUsxH/BauAxHhllWf0SsLrEeb9FHyXI5eXCO14wixA9oPHfRkuFn7OyyCzzHH//q BiJ5hmHEW5t+uz4VIb9Qb59DlcE63OUSjXjFoueU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, PaX Team , "Jason A. Donenfeld" , Jakub Kicinski Subject: [PATCH 5.15 828/913] wireguard: queueing: use CFI-safe ptr_ring cleanup function Date: Tue, 5 Apr 2022 09:31:30 +0200 Message-Id: <20220405070404.649763119@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Jason A. Donenfeld commit ec59f128a9bd4255798abb1e06ac3b442f46ef68 upstream. We make too nuanced use of ptr_ring to entirely move to the skb_array wrappers, but we at least should avoid the naughty function pointer cast when cleaning up skbs. Otherwise RAP/CFI will honk at us. This patch uses the __skb_array_destroy_skb wrapper for the cleanup, rather than directly providing kfree_skb, which is what other drivers in the same situation do too. Reported-by: PaX Team Fixes: 886fcee939ad ("wireguard: receive: use ring buffer for incoming handshakes") Signed-off-by: Jason A. Donenfeld Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireguard/queueing.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/wireguard/queueing.c +++ b/drivers/net/wireguard/queueing.c @@ -4,6 +4,7 @@ */ #include "queueing.h" +#include struct multicore_worker __percpu * wg_packet_percpu_multicore_worker_alloc(work_func_t function, void *ptr) @@ -42,7 +43,7 @@ void wg_packet_queue_free(struct crypt_q { free_percpu(queue->worker); WARN_ON(!purge && !__ptr_ring_empty(&queue->ring)); - ptr_ring_cleanup(&queue->ring, purge ? (void(*)(void*))kfree_skb : NULL); + ptr_ring_cleanup(&queue->ring, purge ? __skb_array_destroy_skb : NULL); } #define NEXT(skb) ((skb)->prev)