Skip to contentSkip to conversation

lustre: ptlrpc: kfree used instead of kvfree

PATCH New Dilger 2 participants 2 messages Sep 1, 2017 – Sep 2, 2017 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Dilger

#1 lore raw

PATCH 1/1 lustre: ptlrpc: kfree used instead of kvfree

Quoted 7 lines · Nadav Amit

rq_reqbuf is allocated using kvmalloc() but released in one occasion using kfree() instead of kvfree().

The issue was found using grep based on a similar bug.

Fixes d7e09d0397e8 ("add Lustre file system client support")

It would appear that this bug was introduced by ee0ec1946ec2 "lustre: ptlrpc: Replace uses of OBD_{ALLOC,FREE}_LARGE", but it looks like the problem predates this patch, since it was originally using OBD_FREE() instead of OBD_FREE_LARGE() here so the Coccinelle script wouldn't have caught the issue.

Quoted 27 lines
Cc Peng Tao <[email protected]>
Cc Oleg Drokin <[email protected]>
Cc Andreas Dilger <[email protected]>
Cc James Simmons <[email protected]>

---
drivers/staging/lustre/lustre/ptlrpc/sec.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/ptlrpc/sec.c +1 -1
index 366f2ce20f5e..2f1c9e15f47c 100644
@@ -847,7 +847,7 @@ void sptlrpc_request_out_callback(struct ptlrpc_request *req)
 	if (req->rq_pool || !req->rq_reqbuf)
 		return;
 
-	kfree(req->rq_reqbuf);
+	kvfree(req->rq_reqbuf);
 	req->rq_reqbuf = NULL;
 	req->rq_reqbuf_len = 0;
 }
Signature · 1 line
2.11.0

Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation

#2 lore raw

PATCH 1/1 lustre: ptlrpc: kfree used instead of kvfree

Quoted 9 lines · Andreas
Quoted 7 lines · Nadav Amit

rq_reqbuf is allocated using kvmalloc() but released in one occasion using kfree() instead of kvfree().

The issue was found using grep based on a similar bug.

Fixes d7e09d0397e8 ("add Lustre file system client support")
Quoted 18 lines

It would appear that this bug was introduced by ee0ec1946ec2 "lustre: ptlrpc: Replace uses of OBD_{ALLOC,FREE}_LARGE", but it looks like the problem predates this patch, since it was originally using OBD_FREE() instead of OBD_FREE_LARGE() here so the Coccinelle script wouldn't have caught the issue.

Quoted 10 lines
Cc Peng Tao <[email protected]>
Cc Oleg Drokin <[email protected]>
Cc Andreas Dilger <[email protected]>
Cc James Simmons <[email protected]>

---
drivers/staging/lustre/lustre/ptlrpc/sec.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

Can a lustre maintainer resend this in a format that I can apply it in?

thanks,

greg k-h