diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-07-14 21:37:24 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-07-14 21:37:24 -0400 |
| commit | 8aa651e23e2835b6d64381ce17447c995040ab30 (patch) | |
| tree | 68c6a283b26b89cb2591f3be2f927234243a5d7d | |
| parent | d878fe2331219ff8518192b67f66699cb6d164e2 (diff) | |
| parent | a89d63a159b1ba5833be2bef00adf8ad8caac8be (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm:
dlm: free socket in error exit path
dlm: fix plock use-after-free
dlm: Fix uninitialised variable warning in lock.c
| -rw-r--r-- | fs/dlm/lock.c | 2 | ||||
| -rw-r--r-- | fs/dlm/lowcomms.c | 4 | ||||
| -rw-r--r-- | fs/dlm/plock.c | 17 |
3 files changed, 14 insertions, 9 deletions
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 205ec95b347e..eb507c453c5f 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
| @@ -435,7 +435,7 @@ static int search_rsb(struct dlm_ls *ls, char *name, int len, int b, | |||
| 435 | static int find_rsb(struct dlm_ls *ls, char *name, int namelen, | 435 | static int find_rsb(struct dlm_ls *ls, char *name, int namelen, |
| 436 | unsigned int flags, struct dlm_rsb **r_ret) | 436 | unsigned int flags, struct dlm_rsb **r_ret) |
| 437 | { | 437 | { |
| 438 | struct dlm_rsb *r, *tmp; | 438 | struct dlm_rsb *r = NULL, *tmp; |
| 439 | uint32_t hash, bucket; | 439 | uint32_t hash, bucket; |
| 440 | int error = -EINVAL; | 440 | int error = -EINVAL; |
| 441 | 441 | ||
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index cdb580a9c7a2..618a60f03886 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
| @@ -902,7 +902,7 @@ static void tcp_connect_to_sock(struct connection *con) | |||
| 902 | int result = -EHOSTUNREACH; | 902 | int result = -EHOSTUNREACH; |
| 903 | struct sockaddr_storage saddr, src_addr; | 903 | struct sockaddr_storage saddr, src_addr; |
| 904 | int addr_len; | 904 | int addr_len; |
| 905 | struct socket *sock; | 905 | struct socket *sock = NULL; |
| 906 | 906 | ||
| 907 | if (con->nodeid == 0) { | 907 | if (con->nodeid == 0) { |
| 908 | log_print("attempt to connect sock 0 foiled"); | 908 | log_print("attempt to connect sock 0 foiled"); |
| @@ -962,6 +962,8 @@ out_err: | |||
| 962 | if (con->sock) { | 962 | if (con->sock) { |
| 963 | sock_release(con->sock); | 963 | sock_release(con->sock); |
| 964 | con->sock = NULL; | 964 | con->sock = NULL; |
| 965 | } else if (sock) { | ||
| 966 | sock_release(sock); | ||
| 965 | } | 967 | } |
| 966 | /* | 968 | /* |
| 967 | * Some errors are fatal and this list might need adjusting. For other | 969 | * Some errors are fatal and this list might need adjusting. For other |
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c index 894a32d438d5..16f682e26c07 100644 --- a/fs/dlm/plock.c +++ b/fs/dlm/plock.c | |||
| @@ -353,7 +353,7 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count, | |||
| 353 | { | 353 | { |
| 354 | struct dlm_plock_info info; | 354 | struct dlm_plock_info info; |
| 355 | struct plock_op *op; | 355 | struct plock_op *op; |
| 356 | int found = 0; | 356 | int found = 0, do_callback = 0; |
| 357 | 357 | ||
| 358 | if (count != sizeof(info)) | 358 | if (count != sizeof(info)) |
| 359 | return -EINVAL; | 359 | return -EINVAL; |
| @@ -366,21 +366,24 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count, | |||
| 366 | 366 | ||
| 367 | spin_lock(&ops_lock); | 367 | spin_lock(&ops_lock); |
| 368 | list_for_each_entry(op, &recv_list, list) { | 368 | list_for_each_entry(op, &recv_list, list) { |
| 369 | if (op->info.fsid == info.fsid && op->info.number == info.number && | 369 | if (op->info.fsid == info.fsid && |
| 370 | op->info.number == info.number && | ||
| 370 | op->info.owner == info.owner) { | 371 | op->info.owner == info.owner) { |
| 372 | struct plock_xop *xop = (struct plock_xop *)op; | ||
| 371 | list_del_init(&op->list); | 373 | list_del_init(&op->list); |
| 372 | found = 1; | ||
| 373 | op->done = 1; | ||
| 374 | memcpy(&op->info, &info, sizeof(info)); | 374 | memcpy(&op->info, &info, sizeof(info)); |
| 375 | if (xop->callback) | ||
| 376 | do_callback = 1; | ||
| 377 | else | ||
| 378 | op->done = 1; | ||
| 379 | found = 1; | ||
| 375 | break; | 380 | break; |
| 376 | } | 381 | } |
| 377 | } | 382 | } |
| 378 | spin_unlock(&ops_lock); | 383 | spin_unlock(&ops_lock); |
| 379 | 384 | ||
| 380 | if (found) { | 385 | if (found) { |
| 381 | struct plock_xop *xop; | 386 | if (do_callback) |
| 382 | xop = (struct plock_xop *)op; | ||
| 383 | if (xop->callback) | ||
| 384 | dlm_plock_callback(op); | 387 | dlm_plock_callback(op); |
| 385 | else | 388 | else |
| 386 | wake_up(&recv_wq); | 389 | wake_up(&recv_wq); |
