Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4701819img; Tue, 26 Mar 2019 15:06:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOWSKrQp0w2/OAqsu6nUSWv3+vPI+iNd0OTORQhZ+E5ivh73ZuqdQwg4LnOZn0wcI1cnq6 X-Received: by 2002:a62:12c9:: with SMTP id 70mr28163621pfs.156.1553638004003; Tue, 26 Mar 2019 15:06:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553638003; cv=none; d=google.com; s=arc-20160816; b=So3Vizf4+1F9gsEpJVS+dDxqKbwpKUZxvTzj77OoylaRint+UbaOQgw3F7AeyHzUNu 2AEHcCU0XM68I6G/DzEvuzAHxMNmoMguueFNRnG8GPeGCjFBX+WKDeMafjvxXMiGzFtJ 4lAb7zyGq9VagzBODIH+LzjPqnfT5Q+tsWGDhNg7yP6UpRfLHsKH+MllSzoyGNBRsI5+ KT4mZq4J97tFbLKRglGPXjQVl+wzqXg4Z9r+4L/QZbfn7V5mUjhBSWEi/2MoG0g7yrP3 m6kGDFSKjaNhUG1iyfsEdjItwL+t2lW4Jxu+Nmjk3Ya6bq4iFl9dXo2gbTWGSRzG9Nxs I6Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=5OS7MeeQZkVjDOMphKCQJrQLOTO9o+8UDZ4EUYnvOds=; b=B6q7BR0Hl/2FrslfRL31oDhnvfnVJEAhP7Qy/7PdjXDEKYPwo6wU/UD6OSVWTDitIQ Cmn2EO7nE5PrRHNIcD1gFAAT+HIRgun+PRXIdq8Hp3zSG6C/cMjb120bfC9G8jpnozwz bmF8DWdryk2h5DeQ5QItVawL9G459ke43a4WXqTwUjqjdNLtHuI87fVjrb80Voa5QSjI BoqbH27BO4mUjgvRx9CM/wj9SCcn/4mfIrANiQADKb00KJRa2a5A01AY1iWQg1l3r3ul S4IF4NaS5KGZe4tQ0GY+aDCp+KYSmaBE2tCK6nsW33vn3K3yBqzKywbgLbNZ8Udby1vk DNAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PkCJFz4g; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u19si16969839pga.567.2019.03.26.15.06.28; Tue, 26 Mar 2019 15:06:43 -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=@google.com header.s=20161025 header.b=PkCJFz4g; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731764AbfCZWFw (ORCPT + 99 others); Tue, 26 Mar 2019 18:05:52 -0400 Received: from mail-qk1-f201.google.com ([209.85.222.201]:43784 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731483AbfCZWFw (ORCPT ); Tue, 26 Mar 2019 18:05:52 -0400 Received: by mail-qk1-f201.google.com with SMTP id m8so12922855qka.10 for ; Tue, 26 Mar 2019 15:05:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=5OS7MeeQZkVjDOMphKCQJrQLOTO9o+8UDZ4EUYnvOds=; b=PkCJFz4gIUUzxfFMy4dd9OumgOl5iHmWHQdrsah8NR6wKkHmArUqJsjoTnRlHoLjU9 kZ1NHsaUAbUyuxT7QzvshppCC33sPT2qlAOinWw0eWFQzvgLDRodVsQ6vh4vPgimjjqL losIMDyUQN94ZsYUe3up5iCmUwZDBY6iMxBWuVI+DxaF3vpaG7X7GhpvyBDedC6clBPw AxY3tLUpMOJLrya+t3CW3BnWb+OTFHuItBmWBOnNER8Trsn0ednmN2Bvuu+3jJSSUhlQ 2KAIaldNpXQ3iGxt3QxLCExUwR/slCPnslZNjXk/v27CrgcaRQJr5X3CvYxERlRIT8LF qN2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=5OS7MeeQZkVjDOMphKCQJrQLOTO9o+8UDZ4EUYnvOds=; b=r1w5bejLosp1e4ZsX7r0T8Zko2D6Xincjs1gFbC1Sb6gm/VnYKpMSsHqipZHQgBhqj i5TxMQFlf7+3xHSqJUylDNJ7qTlFM2nNRWbqiSEDmaBkfjvR5ui5F/6Cvu5tfR2AOHWU GKTQaYvJFBEcnc3eWJCPNr/jOqerxq4xlS1fU7nTjpPHOGfK+4lJ1+w+/wBgZ5KKqZC2 ASFm1BxhB5RdH8N0YoGBoMFpzmOdyz62lgd5jjsBXWcDTfzCdm+NBL4ysFV11/nGgm3P gfCqKtWErzZj4RhgJcAdBFTYaLmXJYzFawTzcSld7GIKRzB2KS4mZW4osQL6E8xb2k30 ncnQ== X-Gm-Message-State: APjAAAUSEMDXdcFImZAR0HhbMaM1Z2jgiQv8rcc7u0qwjcEK9M4hc72p 5/3diB069mzmmbvtCVKqxv+phh853w== X-Received: by 2002:ac8:27a6:: with SMTP id w35mr27473970qtw.157.1553637951208; Tue, 26 Mar 2019 15:05:51 -0700 (PDT) Date: Tue, 26 Mar 2019 23:03:48 +0100 Message-Id: <20190326220348.61172-1-jannh@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog Subject: [PATCH] floppy: fix usercopy direction From: Jann Horn To: Jiri Kosina , Jens Axboe , jannh@google.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Al Viro Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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: -- 2.21.0.392.gf8f6787159e-goog