[ovs-dev] [PATCH] ovsdb-idl: Don't even try to modify synthetic rows, instead of segfaulting.

Ben Pfaff blp at nicira.com
Thu Oct 27 10:40:34 PDT 2011


Thanks, I pushed this.

On Wed, Oct 26, 2011 at 04:46:05PM -0700, Ethan Jackson wrote:
> Looks good to me.
> 
> I didn't check that everywhere that needs to change did in-fact change.
> 
> In the next couple of days, I'm going to write a patch which removes
> all of the synthetic checks from the bridge.
> 
> Ethan
> 
> On Wed, Oct 26, 2011 at 15:47, Ben Pfaff <blp at nicira.com> wrote:
> > Synthetic rows lack a lot of important metadata that the IDL adds to rows
> > actually obtained from the database, and it's impractical to add that
> > metadata to synthetic rows. ?This means that the IDL functions to modify
> > these rows dereference null pointers and segfault. ?So, it's really
> > important not to pass synthetic rows to such functions. ?However, we've
> > screwed this up a number of times now and in the end it seems that it's
> > probably better to just ignore attempts to modify these rows. ?This commit
> > implements that.
> >
> > Feature #8013.
> > Reported-by: Ethan Jackson <ethan at nicira.com>
> > ---
> > ?lib/ovsdb-idl.c | ? 26 ++++++++++++++++++++++----
> > ?1 files changed, 22 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
> > index 11ca6b9..56b4328 100644
> > --- a/lib/ovsdb-idl.c
> > +++ b/lib/ovsdb-idl.c
> > @@ -1705,8 +1705,15 @@ ovsdb_idl_txn_write(const struct ovsdb_idl_row *row_,
> > ? ? ? ? ? ? ? ? ? ? struct ovsdb_datum *datum)
> > ?{
> > ? ? struct ovsdb_idl_row *row = (struct ovsdb_idl_row *) row_;
> > - ? ?const struct ovsdb_idl_table_class *class = row->table->class;
> > - ? ?size_t column_idx = column - class->columns;
> > + ? ?const struct ovsdb_idl_table_class *class;
> > + ? ?size_t column_idx;
> > +
> > + ? ?if (ovsdb_idl_row_is_synthetic(row)) {
> > + ? ? ? ?return;
> > + ? ?}
> > +
> > + ? ?class = row->table->class;
> > + ? ?column_idx = column - class->columns;
> >
> > ? ? assert(row->new != NULL);
> > ? ? assert(column_idx < class->n_columns);
> > @@ -1782,8 +1789,15 @@ ovsdb_idl_txn_verify(const struct ovsdb_idl_row *row_,
> > ? ? ? ? ? ? ? ? ? ? ?const struct ovsdb_idl_column *column)
> > ?{
> > ? ? struct ovsdb_idl_row *row = (struct ovsdb_idl_row *) row_;
> > - ? ?const struct ovsdb_idl_table_class *class = row->table->class;
> > - ? ?size_t column_idx = column - class->columns;
> > + ? ?const struct ovsdb_idl_table_class *class;
> > + ? ?size_t column_idx;
> > +
> > + ? ?if (ovsdb_idl_row_is_synthetic(row)) {
> > + ? ? ? ?return;
> > + ? ?}
> > +
> > + ? ?class = row->table->class;
> > + ? ?column_idx = column - class->columns;
> >
> > ? ? assert(row->new != NULL);
> > ? ? assert(row->old == NULL ||
> > @@ -1815,6 +1829,10 @@ ovsdb_idl_txn_delete(const struct ovsdb_idl_row *row_)
> > ?{
> > ? ? struct ovsdb_idl_row *row = (struct ovsdb_idl_row *) row_;
> >
> > + ? ?if (ovsdb_idl_row_is_synthetic(row)) {
> > + ? ? ? ?return;
> > + ? ?}
> > +
> > ? ? assert(row->new != NULL);
> > ? ? if (!row->old) {
> > ? ? ? ? ovsdb_idl_row_unparse(row);
> > --
> > 1.7.2.5
> >
> >



More information about the dev mailing list