* [PATCH] libceph: fix ceph_msg_new error path
@ 2011-05-03 2:29 Henry C Chang
2011-05-03 16:08 ` Sage Weil
2011-05-03 16:14 ` Tommi Virtanen
0 siblings, 2 replies; 4+ messages in thread
From: Henry C Chang @ 2011-05-03 2:29 UTC (permalink / raw)
To: ceph-devel; +Cc: Henry C Chang
If memory allocation failed, calling ceph_msg_put() will cause GPF
since some of ceph_msg variables are not initialized first.
Fix Bug #970.
Signed-off-by: Henry C Chang <henry_c_chang@tcloudcomputing.com>
---
net/ceph/messenger.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 05f3578..e15a82c 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2267,6 +2267,19 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags)
m->more_to_follow = false;
m->pool = NULL;
+ /* middle */
+ m->middle = NULL;
+
+ /* data */
+ m->nr_pages = 0;
+ m->page_alignment = 0;
+ m->pages = NULL;
+ m->pagelist = NULL;
+ m->bio = NULL;
+ m->bio_iter = NULL;
+ m->bio_seg = 0;
+ m->trail = NULL;
+
/* front */
if (front_len) {
if (front_len > PAGE_CACHE_SIZE) {
@@ -2286,19 +2299,6 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags)
}
m->front.iov_len = front_len;
- /* middle */
- m->middle = NULL;
-
- /* data */
- m->nr_pages = 0;
- m->page_alignment = 0;
- m->pages = NULL;
- m->pagelist = NULL;
- m->bio = NULL;
- m->bio_iter = NULL;
- m->bio_seg = 0;
- m->trail = NULL;
-
dout("ceph_msg_new %p front %d\n", m, front_len);
return m;
--
1.7.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] libceph: fix ceph_msg_new error path
2011-05-03 2:29 [PATCH] libceph: fix ceph_msg_new error path Henry C Chang
@ 2011-05-03 16:08 ` Sage Weil
2011-05-03 16:14 ` Tommi Virtanen
1 sibling, 0 replies; 4+ messages in thread
From: Sage Weil @ 2011-05-03 16:08 UTC (permalink / raw)
To: Henry C Chang; +Cc: ceph-devel, Henry C Chang
Applied, thanks!
On Tue, 3 May 2011, Henry C Chang wrote:
> If memory allocation failed, calling ceph_msg_put() will cause GPF
> since some of ceph_msg variables are not initialized first.
>
> Fix Bug #970.
>
> Signed-off-by: Henry C Chang <henry_c_chang@tcloudcomputing.com>
> ---
> net/ceph/messenger.c | 26 +++++++++++++-------------
> 1 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
> index 05f3578..e15a82c 100644
> --- a/net/ceph/messenger.c
> +++ b/net/ceph/messenger.c
> @@ -2267,6 +2267,19 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags)
> m->more_to_follow = false;
> m->pool = NULL;
>
> + /* middle */
> + m->middle = NULL;
> +
> + /* data */
> + m->nr_pages = 0;
> + m->page_alignment = 0;
> + m->pages = NULL;
> + m->pagelist = NULL;
> + m->bio = NULL;
> + m->bio_iter = NULL;
> + m->bio_seg = 0;
> + m->trail = NULL;
> +
> /* front */
> if (front_len) {
> if (front_len > PAGE_CACHE_SIZE) {
> @@ -2286,19 +2299,6 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags)
> }
> m->front.iov_len = front_len;
>
> - /* middle */
> - m->middle = NULL;
> -
> - /* data */
> - m->nr_pages = 0;
> - m->page_alignment = 0;
> - m->pages = NULL;
> - m->pagelist = NULL;
> - m->bio = NULL;
> - m->bio_iter = NULL;
> - m->bio_seg = 0;
> - m->trail = NULL;
> -
> dout("ceph_msg_new %p front %d\n", m, front_len);
> return m;
>
> --
> 1.7.2.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libceph: fix ceph_msg_new error path
2011-05-03 2:29 [PATCH] libceph: fix ceph_msg_new error path Henry C Chang
2011-05-03 16:08 ` Sage Weil
@ 2011-05-03 16:14 ` Tommi Virtanen
2011-05-03 16:46 ` Tommi Virtanen
1 sibling, 1 reply; 4+ messages in thread
From: Tommi Virtanen @ 2011-05-03 16:14 UTC (permalink / raw)
To: Henry C Chang; +Cc: ceph-devel, Henry C Chang
On Tue, May 03, 2011 at 02:29:56AM +0000, Henry C Chang wrote:
> If memory allocation failed, calling ceph_msg_put() will cause GPF
> since some of ceph_msg variables are not initialized first.
>
> Fix Bug #970.
Looks good and explains the symptoms perfectly. Committed to
ceph-client.git as 56f63aeb6360fb3ba9584bd5b094d55283a9e332.
Thanks!
--
:(){ :|:&};:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libceph: fix ceph_msg_new error path
2011-05-03 16:14 ` Tommi Virtanen
@ 2011-05-03 16:46 ` Tommi Virtanen
0 siblings, 0 replies; 4+ messages in thread
From: Tommi Virtanen @ 2011-05-03 16:46 UTC (permalink / raw)
To: Henry C Chang; +Cc: ceph-devel, Henry C Chang
On Tue, May 03, 2011 at 09:14:31AM -0700, Tommi Virtanen wrote:
> On Tue, May 03, 2011 at 02:29:56AM +0000, Henry C Chang wrote:
> > If memory allocation failed, calling ceph_msg_put() will cause GPF
> > since some of ceph_msg variables are not initialized first.
> >
> > Fix Bug #970.
>
> Looks good and explains the symptoms perfectly. Committed to
> ceph-client.git as 56f63aeb6360fb3ba9584bd5b094d55283a9e332.
> Thanks!
I backed that out in favor of Sage's commits to for-linus. Sorry about
the confusion.
--
:(){ :|:&};:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-05-03 16:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-03 2:29 [PATCH] libceph: fix ceph_msg_new error path Henry C Chang
2011-05-03 16:08 ` Sage Weil
2011-05-03 16:14 ` Tommi Virtanen
2011-05-03 16:46 ` Tommi Virtanen
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.