linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: fix wrong release in sess_alloc_buffer() failed path
@ 2021-08-17 14:55 Ding Hui
  2021-08-18  0:30 ` Paulo Alcantara
  0 siblings, 1 reply; 3+ messages in thread
From: Ding Hui @ 2021-08-17 14:55 UTC (permalink / raw)
  To: sfrench; +Cc: linux-cifs, samba-technical, linux-kernel, Ding Hui

smb_buf is allocated by small_smb_init_no_tc(), and buf type is
CIFS_SMALL_BUFFER, so we should use cifs_small_buf_release() to
release it in failed path.

Signed-off-by: Ding Hui <dinghui@sangfor.com.cn>
---
 fs/cifs/sess.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index c5785fd3f52e..606fd7d6cb71 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -877,7 +877,7 @@ sess_alloc_buffer(struct sess_data *sess_data, int wct)
 	return 0;
 
 out_free_smb_buf:
-	kfree(smb_buf);
+	cifs_small_buf_release(smb_buf);
 	sess_data->iov[0].iov_base = NULL;
 	sess_data->iov[0].iov_len = 0;
 	sess_data->buf0_type = CIFS_NO_BUFFER;
-- 
2.17.1


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

* Re: [PATCH] cifs: fix wrong release in sess_alloc_buffer() failed path
  2021-08-17 14:55 [PATCH] cifs: fix wrong release in sess_alloc_buffer() failed path Ding Hui
@ 2021-08-18  0:30 ` Paulo Alcantara
  2021-08-18  2:46   ` Steve French
  0 siblings, 1 reply; 3+ messages in thread
From: Paulo Alcantara @ 2021-08-18  0:30 UTC (permalink / raw)
  To: Ding Hui, sfrench; +Cc: linux-cifs, samba-technical, linux-kernel, Ding Hui

Ding Hui <dinghui@sangfor.com.cn> writes:

> smb_buf is allocated by small_smb_init_no_tc(), and buf type is
> CIFS_SMALL_BUFFER, so we should use cifs_small_buf_release() to
> release it in failed path.
>
> Signed-off-by: Ding Hui <dinghui@sangfor.com.cn>
> ---
>  fs/cifs/sess.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>

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

* Re: [PATCH] cifs: fix wrong release in sess_alloc_buffer() failed path
  2021-08-18  0:30 ` Paulo Alcantara
@ 2021-08-18  2:46   ` Steve French
  0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2021-08-18  2:46 UTC (permalink / raw)
  To: Paulo Alcantara; +Cc: Ding Hui, Steve French, CIFS, samba-technical, LKML

tentatively merged into cifs-2.6.git for-next pending more testing

On Tue, Aug 17, 2021 at 7:33 PM Paulo Alcantara <pc@cjr.nz> wrote:
>
> Ding Hui <dinghui@sangfor.com.cn> writes:
>
> > smb_buf is allocated by small_smb_init_no_tc(), and buf type is
> > CIFS_SMALL_BUFFER, so we should use cifs_small_buf_release() to
> > release it in failed path.
> >
> > Signed-off-by: Ding Hui <dinghui@sangfor.com.cn>
> > ---
> >  fs/cifs/sess.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>



-- 
Thanks,

Steve

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

end of thread, other threads:[~2021-08-18  2:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 14:55 [PATCH] cifs: fix wrong release in sess_alloc_buffer() failed path Ding Hui
2021-08-18  0:30 ` Paulo Alcantara
2021-08-18  2:46   ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).