lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140708150104.GA2863@laptop.dumpdata.com>
Date:	Tue, 8 Jul 2014 11:01:04 -0400
From:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To:	Zoltan Kiss <zoltan.kiss@...rix.com>
Cc:	Wei Liu <wei.liu2@...rix.com>,
	Ian Campbell <Ian.Campbell@...rix.com>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, xen-devel@...ts.xenproject.org
Subject: Re: [Xen-devel] [PATCH net-next v2] xen-netback: Adding debugfs
 "io_ring_qX" files

On Tue, Jul 08, 2014 at 03:33:50PM +0100, Zoltan Kiss wrote:
> On 02/07/14 21:02, Konrad Rzeszutek Wilk wrote:
> >On Wed, Jul 02, 2014 at 08:53:50PM +0100, Zoltan Kiss wrote:
> >>+static ssize_t
> >>+xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count,
> >>+		     loff_t *ppos)
> >>+{
> >>+	struct xenvif_queue *queue =
> >>+		((struct seq_file *)filp->private_data)->private;
> >>+	int len;
> >>+	char write[sizeof("kick")];
> >
> ><blinks>
> >>+
> >>+	/* don't allow partial writes and check the length */
> >>+	if (*ppos != 0)
> >>+		return 0;
> >>+	if (count < sizeof("kick") - 1)
> >
> >Um, could you just use a #define please?
> OK
> 
> >
> >>+		return -ENOSPC;
> >>+
> >>+	len = simple_write_to_buffer(write,
> >>+				     sizeof(write),
> >>+				     ppos,
> >>+				     buf,
> >>+				     count);
> >>+	if (len < 0)
> >>+		return len;
> >>+
> >>+	if (!strncmp(write, "kick", sizeof("kick") - 1))
> >>+		xenvif_interrupt(0, (void *)queue);
> >>+	else
> >>+		pr_warn("Unknown command to io_ring. Available: kick\n");
> >
> >It is 'io_ring_q%d'?
> Yes
> 
> >Why don't you split that back out to the user
> >instead of the console?
> How do you mean? Printing it into buf? I don't think the user cares about
> its content after doing the write syscall. More importantly, I don't know if
> that buffer is big enough to hold the message.

Isn't it 4K? 

Either way I think you need to do 'count = -EINVAL' here.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ