netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch] net: fix incorrect counting in __scm_destroy()
@ 2009-11-04 10:04 Amerigo Wang
  2009-11-04 10:29 ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Amerigo Wang @ 2009-11-04 10:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, Amerigo Wang, David S. Miller


It seems that in __scm_destroy() we forgot to decrease
the ->count after fput(->fp[i]), this may cause some
problem when we recursively call fput() again.

Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: David S. Miller <davem@davemloft.net>

---
diff --git a/net/core/scm.c b/net/core/scm.c
index b7ba91b..fa53219 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -120,8 +120,10 @@ void __scm_destroy(struct scm_cookie *scm)
 				fpl = list_first_entry(&work_list, struct scm_fp_list, list);
 
 				list_del(&fpl->list);
-				for (i=fpl->count-1; i>=0; i--)
+				for (i = fpl->count-1; i >= 0; i--) {
 					fput(fpl->fp[i]);
+					fpl->count--;
+				}
 				kfree(fpl);
 			}
 

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

end of thread, other threads:[~2009-11-10  6:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04 10:04 [Patch] net: fix incorrect counting in __scm_destroy() Amerigo Wang
2009-11-04 10:29 ` Eric Dumazet
2009-11-04 12:41   ` David Miller
2009-11-10  6:12     ` Cong Wang
2009-11-10  6:33       ` Eric Dumazet

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).