mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH RESEND] ceph: fix length validation in parse_reply_info()
@ 2012-01-15  3:20 Xi Wang
  2012-01-15  5:18 ` Sage Weil
  0 siblings, 1 reply; 3+ messages in thread
From: Xi Wang @ 2012-01-15  3:20 UTC (permalink / raw)
  To: Sage Weil; +Cc: ceph-devel, linux-kernel, Xi Wang

"len" is read from network and thus needs validation.  Otherwise, given
a bogus "len" value, p+len could be an out-of-bounds pointer, which is
used in further parsing.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
---
 fs/ceph/mds_client.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 23ab6a3..3cc9b0b 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -262,6 +262,7 @@ static int parse_reply_info(struct ceph_msg *msg,
 	/* trace */
 	ceph_decode_32_safe(&p, end, len, bad);
 	if (len > 0) {
+		ceph_decode_need(&p, end, len, bad);
 		err = parse_reply_info_trace(&p, p+len, info, features);
 		if (err < 0)
 			goto out_bad;
@@ -270,6 +271,7 @@ static int parse_reply_info(struct ceph_msg *msg,
 	/* extra */
 	ceph_decode_32_safe(&p, end, len, bad);
 	if (len > 0) {
+		ceph_decode_need(&p, end, len, bad);
 		err = parse_reply_info_extra(&p, p+len, info, features);
 		if (err < 0)
 			goto out_bad;
-- 
1.7.5.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] ceph: fix length validation in parse_reply_info()
  2012-01-15  3:20 [PATCH RESEND] ceph: fix length validation in parse_reply_info() Xi Wang
@ 2012-01-15  5:18 ` Sage Weil
  2012-01-15  5:42   ` Xi Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Sage Weil @ 2012-01-15  5:18 UTC (permalink / raw)
  To: Xi Wang; +Cc: ceph-devel, linux-kernel

On Sat, 14 Jan 2012, Xi Wang wrote:
> "len" is read from network and thus needs validation.  Otherwise, given
> a bogus "len" value, p+len could be an out-of-bounds pointer, which is
> used in further parsing.
> 
> Signed-off-by: Xi Wang <xi.wang@gmail.com>

Applied.  Sorry I missed this the first time around!

sage


> ---
>  fs/ceph/mds_client.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 23ab6a3..3cc9b0b 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -262,6 +262,7 @@ static int parse_reply_info(struct ceph_msg *msg,
>  	/* trace */
>  	ceph_decode_32_safe(&p, end, len, bad);
>  	if (len > 0) {
> +		ceph_decode_need(&p, end, len, bad);
>  		err = parse_reply_info_trace(&p, p+len, info, features);
>  		if (err < 0)
>  			goto out_bad;
> @@ -270,6 +271,7 @@ static int parse_reply_info(struct ceph_msg *msg,
>  	/* extra */
>  	ceph_decode_32_safe(&p, end, len, bad);
>  	if (len > 0) {
> +		ceph_decode_need(&p, end, len, bad);
>  		err = parse_reply_info_extra(&p, p+len, info, features);
>  		if (err < 0)
>  			goto out_bad;
> -- 
> 1.7.5.4
> 
> --
> 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] 3+ messages in thread

* Re: [PATCH RESEND] ceph: fix length validation in parse_reply_info()
  2012-01-15  5:18 ` Sage Weil
@ 2012-01-15  5:42   ` Xi Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Xi Wang @ 2012-01-15  5:42 UTC (permalink / raw)
  To: Sage Weil; +Cc: ceph-devel, linux-kernel

On Jan 15, 2012, at 12:18 AM, Sage Weil wrote:
> Applied.  Sorry I missed this the first time around!

Thanks. ;-)

- xi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-15  5:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-15  3:20 [PATCH RESEND] ceph: fix length validation in parse_reply_info() Xi Wang
2012-01-15  5:18 ` Sage Weil
2012-01-15  5:42   ` Xi Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®