Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6771281rwb; Mon, 12 Dec 2022 06:17:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf4rSBiXZYOWikObw+mwnLcqHWvxog1bbzszTSJmoBDF+GGQHzf7kHnByH4h2g26cl+ZBnSH X-Received: by 2002:a17:906:39d7:b0:7ad:c8d7:4fd9 with SMTP id i23-20020a17090639d700b007adc8d74fd9mr12673264eje.36.1670854642942; Mon, 12 Dec 2022 06:17:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670854642; cv=none; d=google.com; s=arc-20160816; b=fQfU58L5gKjL2l36iF+AQI3w3X2HOTqdCu1DbhblfFIxHUxkZCsCX6fHVaSx/0pnzd Fe2gDELi5Zaip9IOujxm1aGcUCRGNP1Yos0H5wmF+4kFCyVuHvJgBvOFYCJD5rs1CzsG qI32fIAacCbC640Xv+2eD/gM1OcCxECKOARk/yntqVInOiHh0w6yY3HE/rKyHLHD08Sg K/r9uNLOW4f5eJiaNafKmXZyIMJ8Txq7tQ+X74WY9w//HmoRO6XceFQnwW80sLUcgc3C KdXnDKyMgsO1MjkVrSARfkXfrTSFfLrT22mwn21ST8DdbksEx+cvTkhSmr3+hB62bRSq OcuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cO3Dx3OHHxJSEXzaZsdDqnwyc7eLG61Edw6kEr88FUU=; b=Pg8Jt8kRYYIgrS0gNd+vPjCz0LkfiSNrYFy3TbpeRucmtY2Z2bPZsgfNp5mwE/xIS+ eDd/tX7UDAUkLFOjwrbmV3TO6Arb9sr/cNLrx9kuvseB0PufL87sPXgWfirixMyCLVP9 phdpc630qUupS5SMpv9KvwtveHfyHvxLlDMOwIBZJYK2BwNFardYc8ZYcg176jIxr9sd NmajEVf5xrrRUgMQH2xKRhOIZPUoqpX/A8BaHToONvE1oCF43Py5BjKJeuQI4KQNud9x Ak6lzDH1noyPIXge22h/r4RFB+UqTUEg3vmVk8OZXuVWv4ImUCRYtMEjwzpH2p1vEXyk gLxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@metanate.com header.s=stronger header.b=PIQL8ifI; 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=metanate.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs13-20020a1709072d0d00b007b284329e36si7580184ejc.131.2022.12.12.06.17.03; Mon, 12 Dec 2022 06:17:22 -0800 (PST) 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 (test mode) header.i=@metanate.com header.s=stronger header.b=PIQL8ifI; 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=metanate.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233206AbiLLN4z (ORCPT + 75 others); Mon, 12 Dec 2022 08:56:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233324AbiLLN42 (ORCPT ); Mon, 12 Dec 2022 08:56:28 -0500 X-Greylist: delayed 1115 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 12 Dec 2022 05:56:16 PST Received: from metanate.com (unknown [IPv6:2001:8b0:1628:5005::111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 256F615A2B; Mon, 12 Dec 2022 05:56:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metanate.com; s=stronger; h=In-Reply-To:Content-Type:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=cO3Dx3OHHxJSEXzaZsdDqnwyc7eLG61Edw6kEr88FUU=; b=PIQL8 ifItxTKeDkURpz5aWa2Szu4wbUbPUFIZ/PBC1DzBkkbw4AqIoX2oJJSZS/z0fFB94RtbBN8iKFZJg uZR3hqZ+C3AZz5J2pS+eao6GdpH5bTt4Op0V8S2PqBvApykhwFZxE86rebXibIlbHczI0XomGMuvD IqUVhDRbEL/Q4OuRu8f5If7WdhMwZLdODpQ7jGAoDF5eBfrAcGeCBP+hVN6qKa8q5tWgYjwafQPIh BTt1yjNgLigmm7pj9zkp3VRo8HiiOrKiGhamiJm9xfDqE8cQeV2RvGRx7uKgd57mK2mOZCQbwf+T5 vaPUkMWPMVhhloR9njp8L0UCy8qaQ==; Received: from [81.174.171.191] (helo=donbot) by email.metanate.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1p4izs-0007Q1-Hs; Mon, 12 Dec 2022 13:37:33 +0000 Date: Mon, 12 Dec 2022 13:37:31 +0000 From: John Keeping To: Prashanth K Cc: Greg Kroah-Hartman , "Gustavo A . R . Silva" , Shuah Khan , Linyu Yuan , Pratham Pratap , Vincent Pelletier , Dan Carpenter , Udipto Goswami , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "# 5 . 15" Subject: Re: usb: f_fs: Fix CFI failure in ki_complete Message-ID: References: <1670851464-8106-1-git-send-email-quic_prashk@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1670851464-8106-1-git-send-email-quic_prashk@quicinc.com> X-Authenticated: YES X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RDNS_NONE,SPF_HELO_PASS, SPF_PASS 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 On Mon, Dec 12, 2022 at 06:54:24PM +0530, Prashanth K wrote: > Function pointer ki_complete() expects 'long' as its second > argument, but we pass integer from ffs_user_copy_worker. This > might cause a CFI failure, as ki_complete is an indirect call > with mismatched prototype. Fix this by typecasting the second > argument to long. > > Cc: # 5.15 > Signed-off-by: Prashanth K > > --- > drivers/usb/gadget/function/f_fs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c > index 73dc10a7..9c26561 100644 > --- a/drivers/usb/gadget/function/f_fs.c > +++ b/drivers/usb/gadget/function/f_fs.c > @@ -835,7 +835,7 @@ static void ffs_user_copy_worker(struct work_struct *work) > kthread_unuse_mm(io_data->mm); > } > > - io_data->kiocb->ki_complete(io_data->kiocb, ret); > + io_data->kiocb->ki_complete(io_data->kiocb, (long)ret); I don't understand the problem here, ki_complete() is declared with a long parameter, so won't integer promotion kick in so that the function is called with a long? Why is the explicit cast necessary? > > if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd) > eventfd_signal(io_data->ffs->ffs_eventfd, 1); > -- > 2.7.4 >