All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
To: Adam Borowski <kilobyte@angband.pl>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] vt: use copy_to_user instead of __put_user in GIO_UNIMAP ioctl
Date: Mon, 5 Jun 2017 17:34:16 +0100	[thread overview]
Message-ID: <20170605173416.73da4975@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <20170603073509.4718-3-kilobyte@angband.pl>

> @@ -775,13 +775,11 @@ int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct uni
>  		}
>  	}
>  	console_unlock();
> -	for (i = min(ect, ct), plist = unilist; i; i--, list++, plist++) {
> -		__put_user(plist->unicode, &list->unicode);
> -		__put_user(plist->fontpos, &list->fontpos);
> -	}
> -	__put_user(ect, uct);
> +	if (copy_to_user(list, unilist, min(ect, ct) * sizeof(struct unipair)))
> +		ret = -EFAULT;
> +	put_user(ect, uct);
>  	kfree(unilist);
> -	return ((ect <= ct) ? 0 : -ENOMEM);
> +	return ret ? ret : (ect <= ct) ? 0 : -ENOMEM;
>  }


The rest looks good but that line needs taking out and shooting.

Alan

  reply	other threads:[~2017-06-05 16:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-03  7:32 [PATCH 0/5] vt: get rid of worst cases of __put_user/__get_user Adam Borowski
2017-06-03  7:35 ` [PATCH 1/5] vt: use copy_from/to_user instead of __get/put_user for scrnmap ioctls Adam Borowski
2017-06-03  7:35   ` [PATCH 2/5] vt: fix unchecked __put_user() in tioclinux ioctls Adam Borowski
2017-06-03  7:35   ` [PATCH 3/5] vt: use copy_to_user instead of __put_user in GIO_UNIMAP ioctl Adam Borowski
2017-06-05 16:34     ` Alan Cox [this message]
2017-06-05 23:05       ` Al Viro
2017-06-03  7:35   ` [PATCH 4/5] vt: use memdup_user in PIO_UNIMAP ioctl Adam Borowski
2017-06-03  7:35   ` [PATCH 5/5] vt: drop access_ok() calls in unimap ioctls Adam Borowski
2017-06-03 15:42 ` [PATCH 0/5] vt: get rid of worst cases of __put_user/__get_user Greg Kroah-Hartman
2017-06-05  6:13   ` Al Viro
2017-06-05  6:41     ` Greg Kroah-Hartman
2017-06-09  9:18     ` Greg Kroah-Hartman

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=20170605173416.73da4975@lxorguk.ukuu.org.uk \
    --to=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=kilobyte@angband.pl \
    --cc=linux-kernel@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.