Message ID | 1500037864-52123-1-git-send-email-bryantly@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 07/14/2017 08:11 AM, Bryant G. Ly wrote: > On initial tcmu_configure_device call the info->name would > have already been allocated and set, so on the second call > make sure to free it first. > > Reported-by: Mike Christie <mchristi@redhat.com> > Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com> > --- > drivers/target/target_core_user.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c > index 80ee130..e366260 100644 > --- a/drivers/target/target_core_user.c > +++ b/drivers/target/target_core_user.c > @@ -1433,6 +1433,8 @@ static int tcmu_update_uio_info(struct tcmu_dev *udev) > if (udev->dev_config[0]) > snprintf(str + used, size - used, "/%s", udev->dev_config); > > + /* If the old string exists, free it */ > + kfree(info->name); > info->name = str; > > return 0; > Reviewed-by: Mike Christie <mchristi@redhat.com> -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, 2017-07-14 at 08:11 -0500, Bryant G. Ly wrote: > On initial tcmu_configure_device call the info->name would > have already been allocated and set, so on the second call > make sure to free it first. > > Reported-by: Mike Christie <mchristi@redhat.com> > Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com> > --- > drivers/target/target_core_user.c | 2 ++ > 1 file changed, 2 insertions(+) > Applied to target-pending/master. Thanks Bryant + MNC. -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 80ee130..e366260 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -1433,6 +1433,8 @@ static int tcmu_update_uio_info(struct tcmu_dev *udev) if (udev->dev_config[0]) snprintf(str + used, size - used, "/%s", udev->dev_config); + /* If the old string exists, free it */ + kfree(info->name); info->name = str; return 0;
On initial tcmu_configure_device call the info->name would have already been allocated and set, so on the second call make sure to free it first. Reported-by: Mike Christie <mchristi@redhat.com> Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com> --- drivers/target/target_core_user.c | 2 ++ 1 file changed, 2 insertions(+)