Message ID | 20161119182256.9081-1-lambert.quentin@gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On 19/11/16 19:22, Quentin Lambert wrote: > Most error branches following the call to kmalloc contain > a call to kfree. This patch add these calls where they are > missing. > > This issue was found with Hector. > > Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Nice catch. I think this will need some more work, I'll do a follow-on patch. Reviewed-by: Juergen Gross <jgross@suse.com> > > --- > drivers/scsi/xen-scsifront.c | 1 + > 1 file changed, 1 insertion(+) > > --- a/drivers/scsi/xen-scsifront.c > +++ b/drivers/scsi/xen-scsifront.c > @@ -627,6 +627,7 @@ static int scsifront_action_handler(stru > > if (scsifront_enter(info)) { > spin_unlock_irq(host->host_lock); > + kfree(shadow); > return FAILED; > } > > -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>>> "Juergen" == Juergen Gross <jgross@suse.com> writes: Juergen, Juergen> On 19/11/16 19:22, Quentin Lambert wrote: >> Most error branches following the call to kmalloc contain a call to >> kfree. This patch add these calls where they are missing. >> >> This issue was found with Hector. >> >> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Juergen> Nice catch. I think this will need some more work, I'll do a Juergen> follow-on patch. Juergen> Reviewed-by: Juergen Gross <jgross@suse.com> Are you taking this patch through the Xen tree or should I queue it up?
On 22/11/16 04:40, Martin K. Petersen wrote: >>>>>> "Juergen" == Juergen Gross <jgross@suse.com> writes: > > Juergen, > > Juergen> On 19/11/16 19:22, Quentin Lambert wrote: >>> Most error branches following the call to kmalloc contain a call to >>> kfree. This patch add these calls where they are missing. >>> >>> This issue was found with Hector. >>> >>> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> > > Juergen> Nice catch. I think this will need some more work, I'll do a > Juergen> follow-on patch. > > Juergen> Reviewed-by: Juergen Gross <jgross@suse.com> > > Are you taking this patch through the Xen tree or should I queue it up? I'm taking it through the xen tree, thanks. Juergen -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 19/11/16 19:22, Quentin Lambert wrote: > Most error branches following the call to kmalloc contain > a call to kfree. This patch add these calls where they are > missing. > > This issue was found with Hector. > > Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Applied to xen/tip.git for-linus-4.10 Juergen > > --- > drivers/scsi/xen-scsifront.c | 1 + > 1 file changed, 1 insertion(+) > > --- a/drivers/scsi/xen-scsifront.c > +++ b/drivers/scsi/xen-scsifront.c > @@ -627,6 +627,7 @@ static int scsifront_action_handler(stru > > if (scsifront_enter(info)) { > spin_unlock_irq(host->host_lock); > + kfree(shadow); > return FAILED; > } > > > -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Nov 21, 2016 at 07:01:36AM +0100, Juergen Gross wrote: > On 19/11/16 19:22, Quentin Lambert wrote: > > Most error branches following the call to kmalloc contain > > a call to kfree. This patch add these calls where they are > > missing. > > > > This issue was found with Hector. > > > > Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> > > Nice catch. I think this will need some more work, I'll do a > follow-on patch. Yeah. It's weird how we free it on the success path and all the failure paths except one. But it looks so deliberate. What's going on with that? Could you send your follow on patch as a reply to the thread? regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Nov 21, 2016 at 07:01:36AM +0100, Juergen Gross wrote: > On 19/11/16 19:22, Quentin Lambert wrote: > > Most error branches following the call to kmalloc contain > > a call to kfree. This patch add these calls where they are > > missing. > > > > This issue was found with Hector. > > > > Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> > > Nice catch. I think this will need some more work, I'll do a > follow-on patch. > The error handling is really weird. Could you send your follow on to this thread? regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 05/12/16 21:53, Dan Carpenter wrote: > On Mon, Nov 21, 2016 at 07:01:36AM +0100, Juergen Gross wrote: >> On 19/11/16 19:22, Quentin Lambert wrote: >>> Most error branches following the call to kmalloc contain >>> a call to kfree. This patch add these calls where they are >>> missing. >>> >>> This issue was found with Hector. >>> >>> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> >> >> Nice catch. I think this will need some more work, I'll do a >> follow-on patch. >> > > The error handling is really weird. Could you send your follow on to > this thread? I did: https://lkml.org/lkml/2016/12/2/17 Juergen -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Oops. Sorry for the noise. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
--- a/drivers/scsi/xen-scsifront.c +++ b/drivers/scsi/xen-scsifront.c @@ -627,6 +627,7 @@ static int scsifront_action_handler(stru if (scsifront_enter(info)) { spin_unlock_irq(host->host_lock); + kfree(shadow); return FAILED; }
Most error branches following the call to kmalloc contain a call to kfree. This patch add these calls where they are missing. This issue was found with Hector. Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> --- drivers/scsi/xen-scsifront.c | 1 + 1 file changed, 1 insertion(+) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html