Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5242783img; Wed, 27 Mar 2019 05:03:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9bk+a5Jiv7pXqDmXTmWBS20FIaI45oIS5rwXDHp+M/VBD+luXc83iLkdZ/y+msYsJ9u/m X-Received: by 2002:a17:902:a706:: with SMTP id w6mr12081453plq.91.1553688203701; Wed, 27 Mar 2019 05:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553688203; cv=none; d=google.com; s=arc-20160816; b=pjW9x7Pa/iR6djiHWguv8fE372d7J0QpSZbR12VAcC+Nf7aiz8pnDPYjxemnyeUONW y5h2QGRuOo9f9JqvCAzU8qbS/VPZuXOxkafUKuhRr6bgUuW1y1mpnXa3NZP1zdgeZw9X d8IxGVx9QAJS3qffQLdT6rbYf15okZssrI20ZLfoQBtNuVuimqPdfe6XUu9X1UlL0UGW 0H1Coogvkyu52Ncba5gYvwVt6yyA51SV4BysxWdzpiKLi+DFQoMWbGNQ44SvIA+f/j3O rPV3579TDXLgcQrA2K+ZMgeakzZrB9c44SAI8Fq4lMufyaH4q/CgzS+Hx0pmNQY4CiXe UGoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature; bh=MWQ9yzXmvAqDq/dc9icexX7p2DtgTh5ye+mnsS7y+sA=; b=pFnH+Ly3niMTJHYzIc4xJ6e6g0j1RaVWlyacyUXvMrzLSK65y1afhNb1SMT14GdeMm Jr74O6p+dgX1D6e3Swqu6yfNzHmM1337gia15KBFSqYhXxqed2QhuYsGCK2IY4Qsgub4 bSs+ox3wbWKFJMSDu/COrfqRqycvFgUwgiV1ZcaQgE28jKNGnFeXWLtiJzaHnXHGqhAx VZgswklrVpUL6I+7dapwCVNzzIf7ztCgcktluP8529pO+G/XUosJNzyd5OAcySf4BKRb 1YgewtUNZFlR7j6EMNVr8VuakSC0DlYZRr+/PO7r4qX5qON+A5EUw0u9faNSWacIajf5 qAZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=lnZNAO6U; dkim=pass header.i=@codeaurora.org header.s=default header.b=lnZNAO6U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si12695463pgn.457.2019.03.27.05.03.08; Wed, 27 Mar 2019 05:03:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=lnZNAO6U; dkim=pass header.i=@codeaurora.org header.s=default header.b=lnZNAO6U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728778AbfC0MCR (ORCPT + 99 others); Wed, 27 Mar 2019 08:02:17 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:58138 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727488AbfC0MCR (ORCPT ); Wed, 27 Mar 2019 08:02:17 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id A4E5C60CF1; Wed, 27 Mar 2019 12:02:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553688136; bh=d8OIWgQ+HFsqF+/1669O8AOqclvMD9W6J6ZOJwwvRy0=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=lnZNAO6U6pHLdsbJ1NtUu26z2l7o1kx7pXIGuL/H0a3I10/tuuxvFQkuXuxd+yxUl VLKCI4LMYdkV0DV+MtkwqgBj73rZLzN+k+8+F+9aOhqTShecGq0lOGqt3p/ZINwUTA dkOo5Brww26flTg+dy/gQr+Omgw9S+sF/kXBokpc= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from [10.204.79.83] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mojha@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C629560790; Wed, 27 Mar 2019 12:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553688136; bh=d8OIWgQ+HFsqF+/1669O8AOqclvMD9W6J6ZOJwwvRy0=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=lnZNAO6U6pHLdsbJ1NtUu26z2l7o1kx7pXIGuL/H0a3I10/tuuxvFQkuXuxd+yxUl VLKCI4LMYdkV0DV+MtkwqgBj73rZLzN+k+8+F+9aOhqTShecGq0lOGqt3p/ZINwUTA dkOo5Brww26flTg+dy/gQr+Omgw9S+sF/kXBokpc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C629560790 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=mojha@codeaurora.org Subject: Re: [PATCH] floppy: fix usercopy direction To: Jann Horn , Jiri Kosina , Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Al Viro References: <20190326220348.61172-1-jannh@google.com> From: Mukesh Ojha Message-ID: Date: Wed, 27 Mar 2019 17:32:10 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 MIME-Version: 1.0 In-Reply-To: <20190326220348.61172-1-jannh@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/27/2019 3:33 AM, Jann Horn wrote: > As sparse points out, these two copy_from_user() should actually be > copy_to_user(). > > Fixes: 229b53c9bf4e ("take floppy compat ioctls to sodding floppy.c") > Cc: stable@vger.kernel.org > Signed-off-by: Jann Horn Reviewed-by: Mukesh Ojha > --- > compile-tested only > > drivers/block/floppy.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c > index 95f608d1a098..8c641245ff12 100644 > --- a/drivers/block/floppy.c > +++ b/drivers/block/floppy.c > @@ -3749,7 +3749,7 @@ static int compat_getdrvprm(int drive, > v.native_format = UDP->native_format; > mutex_unlock(&floppy_mutex); > > - if (copy_from_user(arg, &v, sizeof(struct compat_floppy_drive_params))) > + if (copy_to_user(arg, &v, sizeof(struct compat_floppy_drive_params))) > return -EFAULT; > return 0; > } > @@ -3785,7 +3785,7 @@ static int compat_getdrvstat(int drive, bool poll, > v.bufblocks = UDRS->bufblocks; > mutex_unlock(&floppy_mutex); > > - if (copy_from_user(arg, &v, sizeof(struct compat_floppy_drive_struct))) > + if (copy_to_user(arg, &v, sizeof(struct compat_floppy_drive_struct))) > return -EFAULT; > return 0; > Eintr: