All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Keeping <john@metanate.com>
To: Prashanth K <quic_prashk@quicinc.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Gustavo A . R . Silva" <gustavoars@kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Linyu Yuan <quic_linyyuan@quicinc.com>,
	Pratham Pratap <quic_ppratap@quicinc.com>,
	Vincent Pelletier <plr.vincent@gmail.com>,
	Dan Carpenter <error27@gmail.com>,
	Udipto Goswami <quic_ugoswami@quicinc.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	"# 5 . 15" <stable@vger.kernel.org>
Subject: Re: usb: f_fs: Fix CFI failure in ki_complete
Date: Mon, 12 Dec 2022 13:37:31 +0000	[thread overview]
Message-ID: <Y5cum5pYxro1SYtx@donbot> (raw)
In-Reply-To: <1670851464-8106-1-git-send-email-quic_prashk@quicinc.com>

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: <stable@vger.kernel.org> # 5.15
> Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
> 
> ---
>  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
> 

  parent reply	other threads:[~2022-12-12 13:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 13:24 usb: f_fs: Fix CFI failure in ki_complete Prashanth K
2022-12-12 13:35 ` Greg Kroah-Hartman
2022-12-14 13:08   ` Prashanth K
2022-12-14 14:56     ` Greg Kroah-Hartman
2022-12-14 17:35   ` David Laight
2022-12-22 12:51     ` Prashanth K
2022-12-23  9:04       ` Dan Carpenter
2022-12-23 14:41         ` Alexander Lobakin
2022-12-23 14:51       ` 'Greg Kroah-Hartman'
2022-12-12 13:37 ` John Keeping [this message]
2022-12-12 13:49 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y5cum5pYxro1SYtx@donbot \
    --to=john@metanate.com \
    --cc=error27@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=plr.vincent@gmail.com \
    --cc=quic_linyyuan@quicinc.com \
    --cc=quic_ppratap@quicinc.com \
    --cc=quic_prashk@quicinc.com \
    --cc=quic_ugoswami@quicinc.com \
    --cc=skhan@linuxfoundation.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.