[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAECXXi5GcAbBzS+ATr2BRryJPvAUPCTMkmVT2TKWESG6anWuWw@mail.gmail.com>
Date: Mon, 26 Jan 2015 11:16:12 -0500
From: Paul Clements <paul.clements@...sios.com>
To: Markus Pargmann <mpa@...gutronix.de>
Cc: "nbd-general@...ts.sourceforge.net"
<nbd-general@...ts.sourceforge.net>,
kernel list <linux-kernel@...r.kernel.org>,
kernel@...gutronix.de
Subject: Re: [RFC 2/4] nbd: Split 'DO_IT' into three functions
Markus,
This refactor looks OK with the exception of one thing...
On Tue, Jan 13, 2015 at 8:44 AM, Markus Pargmann <mpa@...gutronix.de> wrote:
> /* Must be called with tx_lock held */
>
> static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
> @@ -684,61 +773,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
> set_capacity(nbd->disk, nbd->bytesize >> 9);
> return 0;
>
> - case NBD_DO_IT: {
> - struct task_struct *thread;
> - struct socket *sock;
> - int error;
> -
> - if (nbd->pid)
> - return -EBUSY;
> - if (!nbd->sock)
> - return -EINVAL;
>
You seem to have done away with these checks. Was that inadvertent or
was there a reason for that? The pid check is necessary to prevent two
instances of NBD_DO_IT from running. Without the sock check you'll get
a null pointer deref in nbd_do_it.
Thanks,
Paul
--
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