From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leon Romanovsky Date: Tue, 12 May 2020 06:29:36 +0000 Subject: Re: [PATCH] RDMA/rxe: Return -EFAULT if copy_from_user() fails Message-Id: <20200512062936.GE4814@unreal> List-Id: References: <20200511183742.GB225608@mwanda> In-Reply-To: <20200511183742.GB225608@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dan Carpenter Cc: Zhu Yanjun , Sudip Mukherjee , Doug Ledford , Jason Gunthorpe , linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org On Mon, May 11, 2020 at 09:37:42PM +0300, Dan Carpenter wrote: > This function used to always return -EINVAL but we updated it to try > preserve the error codes. Unfortunately the copy_to_user() is returning > the number of bytes remaining to be copied instead of a negative error > code. > > Fixes: a3a974b4654d ("RDMA/rxe: Always return ERR_PTR from rxe_create_mmap_info()") > Signed-off-by: Dan Carpenter > --- > drivers/infiniband/sw/rxe/rxe_queue.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) Thanks, Reviewed-by: Leon Romanovsky From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA6C7C54E4B for ; Tue, 12 May 2020 06:29:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C575D20836 for ; Tue, 12 May 2020 06:29:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589264981; bh=O8I7o1RCa0JpLsUgCQ7eBV36I9wq4mAuill8a5ESQLA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=rso8GiCmjJ4cGPJBnjNaCoaZrg4yXGK+roHL1wRGOrPCXAZVePFysr0B5513j8Zrv 8FFMZyFWLIrZ6XAhcMlX4nhPHlTSp6Ma4pvtFWqt8RFFvPlmWJS0v+3eaOwQaAqz52 vMVwkXo2T/HTOejLGYTtWX9bmlZ1wAUxweJ29o9I= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725987AbgELG3l (ORCPT ); Tue, 12 May 2020 02:29:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:38284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725536AbgELG3l (ORCPT ); Tue, 12 May 2020 02:29:41 -0400 Received: from localhost (unknown [213.57.247.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EE7D220733; Tue, 12 May 2020 06:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589264980; bh=O8I7o1RCa0JpLsUgCQ7eBV36I9wq4mAuill8a5ESQLA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lLCpUBr1oGZhjU5G7afGHrEjDwKJ4Fc35dDvJzwmZGsPgUKFL67k06FF71ihkRJam 5NZiOqTZ6QrKTjWdz+kIewFrvCF8Szwfzd7euh46g9kNEcp5asXcHH1Rm0VDr+OC/2 L5R8st7CyuF0qVnPP5wq7xGtn+WDfOHxBVeZPN2s= Date: Tue, 12 May 2020 09:29:36 +0300 From: Leon Romanovsky To: Dan Carpenter Cc: Zhu Yanjun , Sudip Mukherjee , Doug Ledford , Jason Gunthorpe , linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] RDMA/rxe: Return -EFAULT if copy_from_user() fails Message-ID: <20200512062936.GE4814@unreal> References: <20200511183742.GB225608@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200511183742.GB225608@mwanda> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Mon, May 11, 2020 at 09:37:42PM +0300, Dan Carpenter wrote: > This function used to always return -EINVAL but we updated it to try > preserve the error codes. Unfortunately the copy_to_user() is returning > the number of bytes remaining to be copied instead of a negative error > code. > > Fixes: a3a974b4654d ("RDMA/rxe: Always return ERR_PTR from rxe_create_mmap_info()") > Signed-off-by: Dan Carpenter > --- > drivers/infiniband/sw/rxe/rxe_queue.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) Thanks, Reviewed-by: Leon Romanovsky