From: David S. Miller Date: Mon, 20 Sep 2010 00:56:19 +0000 (-0700) Subject: irda: Correctly clean up self->ias_obj on irda_bind() failure. X-Git-Tag: firefly_0821_release~10186^2~926 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8e75a0d65dce9d24b551d4a5ccbe00a23771583a;p=firefly-linux-kernel-4.4.55.git irda: Correctly clean up self->ias_obj on irda_bind() failure. [ Upstream commit 628e300cccaa628d8fb92aa28cb7530a3d5f2257 ] If irda_open_tsap() fails, the irda_bind() code tries to destroy the ->ias_obj object by hand, but does so wrongly. In particular, it fails to a) release the hashbin attached to the object and b) reset the self->ias_obj pointer to NULL. Fix both problems by using irias_delete_object() and explicitly setting self->ias_obj to NULL, just as irda_release() does. Reported-by: Tavis Ormandy Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index dd35641835f4..b6cef980095f 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -810,8 +810,8 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) err = irda_open_tsap(self, addr->sir_lsap_sel, addr->sir_name); if (err < 0) { - kfree(self->ias_obj->name); - kfree(self->ias_obj); + irias_delete_object(self->ias_obj); + self->ias_obj = NULL; return err; }