NBD does not protect the nbd_device's socket from becoming NULL during receives.
This closes a race with the NBD_CLEAR_SOCK ioctl (nbd-client -d) setting
the nbd_device's socket to NULL right before NBD calls sock_xmit.
Signed-off-by: Mike Snitzer <snitzer@gmail.com>
Cc: Paul Clements <paul.clements@steeleye.com>
---
drivers/block/nbd.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index b53fdb0..bd3c50b 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -153,6 +153,12 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size,
struct kvec iov;
sigset_t blocked, oldset;
+ if (unlikely(!sock)) {
+ printk(KERN_ERR "%s: Attempted %s on closed socket in sock_xmit\n",
+ lo->disk->disk_name, (send ? "send" : "recv"));
+ return -EINVAL;
+ }
+
/* Allow interception of SIGKILL only
* Don't allow other signals to interrupt the transmission */
siginitsetinv(&blocked, sigmask(SIGKILL));
--
1.5.3.4
--
| Peter Zijlstra | [PATCH 6/6] sched: disabled rt-bandwidth by default |
| Tejun Heo | [PATCHSET] CUSE: implement CUSE |
| Nigel Cunningham | Re: Back to the future. |
| FUJITA Tomonori | Re: Integration of SCST in the mainstream Linux kernel |
git: | |
| Junio C Hamano | [PATCH] combine-diff: reuse diff from the same blob. |
| Ken Pratt | pack operation is thrashing my server |
| Bill Lear | Question on git-filter-branch |
| Shawn O. Pearce | Re: [PATCH resend] make "git push" update origin and mirrors, "git push --mirror" ... |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Linden Varley | Load balancing with DSR |
| Parvinder Bhasin | BIND and CNAME-ing |
| Rogier Krieger | Re: Network Time Synchronization using timed or ntpd or a Combination? |
| kamal kc | using get_system_info() - obtaining system load averages |
| Tim Kientzle | Re: [PATCH] adding two new options to 'cp' |
| Kailas Ramasamy | Bridging console port to a telnet session |
| Vitaliy Skakun | Comtrol Rocketport UNIVERSAL PCI 32-port |
